aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/glsl
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2017-12-20 10:07:49 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-20 20:59:46 +0000
commita8f6aef13d0592305e05baf19ee724f31a53b466 (patch)
tree7089724d8d0d2943ca260ee3ec558c635e836148 /src/gpu/glsl
parent5f9836edb0de062a6e30ba74f94803fae4f311ed (diff)
CCPR: Initial semi-optimized vertex shader Impl
Bug: skia: Change-Id: If22f47a3b945ce7336f8e609c2e0c911f09e1d18 Reviewed-on: https://skia-review.googlesource.com/86820 Reviewed-by: Brian Salomon <bsalomon@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;