Index: src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp |
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp |
index 54e0b7f9561eded3ab6a2c20cf1fe0e54b004bc8..e2003e4142360fc2a9afc3b56fff1e197e030568 100644 |
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp |
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp |
@@ -7,6 +7,7 @@ |
#include "GrGLSLFragmentShaderBuilder.h" |
#include "GrRenderTarget.h" |
+#include "gl/GrGLGpu.h" |
#include "glsl/GrGLSL.h" |
#include "glsl/GrGLSLCaps.h" |
#include "glsl/GrGLSLProgramBuilder.h" |
@@ -87,6 +88,14 @@ bool GrGLSLFragmentShaderBuilder::enableFeature(GLSLFeature feature) { |
} |
return true; |
} |
+ case kPixelLocalStorage_GLSLFeature: { |
+ if (fProgramBuilder->glslCaps()->pixelLocalStorageSize() <= 0) { |
+ return false; |
+ } |
+ this->addFeature(1 << kPixelLocalStorage_GLSLFeature, |
+ "GL_EXT_shader_pixel_local_storage"); |
+ return true; |
+ } |
default: |
SkFAIL("Unexpected GLSLFeature requested."); |
return false; |
@@ -160,6 +169,11 @@ const char* GrGLSLFragmentShaderBuilder::fragmentPosition() { |
const char* GrGLSLFragmentShaderBuilder::dstColor() { |
fHasReadDstColor = true; |
+ GrPixelLocalStorageState pls = fProgramBuilder->primitiveProcessor().getPixelLocalStorageState(); |
+ if (pls == GrPixelLocalStorageState::kFinish_State) { |
+ return "pls.dstColor"; |
bsalomon
2016/01/04 15:33:47
Should we make it possible for the GP to provide t
|
+ } |
+ |
const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps(); |
if (glslCaps->fbFetchSupport()) { |
this->addFeature(1 << (GrGLSLFragmentShaderBuilder::kLastGLSLPrivateFeature + 1), |
@@ -227,6 +241,13 @@ const char* GrGLSLFragmentShaderBuilder::getPrimaryColorOutputName() const { |
return fHasCustomColorOutput ? DeclaredColorOutputName() : "gl_FragColor"; |
} |
+void GrGLSLFragmentBuilder::declAppendf(const char* fmt, ...) { |
+ va_list argp; |
+ va_start(argp, fmt); |
+ inputs().appendVAList(fmt, argp); |
+ va_end(argp); |
+} |
+ |
const char* GrGLSLFragmentShaderBuilder::getSecondaryColorOutputName() const { |
const GrGLSLCaps& caps = *fProgramBuilder->glslCaps(); |
return caps.mustDeclareFragmentShaderOutput() ? DeclaredSecondaryColorOutputName() |