Chromium Code Reviews| 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 <cmath> | 10 #include <cmath> |
| (...skipping 6427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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): Unsafe ES3 API, missing states update. |
|
Zhenyao Mo
2015/10/26 21:50:33
Now this is no longer valid with the changes here,
qiankun
2015/10/27 14:26:31
Done.
| |
| 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 } |
| 6461 glFramebufferTextureLayer(target, attachment, service_id, level, layer); | 6468 glFramebufferTextureLayer(target, attachment, service_id, level, layer); |
| 6469 GLenum error = LOCAL_PEEK_GL_ERROR("glFramebufferTextureLayer"); | |
|
Zhenyao Mo
2015/10/26 21:50:33
This is incorrect. You need to check error before
qiankun
2015/10/27 14:26:31
Done.
| |
| 6470 if (error == GL_NO_ERROR) { | |
| 6471 framebuffer->AttachTexture(attachment, texture_ref, | |
|
Zhenyao Mo
2015/10/26 21:50:33
You should add a AttachTextureLayer function and u
qiankun
2015/10/27 14:26:31
Framebuffer::AttachTextureLayer is added. What API
| |
| 6472 texture_ref->texture()->target(), level, 0); | |
| 6473 } | |
| 6462 } | 6474 } |
| 6463 | 6475 |
| 6464 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv( | 6476 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv( |
| 6465 GLenum target, GLenum attachment, GLenum pname, GLint* params) { | 6477 GLenum target, GLenum attachment, GLenum pname, GLint* params) { |
| 6466 const char kFunctionName[] = "glGetFramebufferAttachmentParameteriv"; | 6478 const char kFunctionName[] = "glGetFramebufferAttachmentParameteriv"; |
| 6467 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); | 6479 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); |
| 6468 if (!framebuffer) { | 6480 if (!framebuffer) { |
| 6469 if (!unsafe_es3_apis_enabled()) { | 6481 if (!unsafe_es3_apis_enabled()) { |
| 6470 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, | 6482 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, |
| 6471 "no framebuffer bound"); | 6483 "no framebuffer bound"); |
| (...skipping 8630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15102 return error::kNoError; | 15114 return error::kNoError; |
| 15103 } | 15115 } |
| 15104 | 15116 |
| 15105 // Include the auto-generated part of this file. We split this because it means | 15117 // 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 | 15118 // 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. | 15119 // instead of having to edit some template or the code generator. |
| 15108 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 15120 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 15109 | 15121 |
| 15110 } // namespace gles2 | 15122 } // namespace gles2 |
| 15111 } // namespace gpu | 15123 } // namespace gpu |
| OLD | NEW |