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

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

Issue 189133004: WebGL TexParameterf and GetTexParameterf needs to handle float param correctly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 <list> 10 #include <list>
(...skipping 3080 matching lines...) Expand 10 before | Expand all | Expand 10 after
3091 GL_TEXTURE_2D, 3091 GL_TEXTURE_2D,
3092 0, // level 3092 0, // level
3093 GL_RGBA, 3093 GL_RGBA,
3094 offscreen_size_.width(), 3094 offscreen_size_.width(),
3095 offscreen_size_.height(), 3095 offscreen_size_.height(),
3096 1, // depth 3096 1, // depth
3097 0, // border 3097 0, // border
3098 GL_RGBA, 3098 GL_RGBA,
3099 GL_UNSIGNED_BYTE, 3099 GL_UNSIGNED_BYTE,
3100 true); 3100 true);
3101 texture_manager()->SetParameter( 3101 texture_manager()->SetParameteri(
3102 "UpdateParentTextureInfo", 3102 "UpdateParentTextureInfo",
3103 GetErrorState(), 3103 GetErrorState(),
3104 offscreen_saved_color_texture_info_.get(), 3104 offscreen_saved_color_texture_info_.get(),
3105 GL_TEXTURE_MAG_FILTER, 3105 GL_TEXTURE_MAG_FILTER,
3106 GL_NEAREST); 3106 GL_NEAREST);
3107 texture_manager()->SetParameter( 3107 texture_manager()->SetParameteri(
3108 "UpdateParentTextureInfo", 3108 "UpdateParentTextureInfo",
3109 GetErrorState(), 3109 GetErrorState(),
3110 offscreen_saved_color_texture_info_.get(), 3110 offscreen_saved_color_texture_info_.get(),
3111 GL_TEXTURE_MIN_FILTER, 3111 GL_TEXTURE_MIN_FILTER,
3112 GL_NEAREST); 3112 GL_NEAREST);
3113 texture_manager()->SetParameter( 3113 texture_manager()->SetParameteri(
3114 "UpdateParentTextureInfo", 3114 "UpdateParentTextureInfo",
3115 GetErrorState(), 3115 GetErrorState(),
3116 offscreen_saved_color_texture_info_.get(), 3116 offscreen_saved_color_texture_info_.get(),
3117 GL_TEXTURE_WRAP_S, 3117 GL_TEXTURE_WRAP_S,
3118 GL_CLAMP_TO_EDGE); 3118 GL_CLAMP_TO_EDGE);
3119 texture_manager()->SetParameter( 3119 texture_manager()->SetParameteri(
3120 "UpdateParentTextureInfo", 3120 "UpdateParentTextureInfo",
3121 GetErrorState(), 3121 GetErrorState(),
3122 offscreen_saved_color_texture_info_.get(), 3122 offscreen_saved_color_texture_info_.get(),
3123 GL_TEXTURE_WRAP_T, 3123 GL_TEXTURE_WRAP_T,
3124 GL_CLAMP_TO_EDGE); 3124 GL_CLAMP_TO_EDGE);
3125 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( 3125 TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget(
3126 &state_, target); 3126 &state_, target);
3127 glBindTexture(target, texture_ref ? texture_ref->service_id() : 0); 3127 glBindTexture(target, texture_ref ? texture_ref->service_id() : 0);
3128 } 3128 }
3129 3129
(...skipping 2330 matching lines...) Expand 10 before | Expand all | Expand 10 after
5460 5460
5461 void GLES2DecoderImpl::DoTexParameterf( 5461 void GLES2DecoderImpl::DoTexParameterf(
5462 GLenum target, GLenum pname, GLfloat param) { 5462 GLenum target, GLenum pname, GLfloat param) {
5463 TextureRef* texture = texture_manager()->GetTextureInfoForTarget( 5463 TextureRef* texture = texture_manager()->GetTextureInfoForTarget(
5464 &state_, target); 5464 &state_, target);
5465 if (!texture) { 5465 if (!texture) {
5466 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterf", "unknown texture"); 5466 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterf", "unknown texture");
5467 return; 5467 return;
5468 } 5468 }
5469 5469
5470 texture_manager()->SetParameter( 5470 texture_manager()->SetParameterf(
5471 "glTexParameterf", GetErrorState(), texture, pname, 5471 "glTexParameterf", GetErrorState(), texture, pname, param);
5472 static_cast<GLint>(param));
5473 } 5472 }
5474 5473
5475 void GLES2DecoderImpl::DoTexParameteri( 5474 void GLES2DecoderImpl::DoTexParameteri(
5476 GLenum target, GLenum pname, GLint param) { 5475 GLenum target, GLenum pname, GLint param) {
5477 TextureRef* texture = texture_manager()->GetTextureInfoForTarget( 5476 TextureRef* texture = texture_manager()->GetTextureInfoForTarget(
5478 &state_, target); 5477 &state_, target);
5479 if (!texture) { 5478 if (!texture) {
5480 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameteri", "unknown texture"); 5479 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameteri", "unknown texture");
5481 return; 5480 return;
5482 } 5481 }
5483 5482
5484 texture_manager()->SetParameter( 5483 texture_manager()->SetParameteri(
5485 "glTexParameteri", GetErrorState(), texture, pname, param); 5484 "glTexParameteri", GetErrorState(), texture, pname, param);
5486 } 5485 }
5487 5486
5488 void GLES2DecoderImpl::DoTexParameterfv( 5487 void GLES2DecoderImpl::DoTexParameterfv(
5489 GLenum target, GLenum pname, const GLfloat* params) { 5488 GLenum target, GLenum pname, const GLfloat* params) {
5490 TextureRef* texture = texture_manager()->GetTextureInfoForTarget( 5489 TextureRef* texture = texture_manager()->GetTextureInfoForTarget(
5491 &state_, target); 5490 &state_, target);
5492 if (!texture) { 5491 if (!texture) {
5493 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterfv", "unknown texture"); 5492 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterfv", "unknown texture");
5494 return; 5493 return;
5495 } 5494 }
5496 5495
5497 texture_manager()->SetParameter( 5496 texture_manager()->SetParameterf(
5498 "glTexParameterfv", GetErrorState(), texture, pname, 5497 "glTexParameterfv", GetErrorState(), texture, pname, *params);
5499 static_cast<GLint>(params[0]));
5500 } 5498 }
5501 5499
5502 void GLES2DecoderImpl::DoTexParameteriv( 5500 void GLES2DecoderImpl::DoTexParameteriv(
5503 GLenum target, GLenum pname, const GLint* params) { 5501 GLenum target, GLenum pname, const GLint* params) {
5504 TextureRef* texture = texture_manager()->GetTextureInfoForTarget( 5502 TextureRef* texture = texture_manager()->GetTextureInfoForTarget(
5505 &state_, target); 5503 &state_, target);
5506 if (!texture) { 5504 if (!texture) {
5507 LOCAL_SET_GL_ERROR( 5505 LOCAL_SET_GL_ERROR(
5508 GL_INVALID_VALUE, "glTexParameteriv", "unknown texture"); 5506 GL_INVALID_VALUE, "glTexParameteriv", "unknown texture");
5509 return; 5507 return;
5510 } 5508 }
5511 5509
5512 texture_manager()->SetParameter( 5510 texture_manager()->SetParameteri(
5513 "glTexParameteriv", GetErrorState(), texture, pname, *params); 5511 "glTexParameteriv", GetErrorState(), texture, pname, *params);
5514 } 5512 }
5515 5513
5516 bool GLES2DecoderImpl::CheckCurrentProgram(const char* function_name) { 5514 bool GLES2DecoderImpl::CheckCurrentProgram(const char* function_name) {
5517 if (!state_.current_program.get()) { 5515 if (!state_.current_program.get()) {
5518 // The program does not exist. 5516 // The program does not exist.
5519 LOCAL_SET_GL_ERROR( 5517 LOCAL_SET_GL_ERROR(
5520 GL_INVALID_OPERATION, function_name, "no program in use"); 5518 GL_INVALID_OPERATION, function_name, "no program in use");
5521 return false; 5519 return false;
5522 } 5520 }
(...skipping 5060 matching lines...) Expand 10 before | Expand all | Expand 10 after
10583 DoDidUseTexImageIfNeeded(texture, texture->target()); 10581 DoDidUseTexImageIfNeeded(texture, texture->target());
10584 } 10582 }
10585 10583
10586 // Include the auto-generated part of this file. We split this because it means 10584 // Include the auto-generated part of this file. We split this because it means
10587 // we can easily edit the non-auto generated parts right here in this file 10585 // we can easily edit the non-auto generated parts right here in this file
10588 // instead of having to edit some template or the code generator. 10586 // instead of having to edit some template or the code generator.
10589 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 10587 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
10590 10588
10591 } // namespace gles2 10589 } // namespace gles2
10592 } // namespace gpu 10590 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698