| 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 580 |
| 581 GrGLenum internalFormat; | 581 GrGLenum internalFormat; |
| 582 GrGLenum externalFormat = 0x0; // suprress warning | 582 GrGLenum externalFormat = 0x0; // suprress warning |
| 583 GrGLenum externalType = 0x0;// suprress warning | 583 GrGLenum externalType = 0x0;// suprress warning |
| 584 | 584 |
| 585 // glTexStorage requires sized internal formats on both desktop and ES. ES2
requires an unsized | 585 // glTexStorage requires sized internal formats on both desktop and ES. ES2
requires an unsized |
| 586 // format for glTexImage, unlike ES3 and desktop. However, we allow the driv
er to decide the | 586 // format for glTexImage, unlike ES3 and desktop. However, we allow the driv
er to decide the |
| 587 // size of the internal format whenever possible and so only use a sized int
ernal format when | 587 // size of the internal format whenever possible and so only use a sized int
ernal format when |
| 588 // using texture storage. | 588 // using texture storage. |
| 589 bool useSizedFormat = useTexStorage; | 589 bool useSizedFormat = useTexStorage; |
| 590 // At least some versions of the desktop ES3 drivers for NVIDIA won't accept
GL_RED in | 590 // At least some versions of the ES3 drivers for NVIDIA and IMG won't accept
GL_RED in |
| 591 // glTexImage2D for the internal format but will accept GL_R8. | 591 // glTexImage2D for the internal format but will accept GL_R8. |
| 592 if (!useSizedFormat && kNVIDIA_GrGLVendor == this->glContext().vendor() && | 592 if (kNVIDIA_GrGLVendor == this->glContext().vendor() || |
| 593 kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_GL_V
ER(3, 0)) { | 593 kImagination_GrGLVendor == this->glContext().vendor()) { |
| 594 useSizedFormat = true; | 594 if (kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_
GL_VER(3, 0)) { |
| 595 useSizedFormat = true; |
| 596 } |
| 595 } | 597 } |
| 596 if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat, | 598 if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat, |
| 597 &externalFormat, &externalType)) { | 599 &externalFormat, &externalType)) { |
| 598 return false; | 600 return false; |
| 599 } | 601 } |
| 600 | 602 |
| 601 /* | 603 /* |
| 602 * check whether to allocate a temporary buffer for flipping y or | 604 * check whether to allocate a temporary buffer for flipping y or |
| 603 * because our srcData has extra bytes past each row. If so, we need | 605 * because our srcData has extra bytes past each row. If so, we need |
| 604 * to trim those off here, since GL ES may not let us specify | 606 * to trim those off here, since GL ES may not let us specify |
| (...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2603 this->setVertexArrayID(gpu, 0); | 2605 this->setVertexArrayID(gpu, 0); |
| 2604 } | 2606 } |
| 2605 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2607 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2606 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2608 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2607 fDefaultVertexArrayAttribState.resize(attrCount); | 2609 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2608 } | 2610 } |
| 2609 attribState = &fDefaultVertexArrayAttribState; | 2611 attribState = &fDefaultVertexArrayAttribState; |
| 2610 } | 2612 } |
| 2611 return attribState; | 2613 return attribState; |
| 2612 } | 2614 } |
| OLD | NEW |