OLD | NEW |
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 <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 4349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4360 attachment = GL_STENCIL_ATTACHMENT; | 4360 attachment = GL_STENCIL_ATTACHMENT; |
4361 break; | 4361 break; |
4362 default: | 4362 default: |
4363 NOTREACHED(); | 4363 NOTREACHED(); |
4364 return; | 4364 return; |
4365 } | 4365 } |
4366 } | 4366 } |
4367 translated_attachments[i] = attachment; | 4367 translated_attachments[i] = attachment; |
4368 } | 4368 } |
4369 | 4369 |
| 4370 ScopedRenderTo do_render(framebuffer); |
4370 glDiscardFramebufferEXT(target, numAttachments, translated_attachments.get()); | 4371 glDiscardFramebufferEXT(target, numAttachments, translated_attachments.get()); |
4371 } | 4372 } |
4372 | 4373 |
4373 void GLES2DecoderImpl::DoEnableVertexAttribArray(GLuint index) { | 4374 void GLES2DecoderImpl::DoEnableVertexAttribArray(GLuint index) { |
4374 if (state_.vertex_attrib_manager->Enable(index, true)) { | 4375 if (state_.vertex_attrib_manager->Enable(index, true)) { |
4375 glEnableVertexAttribArray(index); | 4376 glEnableVertexAttribArray(index); |
4376 } else { | 4377 } else { |
4377 LOCAL_SET_GL_ERROR( | 4378 LOCAL_SET_GL_ERROR( |
4378 GL_INVALID_VALUE, "glEnableVertexAttribArray", "index out of range"); | 4379 GL_INVALID_VALUE, "glEnableVertexAttribArray", "index out of range"); |
4379 } | 4380 } |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5107 return error::kOutOfBounds; | 5108 return error::kOutOfBounds; |
5108 } | 5109 } |
5109 DoRegisterSharedIdsCHROMIUM(namespace_id, n, ids); | 5110 DoRegisterSharedIdsCHROMIUM(namespace_id, n, ids); |
5110 return error::kNoError; | 5111 return error::kNoError; |
5111 } | 5112 } |
5112 | 5113 |
5113 error::Error GLES2DecoderImpl::DoClear(GLbitfield mask) { | 5114 error::Error GLES2DecoderImpl::DoClear(GLbitfield mask) { |
5114 DCHECK(!ShouldDeferDraws()); | 5115 DCHECK(!ShouldDeferDraws()); |
5115 if (CheckBoundFramebuffersValid("glClear")) { | 5116 if (CheckBoundFramebuffersValid("glClear")) { |
5116 ApplyDirtyState(); | 5117 ApplyDirtyState(); |
| 5118 ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get()); |
5117 glClear(mask); | 5119 glClear(mask); |
5118 } | 5120 } |
5119 return error::kNoError; | 5121 return error::kNoError; |
5120 } | 5122 } |
5121 | 5123 |
5122 void GLES2DecoderImpl::DoFramebufferRenderbuffer( | 5124 void GLES2DecoderImpl::DoFramebufferRenderbuffer( |
5123 GLenum target, GLenum attachment, GLenum renderbuffertarget, | 5125 GLenum target, GLenum attachment, GLenum renderbuffertarget, |
5124 GLuint client_renderbuffer_id) { | 5126 GLuint client_renderbuffer_id) { |
5125 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); | 5127 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); |
5126 if (!framebuffer) { | 5128 if (!framebuffer) { |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5408 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, | 5410 GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, |
5409 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, | 5411 GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, |
5410 GLbitfield mask, GLenum filter) { | 5412 GLbitfield mask, GLenum filter) { |
5411 DCHECK(!ShouldDeferReads() && !ShouldDeferDraws()); | 5413 DCHECK(!ShouldDeferReads() && !ShouldDeferDraws()); |
5412 | 5414 |
5413 if (!CheckBoundFramebuffersValid("glBlitFramebufferCHROMIUM")) { | 5415 if (!CheckBoundFramebuffersValid("glBlitFramebufferCHROMIUM")) { |
5414 return; | 5416 return; |
5415 } | 5417 } |
5416 | 5418 |
5417 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); | 5419 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); |
| 5420 ScopedRenderTo do_render(framebuffer_state_.bound_draw_framebuffer.get()); |
5418 BlitFramebufferHelper( | 5421 BlitFramebufferHelper( |
5419 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); | 5422 srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
5420 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, | 5423 state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, |
5421 state_.enable_flags.scissor_test); | 5424 state_.enable_flags.scissor_test); |
5422 } | 5425 } |
5423 | 5426 |
5424 void GLES2DecoderImpl::EnsureRenderbufferBound() { | 5427 void GLES2DecoderImpl::EnsureRenderbufferBound() { |
5425 if (!state_.bound_renderbuffer_valid) { | 5428 if (!state_.bound_renderbuffer_valid) { |
5426 state_.bound_renderbuffer_valid = true; | 5429 state_.bound_renderbuffer_valid = true; |
5427 glBindRenderbufferEXT(GL_RENDERBUFFER, | 5430 glBindRenderbufferEXT(GL_RENDERBUFFER, |
(...skipping 5856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11284 } | 11287 } |
11285 } | 11288 } |
11286 | 11289 |
11287 // Include the auto-generated part of this file. We split this because it means | 11290 // Include the auto-generated part of this file. We split this because it means |
11288 // we can easily edit the non-auto generated parts right here in this file | 11291 // we can easily edit the non-auto generated parts right here in this file |
11289 // instead of having to edit some template or the code generator. | 11292 // instead of having to edit some template or the code generator. |
11290 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 11293 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
11291 | 11294 |
11292 } // namespace gles2 | 11295 } // namespace gles2 |
11293 } // namespace gpu | 11296 } // namespace gpu |
OLD | NEW |