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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2823193002: Add supported formats by EXT_color_buffer_float for CopyTexImage2D (Closed)
Patch Set: remove suppressions Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 GL_RGBA8_SNORM, 906 GL_RGBA8_SNORM,
907 GL_RGBA16F, 907 GL_RGBA16F,
908 GL_RGBA32F, 908 GL_RGBA32F,
909 GL_DEPTH_COMPONENT16, 909 GL_DEPTH_COMPONENT16,
910 GL_DEPTH_COMPONENT24, 910 GL_DEPTH_COMPONENT24,
911 GL_DEPTH_COMPONENT32F, 911 GL_DEPTH_COMPONENT32F,
912 GL_DEPTH24_STENCIL8, 912 GL_DEPTH24_STENCIL8,
913 GL_DEPTH32F_STENCIL8, 913 GL_DEPTH32F_STENCIL8,
914 }; 914 };
915 915
916 // Exposed by EXT_color_buffer_float
917 static const GLenum kSupportedInternalFormatsFloatES3[] = {
918 GL_R16F, GL_R32F, GL_RG16F, GL_RG32F,
919 GL_RGBA16F, GL_RGBA32F, GL_R11F_G11F_B10F};
920
916 // ES3 enums supported by TexImageSource 921 // ES3 enums supported by TexImageSource
917 static const GLenum kSupportedInternalFormatsTexImageSourceES3[] = { 922 static const GLenum kSupportedInternalFormatsTexImageSourceES3[] = {
918 GL_R8, GL_R16F, GL_R32F, GL_R8UI, GL_RG8, 923 GL_R8, GL_R16F, GL_R32F, GL_R8UI, GL_RG8,
919 GL_RG16F, GL_RG32F, GL_RG8UI, GL_RGB8, GL_SRGB8, 924 GL_RG16F, GL_RG32F, GL_RG8UI, GL_RGB8, GL_SRGB8,
920 GL_RGB565, GL_R11F_G11F_B10F, GL_RGB9_E5, GL_RGB16F, GL_RGB32F, 925 GL_RGB565, GL_R11F_G11F_B10F, GL_RGB9_E5, GL_RGB16F, GL_RGB32F,
921 GL_RGB8UI, GL_RGBA8, GL_SRGB8_ALPHA8, GL_RGB5_A1, GL_RGBA4, 926 GL_RGB8UI, GL_RGBA8, GL_SRGB8_ALPHA8, GL_RGB5_A1, GL_RGBA4,
922 GL_RGBA16F, GL_RGBA32F, GL_RGBA8UI, 927 GL_RGBA16F, GL_RGBA32F, GL_RGBA8UI,
923 }; 928 };
924 929
925 // ES2 enums 930 // ES2 enums
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 synthesized_errors_to_console_(true), 1060 synthesized_errors_to_console_(true),
1056 num_gl_errors_to_console_allowed_(kMaxGLErrorsAllowedToConsole), 1061 num_gl_errors_to_console_allowed_(kMaxGLErrorsAllowedToConsole),
1057 one_plus_max_non_default_texture_unit_(0), 1062 one_plus_max_non_default_texture_unit_(0),
1058 is_web_gl2_formats_types_added_(false), 1063 is_web_gl2_formats_types_added_(false),
1059 is_web_gl2_tex_image_source_formats_types_added_(false), 1064 is_web_gl2_tex_image_source_formats_types_added_(false),
1060 is_web_gl2_internal_formats_copy_tex_image_added_(false), 1065 is_web_gl2_internal_formats_copy_tex_image_added_(false),
1061 is_oes_texture_float_formats_types_added_(false), 1066 is_oes_texture_float_formats_types_added_(false),
1062 is_oes_texture_half_float_formats_types_added_(false), 1067 is_oes_texture_half_float_formats_types_added_(false),
1063 is_web_gl_depth_texture_formats_types_added_(false), 1068 is_web_gl_depth_texture_formats_types_added_(false),
1064 is_ext_srgb_formats_types_added_(false), 1069 is_ext_srgb_formats_types_added_(false),
1070 is_ext_color_buffer_float_formats_added_(false),
1065 version_(version) { 1071 version_(version) {
1066 ASSERT(context_provider); 1072 ASSERT(context_provider);
1067 1073
1068 context_group_->AddContext(this); 1074 context_group_->AddContext(this);
1069 1075
1070 max_viewport_dims_[0] = max_viewport_dims_[1] = 0; 1076 max_viewport_dims_[0] = max_viewport_dims_[1] = 0;
1071 context_provider->ContextGL()->GetIntegerv(GL_MAX_VIEWPORT_DIMS, 1077 context_provider->ContextGL()->GetIntegerv(GL_MAX_VIEWPORT_DIMS,
1072 max_viewport_dims_); 1078 max_viewport_dims_);
1073 1079
1074 RefPtr<DrawingBuffer> buffer; 1080 RefPtr<DrawingBuffer> buffer;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 for (int i = 0; i < kWebGLExtensionNameCount; ++i) 1255 for (int i = 0; i < kWebGLExtensionNameCount; ++i)
1250 extension_enabled_[i] = false; 1256 extension_enabled_[i] = false;
1251 1257
1252 is_web_gl2_formats_types_added_ = false; 1258 is_web_gl2_formats_types_added_ = false;
1253 is_web_gl2_tex_image_source_formats_types_added_ = false; 1259 is_web_gl2_tex_image_source_formats_types_added_ = false;
1254 is_web_gl2_internal_formats_copy_tex_image_added_ = false; 1260 is_web_gl2_internal_formats_copy_tex_image_added_ = false;
1255 is_oes_texture_float_formats_types_added_ = false; 1261 is_oes_texture_float_formats_types_added_ = false;
1256 is_oes_texture_half_float_formats_types_added_ = false; 1262 is_oes_texture_half_float_formats_types_added_ = false;
1257 is_web_gl_depth_texture_formats_types_added_ = false; 1263 is_web_gl_depth_texture_formats_types_added_ = false;
1258 is_ext_srgb_formats_types_added_ = false; 1264 is_ext_srgb_formats_types_added_ = false;
1265 is_ext_color_buffer_float_formats_added_ = false;
1259 1266
1260 supported_internal_formats_.clear(); 1267 supported_internal_formats_.clear();
1261 ADD_VALUES_TO_SET(supported_internal_formats_, kSupportedFormatsES2); 1268 ADD_VALUES_TO_SET(supported_internal_formats_, kSupportedFormatsES2);
1262 supported_tex_image_source_internal_formats_.clear(); 1269 supported_tex_image_source_internal_formats_.clear();
1263 ADD_VALUES_TO_SET(supported_tex_image_source_internal_formats_, 1270 ADD_VALUES_TO_SET(supported_tex_image_source_internal_formats_,
1264 kSupportedFormatsES2); 1271 kSupportedFormatsES2);
1265 supported_internal_formats_copy_tex_image_.clear(); 1272 supported_internal_formats_copy_tex_image_.clear();
1266 ADD_VALUES_TO_SET(supported_internal_formats_copy_tex_image_, 1273 ADD_VALUES_TO_SET(supported_internal_formats_copy_tex_image_,
1267 kSupportedFormatsES2); 1274 kSupportedFormatsES2);
1268 supported_formats_.clear(); 1275 supported_formats_.clear();
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 } 2140 }
2134 2141
2135 bool WebGLRenderingContextBase::ValidateCopyTexFormat(const char* function_name, 2142 bool WebGLRenderingContextBase::ValidateCopyTexFormat(const char* function_name,
2136 GLenum internalformat) { 2143 GLenum internalformat) {
2137 if (!is_web_gl2_internal_formats_copy_tex_image_added_ && 2144 if (!is_web_gl2_internal_formats_copy_tex_image_added_ &&
2138 IsWebGL2OrHigher()) { 2145 IsWebGL2OrHigher()) {
2139 ADD_VALUES_TO_SET(supported_internal_formats_copy_tex_image_, 2146 ADD_VALUES_TO_SET(supported_internal_formats_copy_tex_image_,
2140 kSupportedInternalFormatsES3); 2147 kSupportedInternalFormatsES3);
2141 is_web_gl2_internal_formats_copy_tex_image_added_ = true; 2148 is_web_gl2_internal_formats_copy_tex_image_added_ = true;
2142 } 2149 }
2150 if (!is_ext_color_buffer_float_formats_added_ &&
2151 ExtensionEnabled(kEXTColorBufferFloatName)) {
2152 ADD_VALUES_TO_SET(supported_internal_formats_copy_tex_image_,
2153 kSupportedInternalFormatsFloatES3);
2154 is_ext_color_buffer_float_formats_added_ = true;
2155 }
2143 2156
2144 if (supported_internal_formats_copy_tex_image_.find(internalformat) == 2157 if (supported_internal_formats_copy_tex_image_.find(internalformat) ==
2145 supported_internal_formats_copy_tex_image_.end()) { 2158 supported_internal_formats_copy_tex_image_.end()) {
2146 SynthesizeGLError(GL_INVALID_ENUM, function_name, "invalid internalformat"); 2159 SynthesizeGLError(GL_INVALID_ENUM, function_name, "invalid internalformat");
2147 return false; 2160 return false;
2148 } 2161 }
2149 2162
2150 return true; 2163 return true;
2151 } 2164 }
2152 2165
(...skipping 5710 matching lines...) Expand 10 before | Expand all | Expand 10 after
7863 7876
7864 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( 7877 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(
7865 HTMLCanvasElementOrOffscreenCanvas& result) const { 7878 HTMLCanvasElementOrOffscreenCanvas& result) const {
7866 if (canvas()) 7879 if (canvas())
7867 result.setHTMLCanvasElement(canvas()); 7880 result.setHTMLCanvasElement(canvas());
7868 else 7881 else
7869 result.setOffscreenCanvas(offscreenCanvas()); 7882 result.setOffscreenCanvas(offscreenCanvas());
7870 } 7883 }
7871 7884
7872 } // namespace blink 7885 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698