| 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 <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 7507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7518 return; | 7518 return; |
| 7519 } | 7519 } |
| 7520 MarkDrawBufferAsCleared(GL_DEPTH, drawbuffer); | 7520 MarkDrawBufferAsCleared(GL_DEPTH, drawbuffer); |
| 7521 MarkDrawBufferAsCleared(GL_STENCIL, drawbuffer); | 7521 MarkDrawBufferAsCleared(GL_STENCIL, drawbuffer); |
| 7522 glClearBufferfi(buffer, drawbuffer, depth, stencil); | 7522 glClearBufferfi(buffer, drawbuffer, depth, stencil); |
| 7523 } | 7523 } |
| 7524 | 7524 |
| 7525 void GLES2DecoderImpl::DoFramebufferRenderbuffer( | 7525 void GLES2DecoderImpl::DoFramebufferRenderbuffer( |
| 7526 GLenum target, GLenum attachment, GLenum renderbuffertarget, | 7526 GLenum target, GLenum attachment, GLenum renderbuffertarget, |
| 7527 GLuint client_renderbuffer_id) { | 7527 GLuint client_renderbuffer_id) { |
| 7528 const char* func_name = "glFramebufferRenderbuffer"; |
| 7528 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); | 7529 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); |
| 7529 if (!framebuffer) { | 7530 if (!framebuffer) { |
| 7530 LOCAL_SET_GL_ERROR( | 7531 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, "no framebuffer bound"); |
| 7531 GL_INVALID_OPERATION, | |
| 7532 "glFramebufferRenderbuffer", "no framebuffer bound"); | |
| 7533 return; | 7532 return; |
| 7534 } | 7533 } |
| 7535 GLuint service_id = 0; | 7534 GLuint service_id = 0; |
| 7536 Renderbuffer* renderbuffer = NULL; | 7535 Renderbuffer* renderbuffer = NULL; |
| 7537 if (client_renderbuffer_id) { | 7536 if (client_renderbuffer_id) { |
| 7538 renderbuffer = GetRenderbuffer(client_renderbuffer_id); | 7537 renderbuffer = GetRenderbuffer(client_renderbuffer_id); |
| 7539 if (!renderbuffer) { | 7538 if (!renderbuffer) { |
| 7540 LOCAL_SET_GL_ERROR( | 7539 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
| 7541 GL_INVALID_OPERATION, | 7540 "unknown renderbuffer"); |
| 7542 "glFramebufferRenderbuffer", "unknown renderbuffer"); | 7541 return; |
| 7542 } |
| 7543 if (!renderbuffer->IsValid()) { |
| 7544 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, func_name, |
| 7545 "renderbuffer never bound or deleted"); |
| 7543 return; | 7546 return; |
| 7544 } | 7547 } |
| 7545 service_id = renderbuffer->service_id(); | 7548 service_id = renderbuffer->service_id(); |
| 7546 } | 7549 } |
| 7547 std::vector<GLenum> attachments; | 7550 std::vector<GLenum> attachments; |
| 7548 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { | 7551 if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { |
| 7549 attachments.push_back(GL_DEPTH_ATTACHMENT); | 7552 attachments.push_back(GL_DEPTH_ATTACHMENT); |
| 7550 attachments.push_back(GL_STENCIL_ATTACHMENT); | 7553 attachments.push_back(GL_STENCIL_ATTACHMENT); |
| 7551 } else { | 7554 } else { |
| 7552 attachments.push_back(attachment); | 7555 attachments.push_back(attachment); |
| 7553 } | 7556 } |
| 7554 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glFramebufferRenderbuffer"); | 7557 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(func_name); |
| 7555 for (GLenum attachment_point : attachments) { | 7558 for (GLenum attachment_point : attachments) { |
| 7556 glFramebufferRenderbufferEXT( | 7559 glFramebufferRenderbufferEXT( |
| 7557 target, attachment_point, renderbuffertarget, service_id); | 7560 target, attachment_point, renderbuffertarget, service_id); |
| 7558 GLenum error = LOCAL_PEEK_GL_ERROR("glFramebufferRenderbuffer"); | 7561 GLenum error = LOCAL_PEEK_GL_ERROR(func_name); |
| 7559 if (error == GL_NO_ERROR) { | 7562 if (error == GL_NO_ERROR) { |
| 7560 framebuffer->AttachRenderbuffer(attachment_point, renderbuffer); | 7563 framebuffer->AttachRenderbuffer(attachment_point, renderbuffer); |
| 7561 } | 7564 } |
| 7562 } | 7565 } |
| 7563 if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { | 7566 if (framebuffer == framebuffer_state_.bound_draw_framebuffer.get()) { |
| 7564 framebuffer_state_.clear_state_dirty = true; | 7567 framebuffer_state_.clear_state_dirty = true; |
| 7565 } | 7568 } |
| 7566 OnFboChanged(); | 7569 OnFboChanged(); |
| 7567 } | 7570 } |
| 7568 | 7571 |
| (...skipping 12188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19757 } | 19760 } |
| 19758 | 19761 |
| 19759 // Include the auto-generated part of this file. We split this because it means | 19762 // Include the auto-generated part of this file. We split this because it means |
| 19760 // we can easily edit the non-auto generated parts right here in this file | 19763 // we can easily edit the non-auto generated parts right here in this file |
| 19761 // instead of having to edit some template or the code generator. | 19764 // instead of having to edit some template or the code generator. |
| 19762 #include "base/macros.h" | 19765 #include "base/macros.h" |
| 19763 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 19766 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 19764 | 19767 |
| 19765 } // namespace gles2 | 19768 } // namespace gles2 |
| 19766 } // namespace gpu | 19769 } // namespace gpu |
| OLD | NEW |