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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 | 556 |
557 GrGLenum internalFormat; | 557 GrGLenum internalFormat; |
558 GrGLenum externalFormat = 0x0; // suprress warning | 558 GrGLenum externalFormat = 0x0; // suprress warning |
559 GrGLenum externalType = 0x0;// suprress warning | 559 GrGLenum externalType = 0x0;// suprress warning |
560 | 560 |
561 // glTexStorage requires sized internal formats on both desktop and ES. ES2
requires an unsized | 561 // glTexStorage requires sized internal formats on both desktop and ES. ES2
requires an unsized |
562 // format for glTexImage, unlike ES3 and desktop. However, we allow the driv
er to decide the | 562 // format for glTexImage, unlike ES3 and desktop. However, we allow the driv
er to decide the |
563 // size of the internal format whenever possible and so only use a sized int
ernal format when | 563 // size of the internal format whenever possible and so only use a sized int
ernal format when |
564 // using texture storage. | 564 // using texture storage. |
565 bool useSizedFormat = useTexStorage; | 565 bool useSizedFormat = useTexStorage; |
566 // At least some versions of the ES3 drivers for NVIDIA and IMG won't accept
GL_RED in | 566 // Many versions of the ES3 drivers on various platforms will not accept GL_
RED in |
567 // glTexImage2D for the internal format but will accept GL_R8. | 567 // glTexImage2D for the internal format but will accept GL_R8. |
568 if (kNVIDIA_GrGLVendor == this->glContext().vendor() || | 568 if (kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_GL_V
ER(3, 0) && |
569 kImagination_GrGLVendor == this->glContext().vendor() || | 569 kAlpha_8_GrPixelConfig == dataConfig) { |
570 this->glContext().isMesa()) { | 570 useSizedFormat = true; |
571 if (kGLES_GrGLStandard == this->glStandard() && this->glVersion() >= GR_
GL_VER(3, 0) && | |
572 kAlpha_8_GrPixelConfig == dataConfig) { | |
573 useSizedFormat = true; | |
574 } | |
575 } | 571 } |
576 if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat, | 572 if (!this->configToGLFormats(dataConfig, useSizedFormat, &internalFormat, |
577 &externalFormat, &externalType)) { | 573 &externalFormat, &externalType)) { |
578 return false; | 574 return false; |
579 } | 575 } |
580 | 576 |
581 /* | 577 /* |
582 * check whether to allocate a temporary buffer for flipping y or | 578 * check whether to allocate a temporary buffer for flipping y or |
583 * because our srcData has extra bytes past each row. If so, we need | 579 * because our srcData has extra bytes past each row. If so, we need |
584 * to trim those off here, since GL ES may not let us specify | 580 * to trim those off here, since GL ES may not let us specify |
(...skipping 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2587 this->setVertexArrayID(gpu, 0); | 2583 this->setVertexArrayID(gpu, 0); |
2588 } | 2584 } |
2589 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2585 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2590 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2586 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2591 fDefaultVertexArrayAttribState.resize(attrCount); | 2587 fDefaultVertexArrayAttribState.resize(attrCount); |
2592 } | 2588 } |
2593 attribState = &fDefaultVertexArrayAttribState; | 2589 attribState = &fDefaultVertexArrayAttribState; |
2594 } | 2590 } |
2595 return attribState; | 2591 return attribState; |
2596 } | 2592 } |
OLD | NEW |