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

Side by Side 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: Revert discard_framebuffer functional change 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 unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc ('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 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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_passthrough.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "ui/gl/gl_version_info.h"
8 9
9 namespace gpu { 10 namespace gpu {
10 namespace gles2 { 11 namespace gles2 {
11 12
12 namespace { 13 namespace {
13 14
14 template <typename ClientType, typename ServiceType, typename GenFunction> 15 template <typename ClientType, typename ServiceType, typename GenFunction>
15 error::Error GenHelper(GLsizei n, 16 error::Error GenHelper(GLsizei n,
16 const volatile ClientType* client_ids, 17 const volatile ClientType* client_ids,
17 ClientServiceMap<ClientType, ServiceType>* id_map, 18 ClientServiceMap<ClientType, ServiceType>* id_map,
(...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 return error::kNoError; 2244 return error::kNoError;
2244 } 2245 }
2245 2246
2246 error::Error 2247 error::Error
2247 GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleCHROMIUM( 2248 GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleCHROMIUM(
2248 GLenum target, 2249 GLenum target,
2249 GLsizei samples, 2250 GLsizei samples,
2250 GLenum internalformat, 2251 GLenum internalformat,
2251 GLsizei width, 2252 GLsizei width,
2252 GLsizei height) { 2253 GLsizei height) {
2253 glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, 2254 if (!feature_info_->feature_flags().chromium_framebuffer_multisample) {
2254 height); 2255 return error::kUnknownCommand;
2256 }
2257
2258 if (feature_info_->feature_flags().angle_framebuffer_multisample) {
2259 glRenderbufferStorageMultisampleANGLE(target, samples, internalformat,
2260 width, height);
2261 } else {
2262 DCHECK(feature_info_->gl_version_info().is_es3);
2263 glRenderbufferStorageMultisample(target, samples, internalformat, width,
2264 height);
2265 }
2255 return error::kNoError; 2266 return error::kNoError;
2256 } 2267 }
2257 2268
2258 error::Error GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleEXT( 2269 error::Error GLES2DecoderPassthroughImpl::DoRenderbufferStorageMultisampleEXT(
2259 GLenum target, 2270 GLenum target,
2260 GLsizei samples, 2271 GLsizei samples,
2261 GLenum internalformat, 2272 GLenum internalformat,
2262 GLsizei width, 2273 GLsizei width,
2263 GLsizei height) { 2274 GLsizei height) {
2264 glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, 2275 if (!feature_info_->feature_flags().chromium_framebuffer_multisample) {
2265 height); 2276 return error::kUnknownCommand;
2277 }
2278
2279 if (feature_info_->feature_flags().angle_framebuffer_multisample) {
2280 glRenderbufferStorageMultisampleANGLE(target, samples, internalformat,
2281 width, height);
2282 } else {
2283 DCHECK(feature_info_->gl_version_info().is_es3);
2284 glRenderbufferStorageMultisample(target, samples, internalformat, width,
2285 height);
2286 }
2266 return error::kNoError; 2287 return error::kNoError;
2267 } 2288 }
2268 2289
2269 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2DMultisampleEXT( 2290 error::Error GLES2DecoderPassthroughImpl::DoFramebufferTexture2DMultisampleEXT(
2270 GLenum target, 2291 GLenum target,
2271 GLenum attachment, 2292 GLenum attachment,
2272 GLenum textarget, 2293 GLenum textarget,
2273 GLuint texture, 2294 GLuint texture,
2274 GLint level, 2295 GLint level,
2275 GLsizei samples) { 2296 GLsizei samples) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 queries_copy.size(), queries_copy.data(), &query_id_map_, 2360 queries_copy.size(), queries_copy.data(), &query_id_map_,
2340 [](GLsizei n, GLuint* queries) { glDeleteQueries(n, queries); }); 2361 [](GLsizei n, GLuint* queries) { glDeleteQueries(n, queries); });
2341 } 2362 }
2342 2363
2343 error::Error GLES2DecoderPassthroughImpl::DoQueryCounterEXT( 2364 error::Error GLES2DecoderPassthroughImpl::DoQueryCounterEXT(
2344 GLuint id, 2365 GLuint id,
2345 GLenum target, 2366 GLenum target,
2346 int32_t sync_shm_id, 2367 int32_t sync_shm_id,
2347 uint32_t sync_shm_offset, 2368 uint32_t sync_shm_offset,
2348 uint32_t submit_count) { 2369 uint32_t submit_count) {
2370 if (!feature_info_->feature_flags().ext_disjoint_timer_query) {
2371 return error::kUnknownCommand;
2372 }
2373
2349 GLuint service_id = GetQueryServiceID(id, &query_id_map_); 2374 GLuint service_id = GetQueryServiceID(id, &query_id_map_);
2350 2375
2351 // Flush all previous errors 2376 // Flush all previous errors
2352 FlushErrors(); 2377 FlushErrors();
2353 2378
2354 glQueryCounter(service_id, target); 2379 glQueryCounter(service_id, target);
2355 2380
2356 // Check if a new error was generated 2381 // Check if a new error was generated
2357 if (FlushErrors()) { 2382 if (FlushErrors()) {
2358 return error::kNoError; 2383 return error::kNoError;
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
3011 3036
3012 error::Error GLES2DecoderPassthroughImpl::DoTraceEndCHROMIUM() { 3037 error::Error GLES2DecoderPassthroughImpl::DoTraceEndCHROMIUM() {
3013 NOTIMPLEMENTED(); 3038 NOTIMPLEMENTED();
3014 return error::kNoError; 3039 return error::kNoError;
3015 } 3040 }
3016 3041
3017 error::Error GLES2DecoderPassthroughImpl::DoDiscardFramebufferEXT( 3042 error::Error GLES2DecoderPassthroughImpl::DoDiscardFramebufferEXT(
3018 GLenum target, 3043 GLenum target,
3019 GLsizei count, 3044 GLsizei count,
3020 const volatile GLenum* attachments) { 3045 const volatile GLenum* attachments) {
3046 if (!feature_info_->feature_flags().ext_discard_framebuffer) {
3047 return error::kUnknownCommand;
3048 }
3049
3021 // Validate that count is non-negative before allocating a vector 3050 // Validate that count is non-negative before allocating a vector
3022 if (count < 0) { 3051 if (count < 0) {
3023 InsertError(GL_INVALID_VALUE, "count cannot be negative."); 3052 InsertError(GL_INVALID_VALUE, "count cannot be negative.");
3024 return error::kNoError; 3053 return error::kNoError;
3025 } 3054 }
3026 std::vector<GLenum> attachments_copy(attachments, attachments + count); 3055 std::vector<GLenum> attachments_copy(attachments, attachments + count);
3027 glDiscardFramebufferEXT(target, count, attachments_copy.data()); 3056
3057 if (feature_info_->gl_version_info().is_es3) {
3058 glInvalidateFramebuffer(target, count, attachments_copy.data());
3059 } else {
3060 glDiscardFramebufferEXT(target, count, attachments_copy.data());
3061 }
3062
3028 return error::kNoError; 3063 return error::kNoError;
3029 } 3064 }
3030 3065
3031 error::Error GLES2DecoderPassthroughImpl::DoLoseContextCHROMIUM(GLenum current, 3066 error::Error GLES2DecoderPassthroughImpl::DoLoseContextCHROMIUM(GLenum current,
3032 GLenum other) { 3067 GLenum other) {
3033 NOTIMPLEMENTED(); 3068 NOTIMPLEMENTED();
3034 return error::kNoError; 3069 return error::kNoError;
3035 } 3070 }
3036 3071
3037 error::Error GLES2DecoderPassthroughImpl::DoDescheduleUntilFinishedCHROMIUM() { 3072 error::Error GLES2DecoderPassthroughImpl::DoDescheduleUntilFinishedCHROMIUM() {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
3416 GLuint texture, 3451 GLuint texture,
3417 GLboolean promotion_hint, 3452 GLboolean promotion_hint,
3418 GLint display_x, 3453 GLint display_x,
3419 GLint display_y) { 3454 GLint display_y) {
3420 NOTIMPLEMENTED(); 3455 NOTIMPLEMENTED();
3421 return error::kNoError; 3456 return error::kNoError;
3422 } 3457 }
3423 3458
3424 } // namespace gles2 3459 } // namespace gles2
3425 } // namespace gpu 3460 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698