Skip to content

Commit

Permalink
Support multisample arrays in shader programs
Browse files Browse the repository at this point in the history
The added tests check that using textureSize() and texelFetch() on
textures with a fixed point format return expected results. texelFetch
is also covered for integer format textures.

dEQP GLES 3.1 tests also cover a variety of multisampled array texture
formats.

BUG=angleproject:2775
TEST=angle_end2end_tests, angle_deqp_gles31_tests

Change-Id: I99b422e24b39e3563ed72f0fb85c9c1907df807d
Reviewed-on: https://chromium-review.googlesource.com/1196521
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
  • Loading branch information
Olli Etuaho authored and Commit Bot committed Sep 6, 2018
1 parent 155bfd1 commit dff32a0
Show file tree
Hide file tree
Showing 16 changed files with 357 additions and 95 deletions.
2 changes: 1 addition & 1 deletion scripts/run_code_generation_hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,5 @@
"proc table:src/libGLESv2/proc_table_data.json":
"2c452ae503df669222e85961ab75fb22",
"uniform type:src/common/gen_uniform_type_table.py":
"261d239af143eeb4bd3d69cdd53ee096"
"59cb4ffd0f584c4bd37f2f4ff59a2b93"
}
17 changes: 17 additions & 0 deletions src/common/PackedEnums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ TextureType SamplerTypeToTextureType(GLenum samplerType)
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
return TextureType::_2DMultisample;

case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
return TextureType::_2DMultisampleArray;

case GL_SAMPLER_2D_RECT_ANGLE:
return TextureType::Rectangle;

Expand All @@ -151,6 +156,18 @@ TextureType SamplerTypeToTextureType(GLenum samplerType)
}
}

bool IsMultisampled(gl::TextureType type)
{
switch (type)
{
case gl::TextureType::_2DMultisample:
case gl::TextureType::_2DMultisampleArray:
return true;
default:
return false;
}
}

} // namespace gl

namespace egl
Expand Down
2 changes: 2 additions & 0 deletions src/common/PackedEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ using ShaderMap = angle::PackedEnumMap<ShaderType, T>;

TextureType SamplerTypeToTextureType(GLenum samplerType);

bool IsMultisampled(gl::TextureType type);

} // namespace gl

namespace egl
Expand Down
4 changes: 4 additions & 0 deletions src/common/gen_uniform_type_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"GL_INT_SAMPLER_2D",
"GL_INT_SAMPLER_2D_ARRAY",
"GL_INT_SAMPLER_2D_MULTISAMPLE",
"GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY",
"GL_INT_SAMPLER_3D",
"GL_INT_SAMPLER_CUBE",
"GL_INT_VEC2",
Expand All @@ -50,6 +51,7 @@
"GL_SAMPLER_2D_ARRAY",
"GL_SAMPLER_2D_ARRAY_SHADOW",
"GL_SAMPLER_2D_MULTISAMPLE",
"GL_SAMPLER_2D_MULTISAMPLE_ARRAY",
"GL_SAMPLER_2D_RECT_ANGLE",
"GL_SAMPLER_2D_SHADOW",
"GL_SAMPLER_3D",
Expand All @@ -65,6 +67,7 @@
"GL_UNSIGNED_INT_SAMPLER_2D",
"GL_UNSIGNED_INT_SAMPLER_2D_ARRAY",
"GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE",
"GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY",
"GL_UNSIGNED_INT_SAMPLER_3D",
"GL_UNSIGNED_INT_SAMPLER_CUBE",
"GL_UNSIGNED_INT_VEC2",
Expand All @@ -79,6 +82,7 @@
"2D_ARRAY": "2D_ARRAY",
"2D_ARRAY_SHADOW": "2D_ARRAY",
"2D_MULTISAMPLE": "2D_MULTISAMPLE",
"2D_MULTISAMPLE_ARRAY": "2D_MULTISAMPLE_ARRAY",
"2D_RECT_ANGLE": "2D",
"2D_SHADOW": "2D",
"3D": "3D",
Expand Down
73 changes: 43 additions & 30 deletions src/common/uniform_type_info_autogen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace gl

namespace
{
constexpr std::array<UniformTypeInfo, 59> kInfoTable = {
constexpr std::array<UniformTypeInfo, 62> kInfoTable = {
{{GL_NONE, GL_NONE, GL_NONE, GL_NONE, GL_NONE, 0, 0, 0, 0, 0 * 0, 0 * 0, false, false, false},
{GL_BOOL, GL_BOOL, GL_NONE, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4,
sizeof(GLint) * 1, false, false, false},
Expand Down Expand Up @@ -78,6 +78,8 @@ constexpr std::array<UniformTypeInfo, 59> kInfoTable = {
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
{GL_INT_SAMPLER_2D_MULTISAMPLE, GL_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE, GL_NONE, 1, 1, 1,
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
{GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_INT, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_NONE,
GL_NONE, 1, 1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
{GL_INT_SAMPLER_3D, GL_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
{GL_INT_SAMPLER_CUBE, GL_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
Expand All @@ -96,6 +98,8 @@ constexpr std::array<UniformTypeInfo, 59> kInfoTable = {
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
{GL_SAMPLER_2D_MULTISAMPLE, GL_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE, GL_NONE, 1, 1, 1,
sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
{GL_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_INT, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_NONE, GL_NONE, 1,
1, 1, sizeof(GLint), sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
{GL_SAMPLER_2D_RECT_ANGLE, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
sizeof(GLint) * 4, sizeof(GLint) * 1, true, false, false},
{GL_SAMPLER_2D_SHADOW, GL_INT, GL_TEXTURE_2D, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLint),
Expand Down Expand Up @@ -126,6 +130,9 @@ constexpr std::array<UniformTypeInfo, 59> kInfoTable = {
1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
{GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, GL_UNSIGNED_INT, GL_TEXTURE_2D_MULTISAMPLE, GL_NONE,
GL_NONE, 1, 1, 1, sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
{GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GL_UNSIGNED_INT,
GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_NONE, GL_NONE, 1, 1, 1, sizeof(GLuint),
sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
{GL_UNSIGNED_INT_SAMPLER_3D, GL_UNSIGNED_INT, GL_TEXTURE_3D, GL_NONE, GL_NONE, 1, 1, 1,
sizeof(GLuint), sizeof(GLuint) * 4, sizeof(GLuint) * 1, true, false, false},
{GL_UNSIGNED_INT_SAMPLER_CUBE, GL_UNSIGNED_INT, GL_TEXTURE_CUBE_MAP, GL_NONE, GL_NONE, 1, 1, 1,
Expand Down Expand Up @@ -201,64 +208,70 @@ size_t GetTypeInfoIndex(GLenum uniformType)
return 28;
case GL_INT_SAMPLER_2D_MULTISAMPLE:
return 29;
case GL_INT_SAMPLER_3D:
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
return 30;
case GL_INT_SAMPLER_CUBE:
case GL_INT_SAMPLER_3D:
return 31;
case GL_INT_VEC2:
case GL_INT_SAMPLER_CUBE:
return 32;
case GL_INT_VEC3:
case GL_INT_VEC2:
return 33;
case GL_INT_VEC4:
case GL_INT_VEC3:
return 34;
case GL_SAMPLER_2D:
case GL_INT_VEC4:
return 35;
case GL_SAMPLER_2D_ARRAY:
case GL_SAMPLER_2D:
return 36;
case GL_SAMPLER_2D_ARRAY_SHADOW:
case GL_SAMPLER_2D_ARRAY:
return 37;
case GL_SAMPLER_2D_MULTISAMPLE:
case GL_SAMPLER_2D_ARRAY_SHADOW:
return 38;
case GL_SAMPLER_2D_RECT_ANGLE:
case GL_SAMPLER_2D_MULTISAMPLE:
return 39;
case GL_SAMPLER_2D_SHADOW:
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
return 40;
case GL_SAMPLER_3D:
case GL_SAMPLER_2D_RECT_ANGLE:
return 41;
case GL_SAMPLER_CUBE:
case GL_SAMPLER_2D_SHADOW:
return 42;
case GL_SAMPLER_CUBE_SHADOW:
case GL_SAMPLER_3D:
return 43;
case GL_SAMPLER_EXTERNAL_OES:
case GL_SAMPLER_CUBE:
return 44;
case GL_UNSIGNED_INT:
case GL_SAMPLER_CUBE_SHADOW:
return 45;
case GL_UNSIGNED_INT_ATOMIC_COUNTER:
case GL_SAMPLER_EXTERNAL_OES:
return 46;
case GL_UNSIGNED_INT_IMAGE_2D:
case GL_UNSIGNED_INT:
return 47;
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
case GL_UNSIGNED_INT_ATOMIC_COUNTER:
return 48;
case GL_UNSIGNED_INT_IMAGE_3D:
case GL_UNSIGNED_INT_IMAGE_2D:
return 49;
case GL_UNSIGNED_INT_IMAGE_CUBE:
case GL_UNSIGNED_INT_IMAGE_2D_ARRAY:
return 50;
case GL_UNSIGNED_INT_SAMPLER_2D:
case GL_UNSIGNED_INT_IMAGE_3D:
return 51;
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
case GL_UNSIGNED_INT_IMAGE_CUBE:
return 52;
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
case GL_UNSIGNED_INT_SAMPLER_2D:
return 53;
case GL_UNSIGNED_INT_SAMPLER_3D:
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
return 54;
case GL_UNSIGNED_INT_SAMPLER_CUBE:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
return 55;
case GL_UNSIGNED_INT_VEC2:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
return 56;
case GL_UNSIGNED_INT_VEC3:
case GL_UNSIGNED_INT_SAMPLER_3D:
return 57;
case GL_UNSIGNED_INT_VEC4:
case GL_UNSIGNED_INT_SAMPLER_CUBE:
return 58;
case GL_UNSIGNED_INT_VEC2:
return 59;
case GL_UNSIGNED_INT_VEC3:
return 60;
case GL_UNSIGNED_INT_VEC4:
return 61;
default:
UNREACHABLE();
return 0;
Expand Down
15 changes: 15 additions & 0 deletions src/common/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,19 @@ GLenum VariableComponentType(GLenum type)
case GL_SAMPLER_2D_ARRAY:
case GL_SAMPLER_EXTERNAL_OES:
case GL_SAMPLER_2D_MULTISAMPLE:
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_INT_SAMPLER_2D:
case GL_INT_SAMPLER_3D:
case GL_INT_SAMPLER_CUBE:
case GL_INT_SAMPLER_2D_ARRAY:
case GL_INT_SAMPLER_2D_MULTISAMPLE:
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D:
case GL_UNSIGNED_INT_SAMPLER_3D:
case GL_UNSIGNED_INT_SAMPLER_CUBE:
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_SAMPLER_2D_SHADOW:
case GL_SAMPLER_CUBE_SHADOW:
case GL_SAMPLER_2D_ARRAY_SHADOW:
Expand Down Expand Up @@ -259,16 +262,19 @@ int VariableRowCount(GLenum type)
case GL_SAMPLER_EXTERNAL_OES:
case GL_SAMPLER_2D_RECT_ANGLE:
case GL_SAMPLER_2D_MULTISAMPLE:
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_INT_SAMPLER_2D:
case GL_INT_SAMPLER_3D:
case GL_INT_SAMPLER_CUBE:
case GL_INT_SAMPLER_2D_ARRAY:
case GL_INT_SAMPLER_2D_MULTISAMPLE:
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D:
case GL_UNSIGNED_INT_SAMPLER_3D:
case GL_UNSIGNED_INT_SAMPLER_CUBE:
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_SAMPLER_2D_SHADOW:
case GL_SAMPLER_CUBE_SHADOW:
case GL_SAMPLER_2D_ARRAY_SHADOW:
Expand Down Expand Up @@ -320,18 +326,21 @@ int VariableColumnCount(GLenum type)
case GL_SAMPLER_CUBE:
case GL_SAMPLER_2D_ARRAY:
case GL_SAMPLER_2D_MULTISAMPLE:
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_INT_SAMPLER_2D:
case GL_INT_SAMPLER_3D:
case GL_INT_SAMPLER_CUBE:
case GL_INT_SAMPLER_2D_ARRAY:
case GL_INT_SAMPLER_2D_MULTISAMPLE:
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_SAMPLER_EXTERNAL_OES:
case GL_SAMPLER_2D_RECT_ANGLE:
case GL_UNSIGNED_INT_SAMPLER_2D:
case GL_UNSIGNED_INT_SAMPLER_3D:
case GL_UNSIGNED_INT_SAMPLER_CUBE:
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_SAMPLER_2D_SHADOW:
case GL_SAMPLER_CUBE_SHADOW:
case GL_SAMPLER_2D_ARRAY_SHADOW:
Expand Down Expand Up @@ -390,17 +399,20 @@ bool IsSamplerType(GLenum type)
case GL_SAMPLER_2D_ARRAY:
case GL_SAMPLER_EXTERNAL_OES:
case GL_SAMPLER_2D_MULTISAMPLE:
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_SAMPLER_2D_RECT_ANGLE:
case GL_INT_SAMPLER_2D:
case GL_INT_SAMPLER_3D:
case GL_INT_SAMPLER_CUBE:
case GL_INT_SAMPLER_2D_ARRAY:
case GL_INT_SAMPLER_2D_MULTISAMPLE:
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D:
case GL_UNSIGNED_INT_SAMPLER_3D:
case GL_UNSIGNED_INT_SAMPLER_CUBE:
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_SAMPLER_2D_SHADOW:
case GL_SAMPLER_CUBE_SHADOW:
case GL_SAMPLER_2D_ARRAY_SHADOW:
Expand Down Expand Up @@ -652,17 +664,20 @@ int VariableSortOrder(GLenum type)
case GL_SAMPLER_2D_RECT_ANGLE:
case GL_SAMPLER_2D_ARRAY:
case GL_SAMPLER_2D_MULTISAMPLE:
case GL_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_SAMPLER_3D:
case GL_INT_SAMPLER_2D:
case GL_INT_SAMPLER_3D:
case GL_INT_SAMPLER_CUBE:
case GL_INT_SAMPLER_2D_ARRAY:
case GL_INT_SAMPLER_2D_MULTISAMPLE:
case GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D:
case GL_UNSIGNED_INT_SAMPLER_3D:
case GL_UNSIGNED_INT_SAMPLER_CUBE:
case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case GL_SAMPLER_2D_SHADOW:
case GL_SAMPLER_2D_ARRAY_SHADOW:
case GL_SAMPLER_CUBE_SHADOW:
Expand Down
6 changes: 6 additions & 0 deletions src/compiler/translator/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ GLenum GLVariableType(const TType &type)
return GL_SAMPLER_2D_ARRAY;
case EbtSampler2DMS:
return GL_SAMPLER_2D_MULTISAMPLE;
case EbtSampler2DMSArray:
return GL_SAMPLER_2D_MULTISAMPLE_ARRAY;
case EbtISampler2D:
return GL_INT_SAMPLER_2D;
case EbtISampler3D:
Expand All @@ -385,6 +387,8 @@ GLenum GLVariableType(const TType &type)
return GL_INT_SAMPLER_2D_ARRAY;
case EbtISampler2DMS:
return GL_INT_SAMPLER_2D_MULTISAMPLE;
case EbtISampler2DMSArray:
return GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY;
case EbtUSampler2D:
return GL_UNSIGNED_INT_SAMPLER_2D;
case EbtUSampler3D:
Expand All @@ -395,6 +399,8 @@ GLenum GLVariableType(const TType &type)
return GL_UNSIGNED_INT_SAMPLER_2D_ARRAY;
case EbtUSampler2DMS:
return GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE;
case EbtUSampler2DMSArray:
return GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY;
case EbtSampler2DShadow:
return GL_SAMPLER_2D_SHADOW;
case EbtSamplerCubeShadow:
Expand Down
2 changes: 2 additions & 0 deletions src/libANGLE/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ Compiler::Compiler(rx::GLImplFactory *implFactory, const ContextState &state)
mResources.OES_EGL_image_external_essl3 = extensions.eglImageExternalEssl3;
mResources.NV_EGL_stream_consumer_external = extensions.eglStreamConsumerExternal;
mResources.ARB_texture_rectangle = extensions.textureRectangle;
mResources.OES_texture_storage_multisample_2d_array =
extensions.textureStorageMultisample2DArray;
// TODO: use shader precision caps to determine if high precision is supported?
mResources.FragmentPrecisionHigh = 1;
mResources.EXT_frag_depth = extensions.fragDepth;
Expand Down
1 change: 1 addition & 0 deletions src/libANGLE/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7475,6 +7475,7 @@ bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *nu
case GL_SHADER_STORAGE_BUFFER_BINDING:
case GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT:
case GL_TEXTURE_BINDING_2D_MULTISAMPLE:
case GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY:
*type = GL_INT;
*numParams = 1;
return true;
Expand Down
5 changes: 5 additions & 0 deletions src/libANGLE/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2407,6 +2407,11 @@ Error State::getIntegerv(const Context *context, GLenum pname, GLint *params)
*params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
TextureType::_2DMultisample);
break;
case GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY:
ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
*params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
TextureType::_2DMultisampleArray);
break;
case GL_TEXTURE_BINDING_EXTERNAL_OES:
ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits);
*params = getSamplerTextureId(static_cast<unsigned int>(mActiveSampler),
Expand Down
Loading

0 comments on commit dff32a0

Please sign in to comment.