diff options
Diffstat (limited to 'src/gpu/glsl')
-rw-r--r-- | src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp | 10 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLFragmentShaderBuilder.h | 2 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLShaderBuilder.h | 24 | ||||
-rw-r--r-- | src/gpu/glsl/GrGLSLShaderVar.h | 10 |
4 files changed, 23 insertions, 23 deletions
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp index eb744a9915..d35730f633 100644 --- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp +++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp @@ -291,10 +291,10 @@ void GrGLSLFragmentShaderBuilder::enableCustomOutput() { if (!fHasCustomColorOutput) { fHasCustomColorOutput = true; fCustomColorOutputIndex = fOutputs.count(); - fOutputs.push_back().set(kVec4f_GrSLType, - GrGLSLShaderVar::kOut_TypeModifier, - DeclaredColorOutputName()); - fProgramBuilder->finalizeFragmentOutputColor(fOutputs.back()); + fOutputs.push_back().set(kVec4f_GrSLType, + GrGLSLShaderVar::kOut_TypeModifier, + DeclaredColorOutputName()); + fProgramBuilder->finalizeFragmentOutputColor(fOutputs.back()); } } @@ -318,7 +318,7 @@ void GrGLSLFragmentShaderBuilder::enableSecondaryOutput() { } const char* GrGLSLFragmentShaderBuilder::getPrimaryColorOutputName() const { - return fHasCustomColorOutput ? DeclaredColorOutputName() : "sk_FragColor"; + return fHasCustomColorOutput ? DeclaredColorOutputName() : "gl_FragColor"; } void GrGLSLFragmentBuilder::declAppendf(const char* fmt, ...) { diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h index 6a4a184829..ecb6d455dd 100644 --- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h +++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.h @@ -203,7 +203,7 @@ private: } #endif - static const char* DeclaredColorOutputName() { return "sk_FragColor"; } + static const char* DeclaredColorOutputName() { return "fsColorOut"; } static const char* DeclaredSecondaryColorOutputName() { return "fsSecondaryColorOut"; } GrSurfaceOrigin getSurfaceOrigin() const; diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.h b/src/gpu/glsl/GrGLSLShaderBuilder.h index f59edb4553..a6ff96dd1b 100644 --- a/src/gpu/glsl/GrGLSLShaderBuilder.h +++ b/src/gpu/glsl/GrGLSLShaderBuilder.h @@ -72,27 +72,23 @@ public: void appendTexelFetch(SamplerHandle, const char* coordExpr); /** - * Adds a constant declaration to the top of the shader. + * Adds a #define directive to the top of the shader. */ - void defineConstant(const char* type, const char* name, const char* value) { - this->definitions().appendf("const %s %s = %s;\n", type, name, value); + void define(const char* macro, const char* replacement) { + this->definitions().appendf("#define %s %s\n", macro, replacement); } - void defineConstant(const char* name, int value) { - this->definitions().appendf("const int %s = %i;\n", name, value); + void define(const char* macro, int replacement) { + this->definitions().appendf("#define %s %i\n", macro, replacement); } - void defineConstant(const char* name, float value) { - this->definitions().appendf("const float %s = %f;\n", name, value); - } - - void defineConstantf(const char* type, const char* name, const char* fmt, ...) { - this->definitions().appendf("const %s %s = ", type, name); + void definef(const char* macro, const char* replacement, ...) { + this->definitions().appendf("#define %s ", macro); va_list args; - va_start(args, fmt); - this->definitions().appendVAList(fmt, args); + va_start(args, replacement); + this->definitions().appendVAList(replacement, args); va_end(args); - this->definitions().append(";\n"); + this->definitions().append("\n"); } /** diff --git a/src/gpu/glsl/GrGLSLShaderVar.h b/src/gpu/glsl/GrGLSLShaderVar.h index 35ac4bcb84..9d162ecaa4 100644 --- a/src/gpu/glsl/GrGLSLShaderVar.h +++ b/src/gpu/glsl/GrGLSLShaderVar.h @@ -213,20 +213,24 @@ public: private: static const char* TypeModifierString(const GrGLSLCaps* glslCaps, TypeModifier t) { + GrGLSLGeneration gen = glslCaps->generation(); switch (t) { case kNone_TypeModifier: return ""; - case kAttribute_TypeModifier: // fall through - case kVaryingIn_TypeModifier: // fall through case kIn_TypeModifier: return "in"; case kInOut_TypeModifier: return "inout"; - case kVaryingOut_TypeModifier: // fall through case kOut_TypeModifier: return "out"; case kUniform_TypeModifier: return "uniform"; + case kAttribute_TypeModifier: + return k110_GrGLSLGeneration == gen ? "attribute" : "in"; + case kVaryingIn_TypeModifier: + return k110_GrGLSLGeneration == gen ? "varying" : "in"; + case kVaryingOut_TypeModifier: + return k110_GrGLSLGeneration == gen ? "varying" : "out"; default: SkFAIL("Unknown shader variable type modifier."); return ""; // suppress warning |