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

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

Issue 2023783002: Fix incorrect sampler locations when using CHROMIUM_bind_uniform_location (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « no previous file | no next file » | 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 2015 Google Inc. 2 * Copyright 2015 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/GrGLUniformHandler.h" 8 #include "gl/GrGLUniformHandler.h"
9 9
10 #include "gl/GrGLCaps.h" 10 #include "gl/GrGLCaps.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 for (int i = 0; i < fSamplers.count(); ++i) { 78 for (int i = 0; i < fSamplers.count(); ++i) {
79 if (fSamplers[i].visibility() & visibility) { 79 if (fSamplers[i].visibility() & visibility) {
80 fSamplers[i].fShaderVar.appendDecl(fProgramBuilder->glslCaps(), out) ; 80 fSamplers[i].fShaderVar.appendDecl(fProgramBuilder->glslCaps(), out) ;
81 out->append(";\n"); 81 out->append(";\n");
82 } 82 }
83 } 83 }
84 } 84 }
85 85
86 void GrGLUniformHandler::bindUniformLocations(GrGLuint programID, const GrGLCaps & caps) { 86 void GrGLUniformHandler::bindUniformLocations(GrGLuint programID, const GrGLCaps & caps) {
87 if (caps.bindUniformLocationSupport()) { 87 if (caps.bindUniformLocationSupport()) {
88 int count = fUniforms.count(); 88 int uniformCnt = fUniforms.count();
89 for (int i = 0; i < count; ++i) { 89 for (int i = 0; i < uniformCnt; ++i) {
90 GL_CALL(BindUniformLocation(programID, i, fUniforms[i].fVariable.c_s tr())); 90 GL_CALL(BindUniformLocation(programID, i, fUniforms[i].fVariable.c_s tr()));
91 fUniforms[i].fLocation = i; 91 fUniforms[i].fLocation = i;
92 } 92 }
93 for (int i = 0; i < fSamplers.count(); ++i) { 93 for (int i = 0; i < fSamplers.count(); ++i) {
94 GL_CALL(BindUniformLocation(programID, i, fSamplers[i].fShaderVar.c_ str())); 94 GrGLint location = i + uniformCnt;
95 fSamplers[i].fLocation = i; 95 GL_CALL(BindUniformLocation(programID, location, fSamplers[i].fShade rVar.c_str()));
96 fSamplers[i].fLocation = location;
96 } 97 }
97 } 98 }
98 } 99 }
99 100
100 void GrGLUniformHandler::getUniformLocations(GrGLuint programID, const GrGLCaps& caps) { 101 void GrGLUniformHandler::getUniformLocations(GrGLuint programID, const GrGLCaps& caps) {
101 if (!caps.bindUniformLocationSupport()) { 102 if (!caps.bindUniformLocationSupport()) {
102 int count = fUniforms.count(); 103 int count = fUniforms.count();
103 for (int i = 0; i < count; ++i) { 104 for (int i = 0; i < count; ++i) {
104 GrGLint location; 105 GrGLint location;
105 GL_CALL_RET(location, GetUniformLocation(programID, fUniforms[i].fVa riable.c_str())); 106 GL_CALL_RET(location, GetUniformLocation(programID, fUniforms[i].fVa riable.c_str()));
106 fUniforms[i].fLocation = location; 107 fUniforms[i].fLocation = location;
107 } 108 }
108 for (int i = 0; i < fSamplers.count(); ++i) { 109 for (int i = 0; i < fSamplers.count(); ++i) {
109 GrGLint location; 110 GrGLint location;
110 GL_CALL_RET(location, GetUniformLocation(programID, fSamplers[i].fSh aderVar.c_str())); 111 GL_CALL_RET(location, GetUniformLocation(programID, fSamplers[i].fSh aderVar.c_str()));
111 fSamplers[i].fLocation = location; 112 fSamplers[i].fLocation = location;
112 } 113 }
113 } 114 }
114 } 115 }
115 116
116 const GrGLGpu* GrGLUniformHandler::glGpu() const { 117 const GrGLGpu* GrGLUniformHandler::glGpu() const {
117 GrGLProgramBuilder* glPB = (GrGLProgramBuilder*) fProgramBuilder; 118 GrGLProgramBuilder* glPB = (GrGLProgramBuilder*) fProgramBuilder;
118 return glPB->gpu(); 119 return glPB->gpu();
119 } 120 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698