OLD | NEW |
---|---|
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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
924 desc.fSampleCnt) { | 924 desc.fSampleCnt) { |
925 //GrPrintf("MSAA RT requested but not supported on this platform."); | 925 //GrPrintf("MSAA RT requested but not supported on this platform."); |
926 return return_null_texture(); | 926 return return_null_texture(); |
927 } | 927 } |
928 | 928 |
929 if (renderTarget) { | 929 if (renderTarget) { |
930 int maxRTSize = this->caps()->maxRenderTargetSize(); | 930 int maxRTSize = this->caps()->maxRenderTargetSize(); |
931 if (glTexDesc.fWidth > maxRTSize || glTexDesc.fHeight > maxRTSize) { | 931 if (glTexDesc.fWidth > maxRTSize || glTexDesc.fHeight > maxRTSize) { |
932 return return_null_texture(); | 932 return return_null_texture(); |
933 } | 933 } |
934 } else { | |
sugoi1
2013/05/02 21:14:32
Since we were only checking texture sizes when cre
| |
935 int maxSize = this->caps()->maxTextureSize(); | |
936 if (glTexDesc.fWidth > maxSize || glTexDesc.fHeight > maxSize) { | |
937 return return_null_texture(); | |
938 } | |
934 } | 939 } |
935 | 940 |
936 GL_CALL(GenTextures(1, &glTexDesc.fTextureID)); | 941 GL_CALL(GenTextures(1, &glTexDesc.fTextureID)); |
937 if (renderTarget && this->glCaps().textureUsageSupport()) { | 942 if (renderTarget && this->glCaps().textureUsageSupport()) { |
938 // provides a hint about how this texture will be used | 943 // provides a hint about how this texture will be used |
939 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, | 944 GL_CALL(TexParameteri(GR_GL_TEXTURE_2D, |
940 GR_GL_TEXTURE_USAGE, | 945 GR_GL_TEXTURE_USAGE, |
941 GR_GL_FRAMEBUFFER_ATTACHMENT)); | 946 GR_GL_FRAMEBUFFER_ATTACHMENT)); |
942 } | 947 } |
943 if (!glTexDesc.fTextureID) { | 948 if (!glTexDesc.fTextureID) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
997 glTexDesc.fTextureID, desc.fWidth, desc.fHeight, desc.fConfig); | 1002 glTexDesc.fTextureID, desc.fWidth, desc.fHeight, desc.fConfig); |
998 #endif | 1003 #endif |
999 return tex; | 1004 return tex; |
1000 } | 1005 } |
1001 | 1006 |
1002 namespace { | 1007 namespace { |
1003 | 1008 |
1004 const GrGLuint kUnknownBitCount = GrGLStencilBuffer::kUnknownBitCount; | 1009 const GrGLuint kUnknownBitCount = GrGLStencilBuffer::kUnknownBitCount; |
1005 | 1010 |
1006 void inline get_stencil_rb_sizes(const GrGLInterface* gl, | 1011 void inline get_stencil_rb_sizes(const GrGLInterface* gl, |
1007 GrGLuint rb, | |
sugoi1
2013/05/02 21:14:32
Removed an unused parameter
| |
1008 GrGLStencilBuffer::Format* format) { | 1012 GrGLStencilBuffer::Format* format) { |
1013 | |
1009 // we shouldn't ever know one size and not the other | 1014 // we shouldn't ever know one size and not the other |
1010 GrAssert((kUnknownBitCount == format->fStencilBits) == | 1015 GrAssert((kUnknownBitCount == format->fStencilBits) == |
1011 (kUnknownBitCount == format->fTotalBits)); | 1016 (kUnknownBitCount == format->fTotalBits)); |
1012 if (kUnknownBitCount == format->fStencilBits) { | 1017 if (kUnknownBitCount == format->fStencilBits) { |
1013 GR_GL_GetRenderbufferParameteriv(gl, GR_GL_RENDERBUFFER, | 1018 GR_GL_GetRenderbufferParameteriv(gl, GR_GL_RENDERBUFFER, |
1014 GR_GL_RENDERBUFFER_STENCIL_SIZE, | 1019 GR_GL_RENDERBUFFER_STENCIL_SIZE, |
1015 (GrGLint*)&format->fStencilBits); | 1020 (GrGLint*)&format->fStencilBits); |
1016 if (format->fPacked) { | 1021 if (format->fPacked) { |
1017 GR_GL_GetRenderbufferParameteriv(gl, GR_GL_RENDERBUFFER, | 1022 GR_GL_GetRenderbufferParameteriv(gl, GR_GL_RENDERBUFFER, |
1018 GR_GL_RENDERBUFFER_DEPTH_SIZE, | 1023 GR_GL_RENDERBUFFER_DEPTH_SIZE, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1064 RenderbufferStorage(GR_GL_RENDERBUFFER, | 1069 RenderbufferStorage(GR_GL_RENDERBUFFER, |
1065 sFmt.fInternalFormat, | 1070 sFmt.fInternalFormat, |
1066 width, height)); | 1071 width, height)); |
1067 created = | 1072 created = |
1068 (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(this->glInterface())); | 1073 (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(this->glInterface())); |
1069 } | 1074 } |
1070 if (created) { | 1075 if (created) { |
1071 // After sized formats we attempt an unsized format and take | 1076 // After sized formats we attempt an unsized format and take |
1072 // whatever sizes GL gives us. In that case we query for the size. | 1077 // whatever sizes GL gives us. In that case we query for the size. |
1073 GrGLStencilBuffer::Format format = sFmt; | 1078 GrGLStencilBuffer::Format format = sFmt; |
1074 get_stencil_rb_sizes(this->glInterface(), sbID, &format); | 1079 get_stencil_rb_sizes(this->glInterface(), &format); |
1075 static const bool kIsWrapped = false; | 1080 static const bool kIsWrapped = false; |
1076 SkAutoTUnref<GrStencilBuffer> sb(SkNEW_ARGS(GrGLStencilBuffer, | 1081 SkAutoTUnref<GrStencilBuffer> sb(SkNEW_ARGS(GrGLStencilBuffer, |
1077 (this, kIsWrapped, sbID, width , height, | 1082 (this, kIsWrapped, sbID, width , height, |
1078 samples, format))); | 1083 samples, format))); |
1079 if (this->attachStencilBufferToRenderTarget(sb, rt)) { | 1084 if (this->attachStencilBufferToRenderTarget(sb, rt)) { |
1080 fLastSuccessfulStencilFmtIdx = sIdx; | 1085 fLastSuccessfulStencilFmtIdx = sIdx; |
1081 sb->transferToCache(); | 1086 sb->transferToCache(); |
1082 rt->setStencilBuffer(sb); | 1087 rt->setStencilBuffer(sb); |
1083 return true; | 1088 return true; |
1084 } | 1089 } |
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2502 this->setVertexArrayID(gpu, 0); | 2507 this->setVertexArrayID(gpu, 0); |
2503 } | 2508 } |
2504 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2509 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2505 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2510 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2506 fDefaultVertexArrayAttribState.resize(attrCount); | 2511 fDefaultVertexArrayAttribState.resize(attrCount); |
2507 } | 2512 } |
2508 attribState = &fDefaultVertexArrayAttribState; | 2513 attribState = &fDefaultVertexArrayAttribState; |
2509 } | 2514 } |
2510 return attribState; | 2515 return attribState; |
2511 } | 2516 } |
OLD | NEW |