Hash :
9d737966
Author :
Date :
2019-08-14T12:25:12
Standardize copyright notices to project style
For all "ANGLE Project" copyrights, standardize to the format specified
by the style guide. Changes:
- "Copyright (c)" and "Copyright(c)" changed to just "Copyright".
- Removed the second half of date ranges ("Y1Y1-Y2Y2"->"Y1Y1").
- Fixed a small number of files that had no copyright date using the
initial commit year from the version control history.
- Fixed one instance of copyright being "The ANGLE Project" rather than
"The ANGLE Project Authors"
These changes are applied both to the copyright of source file, and
where applicable to copyright statements that are generated by
templates.
BUG=angleproject:3811
Change-Id: I973dd65e4ef9deeba232d5be74c768256a0eb2e5
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1754397
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// SamplerMultisample_test.cpp:
// Tests compiling shaders that use gsampler2DMS types
//
#include "GLSLANG/ShaderLang.h"
#include "angle_gl.h"
#include "gtest/gtest.h"
#include "tests/test_utils/ShaderCompileTreeTest.h"
using namespace sh;
class SamplerMultisampleTest : public ShaderCompileTreeTest
{
public:
SamplerMultisampleTest() {}
protected:
::GLenum getShaderType() const override { return GL_FRAGMENT_SHADER; }
ShShaderSpec getShaderSpec() const override { return SH_GLES3_1_SPEC; }
};
class SamplerMultisampleArrayTest : public ShaderCompileTreeTest
{
public:
SamplerMultisampleArrayTest() {}
void initResources(ShBuiltInResources *resources) override
{
resources->OES_texture_storage_multisample_2d_array = 1;
}
protected:
::GLenum getShaderType() const override { return GL_FRAGMENT_SHADER; }
ShShaderSpec getShaderSpec() const override { return SH_GLES3_1_SPEC; }
};
// Checks whether compiler has parsed the gsampler2DMS, texelfetch correctly.
TEST_F(SamplerMultisampleTest, TexelFetchSampler2DMS)
{
constexpr char kShaderString[] =
R"(#version 310 es
precision highp float;
uniform highp sampler2DMS s;
uniform highp isampler2DMS is;
uniform highp usampler2DMS us;
void main() {
vec4 tex1 = texelFetch(s, ivec2(0, 0), 0);
ivec4 tex2 = texelFetch(is, ivec2(0, 0), 0);
uvec4 tex3 = texelFetch(us, ivec2(0, 0), 0);
})";
if (!compile(kShaderString))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
// Checks whether compiler has parsed the gsampler2DMS, textureSize correctly.
TEST_F(SamplerMultisampleTest, TextureSizeSampler2DMS)
{
constexpr char kShaderString[] =
R"(#version 310 es
precision highp float;
uniform highp sampler2DMS s;
uniform highp isampler2DMS is;
uniform highp usampler2DMS us;
void main() {
ivec2 size = textureSize(s);
size = textureSize(is);
size = textureSize(us);
})";
if (!compile(kShaderString))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
// Check that sampler2DMS has no default precision.
TEST_F(SamplerMultisampleTest, NoPrecisionSampler2DMS)
{
constexpr char kShaderString[] =
R"(#version 310 es
precision highp float;
uniform sampler2DMS s;
void main() {})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Check that isampler2DMS has no default precision.
TEST_F(SamplerMultisampleTest, NoPrecisionISampler2DMS)
{
constexpr char kShaderString[] =
R"(#version 310 es
precision highp float;
uniform isampler2DMS s;
void main() {})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Check that usampler2DMS has no default precision.
TEST_F(SamplerMultisampleTest, NoPrecisionUSampler2DMS)
{
constexpr char kShaderString[] =
R"(#version 310 es
precision highp float;
uniform usampler2DMS s;
void main() {})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Negative test: checks that sampler2DMS is not usable in ESSL 3.00.
TEST_F(SamplerMultisampleTest, Sampler2DMSESSL300)
{
constexpr char kShaderString[] =
R"(#version 300 es
precision highp float;
uniform highp sampler2DMS s;
void main() {
})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Negative test: checks that isampler2DMS is not usable in ESSL 3.00.
TEST_F(SamplerMultisampleTest, ISampler2DMSESSL300)
{
constexpr char kShaderString[] =
R"(#version 300 es
precision highp float;
uniform highp isampler2DMS s;
void main() {
})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Negative test: checks that usampler2DMS is not usable in ESSL 3.00.
TEST_F(SamplerMultisampleTest, USampler2DMSESSL300)
{
constexpr char kShaderString[] =
R"(#version 300 es
precision highp float;
uniform highp usampler2DMS s;
void main() {
})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Negative test: checks that sampler2DMSArray is not usable in ESSL 3.10 without extensions.
TEST_F(SamplerMultisampleTest, Sampler2DMSArrayNotSupported)
{
constexpr char kShaderString[] =
R"(#version 310 es
precision highp float;
uniform highp sampler2DMSArray s;
void main() {
})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Negative test: checks that isampler2DMSArray is not usable in ESSL 3.10 without extensions.
TEST_F(SamplerMultisampleTest, ISampler2DMSArrayNotSupported)
{
constexpr char kShaderString[] =
R"(#version 310 es
precision highp float;
uniform highp isampler2DMSArray s;
void main() {
})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Negative test: checks that usampler2DMSArray is not usable in ESSL 3.10 without extensions.
TEST_F(SamplerMultisampleTest, USampler2DMSArrayNotSupported)
{
constexpr char kShaderString[] =
R"(#version 310 es
precision highp float;
uniform highp usampler2DMSArray s;
void main() {
})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Checks whether compiler has parsed the gsampler2DMSArray, texelfetch correctly.
TEST_F(SamplerMultisampleArrayTest, TexelFetchSampler2DMSArray)
{
constexpr char kShaderString[] =
R"(#version 310 es
#extension GL_OES_texture_storage_multisample_2d_array : require
precision highp float;
uniform highp sampler2DMSArray s;
uniform highp isampler2DMSArray is;
uniform highp usampler2DMSArray us;
void main() {
vec4 tex1 = texelFetch(s, ivec3(0, 0, 0), 0);
ivec4 tex2 = texelFetch(is, ivec3(0, 0, 0), 0);
uvec4 tex3 = texelFetch(us, ivec3(0, 0, 0), 0);
})";
if (!compile(kShaderString))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
// Checks whether compiler has parsed the gsampler2DMSArray, textureSize correctly.
TEST_F(SamplerMultisampleArrayTest, TextureSizeSampler2DMSArray)
{
constexpr char kShaderString[] =
R"(#version 310 es
#extension GL_OES_texture_storage_multisample_2d_array : require
precision highp float;
uniform highp sampler2DMSArray s;
uniform highp isampler2DMSArray is;
uniform highp usampler2DMSArray us;
void main() {
ivec3 size = textureSize(s);
size = textureSize(is);
size = textureSize(us);
})";
if (!compile(kShaderString))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
// Check that sampler2DMSArray has no default precision.
TEST_F(SamplerMultisampleArrayTest, NoPrecisionSampler2DMSArray)
{
constexpr char kShaderString[] =
R"(#version 310 es
#extension GL_OES_texture_storage_multisample_2d_array : require
precision highp float;
uniform sampler2DMSArray s;
void main() {})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Check that isampler2DMSArray has no default precision.
TEST_F(SamplerMultisampleArrayTest, NoPrecisionISampler2DMSArray)
{
constexpr char kShaderString[] =
R"(#version 310 es
#extension GL_OES_texture_storage_multisample_2d_array : require
precision highp float;
uniform isampler2DMSArray s;
void main() {})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Check that usampler2DMSArray has no default precision.
TEST_F(SamplerMultisampleArrayTest, NoPrecisionUSampler2DMSArray)
{
constexpr char kShaderString[] =
R"(#version 310 es
#extension GL_OES_texture_storage_multisample_2d_array : require
precision highp float;
uniform usampler2DMSArray s;
void main() {})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
class SamplerMultisampleEXTTest : public SamplerMultisampleTest
{
public:
SamplerMultisampleEXTTest() {}
protected:
void initResources(ShBuiltInResources *resources) override
{
resources->ANGLE_texture_multisample = 1;
}
::GLenum getShaderType() const override { return GL_FRAGMENT_SHADER; }
ShShaderSpec getShaderSpec() const override { return SH_GLES3_SPEC; }
};
// checks ANGLE_texture_multisample is supported in es 3.0
TEST_F(SamplerMultisampleEXTTest, TextureMultisampleEXTEnabled)
{
constexpr char kShaderString[] =
R"(#version 300 es
#extension GL_ANGLE_texture_multisample : require
precision highp float;
uniform highp sampler2DMS s;
uniform highp isampler2DMS is;
uniform highp usampler2DMS us;
void main() {
ivec2 size = textureSize(s);
size = textureSize(is);
size = textureSize(us);
vec4 tex1 = texelFetch(s, ivec2(0, 0), 0);
ivec4 tex2 = texelFetch(is, ivec2(0, 0), 0);
uvec4 tex3 = texelFetch(us, ivec2(0, 0), 0);
})";
if (!compile(kShaderString))
{
FAIL() << "Shader compilation failure, expecting success:\n" << mInfoLog;
}
}
// checks that multisample texture is not supported without ANGLE_texture_multisample in es 3.0
TEST_F(SamplerMultisampleEXTTest, TextureMultisampleEXTDisabled)
{
constexpr char kShaderString[] =
R"(#version 300 es
precision highp float;
uniform highp sampler2DMS s;
uniform highp isampler2DMS is;
uniform highp usampler2DMS us;
void main() {
ivec2 size = textureSize(s);
size = textureSize(is);
size = textureSize(us);
vec4 tex1 = texelFetch(s, ivec2(0, 0), 0);
ivec4 tex2 = texelFetch(is, ivec2(0, 0), 0);
uvec4 tex3 = texelFetch(us, ivec2(0, 0), 0);
})";
if (compile(kShaderString))
{
FAIL() << "Shader compilation success, expecting failure:\n" << mInfoLog;
}
}