From e7e81c15c144b8133f696d0744ed9f7e8d06e936 Mon Sep 17 00:00:00 2001 From: Ethan Nicholas Date: Tue, 12 Dec 2017 09:48:48 -0500 Subject: converted vertex shaders to device coords Bug: skia:6239 Change-Id: I1a3b67fe84d208d426d71deb7aea6b0cd433af37 Reviewed-on: https://skia-review.googlesource.com/75501 Reviewed-by: Chris Dalton Commit-Queue: Ethan Nicholas --- src/gpu/gl/GrGLUniformHandler.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/gpu/gl') diff --git a/src/gpu/gl/GrGLUniformHandler.cpp b/src/gpu/gl/GrGLUniformHandler.cpp index b3b4b9f6b5..39392f996b 100644 --- a/src/gpu/gl/GrGLUniformHandler.cpp +++ b/src/gpu/gl/GrGLUniformHandler.cpp @@ -10,10 +10,19 @@ #include "gl/GrGLCaps.h" #include "gl/GrGLGpu.h" #include "gl/builders/GrGLProgramBuilder.h" +#include "SkSLCompiler.h" #define GL_CALL(X) GR_GL_CALL(this->glGpu()->glInterface(), X) #define GL_CALL_RET(R, X) GR_GL_CALL_RET(this->glGpu()->glInterface(), R, X) +bool valid_name(const char* name) { + // disallow unknown names that start with "sk_" + if (!strncmp(name, GR_NO_MANGLE_PREFIX, strlen(GR_NO_MANGLE_PREFIX))) { + return !strcmp(name, SkSL::Compiler::RTADJUST_NAME); + } + return true; +} + GrGLSLUniformHandler::UniformHandle GrGLUniformHandler::internalAddUniformArray( uint32_t visibility, GrSLType type, @@ -23,6 +32,7 @@ GrGLSLUniformHandler::UniformHandle GrGLUniformHandler::internalAddUniformArray( int arrayCount, const char** outName) { SkASSERT(name && strlen(name)); + SkASSERT(valid_name(name)); SkASSERT(0 != visibility); SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeTemporarilyAcceptsPrecision(type)); @@ -36,7 +46,7 @@ GrGLSLUniformHandler::UniformHandle GrGLUniformHandler::internalAddUniformArray( // uniform view matrix, they should upload the view matrix in their setData along with regular // uniforms. char prefix = 'u'; - if ('u' == name[0]) { + if ('u' == name[0] || !strncmp(name, GR_NO_MANGLE_PREFIX, strlen(GR_NO_MANGLE_PREFIX))) { prefix = '\0'; } fProgramBuilder->nameVariable(uni.fVariable.accessName(), prefix, name, mangleName); -- cgit v1.2.3