Hash :
f0d0408a
Author :
Date :
2018-08-28T16:02:13
Use OES_texture_storage_multisample_2d_array There's an OES extension for multisample texture arrays, OES_texture_storage_multisample_2d_array. Change references from ANGLE_texture_multisample_array to the native extension in the shader compiler. ANGLE still needs to have robust behavior for out-of-range texel fetches that's not found in the original extension, but this does not need to be spelled out in the extension spec. BUG=angleproject:2775 TEST=angle_unittests Change-Id: Ie80ae767cc92ccaf7389af28789f45547f86978f Reviewed-on: https://chromium-review.googlesource.com/1193266 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> 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
//
// Copyright (c) 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)
{
const std::string &shaderString =
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(shaderString))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
// Checks whether compiler has parsed the gsampler2DMS, textureSize correctly.
TEST_F(SamplerMultisampleTest, TextureSizeSampler2DMS)
{
const std::string &shaderString =
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(shaderString))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
// Check that sampler2DMS has no default precision.
TEST_F(SamplerMultisampleTest, NoPrecisionSampler2DMS)
{
const std::string &shaderString =
R"(#version 310 es
precision highp float;
uniform sampler2DMS s;
void main() {})";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Check that isampler2DMS has no default precision.
TEST_F(SamplerMultisampleTest, NoPrecisionISampler2DMS)
{
const std::string &shaderString =
R"(#version 310 es
precision highp float;
uniform isampler2DMS s;
void main() {})";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Check that usampler2DMS has no default precision.
TEST_F(SamplerMultisampleTest, NoPrecisionUSampler2DMS)
{
const std::string &shaderString =
R"(#version 310 es
precision highp float;
uniform usampler2DMS s;
void main() {})";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Negative test: checks that sampler2DMS is not usable in ESSL 3.00.
TEST_F(SamplerMultisampleTest, Sampler2DMSESSL300)
{
const std::string &shaderString =
R"(#version 300 es
precision highp float;
uniform highp sampler2DMS s;
void main() {
})";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Negative test: checks that isampler2DMS is not usable in ESSL 3.00.
TEST_F(SamplerMultisampleTest, ISampler2DMSESSL300)
{
const std::string &shaderString =
R"(#version 300 es
precision highp float;
uniform highp isampler2DMS s;
void main() {
})";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Negative test: checks that usampler2DMS is not usable in ESSL 3.00.
TEST_F(SamplerMultisampleTest, USampler2DMSESSL300)
{
const std::string &shaderString =
R"(#version 300 es
precision highp float;
uniform highp usampler2DMS s;
void main() {
})";
if (compile(shaderString))
{
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)
{
const std::string &shaderString =
R"(#version 310 es
precision highp float;
uniform highp sampler2DMSArray s;
void main() {
})";
if (compile(shaderString))
{
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)
{
const std::string &shaderString =
R"(#version 310 es
precision highp float;
uniform highp isampler2DMSArray s;
void main() {
})";
if (compile(shaderString))
{
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)
{
const std::string &shaderString =
R"(#version 310 es
precision highp float;
uniform highp usampler2DMSArray s;
void main() {
})";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Checks whether compiler has parsed the gsampler2DMSArray, texelfetch correctly.
TEST_F(SamplerMultisampleArrayTest, TexelFetchSampler2DMSArray)
{
const std::string &shaderString =
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(shaderString))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
// Checks whether compiler has parsed the gsampler2DMSArray, textureSize correctly.
TEST_F(SamplerMultisampleArrayTest, TextureSizeSampler2DMSArray)
{
const std::string &shaderString =
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(shaderString))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
// Check that sampler2DMSArray has no default precision.
TEST_F(SamplerMultisampleArrayTest, NoPrecisionSampler2DMSArray)
{
const std::string &shaderString =
R"(#version 310 es
#extension GL_OES_texture_storage_multisample_2d_array : require
precision highp float;
uniform sampler2DMSArray s;
void main() {})";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Check that isampler2DMSArray has no default precision.
TEST_F(SamplerMultisampleArrayTest, NoPrecisionISampler2DMSArray)
{
const std::string &shaderString =
R"(#version 310 es
#extension GL_OES_texture_storage_multisample_2d_array : require
precision highp float;
uniform isampler2DMSArray s;
void main() {})";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}
// Check that usampler2DMSArray has no default precision.
TEST_F(SamplerMultisampleArrayTest, NoPrecisionUSampler2DMSArray)
{
const std::string &shaderString =
R"(#version 310 es
#extension GL_OES_texture_storage_multisample_2d_array : require
precision highp float;
uniform usampler2DMSArray s;
void main() {})";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}