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

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

Issue 2182443003: WebGL 2: Fix bugs in negativetextureapi.html for Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: small change Created 4 years, 4 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 <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 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 0, 0, 0, 1068 0, 0, 0,
1069 kWidth, 1069 kWidth,
1070 kHeight, 1070 kHeight,
1071 kDepth, 1071 kDepth,
1072 kInternalFormat, 1072 kInternalFormat,
1073 kBucketId); 1073 kBucketId);
1074 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd)); 1074 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1075 } 1075 }
1076 } 1076 }
1077 1077
1078 TEST_P(GLES2DecoderTest, CopyTexSubImage3DFailsOnES2) {
1079 const GLenum kTarget = GL_TEXTURE_2D_ARRAY;
1080 const GLint kLevel = 0;
1081 const GLsizei kWidth = 4;
1082 const GLsizei kHeight = 4;
1083
1084 {
qiankun 2016/07/27 13:56:26 {} is not required.
yunchao 2016/07/27 23:46:11 Done.
1085 CopyTexSubImage3D cmd;
1086 cmd.Init(kTarget,
1087 kLevel,
1088 0, 0, 0,
1089 0, 0,
1090 kWidth,
1091 kHeight);
1092 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1093 }
1094 }
1095
1096 TEST_P(GLES3DecoderTest, CopyTexSubImage3DValidArgs) {
1097 const GLenum kTarget = GL_TEXTURE_3D;
1098 const GLint kLevel = 1;
1099 const GLint kInternalFormat = GL_RGB8;
1100 const GLsizei kWidth = 2;
1101 const GLsizei kHeight = 2;
1102 const GLsizei kDepth = 2;
1103 const GLenum kFormat = GL_RGB;
1104 const GLenum kType = GL_UNSIGNED_BYTE;
1105
1106 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
1107 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0,
1108 kFormat, kType, kSharedMemoryId, kSharedMemoryOffset);
1109
1110 EXPECT_CALL(*gl_,
1111 CopyTexSubImage3D(kTarget, 1, 0, 0, 0, 0, 0, kWidth, kHeight))
Zhenyao Mo 2016/07/27 17:38:29 Can you use kLevel, kXOffset, kYOffset, kZOffset,
yunchao 2016/07/27 23:46:11 Done.
1112 .Times(1)
1113 .RetiresOnSaturation();
1114 CopyTexSubImage3D cmd;
1115 cmd.Init(kTarget, 1, 0, 0, 0, 0, 0, kWidth, kHeight);
1116 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1117 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1118 }
1119
1120 TEST_P(GLES3DecoderTest, CopyTexSubImage3DBadArgs0) {
1121 const GLenum kTarget = GL_TEXTURE_3D;
1122 const GLsizei kWidth = 2;
1123 const GLsizei kHeight = 2;
1124
1125 CopyTexSubImage3D cmd;
1126
1127 // No texture bound
1128 cmd.Init(kTarget, 0, 0, 0, 0, 0, 0, kWidth, kHeight);
Zhenyao Mo 2016/07/27 17:38:29 Same here, please define constants and use it.
yunchao 2016/07/27 23:46:11 Done.
1129 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1130 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
1131
1132 // Incompatible format / type
1133 const GLint kLevel = 1;
1134 const GLint kInternalFormat = GL_RGBA8;
1135 const GLsizei kDepth = 2;
1136 const GLenum kFormat = GL_RGBA;
1137 const GLenum kType = GL_UNSIGNED_BYTE;
1138 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
1139 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0,
1140 kFormat, kType, kSharedMemoryId, kSharedMemoryOffset);
1141
1142 cmd.Init(kTarget, 1, 0, 0, 0, 0, 0, kWidth, kHeight);
qiankun 2016/07/27 13:56:26 What's the format of read buffer here?
Zhenyao Mo 2016/07/27 17:38:29 Same here, please define constants and use it. It
yunchao 2016/07/27 23:46:11 AFAIK, the default format/type of the default read
yunchao 2016/07/27 23:46:11 Good suggestion. It would be much clear. Done.
1143 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1144 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
1145 }
1146
1147 TEST_P(GLES3DecoderTest, CopyTexSubImage3DBadArgs1) {
1148 const GLenum kTarget = GL_TEXTURE_3D;
1149 const GLint kLevel = 1;
1150 const GLint kInternalFormat = GL_RGB8;
1151 const GLsizei kWidth = 2;
1152 const GLsizei kHeight = 2;
1153 const GLsizei kDepth = 2;
1154 const GLenum kFormat = GL_RGB;
1155 const GLenum kType = GL_UNSIGNED_BYTE;
1156
1157 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
1158 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0,
1159 kFormat, kType, kSharedMemoryId, kSharedMemoryOffset);
1160
1161 CopyTexSubImage3D cmd;
1162
1163 // Bad target
1164 cmd.Init(GL_TEXTURE_2D, 1, 0, 0, 0, 0, 0, kWidth, kHeight);
1165 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1166 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1167
1168 // Bad xoffest / yoffset of 3D texture
1169 cmd.Init(GL_TEXTURE_3D, 1, -1, 0, 0, 0, 0, kWidth, kHeight);
1170 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1171 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1172 cmd.Init(GL_TEXTURE_3D, 1, 1, 0, 0, 0, 0, kWidth, kHeight);
1173 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1174 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1175 cmd.Init(GL_TEXTURE_3D, 1, 0, -1, 0, 0, 0, kWidth, kHeight);
1176 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1177 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1178 cmd.Init(GL_TEXTURE_3D, 1, 0, 1, 0, 0, 0, kWidth, kHeight);
1179 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1180 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1181
1182 // Bad zoffset: zoffset specifies the mipmap level of the
1183 // 3D texture to be replaced
1184 cmd.Init(GL_TEXTURE_3D, 1, 0, 0, -1, 0, 0, kWidth, kHeight);
1185 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1186 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1187 cmd.Init(GL_TEXTURE_3D, 1, 0, 0, 2, 0, 0, kWidth, kHeight);
1188 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1189 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1190
1191 // Bad width / height
1192 cmd.Init(GL_TEXTURE_3D, 1, 0, 0, 0, 0, 0, kWidth + 1, kHeight);
1193 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1194 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1195 cmd.Init(GL_TEXTURE_3D, 1, 0, 0, 0, 0, 0, kWidth, kHeight + 1);
1196 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1197 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1198 }
1199
1078 TEST_P(GLES3DecoderTest, CompressedTexImage3DFailsWithBadImageSize) { 1200 TEST_P(GLES3DecoderTest, CompressedTexImage3DFailsWithBadImageSize) {
1079 const uint32_t kBucketId = 123; 1201 const uint32_t kBucketId = 123;
1080 const GLenum kTarget = GL_TEXTURE_2D_ARRAY; 1202 const GLenum kTarget = GL_TEXTURE_2D_ARRAY;
1081 const GLint kLevel = 0; 1203 const GLint kLevel = 0;
1082 const GLenum kInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC; 1204 const GLenum kInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
1083 const GLsizei kWidth = 4; 1205 const GLsizei kWidth = 4;
1084 const GLsizei kHeight = 8; 1206 const GLsizei kHeight = 8;
1085 const GLsizei kDepth = 4; 1207 const GLsizei kDepth = 4;
1086 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 1208 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
1087 ASSERT_TRUE(bucket != NULL); 1209 ASSERT_TRUE(bucket != NULL);
(...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after
4081 // TODO(gman): CompressedTexSubImage2DImmediate 4203 // TODO(gman): CompressedTexSubImage2DImmediate
4082 4204
4083 // TODO(gman): TexImage2D 4205 // TODO(gman): TexImage2D
4084 4206
4085 // TODO(gman): TexImage2DImmediate 4207 // TODO(gman): TexImage2DImmediate
4086 4208
4087 // TODO(gman): TexSubImage2DImmediate 4209 // TODO(gman): TexSubImage2DImmediate
4088 4210
4089 } // namespace gles2 4211 } // namespace gles2
4090 } // namespace gpu 4212 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698