| 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
requires an unsized |
| 614 // glTexImage requires an unsized format. | 614 // format for glTexImage, unlike ES3 and desktop. However, we allow the driv
er to decide the |
| 615 // size of the internal format whenever possible and so only use a sized int
ernal format when |
| 616 // using texture storage. |
| 615 if (!this->configToGLFormats(dataConfig, useTexStorage, &internalFormat, | 617 if (!this->configToGLFormats(dataConfig, useTexStorage, &internalFormat, |
| 616 &externalFormat, &externalType)) { | 618 &externalFormat, &externalType)) { |
| 617 return false; | 619 return false; |
| 618 } | 620 } |
| 619 | 621 |
| 620 if (!isNewTexture && GR_GL_PALETTE8_RGBA8 == internalFormat) { | 622 if (!isNewTexture && GR_GL_PALETTE8_RGBA8 == internalFormat) { |
| 621 // paletted textures cannot be updated | 623 // paletted textures cannot be updated |
| 622 return false; | 624 return false; |
| 623 } | 625 } |
| 624 | 626 |
| (...skipping 177 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 | 804 // 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 | 805 // 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 | 806 // extension the texture is multisampled when rendered to and then auto-reso
lves it when it is |
| 805 // rendered from. | 807 // rendered from. |
| 806 if (desc->fSampleCnt > 0 && this->glCaps().usesMSAARenderBuffers()) { | 808 if (desc->fSampleCnt > 0 && this->glCaps().usesMSAARenderBuffers()) { |
| 807 GL_CALL(GenFramebuffers(1, &desc->fRTFBOID)); | 809 GL_CALL(GenFramebuffers(1, &desc->fRTFBOID)); |
| 808 GL_CALL(GenRenderbuffers(1, &desc->fMSColorRenderbufferID)); | 810 GL_CALL(GenRenderbuffers(1, &desc->fMSColorRenderbufferID)); |
| 809 if (!desc->fRTFBOID || | 811 if (!desc->fRTFBOID || |
| 810 !desc->fMSColorRenderbufferID || | 812 !desc->fMSColorRenderbufferID || |
| 811 !this->configToGLFormats(desc->fConfig, | 813 !this->configToGLFormats(desc->fConfig, |
| 812 // GLES requires sized internal formats | 814 // ES2 and ES3 require sized internal forma
ts for rb storage. |
| 813 kES_GrGLBinding == this->glBinding(), | 815 kES_GrGLBinding == this->glBinding(), |
| 814 &msColorFormat, | 816 &msColorFormat, |
| 815 NULL, | 817 NULL, |
| 816 NULL)) { | 818 NULL)) { |
| 817 goto FAILED; | 819 goto FAILED; |
| 818 } | 820 } |
| 819 } else { | 821 } else { |
| 820 desc->fRTFBOID = desc->fTexFBOID; | 822 desc->fRTFBOID = desc->fTexFBOID; |
| 821 } | 823 } |
| 822 | 824 |
| (...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2552 this->setVertexArrayID(gpu, 0); | 2554 this->setVertexArrayID(gpu, 0); |
| 2553 } | 2555 } |
| 2554 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2556 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2555 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2557 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2556 fDefaultVertexArrayAttribState.resize(attrCount); | 2558 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2557 } | 2559 } |
| 2558 attribState = &fDefaultVertexArrayAttribState; | 2560 attribState = &fDefaultVertexArrayAttribState; |
| 2559 } | 2561 } |
| 2560 return attribState; | 2562 return attribState; |
| 2561 } | 2563 } |
| OLD | NEW |