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

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

Issue 2689203002: Check for some extensions before calling potentially NULL GL entry points. (Closed)
Patch Set: Created 3 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_passthrough_doers.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
index b2900c1dc27839a56c0aec524024470a44377275..987c04bfb1b4d2936475f4caaec4aa508e46e074 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough_doers.cc
@@ -2250,8 +2250,18 @@ GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleCHROMIUM(
GLenum internalformat,
GLsizei width,
GLsizei height) {
- glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width,
- height);
+ if (!feature_info_->feature_flags().chromium_framebuffer_multisample) {
+ return error::kUnknownCommand;
+ }
+
+ if (has_angle_framebuffer_multisample_) {
+ glRenderbufferStorageMultisampleANGLE(target, samples, internalformat,
+ width, height);
+ } else {
+ DCHECK(has_es3_);
+ glRenderbufferStorageMultisample(target, samples, internalformat, width,
+ height);
+ }
return error::kNoError;
}
@@ -2261,8 +2271,18 @@ error::Error GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleEXT(
GLenum internalformat,
GLsizei width,
GLsizei height) {
- glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width,
- height);
+ if (!feature_info_->feature_flags().chromium_framebuffer_multisample) {
+ return error::kUnknownCommand;
+ }
+
+ if (has_angle_framebuffer_multisample_) {
+ glRenderbufferStorageMultisampleANGLE(target, samples, internalformat,
+ width, height);
+ } else {
+ DCHECK(has_es3_);
+ glRenderbufferStorageMultisample(target, samples, internalformat, width,
+ height);
+ }
return error::kNoError;
}
@@ -2346,6 +2366,10 @@ error::Error GLES2DecoderPassthroughImpl::DoQueryCounterEXT(
int32_t sync_shm_id,
uint32_t sync_shm_offset,
uint32_t submit_count) {
+ if (!has_ext_disjoint_timer_query_) {
+ return error::kUnknownCommand;
+ }
+
GLuint service_id = GetQueryServiceID(id, &query_id_map_);
// Flush all previous errors
@@ -3018,13 +3042,23 @@ error::Error GLES2DecoderPassthroughImpl::DoDiscardFramebufferEXT(
GLenum target,
GLsizei count,
const volatile GLenum* attachments) {
+ if (!feature_info_->feature_flags().ext_discard_framebuffer) {
+ return error::kUnknownCommand;
+ }
+
// Validate that count is non-negative before allocating a vector
if (count < 0) {
InsertError(GL_INVALID_VALUE, "count cannot be negative.");
return error::kNoError;
}
std::vector<GLenum> attachments_copy(attachments, attachments + count);
- glDiscardFramebufferEXT(target, count, attachments_copy.data());
+
+ if (has_ext_discard_framebuffer_) {
+ glDiscardFramebufferEXT(target, count, attachments_copy.data());
+ } else {
+ DCHECK(has_es3_);
+ glInvalidateFramebuffer(target, count, attachments_copy.data());
+ }
return error::kNoError;
}

Powered by Google App Engine
This is Rietveld 408576698