| 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 // This file is auto-generated from | 5 // This file is auto-generated from |
| 6 // gpu/command_buffer/build_gles2_cmd_buffer.py | 6 // gpu/command_buffer/build_gles2_cmd_buffer.py |
| 7 // DO NOT EDIT! | 7 // DO NOT EDIT! |
| 8 | 8 |
| 9 // It is included by gles2_cmd_decoder.cc | 9 // It is included by gles2_cmd_decoder.cc |
| 10 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ | 10 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 DoBindTexture(target, texture); | 72 DoBindTexture(target, texture); |
| 73 return error::kNoError; | 73 return error::kNoError; |
| 74 } | 74 } |
| 75 | 75 |
| 76 error::Error GLES2DecoderImpl::HandleBlendColor( | 76 error::Error GLES2DecoderImpl::HandleBlendColor( |
| 77 uint32 immediate_data_size, const gles2::BlendColor& c) { | 77 uint32 immediate_data_size, const gles2::BlendColor& c) { |
| 78 GLclampf red = static_cast<GLclampf>(c.red); | 78 GLclampf red = static_cast<GLclampf>(c.red); |
| 79 GLclampf green = static_cast<GLclampf>(c.green); | 79 GLclampf green = static_cast<GLclampf>(c.green); |
| 80 GLclampf blue = static_cast<GLclampf>(c.blue); | 80 GLclampf blue = static_cast<GLclampf>(c.blue); |
| 81 GLclampf alpha = static_cast<GLclampf>(c.alpha); | 81 GLclampf alpha = static_cast<GLclampf>(c.alpha); |
| 82 state_.blend_color_red = red; | 82 if (state_.blend_color_red != red || |
| 83 state_.blend_color_green = green; | 83 state_.blend_color_green != green || |
| 84 state_.blend_color_blue = blue; | 84 state_.blend_color_blue != blue || |
| 85 state_.blend_color_alpha = alpha; | 85 state_.blend_color_alpha != alpha) { |
| 86 glBlendColor(red, green, blue, alpha); | 86 state_.blend_color_red = red; |
| 87 state_.blend_color_green = green; |
| 88 state_.blend_color_blue = blue; |
| 89 state_.blend_color_alpha = alpha; |
| 90 glBlendColor(red, green, blue, alpha); |
| 91 } |
| 87 return error::kNoError; | 92 return error::kNoError; |
| 88 } | 93 } |
| 89 | 94 |
| 90 error::Error GLES2DecoderImpl::HandleBlendEquation( | 95 error::Error GLES2DecoderImpl::HandleBlendEquation( |
| 91 uint32 immediate_data_size, const gles2::BlendEquation& c) { | 96 uint32 immediate_data_size, const gles2::BlendEquation& c) { |
| 92 GLenum mode = static_cast<GLenum>(c.mode); | 97 GLenum mode = static_cast<GLenum>(c.mode); |
| 93 if (!validators_->equation.IsValid(mode)) { | 98 if (!validators_->equation.IsValid(mode)) { |
| 94 SetGLErrorInvalidEnum("glBlendEquation", mode, "mode"); | 99 SetGLErrorInvalidEnum("glBlendEquation", mode, "mode"); |
| 95 return error::kNoError; | 100 return error::kNoError; |
| 96 } | 101 } |
| 97 state_.blend_equation_rgb = mode; | 102 if (state_.blend_equation_rgb != mode || |
| 98 state_.blend_equation_alpha = mode; | 103 state_.blend_equation_alpha != mode) { |
| 99 glBlendEquation(mode); | 104 state_.blend_equation_rgb = mode; |
| 105 state_.blend_equation_alpha = mode; |
| 106 glBlendEquation(mode); |
| 107 } |
| 100 return error::kNoError; | 108 return error::kNoError; |
| 101 } | 109 } |
| 102 | 110 |
| 103 error::Error GLES2DecoderImpl::HandleBlendEquationSeparate( | 111 error::Error GLES2DecoderImpl::HandleBlendEquationSeparate( |
| 104 uint32 immediate_data_size, const gles2::BlendEquationSeparate& c) { | 112 uint32 immediate_data_size, const gles2::BlendEquationSeparate& c) { |
| 105 GLenum modeRGB = static_cast<GLenum>(c.modeRGB); | 113 GLenum modeRGB = static_cast<GLenum>(c.modeRGB); |
| 106 GLenum modeAlpha = static_cast<GLenum>(c.modeAlpha); | 114 GLenum modeAlpha = static_cast<GLenum>(c.modeAlpha); |
| 107 if (!validators_->equation.IsValid(modeRGB)) { | 115 if (!validators_->equation.IsValid(modeRGB)) { |
| 108 SetGLErrorInvalidEnum("glBlendEquationSeparate", modeRGB, "modeRGB"); | 116 SetGLErrorInvalidEnum("glBlendEquationSeparate", modeRGB, "modeRGB"); |
| 109 return error::kNoError; | 117 return error::kNoError; |
| 110 } | 118 } |
| 111 if (!validators_->equation.IsValid(modeAlpha)) { | 119 if (!validators_->equation.IsValid(modeAlpha)) { |
| 112 SetGLErrorInvalidEnum("glBlendEquationSeparate", modeAlpha, "modeAlpha"); | 120 SetGLErrorInvalidEnum("glBlendEquationSeparate", modeAlpha, "modeAlpha"); |
| 113 return error::kNoError; | 121 return error::kNoError; |
| 114 } | 122 } |
| 115 state_.blend_equation_rgb = modeRGB; | 123 if (state_.blend_equation_rgb != modeRGB || |
| 116 state_.blend_equation_alpha = modeAlpha; | 124 state_.blend_equation_alpha != modeAlpha) { |
| 117 glBlendEquationSeparate(modeRGB, modeAlpha); | 125 state_.blend_equation_rgb = modeRGB; |
| 126 state_.blend_equation_alpha = modeAlpha; |
| 127 glBlendEquationSeparate(modeRGB, modeAlpha); |
| 128 } |
| 118 return error::kNoError; | 129 return error::kNoError; |
| 119 } | 130 } |
| 120 | 131 |
| 121 error::Error GLES2DecoderImpl::HandleBlendFunc( | 132 error::Error GLES2DecoderImpl::HandleBlendFunc( |
| 122 uint32 immediate_data_size, const gles2::BlendFunc& c) { | 133 uint32 immediate_data_size, const gles2::BlendFunc& c) { |
| 123 GLenum sfactor = static_cast<GLenum>(c.sfactor); | 134 GLenum sfactor = static_cast<GLenum>(c.sfactor); |
| 124 GLenum dfactor = static_cast<GLenum>(c.dfactor); | 135 GLenum dfactor = static_cast<GLenum>(c.dfactor); |
| 125 if (!validators_->src_blend_factor.IsValid(sfactor)) { | 136 if (!validators_->src_blend_factor.IsValid(sfactor)) { |
| 126 SetGLErrorInvalidEnum("glBlendFunc", sfactor, "sfactor"); | 137 SetGLErrorInvalidEnum("glBlendFunc", sfactor, "sfactor"); |
| 127 return error::kNoError; | 138 return error::kNoError; |
| 128 } | 139 } |
| 129 if (!validators_->dst_blend_factor.IsValid(dfactor)) { | 140 if (!validators_->dst_blend_factor.IsValid(dfactor)) { |
| 130 SetGLErrorInvalidEnum("glBlendFunc", dfactor, "dfactor"); | 141 SetGLErrorInvalidEnum("glBlendFunc", dfactor, "dfactor"); |
| 131 return error::kNoError; | 142 return error::kNoError; |
| 132 } | 143 } |
| 133 state_.blend_source_rgb = sfactor; | 144 if (state_.blend_source_rgb != sfactor || |
| 134 state_.blend_dest_rgb = dfactor; | 145 state_.blend_dest_rgb != dfactor || |
| 135 state_.blend_source_alpha = sfactor; | 146 state_.blend_source_alpha != sfactor || |
| 136 state_.blend_dest_alpha = dfactor; | 147 state_.blend_dest_alpha != dfactor) { |
| 137 glBlendFunc(sfactor, dfactor); | 148 state_.blend_source_rgb = sfactor; |
| 149 state_.blend_dest_rgb = dfactor; |
| 150 state_.blend_source_alpha = sfactor; |
| 151 state_.blend_dest_alpha = dfactor; |
| 152 glBlendFunc(sfactor, dfactor); |
| 153 } |
| 138 return error::kNoError; | 154 return error::kNoError; |
| 139 } | 155 } |
| 140 | 156 |
| 141 error::Error GLES2DecoderImpl::HandleBlendFuncSeparate( | 157 error::Error GLES2DecoderImpl::HandleBlendFuncSeparate( |
| 142 uint32 immediate_data_size, const gles2::BlendFuncSeparate& c) { | 158 uint32 immediate_data_size, const gles2::BlendFuncSeparate& c) { |
| 143 GLenum srcRGB = static_cast<GLenum>(c.srcRGB); | 159 GLenum srcRGB = static_cast<GLenum>(c.srcRGB); |
| 144 GLenum dstRGB = static_cast<GLenum>(c.dstRGB); | 160 GLenum dstRGB = static_cast<GLenum>(c.dstRGB); |
| 145 GLenum srcAlpha = static_cast<GLenum>(c.srcAlpha); | 161 GLenum srcAlpha = static_cast<GLenum>(c.srcAlpha); |
| 146 GLenum dstAlpha = static_cast<GLenum>(c.dstAlpha); | 162 GLenum dstAlpha = static_cast<GLenum>(c.dstAlpha); |
| 147 if (!validators_->src_blend_factor.IsValid(srcRGB)) { | 163 if (!validators_->src_blend_factor.IsValid(srcRGB)) { |
| 148 SetGLErrorInvalidEnum("glBlendFuncSeparate", srcRGB, "srcRGB"); | 164 SetGLErrorInvalidEnum("glBlendFuncSeparate", srcRGB, "srcRGB"); |
| 149 return error::kNoError; | 165 return error::kNoError; |
| 150 } | 166 } |
| 151 if (!validators_->dst_blend_factor.IsValid(dstRGB)) { | 167 if (!validators_->dst_blend_factor.IsValid(dstRGB)) { |
| 152 SetGLErrorInvalidEnum("glBlendFuncSeparate", dstRGB, "dstRGB"); | 168 SetGLErrorInvalidEnum("glBlendFuncSeparate", dstRGB, "dstRGB"); |
| 153 return error::kNoError; | 169 return error::kNoError; |
| 154 } | 170 } |
| 155 if (!validators_->src_blend_factor.IsValid(srcAlpha)) { | 171 if (!validators_->src_blend_factor.IsValid(srcAlpha)) { |
| 156 SetGLErrorInvalidEnum("glBlendFuncSeparate", srcAlpha, "srcAlpha"); | 172 SetGLErrorInvalidEnum("glBlendFuncSeparate", srcAlpha, "srcAlpha"); |
| 157 return error::kNoError; | 173 return error::kNoError; |
| 158 } | 174 } |
| 159 if (!validators_->dst_blend_factor.IsValid(dstAlpha)) { | 175 if (!validators_->dst_blend_factor.IsValid(dstAlpha)) { |
| 160 SetGLErrorInvalidEnum("glBlendFuncSeparate", dstAlpha, "dstAlpha"); | 176 SetGLErrorInvalidEnum("glBlendFuncSeparate", dstAlpha, "dstAlpha"); |
| 161 return error::kNoError; | 177 return error::kNoError; |
| 162 } | 178 } |
| 163 state_.blend_source_rgb = srcRGB; | 179 if (state_.blend_source_rgb != srcRGB || |
| 164 state_.blend_dest_rgb = dstRGB; | 180 state_.blend_dest_rgb != dstRGB || |
| 165 state_.blend_source_alpha = srcAlpha; | 181 state_.blend_source_alpha != srcAlpha || |
| 166 state_.blend_dest_alpha = dstAlpha; | 182 state_.blend_dest_alpha != dstAlpha) { |
| 167 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); | 183 state_.blend_source_rgb = srcRGB; |
| 184 state_.blend_dest_rgb = dstRGB; |
| 185 state_.blend_source_alpha = srcAlpha; |
| 186 state_.blend_dest_alpha = dstAlpha; |
| 187 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); |
| 188 } |
| 168 return error::kNoError; | 189 return error::kNoError; |
| 169 } | 190 } |
| 170 | 191 |
| 171 error::Error GLES2DecoderImpl::HandleBufferSubData( | 192 error::Error GLES2DecoderImpl::HandleBufferSubData( |
| 172 uint32 immediate_data_size, const gles2::BufferSubData& c) { | 193 uint32 immediate_data_size, const gles2::BufferSubData& c) { |
| 173 GLenum target = static_cast<GLenum>(c.target); | 194 GLenum target = static_cast<GLenum>(c.target); |
| 174 GLintptr offset = static_cast<GLintptr>(c.offset); | 195 GLintptr offset = static_cast<GLintptr>(c.offset); |
| 175 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); | 196 GLsizeiptr size = static_cast<GLsizeiptr>(c.size); |
| 176 uint32 data_size = size; | 197 uint32 data_size = size; |
| 177 const void* data = GetSharedMemoryAs<const void*>( | 198 const void* data = GetSharedMemoryAs<const void*>( |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 *result_dst = DoCheckFramebufferStatus(target); | 251 *result_dst = DoCheckFramebufferStatus(target); |
| 231 return error::kNoError; | 252 return error::kNoError; |
| 232 } | 253 } |
| 233 | 254 |
| 234 error::Error GLES2DecoderImpl::HandleClearColor( | 255 error::Error GLES2DecoderImpl::HandleClearColor( |
| 235 uint32 immediate_data_size, const gles2::ClearColor& c) { | 256 uint32 immediate_data_size, const gles2::ClearColor& c) { |
| 236 GLclampf red = static_cast<GLclampf>(c.red); | 257 GLclampf red = static_cast<GLclampf>(c.red); |
| 237 GLclampf green = static_cast<GLclampf>(c.green); | 258 GLclampf green = static_cast<GLclampf>(c.green); |
| 238 GLclampf blue = static_cast<GLclampf>(c.blue); | 259 GLclampf blue = static_cast<GLclampf>(c.blue); |
| 239 GLclampf alpha = static_cast<GLclampf>(c.alpha); | 260 GLclampf alpha = static_cast<GLclampf>(c.alpha); |
| 240 state_.color_clear_red = red; | 261 if (state_.color_clear_red != red || |
| 241 state_.color_clear_green = green; | 262 state_.color_clear_green != green || |
| 242 state_.color_clear_blue = blue; | 263 state_.color_clear_blue != blue || |
| 243 state_.color_clear_alpha = alpha; | 264 state_.color_clear_alpha != alpha) { |
| 244 glClearColor(red, green, blue, alpha); | 265 state_.color_clear_red = red; |
| 266 state_.color_clear_green = green; |
| 267 state_.color_clear_blue = blue; |
| 268 state_.color_clear_alpha = alpha; |
| 269 glClearColor(red, green, blue, alpha); |
| 270 } |
| 245 return error::kNoError; | 271 return error::kNoError; |
| 246 } | 272 } |
| 247 | 273 |
| 248 error::Error GLES2DecoderImpl::HandleClearDepthf( | 274 error::Error GLES2DecoderImpl::HandleClearDepthf( |
| 249 uint32 immediate_data_size, const gles2::ClearDepthf& c) { | 275 uint32 immediate_data_size, const gles2::ClearDepthf& c) { |
| 250 GLclampf depth = static_cast<GLclampf>(c.depth); | 276 GLclampf depth = static_cast<GLclampf>(c.depth); |
| 251 state_.depth_clear = depth; | 277 if (state_.depth_clear != depth) { |
| 252 glClearDepth(depth); | 278 state_.depth_clear = depth; |
| 279 glClearDepth(depth); |
| 280 } |
| 253 return error::kNoError; | 281 return error::kNoError; |
| 254 } | 282 } |
| 255 | 283 |
| 256 error::Error GLES2DecoderImpl::HandleClearStencil( | 284 error::Error GLES2DecoderImpl::HandleClearStencil( |
| 257 uint32 immediate_data_size, const gles2::ClearStencil& c) { | 285 uint32 immediate_data_size, const gles2::ClearStencil& c) { |
| 258 GLint s = static_cast<GLint>(c.s); | 286 GLint s = static_cast<GLint>(c.s); |
| 259 state_.stencil_clear = s; | 287 if (state_.stencil_clear != s) { |
| 260 glClearStencil(s); | 288 state_.stencil_clear = s; |
| 289 glClearStencil(s); |
| 290 } |
| 261 return error::kNoError; | 291 return error::kNoError; |
| 262 } | 292 } |
| 263 | 293 |
| 264 error::Error GLES2DecoderImpl::HandleColorMask( | 294 error::Error GLES2DecoderImpl::HandleColorMask( |
| 265 uint32 immediate_data_size, const gles2::ColorMask& c) { | 295 uint32 immediate_data_size, const gles2::ColorMask& c) { |
| 266 GLboolean red = static_cast<GLboolean>(c.red); | 296 GLboolean red = static_cast<GLboolean>(c.red); |
| 267 GLboolean green = static_cast<GLboolean>(c.green); | 297 GLboolean green = static_cast<GLboolean>(c.green); |
| 268 GLboolean blue = static_cast<GLboolean>(c.blue); | 298 GLboolean blue = static_cast<GLboolean>(c.blue); |
| 269 GLboolean alpha = static_cast<GLboolean>(c.alpha); | 299 GLboolean alpha = static_cast<GLboolean>(c.alpha); |
| 270 state_.color_mask_red = red; | 300 if (state_.color_mask_red != red || |
| 271 state_.color_mask_green = green; | 301 state_.color_mask_green != green || |
| 272 state_.color_mask_blue = blue; | 302 state_.color_mask_blue != blue || |
| 273 state_.color_mask_alpha = alpha; | 303 state_.color_mask_alpha != alpha) { |
| 274 clear_state_dirty_ = true; | 304 state_.color_mask_red = red; |
| 305 state_.color_mask_green = green; |
| 306 state_.color_mask_blue = blue; |
| 307 state_.color_mask_alpha = alpha; |
| 308 clear_state_dirty_ = true; |
| 309 } |
| 275 return error::kNoError; | 310 return error::kNoError; |
| 276 } | 311 } |
| 277 | 312 |
| 278 error::Error GLES2DecoderImpl::HandleCompileShader( | 313 error::Error GLES2DecoderImpl::HandleCompileShader( |
| 279 uint32 immediate_data_size, const gles2::CompileShader& c) { | 314 uint32 immediate_data_size, const gles2::CompileShader& c) { |
| 280 GLuint shader = c.shader; | 315 GLuint shader = c.shader; |
| 281 DoCompileShader(shader); | 316 DoCompileShader(shader); |
| 282 return error::kNoError; | 317 return error::kNoError; |
| 283 } | 318 } |
| 284 | 319 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 return error::kNoError; | 485 return error::kNoError; |
| 451 } | 486 } |
| 452 | 487 |
| 453 error::Error GLES2DecoderImpl::HandleCullFace( | 488 error::Error GLES2DecoderImpl::HandleCullFace( |
| 454 uint32 immediate_data_size, const gles2::CullFace& c) { | 489 uint32 immediate_data_size, const gles2::CullFace& c) { |
| 455 GLenum mode = static_cast<GLenum>(c.mode); | 490 GLenum mode = static_cast<GLenum>(c.mode); |
| 456 if (!validators_->face_type.IsValid(mode)) { | 491 if (!validators_->face_type.IsValid(mode)) { |
| 457 SetGLErrorInvalidEnum("glCullFace", mode, "mode"); | 492 SetGLErrorInvalidEnum("glCullFace", mode, "mode"); |
| 458 return error::kNoError; | 493 return error::kNoError; |
| 459 } | 494 } |
| 460 state_.cull_mode = mode; | 495 if (state_.cull_mode != mode) { |
| 461 glCullFace(mode); | 496 state_.cull_mode = mode; |
| 497 glCullFace(mode); |
| 498 } |
| 462 return error::kNoError; | 499 return error::kNoError; |
| 463 } | 500 } |
| 464 | 501 |
| 465 error::Error GLES2DecoderImpl::HandleDeleteBuffers( | 502 error::Error GLES2DecoderImpl::HandleDeleteBuffers( |
| 466 uint32 immediate_data_size, const gles2::DeleteBuffers& c) { | 503 uint32 immediate_data_size, const gles2::DeleteBuffers& c) { |
| 467 GLsizei n = static_cast<GLsizei>(c.n); | 504 GLsizei n = static_cast<GLsizei>(c.n); |
| 468 uint32 data_size; | 505 uint32 data_size; |
| 469 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 506 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
| 470 return error::kOutOfBounds; | 507 return error::kOutOfBounds; |
| 471 } | 508 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 return error::kNoError; | 627 return error::kNoError; |
| 591 } | 628 } |
| 592 | 629 |
| 593 error::Error GLES2DecoderImpl::HandleDepthFunc( | 630 error::Error GLES2DecoderImpl::HandleDepthFunc( |
| 594 uint32 immediate_data_size, const gles2::DepthFunc& c) { | 631 uint32 immediate_data_size, const gles2::DepthFunc& c) { |
| 595 GLenum func = static_cast<GLenum>(c.func); | 632 GLenum func = static_cast<GLenum>(c.func); |
| 596 if (!validators_->cmp_function.IsValid(func)) { | 633 if (!validators_->cmp_function.IsValid(func)) { |
| 597 SetGLErrorInvalidEnum("glDepthFunc", func, "func"); | 634 SetGLErrorInvalidEnum("glDepthFunc", func, "func"); |
| 598 return error::kNoError; | 635 return error::kNoError; |
| 599 } | 636 } |
| 600 state_.depth_func = func; | 637 if (state_.depth_func != func) { |
| 601 glDepthFunc(func); | 638 state_.depth_func = func; |
| 639 glDepthFunc(func); |
| 640 } |
| 602 return error::kNoError; | 641 return error::kNoError; |
| 603 } | 642 } |
| 604 | 643 |
| 605 error::Error GLES2DecoderImpl::HandleDepthMask( | 644 error::Error GLES2DecoderImpl::HandleDepthMask( |
| 606 uint32 immediate_data_size, const gles2::DepthMask& c) { | 645 uint32 immediate_data_size, const gles2::DepthMask& c) { |
| 607 GLboolean flag = static_cast<GLboolean>(c.flag); | 646 GLboolean flag = static_cast<GLboolean>(c.flag); |
| 608 state_.depth_mask = flag; | 647 if (state_.depth_mask != flag) { |
| 609 clear_state_dirty_ = true; | 648 state_.depth_mask = flag; |
| 649 clear_state_dirty_ = true; |
| 650 } |
| 610 return error::kNoError; | 651 return error::kNoError; |
| 611 } | 652 } |
| 612 | 653 |
| 613 error::Error GLES2DecoderImpl::HandleDepthRangef( | 654 error::Error GLES2DecoderImpl::HandleDepthRangef( |
| 614 uint32 immediate_data_size, const gles2::DepthRangef& c) { | 655 uint32 immediate_data_size, const gles2::DepthRangef& c) { |
| 615 GLclampf zNear = static_cast<GLclampf>(c.zNear); | 656 GLclampf zNear = static_cast<GLclampf>(c.zNear); |
| 616 GLclampf zFar = static_cast<GLclampf>(c.zFar); | 657 GLclampf zFar = static_cast<GLclampf>(c.zFar); |
| 617 DoDepthRangef(zNear, zFar); | 658 DoDepthRangef(zNear, zFar); |
| 618 return error::kNoError; | 659 return error::kNoError; |
| 619 } | 660 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 return error::kNoError; | 768 return error::kNoError; |
| 728 } | 769 } |
| 729 | 770 |
| 730 error::Error GLES2DecoderImpl::HandleFrontFace( | 771 error::Error GLES2DecoderImpl::HandleFrontFace( |
| 731 uint32 immediate_data_size, const gles2::FrontFace& c) { | 772 uint32 immediate_data_size, const gles2::FrontFace& c) { |
| 732 GLenum mode = static_cast<GLenum>(c.mode); | 773 GLenum mode = static_cast<GLenum>(c.mode); |
| 733 if (!validators_->face_mode.IsValid(mode)) { | 774 if (!validators_->face_mode.IsValid(mode)) { |
| 734 SetGLErrorInvalidEnum("glFrontFace", mode, "mode"); | 775 SetGLErrorInvalidEnum("glFrontFace", mode, "mode"); |
| 735 return error::kNoError; | 776 return error::kNoError; |
| 736 } | 777 } |
| 737 state_.front_face = mode; | 778 if (state_.front_face != mode) { |
| 738 glFrontFace(mode); | 779 state_.front_face = mode; |
| 780 glFrontFace(mode); |
| 781 } |
| 739 return error::kNoError; | 782 return error::kNoError; |
| 740 } | 783 } |
| 741 | 784 |
| 742 error::Error GLES2DecoderImpl::HandleGenBuffers( | 785 error::Error GLES2DecoderImpl::HandleGenBuffers( |
| 743 uint32 immediate_data_size, const gles2::GenBuffers& c) { | 786 uint32 immediate_data_size, const gles2::GenBuffers& c) { |
| 744 GLsizei n = static_cast<GLsizei>(c.n); | 787 GLsizei n = static_cast<GLsizei>(c.n); |
| 745 uint32 data_size; | 788 uint32 data_size; |
| 746 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { | 789 if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { |
| 747 return error::kOutOfBounds; | 790 return error::kOutOfBounds; |
| 748 } | 791 } |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 if (!result_dst) { | 1466 if (!result_dst) { |
| 1424 return error::kOutOfBounds; | 1467 return error::kOutOfBounds; |
| 1425 } | 1468 } |
| 1426 *result_dst = DoIsTexture(texture); | 1469 *result_dst = DoIsTexture(texture); |
| 1427 return error::kNoError; | 1470 return error::kNoError; |
| 1428 } | 1471 } |
| 1429 | 1472 |
| 1430 error::Error GLES2DecoderImpl::HandleLineWidth( | 1473 error::Error GLES2DecoderImpl::HandleLineWidth( |
| 1431 uint32 immediate_data_size, const gles2::LineWidth& c) { | 1474 uint32 immediate_data_size, const gles2::LineWidth& c) { |
| 1432 GLfloat width = static_cast<GLfloat>(c.width); | 1475 GLfloat width = static_cast<GLfloat>(c.width); |
| 1433 state_.line_width = width; | 1476 if (state_.line_width != width) { |
| 1434 glLineWidth(width); | 1477 state_.line_width = width; |
| 1478 glLineWidth(width); |
| 1479 } |
| 1435 return error::kNoError; | 1480 return error::kNoError; |
| 1436 } | 1481 } |
| 1437 | 1482 |
| 1438 error::Error GLES2DecoderImpl::HandleLinkProgram( | 1483 error::Error GLES2DecoderImpl::HandleLinkProgram( |
| 1439 uint32 immediate_data_size, const gles2::LinkProgram& c) { | 1484 uint32 immediate_data_size, const gles2::LinkProgram& c) { |
| 1440 GLuint program = c.program; | 1485 GLuint program = c.program; |
| 1441 DoLinkProgram(program); | 1486 DoLinkProgram(program); |
| 1442 return error::kNoError; | 1487 return error::kNoError; |
| 1443 } | 1488 } |
| 1444 | 1489 |
| 1445 error::Error GLES2DecoderImpl::HandlePolygonOffset( | 1490 error::Error GLES2DecoderImpl::HandlePolygonOffset( |
| 1446 uint32 immediate_data_size, const gles2::PolygonOffset& c) { | 1491 uint32 immediate_data_size, const gles2::PolygonOffset& c) { |
| 1447 GLfloat factor = static_cast<GLfloat>(c.factor); | 1492 GLfloat factor = static_cast<GLfloat>(c.factor); |
| 1448 GLfloat units = static_cast<GLfloat>(c.units); | 1493 GLfloat units = static_cast<GLfloat>(c.units); |
| 1449 state_.polygon_offset_factor = factor; | 1494 if (state_.polygon_offset_factor != factor || |
| 1450 state_.polygon_offset_units = units; | 1495 state_.polygon_offset_units != units) { |
| 1451 glPolygonOffset(factor, units); | 1496 state_.polygon_offset_factor = factor; |
| 1497 state_.polygon_offset_units = units; |
| 1498 glPolygonOffset(factor, units); |
| 1499 } |
| 1452 return error::kNoError; | 1500 return error::kNoError; |
| 1453 } | 1501 } |
| 1454 | 1502 |
| 1455 error::Error GLES2DecoderImpl::HandleReleaseShaderCompiler( | 1503 error::Error GLES2DecoderImpl::HandleReleaseShaderCompiler( |
| 1456 uint32 immediate_data_size, const gles2::ReleaseShaderCompiler& c) { | 1504 uint32 immediate_data_size, const gles2::ReleaseShaderCompiler& c) { |
| 1457 DoReleaseShaderCompiler(); | 1505 DoReleaseShaderCompiler(); |
| 1458 return error::kNoError; | 1506 return error::kNoError; |
| 1459 } | 1507 } |
| 1460 | 1508 |
| 1461 error::Error GLES2DecoderImpl::HandleRenderbufferStorage( | 1509 error::Error GLES2DecoderImpl::HandleRenderbufferStorage( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1500 GLsizei width = static_cast<GLsizei>(c.width); | 1548 GLsizei width = static_cast<GLsizei>(c.width); |
| 1501 GLsizei height = static_cast<GLsizei>(c.height); | 1549 GLsizei height = static_cast<GLsizei>(c.height); |
| 1502 if (width < 0) { | 1550 if (width < 0) { |
| 1503 SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0"); | 1551 SetGLError(GL_INVALID_VALUE, "glScissor", "width < 0"); |
| 1504 return error::kNoError; | 1552 return error::kNoError; |
| 1505 } | 1553 } |
| 1506 if (height < 0) { | 1554 if (height < 0) { |
| 1507 SetGLError(GL_INVALID_VALUE, "glScissor", "height < 0"); | 1555 SetGLError(GL_INVALID_VALUE, "glScissor", "height < 0"); |
| 1508 return error::kNoError; | 1556 return error::kNoError; |
| 1509 } | 1557 } |
| 1510 state_.scissor_x = x; | 1558 if (state_.scissor_x != x || |
| 1511 state_.scissor_y = y; | 1559 state_.scissor_y != y || |
| 1512 state_.scissor_width = width; | 1560 state_.scissor_width != width || |
| 1513 state_.scissor_height = height; | 1561 state_.scissor_height != height) { |
| 1514 glScissor(x, y, width, height); | 1562 state_.scissor_x = x; |
| 1563 state_.scissor_y = y; |
| 1564 state_.scissor_width = width; |
| 1565 state_.scissor_height = height; |
| 1566 glScissor(x, y, width, height); |
| 1567 } |
| 1515 return error::kNoError; | 1568 return error::kNoError; |
| 1516 } | 1569 } |
| 1517 | 1570 |
| 1518 error::Error GLES2DecoderImpl::HandleStencilFunc( | 1571 error::Error GLES2DecoderImpl::HandleStencilFunc( |
| 1519 uint32 immediate_data_size, const gles2::StencilFunc& c) { | 1572 uint32 immediate_data_size, const gles2::StencilFunc& c) { |
| 1520 GLenum func = static_cast<GLenum>(c.func); | 1573 GLenum func = static_cast<GLenum>(c.func); |
| 1521 GLint ref = static_cast<GLint>(c.ref); | 1574 GLint ref = static_cast<GLint>(c.ref); |
| 1522 GLuint mask = static_cast<GLuint>(c.mask); | 1575 GLuint mask = static_cast<GLuint>(c.mask); |
| 1523 if (!validators_->cmp_function.IsValid(func)) { | 1576 if (!validators_->cmp_function.IsValid(func)) { |
| 1524 SetGLErrorInvalidEnum("glStencilFunc", func, "func"); | 1577 SetGLErrorInvalidEnum("glStencilFunc", func, "func"); |
| 1525 return error::kNoError; | 1578 return error::kNoError; |
| 1526 } | 1579 } |
| 1527 glStencilFunc(func, ref, mask); | 1580 if (state_.stencil_front_func != func || |
| 1581 state_.stencil_front_ref != ref || |
| 1582 state_.stencil_front_mask != mask || |
| 1583 state_.stencil_back_func != func || |
| 1584 state_.stencil_back_ref != ref || |
| 1585 state_.stencil_back_mask != mask) { |
| 1586 state_.stencil_front_func = func; |
| 1587 state_.stencil_front_ref = ref; |
| 1588 state_.stencil_front_mask = mask; |
| 1589 state_.stencil_back_func = func; |
| 1590 state_.stencil_back_ref = ref; |
| 1591 state_.stencil_back_mask = mask; |
| 1592 glStencilFunc(func, ref, mask); |
| 1593 } |
| 1528 return error::kNoError; | 1594 return error::kNoError; |
| 1529 } | 1595 } |
| 1530 | 1596 |
| 1531 error::Error GLES2DecoderImpl::HandleStencilFuncSeparate( | 1597 error::Error GLES2DecoderImpl::HandleStencilFuncSeparate( |
| 1532 uint32 immediate_data_size, const gles2::StencilFuncSeparate& c) { | 1598 uint32 immediate_data_size, const gles2::StencilFuncSeparate& c) { |
| 1533 GLenum face = static_cast<GLenum>(c.face); | 1599 GLenum face = static_cast<GLenum>(c.face); |
| 1534 GLenum func = static_cast<GLenum>(c.func); | 1600 GLenum func = static_cast<GLenum>(c.func); |
| 1535 GLint ref = static_cast<GLint>(c.ref); | 1601 GLint ref = static_cast<GLint>(c.ref); |
| 1536 GLuint mask = static_cast<GLuint>(c.mask); | 1602 GLuint mask = static_cast<GLuint>(c.mask); |
| 1537 if (!validators_->face_type.IsValid(face)) { | 1603 if (!validators_->face_type.IsValid(face)) { |
| 1538 SetGLErrorInvalidEnum("glStencilFuncSeparate", face, "face"); | 1604 SetGLErrorInvalidEnum("glStencilFuncSeparate", face, "face"); |
| 1539 return error::kNoError; | 1605 return error::kNoError; |
| 1540 } | 1606 } |
| 1541 if (!validators_->cmp_function.IsValid(func)) { | 1607 if (!validators_->cmp_function.IsValid(func)) { |
| 1542 SetGLErrorInvalidEnum("glStencilFuncSeparate", func, "func"); | 1608 SetGLErrorInvalidEnum("glStencilFuncSeparate", func, "func"); |
| 1543 return error::kNoError; | 1609 return error::kNoError; |
| 1544 } | 1610 } |
| 1545 glStencilFuncSeparate(face, func, ref, mask); | 1611 bool changed = false; |
| 1612 if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { |
| 1613 changed |= state_.stencil_front_func != func || |
| 1614 state_.stencil_front_ref != ref || |
| 1615 state_.stencil_front_mask != mask; |
| 1616 } |
| 1617 if (face == GL_BACK || face == GL_FRONT_AND_BACK) { |
| 1618 changed |= state_.stencil_back_func != func || |
| 1619 state_.stencil_back_ref != ref || |
| 1620 state_.stencil_back_mask != mask; |
| 1621 } |
| 1622 if (changed) { |
| 1623 if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { |
| 1624 state_.stencil_front_func = func; |
| 1625 state_.stencil_front_ref = ref; |
| 1626 state_.stencil_front_mask = mask; |
| 1627 } |
| 1628 if (face == GL_BACK || face == GL_FRONT_AND_BACK) { |
| 1629 state_.stencil_back_func = func; |
| 1630 state_.stencil_back_ref = ref; |
| 1631 state_.stencil_back_mask = mask; |
| 1632 } |
| 1633 glStencilFuncSeparate(face, func, ref, mask); |
| 1634 } |
| 1546 return error::kNoError; | 1635 return error::kNoError; |
| 1547 } | 1636 } |
| 1548 | 1637 |
| 1549 error::Error GLES2DecoderImpl::HandleStencilMask( | 1638 error::Error GLES2DecoderImpl::HandleStencilMask( |
| 1550 uint32 immediate_data_size, const gles2::StencilMask& c) { | 1639 uint32 immediate_data_size, const gles2::StencilMask& c) { |
| 1551 GLuint mask = static_cast<GLuint>(c.mask); | 1640 GLuint mask = static_cast<GLuint>(c.mask); |
| 1552 state_.stencil_front_writemask = mask; | 1641 if (state_.stencil_front_writemask != mask || |
| 1553 state_.stencil_back_writemask = mask; | 1642 state_.stencil_back_writemask != mask) { |
| 1554 clear_state_dirty_ = true; | 1643 state_.stencil_front_writemask = mask; |
| 1644 state_.stencil_back_writemask = mask; |
| 1645 clear_state_dirty_ = true; |
| 1646 } |
| 1555 return error::kNoError; | 1647 return error::kNoError; |
| 1556 } | 1648 } |
| 1557 | 1649 |
| 1558 error::Error GLES2DecoderImpl::HandleStencilMaskSeparate( | 1650 error::Error GLES2DecoderImpl::HandleStencilMaskSeparate( |
| 1559 uint32 immediate_data_size, const gles2::StencilMaskSeparate& c) { | 1651 uint32 immediate_data_size, const gles2::StencilMaskSeparate& c) { |
| 1560 GLenum face = static_cast<GLenum>(c.face); | 1652 GLenum face = static_cast<GLenum>(c.face); |
| 1561 GLuint mask = static_cast<GLuint>(c.mask); | 1653 GLuint mask = static_cast<GLuint>(c.mask); |
| 1562 if (!validators_->face_type.IsValid(face)) { | 1654 if (!validators_->face_type.IsValid(face)) { |
| 1563 SetGLErrorInvalidEnum("glStencilMaskSeparate", face, "face"); | 1655 SetGLErrorInvalidEnum("glStencilMaskSeparate", face, "face"); |
| 1564 return error::kNoError; | 1656 return error::kNoError; |
| 1565 } | 1657 } |
| 1658 bool changed = false; |
| 1566 if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { | 1659 if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { |
| 1567 state_.stencil_front_writemask = mask; | 1660 changed |= state_.stencil_front_writemask != mask; |
| 1568 } | 1661 } |
| 1569 if (face == GL_BACK || face == GL_FRONT_AND_BACK) { | 1662 if (face == GL_BACK || face == GL_FRONT_AND_BACK) { |
| 1570 state_.stencil_back_writemask = mask; | 1663 changed |= state_.stencil_back_writemask != mask; |
| 1571 } | 1664 } |
| 1572 clear_state_dirty_ = true; | 1665 if (changed) { |
| 1666 if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { |
| 1667 state_.stencil_front_writemask = mask; |
| 1668 } |
| 1669 if (face == GL_BACK || face == GL_FRONT_AND_BACK) { |
| 1670 state_.stencil_back_writemask = mask; |
| 1671 } |
| 1672 clear_state_dirty_ = true; |
| 1673 } |
| 1573 return error::kNoError; | 1674 return error::kNoError; |
| 1574 } | 1675 } |
| 1575 | 1676 |
| 1576 error::Error GLES2DecoderImpl::HandleStencilOp( | 1677 error::Error GLES2DecoderImpl::HandleStencilOp( |
| 1577 uint32 immediate_data_size, const gles2::StencilOp& c) { | 1678 uint32 immediate_data_size, const gles2::StencilOp& c) { |
| 1578 GLenum fail = static_cast<GLenum>(c.fail); | 1679 GLenum fail = static_cast<GLenum>(c.fail); |
| 1579 GLenum zfail = static_cast<GLenum>(c.zfail); | 1680 GLenum zfail = static_cast<GLenum>(c.zfail); |
| 1580 GLenum zpass = static_cast<GLenum>(c.zpass); | 1681 GLenum zpass = static_cast<GLenum>(c.zpass); |
| 1581 if (!validators_->stencil_op.IsValid(fail)) { | 1682 if (!validators_->stencil_op.IsValid(fail)) { |
| 1582 SetGLErrorInvalidEnum("glStencilOp", fail, "fail"); | 1683 SetGLErrorInvalidEnum("glStencilOp", fail, "fail"); |
| 1583 return error::kNoError; | 1684 return error::kNoError; |
| 1584 } | 1685 } |
| 1585 if (!validators_->stencil_op.IsValid(zfail)) { | 1686 if (!validators_->stencil_op.IsValid(zfail)) { |
| 1586 SetGLErrorInvalidEnum("glStencilOp", zfail, "zfail"); | 1687 SetGLErrorInvalidEnum("glStencilOp", zfail, "zfail"); |
| 1587 return error::kNoError; | 1688 return error::kNoError; |
| 1588 } | 1689 } |
| 1589 if (!validators_->stencil_op.IsValid(zpass)) { | 1690 if (!validators_->stencil_op.IsValid(zpass)) { |
| 1590 SetGLErrorInvalidEnum("glStencilOp", zpass, "zpass"); | 1691 SetGLErrorInvalidEnum("glStencilOp", zpass, "zpass"); |
| 1591 return error::kNoError; | 1692 return error::kNoError; |
| 1592 } | 1693 } |
| 1593 state_.stencil_front_fail_op = fail; | 1694 if (state_.stencil_front_fail_op != fail || |
| 1594 state_.stencil_front_z_fail_op = zfail; | 1695 state_.stencil_front_z_fail_op != zfail || |
| 1595 state_.stencil_front_z_pass_op = zpass; | 1696 state_.stencil_front_z_pass_op != zpass || |
| 1596 state_.stencil_back_fail_op = fail; | 1697 state_.stencil_back_fail_op != fail || |
| 1597 state_.stencil_back_z_fail_op = zfail; | 1698 state_.stencil_back_z_fail_op != zfail || |
| 1598 state_.stencil_back_z_pass_op = zpass; | 1699 state_.stencil_back_z_pass_op != zpass) { |
| 1599 glStencilOp(fail, zfail, zpass); | 1700 state_.stencil_front_fail_op = fail; |
| 1701 state_.stencil_front_z_fail_op = zfail; |
| 1702 state_.stencil_front_z_pass_op = zpass; |
| 1703 state_.stencil_back_fail_op = fail; |
| 1704 state_.stencil_back_z_fail_op = zfail; |
| 1705 state_.stencil_back_z_pass_op = zpass; |
| 1706 glStencilOp(fail, zfail, zpass); |
| 1707 } |
| 1600 return error::kNoError; | 1708 return error::kNoError; |
| 1601 } | 1709 } |
| 1602 | 1710 |
| 1603 error::Error GLES2DecoderImpl::HandleStencilOpSeparate( | 1711 error::Error GLES2DecoderImpl::HandleStencilOpSeparate( |
| 1604 uint32 immediate_data_size, const gles2::StencilOpSeparate& c) { | 1712 uint32 immediate_data_size, const gles2::StencilOpSeparate& c) { |
| 1605 GLenum face = static_cast<GLenum>(c.face); | 1713 GLenum face = static_cast<GLenum>(c.face); |
| 1606 GLenum fail = static_cast<GLenum>(c.fail); | 1714 GLenum fail = static_cast<GLenum>(c.fail); |
| 1607 GLenum zfail = static_cast<GLenum>(c.zfail); | 1715 GLenum zfail = static_cast<GLenum>(c.zfail); |
| 1608 GLenum zpass = static_cast<GLenum>(c.zpass); | 1716 GLenum zpass = static_cast<GLenum>(c.zpass); |
| 1609 if (!validators_->face_type.IsValid(face)) { | 1717 if (!validators_->face_type.IsValid(face)) { |
| 1610 SetGLErrorInvalidEnum("glStencilOpSeparate", face, "face"); | 1718 SetGLErrorInvalidEnum("glStencilOpSeparate", face, "face"); |
| 1611 return error::kNoError; | 1719 return error::kNoError; |
| 1612 } | 1720 } |
| 1613 if (!validators_->stencil_op.IsValid(fail)) { | 1721 if (!validators_->stencil_op.IsValid(fail)) { |
| 1614 SetGLErrorInvalidEnum("glStencilOpSeparate", fail, "fail"); | 1722 SetGLErrorInvalidEnum("glStencilOpSeparate", fail, "fail"); |
| 1615 return error::kNoError; | 1723 return error::kNoError; |
| 1616 } | 1724 } |
| 1617 if (!validators_->stencil_op.IsValid(zfail)) { | 1725 if (!validators_->stencil_op.IsValid(zfail)) { |
| 1618 SetGLErrorInvalidEnum("glStencilOpSeparate", zfail, "zfail"); | 1726 SetGLErrorInvalidEnum("glStencilOpSeparate", zfail, "zfail"); |
| 1619 return error::kNoError; | 1727 return error::kNoError; |
| 1620 } | 1728 } |
| 1621 if (!validators_->stencil_op.IsValid(zpass)) { | 1729 if (!validators_->stencil_op.IsValid(zpass)) { |
| 1622 SetGLErrorInvalidEnum("glStencilOpSeparate", zpass, "zpass"); | 1730 SetGLErrorInvalidEnum("glStencilOpSeparate", zpass, "zpass"); |
| 1623 return error::kNoError; | 1731 return error::kNoError; |
| 1624 } | 1732 } |
| 1733 bool changed = false; |
| 1625 if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { | 1734 if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { |
| 1626 state_.stencil_front_fail_op = fail; | 1735 changed |= state_.stencil_front_fail_op != fail || |
| 1627 state_.stencil_front_z_fail_op = zfail; | 1736 state_.stencil_front_z_fail_op != zfail || |
| 1628 state_.stencil_front_z_pass_op = zpass; | 1737 state_.stencil_front_z_pass_op != zpass; |
| 1629 } | 1738 } |
| 1630 if (face == GL_BACK || face == GL_FRONT_AND_BACK) { | 1739 if (face == GL_BACK || face == GL_FRONT_AND_BACK) { |
| 1631 state_.stencil_back_fail_op = fail; | 1740 changed |= state_.stencil_back_fail_op != fail || |
| 1632 state_.stencil_back_z_fail_op = zfail; | 1741 state_.stencil_back_z_fail_op != zfail || |
| 1633 state_.stencil_back_z_pass_op = zpass; | 1742 state_.stencil_back_z_pass_op != zpass; |
| 1634 } | 1743 } |
| 1635 glStencilOpSeparate(face, fail, zfail, zpass); | 1744 if (changed) { |
| 1745 if (face == GL_FRONT || face == GL_FRONT_AND_BACK) { |
| 1746 state_.stencil_front_fail_op = fail; |
| 1747 state_.stencil_front_z_fail_op = zfail; |
| 1748 state_.stencil_front_z_pass_op = zpass; |
| 1749 } |
| 1750 if (face == GL_BACK || face == GL_FRONT_AND_BACK) { |
| 1751 state_.stencil_back_fail_op = fail; |
| 1752 state_.stencil_back_z_fail_op = zfail; |
| 1753 state_.stencil_back_z_pass_op = zpass; |
| 1754 } |
| 1755 glStencilOpSeparate(face, fail, zfail, zpass); |
| 1756 } |
| 1636 return error::kNoError; | 1757 return error::kNoError; |
| 1637 } | 1758 } |
| 1638 | 1759 |
| 1639 error::Error GLES2DecoderImpl::HandleTexParameterf( | 1760 error::Error GLES2DecoderImpl::HandleTexParameterf( |
| 1640 uint32 immediate_data_size, const gles2::TexParameterf& c) { | 1761 uint32 immediate_data_size, const gles2::TexParameterf& c) { |
| 1641 GLenum target = static_cast<GLenum>(c.target); | 1762 GLenum target = static_cast<GLenum>(c.target); |
| 1642 GLenum pname = static_cast<GLenum>(c.pname); | 1763 GLenum pname = static_cast<GLenum>(c.pname); |
| 1643 GLfloat param = static_cast<GLfloat>(c.param); | 1764 GLfloat param = static_cast<GLfloat>(c.param); |
| 1644 if (!validators_->texture_bind_target.IsValid(target)) { | 1765 if (!validators_->texture_bind_target.IsValid(target)) { |
| 1645 SetGLErrorInvalidEnum("glTexParameterf", target, "target"); | 1766 SetGLErrorInvalidEnum("glTexParameterf", target, "target"); |
| (...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2993 case GL_POLYGON_OFFSET_FILL: | 3114 case GL_POLYGON_OFFSET_FILL: |
| 2994 state_.enable_flags.polygon_offset_fill = enabled; | 3115 state_.enable_flags.polygon_offset_fill = enabled; |
| 2995 return true; | 3116 return true; |
| 2996 case GL_SAMPLE_ALPHA_TO_COVERAGE: | 3117 case GL_SAMPLE_ALPHA_TO_COVERAGE: |
| 2997 state_.enable_flags.sample_alpha_to_coverage = enabled; | 3118 state_.enable_flags.sample_alpha_to_coverage = enabled; |
| 2998 return true; | 3119 return true; |
| 2999 case GL_SAMPLE_COVERAGE: | 3120 case GL_SAMPLE_COVERAGE: |
| 3000 state_.enable_flags.sample_coverage = enabled; | 3121 state_.enable_flags.sample_coverage = enabled; |
| 3001 return true; | 3122 return true; |
| 3002 case GL_SCISSOR_TEST: | 3123 case GL_SCISSOR_TEST: |
| 3003 state_.enable_flags.scissor_test = enabled; | 3124 if (state_.enable_flags.scissor_test != enabled) { |
| 3004 return true; | 3125 state_.enable_flags.scissor_test = enabled; |
| 3126 clear_state_dirty_ = true; |
| 3127 } |
| 3128 return false; |
| 3005 case GL_STENCIL_TEST: | 3129 case GL_STENCIL_TEST: |
| 3006 if (state_.enable_flags.stencil_test != enabled) { | 3130 if (state_.enable_flags.stencil_test != enabled) { |
| 3007 state_.enable_flags.stencil_test = enabled; | 3131 state_.enable_flags.stencil_test = enabled; |
| 3008 clear_state_dirty_ = true; | 3132 clear_state_dirty_ = true; |
| 3009 } | 3133 } |
| 3010 return false; | 3134 return false; |
| 3011 default: | 3135 default: |
| 3012 NOTREACHED(); | 3136 NOTREACHED(); |
| 3013 return false; | 3137 return false; |
| 3014 } | 3138 } |
| 3015 } | 3139 } |
| 3016 | |
| 3017 bool GLES2DecoderImpl::DoIsEnabled(GLenum cap) { | |
| 3018 switch (cap) { | |
| 3019 case GL_BLEND: | |
| 3020 return state_.enable_flags.blend; | |
| 3021 case GL_CULL_FACE: | |
| 3022 return state_.enable_flags.cull_face; | |
| 3023 case GL_DEPTH_TEST: | |
| 3024 return state_.enable_flags.depth_test; | |
| 3025 case GL_DITHER: | |
| 3026 return state_.enable_flags.dither; | |
| 3027 case GL_POLYGON_OFFSET_FILL: | |
| 3028 return state_.enable_flags.polygon_offset_fill; | |
| 3029 case GL_SAMPLE_ALPHA_TO_COVERAGE: | |
| 3030 return state_.enable_flags.sample_alpha_to_coverage; | |
| 3031 case GL_SAMPLE_COVERAGE: | |
| 3032 return state_.enable_flags.sample_coverage; | |
| 3033 case GL_SCISSOR_TEST: | |
| 3034 return state_.enable_flags.scissor_test; | |
| 3035 case GL_STENCIL_TEST: | |
| 3036 return state_.enable_flags.stencil_test; | |
| 3037 default: | |
| 3038 NOTREACHED(); | |
| 3039 return false; | |
| 3040 } | |
| 3041 } | |
| 3042 | |
| 3043 bool GLES2DecoderImpl::GetStateAsGLint( | |
| 3044 GLenum pname, GLint* params, GLsizei* num_written) { | |
| 3045 switch (pname) { | |
| 3046 case GL_VIEWPORT: | |
| 3047 *num_written = 4; | |
| 3048 if (params) { | |
| 3049 params[0] = static_cast<GLint>(state_.viewport_x); | |
| 3050 params[1] = static_cast<GLint>(state_.viewport_y); | |
| 3051 params[2] = static_cast<GLint>(state_.viewport_width); | |
| 3052 params[3] = static_cast<GLint>(state_.viewport_height); | |
| 3053 } | |
| 3054 return true; | |
| 3055 case GL_BLEND_SRC_RGB: | |
| 3056 *num_written = 1; | |
| 3057 if (params) { | |
| 3058 params[0] = static_cast<GLint>(state_.blend_source_rgb); | |
| 3059 } | |
| 3060 return true; | |
| 3061 case GL_BLEND_DST_RGB: | |
| 3062 *num_written = 1; | |
| 3063 if (params) { | |
| 3064 params[0] = static_cast<GLint>(state_.blend_dest_rgb); | |
| 3065 } | |
| 3066 return true; | |
| 3067 case GL_BLEND_SRC_ALPHA: | |
| 3068 *num_written = 1; | |
| 3069 if (params) { | |
| 3070 params[0] = static_cast<GLint>(state_.blend_source_alpha); | |
| 3071 } | |
| 3072 return true; | |
| 3073 case GL_BLEND_DST_ALPHA: | |
| 3074 *num_written = 1; | |
| 3075 if (params) { | |
| 3076 params[0] = static_cast<GLint>(state_.blend_dest_alpha); | |
| 3077 } | |
| 3078 return true; | |
| 3079 case GL_LINE_WIDTH: | |
| 3080 *num_written = 1; | |
| 3081 if (params) { | |
| 3082 params[0] = static_cast<GLint>(state_.line_width); | |
| 3083 } | |
| 3084 return true; | |
| 3085 case GL_BLEND_COLOR: | |
| 3086 *num_written = 4; | |
| 3087 if (params) { | |
| 3088 params[0] = static_cast<GLint>(state_.blend_color_red); | |
| 3089 params[1] = static_cast<GLint>(state_.blend_color_green); | |
| 3090 params[2] = static_cast<GLint>(state_.blend_color_blue); | |
| 3091 params[3] = static_cast<GLint>(state_.blend_color_alpha); | |
| 3092 } | |
| 3093 return true; | |
| 3094 case GL_STENCIL_CLEAR_VALUE: | |
| 3095 *num_written = 1; | |
| 3096 if (params) { | |
| 3097 params[0] = static_cast<GLint>(state_.stencil_clear); | |
| 3098 } | |
| 3099 return true; | |
| 3100 case GL_COLOR_WRITEMASK: | |
| 3101 *num_written = 4; | |
| 3102 if (params) { | |
| 3103 params[0] = static_cast<GLint>(state_.color_mask_red); | |
| 3104 params[1] = static_cast<GLint>(state_.color_mask_green); | |
| 3105 params[2] = static_cast<GLint>(state_.color_mask_blue); | |
| 3106 params[3] = static_cast<GLint>(state_.color_mask_alpha); | |
| 3107 } | |
| 3108 return true; | |
| 3109 case GL_COLOR_CLEAR_VALUE: | |
| 3110 *num_written = 4; | |
| 3111 if (params) { | |
| 3112 params[0] = static_cast<GLint>(state_.color_clear_red); | |
| 3113 params[1] = static_cast<GLint>(state_.color_clear_green); | |
| 3114 params[2] = static_cast<GLint>(state_.color_clear_blue); | |
| 3115 params[3] = static_cast<GLint>(state_.color_clear_alpha); | |
| 3116 } | |
| 3117 return true; | |
| 3118 case GL_DEPTH_RANGE: | |
| 3119 *num_written = 2; | |
| 3120 if (params) { | |
| 3121 params[0] = static_cast<GLint>(state_.z_near); | |
| 3122 params[1] = static_cast<GLint>(state_.z_far); | |
| 3123 } | |
| 3124 return true; | |
| 3125 case GL_DEPTH_CLEAR_VALUE: | |
| 3126 *num_written = 1; | |
| 3127 if (params) { | |
| 3128 params[0] = static_cast<GLint>(state_.depth_clear); | |
| 3129 } | |
| 3130 return true; | |
| 3131 case GL_STENCIL_FAIL: | |
| 3132 *num_written = 1; | |
| 3133 if (params) { | |
| 3134 params[0] = static_cast<GLint>(state_.stencil_front_fail_op); | |
| 3135 } | |
| 3136 return true; | |
| 3137 case GL_STENCIL_PASS_DEPTH_FAIL: | |
| 3138 *num_written = 1; | |
| 3139 if (params) { | |
| 3140 params[0] = static_cast<GLint>(state_.stencil_front_z_fail_op); | |
| 3141 } | |
| 3142 return true; | |
| 3143 case GL_STENCIL_PASS_DEPTH_PASS: | |
| 3144 *num_written = 1; | |
| 3145 if (params) { | |
| 3146 params[0] = static_cast<GLint>(state_.stencil_front_z_pass_op); | |
| 3147 } | |
| 3148 return true; | |
| 3149 case GL_STENCIL_BACK_FAIL: | |
| 3150 *num_written = 1; | |
| 3151 if (params) { | |
| 3152 params[0] = static_cast<GLint>(state_.stencil_back_fail_op); | |
| 3153 } | |
| 3154 return true; | |
| 3155 case GL_STENCIL_BACK_PASS_DEPTH_FAIL: | |
| 3156 *num_written = 1; | |
| 3157 if (params) { | |
| 3158 params[0] = static_cast<GLint>(state_.stencil_back_z_fail_op); | |
| 3159 } | |
| 3160 return true; | |
| 3161 case GL_STENCIL_BACK_PASS_DEPTH_PASS: | |
| 3162 *num_written = 1; | |
| 3163 if (params) { | |
| 3164 params[0] = static_cast<GLint>(state_.stencil_back_z_pass_op); | |
| 3165 } | |
| 3166 return true; | |
| 3167 case GL_SCISSOR_BOX: | |
| 3168 *num_written = 4; | |
| 3169 if (params) { | |
| 3170 params[0] = static_cast<GLint>(state_.scissor_x); | |
| 3171 params[1] = static_cast<GLint>(state_.scissor_y); | |
| 3172 params[2] = static_cast<GLint>(state_.scissor_width); | |
| 3173 params[3] = static_cast<GLint>(state_.scissor_height); | |
| 3174 } | |
| 3175 return true; | |
| 3176 case GL_FRONT_FACE: | |
| 3177 *num_written = 1; | |
| 3178 if (params) { | |
| 3179 params[0] = static_cast<GLint>(state_.front_face); | |
| 3180 } | |
| 3181 return true; | |
| 3182 case GL_SAMPLE_COVERAGE_VALUE: | |
| 3183 *num_written = 1; | |
| 3184 if (params) { | |
| 3185 params[0] = static_cast<GLint>(state_.sample_coverage_value); | |
| 3186 } | |
| 3187 return true; | |
| 3188 case GL_SAMPLE_COVERAGE_INVERT: | |
| 3189 *num_written = 1; | |
| 3190 if (params) { | |
| 3191 params[0] = static_cast<GLint>(state_.sample_coverage_invert); | |
| 3192 } | |
| 3193 return true; | |
| 3194 case GL_POLYGON_OFFSET_FACTOR: | |
| 3195 *num_written = 1; | |
| 3196 if (params) { | |
| 3197 params[0] = static_cast<GLint>(state_.polygon_offset_factor); | |
| 3198 } | |
| 3199 return true; | |
| 3200 case GL_POLYGON_OFFSET_UNITS: | |
| 3201 *num_written = 1; | |
| 3202 if (params) { | |
| 3203 params[0] = static_cast<GLint>(state_.polygon_offset_units); | |
| 3204 } | |
| 3205 return true; | |
| 3206 case GL_CULL_FACE_MODE: | |
| 3207 *num_written = 1; | |
| 3208 if (params) { | |
| 3209 params[0] = static_cast<GLint>(state_.cull_mode); | |
| 3210 } | |
| 3211 return true; | |
| 3212 case GL_DEPTH_FUNC: | |
| 3213 *num_written = 1; | |
| 3214 if (params) { | |
| 3215 params[0] = static_cast<GLint>(state_.depth_func); | |
| 3216 } | |
| 3217 return true; | |
| 3218 case GL_STENCIL_FUNC: | |
| 3219 *num_written = 1; | |
| 3220 if (params) { | |
| 3221 params[0] = static_cast<GLint>(state_.stencil_front_func); | |
| 3222 } | |
| 3223 return true; | |
| 3224 case GL_STENCIL_REF: | |
| 3225 *num_written = 1; | |
| 3226 if (params) { | |
| 3227 params[0] = static_cast<GLint>(state_.stencil_front_ref); | |
| 3228 } | |
| 3229 return true; | |
| 3230 case GL_STENCIL_VALUE_MASK: | |
| 3231 *num_written = 1; | |
| 3232 if (params) { | |
| 3233 params[0] = static_cast<GLint>(state_.stencil_front_mask); | |
| 3234 } | |
| 3235 return true; | |
| 3236 case GL_STENCIL_BACK_FUNC: | |
| 3237 *num_written = 1; | |
| 3238 if (params) { | |
| 3239 params[0] = static_cast<GLint>(state_.stencil_back_func); | |
| 3240 } | |
| 3241 return true; | |
| 3242 case GL_STENCIL_BACK_REF: | |
| 3243 *num_written = 1; | |
| 3244 if (params) { | |
| 3245 params[0] = static_cast<GLint>(state_.stencil_back_ref); | |
| 3246 } | |
| 3247 return true; | |
| 3248 case GL_STENCIL_BACK_VALUE_MASK: | |
| 3249 *num_written = 1; | |
| 3250 if (params) { | |
| 3251 params[0] = static_cast<GLint>(state_.stencil_back_mask); | |
| 3252 } | |
| 3253 return true; | |
| 3254 case GL_DEPTH_WRITEMASK: | |
| 3255 *num_written = 1; | |
| 3256 if (params) { | |
| 3257 params[0] = static_cast<GLint>(state_.depth_mask); | |
| 3258 } | |
| 3259 return true; | |
| 3260 case GL_BLEND_EQUATION_RGB: | |
| 3261 *num_written = 1; | |
| 3262 if (params) { | |
| 3263 params[0] = static_cast<GLint>(state_.blend_equation_rgb); | |
| 3264 } | |
| 3265 return true; | |
| 3266 case GL_BLEND_EQUATION_ALPHA: | |
| 3267 *num_written = 1; | |
| 3268 if (params) { | |
| 3269 params[0] = static_cast<GLint>(state_.blend_equation_alpha); | |
| 3270 } | |
| 3271 return true; | |
| 3272 case GL_STENCIL_WRITEMASK: | |
| 3273 *num_written = 1; | |
| 3274 if (params) { | |
| 3275 params[0] = static_cast<GLint>(state_.stencil_front_writemask); | |
| 3276 } | |
| 3277 return true; | |
| 3278 case GL_STENCIL_BACK_WRITEMASK: | |
| 3279 *num_written = 1; | |
| 3280 if (params) { | |
| 3281 params[0] = static_cast<GLint>(state_.stencil_back_writemask); | |
| 3282 } | |
| 3283 return true; | |
| 3284 case GL_BLEND: | |
| 3285 *num_written = 1; | |
| 3286 if (params) { | |
| 3287 params[0] = static_cast<GLint>(state_.enable_flags.blend); | |
| 3288 } | |
| 3289 return true; | |
| 3290 case GL_CULL_FACE: | |
| 3291 *num_written = 1; | |
| 3292 if (params) { | |
| 3293 params[0] = static_cast<GLint>(state_.enable_flags.cull_face); | |
| 3294 } | |
| 3295 return true; | |
| 3296 case GL_DEPTH_TEST: | |
| 3297 *num_written = 1; | |
| 3298 if (params) { | |
| 3299 params[0] = static_cast<GLint>(state_.enable_flags.depth_test); | |
| 3300 } | |
| 3301 return true; | |
| 3302 case GL_DITHER: | |
| 3303 *num_written = 1; | |
| 3304 if (params) { | |
| 3305 params[0] = static_cast<GLint>(state_.enable_flags.dither); | |
| 3306 } | |
| 3307 return true; | |
| 3308 case GL_POLYGON_OFFSET_FILL: | |
| 3309 *num_written = 1; | |
| 3310 if (params) { | |
| 3311 params[0] = | |
| 3312 static_cast<GLint>(state_.enable_flags.polygon_offset_fill); | |
| 3313 } | |
| 3314 return true; | |
| 3315 case GL_SAMPLE_ALPHA_TO_COVERAGE: | |
| 3316 *num_written = 1; | |
| 3317 if (params) { | |
| 3318 params[0] = | |
| 3319 static_cast<GLint>(state_.enable_flags.sample_alpha_to_coverage); | |
| 3320 } | |
| 3321 return true; | |
| 3322 case GL_SAMPLE_COVERAGE: | |
| 3323 *num_written = 1; | |
| 3324 if (params) { | |
| 3325 params[0] = static_cast<GLint>(state_.enable_flags.sample_coverage); | |
| 3326 } | |
| 3327 return true; | |
| 3328 case GL_SCISSOR_TEST: | |
| 3329 *num_written = 1; | |
| 3330 if (params) { | |
| 3331 params[0] = static_cast<GLint>(state_.enable_flags.scissor_test); | |
| 3332 } | |
| 3333 return true; | |
| 3334 case GL_STENCIL_TEST: | |
| 3335 *num_written = 1; | |
| 3336 if (params) { | |
| 3337 params[0] = static_cast<GLint>(state_.enable_flags.stencil_test); | |
| 3338 } | |
| 3339 return true; | |
| 3340 default: | |
| 3341 return false; | |
| 3342 } | |
| 3343 } | |
| 3344 | |
| 3345 bool GLES2DecoderImpl::GetStateAsGLfloat( | |
| 3346 GLenum pname, GLfloat* params, GLsizei* num_written) { | |
| 3347 switch (pname) { | |
| 3348 case GL_VIEWPORT: | |
| 3349 *num_written = 4; | |
| 3350 if (params) { | |
| 3351 params[0] = static_cast<GLfloat>(state_.viewport_x); | |
| 3352 params[1] = static_cast<GLfloat>(state_.viewport_y); | |
| 3353 params[2] = static_cast<GLfloat>(state_.viewport_width); | |
| 3354 params[3] = static_cast<GLfloat>(state_.viewport_height); | |
| 3355 } | |
| 3356 return true; | |
| 3357 case GL_BLEND_SRC_RGB: | |
| 3358 *num_written = 1; | |
| 3359 if (params) { | |
| 3360 params[0] = static_cast<GLfloat>(state_.blend_source_rgb); | |
| 3361 } | |
| 3362 return true; | |
| 3363 case GL_BLEND_DST_RGB: | |
| 3364 *num_written = 1; | |
| 3365 if (params) { | |
| 3366 params[0] = static_cast<GLfloat>(state_.blend_dest_rgb); | |
| 3367 } | |
| 3368 return true; | |
| 3369 case GL_BLEND_SRC_ALPHA: | |
| 3370 *num_written = 1; | |
| 3371 if (params) { | |
| 3372 params[0] = static_cast<GLfloat>(state_.blend_source_alpha); | |
| 3373 } | |
| 3374 return true; | |
| 3375 case GL_BLEND_DST_ALPHA: | |
| 3376 *num_written = 1; | |
| 3377 if (params) { | |
| 3378 params[0] = static_cast<GLfloat>(state_.blend_dest_alpha); | |
| 3379 } | |
| 3380 return true; | |
| 3381 case GL_LINE_WIDTH: | |
| 3382 *num_written = 1; | |
| 3383 if (params) { | |
| 3384 params[0] = static_cast<GLfloat>(state_.line_width); | |
| 3385 } | |
| 3386 return true; | |
| 3387 case GL_BLEND_COLOR: | |
| 3388 *num_written = 4; | |
| 3389 if (params) { | |
| 3390 params[0] = static_cast<GLfloat>(state_.blend_color_red); | |
| 3391 params[1] = static_cast<GLfloat>(state_.blend_color_green); | |
| 3392 params[2] = static_cast<GLfloat>(state_.blend_color_blue); | |
| 3393 params[3] = static_cast<GLfloat>(state_.blend_color_alpha); | |
| 3394 } | |
| 3395 return true; | |
| 3396 case GL_STENCIL_CLEAR_VALUE: | |
| 3397 *num_written = 1; | |
| 3398 if (params) { | |
| 3399 params[0] = static_cast<GLfloat>(state_.stencil_clear); | |
| 3400 } | |
| 3401 return true; | |
| 3402 case GL_COLOR_WRITEMASK: | |
| 3403 *num_written = 4; | |
| 3404 if (params) { | |
| 3405 params[0] = static_cast<GLfloat>(state_.color_mask_red); | |
| 3406 params[1] = static_cast<GLfloat>(state_.color_mask_green); | |
| 3407 params[2] = static_cast<GLfloat>(state_.color_mask_blue); | |
| 3408 params[3] = static_cast<GLfloat>(state_.color_mask_alpha); | |
| 3409 } | |
| 3410 return true; | |
| 3411 case GL_COLOR_CLEAR_VALUE: | |
| 3412 *num_written = 4; | |
| 3413 if (params) { | |
| 3414 params[0] = static_cast<GLfloat>(state_.color_clear_red); | |
| 3415 params[1] = static_cast<GLfloat>(state_.color_clear_green); | |
| 3416 params[2] = static_cast<GLfloat>(state_.color_clear_blue); | |
| 3417 params[3] = static_cast<GLfloat>(state_.color_clear_alpha); | |
| 3418 } | |
| 3419 return true; | |
| 3420 case GL_DEPTH_RANGE: | |
| 3421 *num_written = 2; | |
| 3422 if (params) { | |
| 3423 params[0] = static_cast<GLfloat>(state_.z_near); | |
| 3424 params[1] = static_cast<GLfloat>(state_.z_far); | |
| 3425 } | |
| 3426 return true; | |
| 3427 case GL_DEPTH_CLEAR_VALUE: | |
| 3428 *num_written = 1; | |
| 3429 if (params) { | |
| 3430 params[0] = static_cast<GLfloat>(state_.depth_clear); | |
| 3431 } | |
| 3432 return true; | |
| 3433 case GL_STENCIL_FAIL: | |
| 3434 *num_written = 1; | |
| 3435 if (params) { | |
| 3436 params[0] = static_cast<GLfloat>(state_.stencil_front_fail_op); | |
| 3437 } | |
| 3438 return true; | |
| 3439 case GL_STENCIL_PASS_DEPTH_FAIL: | |
| 3440 *num_written = 1; | |
| 3441 if (params) { | |
| 3442 params[0] = static_cast<GLfloat>(state_.stencil_front_z_fail_op); | |
| 3443 } | |
| 3444 return true; | |
| 3445 case GL_STENCIL_PASS_DEPTH_PASS: | |
| 3446 *num_written = 1; | |
| 3447 if (params) { | |
| 3448 params[0] = static_cast<GLfloat>(state_.stencil_front_z_pass_op); | |
| 3449 } | |
| 3450 return true; | |
| 3451 case GL_STENCIL_BACK_FAIL: | |
| 3452 *num_written = 1; | |
| 3453 if (params) { | |
| 3454 params[0] = static_cast<GLfloat>(state_.stencil_back_fail_op); | |
| 3455 } | |
| 3456 return true; | |
| 3457 case GL_STENCIL_BACK_PASS_DEPTH_FAIL: | |
| 3458 *num_written = 1; | |
| 3459 if (params) { | |
| 3460 params[0] = static_cast<GLfloat>(state_.stencil_back_z_fail_op); | |
| 3461 } | |
| 3462 return true; | |
| 3463 case GL_STENCIL_BACK_PASS_DEPTH_PASS: | |
| 3464 *num_written = 1; | |
| 3465 if (params) { | |
| 3466 params[0] = static_cast<GLfloat>(state_.stencil_back_z_pass_op); | |
| 3467 } | |
| 3468 return true; | |
| 3469 case GL_SCISSOR_BOX: | |
| 3470 *num_written = 4; | |
| 3471 if (params) { | |
| 3472 params[0] = static_cast<GLfloat>(state_.scissor_x); | |
| 3473 params[1] = static_cast<GLfloat>(state_.scissor_y); | |
| 3474 params[2] = static_cast<GLfloat>(state_.scissor_width); | |
| 3475 params[3] = static_cast<GLfloat>(state_.scissor_height); | |
| 3476 } | |
| 3477 return true; | |
| 3478 case GL_FRONT_FACE: | |
| 3479 *num_written = 1; | |
| 3480 if (params) { | |
| 3481 params[0] = static_cast<GLfloat>(state_.front_face); | |
| 3482 } | |
| 3483 return true; | |
| 3484 case GL_SAMPLE_COVERAGE_VALUE: | |
| 3485 *num_written = 1; | |
| 3486 if (params) { | |
| 3487 params[0] = static_cast<GLfloat>(state_.sample_coverage_value); | |
| 3488 } | |
| 3489 return true; | |
| 3490 case GL_SAMPLE_COVERAGE_INVERT: | |
| 3491 *num_written = 1; | |
| 3492 if (params) { | |
| 3493 params[0] = static_cast<GLfloat>(state_.sample_coverage_invert); | |
| 3494 } | |
| 3495 return true; | |
| 3496 case GL_POLYGON_OFFSET_FACTOR: | |
| 3497 *num_written = 1; | |
| 3498 if (params) { | |
| 3499 params[0] = static_cast<GLfloat>(state_.polygon_offset_factor); | |
| 3500 } | |
| 3501 return true; | |
| 3502 case GL_POLYGON_OFFSET_UNITS: | |
| 3503 *num_written = 1; | |
| 3504 if (params) { | |
| 3505 params[0] = static_cast<GLfloat>(state_.polygon_offset_units); | |
| 3506 } | |
| 3507 return true; | |
| 3508 case GL_CULL_FACE_MODE: | |
| 3509 *num_written = 1; | |
| 3510 if (params) { | |
| 3511 params[0] = static_cast<GLfloat>(state_.cull_mode); | |
| 3512 } | |
| 3513 return true; | |
| 3514 case GL_DEPTH_FUNC: | |
| 3515 *num_written = 1; | |
| 3516 if (params) { | |
| 3517 params[0] = static_cast<GLfloat>(state_.depth_func); | |
| 3518 } | |
| 3519 return true; | |
| 3520 case GL_STENCIL_FUNC: | |
| 3521 *num_written = 1; | |
| 3522 if (params) { | |
| 3523 params[0] = static_cast<GLfloat>(state_.stencil_front_func); | |
| 3524 } | |
| 3525 return true; | |
| 3526 case GL_STENCIL_REF: | |
| 3527 *num_written = 1; | |
| 3528 if (params) { | |
| 3529 params[0] = static_cast<GLfloat>(state_.stencil_front_ref); | |
| 3530 } | |
| 3531 return true; | |
| 3532 case GL_STENCIL_VALUE_MASK: | |
| 3533 *num_written = 1; | |
| 3534 if (params) { | |
| 3535 params[0] = static_cast<GLfloat>(state_.stencil_front_mask); | |
| 3536 } | |
| 3537 return true; | |
| 3538 case GL_STENCIL_BACK_FUNC: | |
| 3539 *num_written = 1; | |
| 3540 if (params) { | |
| 3541 params[0] = static_cast<GLfloat>(state_.stencil_back_func); | |
| 3542 } | |
| 3543 return true; | |
| 3544 case GL_STENCIL_BACK_REF: | |
| 3545 *num_written = 1; | |
| 3546 if (params) { | |
| 3547 params[0] = static_cast<GLfloat>(state_.stencil_back_ref); | |
| 3548 } | |
| 3549 return true; | |
| 3550 case GL_STENCIL_BACK_VALUE_MASK: | |
| 3551 *num_written = 1; | |
| 3552 if (params) { | |
| 3553 params[0] = static_cast<GLfloat>(state_.stencil_back_mask); | |
| 3554 } | |
| 3555 return true; | |
| 3556 case GL_DEPTH_WRITEMASK: | |
| 3557 *num_written = 1; | |
| 3558 if (params) { | |
| 3559 params[0] = static_cast<GLfloat>(state_.depth_mask); | |
| 3560 } | |
| 3561 return true; | |
| 3562 case GL_BLEND_EQUATION_RGB: | |
| 3563 *num_written = 1; | |
| 3564 if (params) { | |
| 3565 params[0] = static_cast<GLfloat>(state_.blend_equation_rgb); | |
| 3566 } | |
| 3567 return true; | |
| 3568 case GL_BLEND_EQUATION_ALPHA: | |
| 3569 *num_written = 1; | |
| 3570 if (params) { | |
| 3571 params[0] = static_cast<GLfloat>(state_.blend_equation_alpha); | |
| 3572 } | |
| 3573 return true; | |
| 3574 case GL_STENCIL_WRITEMASK: | |
| 3575 *num_written = 1; | |
| 3576 if (params) { | |
| 3577 params[0] = static_cast<GLfloat>(state_.stencil_front_writemask); | |
| 3578 } | |
| 3579 return true; | |
| 3580 case GL_STENCIL_BACK_WRITEMASK: | |
| 3581 *num_written = 1; | |
| 3582 if (params) { | |
| 3583 params[0] = static_cast<GLfloat>(state_.stencil_back_writemask); | |
| 3584 } | |
| 3585 return true; | |
| 3586 case GL_BLEND: | |
| 3587 *num_written = 1; | |
| 3588 if (params) { | |
| 3589 params[0] = static_cast<GLfloat>(state_.enable_flags.blend); | |
| 3590 } | |
| 3591 return true; | |
| 3592 case GL_CULL_FACE: | |
| 3593 *num_written = 1; | |
| 3594 if (params) { | |
| 3595 params[0] = static_cast<GLfloat>(state_.enable_flags.cull_face); | |
| 3596 } | |
| 3597 return true; | |
| 3598 case GL_DEPTH_TEST: | |
| 3599 *num_written = 1; | |
| 3600 if (params) { | |
| 3601 params[0] = static_cast<GLfloat>(state_.enable_flags.depth_test); | |
| 3602 } | |
| 3603 return true; | |
| 3604 case GL_DITHER: | |
| 3605 *num_written = 1; | |
| 3606 if (params) { | |
| 3607 params[0] = static_cast<GLfloat>(state_.enable_flags.dither); | |
| 3608 } | |
| 3609 return true; | |
| 3610 case GL_POLYGON_OFFSET_FILL: | |
| 3611 *num_written = 1; | |
| 3612 if (params) { | |
| 3613 params[0] = | |
| 3614 static_cast<GLfloat>(state_.enable_flags.polygon_offset_fill); | |
| 3615 } | |
| 3616 return true; | |
| 3617 case GL_SAMPLE_ALPHA_TO_COVERAGE: | |
| 3618 *num_written = 1; | |
| 3619 if (params) { | |
| 3620 params[0] = | |
| 3621 static_cast<GLfloat>(state_.enable_flags.sample_alpha_to_coverage); | |
| 3622 } | |
| 3623 return true; | |
| 3624 case GL_SAMPLE_COVERAGE: | |
| 3625 *num_written = 1; | |
| 3626 if (params) { | |
| 3627 params[0] = static_cast<GLfloat>(state_.enable_flags.sample_coverage); | |
| 3628 } | |
| 3629 return true; | |
| 3630 case GL_SCISSOR_TEST: | |
| 3631 *num_written = 1; | |
| 3632 if (params) { | |
| 3633 params[0] = static_cast<GLfloat>(state_.enable_flags.scissor_test); | |
| 3634 } | |
| 3635 return true; | |
| 3636 case GL_STENCIL_TEST: | |
| 3637 *num_written = 1; | |
| 3638 if (params) { | |
| 3639 params[0] = static_cast<GLfloat>(state_.enable_flags.stencil_test); | |
| 3640 } | |
| 3641 return true; | |
| 3642 default: | |
| 3643 return false; | |
| 3644 } | |
| 3645 } | |
| 3646 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ | 3140 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_AUTOGEN_H_ |
| 3647 | 3141 |
| OLD | NEW |