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

Unified Diff: src/gpu/glsl/GrGLSL.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.cpp ('k') | src/gpu/glsl/GrGLSLCaps.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/glsl/GrGLSL.h
diff --git a/src/gpu/glsl/GrGLSL.h b/src/gpu/glsl/GrGLSL.h
index 6fc8f83c7a3ca1be80fada8a9ef72a12d923ca02..e7b5cfac1595ec63e240fbc03341071821afb9e9 100644
--- a/src/gpu/glsl/GrGLSL.h
+++ b/src/gpu/glsl/GrGLSL.h
@@ -10,37 +10,7 @@
#include "GrTypesPriv.h"
#include "SkString.h"
-
-class GrGLSLCaps;
-
-// Limited set of GLSL versions we build shaders for. Caller should round
-// down the GLSL version to one of these enums.
-enum GrGLSLGeneration {
- /**
- * Desktop GLSL 1.10 and ES2 shading language (based on desktop GLSL 1.20)
- */
- k110_GrGLSLGeneration,
- /**
- * Desktop GLSL 1.30
- */
- k130_GrGLSLGeneration,
- /**
- * Desktop GLSL 1.40
- */
- k140_GrGLSLGeneration,
- /**
- * Desktop GLSL 1.50
- */
- k150_GrGLSLGeneration,
- /**
- * Desktop GLSL 3.30, and ES GLSL 3.00
- */
- k330_GrGLSLGeneration,
- /**
- * ES GLSL 3.10 only TODO Make GLSLCap objects to make this more granular
- */
- k310es_GrGLSLGeneration,
-};
+#include "GrGLSLCaps.h"
bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration);
@@ -49,7 +19,7 @@ bool GrGLSLSupportsNamedFragmentShaderOutputs(GrGLSLGeneration);
* to indicate whether the texture is sampled using projective textured (kVec3f) or not (kVec2f).
*/
inline const char* GrGLSLTexture2DFunctionName(GrSLType coordType, GrSLType samplerType,
- GrGLSLGeneration glslGen) {
+ const GrGLSLCaps& glslCaps) {
SkASSERT(GrSLTypeIsSamplerType(samplerType));
SkASSERT(kVec2f_GrSLType == coordType || kVec3f_GrSLType == coordType);
// GL_TEXTURE_RECTANGLE_ARB is written against OpenGL 2.0/GLSL 1.10. At that time there were
@@ -58,14 +28,23 @@ inline const char* GrGLSLTexture2DFunctionName(GrSLType coordType, GrSLType samp
// standard in OpenGL 3.2/GLSL 1.50 and use texture(). It isn't completely clear what function
// should be used for RECTANGLE textures in GLSL versions >= 1.30 && < 1.50. We're going with
// using texture().
- if (glslGen >= k130_GrGLSLGeneration) {
- return (kVec2f_GrSLType == coordType) ? "texture" : "textureProj";
+ if (samplerType == kSampler2DRect_GrSLType &&
+ !glslCaps.rectangleTextureUseUnifiedTextureFunctionName()) {
+ if (kVec2f_GrSLType == coordType) {
+ return "texture2DRect";
+ }
+ return "texture2DRectProj";
+ }
+ if (glslCaps.generation() >= k130_GrGLSLGeneration) {
+ if (kVec2f_GrSLType == coordType) {
+ return "texture";
+ }
+ return "textureProj";
}
if (kVec2f_GrSLType == coordType) {
- return (samplerType == kSampler2DRect_GrSLType) ? "texture2DRect" : "texture2D";
- } else {
- return (samplerType == kSampler2DRect_GrSLType) ? "texture2DRectProj" : "texture2DProj";
+ return "texture2D";
}
+ return "texture2DProj";
}
/**
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.cpp ('k') | src/gpu/glsl/GrGLSLCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698