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

Unified Diff: gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc

Issue 2875903002: Delete useless codes in gles2_cmd_copy_texture_chromium (Closed)
Patch Set: Add DCHECK for non integer format Created 3 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
index 7b28f3c2de3d660245c91f514595ebbf91f8ef1b..08642bebe4a5aec90a510c1ee8e165a2729f397d 100644
--- a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
+++ b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.cc
@@ -366,42 +366,22 @@ std::string GetFragmentShaderSource(const gl::GLVersionInfo& gl_version_info,
// Preamble for texture precision.
source += kShaderPrecisionPreamble;
- if (gpu::gles2::GLES2Util::IsSignedIntegerFormat(dest_format)) {
- source += "#define TextureType ivec4\n";
- source += "#define ZERO 0\n";
- source += "#define MAX_COLOR 255\n";
- if (gpu::gles2::GLES2Util::IsSignedIntegerFormat(source_format))
- source += "#define InnerScaleValue 1\n";
- else if (gpu::gles2::GLES2Util::IsUnsignedIntegerFormat(source_format))
- source += "#define InnerScaleValue 1u\n";
- else
- source += "#define InnerScaleValue 255.0\n";
- source += "#define OuterScaleValue 1\n";
- } else if (gpu::gles2::GLES2Util::IsUnsignedIntegerFormat(dest_format)) {
+ // According to the spec, |dest_format| can be unsigend interger format, float
+ // format or unsigned normalized fixed-point format. |source_format| can only
+ // be unsigned normalized fixed-point format.
+ if (gpu::gles2::GLES2Util::IsUnsignedIntegerFormat(dest_format)) {
source += "#define TextureType uvec4\n";
source += "#define ZERO 0u\n";
source += "#define MAX_COLOR 255u\n";
- if (gpu::gles2::GLES2Util::IsSignedIntegerFormat(source_format))
- source += "#define InnerScaleValue 1\n";
- else if (gpu::gles2::GLES2Util::IsUnsignedIntegerFormat(source_format))
- source += "#define InnerScaleValue 1u\n";
- else
- source += "#define InnerScaleValue 255.0\n";
+ source += "#define InnerScaleValue 255.0\n";
source += "#define OuterScaleValue 1u\n";
} else {
+ DCHECK(!gpu::gles2::GLES2Util::IsIntegerFormat(dest_format));
source += "#define TextureType vec4\n";
source += "#define ZERO 0.0\n";
source += "#define MAX_COLOR 1.0\n";
- if (gpu::gles2::GLES2Util::IsSignedIntegerFormat(source_format)) {
- source += "#define InnerScaleValue 1\n";
- source += "#define OuterScaleValue (1.0 / 255.0)\n";
- } else if (gpu::gles2::GLES2Util::IsUnsignedIntegerFormat(source_format)) {
- source += "#define InnerScaleValue 1u\n";
- source += "#define OuterScaleValue (1.0 / 255.0)\n";
- } else {
- source += "#define InnerScaleValue 1.0\n";
- source += "#define OuterScaleValue 1.0\n";
- }
+ source += "#define InnerScaleValue 1.0\n";
+ source += "#define OuterScaleValue 1.0\n";
}
if (gl_version_info.is_es2 || gl_version_info.IsLowerThanGL(3, 2) ||
target == GL_TEXTURE_EXTERNAL_OES) {
« 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