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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
index e31447d4c81668115784bca1efe364aad36c878d..0122d3778807053dad6784e995df0069d0f6a326 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
@@ -42,7 +42,6 @@ using ::testing::Pointee;
using ::testing::Return;
using ::testing::SetArrayArgument;
using ::testing::SetArgPointee;
-using ::testing::SetArgumentPointee;
using ::testing::StrEq;
using ::testing::StrictMock;
using ::testing::WithArg;
@@ -239,14 +238,14 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine(
if (init.context_type == CONTEXT_TYPE_WEBGL2 ||
init.context_type == CONTEXT_TYPE_OPENGLES3) {
EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_COLOR_ATTACHMENTS, _))
- .WillOnce(SetArgumentPointee<1>(kMaxColorAttachments))
+ .WillOnce(SetArgPointee<1>(kMaxColorAttachments))
.RetiresOnSaturation();
EXPECT_CALL(*gl_, GetIntegerv(GL_MAX_DRAW_BUFFERS, _))
- .WillOnce(SetArgumentPointee<1>(kMaxDrawBuffers))
+ .WillOnce(SetArgPointee<1>(kMaxDrawBuffers))
.RetiresOnSaturation();
EXPECT_CALL(*gl_, GenTransformFeedbacks(1, _))
- .WillOnce(SetArgumentPointee<1>(kServiceDefaultTransformFeedbackId))
+ .WillOnce(SetArgPointee<1>(kServiceDefaultTransformFeedbackId))
.RetiresOnSaturation();
EXPECT_CALL(*gl_, BindTransformFeedback(GL_TRANSFORM_FEEDBACK,
kServiceDefaultTransformFeedbackId))
@@ -256,7 +255,7 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine(
if (group_->feature_info()->feature_flags().native_vertex_array_object) {
EXPECT_CALL(*gl_, GenVertexArraysOES(1, _))
- .WillOnce(SetArgumentPointee<1>(kServiceVertexArrayId))
+ .WillOnce(SetArgPointee<1>(kServiceVertexArrayId))
.RetiresOnSaturation();
EXPECT_CALL(*gl_, BindVertexArrayOES(_)).Times(1).RetiresOnSaturation();
}
@@ -349,27 +348,27 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine(
EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(
GL_FRAMEBUFFER, GL_BACK_LEFT,
GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, _))
- .WillOnce(SetArgumentPointee<3>(normalized_init.has_alpha ? 8 : 0))
+ .WillOnce(SetArgPointee<3>(normalized_init.has_alpha ? 8 : 0))
.RetiresOnSaturation();
EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(
GL_FRAMEBUFFER, GL_DEPTH,
GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, _))
- .WillOnce(SetArgumentPointee<3>(normalized_init.has_depth ? 24 : 0))
+ .WillOnce(SetArgPointee<3>(normalized_init.has_depth ? 24 : 0))
.RetiresOnSaturation();
EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(
GL_FRAMEBUFFER, GL_STENCIL,
GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, _))
- .WillOnce(SetArgumentPointee<3>(normalized_init.has_stencil ? 8 : 0))
+ .WillOnce(SetArgPointee<3>(normalized_init.has_stencil ? 8 : 0))
.RetiresOnSaturation();
} else {
EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _))
- .WillOnce(SetArgumentPointee<1>(normalized_init.has_alpha ? 8 : 0))
+ .WillOnce(SetArgPointee<1>(normalized_init.has_alpha ? 8 : 0))
.RetiresOnSaturation();
EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _))
- .WillOnce(SetArgumentPointee<1>(normalized_init.has_depth ? 24 : 0))
+ .WillOnce(SetArgPointee<1>(normalized_init.has_depth ? 24 : 0))
.RetiresOnSaturation();
EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _))
- .WillOnce(SetArgumentPointee<1>(normalized_init.has_stencil ? 8 : 0))
+ .WillOnce(SetArgPointee<1>(normalized_init.has_stencil ? 8 : 0))
.RetiresOnSaturation();
}
@@ -480,23 +479,23 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine(
decoder_->BeginDecoding();
EXPECT_CALL(*gl_, GenBuffersARB(_, _))
- .WillOnce(SetArgumentPointee<1>(kServiceBufferId))
+ .WillOnce(SetArgPointee<1>(kServiceBufferId))
.RetiresOnSaturation();
GenHelper<cmds::GenBuffersImmediate>(client_buffer_id_);
EXPECT_CALL(*gl_, GenFramebuffersEXT(_, _))
- .WillOnce(SetArgumentPointee<1>(kServiceFramebufferId))
+ .WillOnce(SetArgPointee<1>(kServiceFramebufferId))
.RetiresOnSaturation();
GenHelper<cmds::GenFramebuffersImmediate>(client_framebuffer_id_);
EXPECT_CALL(*gl_, GenRenderbuffersEXT(_, _))
- .WillOnce(SetArgumentPointee<1>(kServiceRenderbufferId))
+ .WillOnce(SetArgPointee<1>(kServiceRenderbufferId))
.RetiresOnSaturation();
GenHelper<cmds::GenRenderbuffersImmediate>(client_renderbuffer_id_);
EXPECT_CALL(*gl_, GenTextures(_, _))
- .WillOnce(SetArgumentPointee<1>(kServiceTextureId))
+ .WillOnce(SetArgPointee<1>(kServiceTextureId))
.RetiresOnSaturation();
GenHelper<cmds::GenTexturesImmediate>(client_texture_id_);
EXPECT_CALL(*gl_, GenBuffersARB(_, _))
- .WillOnce(SetArgumentPointee<1>(kServiceElementBufferId))
+ .WillOnce(SetArgPointee<1>(kServiceElementBufferId))
.RetiresOnSaturation();
GenHelper<cmds::GenBuffersImmediate>(client_element_buffer_id_);
GenHelper<cmds::GenQueriesEXTImmediate>(client_query_id_);
@@ -514,13 +513,13 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine(
const gl::GLVersionInfo* version = context_->GetVersionInfo();
if (version->IsAtLeastGL(3, 3) || version->IsAtLeastGLES(3, 0)) {
EXPECT_CALL(*gl_, GenSamplers(_, _))
- .WillOnce(SetArgumentPointee<1>(kServiceSamplerId))
+ .WillOnce(SetArgPointee<1>(kServiceSamplerId))
.RetiresOnSaturation();
GenHelper<cmds::GenSamplersImmediate>(client_sampler_id_);
}
if (version->IsAtLeastGL(4, 0) || version->IsAtLeastGLES(3, 0)) {
EXPECT_CALL(*gl_, GenTransformFeedbacks(_, _))
- .WillOnce(SetArgumentPointee<1>(kServiceTransformFeedbackId))
+ .WillOnce(SetArgPointee<1>(kServiceTransformFeedbackId))
.RetiresOnSaturation();
GenHelper<cmds::GenTransformFeedbacksImmediate>(
client_transformfeedback_id_);
@@ -1435,7 +1434,7 @@ void GLES2DecoderTestBase::DoVertexAttribDivisorANGLE(
void GLES2DecoderTestBase::AddExpectationsForGenVertexArraysOES(){
if (group_->feature_info()->feature_flags().native_vertex_array_object) {
EXPECT_CALL(*gl_, GenVertexArraysOES(1, _))
- .WillOnce(SetArgumentPointee<1>(kServiceVertexArrayId))
+ .WillOnce(SetArgPointee<1>(kServiceVertexArrayId))
.RetiresOnSaturation();
}
}
@@ -1807,6 +1806,9 @@ void GLES2DecoderTestBase::SetupShader(
shader_language_version_ == 100 ? kProgramOutputsESSL1
: kProgramOutputsESSL3;
const size_t kNumProgramOutputs = 1;
+ const int kNumUniformBlocks = 2;
+ const int kUniformBlockBinding[] = { 0, 1 };
+ const int kUniformBlockDataSize[] = { 32, 16 };
{
InSequence s;
@@ -1854,6 +1856,25 @@ void GLES2DecoderTestBase::SetupShader(
attach_cmd.Init(program_client_id, fragment_shader_client_id);
EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd));
+ if (shader_language_version_ == 300) {
+ EXPECT_CALL(*gl_, GetProgramiv(
+ program_service_id, GL_ACTIVE_UNIFORM_BLOCKS, _))
+ .WillOnce(SetArgPointee<2>(kNumUniformBlocks))
+ .RetiresOnSaturation();
+ for (int ii = 0; ii < kNumUniformBlocks; ++ii) {
+ EXPECT_CALL(*gl_,
+ GetActiveUniformBlockiv(program_service_id, ii,
+ GL_UNIFORM_BLOCK_BINDING, _))
+ .WillOnce(SetArgPointee<3>(kUniformBlockBinding[ii]))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl_,
+ GetActiveUniformBlockiv(program_service_id, ii,
+ GL_UNIFORM_BLOCK_DATA_SIZE, _))
+ .WillOnce(SetArgPointee<3>(kUniformBlockDataSize[ii]))
+ .RetiresOnSaturation();
+ }
+ }
+
cmds::LinkProgram link_cmd;
link_cmd.Init(program_client_id);
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698