aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/glsl
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-12-22 02:24:53 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-22 18:42:05 +0000
commite3877ce5ceb7842b61d54bebcc51864e5787a2bc (patch)
tree60496eb4538ae408f46471db1b394602abd519c9 /src/gpu/glsl
parent92c7fa6b009b3ea4e93ca179153f837c2d9d7962 (diff)
CCPR: Initial semi-optimized vertex shader Impl
TBR=bsalomon@google.com Bug: skia: Change-Id: I24173e146d8c95cec5f29e8cb4fa5e2c28f9a33c Reviewed-on: https://skia-review.googlesource.com/89120 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/glsl')
-rw-r--r--src/gpu/glsl/GrGLSLVarying.cpp1
-rw-r--r--src/gpu/glsl/GrGLSLVarying.h11
2 files changed, 10 insertions, 2 deletions
diff --git a/src/gpu/glsl/GrGLSLVarying.cpp b/src/gpu/glsl/GrGLSLVarying.cpp
index 4bcce0391a..5a57613b3a 100644
--- a/src/gpu/glsl/GrGLSLVarying.cpp
+++ b/src/gpu/glsl/GrGLSLVarying.cpp
@@ -37,6 +37,7 @@ void GrGLSLVaryingHandler::internalAddVarying(const char* name, GrGLSLVarying* v
VaryingInfo& v = fVaryings.push_back();
SkASSERT(varying);
+ SkASSERT(kVoid_GrSLType != varying->fType);
v.fType = varying->fType;
v.fIsFlat = flat;
fProgramBuilder->nameVariable(&v.fVsOut, 'v', name);
diff --git a/src/gpu/glsl/GrGLSLVarying.h b/src/gpu/glsl/GrGLSLVarying.h
index e6174a6197..dac9bb771f 100644
--- a/src/gpu/glsl/GrGLSLVarying.h
+++ b/src/gpu/glsl/GrGLSLVarying.h
@@ -24,8 +24,15 @@ public:
kGeoToFrag
};
+ GrGLSLVarying() = default;
GrGLSLVarying(GrSLType type, Scope scope = Scope::kVertToFrag) : fType(type), fScope(scope) {}
+ void reset(GrSLType type, Scope scope = Scope::kVertToFrag) {
+ *this = GrGLSLVarying();
+ fType = type;
+ fScope = scope;
+ }
+
GrSLType type() const { return fType; }
Scope scope() const { return fScope; }
bool isInVertexShader() const { return Scope::kGeoToFrag != fScope; }
@@ -37,8 +44,8 @@ public:
const char* fsIn() const { SkASSERT(this->isInFragmentShader()); return fFsIn; }
private:
- const GrSLType fType;
- const Scope fScope;
+ GrSLType fType = kVoid_GrSLType;
+ Scope fScope = Scope::kVertToFrag;
const char* fVsOut = nullptr;
const char* fGsIn = nullptr;
const char* fGsOut = nullptr;