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

Side by Side Diff: src/gpu/gl/GrGLShaderBuilder.cpp

Issue 299943002: separate view matrix from rt adjustment (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase on tot: Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.h ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gl/GrGLShaderBuilder.h" 8 #include "gl/GrGLShaderBuilder.h"
9 #include "gl/GrGLProgram.h" 9 #include "gl/GrGLProgram.h"
10 #include "gl/GrGLUniformHandle.h" 10 #include "gl/GrGLUniformHandle.h"
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 fLocalCoordsVar->set(kVec2f_GrSLType, 750 fLocalCoordsVar->set(kVec2f_GrSLType,
751 GrGLShaderVar::kAttribute_TypeModifier, 751 GrGLShaderVar::kAttribute_TypeModifier,
752 "aLocalCoords"); 752 "aLocalCoords");
753 } else { 753 } else {
754 fLocalCoordsVar = fPositionVar; 754 fLocalCoordsVar = fPositionVar;
755 } 755 }
756 756
757 const char* viewMName; 757 const char* viewMName;
758 fViewMatrixUniform = this->addUniform(GrGLShaderBuilder::kVertex_Visibility, 758 fViewMatrixUniform = this->addUniform(GrGLShaderBuilder::kVertex_Visibility,
759 kMat33f_GrSLType, "ViewM", &viewMName) ; 759 kMat33f_GrSLType, "ViewM", &viewMName) ;
760 const char* rtAdjustName;
761 fRTAdustmentVecUniform = this->addUniform(GrGLShaderBuilder::kVertex_Visibil ity,
762 kVec4f_GrSLType, "rtAdjustment", & rtAdjustName);
760 763
761 this->vsCodeAppendf("\tvec3 pos3 = %s * vec3(%s, 1);\n" 764 // Transform the position into Skia's device coords.
762 "\tgl_Position = vec4(pos3.xy, 0, pos3.z);\n", 765 this->vsCodeAppendf("\tvec3 pos3 = %s * vec3(%s, 1);\n",
763 viewMName, fPositionVar->c_str()); 766 viewMName, fPositionVar->c_str());
764 767
768 // Transform from Skia's device coords to GL's normalized device coords.
769 this->vsCodeAppendf(
770 "\tgl_Position = vec4(dot(pos3.xz, %s.xy), dot(pos3.yz, %s.zw), 0, pos3. z);\n",
771 rtAdjustName, rtAdjustName);
772
765 // we output point size in the GS if present 773 // we output point size in the GS if present
766 if (header.fEmitsPointSize 774 if (header.fEmitsPointSize
767 #if GR_GL_EXPERIMENTAL_GS 775 #if GR_GL_EXPERIMENTAL_GS
768 && !header.fExperimentalGS 776 && !header.fExperimentalGS
769 #endif 777 #endif
770 ) { 778 ) {
771 this->vsCodeAppend("\tgl_PointSize = 1.0;\n"); 779 this->vsCodeAppend("\tgl_PointSize = 1.0;\n");
772 } 780 }
773 781
774 if (GrGLProgramDesc::kAttribute_ColorInput == header.fColorInput) { 782 if (GrGLProgramDesc::kAttribute_ColorInput == header.fColorInput) {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 998
991 GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this, 999 GrGLPathTexGenProgramEffectsBuilder pathTexGenEffectsBuilder(this,
992 effectCnt); 1000 effectCnt);
993 this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder, 1001 this->INHERITED::createAndEmitEffects(&pathTexGenEffectsBuilder,
994 effectStages, 1002 effectStages,
995 effectKeys, 1003 effectKeys,
996 effectCnt, 1004 effectCnt,
997 inOutFSColor); 1005 inOutFSColor);
998 return pathTexGenEffectsBuilder.finish(); 1006 return pathTexGenEffectsBuilder.finish();
999 } 1007 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLShaderBuilder.h ('k') | src/gpu/gl/GrGpuGL.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698