Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa _intel.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa _intel.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "gpu/command_buffer/service/framebuffer_manager.h" | 8 #include "gpu/command_buffer/service/framebuffer_manager.h" |
| 9 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
| 10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 const bool rgba_immutable = | 249 const bool rgba_immutable = |
| 250 texture->texture()->IsImmutable() && | 250 texture->texture()->IsImmutable() && |
| 251 TextureManager::ExtractFormatFromStorageFormat(internal_format) == | 251 TextureManager::ExtractFormatFromStorageFormat(internal_format) == |
| 252 GL_RGBA; | 252 GL_RGBA; |
| 253 const bool do_copy = !rgba_immutable; | 253 const bool do_copy = !rgba_immutable; |
| 254 | 254 |
| 255 // CMAA Effect | 255 // CMAA Effect |
| 256 if (do_copy) { | 256 if (do_copy) { |
| 257 ApplyCMAAEffectTexture(source_texture, rgba8_texture_, do_copy); | 257 ApplyCMAAEffectTexture(source_texture, rgba8_texture_, do_copy); |
| 258 | 258 |
| 259 // Source format for DoCopySubTexture is always GL_RGBA8. | |
| 260 CopyTextureMethod method = DIRECT_COPY; | |
| 261 bool copy_tex_image_format_valid = | |
| 262 !GLES2Util::IsIntegerFormat(internal_format) && | |
| 263 GLES2Util::GetColorEncodingFromInternalFormat(internal_format) != | |
| 264 GL_SRGB && | |
| 265 internal_format != GL_BGRA_EXT && internal_format != GL_BGRA8_EXT; | |
| 266 if (GLES2Util::IsSizedColorFormat(internal_format)) { | |
|
Zhenyao Mo
2017/02/07 18:58:07
I have a question: if the format is float, even if
qiankun
2017/02/08 03:44:23
I didn't see the bits matching rule only applies t
dshwang
2017/02/10 01:25:28
We don't have plan to use CMAA on float texture. C
| |
| 267 int dr, dg, db, da; | |
| 268 GLES2Util::GetColorFormatComponentSizes(internal_format, 0, &dr, &dg, | |
| 269 &db, &da); | |
| 270 if ((dr > 0 && dr != 8) || (dg > 0 && dg != 8) || | |
| 271 (db > 0 && db != 8) || (da > 0 && da != 8)) { | |
| 272 copy_tex_image_format_valid = false; | |
| 273 } | |
| 274 } | |
| 275 if (!copy_tex_image_format_valid) | |
| 276 method = DIRECT_DRAW; | |
| 277 bool color_renderable = Texture::ColorRenderable( | |
| 278 decoder->GetFeatureInfo(), internal_format, false); | |
| 279 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | |
| 280 // glDrawArrays is faster than glCopyTexSubImage2D on IA Mesa driver, | |
| 281 // although opposite in Android. | |
| 282 // TODO(dshwang): After Mesa fixes this issue, remove this hack. | |
| 283 // https://bugs.freedesktop.org/show_bug.cgi?id=98478, crbug.com/535198. | |
| 284 if (color_renderable) | |
| 285 method = DIRECT_DRAW; | |
| 286 #endif | |
| 287 if (method == DIRECT_DRAW && !color_renderable) | |
| 288 method = DRAW_AND_COPY; | |
| 289 | |
| 259 copier->DoCopySubTexture( | 290 copier->DoCopySubTexture( |
| 260 decoder, GL_TEXTURE_2D, rgba8_texture_, 0, GL_RGBA8, GL_TEXTURE_2D, | 291 decoder, GL_TEXTURE_2D, rgba8_texture_, 0, GL_RGBA8, GL_TEXTURE_2D, |
| 261 source_texture, 0, internal_format, 0, 0, 0, 0, width_, height_, | 292 source_texture, 0, internal_format, 0, 0, 0, 0, width_, height_, |
|
qiankun
2017/02/07 10:46:33
internal_format may be non-color-renderable. It ca
| |
| 262 width_, height_, width_, height_, false, false, false, DIRECT_DRAW); | 293 width_, height_, width_, height_, false, false, false, method); |
| 263 } else { | 294 } else { |
| 264 ApplyCMAAEffectTexture(source_texture, source_texture, do_copy); | 295 ApplyCMAAEffectTexture(source_texture, source_texture, do_copy); |
| 265 } | 296 } |
| 266 | 297 |
| 267 decoder->RestoreTextureState(source_texture); | 298 decoder->RestoreTextureState(source_texture); |
| 268 } | 299 } |
| 269 } | 300 } |
| 270 | 301 |
| 271 // Restore state | 302 // Restore state |
| 272 decoder->RestoreAllAttributes(); | 303 decoder->RestoreAllAttributes(); |
| (...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1850 \n#endif\n | 1881 \n#endif\n |
| 1851 \n#if defined DISPLAY_EDGES\n | 1882 \n#if defined DISPLAY_EDGES\n |
| 1852 DisplayEdges(); | 1883 DisplayEdges(); |
| 1853 \n#endif\n | 1884 \n#endif\n |
| 1854 } | 1885 } |
| 1855 ); | 1886 ); |
| 1856 /* clang-format on */ | 1887 /* clang-format on */ |
| 1857 | 1888 |
| 1858 } // namespace gles2 | 1889 } // namespace gles2 |
| 1859 } // namespace gpu | 1890 } // namespace gpu |
| OLD | NEW |