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 812063002: Change to create device coord coordset (Closed) Base URL: https://skia.googlesource.com/skia.git@vm-off-context
Patch Set: ignoring bleed Created 6 years 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/GrGLProgramBuilder.cpp ('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 1d97e85234a94308d6172465a7ba4e26eec79213..317657e61f4d55f32aa9e44601754342c92d9a4b 100644
--- a/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLVertexShaderBuilder.cpp
@@ -53,16 +53,39 @@ void GrGLVertexBuilder::transformToNormalizedDeviceSpace() {
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();
+ GrCoordSet coordSet = transVs[i].fCoordSet;
+ const char* coords;
+ switch (coordSet) {
+ default:
+ SkFAIL("Case missing");
+ case kPosition_GrCoordSet:
+ coords = this->positionCoords();
+ break;
+ 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 (kVec2f_GrSLType == v.fType) {
- this->codeAppendf("%s = (%s * vec3(%s, 1)).xy;", v.fVsOut, transVs[i].fUniName.c_str(),
- coords);
+ 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 {
- this->codeAppendf("%s = %s * vec3(%s, 1);", v.fVsOut, transVs[i].fUniName.c_str(),
- coords);
+ 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);
+ }
}
}
« no previous file with comments | « src/gpu/gl/builders/GrGLProgramBuilder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698