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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
(...skipping 8806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8817 AddExpectationsForActiveTexture(GL_TEXTURE1); | 8817 AddExpectationsForActiveTexture(GL_TEXTURE1); |
8818 AddExpectationsForBindTexture(GL_TEXTURE_2D, | 8818 AddExpectationsForBindTexture(GL_TEXTURE_2D, |
8819 TestHelper::kServiceDefaultTexture2dId); | 8819 TestHelper::kServiceDefaultTexture2dId); |
8820 | 8820 |
8821 // Expect to restore active texture unit to GL_TEXTURE0. | 8821 // Expect to restore active texture unit to GL_TEXTURE0. |
8822 AddExpectationsForActiveTexture(GL_TEXTURE0); | 8822 AddExpectationsForActiveTexture(GL_TEXTURE0); |
8823 | 8823 |
8824 GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); | 8824 GetDecoder()->RestoreAllTextureUnitBindings(&prev_state); |
8825 } | 8825 } |
8826 | 8826 |
| 8827 TEST_F(GLES2DecoderManualInitTest, ClearUniformsBeforeFirstProgramUse) { |
| 8828 CommandLine command_line(0, NULL); |
| 8829 command_line.AppendSwitchASCII( |
| 8830 switches::kGpuDriverBugWorkarounds, |
| 8831 base::IntToString(gpu::CLEAR_UNIFORMS_BEFORE_FIRST_PROGRAM_USE)); |
| 8832 InitDecoderWithCommandLine( |
| 8833 "", // extensions |
| 8834 "3.0", // gl version |
| 8835 true, // has alpha |
| 8836 false, // has depth |
| 8837 false, // has stencil |
| 8838 true, // request alpha |
| 8839 false, // request depth |
| 8840 false, // request stencil |
| 8841 true, // bind generates resource |
| 8842 &command_line); |
| 8843 { |
| 8844 static AttribInfo attribs[] = { |
| 8845 { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, |
| 8846 { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, |
| 8847 { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, |
| 8848 }; |
| 8849 static UniformInfo uniforms[] = { |
| 8850 { kUniform1Name, kUniform1Size, kUniform1Type, |
| 8851 kUniform1FakeLocation, kUniform1RealLocation, |
| 8852 kUniform1DesiredLocation }, |
| 8853 { kUniform2Name, kUniform2Size, kUniform2Type, |
| 8854 kUniform2FakeLocation, kUniform2RealLocation, |
| 8855 kUniform2DesiredLocation }, |
| 8856 { kUniform3Name, kUniform3Size, kUniform3Type, |
| 8857 kUniform3FakeLocation, kUniform3RealLocation, |
| 8858 kUniform3DesiredLocation }, |
| 8859 }; |
| 8860 SetupShader(attribs, arraysize(attribs), uniforms, arraysize(uniforms), |
| 8861 client_program_id_, kServiceProgramId, |
| 8862 client_vertex_shader_id_, kServiceVertexShaderId, |
| 8863 client_fragment_shader_id_, kServiceFragmentShaderId); |
| 8864 TestHelper::SetupExpectationsForClearingUniforms( |
| 8865 gl_.get(), uniforms, arraysize(uniforms)); |
| 8866 } |
| 8867 |
| 8868 { |
| 8869 EXPECT_CALL(*gl_, UseProgram(kServiceProgramId)) |
| 8870 .Times(1) |
| 8871 .RetiresOnSaturation(); |
| 8872 cmds::UseProgram cmd; |
| 8873 cmd.Init(client_program_id_); |
| 8874 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 8875 } |
| 8876 } |
| 8877 |
8827 // TODO(gman): Complete this test. | 8878 // TODO(gman): Complete this test. |
8828 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { | 8879 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { |
8829 // } | 8880 // } |
8830 | 8881 |
8831 // TODO(gman): BufferData | 8882 // TODO(gman): BufferData |
8832 | 8883 |
8833 // TODO(gman): BufferDataImmediate | 8884 // TODO(gman): BufferDataImmediate |
8834 | 8885 |
8835 // TODO(gman): BufferSubData | 8886 // TODO(gman): BufferSubData |
8836 | 8887 |
(...skipping 16 matching lines...) Expand all Loading... |
8853 // TODO(gman): TexImage2DImmediate | 8904 // TODO(gman): TexImage2DImmediate |
8854 | 8905 |
8855 // TODO(gman): TexSubImage2DImmediate | 8906 // TODO(gman): TexSubImage2DImmediate |
8856 | 8907 |
8857 // TODO(gman): UseProgram | 8908 // TODO(gman): UseProgram |
8858 | 8909 |
8859 // TODO(gman): SwapBuffers | 8910 // TODO(gman): SwapBuffers |
8860 | 8911 |
8861 } // namespace gles2 | 8912 } // namespace gles2 |
8862 } // namespace gpu | 8913 } // namespace gpu |
OLD | NEW |