OLD | NEW |
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 3073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3084 EXPECT_EQ(4, height); | 3084 EXPECT_EQ(4, height); |
3085 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); | 3085 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); |
3086 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 3086 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
3087 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 3087 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
3088 | 3088 |
3089 // Service ID has not changed. | 3089 // Service ID has not changed. |
3090 EXPECT_EQ(kServiceTextureId, texture->service_id()); | 3090 EXPECT_EQ(kServiceTextureId, texture->service_id()); |
3091 | 3091 |
3092 // Consume the texture into a new client ID. | 3092 // Consume the texture into a new client ID. |
3093 GLuint new_texture_id = kNewClientId; | 3093 GLuint new_texture_id = kNewClientId; |
3094 CreateAndConsumeTextureCHROMIUMImmediate& consume_cmd = | 3094 CreateAndConsumeTextureINTERNALImmediate& consume_cmd = |
3095 *GetImmediateAs<CreateAndConsumeTextureCHROMIUMImmediate>(); | 3095 *GetImmediateAs<CreateAndConsumeTextureINTERNALImmediate>(); |
3096 consume_cmd.Init(GL_TEXTURE_2D, new_texture_id, mailbox.name); | 3096 consume_cmd.Init(GL_TEXTURE_2D, new_texture_id, mailbox.name); |
3097 EXPECT_EQ(error::kNoError, | 3097 EXPECT_EQ(error::kNoError, |
3098 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name))); | 3098 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name))); |
3099 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3099 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3100 | 3100 |
3101 // Make sure the new client ID is associated with the produced service ID. | 3101 // Make sure the new client ID is associated with the produced service ID. |
3102 texture_ref = group().texture_manager()->GetTexture(new_texture_id); | 3102 texture_ref = group().texture_manager()->GetTexture(new_texture_id); |
3103 ASSERT_TRUE(texture_ref != NULL); | 3103 ASSERT_TRUE(texture_ref != NULL); |
3104 texture = texture_ref->texture(); | 3104 texture = texture_ref->texture(); |
3105 EXPECT_EQ(kServiceTextureId, texture->service_id()); | 3105 EXPECT_EQ(kServiceTextureId, texture->service_id()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3155 EXPECT_CALL(*gl_, GenTextures(1, _)) | 3155 EXPECT_CALL(*gl_, GenTextures(1, _)) |
3156 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) | 3156 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) |
3157 .RetiresOnSaturation(); | 3157 .RetiresOnSaturation(); |
3158 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, _)) | 3158 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, _)) |
3159 .Times(2) | 3159 .Times(2) |
3160 .RetiresOnSaturation(); | 3160 .RetiresOnSaturation(); |
3161 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) | 3161 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) |
3162 .Times(1) | 3162 .Times(1) |
3163 .RetiresOnSaturation(); | 3163 .RetiresOnSaturation(); |
3164 | 3164 |
3165 CreateAndConsumeTextureCHROMIUMImmediate& consume_cmd = | 3165 CreateAndConsumeTextureINTERNALImmediate& consume_cmd = |
3166 *GetImmediateAs<CreateAndConsumeTextureCHROMIUMImmediate>(); | 3166 *GetImmediateAs<CreateAndConsumeTextureINTERNALImmediate>(); |
3167 consume_cmd.Init(GL_TEXTURE_2D, new_texture_id, mailbox.name); | 3167 consume_cmd.Init(GL_TEXTURE_2D, new_texture_id, mailbox.name); |
3168 EXPECT_EQ(error::kNoError, | 3168 EXPECT_EQ(error::kNoError, |
3169 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name))); | 3169 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name))); |
3170 | 3170 |
3171 // CreateAndConsumeTexture should fail if the mailbox isn't associated with a | 3171 // CreateAndConsumeTexture should fail if the mailbox isn't associated with a |
3172 // texture. | 3172 // texture. |
3173 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 3173 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
3174 | 3174 |
3175 // Make sure the new client_id is associated with a texture ref even though | 3175 // Make sure the new client_id is associated with a texture ref even though |
3176 // CreateAndConsumeTexture failed. | 3176 // CreateAndConsumeTexture failed. |
(...skipping 27 matching lines...) Expand all Loading... |
3204 .RetiresOnSaturation(); | 3204 .RetiresOnSaturation(); |
3205 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_CUBE_MAP, _)) | 3205 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_CUBE_MAP, _)) |
3206 .Times(2) | 3206 .Times(2) |
3207 .RetiresOnSaturation(); | 3207 .RetiresOnSaturation(); |
3208 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) | 3208 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) |
3209 .Times(1) | 3209 .Times(1) |
3210 .RetiresOnSaturation(); | 3210 .RetiresOnSaturation(); |
3211 | 3211 |
3212 // Attempt to consume the mailbox with a different target. | 3212 // Attempt to consume the mailbox with a different target. |
3213 GLuint new_texture_id = kNewClientId; | 3213 GLuint new_texture_id = kNewClientId; |
3214 CreateAndConsumeTextureCHROMIUMImmediate& consume_cmd = | 3214 CreateAndConsumeTextureINTERNALImmediate& consume_cmd = |
3215 *GetImmediateAs<CreateAndConsumeTextureCHROMIUMImmediate>(); | 3215 *GetImmediateAs<CreateAndConsumeTextureINTERNALImmediate>(); |
3216 consume_cmd.Init(GL_TEXTURE_CUBE_MAP, new_texture_id, mailbox.name); | 3216 consume_cmd.Init(GL_TEXTURE_CUBE_MAP, new_texture_id, mailbox.name); |
3217 EXPECT_EQ(error::kNoError, | 3217 EXPECT_EQ(error::kNoError, |
3218 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name))); | 3218 ExecuteImmediateCmd(consume_cmd, sizeof(mailbox.name))); |
3219 | 3219 |
3220 // CreateAndConsumeTexture should fail if the produced texture had a different | 3220 // CreateAndConsumeTexture should fail if the produced texture had a different |
3221 // target. | 3221 // target. |
3222 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 3222 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
3223 | 3223 |
3224 // Make sure the new client_id is associated with a texture ref even though | 3224 // Make sure the new client_id is associated with a texture ref even though |
3225 // CreateAndConsumeTexture failed. | 3225 // CreateAndConsumeTexture failed. |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4446 // TODO(gman): CompressedTexSubImage2DImmediate | 4446 // TODO(gman): CompressedTexSubImage2DImmediate |
4447 | 4447 |
4448 // TODO(gman): TexImage2D | 4448 // TODO(gman): TexImage2D |
4449 | 4449 |
4450 // TODO(gman): TexImage2DImmediate | 4450 // TODO(gman): TexImage2DImmediate |
4451 | 4451 |
4452 // TODO(gman): TexSubImage2DImmediate | 4452 // TODO(gman): TexSubImage2DImmediate |
4453 | 4453 |
4454 } // namespace gles2 | 4454 } // namespace gles2 |
4455 } // namespace gpu | 4455 } // namespace gpu |
OLD | NEW |