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

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

Issue 1412613004: Set attachment for bound framebuffer in FramebufferTextureLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix WebGLTextureAttachment::attach Created 5 years, 1 month 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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 6427 matching lines...) Expand 10 before | Expand all | Expand 10 after
6438 6438
6439 if (texture_ref) 6439 if (texture_ref)
6440 DoDidUseTexImageIfNeeded(texture_ref->texture(), textarget); 6440 DoDidUseTexImageIfNeeded(texture_ref->texture(), textarget);
6441 6441
6442 OnFboChanged(); 6442 OnFboChanged();
6443 } 6443 }
6444 6444
6445 void GLES2DecoderImpl::DoFramebufferTextureLayer( 6445 void GLES2DecoderImpl::DoFramebufferTextureLayer(
6446 GLenum target, GLenum attachment, GLuint client_texture_id, 6446 GLenum target, GLenum attachment, GLuint client_texture_id,
6447 GLint level, GLint layer) { 6447 GLint level, GLint layer) {
6448 // TODO(zmo): Unsafe ES3 API, missing states update. 6448 // TODO(zmo): Add full validation.
6449 GLuint service_id = 0; 6449 GLuint service_id = 0;
6450 TextureRef* texture_ref = NULL; 6450 TextureRef* texture_ref = NULL;
6451 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
6452 if (!framebuffer) {
6453 LOCAL_SET_GL_ERROR(
6454 GL_INVALID_OPERATION,
6455 "glFramebufferTextureLayer", "no framebuffer bound.");
6456 return;
6457 }
6451 if (client_texture_id) { 6458 if (client_texture_id) {
6452 texture_ref = GetTexture(client_texture_id); 6459 texture_ref = GetTexture(client_texture_id);
6453 if (!texture_ref) { 6460 if (!texture_ref) {
6454 LOCAL_SET_GL_ERROR( 6461 LOCAL_SET_GL_ERROR(
6455 GL_INVALID_OPERATION, 6462 GL_INVALID_OPERATION,
6456 "glFramebufferTextureLayer", "unknown texture_ref"); 6463 "glFramebufferTextureLayer", "unknown texture_ref");
6457 return; 6464 return;
6458 } 6465 }
6459 service_id = texture_ref->service_id(); 6466 service_id = texture_ref->service_id();
6460 } 6467 }
6468 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER("glFramebufferTextureLayer");
6461 glFramebufferTextureLayer(target, attachment, service_id, level, layer); 6469 glFramebufferTextureLayer(target, attachment, service_id, level, layer);
6470 GLenum error = LOCAL_PEEK_GL_ERROR("glFramebufferTextureLayer");
6471 if (error == GL_NO_ERROR) {
6472 framebuffer->AttachTextureLayer(attachment, texture_ref,
6473 texture_ref ? texture_ref->texture()->target() : 0,
6474 level, layer);
6475 }
6462 } 6476 }
6463 6477
6464 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv( 6478 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv(
6465 GLenum target, GLenum attachment, GLenum pname, GLint* params) { 6479 GLenum target, GLenum attachment, GLenum pname, GLint* params) {
6466 const char kFunctionName[] = "glGetFramebufferAttachmentParameteriv"; 6480 const char kFunctionName[] = "glGetFramebufferAttachmentParameteriv";
6467 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); 6481 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
6468 if (!framebuffer) { 6482 if (!framebuffer) {
6469 if (!unsafe_es3_apis_enabled()) { 6483 if (!unsafe_es3_apis_enabled()) {
6470 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, 6484 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
6471 "no framebuffer bound"); 6485 "no framebuffer bound");
(...skipping 8630 matching lines...) Expand 10 before | Expand all | Expand 10 after
15102 return error::kNoError; 15116 return error::kNoError;
15103 } 15117 }
15104 15118
15105 // Include the auto-generated part of this file. We split this because it means 15119 // Include the auto-generated part of this file. We split this because it means
15106 // we can easily edit the non-auto generated parts right here in this file 15120 // we can easily edit the non-auto generated parts right here in this file
15107 // instead of having to edit some template or the code generator. 15121 // instead of having to edit some template or the code generator.
15108 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15122 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15109 15123
15110 } // namespace gles2 15124 } // namespace gles2
15111 } // namespace gpu 15125 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_1.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698