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_framebuffers.cc

Issue 2264253003: Command buffers: ensure we only read immediate data once (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Keep track of the correct draw buffer Created 4 years, 3 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 <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 2079
2080 ClearBufferivImmediate& cmd = 2080 ClearBufferivImmediate& cmd =
2081 *GetImmediateAs<ClearBufferivImmediate>(); 2081 *GetImmediateAs<ClearBufferivImmediate>();
2082 GLint temp[4] = { 0 }; 2082 GLint temp[4] = { 0 };
2083 cmd.Init(GL_COLOR, 0, &temp[0]); 2083 cmd.Init(GL_COLOR, 0, &temp[0]);
2084 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER)) 2084 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER))
2085 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 2085 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
2086 .RetiresOnSaturation(); 2086 .RetiresOnSaturation();
2087 SetupExpectationsForApplyingDirtyState( 2087 SetupExpectationsForApplyingDirtyState(
2088 false, false, false, 0x1111, false, false, 0, 0, false); 2088 false, false, false, 0x1111, false, false, 0, 0, false);
2089 EXPECT_CALL(*gl_, ClearBufferiv( 2089 EXPECT_CALL(*gl_, ClearBufferiv(GL_COLOR, 0, PointsToArray(temp, 4)));
2090 GL_COLOR, 0,
2091 reinterpret_cast<GLint*>(ImmediateDataAddress(&cmd))));
2092 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 2090 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
2093 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2091 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2094 } 2092 }
2095 2093
2096 TEST_P(GLES3DecoderTest, ClearBufferuivImmediateValidArgs) { 2094 TEST_P(GLES3DecoderTest, ClearBufferuivImmediateValidArgs) {
2097 DoBindFramebuffer( 2095 DoBindFramebuffer(
2098 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); 2096 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
2099 DoBindRenderbuffer( 2097 DoBindRenderbuffer(
2100 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); 2098 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId);
2101 DoRenderbufferStorage( 2099 DoRenderbufferStorage(
(...skipping 11 matching lines...) Expand all
2113 2111
2114 ClearBufferuivImmediate& cmd = 2112 ClearBufferuivImmediate& cmd =
2115 *GetImmediateAs<ClearBufferuivImmediate>(); 2113 *GetImmediateAs<ClearBufferuivImmediate>();
2116 GLuint temp[4] = { 0u }; 2114 GLuint temp[4] = { 0u };
2117 cmd.Init(GL_COLOR, 0, &temp[0]); 2115 cmd.Init(GL_COLOR, 0, &temp[0]);
2118 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER)) 2116 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER))
2119 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 2117 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
2120 .RetiresOnSaturation(); 2118 .RetiresOnSaturation();
2121 SetupExpectationsForApplyingDirtyState( 2119 SetupExpectationsForApplyingDirtyState(
2122 false, false, false, 0x1111, false, false, 0, 0, false); 2120 false, false, false, 0x1111, false, false, 0, 0, false);
2123 EXPECT_CALL(*gl_, ClearBufferuiv( 2121 EXPECT_CALL(*gl_, ClearBufferuiv(GL_COLOR, 0, PointsToArray(temp, 4)));
2124 GL_COLOR, 0,
2125 reinterpret_cast<GLuint*>(
2126 ImmediateDataAddress(&cmd))));
2127 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 2122 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
2128 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2123 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2129 } 2124 }
2130 2125
2131 TEST_P(GLES3DecoderTest, ClearBufferfvImmediateValidArgs) { 2126 TEST_P(GLES3DecoderTest, ClearBufferfvImmediateValidArgs) {
2132 DoBindFramebuffer( 2127 DoBindFramebuffer(
2133 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); 2128 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
2134 DoBindRenderbuffer( 2129 DoBindRenderbuffer(
2135 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); 2130 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId);
2136 DoRenderbufferStorage( 2131 DoRenderbufferStorage(
(...skipping 17 matching lines...) Expand all
2154 2149
2155 ClearBufferfvImmediate& cmd = 2150 ClearBufferfvImmediate& cmd =
2156 *GetImmediateAs<ClearBufferfvImmediate>(); 2151 *GetImmediateAs<ClearBufferfvImmediate>();
2157 GLfloat temp[4] = { 1.0f }; 2152 GLfloat temp[4] = { 1.0f };
2158 cmd.Init(GL_DEPTH, 0, &temp[0]); 2153 cmd.Init(GL_DEPTH, 0, &temp[0]);
2159 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER)) 2154 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER))
2160 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) 2155 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
2161 .RetiresOnSaturation(); 2156 .RetiresOnSaturation();
2162 SetupExpectationsForApplyingDirtyState( 2157 SetupExpectationsForApplyingDirtyState(
2163 true, true, false, 0x1110, true, true, 0, 0, false); 2158 true, true, false, 0x1110, true, true, 0, 0, false);
2164 EXPECT_CALL(*gl_, ClearBufferfv( 2159 EXPECT_CALL(*gl_, ClearBufferfv(GL_DEPTH, 0, PointsToArray(temp, 4)));
2165 GL_DEPTH, 0,
2166 reinterpret_cast<GLfloat*>(
2167 ImmediateDataAddress(&cmd))));
2168 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 2160 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
2169 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2161 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2170 } 2162 }
2171 2163
2172 TEST_P(GLES3DecoderTest, ClearBufferfiValidArgs) { 2164 TEST_P(GLES3DecoderTest, ClearBufferfiValidArgs) {
2173 DoBindFramebuffer( 2165 DoBindFramebuffer(
2174 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); 2166 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
2175 DoBindRenderbuffer( 2167 DoBindRenderbuffer(
2176 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); 2168 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId);
2177 DoRenderbufferStorage( 2169 DoRenderbufferStorage(
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
3632 EXPECT_TRUE(framebuffer->HasUnclearedAttachment( 3624 EXPECT_TRUE(framebuffer->HasUnclearedAttachment(
3633 GL_DEPTH_STENCIL_ATTACHMENT)); 3625 GL_DEPTH_STENCIL_ATTACHMENT));
3634 } 3626 }
3635 3627
3636 // TODO(gman): PixelStorei 3628 // TODO(gman): PixelStorei
3637 3629
3638 // TODO(gman): SwapBuffers 3630 // TODO(gman): SwapBuffers
3639 3631
3640 } // namespace gles2 3632 } // namespace gles2
3641 } // namespace gpu 3633 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698