Index: src/gpu/glsl/GrGLSLShaderBuilder.h |
diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.h b/src/gpu/glsl/GrGLSLShaderBuilder.h |
index f59edb4553b07ffa528549e436286c3d01a00850..a6ff96dd1b08e52540b96bc0507a33da62c3fd1f 100644 |
--- a/src/gpu/glsl/GrGLSLShaderBuilder.h |
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.h |
@@ -72,27 +72,23 @@ |
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 defineConstant(const char* name, int value) { |
- this->definitions().appendf("const int %s = %i;\n", name, value); |
- } |
- |
- 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 define(const char* macro, const char* replacement) { |
+ this->definitions().appendf("#define %s %s\n", macro, replacement); |
+ } |
+ |
+ void define(const char* macro, int replacement) { |
+ this->definitions().appendf("#define %s %i\n", macro, replacement); |
+ } |
+ |
+ 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"); |
} |
/** |