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

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

Issue 2165873002: Validate UniformBlocks being backed by sufficient data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a bug Created 4 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 kInvalidSharedMemoryId, 2190 kInvalidSharedMemoryId,
2191 kSharedMemoryOffset); 2191 kSharedMemoryOffset);
2192 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 2192 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
2193 cmd.Init(client_program_id_, 2193 cmd.Init(client_program_id_,
2194 kBucketId, 2194 kBucketId,
2195 kSharedMemoryId, 2195 kSharedMemoryId,
2196 kInvalidSharedMemoryOffset); 2196 kInvalidSharedMemoryOffset);
2197 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 2197 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
2198 } 2198 }
2199 2199
2200 TEST_P(GLES2DecoderWithShaderTest, UniformBlockBindingValidArgs) { 2200 TEST_P(GLES3DecoderWithESSL3ShaderTest, Basic) {
2201 EXPECT_CALL(*gl_, UniformBlockBinding(kServiceProgramId, 2, 3)); 2201 // Make sure the setup is correct for ES3.
2202 EXPECT_TRUE(decoder_->unsafe_es3_apis_enabled());
2203 EXPECT_TRUE(feature_info()->validators()->texture_bind_target.IsValid(
2204 GL_TEXTURE_3D));
2205 }
2206
2207 TEST_P(GLES3DecoderWithESSL3ShaderTest, UniformBlockBindingValidArgs) {
2208 EXPECT_CALL(*gl_, UniformBlockBinding(kServiceProgramId, 1, 3));
2202 SpecializedSetup<cmds::UniformBlockBinding, 0>(true); 2209 SpecializedSetup<cmds::UniformBlockBinding, 0>(true);
2203 cmds::UniformBlockBinding cmd; 2210 cmds::UniformBlockBinding cmd;
2204 cmd.Init(client_program_id_, 2, 3); 2211 cmd.Init(client_program_id_, 1, 3);
2205 decoder_->set_unsafe_es3_apis_enabled(true);
2206 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2212 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2207 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2213 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2208 decoder_->set_unsafe_es3_apis_enabled(false);
2209 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
2210 } 2214 }
2211 2215
2212 TEST_P(GLES2DecoderWithShaderTest, BindUniformLocationCHROMIUMBucket) { 2216 TEST_P(GLES2DecoderWithShaderTest, BindUniformLocationCHROMIUMBucket) {
2213 const uint32_t kBucketId = 123; 2217 const uint32_t kBucketId = 123;
2214 const GLint kLocation = 2; 2218 const GLint kLocation = 2;
2215 const char* kName = "testing"; 2219 const char* kName = "testing";
2216 const char* kBadName1 = "gl_testing"; 2220 const char* kBadName1 = "gl_testing";
2217 const char* kBadName2 = "testing[1]"; 2221 const char* kBadName2 = "testing[1]";
2218 2222
2219 SetBucketAsCString(kBucketId, kName); 2223 SetBucketAsCString(kBucketId, kName);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 } 2341 }
2338 2342
2339 // TODO(gman): DeleteProgram 2343 // TODO(gman): DeleteProgram
2340 2344
2341 // TODO(gman): UseProgram 2345 // TODO(gman): UseProgram
2342 2346
2343 // TODO(gman): DeleteShader 2347 // TODO(gman): DeleteShader
2344 2348
2345 } // namespace gles2 2349 } // namespace gles2
2346 } // namespace gpu 2350 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698