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

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: pure rebase 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
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 GL_RGBA8_SNORM, 905 GL_RGBA8_SNORM,
906 GL_RGBA16F, 906 GL_RGBA16F,
907 GL_RGBA32F, 907 GL_RGBA32F,
908 GL_DEPTH_COMPONENT16, 908 GL_DEPTH_COMPONENT16,
909 GL_DEPTH_COMPONENT24, 909 GL_DEPTH_COMPONENT24,
910 GL_DEPTH_COMPONENT32F, 910 GL_DEPTH_COMPONENT32F,
911 GL_DEPTH24_STENCIL8, 911 GL_DEPTH24_STENCIL8,
912 GL_DEPTH32F_STENCIL8, 912 GL_DEPTH32F_STENCIL8,
913 }; 913 };
914 914
915 // Exposed by EXT_color_buffer_float
916 static const GLenum kSupportedInternalFormatsFloat[] = {
Ken Russell (switch to Gerrit) 2017/04/20 01:06:48 These are ES3-specific, so could you name this kSu
qiankun 2017/04/20 16:45:55 Done.
917 GL_R16F, GL_R32F, GL_RG16F, GL_RG32F,
918 GL_RGBA16F, GL_RGBA32F, GL_R11F_G11F_B10F};
919
915 // ES3 enums supported by TexImageSource 920 // ES3 enums supported by TexImageSource
916 static const GLenum kSupportedInternalFormatsTexImageSourceES3[] = { 921 static const GLenum kSupportedInternalFormatsTexImageSourceES3[] = {
917 GL_R8, GL_R16F, GL_R32F, GL_R8UI, GL_RG8, 922 GL_R8, GL_R16F, GL_R32F, GL_R8UI, GL_RG8,
918 GL_RG16F, GL_RG32F, GL_RG8UI, GL_RGB8, GL_SRGB8, 923 GL_RG16F, GL_RG32F, GL_RG8UI, GL_RGB8, GL_SRGB8,
919 GL_RGB565, GL_R11F_G11F_B10F, GL_RGB9_E5, GL_RGB16F, GL_RGB32F, 924 GL_RGB565, GL_R11F_G11F_B10F, GL_RGB9_E5, GL_RGB16F, GL_RGB32F,
920 GL_RGB8UI, GL_RGBA8, GL_SRGB8_ALPHA8, GL_RGB5_A1, GL_RGBA4, 925 GL_RGB8UI, GL_RGBA8, GL_SRGB8_ALPHA8, GL_RGB5_A1, GL_RGBA4,
921 GL_RGBA16F, GL_RGBA32F, GL_RGBA8UI, 926 GL_RGBA16F, GL_RGBA32F, GL_RGBA8UI,
922 }; 927 };
923 928
924 // ES2 enums 929 // ES2 enums
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 synthesized_errors_to_console_(true), 1059 synthesized_errors_to_console_(true),
1055 num_gl_errors_to_console_allowed_(kMaxGLErrorsAllowedToConsole), 1060 num_gl_errors_to_console_allowed_(kMaxGLErrorsAllowedToConsole),
1056 one_plus_max_non_default_texture_unit_(0), 1061 one_plus_max_non_default_texture_unit_(0),
1057 is_web_gl2_formats_types_added_(false), 1062 is_web_gl2_formats_types_added_(false),
1058 is_web_gl2_tex_image_source_formats_types_added_(false), 1063 is_web_gl2_tex_image_source_formats_types_added_(false),
1059 is_web_gl2_internal_formats_copy_tex_image_added_(false), 1064 is_web_gl2_internal_formats_copy_tex_image_added_(false),
1060 is_oes_texture_float_formats_types_added_(false), 1065 is_oes_texture_float_formats_types_added_(false),
1061 is_oes_texture_half_float_formats_types_added_(false), 1066 is_oes_texture_half_float_formats_types_added_(false),
1062 is_web_gl_depth_texture_formats_types_added_(false), 1067 is_web_gl_depth_texture_formats_types_added_(false),
1063 is_ext_srgb_formats_types_added_(false), 1068 is_ext_srgb_formats_types_added_(false),
1069 is_ext_color_buffer_float_formats_added_(false),
1064 version_(version) { 1070 version_(version) {
1065 ASSERT(context_provider); 1071 ASSERT(context_provider);
1066 1072
1067 context_group_->AddContext(this); 1073 context_group_->AddContext(this);
1068 1074
1069 max_viewport_dims_[0] = max_viewport_dims_[1] = 0; 1075 max_viewport_dims_[0] = max_viewport_dims_[1] = 0;
1070 context_provider->ContextGL()->GetIntegerv(GL_MAX_VIEWPORT_DIMS, 1076 context_provider->ContextGL()->GetIntegerv(GL_MAX_VIEWPORT_DIMS,
1071 max_viewport_dims_); 1077 max_viewport_dims_);
1072 1078
1073 RefPtr<DrawingBuffer> buffer; 1079 RefPtr<DrawingBuffer> buffer;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 for (int i = 0; i < kWebGLExtensionNameCount; ++i) 1254 for (int i = 0; i < kWebGLExtensionNameCount; ++i)
1249 extension_enabled_[i] = false; 1255 extension_enabled_[i] = false;
1250 1256
1251 is_web_gl2_formats_types_added_ = false; 1257 is_web_gl2_formats_types_added_ = false;
1252 is_web_gl2_tex_image_source_formats_types_added_ = false; 1258 is_web_gl2_tex_image_source_formats_types_added_ = false;
1253 is_web_gl2_internal_formats_copy_tex_image_added_ = false; 1259 is_web_gl2_internal_formats_copy_tex_image_added_ = false;
1254 is_oes_texture_float_formats_types_added_ = false; 1260 is_oes_texture_float_formats_types_added_ = false;
1255 is_oes_texture_half_float_formats_types_added_ = false; 1261 is_oes_texture_half_float_formats_types_added_ = false;
1256 is_web_gl_depth_texture_formats_types_added_ = false; 1262 is_web_gl_depth_texture_formats_types_added_ = false;
1257 is_ext_srgb_formats_types_added_ = false; 1263 is_ext_srgb_formats_types_added_ = false;
1264 is_ext_color_buffer_float_formats_added_ = false;
1258 1265
1259 supported_internal_formats_.clear(); 1266 supported_internal_formats_.clear();
1260 ADD_VALUES_TO_SET(supported_internal_formats_, kSupportedFormatsES2); 1267 ADD_VALUES_TO_SET(supported_internal_formats_, kSupportedFormatsES2);
1261 supported_tex_image_source_internal_formats_.clear(); 1268 supported_tex_image_source_internal_formats_.clear();
1262 ADD_VALUES_TO_SET(supported_tex_image_source_internal_formats_, 1269 ADD_VALUES_TO_SET(supported_tex_image_source_internal_formats_,
1263 kSupportedFormatsES2); 1270 kSupportedFormatsES2);
1264 supported_internal_formats_copy_tex_image_.clear(); 1271 supported_internal_formats_copy_tex_image_.clear();
1265 ADD_VALUES_TO_SET(supported_internal_formats_copy_tex_image_, 1272 ADD_VALUES_TO_SET(supported_internal_formats_copy_tex_image_,
1266 kSupportedFormatsES2); 1273 kSupportedFormatsES2);
1267 supported_formats_.clear(); 1274 supported_formats_.clear();
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 } 2139 }
2133 2140
2134 bool WebGLRenderingContextBase::ValidateCopyTexFormat(const char* function_name, 2141 bool WebGLRenderingContextBase::ValidateCopyTexFormat(const char* function_name,
2135 GLenum internalformat) { 2142 GLenum internalformat) {
2136 if (!is_web_gl2_internal_formats_copy_tex_image_added_ && 2143 if (!is_web_gl2_internal_formats_copy_tex_image_added_ &&
2137 IsWebGL2OrHigher()) { 2144 IsWebGL2OrHigher()) {
2138 ADD_VALUES_TO_SET(supported_internal_formats_copy_tex_image_, 2145 ADD_VALUES_TO_SET(supported_internal_formats_copy_tex_image_,
2139 kSupportedInternalFormatsES3); 2146 kSupportedInternalFormatsES3);
2140 is_web_gl2_internal_formats_copy_tex_image_added_ = true; 2147 is_web_gl2_internal_formats_copy_tex_image_added_ = true;
2141 } 2148 }
2149 if (!is_ext_color_buffer_float_formats_added_ &&
2150 ExtensionEnabled(kEXTColorBufferFloatName)) {
2151 ADD_VALUES_TO_SET(supported_internal_formats_copy_tex_image_,
2152 kSupportedInternalFormatsFloat);
2153 is_ext_color_buffer_float_formats_added_ = true;
2154 }
2142 2155
2143 if (supported_internal_formats_copy_tex_image_.find(internalformat) == 2156 if (supported_internal_formats_copy_tex_image_.find(internalformat) ==
2144 supported_internal_formats_copy_tex_image_.end()) { 2157 supported_internal_formats_copy_tex_image_.end()) {
2145 SynthesizeGLError(GL_INVALID_ENUM, function_name, "invalid internalformat"); 2158 SynthesizeGLError(GL_INVALID_ENUM, function_name, "invalid internalformat");
2146 return false; 2159 return false;
2147 } 2160 }
2148 2161
2149 return true; 2162 return true;
2150 } 2163 }
2151 2164
(...skipping 5710 matching lines...) Expand 10 before | Expand all | Expand 10 after
7862 7875
7863 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( 7876 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas(
7864 HTMLCanvasElementOrOffscreenCanvas& result) const { 7877 HTMLCanvasElementOrOffscreenCanvas& result) const {
7865 if (canvas()) 7878 if (canvas())
7866 result.setHTMLCanvasElement(canvas()); 7879 result.setHTMLCanvasElement(canvas());
7867 else 7880 else
7868 result.setOffscreenCanvas(offscreenCanvas()); 7881 result.setOffscreenCanvas(offscreenCanvas());
7869 } 7882 }
7870 7883
7871 } // namespace blink 7884 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698