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_unittest_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 cached_depth_mask_(true), | 111 cached_depth_mask_(true), |
112 cached_stencil_front_mask_(static_cast<GLuint>(-1)), | 112 cached_stencil_front_mask_(static_cast<GLuint>(-1)), |
113 cached_stencil_back_mask_(static_cast<GLuint>(-1)) { | 113 cached_stencil_back_mask_(static_cast<GLuint>(-1)) { |
114 memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); | 114 memset(immediate_buffer_, 0xEE, sizeof(immediate_buffer_)); |
115 } | 115 } |
116 | 116 |
117 GLES2DecoderTestBase::~GLES2DecoderTestBase() {} | 117 GLES2DecoderTestBase::~GLES2DecoderTestBase() {} |
118 | 118 |
119 void GLES2DecoderTestBase::SetUp() { | 119 void GLES2DecoderTestBase::SetUp() { |
120 InitState init; | 120 InitState init; |
121 init.gl_version = "3.0"; | 121 // Autogenerated tests do not overwrite version or extension string, |
122 // so we have to pick something that supports everything here. | |
123 init.gl_version = "4.4"; | |
122 init.has_alpha = true; | 124 init.has_alpha = true; |
123 init.has_depth = true; | 125 init.has_depth = true; |
124 init.request_alpha = true; | 126 init.request_alpha = true; |
125 init.request_depth = true; | 127 init.request_depth = true; |
126 init.bind_generates_resource = true; | 128 init.bind_generates_resource = true; |
127 InitDecoder(init); | 129 InitDecoder(init); |
128 } | 130 } |
129 | 131 |
130 void GLES2DecoderTestBase::AddExpectationsForVertexAttribManager() { | 132 void GLES2DecoderTestBase::AddExpectationsForVertexAttribManager() { |
131 for (GLint ii = 0; ii < kNumVertexAttribs; ++ii) { | 133 for (GLint ii = 0; ii < kNumVertexAttribs; ++ii) { |
132 EXPECT_CALL(*gl_, VertexAttrib4f(ii, 0.0f, 0.0f, 0.0f, 1.0f)) | 134 EXPECT_CALL(*gl_, VertexAttrib4f(ii, 0.0f, 0.0f, 0.0f, 1.0f)) |
133 .Times(1) | 135 .Times(1) |
134 .RetiresOnSaturation(); | 136 .RetiresOnSaturation(); |
135 } | 137 } |
136 } | 138 } |
137 | 139 |
138 GLES2DecoderTestBase::InitState::InitState() | 140 GLES2DecoderTestBase::InitState::InitState() |
139 : has_alpha(false), | 141 : extensions("GL_EXT_framebuffer_object"), |
142 gl_version("2.1"), | |
143 has_alpha(false), | |
140 has_depth(false), | 144 has_depth(false), |
141 has_stencil(false), | 145 has_stencil(false), |
142 request_alpha(false), | 146 request_alpha(false), |
143 request_depth(false), | 147 request_depth(false), |
144 request_stencil(false), | 148 request_stencil(false), |
145 bind_generates_resource(false), | 149 bind_generates_resource(false), |
146 lose_context_when_out_of_memory(false), | 150 lose_context_when_out_of_memory(false), |
147 use_native_vao(true) { | 151 use_native_vao(true) { |
148 } | 152 } |
149 | 153 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 | 420 |
417 DoCreateProgram(client_program_id_, kServiceProgramId); | 421 DoCreateProgram(client_program_id_, kServiceProgramId); |
418 DoCreateShader(GL_VERTEX_SHADER, client_shader_id_, kServiceShaderId); | 422 DoCreateShader(GL_VERTEX_SHADER, client_shader_id_, kServiceShaderId); |
419 | 423 |
420 // Unsafe commands. | 424 // Unsafe commands. |
421 bool reset_unsafe_es3_apis_enabled = false; | 425 bool reset_unsafe_es3_apis_enabled = false; |
422 if (!decoder_->unsafe_es3_apis_enabled()) { | 426 if (!decoder_->unsafe_es3_apis_enabled()) { |
423 decoder_->set_unsafe_es3_apis_enabled(true); | 427 decoder_->set_unsafe_es3_apis_enabled(true); |
424 reset_unsafe_es3_apis_enabled = true; | 428 reset_unsafe_es3_apis_enabled = true; |
425 } | 429 } |
426 EXPECT_CALL(*gl_, GenSamplers(_, _)) | 430 |
427 .WillOnce(SetArgumentPointee<1>(kServiceSamplerId)) | 431 const gfx::GLVersionInfo* version = context_->GetVersionInfo(); |
428 .RetiresOnSaturation(); | 432 if (version->IsAtLeastGL(3, 3) || version->IsAtLeastGLES(3, 0)) { |
429 GenHelper<cmds::GenSamplersImmediate>(client_sampler_id_); | 433 EXPECT_CALL(*gl_, GenSamplers(_, _)) |
430 EXPECT_CALL(*gl_, GenTransformFeedbacks(_, _)) | 434 .WillOnce(SetArgumentPointee<1>(kServiceSamplerId)) |
431 .WillOnce(SetArgumentPointee<1>(kServiceTransformFeedbackId)) | 435 .RetiresOnSaturation(); |
432 .RetiresOnSaturation(); | 436 GenHelper<cmds::GenSamplersImmediate>(client_sampler_id_); |
433 GenHelper<cmds::GenTransformFeedbacksImmediate>(client_transformfeedback_id_); | 437 } |
434 DoFenceSync(client_sync_id_, kServiceSyncId); | 438 if (version->IsAtLeastGL(4, 0) || version->IsAtLeastGLES(3, 0)) { |
439 EXPECT_CALL(*gl_, GenTransformFeedbacks(_, _)) | |
440 .WillOnce(SetArgumentPointee<1>(kServiceTransformFeedbackId)) | |
441 .RetiresOnSaturation(); | |
442 GenHelper<cmds::GenTransformFeedbacksImmediate>( | |
443 client_transformfeedback_id_); | |
444 } | |
445 | |
446 if (init.extensions.find("GL_ARB_sync ") != std::string::npos || | |
Ken Russell (switch to Gerrit)
2015/01/24 05:08:05
What if this one is the last in the extension stri
no sievers
2015/01/26 21:13:03
See NormalizeInitState():
if (!init->extensions.e
| |
447 version->IsAtLeastGL(3, 2) || version->IsAtLeastGLES(3, 0)) { | |
448 DoFenceSync(client_sync_id_, kServiceSyncId); | |
449 } | |
450 | |
435 if (reset_unsafe_es3_apis_enabled) { | 451 if (reset_unsafe_es3_apis_enabled) { |
436 decoder_->set_unsafe_es3_apis_enabled(false); | 452 decoder_->set_unsafe_es3_apis_enabled(false); |
437 } | 453 } |
438 | 454 |
439 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 455 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
440 } | 456 } |
441 | 457 |
442 void GLES2DecoderTestBase::ResetDecoder() { | 458 void GLES2DecoderTestBase::ResetDecoder() { |
443 if (!decoder_.get()) | 459 if (!decoder_.get()) |
444 return; | 460 return; |
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1743 SetupDefaultProgram(); | 1759 SetupDefaultProgram(); |
1744 } | 1760 } |
1745 | 1761 |
1746 // Include the auto-generated part of this file. We split this because it means | 1762 // Include the auto-generated part of this file. We split this because it means |
1747 // we can easily edit the non-auto generated parts right here in this file | 1763 // we can easily edit the non-auto generated parts right here in this file |
1748 // instead of having to edit some template or the code generator. | 1764 // instead of having to edit some template or the code generator. |
1749 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 1765 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
1750 | 1766 |
1751 } // namespace gles2 | 1767 } // namespace gles2 |
1752 } // namespace gpu | 1768 } // namespace gpu |
OLD | NEW |