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

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

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 <list> 10 #include <list>
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 1466
1467 // Verifies that the currently bound multisample renderbuffer is valid 1467 // Verifies that the currently bound multisample renderbuffer is valid
1468 // Very slow! Only done on platforms with driver bugs that return invalid 1468 // Very slow! Only done on platforms with driver bugs that return invalid
1469 // buffers under memory pressure 1469 // buffers under memory pressure
1470 bool VerifyMultisampleRenderbufferIntegrity( 1470 bool VerifyMultisampleRenderbufferIntegrity(
1471 GLuint renderbuffer, GLenum format); 1471 GLuint renderbuffer, GLenum format);
1472 1472
1473 // Wrapper for glReleaseShaderCompiler. 1473 // Wrapper for glReleaseShaderCompiler.
1474 void DoReleaseShaderCompiler() { } 1474 void DoReleaseShaderCompiler() { }
1475 1475
1476 // Wrappers for glSamplerParameter*v functions.
1477 void DoSamplerParameterfv(
1478 GLuint sampler, GLenum pname, const GLfloat* params);
1479 void DoSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* params);
1480
1476 // Wrappers for glTexParameter functions. 1481 // Wrappers for glTexParameter functions.
1477 void DoTexParameterf(GLenum target, GLenum pname, GLfloat param); 1482 void DoTexParameterf(GLenum target, GLenum pname, GLfloat param);
1478 void DoTexParameteri(GLenum target, GLenum pname, GLint param); 1483 void DoTexParameteri(GLenum target, GLenum pname, GLint param);
1479 void DoTexParameterfv(GLenum target, GLenum pname, const GLfloat* params); 1484 void DoTexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
1480 void DoTexParameteriv(GLenum target, GLenum pname, const GLint* params); 1485 void DoTexParameteriv(GLenum target, GLenum pname, const GLint* params);
1481 1486
1482 // Wrappers for glUniform1i and glUniform1iv as according to the GLES2 1487 // Wrappers for glUniform1i and glUniform1iv as according to the GLES2
1483 // spec only these 2 functions can be used to set sampler uniforms. 1488 // spec only these 2 functions can be used to set sampler uniforms.
1484 void DoUniform1i(GLint fake_location, GLint v0); 1489 void DoUniform1i(GLint fake_location, GLint v0);
1485 void DoUniform1iv(GLint fake_location, GLsizei count, const GLint* value); 1490 void DoUniform1iv(GLint fake_location, GLsizei count, const GLint* value);
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after
2948 driver_bug_workarounds |= SH_UNFOLD_SHORT_CIRCUIT; 2953 driver_bug_workarounds |= SH_UNFOLD_SHORT_CIRCUIT;
2949 if (workarounds().init_varyings_without_static_use) 2954 if (workarounds().init_varyings_without_static_use)
2950 driver_bug_workarounds |= SH_INIT_VARYINGS_WITHOUT_STATIC_USE; 2955 driver_bug_workarounds |= SH_INIT_VARYINGS_WITHOUT_STATIC_USE;
2951 if (workarounds().unroll_for_loop_with_sampler_array_index) 2956 if (workarounds().unroll_for_loop_with_sampler_array_index)
2952 driver_bug_workarounds |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX; 2957 driver_bug_workarounds |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX;
2953 if (workarounds().scalarize_vec_and_mat_constructor_args) 2958 if (workarounds().scalarize_vec_and_mat_constructor_args)
2954 driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS; 2959 driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS;
2955 if (workarounds().regenerate_struct_names) 2960 if (workarounds().regenerate_struct_names)
2956 driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES; 2961 driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES;
2957 2962
2963 if (CommandLine::ForCurrentProcess()->HasSwitch(
2964 switches::kEmulateShaderPrecision))
2965 resources.WEBGL_debug_shader_precision = true;
2966
2958 vertex_translator_ = shader_translator_cache()->GetTranslator( 2967 vertex_translator_ = shader_translator_cache()->GetTranslator(
2959 GL_VERTEX_SHADER, 2968 GL_VERTEX_SHADER,
2960 shader_spec, 2969 shader_spec,
2961 &resources, 2970 &resources,
2962 implementation_type, 2971 implementation_type,
2963 static_cast<ShCompileOptions>(driver_bug_workarounds)); 2972 static_cast<ShCompileOptions>(driver_bug_workarounds));
2964 if (!vertex_translator_.get()) { 2973 if (!vertex_translator_.get()) {
2965 LOG(ERROR) << "Could not initialize vertex shader translator."; 2974 LOG(ERROR) << "Could not initialize vertex shader translator.";
2966 Destroy(true); 2975 Destroy(true);
2967 return false; 2976 return false;
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
4262 state_.RestoreVertexAttribs(); 4271 state_.RestoreVertexAttribs();
4263 } 4272 }
4264 4273
4265 void GLES2DecoderImpl::SetIgnoreCachedStateForTest(bool ignore) { 4274 void GLES2DecoderImpl::SetIgnoreCachedStateForTest(bool ignore) {
4266 state_.SetIgnoreCachedStateForTest(ignore); 4275 state_.SetIgnoreCachedStateForTest(ignore);
4267 } 4276 }
4268 4277
4269 void GLES2DecoderImpl::OnFboChanged() const { 4278 void GLES2DecoderImpl::OnFboChanged() const {
4270 if (workarounds().restore_scissor_on_fbo_change) 4279 if (workarounds().restore_scissor_on_fbo_change)
4271 state_.fbo_binding_for_scissor_workaround_dirty_ = true; 4280 state_.fbo_binding_for_scissor_workaround_dirty_ = true;
4281
4282 if (workarounds().gl_begin_gl_end_on_fbo_change_to_backbuffer) {
4283 GLint bound_fbo_unsigned = -1;
4284 glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &bound_fbo_unsigned);
4285 GLuint bound_fbo = static_cast<GLuint>(bound_fbo_unsigned);
4286 if (surface_ && surface_->GetBackingFrameBufferObject() == bound_fbo)
4287 surface_->NotifyWasBound();
4288 }
4272 } 4289 }
4273 4290
4274 // Called after the FBO is checked for completeness. 4291 // Called after the FBO is checked for completeness.
4275 void GLES2DecoderImpl::OnUseFramebuffer() const { 4292 void GLES2DecoderImpl::OnUseFramebuffer() const {
4276 if (state_.fbo_binding_for_scissor_workaround_dirty_) { 4293 if (state_.fbo_binding_for_scissor_workaround_dirty_) {
4277 state_.fbo_binding_for_scissor_workaround_dirty_ = false; 4294 state_.fbo_binding_for_scissor_workaround_dirty_ = false;
4278 // The driver forgets the correct scissor when modifying the FBO binding. 4295 // The driver forgets the correct scissor when modifying the FBO binding.
4279 glScissor(state_.scissor_x, 4296 glScissor(state_.scissor_x,
4280 state_.scissor_y, 4297 state_.scissor_y,
4281 state_.scissor_width, 4298 state_.scissor_width,
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after
5851 if (workarounds().clear_uniforms_before_first_program_use) 5868 if (workarounds().clear_uniforms_before_first_program_use)
5852 program_manager()->ClearUniforms(program); 5869 program_manager()->ClearUniforms(program);
5853 } 5870 }
5854 } 5871 }
5855 5872
5856 // LinkProgram can be very slow. Exit command processing to allow for 5873 // LinkProgram can be very slow. Exit command processing to allow for
5857 // context preemption and GPU watchdog checks. 5874 // context preemption and GPU watchdog checks.
5858 ExitCommandProcessingEarly(); 5875 ExitCommandProcessingEarly();
5859 }; 5876 };
5860 5877
5878 void GLES2DecoderImpl::DoSamplerParameterfv(
5879 GLuint sampler, GLenum pname, const GLfloat* params) {
5880 DCHECK(params);
5881 glSamplerParameterf(sampler, pname, params[0]);
5882 }
5883
5884 void GLES2DecoderImpl::DoSamplerParameteriv(
5885 GLuint sampler, GLenum pname, const GLint* params) {
5886 DCHECK(params);
5887 glSamplerParameteri(sampler, pname, params[0]);
5888 }
5889
5861 void GLES2DecoderImpl::DoTexParameterf( 5890 void GLES2DecoderImpl::DoTexParameterf(
5862 GLenum target, GLenum pname, GLfloat param) { 5891 GLenum target, GLenum pname, GLfloat param) {
5863 TextureRef* texture = texture_manager()->GetTextureInfoForTarget( 5892 TextureRef* texture = texture_manager()->GetTextureInfoForTarget(
5864 &state_, target); 5893 &state_, target);
5865 if (!texture) { 5894 if (!texture) {
5866 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterf", "unknown texture"); 5895 LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, "glTexParameterf", "unknown texture");
5867 return; 5896 return;
5868 } 5897 }
5869 5898
5870 texture_manager()->SetParameterf( 5899 texture_manager()->SetParameterf(
(...skipping 5661 matching lines...) Expand 10 before | Expand all | Expand 10 after
11532 } 11561 }
11533 } 11562 }
11534 11563
11535 // Include the auto-generated part of this file. We split this because it means 11564 // Include the auto-generated part of this file. We split this because it means
11536 // we can easily edit the non-auto generated parts right here in this file 11565 // we can easily edit the non-auto generated parts right here in this file
11537 // instead of having to edit some template or the code generator. 11566 // instead of having to edit some template or the code generator.
11538 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 11567 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
11539 11568
11540 } // namespace gles2 11569 } // namespace gles2
11541 } // namespace gpu 11570 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gl_context_virtual.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698