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

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

Issue 1319453010: Fix GetFramebufferAttachmentParameteriv command handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gpu_unittests and gl_tests Created 5 years, 3 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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 6142 matching lines...) Expand 10 before | Expand all | Expand 10 after
6153 "glFramebufferTextureLayer", "unknown texture_ref"); 6153 "glFramebufferTextureLayer", "unknown texture_ref");
6154 return; 6154 return;
6155 } 6155 }
6156 service_id = texture_ref->service_id(); 6156 service_id = texture_ref->service_id();
6157 } 6157 }
6158 glFramebufferTextureLayer(target, attachment, service_id, level, layer); 6158 glFramebufferTextureLayer(target, attachment, service_id, level, layer);
6159 } 6159 }
6160 6160
6161 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv( 6161 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv(
6162 GLenum target, GLenum attachment, GLenum pname, GLint* params) { 6162 GLenum target, GLenum attachment, GLenum pname, GLint* params) {
6163 const char kFunctionName[] = "glGetFramebufferAttachmentParameteriv";
6163 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); 6164 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
6164 if (!framebuffer) { 6165 if (!framebuffer) {
6165 LOCAL_SET_GL_ERROR( 6166 if (!unsafe_es3_apis_enabled()) {
6166 GL_INVALID_OPERATION, 6167 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
6167 "glGetFramebufferAttachmentParameteriv", "no framebuffer bound"); 6168 "no framebuffer bound");
6168 return; 6169 return;
6170 }
6171 if (!validators_->backbuffer_attachment.IsValid(attachment)) {
6172 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
6173 "invalid attachment for backbuffer");
6174 return;
6175 }
6176 if (GetBackbufferServiceId() != 0) { // Emulated backbuffer.
6177 switch (attachment) {
6178 case GL_BACK:
6179 attachment = GL_COLOR_ATTACHMENT0;
6180 break;
6181 case GL_DEPTH:
6182 attachment = GL_DEPTH_ATTACHMENT;
6183 break;
6184 case GL_STENCIL:
6185 attachment = GL_STENCIL_ATTACHMENT;
6186 break;
6187 default:
6188 NOTREACHED();
6189 break;
6190 }
6191 switch (pname) {
6192 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
6193 *params = static_cast<GLint>(GL_FRAMEBUFFER_DEFAULT);
6194 return;
6195 case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
6196 case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
6197 case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
6198 case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
6199 case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
6200 case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
6201 case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
6202 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
6203 // Delegate to underlying driver.
6204 break;
6205 default:
6206 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, kFunctionName,
6207 "invalid pname for backbuffer");
6208 return;
6209 }
6210 }
6169 } 6211 }
6170 if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) { 6212 if (pname == GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT &&
6213 features().use_img_for_multisampled_render_to_texture) {
6214 pname = GL_TEXTURE_SAMPLES_IMG;
6215 }
6216
6217 // We didn't perform a full error check before gl call.
6218 LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(kFunctionName);
6219 glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params);
6220 GLenum error = LOCAL_PEEK_GL_ERROR(kFunctionName);
6221
6222 if (error == GL_NO_ERROR && pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) {
Zhenyao Mo 2015/09/04 23:38:11 This is where the change is.
piman 2015/09/05 00:12:03 For this pname, should we just always return the t
6223 // We should return client ID, not service ID.
6171 const Framebuffer::Attachment* attachment_object = 6224 const Framebuffer::Attachment* attachment_object =
6172 framebuffer->GetAttachment(attachment); 6225 framebuffer->GetAttachment(attachment);
6173 *params = attachment_object ? attachment_object->object_name() : 0; 6226 *params = attachment_object ? attachment_object->object_name() : 0;
6174 } else {
6175 if (pname == GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT &&
6176 features().use_img_for_multisampled_render_to_texture) {
6177 pname = GL_TEXTURE_SAMPLES_IMG;
6178 }
6179 glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params);
6180 } 6227 }
6181 } 6228 }
6182 6229
6183 void GLES2DecoderImpl::DoGetRenderbufferParameteriv( 6230 void GLES2DecoderImpl::DoGetRenderbufferParameteriv(
6184 GLenum target, GLenum pname, GLint* params) { 6231 GLenum target, GLenum pname, GLint* params) {
6185 Renderbuffer* renderbuffer = 6232 Renderbuffer* renderbuffer =
6186 GetRenderbufferInfoForTarget(GL_RENDERBUFFER); 6233 GetRenderbufferInfoForTarget(GL_RENDERBUFFER);
6187 if (!renderbuffer) { 6234 if (!renderbuffer) {
6188 LOCAL_SET_GL_ERROR( 6235 LOCAL_SET_GL_ERROR(
6189 GL_INVALID_OPERATION, 6236 GL_INVALID_OPERATION,
(...skipping 8608 matching lines...) Expand 10 before | Expand all | Expand 10 after
14798 return error::kNoError; 14845 return error::kNoError;
14799 } 14846 }
14800 14847
14801 // Include the auto-generated part of this file. We split this because it means 14848 // Include the auto-generated part of this file. We split this because it means
14802 // we can easily edit the non-auto generated parts right here in this file 14849 // we can easily edit the non-auto generated parts right here in this file
14803 // instead of having to edit some template or the code generator. 14850 // instead of having to edit some template or the code generator.
14804 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 14851 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
14805 14852
14806 } // namespace gles2 14853 } // namespace gles2
14807 } // namespace gpu 14854 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698