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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 1949303003: Improve indexed gl state related GL commands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tex
Patch Set: fix a DCHECK failure Created 4 years, 7 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 // Wrapper for glGetFramebufferAttachmentParameteriv. 1539 // Wrapper for glGetFramebufferAttachmentParameteriv.
1540 void DoGetFramebufferAttachmentParameteriv( 1540 void DoGetFramebufferAttachmentParameteriv(
1541 GLenum target, GLenum attachment, GLenum pname, GLint* params); 1541 GLenum target, GLenum attachment, GLenum pname, GLint* params);
1542 1542
1543 // Wrapper for glGetInteger64v. 1543 // Wrapper for glGetInteger64v.
1544 void DoGetInteger64v(GLenum pname, GLint64* params); 1544 void DoGetInteger64v(GLenum pname, GLint64* params);
1545 1545
1546 // Wrapper for glGetIntegerv. 1546 // Wrapper for glGetIntegerv.
1547 void DoGetIntegerv(GLenum pname, GLint* params); 1547 void DoGetIntegerv(GLenum pname, GLint* params);
1548 1548
1549 // Helper for DoGetIntegeri_v and DoGetInteger64i_v.
1550 template <typename TYPE>
1551 void GetIndexedIntegerImpl(
1552 const char* function_name, GLenum target, GLuint index, TYPE* data);
1553
1554 // Wrapper for glGetIntegeri_v.
1555 void DoGetIntegeri_v(GLenum target, GLuint index, GLint* data);
1556
1557 // Wrapper for glGetInteger64i_v.
1558 void DoGetInteger64i_v(GLenum target, GLuint index, GLint64* data);
1559
1549 // Gets the max value in a range in a buffer. 1560 // Gets the max value in a range in a buffer.
1550 GLuint DoGetMaxValueInBufferCHROMIUM( 1561 GLuint DoGetMaxValueInBufferCHROMIUM(
1551 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); 1562 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset);
1552 1563
1553 // Wrapper for glGetBufferParameteri64v. 1564 // Wrapper for glGetBufferParameteri64v.
1554 void DoGetBufferParameteri64v( 1565 void DoGetBufferParameteri64v(
1555 GLenum target, GLenum pname, GLint64* params); 1566 GLenum target, GLenum pname, GLint64* params);
1556 1567
1557 // Wrapper for glGetBufferParameteriv. 1568 // Wrapper for glGetBufferParameteriv.
1558 void DoGetBufferParameteriv( 1569 void DoGetBufferParameteriv(
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2822 2833
2823 // Create a fake default transform feedback and bind to it. 2834 // Create a fake default transform feedback and bind to it.
2824 GLuint default_transform_feedback = 0; 2835 GLuint default_transform_feedback = 0;
2825 glGenTransformFeedbacks(1, &default_transform_feedback); 2836 glGenTransformFeedbacks(1, &default_transform_feedback);
2826 state_.default_transform_feedback = 2837 state_.default_transform_feedback =
2827 transform_feedback_manager_->CreateTransformFeedback( 2838 transform_feedback_manager_->CreateTransformFeedback(
2828 0, default_transform_feedback); 2839 0, default_transform_feedback);
2829 glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, default_transform_feedback); 2840 glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, default_transform_feedback);
2830 state_.bound_transform_feedback = state_.default_transform_feedback.get(); 2841 state_.bound_transform_feedback = state_.default_transform_feedback.get();
2831 } 2842 }
2843 state_.indexed_uniform_buffer_bindings = new IndexedBufferBindingHost(
2844 group_->max_uniform_buffer_bindings(), needs_emulation);
2832 2845
2833 state_.attrib_values.resize(group_->max_vertex_attribs()); 2846 state_.attrib_values.resize(group_->max_vertex_attribs());
2834 vertex_array_manager_.reset(new VertexArrayManager()); 2847 vertex_array_manager_.reset(new VertexArrayManager());
2835 2848
2836 GLuint default_vertex_attrib_service_id = 0; 2849 GLuint default_vertex_attrib_service_id = 0;
2837 if (features().native_vertex_array_object) { 2850 if (features().native_vertex_array_object) {
2838 glGenVertexArraysOES(1, &default_vertex_attrib_service_id); 2851 glGenVertexArraysOES(1, &default_vertex_attrib_service_id);
2839 glBindVertexArrayOES(default_vertex_attrib_service_id); 2852 glBindVertexArrayOES(default_vertex_attrib_service_id);
2840 } 2853 }
2841 2854
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
4196 state_.bound_copy_write_buffer = nullptr; 4209 state_.bound_copy_write_buffer = nullptr;
4197 state_.bound_pixel_pack_buffer = nullptr; 4210 state_.bound_pixel_pack_buffer = nullptr;
4198 state_.bound_pixel_unpack_buffer = nullptr; 4211 state_.bound_pixel_unpack_buffer = nullptr;
4199 state_.bound_transform_feedback_buffer = nullptr; 4212 state_.bound_transform_feedback_buffer = nullptr;
4200 state_.bound_uniform_buffer = nullptr; 4213 state_.bound_uniform_buffer = nullptr;
4201 framebuffer_state_.bound_read_framebuffer = nullptr; 4214 framebuffer_state_.bound_read_framebuffer = nullptr;
4202 framebuffer_state_.bound_draw_framebuffer = nullptr; 4215 framebuffer_state_.bound_draw_framebuffer = nullptr;
4203 state_.bound_renderbuffer = nullptr; 4216 state_.bound_renderbuffer = nullptr;
4204 state_.bound_transform_feedback = nullptr; 4217 state_.bound_transform_feedback = nullptr;
4205 state_.default_transform_feedback = nullptr; 4218 state_.default_transform_feedback = nullptr;
4219 state_.indexed_uniform_buffer_bindings = nullptr;
4206 4220
4207 if (offscreen_saved_color_texture_info_.get()) { 4221 if (offscreen_saved_color_texture_info_.get()) {
4208 DCHECK(offscreen_target_color_texture_); 4222 DCHECK(offscreen_target_color_texture_);
4209 DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(), 4223 DCHECK_EQ(offscreen_saved_color_texture_info_->service_id(),
4210 offscreen_saved_color_texture_->id()); 4224 offscreen_saved_color_texture_->id());
4211 offscreen_saved_color_texture_->Invalidate(); 4225 offscreen_saved_color_texture_->Invalidate();
4212 offscreen_saved_color_texture_info_ = NULL; 4226 offscreen_saved_color_texture_info_ = NULL;
4213 } 4227 }
4214 ReleaseAllBackTextures(); 4228 ReleaseAllBackTextures();
4215 if (have_context) { 4229 if (have_context) {
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
4845 } 4859 }
4846 case GL_UNIFORM_BUFFER: { 4860 case GL_UNIFORM_BUFFER: {
4847 if (index >= group_->max_uniform_buffer_bindings()) { 4861 if (index >= group_->max_uniform_buffer_bindings()) {
4848 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, 4862 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name,
4849 "index out of range"); 4863 "index out of range");
4850 return; 4864 return;
4851 } 4865 }
4852 break; 4866 break;
4853 } 4867 }
4854 default: 4868 default:
4855 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "invalid target"); 4869 NOTREACHED();
4856 return; 4870 break;
4857 } 4871 }
4858 4872
4859 if (function_type == kBindBufferRange) { 4873 if (function_type == kBindBufferRange) {
4860 switch (target) { 4874 switch (target) {
4861 case GL_TRANSFORM_FEEDBACK_BUFFER: 4875 case GL_TRANSFORM_FEEDBACK_BUFFER:
4862 if ((size % 4 != 0) || (offset % 4 != 0)) { 4876 if ((size % 4 != 0) || (offset % 4 != 0)) {
4863 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, 4877 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name,
4864 "size or offset are not multiples of 4"); 4878 "size or offset are not multiples of 4");
4865 return; 4879 return;
4866 } 4880 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4904 // It's a new id so make a buffer for it. 4918 // It's a new id so make a buffer for it.
4905 glGenBuffersARB(1, &service_id); 4919 glGenBuffersARB(1, &service_id);
4906 CreateBuffer(client_id, service_id); 4920 CreateBuffer(client_id, service_id);
4907 buffer = GetBuffer(client_id); 4921 buffer = GetBuffer(client_id);
4908 DCHECK(buffer); 4922 DCHECK(buffer);
4909 } 4923 }
4910 service_id = buffer->service_id(); 4924 service_id = buffer->service_id();
4911 } 4925 }
4912 LogClientServiceForInfo(buffer, client_id, function_name); 4926 LogClientServiceForInfo(buffer, client_id, function_name);
4913 4927
4928 scoped_refptr<IndexedBufferBindingHost> bindings;
4914 switch (target) { 4929 switch (target) {
4915 case GL_TRANSFORM_FEEDBACK_BUFFER: 4930 case GL_TRANSFORM_FEEDBACK_BUFFER:
4916 DCHECK(state_.bound_transform_feedback.get()); 4931 bindings = state_.bound_transform_feedback.get();
4917 switch (function_type) {
4918 case kBindBufferBase:
4919 state_.bound_transform_feedback->DoBindBufferBase(
4920 target, index, buffer);
4921 break;
4922 case kBindBufferRange:
4923 state_.bound_transform_feedback->DoBindBufferRange(
4924 target, index, buffer, offset, size);
4925 break;
4926 }
4927 break; 4932 break;
4928 case GL_UNIFORM_BUFFER: 4933 case GL_UNIFORM_BUFFER:
4929 // TODO(zmo): emulate Desktop GL 4.1 or lower behavior and keep track of 4934 bindings = state_.indexed_uniform_buffer_bindings.get();
4930 // indexed buffer bindings.
4931 switch (function_type) {
4932 case kBindBufferBase:
4933 glBindBufferBase(target, index, service_id);
4934 break;
4935 case kBindBufferRange:
4936 glBindBufferRange(target, index, service_id, offset, size);
4937 break;
4938 }
4939 break; 4935 break;
4940 default: 4936 default:
4941 NOTREACHED(); 4937 NOTREACHED();
4938 break;
4939 }
4940 DCHECK(bindings);
4941 switch (function_type) {
4942 case kBindBufferBase:
4943 bindings->DoBindBufferBase(target, index, buffer);
4944 break;
4945 case kBindBufferRange:
4946 bindings->DoBindBufferRange(target, index, buffer, offset, size);
4947 break;
4948 default:
4949 NOTREACHED();
4942 break; 4950 break;
4943 } 4951 }
4944 } 4952 }
4945 4953
4946 void GLES2DecoderImpl::DoBindBufferBase(GLenum target, GLuint index, 4954 void GLES2DecoderImpl::DoBindBufferBase(GLenum target, GLuint index,
4947 GLuint client_id) { 4955 GLuint client_id) {
4948 BindIndexedBufferImpl(target, index, client_id, 0, 0, 4956 BindIndexedBufferImpl(target, index, client_id, 0, 0,
4949 kBindBufferBase, "glBindBufferBase"); 4957 kBindBufferBase, "glBindBufferBase");
4950 } 4958 }
4951 4959
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
5262 } else { 5270 } else {
5263 glBindSampler(unit, 0); 5271 glBindSampler(unit, 0);
5264 } 5272 }
5265 5273
5266 state_.sampler_units[unit] = sampler; 5274 state_.sampler_units[unit] = sampler;
5267 } 5275 }
5268 5276
5269 void GLES2DecoderImpl::DoBindTransformFeedback( 5277 void GLES2DecoderImpl::DoBindTransformFeedback(
5270 GLenum target, GLuint client_id) { 5278 GLenum target, GLuint client_id) {
5271 const char* function_name = "glBindTransformFeedback"; 5279 const char* function_name = "glBindTransformFeedback";
5272 if (!validators_->transform_feedback_bind_target.IsValid(target)) {
5273 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target");
5274 return;
5275 }
5276 5280
5277 TransformFeedback* transform_feedback = nullptr; 5281 TransformFeedback* transform_feedback = nullptr;
5278 if (client_id != 0) { 5282 if (client_id != 0) {
5279 transform_feedback = GetTransformFeedback(client_id); 5283 transform_feedback = GetTransformFeedback(client_id);
5280 if (!transform_feedback) { 5284 if (!transform_feedback) {
5281 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, 5285 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name,
5282 "id not generated by glGenTransformFeedbacks"); 5286 "id not generated by glGenTransformFeedbacks");
5283 return; 5287 return;
5284 } 5288 }
5285 } else { 5289 } else {
5286 transform_feedback = state_.default_transform_feedback.get(); 5290 transform_feedback = state_.default_transform_feedback.get();
5287 } 5291 }
5288 DCHECK(transform_feedback); 5292 DCHECK(transform_feedback);
5289 if (transform_feedback == state_.bound_transform_feedback.get()) 5293 if (transform_feedback == state_.bound_transform_feedback.get())
5290 return; 5294 return;
5291 if (state_.bound_transform_feedback->active() && 5295 if (state_.bound_transform_feedback->active() &&
5292 !state_.bound_transform_feedback->paused()) { 5296 !state_.bound_transform_feedback->paused()) {
5293 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, 5297 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name,
5294 "currently bound transform feedback is active"); 5298 "currently bound transform feedback is active");
5295 return; 5299 return;
5296 } 5300 }
5297 LogClientServiceForInfo(transform_feedback, client_id, function_name); 5301 LogClientServiceForInfo(transform_feedback, client_id, function_name);
5298 transform_feedback->DoBindTransformFeedback(target); 5302 transform_feedback->DoBindTransformFeedback(target);
5299 state_.bound_transform_feedback = transform_feedback; 5303 state_.bound_transform_feedback = transform_feedback;
5300 } 5304 }
5301 5305
5302 void GLES2DecoderImpl::DoBeginTransformFeedback(GLenum primitive_mode) { 5306 void GLES2DecoderImpl::DoBeginTransformFeedback(GLenum primitive_mode) {
5303 const char* function_name = "glBeginTransformFeedback"; 5307 const char* function_name = "glBeginTransformFeedback";
5304 DCHECK(state_.bound_transform_feedback.get()); 5308 DCHECK(state_.bound_transform_feedback.get());
5305 if (!validators_->transform_feedback_primitive_mode.IsValid(primitive_mode)) {
5306 LOCAL_SET_GL_ERROR_INVALID_ENUM(
5307 function_name, primitive_mode, "primitiveMode");
5308 return;
5309 }
5310 if (state_.bound_transform_feedback->active()) { 5309 if (state_.bound_transform_feedback->active()) {
5311 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, 5310 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name,
5312 "transform feedback is already active"); 5311 "transform feedback is already active");
5313 return; 5312 return;
5314 } 5313 }
5315 state_.bound_transform_feedback->DoBeginTransformFeedback(primitive_mode); 5314 state_.bound_transform_feedback->DoBeginTransformFeedback(primitive_mode);
5316 } 5315 }
5317 5316
5318 void GLES2DecoderImpl::DoEndTransformFeedback() { 5317 void GLES2DecoderImpl::DoEndTransformFeedback() {
5319 const char* function_name = "glEndTransformFeedback"; 5318 const char* function_name = "glEndTransformFeedback";
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
5358 LOCAL_SET_GL_ERROR( 5357 LOCAL_SET_GL_ERROR(
5359 GL_INVALID_VALUE, 5358 GL_INVALID_VALUE,
5360 "glDisableVertexAttribArray", "index out of range"); 5359 "glDisableVertexAttribArray", "index out of range");
5361 } 5360 }
5362 } 5361 }
5363 5362
5364 void GLES2DecoderImpl::InvalidateFramebufferImpl( 5363 void GLES2DecoderImpl::InvalidateFramebufferImpl(
5365 GLenum target, GLsizei count, const GLenum* attachments, 5364 GLenum target, GLsizei count, const GLenum* attachments,
5366 GLint x, GLint y, GLsizei width, GLsizei height, 5365 GLint x, GLint y, GLsizei width, GLsizei height,
5367 const char* function_name, FramebufferOperation op) { 5366 const char* function_name, FramebufferOperation op) {
5368 if (!validators_->frame_buffer_target.IsValid(target)) {
5369 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target");
5370 return;
5371 }
5372 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER); 5367 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER);
5373 5368
5374 // Validates the attachments. If one of them fails, the whole command fails. 5369 // Validates the attachments. If one of them fails, the whole command fails.
5375 GLenum thresh0 = GL_COLOR_ATTACHMENT0 + group_->max_color_attachments(); 5370 GLenum thresh0 = GL_COLOR_ATTACHMENT0 + group_->max_color_attachments();
5376 GLenum thresh1 = GL_COLOR_ATTACHMENT15; 5371 GLenum thresh1 = GL_COLOR_ATTACHMENT15;
5377 for (GLsizei i = 0; i < count; ++i) { 5372 for (GLsizei i = 0; i < count; ++i) {
5378 if (framebuffer) { 5373 if (framebuffer) {
5379 if (attachments[i] >= thresh0 && attachments[i] <= thresh1) { 5374 if (attachments[i] >= thresh0 && attachments[i] <= thresh1) {
5380 LOCAL_SET_GL_ERROR( 5375 LOCAL_SET_GL_ERROR(
5381 GL_INVALID_OPERATION, function_name, "invalid attachment"); 5376 GL_INVALID_OPERATION, function_name, "invalid attachment");
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
6145 void GLES2DecoderImpl::DoGetIntegerv(GLenum pname, GLint* params) { 6140 void GLES2DecoderImpl::DoGetIntegerv(GLenum pname, GLint* params) {
6146 DCHECK(params); 6141 DCHECK(params);
6147 GLsizei num_written; 6142 GLsizei num_written;
6148 if (!state_.GetStateAsGLint(pname, params, &num_written) && 6143 if (!state_.GetStateAsGLint(pname, params, &num_written) &&
6149 !GetHelper(pname, params, &num_written)) { 6144 !GetHelper(pname, params, &num_written)) {
6150 pname = AdjustGetPname(pname); 6145 pname = AdjustGetPname(pname);
6151 glGetIntegerv(pname, params); 6146 glGetIntegerv(pname, params);
6152 } 6147 }
6153 } 6148 }
6154 6149
6150 template <typename TYPE>
6151 void GLES2DecoderImpl::GetIndexedIntegerImpl(
6152 const char* function_name, GLenum target, GLuint index, TYPE* data) {
6153 DCHECK(data);
6154 scoped_refptr<IndexedBufferBindingHost> bindings;
6155 switch (target) {
6156 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
6157 case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
6158 case GL_TRANSFORM_FEEDBACK_BUFFER_START:
6159 if (index >= group_->max_transform_feedback_separate_attribs()) {
6160 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid index");
6161 return;
6162 }
6163 bindings = state_.bound_transform_feedback.get();
6164 break;
6165 case GL_UNIFORM_BUFFER_BINDING:
6166 case GL_UNIFORM_BUFFER_SIZE:
6167 case GL_UNIFORM_BUFFER_START:
6168 if (index >= group_->max_uniform_buffer_bindings()) {
6169 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid index");
6170 return;
6171 }
6172 bindings = state_.indexed_uniform_buffer_bindings.get();
6173 break;
6174 default:
6175 NOTREACHED();
6176 break;
6177 }
6178 DCHECK(bindings);
6179 switch (target) {
6180 case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
6181 case GL_UNIFORM_BUFFER_BINDING:
6182 {
6183 Buffer* buffer = bindings->GetBufferBinding(index);
6184 *data = static_cast<TYPE>(buffer ? buffer->service_id() : 0);
6185 }
6186 break;
6187 case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
6188 case GL_UNIFORM_BUFFER_SIZE:
6189 *data = static_cast<TYPE>(bindings->GetBufferSize(index));
6190 break;
6191 case GL_TRANSFORM_FEEDBACK_BUFFER_START:
6192 case GL_UNIFORM_BUFFER_START:
6193 *data = static_cast<TYPE>(bindings->GetBufferStart(index));
6194 break;
6195 default:
6196 NOTREACHED();
6197 break;
6198 }
6199 }
6200
6201 void GLES2DecoderImpl::DoGetIntegeri_v(
6202 GLenum target, GLuint index, GLint* data) {
6203 GetIndexedIntegerImpl<GLint>("glGetIntegeri_v", target, index, data);
6204 }
6205
6206 void GLES2DecoderImpl::DoGetInteger64i_v(
6207 GLenum target, GLuint index, GLint64* data) {
6208 GetIndexedIntegerImpl<GLint64>("glGetInteger64i_v", target, index, data);
6209 }
6210
6155 void GLES2DecoderImpl::DoGetProgramiv( 6211 void GLES2DecoderImpl::DoGetProgramiv(
6156 GLuint program_id, GLenum pname, GLint* params) { 6212 GLuint program_id, GLenum pname, GLint* params) {
6157 Program* program = GetProgramInfoNotShader(program_id, "glGetProgramiv"); 6213 Program* program = GetProgramInfoNotShader(program_id, "glGetProgramiv");
6158 if (!program) { 6214 if (!program) {
6159 return; 6215 return;
6160 } 6216 }
6161 program->GetProgramiv(pname, params); 6217 program->GetProgramiv(pname, params);
6162 } 6218 }
6163 6219
6164 void GLES2DecoderImpl::DoGetBufferParameteri64v( 6220 void GLES2DecoderImpl::DoGetBufferParameteri64v(
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
6446 return error::kNoError; 6502 return error::kNoError;
6447 } 6503 }
6448 6504
6449 void GLES2DecoderImpl::DoClearBufferiv( 6505 void GLES2DecoderImpl::DoClearBufferiv(
6450 GLenum buffer, GLint drawbuffer, const GLint* value) { 6506 GLenum buffer, GLint drawbuffer, const GLint* value) {
6451 // TODO(zmo): Set clear_uncleared_images=true once crbug.com/584059 is fixed. 6507 // TODO(zmo): Set clear_uncleared_images=true once crbug.com/584059 is fixed.
6452 if (!CheckBoundDrawFramebufferValid(false, "glClearBufferiv")) 6508 if (!CheckBoundDrawFramebufferValid(false, "glClearBufferiv"))
6453 return; 6509 return;
6454 ApplyDirtyState(); 6510 ApplyDirtyState();
6455 6511
6456 switch (buffer) {
6457 case GL_COLOR:
6458 case GL_STENCIL:
6459 break;
6460 default:
6461 LOCAL_SET_GL_ERROR(
6462 GL_INVALID_ENUM, "glClearBufferiv", "invalid buffer");
6463 return;
6464 }
6465 if (buffer == GL_COLOR) { 6512 if (buffer == GL_COLOR) {
6466 if (drawbuffer < 0 || 6513 if (drawbuffer < 0 ||
6467 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { 6514 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) {
6468 LOCAL_SET_GL_ERROR( 6515 LOCAL_SET_GL_ERROR(
6469 GL_INVALID_VALUE, "glClearBufferiv", "invalid drawBuffer"); 6516 GL_INVALID_VALUE, "glClearBufferiv", "invalid drawBuffer");
6470 return; 6517 return;
6471 } 6518 }
6472 GLenum internal_format = 6519 GLenum internal_format =
6473 GetBoundColorDrawBufferInternalFormat(drawbuffer); 6520 GetBoundColorDrawBufferInternalFormat(drawbuffer);
6474 if (!GLES2Util::IsSignedIntegerFormat(internal_format)) { 6521 if (!GLES2Util::IsSignedIntegerFormat(internal_format)) {
(...skipping 15 matching lines...) Expand all
6490 glClearBufferiv(buffer, drawbuffer, value); 6537 glClearBufferiv(buffer, drawbuffer, value);
6491 } 6538 }
6492 6539
6493 void GLES2DecoderImpl::DoClearBufferuiv( 6540 void GLES2DecoderImpl::DoClearBufferuiv(
6494 GLenum buffer, GLint drawbuffer, const GLuint* value) { 6541 GLenum buffer, GLint drawbuffer, const GLuint* value) {
6495 // TODO(zmo): Set clear_uncleared_images=true once crbug.com/584059 is fixed. 6542 // TODO(zmo): Set clear_uncleared_images=true once crbug.com/584059 is fixed.
6496 if (!CheckBoundDrawFramebufferValid(false, "glClearBufferuiv")) 6543 if (!CheckBoundDrawFramebufferValid(false, "glClearBufferuiv"))
6497 return; 6544 return;
6498 ApplyDirtyState(); 6545 ApplyDirtyState();
6499 6546
6500 switch (buffer) {
6501 case GL_COLOR:
6502 break;
6503 default:
6504 LOCAL_SET_GL_ERROR(
6505 GL_INVALID_ENUM, "glClearBufferuiv", "invalid buffer");
6506 return;
6507 }
6508 if (drawbuffer < 0 || 6547 if (drawbuffer < 0 ||
6509 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { 6548 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) {
6510 LOCAL_SET_GL_ERROR( 6549 LOCAL_SET_GL_ERROR(
6511 GL_INVALID_VALUE, "glClearBufferuiv", "invalid drawBuffer"); 6550 GL_INVALID_VALUE, "glClearBufferuiv", "invalid drawBuffer");
6512 return; 6551 return;
6513 } 6552 }
6514 GLenum internal_format = 6553 GLenum internal_format =
6515 GetBoundColorDrawBufferInternalFormat(drawbuffer); 6554 GetBoundColorDrawBufferInternalFormat(drawbuffer);
6516 if (!GLES2Util::IsUnsignedIntegerFormat(internal_format)) { 6555 if (!GLES2Util::IsUnsignedIntegerFormat(internal_format)) {
6517 // To avoid undefined results, return without calling the gl function. 6556 // To avoid undefined results, return without calling the gl function.
6518 return; 6557 return;
6519 } 6558 }
6520 MarkDrawBufferAsCleared(buffer, drawbuffer); 6559 MarkDrawBufferAsCleared(buffer, drawbuffer);
6521 glClearBufferuiv(buffer, drawbuffer, value); 6560 glClearBufferuiv(buffer, drawbuffer, value);
6522 } 6561 }
6523 6562
6524 void GLES2DecoderImpl::DoClearBufferfv( 6563 void GLES2DecoderImpl::DoClearBufferfv(
6525 GLenum buffer, GLint drawbuffer, const GLfloat* value) { 6564 GLenum buffer, GLint drawbuffer, const GLfloat* value) {
6526 // TODO(zmo): Set clear_uncleared_images=true once crbug.com/584059 is fixed. 6565 // TODO(zmo): Set clear_uncleared_images=true once crbug.com/584059 is fixed.
6527 if (!CheckBoundDrawFramebufferValid(false, "glClearBufferfv")) 6566 if (!CheckBoundDrawFramebufferValid(false, "glClearBufferfv"))
6528 return; 6567 return;
6529 ApplyDirtyState(); 6568 ApplyDirtyState();
6530 6569
6531 switch (buffer) {
6532 case GL_COLOR:
6533 case GL_DEPTH:
6534 break;
6535 default:
6536 LOCAL_SET_GL_ERROR(
6537 GL_INVALID_ENUM, "glClearBufferfv", "invalid buffer");
6538 return;
6539 }
6540 if (buffer == GL_COLOR) { 6570 if (buffer == GL_COLOR) {
6541 if (drawbuffer < 0 || 6571 if (drawbuffer < 0 ||
6542 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) { 6572 drawbuffer >= static_cast<GLint>(group_->max_draw_buffers())) {
6543 LOCAL_SET_GL_ERROR( 6573 LOCAL_SET_GL_ERROR(
6544 GL_INVALID_VALUE, "glClearBufferfv", "invalid drawBuffer"); 6574 GL_INVALID_VALUE, "glClearBufferfv", "invalid drawBuffer");
6545 return; 6575 return;
6546 } 6576 }
6547 GLenum internal_format = 6577 GLenum internal_format =
6548 GetBoundColorDrawBufferInternalFormat(drawbuffer); 6578 GetBoundColorDrawBufferInternalFormat(drawbuffer);
6549 if (GLES2Util::IsIntegerFormat(internal_format)) { 6579 if (GLES2Util::IsIntegerFormat(internal_format)) {
(...skipping 15 matching lines...) Expand all
6565 glClearBufferfv(buffer, drawbuffer, value); 6595 glClearBufferfv(buffer, drawbuffer, value);
6566 } 6596 }
6567 6597
6568 void GLES2DecoderImpl::DoClearBufferfi( 6598 void GLES2DecoderImpl::DoClearBufferfi(
6569 GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) { 6599 GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) {
6570 // TODO(zmo): Set clear_uncleared_images=true once crbug.com/584059 is fixed. 6600 // TODO(zmo): Set clear_uncleared_images=true once crbug.com/584059 is fixed.
6571 if (!CheckBoundDrawFramebufferValid(false, "glClearBufferfi")) 6601 if (!CheckBoundDrawFramebufferValid(false, "glClearBufferfi"))
6572 return; 6602 return;
6573 ApplyDirtyState(); 6603 ApplyDirtyState();
6574 6604
6575 switch (buffer) {
6576 case GL_DEPTH_STENCIL:
6577 break;
6578 default:
6579 LOCAL_SET_GL_ERROR(
6580 GL_INVALID_ENUM, "glClearBufferfi", "invalid buffer");
6581 return;
6582 }
6583 if (drawbuffer != 0) { 6605 if (drawbuffer != 0) {
6584 LOCAL_SET_GL_ERROR( 6606 LOCAL_SET_GL_ERROR(
6585 GL_INVALID_VALUE, "glClearBufferfi", "invalid drawBuffer"); 6607 GL_INVALID_VALUE, "glClearBufferfi", "invalid drawBuffer");
6586 return; 6608 return;
6587 } 6609 }
6588 if (!BoundFramebufferHasDepthAttachment() && 6610 if (!BoundFramebufferHasDepthAttachment() &&
6589 !BoundFramebufferHasStencilAttachment()) { 6611 !BoundFramebufferHasStencilAttachment()) {
6590 return; 6612 return;
6591 } 6613 }
6592 MarkDrawBufferAsCleared(GL_DEPTH, drawbuffer); 6614 MarkDrawBufferAsCleared(GL_DEPTH, drawbuffer);
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
6868 if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { 6890 if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) {
6869 framebuffer_state_.clear_state_dirty = true; 6891 framebuffer_state_.clear_state_dirty = true;
6870 } 6892 }
6871 6893
6872 OnFboChanged(); 6894 OnFboChanged();
6873 } 6895 }
6874 6896
6875 void GLES2DecoderImpl::DoFramebufferTextureLayer( 6897 void GLES2DecoderImpl::DoFramebufferTextureLayer(
6876 GLenum target, GLenum attachment, GLuint client_texture_id, 6898 GLenum target, GLenum attachment, GLuint client_texture_id,
6877 GLint level, GLint layer) { 6899 GLint level, GLint layer) {
6878 // TODO(zmo): Add full validation. 6900 const char* function_name = "glFramebufferTextureLayer";
6879 GLuint service_id = 0; 6901
6880 TextureRef* texture_ref = NULL; 6902 TextureRef* texture_ref = nullptr;
6881 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); 6903 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
6882 if (!framebuffer) { 6904 if (!framebuffer) {
6883 LOCAL_SET_GL_ERROR( 6905 LOCAL_SET_GL_ERROR(
6884 GL_INVALID_OPERATION, 6906 GL_INVALID_OPERATION, function_name, "no framebuffer bound.");
6885 "glFramebufferTextureLayer", "no framebuffer bound.");
6886 return; 6907 return;
6887 } 6908 }
6909 GLuint service_id = 0;
6910 GLenum texture_target = 0;
6888 if (client_texture_id) { 6911 if (client_texture_id) {
6889 texture_ref = GetTexture(client_texture_id); 6912 texture_ref = GetTexture(client_texture_id);
6890 if (!texture_ref) { 6913 if (!texture_ref) {
6891 LOCAL_SET_GL_ERROR( 6914 LOCAL_SET_GL_ERROR(
6892 GL_INVALID_OPERATION, 6915 GL_INVALID_VALUE, function_name, "unknown texture");
6893 "glFramebufferTextureLayer", "unknown texture_ref");
6894 return; 6916 return;
6895 } 6917 }
6896 service_id = texture_ref->service_id(); 6918 service_id = texture_ref->service_id();
6919
6920 texture_target = texture_ref->texture()->target();
6921 switch (texture_target) {
6922 case GL_TEXTURE_3D:
6923 case GL_TEXTURE_2D_ARRAY:
6924 break;
6925 default:
6926 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name,
6927 "texture is neither TEXTURE_3D nor TEXTURE_2D_ARRAY");
6928 return;
6929 }
6930 if (!texture_manager()->ValidForTarget(texture_target, level,
6931 0, 0, layer)) {
6932 LOCAL_SET_GL_ERROR(
6933 GL_INVALID_VALUE, function_name, "invalid level or layer");
6934 return;
6935 }
6897 } 6936 }
6898 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glFramebufferTextureLayer");
6899 glFramebufferTextureLayer(target, attachment, service_id, level, layer); 6937 glFramebufferTextureLayer(target, attachment, service_id, level, layer);
6900 GLenum error = LOCAL_PEEK_GL_ERROR("glFramebufferTextureLayer"); 6938 framebuffer->AttachTextureLayer(
6901 if (error == GL_NO_ERROR) { 6939 attachment, texture_ref, texture_target, level, layer);
6902 framebuffer->AttachTextureLayer(attachment, texture_ref,
6903 texture_ref ? texture_ref->texture()->target() : 0,
6904 level, layer);
6905 }
6906 if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { 6940 if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) {
6907 framebuffer_state_.clear_state_dirty = true; 6941 framebuffer_state_.clear_state_dirty = true;
6908 } 6942 }
6909 } 6943 }
6910 6944
6911 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv( 6945 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv(
6912 GLenum target, GLenum attachment, GLenum pname, GLint* params) { 6946 GLenum target, GLenum attachment, GLenum pname, GLint* params) {
6913 const char kFunctionName[] = "glGetFramebufferAttachmentParameteriv"; 6947 const char kFunctionName[] = "glGetFramebufferAttachmentParameteriv";
6914 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); 6948 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
6915 if (!framebuffer) { 6949 if (!framebuffer) {
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
7394 program_manager()->ClearUniforms(program); 7428 program_manager()->ClearUniforms(program);
7395 } 7429 }
7396 } 7430 }
7397 7431
7398 // LinkProgram can be very slow. Exit command processing to allow for 7432 // LinkProgram can be very slow. Exit command processing to allow for
7399 // context preemption and GPU watchdog checks. 7433 // context preemption and GPU watchdog checks.
7400 ExitCommandProcessingEarly(); 7434 ExitCommandProcessingEarly();
7401 } 7435 }
7402 7436
7403 void GLES2DecoderImpl::DoReadBuffer(GLenum src) { 7437 void GLES2DecoderImpl::DoReadBuffer(GLenum src) {
7404 switch (src) {
7405 case GL_NONE:
7406 case GL_BACK:
7407 break;
7408 default:
7409 {
7410 GLenum upper_limit = static_cast<GLenum>(
7411 group_->max_color_attachments() + GL_COLOR_ATTACHMENT0);
7412 if (src < GL_COLOR_ATTACHMENT0 || src >= upper_limit) {
7413 LOCAL_SET_GL_ERROR(
7414 GL_INVALID_ENUM, "glReadBuffer", "invalid enum for src");
7415 return;
7416 }
7417 }
7418 break;
7419 }
7420
7421 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER); 7438 Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_READ_FRAMEBUFFER);
7422 if (framebuffer) { 7439 if (framebuffer) {
7423 if (src == GL_BACK) { 7440 if (src == GL_BACK) {
7424 LOCAL_SET_GL_ERROR( 7441 LOCAL_SET_GL_ERROR(
7425 GL_INVALID_ENUM, "glReadBuffer", 7442 GL_INVALID_ENUM, "glReadBuffer",
7426 "invalid src for a named framebuffer"); 7443 "invalid src for a named framebuffer");
7427 return; 7444 return;
7428 } 7445 }
7429 framebuffer->set_read_buffer(src); 7446 framebuffer->set_read_buffer(src);
7430 } else { 7447 } else {
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
8577 if (!CheckBoundDrawFramebufferValid(true, function_name)) { 8594 if (!CheckBoundDrawFramebufferValid(true, function_name)) {
8578 return error::kNoError; 8595 return error::kNoError;
8579 } 8596 }
8580 // We have to check this here because the prototype for glDrawArrays 8597 // We have to check this here because the prototype for glDrawArrays
8581 // is GLint not GLsizei. 8598 // is GLint not GLsizei.
8582 if (first < 0) { 8599 if (first < 0) {
8583 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "first < 0"); 8600 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "first < 0");
8584 return error::kNoError; 8601 return error::kNoError;
8585 } 8602 }
8586 8603
8604 if (state_.bound_transform_feedback.get() &&
8605 state_.bound_transform_feedback->active() &&
8606 !state_.bound_transform_feedback->paused() &&
8607 mode != state_.bound_transform_feedback->primitive_mode()) {
8608 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name,
8609 "mode is not identical with active transformfeedback's primitiveMode");
8610 return error::kNoError;
8611 }
8612
8587 if (count == 0 || primcount == 0) { 8613 if (count == 0 || primcount == 0) {
8588 LOCAL_RENDER_WARNING("Render count or primcount is 0."); 8614 LOCAL_RENDER_WARNING("Render count or primcount is 0.");
8589 return error::kNoError; 8615 return error::kNoError;
8590 } 8616 }
8591 8617
8592 GLuint max_vertex_accessed = first + count - 1; 8618 GLuint max_vertex_accessed = first + count - 1;
8593 if (IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) { 8619 if (IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) {
8594 if (!ClearUnclearedTextures()) { 8620 if (!ClearUnclearedTextures()) {
8595 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "out of memory"); 8621 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "out of memory");
8596 return error::kNoError; 8622 return error::kNoError;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
8690 } 8716 }
8691 if (primcount < 0) { 8717 if (primcount < 0) {
8692 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0"); 8718 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0");
8693 return error::kNoError; 8719 return error::kNoError;
8694 } 8720 }
8695 8721
8696 if (!CheckBoundDrawFramebufferValid(true, function_name)) { 8722 if (!CheckBoundDrawFramebufferValid(true, function_name)) {
8697 return error::kNoError; 8723 return error::kNoError;
8698 } 8724 }
8699 8725
8726 if (state_.bound_transform_feedback.get() &&
8727 state_.bound_transform_feedback->active() &&
8728 !state_.bound_transform_feedback->paused()) {
8729 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name,
8730 "transformfeedback is active and not paused");
8731 return error::kNoError;
8732 }
8733
8700 if (count == 0 || primcount == 0) { 8734 if (count == 0 || primcount == 0) {
8701 return error::kNoError; 8735 return error::kNoError;
8702 } 8736 }
8703 8737
8704 GLuint max_vertex_accessed; 8738 GLuint max_vertex_accessed;
8705 Buffer* element_array_buffer = 8739 Buffer* element_array_buffer =
8706 state_.vertex_attrib_manager->element_array_buffer(); 8740 state_.vertex_attrib_manager->element_array_buffer();
8707 8741
8708 if (!element_array_buffer->GetMaxValueForRange( 8742 if (!element_array_buffer->GetMaxValueForRange(
8709 offset, count, type, 8743 offset, count, type,
(...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after
11686 } 11720 }
11687 } 11721 }
11688 return DoCompressedTexImage3D(target, level, internal_format, width, height, 11722 return DoCompressedTexImage3D(target, level, internal_format, width, height,
11689 depth, border, imageSize, data); 11723 depth, border, imageSize, data);
11690 } 11724 }
11691 11725
11692 void GLES2DecoderImpl::DoCompressedTexSubImage3D( 11726 void GLES2DecoderImpl::DoCompressedTexSubImage3D(
11693 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 11727 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
11694 GLsizei width, GLsizei height, GLsizei depth, GLenum format, 11728 GLsizei width, GLsizei height, GLsizei depth, GLenum format,
11695 GLsizei image_size, const void* data) { 11729 GLsizei image_size, const void* data) {
11696 if (!validators_->texture_3_d_target.IsValid(target)) {
11697 LOCAL_SET_GL_ERROR(
11698 GL_INVALID_ENUM, "glCompressedTexSubImage3D", "target");
11699 return;
11700 }
11701 if (!validators_->compressed_texture_format.IsValid(format)) {
11702 LOCAL_SET_GL_ERROR_INVALID_ENUM(
11703 "glCompressedTexSubImage3D", format, "format");
11704 return;
11705 }
11706 if (!texture_manager()->ValidForTarget(target, level, width, height, depth)) { 11730 if (!texture_manager()->ValidForTarget(target, level, width, height, depth)) {
11707 LOCAL_SET_GL_ERROR( 11731 LOCAL_SET_GL_ERROR(
11708 GL_INVALID_VALUE, 11732 GL_INVALID_VALUE,
11709 "glCompressedTexSubImage3D", "dimensions out of range"); 11733 "glCompressedTexSubImage3D", "dimensions out of range");
11710 return; 11734 return;
11711 } 11735 }
11712 if (image_size < 0) { 11736 if (image_size < 0) {
11713 LOCAL_SET_GL_ERROR( 11737 LOCAL_SET_GL_ERROR(
11714 GL_INVALID_VALUE, "glCompressedTexSubImage3D", "imageSize < 0"); 11738 GL_INVALID_VALUE, "glCompressedTexSubImage3D", "imageSize < 0");
11715 return; 11739 return;
(...skipping 3000 matching lines...) Expand 10 before | Expand all | Expand 10 after
14716 this, source_texture->target(), source_texture->service_id(), 14740 this, source_texture->target(), source_texture->service_id(),
14717 source_internal_format, dest_texture->target(), 14741 source_internal_format, dest_texture->target(),
14718 dest_texture->service_id(), GL_RGBA, source_width, source_height, false, 14742 dest_texture->service_id(), GL_RGBA, source_width, source_height, false,
14719 false, false); 14743 false, false);
14720 } 14744 }
14721 14745
14722 void GLES2DecoderImpl::TexStorageImpl( 14746 void GLES2DecoderImpl::TexStorageImpl(
14723 GLenum target, GLint levels, GLenum internal_format, 14747 GLenum target, GLint levels, GLenum internal_format,
14724 GLsizei width, GLsizei height, GLsizei depth, 14748 GLsizei width, GLsizei height, GLsizei depth,
14725 ContextState::Dimension dimension, const char* function_name) { 14749 ContextState::Dimension dimension, const char* function_name) {
14726 if (dimension == ContextState::k2D) {
14727 if (!validators_->texture_bind_target.IsValid(target)) {
14728 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target");
14729 return;
14730 }
14731 } else {
14732 if (!validators_->texture_3_d_target.IsValid(target)) {
14733 LOCAL_SET_GL_ERROR_INVALID_ENUM(function_name, target, "target");
14734 return;
14735 }
14736 }
14737 if (levels <= 0) { 14750 if (levels <= 0) {
14738 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "levels <= 0"); 14751 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "levels <= 0");
14739 return; 14752 return;
14740 } 14753 }
14741 if (!validators_->texture_internal_format_storage.IsValid(internal_format)) {
14742 LOCAL_SET_GL_ERROR_INVALID_ENUM(
14743 function_name, internal_format, "internal_format");
14744 return;
14745 }
14746 bool is_compressed_format = IsCompressedTextureFormat(internal_format); 14754 bool is_compressed_format = IsCompressedTextureFormat(internal_format);
14747 if (is_compressed_format && target == GL_TEXTURE_3D) { 14755 if (is_compressed_format && target == GL_TEXTURE_3D) {
14748 LOCAL_SET_GL_ERROR( 14756 LOCAL_SET_GL_ERROR(
14749 GL_INVALID_OPERATION, function_name, "target invalid for format"); 14757 GL_INVALID_OPERATION, function_name, "target invalid for format");
14750 return; 14758 return;
14751 } 14759 }
14752 if (!texture_manager()->ValidForTarget(target, 0, width, height, depth) || 14760 if (!texture_manager()->ValidForTarget(target, 0, width, height, depth) ||
14753 TextureManager::ComputeMipMapCount( 14761 TextureManager::ComputeMipMapCount(
14754 target, width, height, depth) < levels) { 14762 target, width, height, depth) < levels) {
14755 LOCAL_SET_GL_ERROR( 14763 LOCAL_SET_GL_ERROR(
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after
16774 } 16782 }
16775 16783
16776 // Include the auto-generated part of this file. We split this because it means 16784 // Include the auto-generated part of this file. We split this because it means
16777 // we can easily edit the non-auto generated parts right here in this file 16785 // we can easily edit the non-auto generated parts right here in this file
16778 // instead of having to edit some template or the code generator. 16786 // instead of having to edit some template or the code generator.
16779 #include "base/macros.h" 16787 #include "base/macros.h"
16780 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 16788 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
16781 16789
16782 } // namespace gles2 16790 } // namespace gles2
16783 } // namespace gpu 16791 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698