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

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

Issue 8341128: Defer clearing textures and renderbuffers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix one more unit test Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "gpu/command_buffer/common/gl_mock.h" 7 #include "gpu/command_buffer/common/gl_mock.h"
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" 8 #include "gpu/command_buffer/common/gles2_cmd_format.h"
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
10 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" 10 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 EXPECT_CALL(*gl_, TexParameteri( 47 EXPECT_CALL(*gl_, TexParameteri(
48 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR)) 48 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR))
49 .Times(1) 49 .Times(1)
50 .RetiresOnSaturation(); 50 .RetiresOnSaturation();
51 } 51 }
52 }; 52 };
53 53
54 template <> 54 template <>
55 void GLES2DecoderTestBase::SpecializedSetup<CheckFramebufferStatus, 0>( 55 void GLES2DecoderTestBase::SpecializedSetup<CheckFramebufferStatus, 0>(
56 bool /* valid */) { 56 bool /* valid */) {
57 // Give it a valid framebuffer.
58 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_,
59 kServiceRenderbufferId);
57 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, 60 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_,
58 kServiceFramebufferId); 61 kServiceFramebufferId);
62 DoRenderbufferStorage(
63 GL_RENDERBUFFER, GL_RGBA4, GL_RGBA, 1, 1, GL_NO_ERROR);
64 DoFramebufferRenderbuffer(
65 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,
66 client_renderbuffer_id_, kServiceRenderbufferId, GL_NO_ERROR);
59 }; 67 };
60 68
61 template <> 69 template <>
62 void GLES2DecoderTestBase::SpecializedSetup<Clear, 0>(bool valid) { 70 void GLES2DecoderTestBase::SpecializedSetup<Clear, 0>(bool valid) {
63 if (valid) { 71 if (valid) {
64 SetupExpectationsForApplyingDefaultDirtyState(); 72 SetupExpectationsForApplyingDefaultDirtyState();
65 } 73 }
66 }; 74 };
67 75
68 template <> 76 template <>
(...skipping 15 matching lines...) Expand all
84 .RetiresOnSaturation(); 92 .RetiresOnSaturation();
85 } 93 }
86 }; 94 };
87 95
88 template <> 96 template <>
89 void GLES2DecoderTestBase::SpecializedSetup<CopyTexSubImage2D, 0>(bool valid) { 97 void GLES2DecoderTestBase::SpecializedSetup<CopyTexSubImage2D, 0>(bool valid) {
90 if (valid) { 98 if (valid) {
91 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 99 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
92 DoTexImage2D( 100 DoTexImage2D(
93 GL_TEXTURE_2D, 2, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 101 GL_TEXTURE_2D, 2, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE,
94 0, 0); 102 kSharedMemoryId, kSharedMemoryOffset);
95 } 103 }
96 }; 104 };
97 105
98 template <> 106 template <>
99 void GLES2DecoderTestBase::SpecializedSetup<DetachShader, 0>(bool valid) { 107 void GLES2DecoderTestBase::SpecializedSetup<DetachShader, 0>(bool valid) {
100 if (valid) { 108 if (valid) {
101 EXPECT_CALL(*gl_, 109 EXPECT_CALL(*gl_,
102 AttachShader(kServiceProgramId, kServiceShaderId)) 110 AttachShader(kServiceProgramId, kServiceShaderId))
103 .Times(1) 111 .Times(1)
104 .RetiresOnSaturation(); 112 .RetiresOnSaturation();
105 AttachShader attach_cmd; 113 AttachShader attach_cmd;
106 attach_cmd.Init(client_program_id_, client_shader_id_); 114 attach_cmd.Init(client_program_id_, client_shader_id_);
107 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd)); 115 EXPECT_EQ(error::kNoError, ExecuteCmd(attach_cmd));
108 } 116 }
109 }; 117 };
110 118
111 template <> 119 template <>
112 void GLES2DecoderTestBase::SpecializedSetup<FramebufferRenderbuffer, 0>( 120 void GLES2DecoderTestBase::SpecializedSetup<FramebufferRenderbuffer, 0>(
113 bool valid) { 121 bool valid) {
114 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, 122 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_,
115 kServiceFramebufferId); 123 kServiceFramebufferId);
116 if (valid) { 124 if (valid) {
117 EXPECT_CALL(*gl_, GetError()) 125 EXPECT_CALL(*gl_, GetError())
118 .WillOnce(Return(GL_NO_ERROR)) 126 .WillOnce(Return(GL_NO_ERROR))
119 .RetiresOnSaturation();
120 // Return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT so the code
121 // doesn't try to clear the buffer. That is tested else where.
122 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
123 .WillOnce(Return(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT))
124 .RetiresOnSaturation();
125 EXPECT_CALL(*gl_, GetError())
126 .WillOnce(Return(GL_NO_ERROR)) 127 .WillOnce(Return(GL_NO_ERROR))
127 .RetiresOnSaturation(); 128 .RetiresOnSaturation();
128 } 129 }
129 }; 130 };
130 131
131 template <> 132 template <>
132 void GLES2DecoderTestBase::SpecializedSetup<FramebufferTexture2D, 0>( 133 void GLES2DecoderTestBase::SpecializedSetup<FramebufferTexture2D, 0>(
133 bool valid) { 134 bool valid) {
134 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, 135 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_,
135 kServiceFramebufferId); 136 kServiceFramebufferId);
136 if (valid) { 137 if (valid) {
137 EXPECT_CALL(*gl_, GetError()) 138 EXPECT_CALL(*gl_, GetError())
138 .WillOnce(Return(GL_NO_ERROR)) 139 .WillOnce(Return(GL_NO_ERROR))
139 .RetiresOnSaturation();
140 // Return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT so the code
141 // doesn't try to clear the buffer. That is tested else where.
142 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
143 .WillOnce(Return(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT))
144 .RetiresOnSaturation();
145 EXPECT_CALL(*gl_, GetError())
146 .WillOnce(Return(GL_NO_ERROR)) 140 .WillOnce(Return(GL_NO_ERROR))
147 .RetiresOnSaturation(); 141 .RetiresOnSaturation();
148 } 142 }
149 }; 143 };
150 144
151 template <> 145 template <>
152 void GLES2DecoderTestBase::SpecializedSetup<GetFramebufferAttachmentParameteriv, 146 void GLES2DecoderTestBase::SpecializedSetup<GetFramebufferAttachmentParameteriv,
153 0>(bool /* valid */) { 147 0>(bool /* valid */) {
154 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, 148 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_,
155 kServiceFramebufferId); 149 kServiceFramebufferId);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 .WillOnce(Return(GL_NO_ERROR)) 232 .WillOnce(Return(GL_NO_ERROR))
239 .RetiresOnSaturation(); 233 .RetiresOnSaturation();
240 } 234 }
241 }; 235 };
242 236
243 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h" 237 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h"
244 238
245 } // namespace gles2 239 } // namespace gles2
246 } // namespace gpu 240 } // namespace gpu
247 241
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698