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

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

Issue 822423004: Move most of the transform logic into the primitive processors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 5 years, 11 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/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 fd79abbeb5ee743367dbe0fc27c3de19d045144e..ead0edfaea4d88e1f754063b65a697a8cd914f27 100644
--- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
@@ -35,52 +35,23 @@ void GrGLVertexBuilder::emitAttributes(const GrGeometryProcessor& gp) {
return;
}
-void GrGLVertexBuilder::transformToNormalizedDeviceSpace() {
+void GrGLVertexBuilder::transformToNormalizedDeviceSpace(const char* pos3) {
+ SkASSERT(!fRtAdjustName);
+
// setup RT Uniform
fProgramBuilder->fUniformHandles.fRTAdjustmentUni =
fProgramBuilder->addUniform(GrGLProgramBuilder::kVertex_Visibility,
kVec4f_GrSLType, kDefault_GrSLPrecision,
fProgramBuilder->rtAdjustment(),
&fRtAdjustName);
- // Wire transforms
- SkTArray<GrGLProgramBuilder::TransformVarying, true>& transVs = fProgramBuilder->fCoordVaryings;
- int transformCount = transVs.count();
- for (int i = 0; i < transformCount; i++) {
- GrCoordSet coordSet = transVs[i].fCoordSet;
- const char* coords = NULL;
- switch (coordSet) {
- case kLocal_GrCoordSet:
- coords = this->localCoords();
- break;
- case kDevice_GrCoordSet:
- coords = this->glPosition();
- break;
- }
-
- // varying = matrix * coords (logically)
- const GrGLVarying& v = transVs[i].fV;
- if (kDevice_GrCoordSet == coordSet) {
- if (kVec2f_GrSLType == v.fType) {
- this->codeAppendf("%s = (%s * %s).xy;", v.fVsOut, transVs[i].fUniName.c_str(),
- coords);
- } else {
- this->codeAppendf("%s = %s * %s;", v.fVsOut, transVs[i].fUniName.c_str(), coords);
- }
- } else {
- 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);
- }
- }
- }
// 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());
+ pos3, fRtAdjustName, pos3, fRtAdjustName, pos3);
+
+ // We could have the GrGeometryProcessor do this, but its just easier to have it performed here.
+ // If we ever need to set variable pointsize, then we can reinvestigate
+ this->codeAppend("gl_PointSize = 1.0;");
}
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