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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 139013008: Implement support for rendering to 32-bit float textures on ES3 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Check that framebuffers really are supported and add tests Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index f913c4883d5ebdb892dd908c2d97842b026ba4fc..9a7da5db2382211d3af9fb91d2128a44eb678172 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -80,6 +80,8 @@ namespace {
static const char kOESDerivativeExtension[] = "GL_OES_standard_derivatives";
static const char kEXTFragDepthExtension[] = "GL_EXT_frag_depth";
static const char kEXTDrawBuffersExtension[] = "GL_EXT_draw_buffers";
+static const char kCHROMIUMColorBufferFloatExtension[] =
+ "GL_CHROMIUM_color_buffer_float";
#if !defined(ANGLE_SH_VERSION) || ANGLE_SH_VERSION < 108
khronos_uint64_t CityHashForAngle(const char* name, unsigned int len) {
@@ -1668,6 +1670,7 @@ class GLES2DecoderImpl : public GLES2Decoder,
bool derivatives_explicitly_enabled_;
bool frag_depth_explicitly_enabled_;
bool draw_buffers_explicitly_enabled_;
+ bool chromium_color_buffer_float_explicitly_enabled_;
piman 2014/02/07 00:43:10 I don't think we need this. Since we decided that
oetuaho-nv 2014/02/07 09:26:58 Okay. I just got the idea from earlier reviews tha
bool compile_shader_always_succeeds_;
@@ -2167,6 +2170,7 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
derivatives_explicitly_enabled_(false),
frag_depth_explicitly_enabled_(false),
draw_buffers_explicitly_enabled_(false),
+ chromium_color_buffer_float_explicitly_enabled_(false),
compile_shader_always_succeeds_(false),
service_logging_(CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableGPUServiceLoggingGPU)),
@@ -2959,7 +2963,8 @@ bool GLES2DecoderImpl::CheckFramebufferValid(
return true;
}
- GLenum completeness = framebuffer->IsPossiblyComplete();
+ GLenum completeness = framebuffer->IsPossiblyComplete(
+ chromium_color_buffer_float_explicitly_enabled_);
if (completeness != GL_FRAMEBUFFER_COMPLETE) {
LOCAL_SET_GL_ERROR(
GL_INVALID_FRAMEBUFFER_OPERATION, func_name, "framebuffer incomplete");
@@ -4895,7 +4900,8 @@ GLenum GLES2DecoderImpl::DoCheckFramebufferStatus(GLenum target) {
if (!framebuffer) {
return GL_FRAMEBUFFER_COMPLETE;
}
- GLenum completeness = framebuffer->IsPossiblyComplete();
+ GLenum completeness = framebuffer->IsPossiblyComplete(
+ chromium_color_buffer_float_explicitly_enabled_);
if (completeness != GL_FRAMEBUFFER_COMPLETE) {
return completeness;
}
@@ -7600,6 +7606,17 @@ error::Error GLES2DecoderImpl::HandleGetString(
} else {
extensions = feature_info_->extensions().c_str();
}
+ // Strip out CHROMIUM_color_buffer_float for all contexts that have
+ // not enabled it to emulate GLES2 more closely.
+ if (!chromium_color_buffer_float_explicitly_enabled_) {
+ size_t offset = extensions.find(
+ kCHROMIUMColorBufferFloatExtension);
+ if (std::string::npos != offset) {
+ extensions.replace(offset,
+ arraysize(kCHROMIUMColorBufferFloatExtension),
+ std::string());
+ }
+ }
std::string surface_extensions = surface_->GetExtensions();
if (!surface_extensions.empty())
extensions += " " + surface_extensions;
@@ -9066,6 +9083,14 @@ error::Error GLES2DecoderImpl::HandleRequestExtensionCHROMIUM(
return error::kInvalidArguments;
}
+ bool desire_chromium_color_buffer_float =
+ feature_str.find("GL_CHROMIUM_color_buffer_float") != std::string::npos;
+
+ if (desire_chromium_color_buffer_float &&
+ feature_info_->feature_flags().chromium_color_buffer_float) {
+ chromium_color_buffer_float_explicitly_enabled_ = true;
+ }
+
bool desire_webgl_glsl_validation =
feature_str.find("GL_CHROMIUM_webglsl") != std::string::npos;
bool desire_standard_derivatives = false;

Powered by Google App Engine
This is Rietveld 408576698