| 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";
|
| }
|
|
|
| /**
|
|
|