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

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

Issue 2693273002: Handle GLES2::ConsumeTextureCHROMIUM consuming the currently bound texture. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3249 matching lines...) Expand 10 before | Expand all | Expand 10 after
3260 EXPECT_EQ(2, width); 3260 EXPECT_EQ(2, width);
3261 EXPECT_EQ(4, height); 3261 EXPECT_EQ(4, height);
3262 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); 3262 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format));
3263 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); 3263 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format);
3264 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); 3264 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
3265 3265
3266 // Service ID is restored. 3266 // Service ID is restored.
3267 EXPECT_EQ(kServiceTextureId, texture->service_id()); 3267 EXPECT_EQ(kServiceTextureId, texture->service_id());
3268 } 3268 }
3269 3269
3270 TEST_P(GLES2DecoderTest, ConsumeAlreadyBoundTexture) {
3271 Mailbox mailbox = Mailbox::Generate();
3272
3273 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3274 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0,
3275 0);
3276
3277 TextureRef* texture_ref1 =
3278 group().texture_manager()->GetTexture(client_texture_id_);
3279
3280 ProduceTextureCHROMIUMImmediate& produce_cmd =
3281 *GetImmediateAs<ProduceTextureCHROMIUMImmediate>();
3282 produce_cmd.Init(GL_TEXTURE_2D, mailbox.name);
3283 EXPECT_EQ(error::kNoError,
3284 ExecuteImmediateCmd(produce_cmd, sizeof(mailbox.name)));
3285 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3286
3287 // Consume texture that is already bound. Operation should succeed, leaving
3288 // existing texture bound with no extra GL calls expected.
3289 ConsumeTextureCHROMIUMImmediate& consume_cmd =
3290 *GetImmediateAs<ConsumeTextureCHROMIUMImmediate>();
3291 consume_cmd.Init(GL_TEXTURE_2D, mailbox.name);
3292 EXPECT_EQ(error::kNoError,
3293 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name)));
3294 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3295
3296 TextureRef* texture_ref2 =
3297 group().texture_manager()->GetTexture(client_texture_id_);
3298
3299 EXPECT_EQ(texture_ref1, texture_ref2);
3300 }
3301
3270 TEST_P(GLES2DecoderTest, ProduceAndConsumeDirectTextureCHROMIUM) { 3302 TEST_P(GLES2DecoderTest, ProduceAndConsumeDirectTextureCHROMIUM) {
3271 Mailbox mailbox = Mailbox::Generate(); 3303 Mailbox mailbox = Mailbox::Generate();
3272 3304
3273 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3305 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3274 DoTexImage2D( 3306 DoTexImage2D(
3275 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3307 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3276 DoTexImage2D( 3308 DoTexImage2D(
3277 GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3309 GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3278 TextureRef* texture_ref = 3310 TextureRef* texture_ref =
3279 group().texture_manager()->GetTexture(client_texture_id_); 3311 group().texture_manager()->GetTexture(client_texture_id_);
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after
4793 // TODO(gman): CompressedTexSubImage2DImmediate 4825 // TODO(gman): CompressedTexSubImage2DImmediate
4794 4826
4795 // TODO(gman): TexImage2D 4827 // TODO(gman): TexImage2D
4796 4828
4797 // TODO(gman): TexImage2DImmediate 4829 // TODO(gman): TexImage2DImmediate
4798 4830
4799 // TODO(gman): TexSubImage2DImmediate 4831 // TODO(gman): TexSubImage2DImmediate
4800 4832
4801 } // namespace gles2 4833 } // namespace gles2
4802 } // namespace gpu 4834 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698