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

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

Issue 1885863004: Refactor how we store and use samplers in Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
Index: src/gpu/glsl/GrGLSLUniformHandler.h
diff --git a/src/gpu/glsl/GrGLSLUniformHandler.h b/src/gpu/glsl/GrGLSLUniformHandler.h
index a2f70532adc2948de8641b18b632a727a026e844..99f4b1111fb14ff2bc40aac2e7cfb41270c3d417 100644
--- a/src/gpu/glsl/GrGLSLUniformHandler.h
+++ b/src/gpu/glsl/GrGLSLUniformHandler.h
@@ -12,12 +12,14 @@
#include "GrGLSLShaderVar.h"
class GrGLSLProgramBuilder;
+class GrGLSLSampler;
class GrGLSLUniformHandler {
public:
virtual ~GrGLSLUniformHandler() {}
typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
+ typedef GrGLSLProgramDataManager::UniformHandle SamplerHandle;
/** Add a uniform variable to the current program, that has visibility in one or more shaders.
visibility is a bitfield of GrShaderFlag values indicating from which shaders the uniform
@@ -30,6 +32,7 @@ public:
GrSLPrecision precision,
const char* name,
const char** outName = nullptr) {
+ SkASSERT(!GrSLTypeIsSamplerType(type));
return this->addUniformArray(visibility, type, precision, name, 0, outName);
}
@@ -39,6 +42,7 @@ public:
const char* name,
int arrayCount,
const char** outName = nullptr) {
+ SkASSERT(!GrSLTypeIsSamplerType(type));
return this->internalAddUniformArray(visibility, type, precision, name, true, arrayCount,
outName);
}
@@ -49,6 +53,9 @@ public:
* Shortcut for getUniformVariable(u).c_str()
*/
virtual const char* getUniformCStr(UniformHandle u) const = 0;
+
+ virtual const GrGLSLSampler& getSampler(SamplerHandle handle) const = 0;
bsalomon 2016/04/14 01:40:16 It seems a bit unfortunate to make every processor
egdaniel 2016/04/14 03:11:50 Yeah I think it would be fine for appendTexLookup
+
protected:
explicit GrGLSLUniformHandler(GrGLSLProgramBuilder* program) : fProgramBuilder(program) {}
@@ -56,6 +63,22 @@ protected:
GrGLSLProgramBuilder* fProgramBuilder;
private:
+ virtual int numSamplers() const = 0;
+
+ SamplerHandle addSampler(uint32_t visibility,
+ GrPixelConfig config,
+ GrSLType type,
+ GrSLPrecision precision,
+ const char* name) {
+ this->internalAddSampler(visibility, config, type, precision, name);
+ }
+
+ virtual SamplerHandle internalAddSampler(uint32_t visibility,
+ GrPixelConfig config,
+ GrSLType type,
+ GrSLPrecision precision,
+ const char* name) = 0;
+
virtual UniformHandle internalAddUniformArray(uint32_t visibility,
GrSLType type,
GrSLPrecision precision,
@@ -64,6 +87,7 @@ private:
int arrayCount,
const char** outName) = 0;
+
virtual void appendUniformDecls(GrShaderFlags visibility, SkString*) const = 0;
friend class GrGLSLProgramBuilder;

Powered by Google App Engine
This is Rietveld 408576698