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

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: revision per piman review 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 6158 matching lines...) Expand 10 before | Expand all | Expand 10 after
6169 "glFramebufferTextureLayer", "unknown texture_ref"); 6169 "glFramebufferTextureLayer", "unknown texture_ref");
6170 return; 6170 return;
6171 } 6171 }
6172 service_id = texture_ref->service_id(); 6172 service_id = texture_ref->service_id();
6173 } 6173 }
6174 glFramebufferTextureLayer(target, attachment, service_id, level, layer); 6174 glFramebufferTextureLayer(target, attachment, service_id, level, layer);
6175 } 6175 }
6176 6176
6177 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv( 6177 void GLES2DecoderImpl::DoGetFramebufferAttachmentParameteriv(
6178 GLenum target, GLenum attachment, GLenum pname, GLint* params) { 6178 GLenum target, GLenum attachment, GLenum pname, GLint* params) {
6179 const char kFunctionName[] = "glGetFramebufferAttachmentParameteriv";
6179 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); 6180 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
6180 if (!framebuffer) { 6181 if (!framebuffer) {
6181 LOCAL_SET_GL_ERROR( 6182 if (!unsafe_es3_apis_enabled()) {
6182 GL_INVALID_OPERATION, 6183 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
6183 "glGetFramebufferAttachmentParameteriv", "no framebuffer bound"); 6184 "no framebuffer bound");
6184 return; 6185 return;
6186 }
6187 if (!validators_->backbuffer_attachment.IsValid(attachment)) {
6188 LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName,
6189 "invalid attachment for backbuffer");
6190 return;
6191 }
6192 switch (pname) {
6193 case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
6194 *params = static_cast<GLint>(GL_FRAMEBUFFER_DEFAULT);
6195 return;
6196 case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
6197 case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
6198 case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
6199 case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
6200 case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
6201 case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
6202 case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
6203 case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
6204 // Delegate to underlying driver.
6205 break;
6206 default:
6207 LOCAL_SET_GL_ERROR(GL_INVALID_ENUM, kFunctionName,
6208 "invalid pname for backbuffer");
6209 return;
6210 }
6211 if (GetBackbufferServiceId() != 0) { // Emulated backbuffer.
6212 switch (attachment) {
6213 case GL_BACK:
6214 attachment = GL_COLOR_ATTACHMENT0;
6215 break;
6216 case GL_DEPTH:
6217 attachment = GL_DEPTH_ATTACHMENT;
6218 break;
6219 case GL_STENCIL:
6220 attachment = GL_STENCIL_ATTACHMENT;
6221 break;
6222 default:
6223 NOTREACHED();
6224 break;
6225 }
6226 }
6227 }
6228 if (pname == GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT &&
6229 features().use_img_for_multisampled_render_to_texture) {
6230 pname = GL_TEXTURE_SAMPLES_IMG;
6185 } 6231 }
6186 if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) { 6232 if (pname == GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) {
6233 DCHECK(framebuffer);
6234 // If we query from the driver, it will be service ID; however, we need to
6235 // return the client ID here.
6187 const Framebuffer::Attachment* attachment_object = 6236 const Framebuffer::Attachment* attachment_object =
6188 framebuffer->GetAttachment(attachment); 6237 framebuffer->GetAttachment(attachment);
6189 *params = attachment_object ? attachment_object->object_name() : 0; 6238 *params = attachment_object ? attachment_object->object_name() : 0;
6190 } else { 6239 return;
6191 if (pname == GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT &&
6192 features().use_img_for_multisampled_render_to_texture) {
6193 pname = GL_TEXTURE_SAMPLES_IMG;
6194 }
6195 glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params);
6196 } 6240 }
6241
6242 glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, params);
6243 // We didn't perform a full error check before gl call.
6244 LOCAL_PEEK_GL_ERROR(kFunctionName);
6197 } 6245 }
6198 6246
6199 void GLES2DecoderImpl::DoGetRenderbufferParameteriv( 6247 void GLES2DecoderImpl::DoGetRenderbufferParameteriv(
6200 GLenum target, GLenum pname, GLint* params) { 6248 GLenum target, GLenum pname, GLint* params) {
6201 Renderbuffer* renderbuffer = 6249 Renderbuffer* renderbuffer =
6202 GetRenderbufferInfoForTarget(GL_RENDERBUFFER); 6250 GetRenderbufferInfoForTarget(GL_RENDERBUFFER);
6203 if (!renderbuffer) { 6251 if (!renderbuffer) {
6204 LOCAL_SET_GL_ERROR( 6252 LOCAL_SET_GL_ERROR(
6205 GL_INVALID_OPERATION, 6253 GL_INVALID_OPERATION,
6206 "glGetRenderbufferParameteriv", "no renderbuffer bound"); 6254 "glGetRenderbufferParameteriv", "no renderbuffer bound");
(...skipping 8608 matching lines...) Expand 10 before | Expand all | Expand 10 after
14815 return error::kNoError; 14863 return error::kNoError;
14816 } 14864 }
14817 14865
14818 // Include the auto-generated part of this file. We split this because it means 14866 // Include the auto-generated part of this file. We split this because it means
14819 // we can easily edit the non-auto generated parts right here in this file 14867 // we can easily edit the non-auto generated parts right here in this file
14820 // instead of having to edit some template or the code generator. 14868 // instead of having to edit some template or the code generator.
14821 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 14869 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
14822 14870
14823 } // namespace gles2 14871 } // namespace gles2
14824 } // namespace gpu 14872 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698