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

Unified Diff: cc/shader.cc

Issue 11420079: Allow using a larger-than-necessary texture as cached render pass backing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win build fix - filepath literals Created 8 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
« cc/gl_renderer_pixeltest.cc ('K') | « cc/shader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/shader.cc
diff --git a/cc/shader.cc b/cc/shader.cc
index c84d88aeccc948abe96257d14778f0a843d6cb20..074f41a382d218e8f5c8c5e744287497a41041d5 100644
--- a/cc/shader.cc
+++ b/cc/shader.cc
@@ -171,12 +171,6 @@ std::string VertexShaderPosTexTransform::getShaderString() const
);
}
-VertexShaderQuad::VertexShaderQuad()
- : m_matrixLocation(-1)
- , m_pointLocation(-1)
-{
-}
-
std::string VertexShaderPosTexIdentity::getShaderString() const
{
return SHADER(
@@ -190,19 +184,30 @@ std::string VertexShaderPosTexIdentity::getShaderString() const
);
}
+VertexShaderQuad::VertexShaderQuad()
+ : m_matrixLocation(-1)
+ , m_pointLocation(-1)
+ , m_texScaleLocation(-1)
+{
+}
+
void VertexShaderQuad::init(WebGraphicsContext3D* context, unsigned program, bool usingBindUniform, int* baseUniformIndex)
{
static const char* shaderUniforms[] = {
"matrix",
"point",
+ "texScale",
};
- int locations[2];
+ int locations[3];
getProgramUniformLocations(context, program, shaderUniforms, arraysize(shaderUniforms), arraysize(locations), locations, usingBindUniform, baseUniformIndex);
m_matrixLocation = locations[0];
m_pointLocation = locations[1];
- DCHECK(m_matrixLocation != -1 && m_pointLocation != -1);
+ m_texScaleLocation = locations[2];
+ DCHECK_NE(m_matrixLocation, -1);
+ DCHECK_NE(m_pointLocation, -1);
+ DCHECK_NE(m_texScaleLocation, -1);
}
std::string VertexShaderQuad::getShaderString() const
@@ -212,6 +217,7 @@ std::string VertexShaderQuad::getShaderString() const
attribute vec2 a_texCoord;
uniform mat4 matrix;
uniform vec2 point[4];
+ uniform vec2 texScale;
varying vec2 v_texCoord;
void main()
{
@@ -222,7 +228,7 @@ std::string VertexShaderQuad::getShaderString() const
pos.xy += (a_texCoord.x * a_texCoord.y) * point[2];
pos.xy += (complement.x * a_texCoord.y) * point[3];
gl_Position = matrix * pos;
- v_texCoord = pos.xy + vec2(0.5);
+ v_texCoord = (pos.xy + vec2(0.5)) * texScale;
}
);
}
« cc/gl_renderer_pixeltest.cc ('K') | « cc/shader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698