Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(773)

Unified Diff: src/gpu/glsl/GrGLSLShaderBuilder.h

Issue 1869063005: Add GLSL support for texelFetch (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_renaem
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/glsl/GrGLSLCaps.cpp ('k') | src/gpu/glsl/GrGLSLShaderBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/glsl/GrGLSLShaderBuilder.h
diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.h b/src/gpu/glsl/GrGLSLShaderBuilder.h
index 6f8bf68bab5a6f25b067b8f048c40f128a5570e8..c14df5391507a34cb6ea462d07877e658e056480 100644
--- a/src/gpu/glsl/GrGLSLShaderBuilder.h
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.h
@@ -34,7 +34,7 @@ public:
const char* coordName,
GrSLType coordType = kVec2f_GrSLType) const;
- /** Version of above that appends the result to the fragment shader code instead.*/
+ /** Version of above that appends the result to the shader code instead.*/
void appendTextureLookup(const GrGLSLSampler&,
const char* coordName,
GrSLType coordType = kVec2f_GrSLType);
@@ -49,6 +49,14 @@ public:
const char* coordName,
GrSLType coordType = kVec2f_GrSLType);
+ /** Fetches an unfiltered texel from a sampler at integer coordinates. coordExpr must match the
+ dimensionality of the sampler and must be within the sampler's range. coordExpr is emitted
+ exactly once, so expressions like "idx++" are acceptable. */
+ void appendTexelFetch(SkString* out, const GrGLSLSampler&, const char* coordExpr) const;
+
+ /** Version of above that appends the result to the shader code instead.*/
+ void appendTexelFetch(const GrGLSLSampler&, const char* coordExpr);
+
/**
* Adds a #define directive to the top of the shader.
*/
@@ -175,6 +183,12 @@ protected:
void compileAndAppendLayoutQualifiers();
+ /* Appends any swizzling we may need to get from some backend internal format to the format used
+ * in GrPixelConfig. If this is implemented by the GrGpu object, then swizzle will be rgba. For
+ * shader prettiness we omit the swizzle rather than appending ".rgba".
+ */
+ void appendTextureSwizzle(SkString* out, GrPixelConfig) const;
+
void nextStage() {
fShaderStrings.push_back();
fCompilerStrings.push_back(this->code().c_str());
« no previous file with comments | « src/gpu/glsl/GrGLSLCaps.cpp ('k') | src/gpu/glsl/GrGLSLShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698