Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: src/gpu/gl/GrGLCaps.cpp

Issue 1688233003: Add arb_texture_rectangle support properly in GLES3 shaders Base URL: https://skia.googlesource.com/skia.git@command-buffer-es3
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "GrGLCaps.h" 9 #include "GrGLCaps.h"
10 10
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (ctxInfo.hasExtension("GL_OES_EGL_image_external")) { 219 if (ctxInfo.hasExtension("GL_OES_EGL_image_external")) {
220 if (ctxInfo.glslGeneration() == k110_GrGLSLGeneration) { 220 if (ctxInfo.glslGeneration() == k110_GrGLSLGeneration) {
221 fExternalTextureSupport = true; 221 fExternalTextureSupport = true;
222 } else if (ctxInfo.hasExtension("GL_OES_EGL_image_external_essl3") || 222 } else if (ctxInfo.hasExtension("GL_OES_EGL_image_external_essl3") ||
223 ctxInfo.hasExtension("OES_EGL_image_external_essl3")) { 223 ctxInfo.hasExtension("OES_EGL_image_external_essl3")) {
224 // At least one driver has been found that has this extension withou t the "GL_" prefix. 224 // At least one driver has been found that has this extension withou t the "GL_" prefix.
225 fExternalTextureSupport = true; 225 fExternalTextureSupport = true;
226 } 226 }
227 } 227 }
228 228
229 if ((kGL_GrGLStandard == standard && version >= GR_GL_VER(3, 1)) ||
230 ctxInfo.hasExtension("GL_ARB_texture_rectangle")) {
231 // We also require textureSize() support for rectangle 2D samplers which was added in GLSL
232 // 1.40.
233 if (ctxInfo.glslGeneration() >= k140_GrGLSLGeneration) {
234 fRectangleTextureSupport = true;
235 }
236 }
237
238 if (kGL_GrGLStandard == standard) { 229 if (kGL_GrGLStandard == standard) {
230 if (version >= GR_GL_VER(3, 1) || ctxInfo.hasExtension("GL_ARB_texture_r ectangle")) {
231 // We also require textureSize() support for rectangle 2D samplers w hich was added in
232 // GLSL 1.40.
233 if (ctxInfo.glslGeneration() >= k140_GrGLSLGeneration) {
234 fRectangleTextureSupport = true;
235 }
236 }
237 } else {
238 // Command buffer exposes this in GL ES context for Chromium reasons,
239 // but it should not be used. Also, at the time of writing command buffe r
240 // lacks TexImage2D support and ANGLE lacks GL ES 3.0 support.
241 fRectangleTextureSupport = ctxInfo.hasExtension("GL_ARB_texture_rectangl e");
242 }
243
244 if (kGL_GrGLStandard == standard) {
239 if (version >= GR_GL_VER(3,3) || ctxInfo.hasExtension("GL_ARB_texture_sw izzle")) { 245 if (version >= GR_GL_VER(3,3) || ctxInfo.hasExtension("GL_ARB_texture_sw izzle")) {
240 fTextureSwizzleSupport = true; 246 fTextureSwizzleSupport = true;
241 } 247 }
242 } else { 248 } else {
243 if (version >= GR_GL_VER(3,0)) { 249 if (version >= GR_GL_VER(3,0)) {
244 fTextureSwizzleSupport = true; 250 fTextureSwizzleSupport = true;
245 } 251 }
246 } 252 }
247 253
248 #ifdef SK_BUILD_FOR_WIN 254 #ifdef SK_BUILD_FOR_WIN
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 glslCaps->fSecondaryOutputExtensionString = "GL_EXT_blend_func_extended" ; 631 glslCaps->fSecondaryOutputExtensionString = "GL_EXT_blend_func_extended" ;
626 } 632 }
627 633
628 if (fExternalTextureSupport) { 634 if (fExternalTextureSupport) {
629 if (ctxInfo.glslGeneration() == k110_GrGLSLGeneration) { 635 if (ctxInfo.glslGeneration() == k110_GrGLSLGeneration) {
630 glslCaps->fExternalTextureExtensionString = "GL_OES_EGL_image_extern al"; 636 glslCaps->fExternalTextureExtensionString = "GL_OES_EGL_image_extern al";
631 } else { 637 } else {
632 glslCaps->fExternalTextureExtensionString = "GL_OES_EGL_image_extern al_essl3"; 638 glslCaps->fExternalTextureExtensionString = "GL_OES_EGL_image_extern al_essl3";
633 } 639 }
634 } 640 }
641 if (fRectangleTextureSupport) {
642 if (kGL_GrGLStandard == standard) {
643 // "Conceptually, you can consider the declaration
644 // #extension GL_ARB_texture_rectangle : require, to allow support
645 // for texture rectangles, to be implicitly prepended to every
646 // GLSL shader when ARB_texture_rectangle is advertised."
647 // --> glslCaps->fRectangleTextureExtensionString == nullptr.
648 glslCaps->fRectangleTextureUseUnifiedTextureFunctionName =
649 ctxInfo.glslGeneration() >= k130_GrGLSLGeneration;
650 } else {
651 //"All future GLSL extensions should follow the "OpenGL Shading Lang uage
652 // Extension Conventions" however."
653 // We imagine ANGLE implementation allowing ARB_texture_rectangle be ing
654 // based on an extension text requires the extension string.
655 glslCaps->fRectangleTextureExtensionString = "GL_ARB_texture_rectang le";
656 glslCaps->fRectangleTextureUseUnifiedTextureFunctionName =
657 ctxInfo.glslGeneration() == k330_GrGLSLGeneration;
658 }
659 }
635 660
636 // The Tegra3 compiler will sometimes never return if we have min(abs(x), 1. 0), so we must do 661 // The Tegra3 compiler will sometimes never return if we have min(abs(x), 1. 0), so we must do
637 // the abs first in a separate expression. 662 // the abs first in a separate expression.
638 if (kTegra3_GrGLRenderer == ctxInfo.renderer()) { 663 if (kTegra3_GrGLRenderer == ctxInfo.renderer()) {
639 glslCaps->fCanUseMinAndAbsTogether = false; 664 glslCaps->fCanUseMinAndAbsTogether = false;
640 } 665 }
641 666
642 // On Intel GPU there is an issue where it reads the second argument to atan "- %s.x" as an int 667 // On Intel GPU there is an issue where it reads the second argument to atan "- %s.x" as an int
643 // thus must us -1.0 * %s.x to work correctly 668 // thus must us -1.0 * %s.x to work correctly
644 if (kIntel_GrGLVendor == ctxInfo.vendor()) { 669 if (kIntel_GrGLVendor == ctxInfo.vendor()) {
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 for (int j = 0; j < kExternalFormatUsageCnt; ++j) { 1689 for (int j = 0; j < kExternalFormatUsageCnt; ++j) {
1665 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] != 1690 SkASSERT(defaultEntry.fFormats.fExternalFormat[j] !=
1666 fConfigTable[i].fFormats.fExternalFormat[j]); 1691 fConfigTable[i].fFormats.fExternalFormat[j]);
1667 } 1692 }
1668 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType); 1693 SkASSERT(defaultEntry.fFormats.fExternalType != fConfigTable[i].fFormats .fExternalType);
1669 } 1694 }
1670 #endif 1695 #endif
1671 } 1696 }
1672 1697
1673 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {} 1698 void GrGLCaps::onApplyOptionsOverrides(const GrContextOptions& options) {}
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698