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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 // 565 is not a sized internal format on desktop GL. So on desktop with | 603 // 565 is not a sized internal format on desktop GL. So on desktop with |
604 // 565 we always use an unsized internal format to let the system pick | 604 // 565 we always use an unsized internal format to let the system pick |
605 // the best sized format to convert the 565 data to. Since TexStorage | 605 // the best sized format to convert the 565 data to. Since TexStorage |
606 // only allows sized internal formats we will instead use TexImage2D. | 606 // only allows sized internal formats we will instead use TexImage2D. |
607 useTexStorage = desc.fConfig != kRGB_565_GrPixelConfig; | 607 useTexStorage = desc.fConfig != kRGB_565_GrPixelConfig; |
608 } | 608 } |
609 | 609 |
610 GrGLenum internalFormat; | 610 GrGLenum internalFormat; |
611 GrGLenum externalFormat; | 611 GrGLenum externalFormat; |
612 GrGLenum externalType; | 612 GrGLenum externalType; |
613 // glTexStorage requires sized internal formats on both desktop and ES. ES | 613 // glTexStorage requires sized internal formats on both desktop and ES. ES2 |
614 // glTexImage requires an unsized format. | 614 // requires an unsized format for glTexImage. ES3 has relaxed this restricti
on. |
615 if (!this->configToGLFormats(dataConfig, useTexStorage, &internalFormat, | 615 // Qualcomm Adreno drivers seem to have issues with the relaxed ES3 rules. |
| 616 bool useSizedInternalFormat = useTexStorage || |
| 617 kDesktop_GrGLBinding == this->glBinding() || |
| 618 (this->glVersion() >= GR_GL_VER(3,0) && |
| 619 kQualcomm_GrGLVendor != this->glContext().inf
o().vendor()); |
| 620 if (!this->configToGLFormats(dataConfig, useSizedInternalFormat, &internalFo
rmat, |
616 &externalFormat, &externalType)) { | 621 &externalFormat, &externalType)) { |
617 return false; | 622 return false; |
618 } | 623 } |
619 | 624 |
620 if (!isNewTexture && GR_GL_PALETTE8_RGBA8 == internalFormat) { | 625 if (!isNewTexture && GR_GL_PALETTE8_RGBA8 == internalFormat) { |
621 // paletted textures cannot be updated | 626 // paletted textures cannot be updated |
622 return false; | 627 return false; |
623 } | 628 } |
624 | 629 |
625 /* | 630 /* |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 // If we are using multisampling we will create two FBOS. We render to one a
nd then resolve to | 807 // If we are using multisampling we will create two FBOS. We render to one a
nd then resolve to |
803 // the texture bound to the other. The exception is the IMG multisample exte
nsion. With this | 808 // the texture bound to the other. The exception is the IMG multisample exte
nsion. With this |
804 // extension the texture is multisampled when rendered to and then auto-reso
lves it when it is | 809 // extension the texture is multisampled when rendered to and then auto-reso
lves it when it is |
805 // rendered from. | 810 // rendered from. |
806 if (desc->fSampleCnt > 0 && this->glCaps().usesMSAARenderBuffers()) { | 811 if (desc->fSampleCnt > 0 && this->glCaps().usesMSAARenderBuffers()) { |
807 GL_CALL(GenFramebuffers(1, &desc->fRTFBOID)); | 812 GL_CALL(GenFramebuffers(1, &desc->fRTFBOID)); |
808 GL_CALL(GenRenderbuffers(1, &desc->fMSColorRenderbufferID)); | 813 GL_CALL(GenRenderbuffers(1, &desc->fMSColorRenderbufferID)); |
809 if (!desc->fRTFBOID || | 814 if (!desc->fRTFBOID || |
810 !desc->fMSColorRenderbufferID || | 815 !desc->fMSColorRenderbufferID || |
811 !this->configToGLFormats(desc->fConfig, | 816 !this->configToGLFormats(desc->fConfig, |
812 // GLES requires sized internal formats | 817 // ES2 and ES3 require sized internal forma
ts for rb storage. |
813 kES_GrGLBinding == this->glBinding(), | 818 kES_GrGLBinding == this->glBinding(), |
814 &msColorFormat, | 819 &msColorFormat, |
815 NULL, | 820 NULL, |
816 NULL)) { | 821 NULL)) { |
817 goto FAILED; | 822 goto FAILED; |
818 } | 823 } |
819 } else { | 824 } else { |
820 desc->fRTFBOID = desc->fTexFBOID; | 825 desc->fRTFBOID = desc->fTexFBOID; |
821 } | 826 } |
822 | 827 |
(...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2552 this->setVertexArrayID(gpu, 0); | 2557 this->setVertexArrayID(gpu, 0); |
2553 } | 2558 } |
2554 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2559 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2555 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2560 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2556 fDefaultVertexArrayAttribState.resize(attrCount); | 2561 fDefaultVertexArrayAttribState.resize(attrCount); |
2557 } | 2562 } |
2558 attribState = &fDefaultVertexArrayAttribState; | 2563 attribState = &fDefaultVertexArrayAttribState; |
2559 } | 2564 } |
2560 return attribState; | 2565 return attribState; |
2561 } | 2566 } |
OLD | NEW |