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

Unified Diff: cc/output/shader.cc

Issue 977533002: cc: Refactored shader locations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix chromium-style Created 5 years, 10 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') | no next file » | 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 189154637d6ab9bffbecf1244b516762e1f9114e..287ffcc9b4662cc0d18366f1c7ecfbe6c9254d3c 100644
--- a/cc/output/shader.cc
+++ b/cc/output/shader.cc
@@ -144,6 +144,9 @@ static std::string SetFragmentSamplerType(SamplerType requested_type,
} // namespace
+ShaderLocations::ShaderLocations() {
+}
+
TexCoordPrecision TexCoordPrecisionRequired(GLES2Interface* context,
int* highp_threshold_cache,
int highp_threshold_min,
@@ -347,6 +350,12 @@ std::string VertexShaderPosTexTransform::GetShaderBody() {
});
}
+void VertexShaderPosTexTransform::FillLocations(
+ ShaderLocations* locations) const {
+ locations->matrix = matrix_location();
+ locations->tex_transform = tex_transform_location();
+}
+
std::string VertexShaderPosTexIdentity::GetShaderString() const {
return VERTEX_SHADER(GetShaderHead(), GetShaderBody());
}
@@ -560,6 +569,16 @@ std::string VertexShaderQuadTexTransformAA::GetShaderBody() {
});
}
+void VertexShaderQuadTexTransformAA::FillLocations(
+ ShaderLocations* locations) const {
+ locations->quad = quad_location();
+ locations->edge = edge_location();
+ locations->viewport = viewport_location();
+ locations->matrix = matrix_location();
+ locations->tex_transform = tex_transform_location();
+}
+
+
VertexShaderTile::VertexShaderTile()
: matrix_location_(-1),
quad_location_(-1),
@@ -1105,6 +1124,14 @@ std::string FragmentShaderRGBATexAlpha::GetShaderBody() {
});
}
+void FragmentShaderRGBATexAlpha::FillLocations(
+ ShaderLocations* locations) const {
+ locations->sampler = sampler_location();
+ locations->alpha = alpha_location();
+ locations->backdrop = backdrop_location();
+ locations->backdrop_rect = backdrop_rect_location();
+}
+
std::string FragmentShaderRGBATexColorMatrixAlpha::GetShaderString(
TexCoordPrecision precision,
SamplerType sampler) const {
@@ -1136,6 +1163,16 @@ std::string FragmentShaderRGBATexColorMatrixAlpha::GetShaderBody() {
});
}
+void FragmentShaderRGBATexColorMatrixAlpha::FillLocations(
+ ShaderLocations* locations) const {
+ locations->sampler = sampler_location();
+ locations->alpha = alpha_location();
+ locations->color_matrix = color_matrix_location();
+ locations->color_offset = color_offset_location();
+ locations->backdrop = backdrop_location();
+ locations->backdrop_rect = backdrop_rect_location();
+}
+
std::string FragmentShaderRGBATexVaryingAlpha::GetShaderString(
TexCoordPrecision precision,
SamplerType sampler) const {
@@ -1405,6 +1442,14 @@ std::string FragmentShaderRGBATexAlphaAA::GetShaderBody() {
});
}
+void FragmentShaderRGBATexAlphaAA::FillLocations(
+ ShaderLocations* locations) const {
+ locations->sampler = sampler_location();
+ locations->alpha = alpha_location();
+ locations->backdrop = backdrop_location();
+ locations->backdrop_rect = backdrop_rect_location();
+}
+
FragmentTexClampAlphaAABinding::FragmentTexClampAlphaAABinding()
: sampler_location_(-1),
alpha_location_(-1),
@@ -1560,6 +1605,17 @@ std::string FragmentShaderRGBATexAlphaMask::GetShaderBody() {
});
}
+void FragmentShaderRGBATexAlphaMask::FillLocations(
+ ShaderLocations* locations) const {
+ locations->sampler = sampler_location();
+ locations->mask_sampler = mask_sampler_location();
+ locations->mask_tex_coord_scale = mask_tex_coord_scale_location();
+ locations->mask_tex_coord_offset = mask_tex_coord_offset_location();
+ locations->alpha = alpha_location();
+ locations->backdrop = backdrop_location();
+ locations->backdrop_rect = backdrop_rect_location();
+}
+
FragmentShaderRGBATexAlphaMaskAA::FragmentShaderRGBATexAlphaMaskAA()
: sampler_location_(-1),
mask_sampler_location_(-1),
@@ -1630,6 +1686,17 @@ std::string FragmentShaderRGBATexAlphaMaskAA::GetShaderBody() {
});
}
+void FragmentShaderRGBATexAlphaMaskAA::FillLocations(
+ ShaderLocations* locations) const {
+ locations->sampler = sampler_location();
+ locations->mask_sampler = mask_sampler_location();
+ locations->mask_tex_coord_scale = mask_tex_coord_scale_location();
+ locations->mask_tex_coord_offset = mask_tex_coord_offset_location();
+ locations->alpha = alpha_location();
+ locations->backdrop = backdrop_location();
+ locations->backdrop_rect = backdrop_rect_location();
+}
+
FragmentShaderRGBATexAlphaMaskColorMatrixAA::
FragmentShaderRGBATexAlphaMaskColorMatrixAA()
: sampler_location_(-1),
@@ -1714,6 +1781,19 @@ std::string FragmentShaderRGBATexAlphaMaskColorMatrixAA::GetShaderBody() {
});
}
+void FragmentShaderRGBATexAlphaMaskColorMatrixAA::FillLocations(
+ ShaderLocations* locations) const {
+ locations->sampler = sampler_location();
+ locations->alpha = alpha_location();
+ locations->mask_sampler = mask_sampler_location();
+ locations->mask_tex_coord_scale = mask_tex_coord_scale_location();
+ locations->mask_tex_coord_offset = mask_tex_coord_offset_location();
+ locations->color_matrix = color_matrix_location();
+ locations->color_offset = color_offset_location();
+ locations->backdrop = backdrop_location();
+ locations->backdrop_rect = backdrop_rect_location();
+}
+
FragmentShaderRGBATexAlphaColorMatrixAA::
FragmentShaderRGBATexAlphaColorMatrixAA()
: sampler_location_(-1),
@@ -1778,6 +1858,16 @@ std::string FragmentShaderRGBATexAlphaColorMatrixAA::GetShaderBody() {
});
}
+void FragmentShaderRGBATexAlphaColorMatrixAA::FillLocations(
+ ShaderLocations* locations) const {
+ locations->sampler = sampler_location();
+ locations->alpha = alpha_location();
+ locations->color_matrix = color_matrix_location();
+ locations->color_offset = color_offset_location();
+ locations->backdrop = backdrop_location();
+ locations->backdrop_rect = backdrop_rect_location();
+}
+
FragmentShaderRGBATexAlphaMaskColorMatrix::
FragmentShaderRGBATexAlphaMaskColorMatrix()
: sampler_location_(-1),
@@ -1855,6 +1945,19 @@ std::string FragmentShaderRGBATexAlphaMaskColorMatrix::GetShaderBody() {
});
}
+void FragmentShaderRGBATexAlphaMaskColorMatrix::FillLocations(
+ ShaderLocations* locations) const {
+ locations->sampler = sampler_location();
+ locations->mask_sampler = mask_sampler_location();
+ locations->mask_tex_coord_scale = mask_tex_coord_scale_location();
+ locations->mask_tex_coord_offset = mask_tex_coord_offset_location();
+ locations->alpha = alpha_location();
+ locations->color_matrix = color_matrix_location();
+ locations->color_offset = color_offset_location();
+ locations->backdrop = backdrop_location();
+ locations->backdrop_rect = backdrop_rect_location();
+}
+
FragmentShaderYUVVideo::FragmentShaderYUVVideo()
: y_texture_location_(-1),
u_texture_location_(-1),
« no previous file with comments | « cc/output/shader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698