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

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: addressed zmo's feedback 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
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h ('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 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 CopyTexSubImage3D cmd;
1085 cmd.Init(kTarget,
1086 kLevel,
1087 0, 0, 0,
1088 0, 0,
1089 kWidth,
1090 kHeight);
1091 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1092 }
1093
1094 TEST_P(GLES3DecoderTest, CopyTexSubImage3DFaiures) {
1095 const GLenum kTarget = GL_TEXTURE_3D;
1096 const GLint kLevel = 1;
1097 const GLint kXoffset = 0;
1098 const GLint kYoffset = 0;
1099 const GLint kZoffset = 0;
1100 const GLint kX = 0;
1101 const GLint kY = 0;
1102 const GLsizei kWidth = 2;
1103 const GLsizei kHeight = 2;
1104 const GLsizei kDepth = 2;
1105
1106 CopyTexSubImage3D cmd;
1107
1108 // No texture bound
1109 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset,
1110 kX, kY, kWidth, kHeight);
1111 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1112 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
1113
1114 // Incompatible format / type
1115 // The default format/type of default read buffer is RGB/UNSIGNED_BYTE
1116 const GLint kInternalFormat = GL_RGBA8;
1117 const GLenum kFormat = GL_RGBA;
1118 const GLenum kType = GL_UNSIGNED_BYTE;
1119 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
1120 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0,
1121 kFormat, kType, kSharedMemoryId, kSharedMemoryOffset);
1122
1123 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset,
1124 kX, kY, kWidth, kHeight);
1125 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1126 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
1127 }
1128
1129 TEST_P(GLES3DecoderTest, CopyTexSubImage3DCheckArgs) {
1130 const GLenum kTarget = GL_TEXTURE_3D;
1131 const GLint kLevel = 1;
1132 const GLint kInternalFormat = GL_RGB8;
1133 const GLint kXoffset = 0;
1134 const GLint kYoffset = 0;
1135 const GLint kZoffset = 0;
1136 const GLint kX = 0;
1137 const GLint kY = 0;
1138 const GLsizei kWidth = 2;
1139 const GLsizei kHeight = 2;
1140 const GLsizei kDepth = 2;
1141 const GLsizei kBorder = 0;
1142 const GLenum kFormat = GL_RGB;
1143 const GLenum kType = GL_UNSIGNED_BYTE;
1144
1145 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
1146 DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth,
1147 kBorder, kFormat, kType, kSharedMemoryId, kSharedMemoryOffset);
1148
1149 // Valid args
1150 EXPECT_CALL(*gl_,
1151 CopyTexSubImage3D(kTarget, kLevel, kXoffset, kYoffset, kZoffset,
1152 kX, kY, kWidth, kHeight))
1153 .Times(1)
1154 .RetiresOnSaturation();
1155 CopyTexSubImage3D cmd;
1156 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset,
1157 kX, kY, kWidth, kHeight);
1158 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1159 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1160
1161 // Bad target
1162 cmd.Init(GL_TEXTURE_2D, kLevel, kXoffset, kYoffset, kZoffset,
1163 kX, kY, kWidth, kHeight);
1164 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1165 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1166
1167 // Bad Level
1168 cmd.Init(kTarget, -1, kXoffset, kYoffset, kZoffset,
1169 kX, kY, kWidth, kHeight);
1170 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1171 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1172 cmd.Init(kTarget, 0, kXoffset, kYoffset, kZoffset,
1173 kX, kY, kWidth, kHeight);
1174 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1175 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1176
1177 // Bad xoffest / yoffset of 3D texture
1178 cmd.Init(kTarget, kLevel, -1, kYoffset, kZoffset,
1179 kX, kY, kWidth, kHeight);
1180 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1181 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1182 cmd.Init(kTarget, kLevel, 1, kYoffset, kZoffset,
1183 kX, kY, kWidth, kHeight);
1184 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1185 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1186 cmd.Init(kTarget, kLevel, kXoffset, -1, kZoffset,
1187 kX, kY, kWidth, kHeight);
1188 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1189 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1190 cmd.Init(kTarget, kLevel, kXoffset, 1, kZoffset,
1191 kX, kY, kWidth, kHeight);
1192 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1193 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1194
1195 // Bad zoffset: zoffset specifies the layer of the 3D texture to be replaced
1196 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, -1,
1197 kX, kY, kWidth, kHeight);
1198 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1199 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1200 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kDepth,
1201 kX, kY, kWidth, kHeight);
1202 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1203 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1204
1205 // Bad width / height
1206 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset,
1207 kX, kY, kWidth + 1, kHeight);
1208 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1209 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1210 cmd.Init(kTarget, kLevel, kXoffset, kYoffset, kZoffset,
1211 kX, kY, kWidth, kHeight + 1);
1212 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1213 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1214 }
1215
1078 TEST_P(GLES3DecoderTest, CompressedTexImage3DFailsWithBadImageSize) { 1216 TEST_P(GLES3DecoderTest, CompressedTexImage3DFailsWithBadImageSize) {
1079 const uint32_t kBucketId = 123; 1217 const uint32_t kBucketId = 123;
1080 const GLenum kTarget = GL_TEXTURE_2D_ARRAY; 1218 const GLenum kTarget = GL_TEXTURE_2D_ARRAY;
1081 const GLint kLevel = 0; 1219 const GLint kLevel = 0;
1082 const GLenum kInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC; 1220 const GLenum kInternalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
1083 const GLsizei kWidth = 4; 1221 const GLsizei kWidth = 4;
1084 const GLsizei kHeight = 8; 1222 const GLsizei kHeight = 8;
1085 const GLsizei kDepth = 4; 1223 const GLsizei kDepth = 4;
1086 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId); 1224 CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
1087 ASSERT_TRUE(bucket != NULL); 1225 ASSERT_TRUE(bucket != NULL);
(...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after
4081 // TODO(gman): CompressedTexSubImage2DImmediate 4219 // TODO(gman): CompressedTexSubImage2DImmediate
4082 4220
4083 // TODO(gman): TexImage2D 4221 // TODO(gman): TexImage2D
4084 4222
4085 // TODO(gman): TexImage2DImmediate 4223 // TODO(gman): TexImage2DImmediate
4086 4224
4087 // TODO(gman): TexSubImage2DImmediate 4225 // TODO(gman): TexSubImage2DImmediate
4088 4226
4089 } // namespace gles2 4227 } // namespace gles2
4090 } // namespace gpu 4228 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_1_autogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698