| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 13963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13974 GLES2Util::IsUnsignedIntegerFormat(read_format))) { | 13974 GLES2Util::IsUnsignedIntegerFormat(read_format))) { |
| 13975 *output_error_msg = std::string("incompatible format"); | 13975 *output_error_msg = std::string("incompatible format"); |
| 13976 return false; | 13976 return false; |
| 13977 } | 13977 } |
| 13978 } | 13978 } |
| 13979 if ((channels_needed & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { | 13979 if ((channels_needed & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { |
| 13980 *output_error_msg = | 13980 *output_error_msg = |
| 13981 std::string("can not be used with depth or stencil textures"); | 13981 std::string("can not be used with depth or stencil textures"); |
| 13982 return false; | 13982 return false; |
| 13983 } | 13983 } |
| 13984 if (feature_info_->IsWebGL2OrES3Context()) { | 13984 if (feature_info_->IsWebGL2OrES3Context() || |
| 13985 (feature_info_->feature_flags().chromium_color_buffer_float_rgb && |
| 13986 internal_format == GL_RGB32F) || |
| 13987 (feature_info_->feature_flags().chromium_color_buffer_float_rgba && |
| 13988 internal_format == GL_RGBA32F)) { |
| 13985 if (GLES2Util::IsSizedColorFormat(internal_format)) { | 13989 if (GLES2Util::IsSizedColorFormat(internal_format)) { |
| 13986 int sr, sg, sb, sa; | 13990 int sr, sg, sb, sa; |
| 13987 GLES2Util::GetColorFormatComponentSizes( | 13991 GLES2Util::GetColorFormatComponentSizes( |
| 13988 read_format, read_type, &sr, &sg, &sb, &sa); | 13992 read_format, read_type, &sr, &sg, &sb, &sa); |
| 13989 DCHECK(sr > 0 || sg > 0 || sb > 0 || sa > 0); | 13993 DCHECK(sr > 0 || sg > 0 || sb > 0 || sa > 0); |
| 13990 int dr, dg, db, da; | 13994 int dr, dg, db, da; |
| 13991 GLES2Util::GetColorFormatComponentSizes( | 13995 GLES2Util::GetColorFormatComponentSizes( |
| 13992 internal_format, 0, &dr, &dg, &db, &da); | 13996 internal_format, 0, &dr, &dg, &db, &da); |
| 13993 DCHECK(dr > 0 || dg > 0 || db > 0 || da > 0); | 13997 DCHECK(dr > 0 || dg > 0 || db > 0 || da > 0); |
| 13994 if ((dr > 0 && sr != dr) || | 13998 if ((dr > 0 && sr != dr) || |
| (...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16315 valid_dest_format = feature_info_->IsWebGL2OrES3Context(); | 16319 valid_dest_format = feature_info_->IsWebGL2OrES3Context(); |
| 16316 break; | 16320 break; |
| 16317 case GL_RGB9_E5: | 16321 case GL_RGB9_E5: |
| 16318 valid_dest_format = !gl_version_info().is_es; | 16322 valid_dest_format = !gl_version_info().is_es; |
| 16319 break; | 16323 break; |
| 16320 case GL_R16F: | 16324 case GL_R16F: |
| 16321 case GL_R32F: | 16325 case GL_R32F: |
| 16322 case GL_RG16F: | 16326 case GL_RG16F: |
| 16323 case GL_RG32F: | 16327 case GL_RG32F: |
| 16324 case GL_RGB16F: | 16328 case GL_RGB16F: |
| 16325 case GL_RGB32F: | |
| 16326 case GL_RGBA16F: | 16329 case GL_RGBA16F: |
| 16327 case GL_RGBA32F: | |
| 16328 case GL_R11F_G11F_B10F: | 16330 case GL_R11F_G11F_B10F: |
| 16329 valid_dest_format = feature_info_->ext_color_buffer_float_available(); | 16331 valid_dest_format = feature_info_->ext_color_buffer_float_available(); |
| 16330 break; | 16332 break; |
| 16333 case GL_RGB32F: |
| 16334 valid_dest_format = |
| 16335 feature_info_->ext_color_buffer_float_available() || |
| 16336 feature_info_->feature_flags().chromium_color_buffer_float_rgb; |
| 16337 break; |
| 16338 case GL_RGBA32F: |
| 16339 valid_dest_format = |
| 16340 feature_info_->ext_color_buffer_float_available() || |
| 16341 feature_info_->feature_flags().chromium_color_buffer_float_rgba; |
| 16342 break; |
| 16331 default: | 16343 default: |
| 16332 valid_dest_format = false; | 16344 valid_dest_format = false; |
| 16333 break; | 16345 break; |
| 16334 } | 16346 } |
| 16335 | 16347 |
| 16336 bool valid_source_format = | 16348 bool valid_source_format = |
| 16337 source_internal_format == GL_RED || source_internal_format == GL_ALPHA || | 16349 source_internal_format == GL_RED || source_internal_format == GL_ALPHA || |
| 16338 source_internal_format == GL_RGB || source_internal_format == GL_RGBA || | 16350 source_internal_format == GL_RGB || source_internal_format == GL_RGBA || |
| 16339 source_internal_format == GL_RGB8 || source_internal_format == GL_RGBA8 || | 16351 source_internal_format == GL_RGB8 || source_internal_format == GL_RGBA8 || |
| 16340 source_internal_format == GL_LUMINANCE || | 16352 source_internal_format == GL_LUMINANCE || |
| (...skipping 2949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19290 } | 19302 } |
| 19291 | 19303 |
| 19292 // Include the auto-generated part of this file. We split this because it means | 19304 // Include the auto-generated part of this file. We split this because it means |
| 19293 // we can easily edit the non-auto generated parts right here in this file | 19305 // we can easily edit the non-auto generated parts right here in this file |
| 19294 // instead of having to edit some template or the code generator. | 19306 // instead of having to edit some template or the code generator. |
| 19295 #include "base/macros.h" | 19307 #include "base/macros.h" |
| 19296 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19308 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 19297 | 19309 |
| 19298 } // namespace gles2 | 19310 } // namespace gles2 |
| 19299 } // namespace gpu | 19311 } // namespace gpu |
| OLD | NEW |