Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: src/gpu/gl/GrGpuGL.cpp

Issue 62163004: Added support for Chrome's gpu command buffer extension BindUniformLocation. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #include "GrGpuGL.h" 9 #include "GrGpuGL.h"
10 #include "GrGLStencilBuffer.h" 10 #include "GrGLStencilBuffer.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 : GrGpu(context) 116 : GrGpu(context)
117 , fGLContext(ctx) { 117 , fGLContext(ctx) {
118 118
119 SkASSERT(ctx.isInitialized()); 119 SkASSERT(ctx.isInitialized());
120 120
121 fCaps.reset(SkRef(ctx.info().caps())); 121 fCaps.reset(SkRef(ctx.info().caps()));
122 122
123 fHWBoundTextures.reset(ctx.info().caps()->maxFragmentTextureUnits()); 123 fHWBoundTextures.reset(ctx.info().caps()->maxFragmentTextureUnits());
124 fHWTexGenSettings.reset(ctx.info().caps()->maxFixedFunctionTextureCoords()); 124 fHWTexGenSettings.reset(ctx.info().caps()->maxFixedFunctionTextureCoords());
125 125
126 #ifdef SK_DEBUG
bsalomon 2013/11/07 15:06:59 Can we make this and the other changes in this fil
slavi 2013/11/07 20:53:29 Done.
126 GrGLClearErr(fGLContext.interface()); 127 GrGLClearErr(fGLContext.interface());
128 #endif
127 129
128 if (gPrintStartupSpew) { 130 if (gPrintStartupSpew) {
129 const GrGLubyte* vendor; 131 const GrGLubyte* vendor;
130 const GrGLubyte* renderer; 132 const GrGLubyte* renderer;
131 const GrGLubyte* version; 133 const GrGLubyte* version;
132 GL_CALL_RET(vendor, GetString(GR_GL_VENDOR)); 134 GL_CALL_RET(vendor, GetString(GR_GL_VENDOR));
133 GL_CALL_RET(renderer, GetString(GR_GL_RENDERER)); 135 GL_CALL_RET(renderer, GetString(GR_GL_RENDERER));
134 GL_CALL_RET(version, GetString(GR_GL_VERSION)); 136 GL_CALL_RET(version, GetString(GR_GL_VERSION));
135 GrPrintf("------------------------- create GrGpuGL %p --------------\n", 137 GrPrintf("------------------------- create GrGpuGL %p --------------\n",
136 this); 138 this);
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 desc->fSampleCnt, 805 desc->fSampleCnt,
804 msColorFormat, 806 msColorFormat,
805 width, height)) { 807 width, height)) {
806 goto FAILED; 808 goto FAILED;
807 } 809 }
808 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fRTFBOID)); 810 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fRTFBOID));
809 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, 811 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
810 GR_GL_COLOR_ATTACHMENT0, 812 GR_GL_COLOR_ATTACHMENT0,
811 GR_GL_RENDERBUFFER, 813 GR_GL_RENDERBUFFER,
812 desc->fMSColorRenderbufferID)); 814 desc->fMSColorRenderbufferID));
815 #ifdef SK_DEBUG
813 if (desc->fCheckAllocation || 816 if (desc->fCheckAllocation ||
814 !this->glCaps().isConfigVerifiedColorAttachment(desc->fConfig)) { 817 !this->glCaps().isConfigVerifiedColorAttachment(desc->fConfig)) {
815 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); 818 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
816 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { 819 if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
817 goto FAILED; 820 goto FAILED;
818 } 821 }
819 fGLContext.info().caps()->markConfigAsValidColorAttachment(desc->fCo nfig); 822 fGLContext.info().caps()->markConfigAsValidColorAttachment(desc->fCo nfig);
820 } 823 }
824 #endif
821 } 825 }
822 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fTexFBOID)); 826 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, desc->fTexFBOID));
823 827
824 if (this->glCaps().usesImplicitMSAAResolve() && desc->fSampleCnt > 0) { 828 if (this->glCaps().usesImplicitMSAAResolve() && desc->fSampleCnt > 0) {
825 GL_CALL(FramebufferTexture2DMultisample(GR_GL_FRAMEBUFFER, 829 GL_CALL(FramebufferTexture2DMultisample(GR_GL_FRAMEBUFFER,
826 GR_GL_COLOR_ATTACHMENT0, 830 GR_GL_COLOR_ATTACHMENT0,
827 GR_GL_TEXTURE_2D, 831 GR_GL_TEXTURE_2D,
828 texID, 0, desc->fSampleCnt)); 832 texID, 0, desc->fSampleCnt));
829 } else { 833 } else {
830 GL_CALL(FramebufferTexture2D(GR_GL_FRAMEBUFFER, 834 GL_CALL(FramebufferTexture2D(GR_GL_FRAMEBUFFER,
831 GR_GL_COLOR_ATTACHMENT0, 835 GR_GL_COLOR_ATTACHMENT0,
832 GR_GL_TEXTURE_2D, 836 GR_GL_TEXTURE_2D,
833 texID, 0)); 837 texID, 0));
834 } 838 }
839
840 #ifdef SK_DEBUG
835 if (desc->fCheckAllocation || 841 if (desc->fCheckAllocation ||
836 !this->glCaps().isConfigVerifiedColorAttachment(desc->fConfig)) { 842 !this->glCaps().isConfigVerifiedColorAttachment(desc->fConfig)) {
837 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); 843 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
838 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { 844 if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
839 goto FAILED; 845 goto FAILED;
840 } 846 }
841 fGLContext.info().caps()->markConfigAsValidColorAttachment(desc->fConfig ); 847 fGLContext.info().caps()->markConfigAsValidColorAttachment(desc->fConfig );
842 } 848 }
849 #endif
843 850
844 return true; 851 return true;
845 852
846 FAILED: 853 FAILED:
847 if (desc->fMSColorRenderbufferID) { 854 if (desc->fMSColorRenderbufferID) {
848 GL_CALL(DeleteRenderbuffers(1, &desc->fMSColorRenderbufferID)); 855 GL_CALL(DeleteRenderbuffers(1, &desc->fMSColorRenderbufferID));
849 } 856 }
850 if (desc->fRTFBOID != desc->fTexFBOID) { 857 if (desc->fRTFBOID != desc->fTexFBOID) {
851 GL_CALL(DeleteFramebuffers(1, &desc->fRTFBOID)); 858 GL_CALL(DeleteFramebuffers(1, &desc->fRTFBOID));
852 } 859 }
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 if (glsb->format().fPacked) { 1120 if (glsb->format().fPacked) {
1114 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, 1121 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
1115 GR_GL_DEPTH_ATTACHMENT, 1122 GR_GL_DEPTH_ATTACHMENT,
1116 GR_GL_RENDERBUFFER, rb)); 1123 GR_GL_RENDERBUFFER, rb));
1117 } else { 1124 } else {
1118 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, 1125 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
1119 GR_GL_DEPTH_ATTACHMENT, 1126 GR_GL_DEPTH_ATTACHMENT,
1120 GR_GL_RENDERBUFFER, 0)); 1127 GR_GL_RENDERBUFFER, 0));
1121 } 1128 }
1122 1129
1130 #ifdef SK_DEBUG
1123 GrGLenum status; 1131 GrGLenum status;
1124 if (!this->glCaps().isColorConfigAndStencilFormatVerified(rt->config(), glsb->format())) { 1132 if (!this->glCaps().isColorConfigAndStencilFormatVerified(rt->config(), glsb->format())) {
1125 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); 1133 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER));
1126 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { 1134 if (status != GR_GL_FRAMEBUFFER_COMPLETE) {
1127 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, 1135 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
1128 GR_GL_STENCIL_ATTACHMENT, 1136 GR_GL_STENCIL_ATTACHMENT,
1129 GR_GL_RENDERBUFFER, 0)); 1137 GR_GL_RENDERBUFFER, 0));
1130 if (glsb->format().fPacked) { 1138 if (glsb->format().fPacked) {
1131 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER, 1139 GL_CALL(FramebufferRenderbuffer(GR_GL_FRAMEBUFFER,
1132 GR_GL_DEPTH_ATTACHMENT, 1140 GR_GL_DEPTH_ATTACHMENT,
1133 GR_GL_RENDERBUFFER, 0)); 1141 GR_GL_RENDERBUFFER, 0));
1134 } 1142 }
1135 return false; 1143 return false;
1136 } else { 1144 } else {
1137 fGLContext.info().caps()->markColorConfigAndStencilFormatAsVerif ied( 1145 fGLContext.info().caps()->markColorConfigAndStencilFormatAsVerif ied(
1138 rt->config(), 1146 rt->config(),
1139 glsb->format()); 1147 glsb->format());
1140 } 1148 }
1141 } 1149 }
1150 #endif
1142 return true; 1151 return true;
1143 } 1152 }
1144 } 1153 }
1145 1154
1146 //////////////////////////////////////////////////////////////////////////////// 1155 ////////////////////////////////////////////////////////////////////////////////
1147 1156
1148 GrVertexBuffer* GrGpuGL::onCreateVertexBuffer(size_t size, bool dynamic) { 1157 GrVertexBuffer* GrGpuGL::onCreateVertexBuffer(size_t size, bool dynamic) {
1149 GrGLVertexBuffer::Desc desc; 1158 GrGLVertexBuffer::Desc desc;
1150 desc.fDynamic = dynamic; 1159 desc.fDynamic = dynamic;
1151 desc.fSizeInBytes = size; 1160 desc.fSizeInBytes = size;
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after
2684 this->setVertexArrayID(gpu, 0); 2693 this->setVertexArrayID(gpu, 0);
2685 } 2694 }
2686 int attrCount = gpu->glCaps().maxVertexAttributes(); 2695 int attrCount = gpu->glCaps().maxVertexAttributes();
2687 if (fDefaultVertexArrayAttribState.count() != attrCount) { 2696 if (fDefaultVertexArrayAttribState.count() != attrCount) {
2688 fDefaultVertexArrayAttribState.resize(attrCount); 2697 fDefaultVertexArrayAttribState.resize(attrCount);
2689 } 2698 }
2690 attribState = &fDefaultVertexArrayAttribState; 2699 attribState = &fDefaultVertexArrayAttribState;
2691 } 2700 }
2692 return attribState; 2701 return attribState;
2693 } 2702 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698