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

Unified Diff: cc/output/shader.cc

Issue 14301021: cc: Don't pass simple well-defined classes by reference. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | « cc/output/shader.h ('k') | cc/quads/shared_quad_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/shader.cc
diff --git a/cc/output/shader.cc b/cc/output/shader.cc
index 7afa8a321ea28d0ecbbe9366019565f4ea816895..f8701e9fb0f46d3410ae22751adc975cae1a71c4 100644
--- a/cc/output/shader.cc
+++ b/cc/output/shader.cc
@@ -8,13 +8,13 @@
#include "base/basictypes.h"
#include "base/logging.h"
-#include "cc/output/gl_renderer.h" // For the GLC() macro.
+#include "cc/output/gl_renderer.h" // For the GLC() macro.
#include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h"
#include "third_party/khronos/GLES2/gl2.h"
#define SHADER0(Src) #Src
-#define VERTEX_SHADER(Src) setVertexTexCoordPrecision(SHADER0(Src))
-#define FRAGMENT_SHADER(Src) setFragTexCoordPrecision(precision, SHADER0(Src))
+#define VERTEX_SHADER(Src) SetVertexTexCoordPrecision(SHADER0(Src))
+#define FRAGMENT_SHADER(Src) SetFragTexCoordPrecision(precision, SHADER0(Src))
using WebKit::WebGraphicsContext3D;
@@ -45,46 +45,46 @@ static void GetProgramUniformLocations(WebGraphicsContext3D* context,
}
}
-static std::string setFragTexCoordPrecision(
- TexCoordPrecision requestedPrecision, std::string shaderString)
-{
- switch (requestedPrecision) {
+static std::string SetFragTexCoordPrecision(
+ TexCoordPrecision requested_precision, std::string shader_string) {
+ switch (requested_precision) {
case TexCoordPrecisionHigh:
- DCHECK_NE(shaderString.find("TexCoordPrecision"), std::string::npos);
- return "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
- " #define TexCoordPrecision highp\n"
- "#else\n"
- " #define TexCoordPrecision mediump\n"
- "#endif\n" +
- shaderString;
+ DCHECK_NE(shader_string.find("TexCoordPrecision"), std::string::npos);
+ return
+ "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
+ " #define TexCoordPrecision highp\n"
+ "#else\n"
+ " #define TexCoordPrecision mediump\n"
+ "#endif\n" +
+ shader_string;
case TexCoordPrecisionMedium:
- DCHECK_NE(shaderString.find("TexCoordPrecision"), std::string::npos);
+ DCHECK_NE(shader_string.find("TexCoordPrecision"), std::string::npos);
return "#define TexCoordPrecision mediump\n" +
- shaderString;
+ shader_string;
case TexCoordPrecisionNA:
- DCHECK_EQ(shaderString.find("TexCoordPrecision"), std::string::npos);
- DCHECK_EQ(shaderString.find("texture2D"), std::string::npos);
- return shaderString;
- }
- return shaderString;
+ DCHECK_EQ(shader_string.find("TexCoordPrecision"), std::string::npos);
+ DCHECK_EQ(shader_string.find("texture2D"), std::string::npos);
+ return shader_string;
+ }
+ return shader_string;
}
-static std::string setVertexTexCoordPrecision(const char* shaderString)
-{
- // We unconditionally use highp in the vertex shader since
- // we are unlikely to be vertex shader bound when drawing large quads.
- // Also, some vertex shaders mutate the texture coordinate in such a
- // way that the effective precision might be lower than expected.
- return "#define TexCoordPrecision highp\n" +
- std::string(shaderString);
+static std::string SetVertexTexCoordPrecision(const char* shader_string) {
+ // We unconditionally use highp in the vertex shader since
+ // we are unlikely to be vertex shader bound when drawing large quads.
+ // Also, some vertex shaders mutate the texture coordinate in such a
+ // way that the effective precision might be lower than expected.
+ return "#define TexCoordPrecision highp\n" +
+ std::string(shader_string);
}
TexCoordPrecision TexCoordPrecisionRequired(WebGraphicsContext3D* context,
int highp_threshold_min,
int x, int y) {
// Initialize range and precision with minimum spec values for when
- // getShaderPrecisionFormat is a test stub.
- // TODO: Implement better stubs of getShaderPrecisionFormat everywhere.
+ // GetShaderPrecisionFormat is a test stub.
+ // TODO(brianderson): Implement better stubs of GetShaderPrecisionFormat
+ // everywhere.
GLint range[2] = { 14, 14 };
GLint precision = 10;
GLC(context, context->getShaderPrecisionFormat(GL_FRAGMENT_SHADER,
@@ -96,18 +96,18 @@ TexCoordPrecision TexCoordPrecisionRequired(WebGraphicsContext3D* context,
return TexCoordPrecisionMedium;
}
-} // namespace
+} // namespace
TexCoordPrecision TexCoordPrecisionRequired(WebGraphicsContext3D* context,
int highp_threshold_min,
- const gfx::Point& max_coordinate) {
+ gfx::Point max_coordinate) {
return TexCoordPrecisionRequired(context, highp_threshold_min,
max_coordinate.x(), max_coordinate.y());
}
TexCoordPrecision TexCoordPrecisionRequired(WebGraphicsContext3D* context,
int highp_threshold_min,
- const gfx::Size& max_size) {
+ gfx::Size max_size) {
return TexCoordPrecisionRequired(context, highp_threshold_min,
max_size.width(), max_size.height());
}
« no previous file with comments | « cc/output/shader.h ('k') | cc/quads/shared_quad_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698