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

Unified Diff: src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp

Issue 691313003: Revert of Default geometry processor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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/gl/builders/GrGLVertexShaderBuilder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
diff --git a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
index 7af5ce9843af40507f694b314b3b7d3db50671af..2bef113410343cdcb3e22132adc9d13c899f35e5 100644
--- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
@@ -20,7 +20,6 @@
: INHERITED(program)
, fPositionVar(NULL)
, fLocalCoordsVar(NULL)
- , fRtAdjustName(NULL)
, fEffectAttribOffset(0) {
}
@@ -32,22 +31,9 @@
v->fVsOut = fOutputs.back().getName().c_str();
}
-void GrGLVertexBuilder::setupUniformViewMatrix() {
- fProgramBuilder->fUniformHandles.fViewMatrixUni =
- fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility,
- kMat33f_GrSLType,
- this->uViewM());
-}
-
-void GrGLVertexBuilder::setupPositionAndLocalCoords() {
- // Setup position
- this->codeAppendf("vec3 %s;", this->glPosition());
-
- // setup position and local coords attribute
+void GrGLVertexBuilder::setupLocalCoords() {
fPositionVar = &fInputs.push_back();
- fPositionVar->set(kVec2f_GrSLType,
- GrGLShaderVar::kAttribute_TypeModifier,
- this->inPosition());
+ fPositionVar->set(kVec2f_GrSLType, GrGLShaderVar::kAttribute_TypeModifier, "inPosition");
if (-1 != fProgramBuilder->header().fLocalCoordAttributeIndex) {
fLocalCoordsVar = &fInputs.push_back();
fLocalCoordsVar->set(kVec2f_GrSLType,
@@ -57,6 +43,18 @@
fLocalCoordsVar = fPositionVar;
}
fEffectAttribOffset = fInputs.count();
+}
+
+void GrGLVertexBuilder::transformGLToSkiaCoords() {
+ const char* viewMName;
+ fProgramBuilder->fUniformHandles.fViewMatrixUni =
+ fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility,
+ kMat33f_GrSLType,
+ "ViewM",
+ &viewMName);
+
+ // Transform the position into Skia's device coords.
+ this->codeAppendf("vec3 pos3 = %s * vec3(%s, 1);", viewMName, fPositionVar->c_str());
}
void GrGLVertexBuilder::setupBuiltinVertexAttribute(const char* inName, GrGLSLExpr1* out) {
@@ -93,34 +91,17 @@
}
}
-void GrGLVertexBuilder::transformToNormalizedDeviceSpace() {
- // setup RT Uniform
+void GrGLVertexBuilder::transformSkiaToGLCoords() {
+ const char* rtAdjustName;
fProgramBuilder->fUniformHandles.fRTAdjustmentUni =
fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility,
kVec4f_GrSLType,
- fProgramBuilder->rtAdjustment(),
- &fRtAdjustName);
- // Wire transforms
- SkTArray<GrGLProgramBuilder::TransformVarying, true>& transVs = fProgramBuilder->fCoordVaryings;
- int transformCount = transVs.count();
- for (int i = 0; i < transformCount; i++) {
- const char* coords = transVs[i].fSourceCoords.c_str();
-
- // varying = matrix * coords (logically)
- const GrGLVarying& v = transVs[i].fV;
- if (kVec2f_GrSLType == v.fType) {
- this->codeAppendf("%s = (%s * vec3(%s, 1)).xy;", v.fVsOut, transVs[i].fUniName.c_str(),
- coords);
- } else {
- this->codeAppendf("%s = %s * vec3(%s, 1);", v.fVsOut, transVs[i].fUniName.c_str(),
- coords);
- }
- }
+ "rtAdjustment",
+ &rtAdjustName);
// Transform from Skia's device coords to GL's normalized device coords.
- this->codeAppendf("gl_Position = vec4(dot(%s.xz, %s.xy), dot(%s.yz, %s.zw), 0, %s.z);",
- this->glPosition(), fRtAdjustName, this->glPosition(), fRtAdjustName,
- this->glPosition());
+ this->codeAppendf("gl_Position = vec4(dot(pos3.xz, %s.xy), dot(pos3.yz, %s.zw), 0, pos3.z);",
+ rtAdjustName, rtAdjustName);
}
void GrGLVertexBuilder::bindVertexAttributes(GrGLuint programID) {
« no previous file with comments | « src/gpu/gl/builders/GrGLVertexShaderBuilder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698