Chromium Code Reviews| 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..2df1072e02a7f7cbe397bd01f9ceb17366db3a61 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,21 @@ 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 { |
|
Zhenyao Mo
2017/05/12 18:00:44
Can we add a DCHECK here to make sure we only get
jiajia.qin
2017/05/15 01:42:11
Done. I use DCHECK(!gpu::gles2::GLES2Util::IsInteg
|
| 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) { |