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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ES3 drivers for NVIDIA and IMG 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 (kNVIDIA_GrGLVendor == this->glContext().vendor() || | 592 if (kNVIDIA_GrGLVendor == this->glContext().vendor() || |
593 kImagination_GrGLVendor == this->glContext().vendor()) { | 593 kImagination_GrGLVendor == this->glContext().vendor()) { |
594 if (kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_
GL_VER(3, 0)) { | 594 if (kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_
GL_VER(3, 0) && |
| 595 kAlpha_8_GrPixelConfig == dataConfig) { |
595 useSizedFormat = true; | 596 useSizedFormat = true; |
596 } | 597 } |
597 } | 598 } |
598 if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat, | 599 if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat, |
599 &externalFormat, &externalType)) { | 600 &externalFormat, &externalType)) { |
600 return false; | 601 return false; |
601 } | 602 } |
602 | 603 |
603 /* | 604 /* |
604 * check whether to allocate a temporary buffer for flipping y or | 605 * check whether to allocate a temporary buffer for flipping y or |
(...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2605 this->setVertexArrayID(gpu, 0); | 2606 this->setVertexArrayID(gpu, 0); |
2606 } | 2607 } |
2607 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2608 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2608 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2609 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2609 fDefaultVertexArrayAttribState.resize(attrCount); | 2610 fDefaultVertexArrayAttribState.resize(attrCount); |
2610 } | 2611 } |
2611 attribState = &fDefaultVertexArrayAttribState; | 2612 attribState = &fDefaultVertexArrayAttribState; |
2612 } | 2613 } |
2613 return attribState; | 2614 return attribState; |
2614 } | 2615 } |
OLD | NEW |