Commit 7a92d958 by Jeff Vigil Committed by Commit Bot

Implement GL_OES_texture_stencil8

Add extension to Caps and code gen files. Add to Validation of TexImage Add all the autogen for new extension Fix swizzle for stencil only Add LoadFunction Fix formatutils Add validation Test: angle_deqp_egl_tests --deqp-case=GLES31.functional.stencil_texturing.format.stencil_index8_2d Bug: angleproject:3231 Change-Id: Id59c7d183ea1658732887e99637d9c8faab938e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2404327Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
parent 513095e9
......@@ -4,7 +4,7 @@
"src/libANGLE/renderer/gen_load_functions_table.py":
"9b4ea6bcb4eb4c43f48a097a9ec920f1",
"src/libANGLE/renderer/load_functions_data.json":
"11413aef6add240ad2dbc4e55543f3ac",
"142960e2ff434fa41276c96bf095f2ac",
"src/libANGLE/renderer/load_functions_table_autogen.cpp":
"e0a3003fcb3ec56559d879ab474bdfeb"
"7de6ba06d86acae6c2662c28e697b42b"
}
\ No newline at end of file
{
"src/libANGLE/es3_format_type_combinations.json":
"3c4288394162b20f5ccdc29d3b4eecbb",
"b7d0c224864b87afd09a557a0099c2bb",
"src/libANGLE/format_map_autogen.cpp":
"f9ed893aeb8aa9a11febc66a8d4f2564",
"93e8ea9cae3d1b2a0a469bb2290a93d0",
"src/libANGLE/format_map_data.json":
"2e5db33b6d6b142b569123f614f3ddb7",
"src/libANGLE/gen_format_map.py":
......
......@@ -1031,6 +1031,7 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_APPLE_clip_distance"] = enableableExtension(&Extensions::clipDistanceAPPLE);
map["GL_EXT_EGL_image_array"] = enableableExtension(&Extensions::eglImageArray);
map["GL_EXT_buffer_storage"] = enableableExtension(&Extensions::bufferStorageEXT);
map["GL_OES_texture_stencil8"] = enableableExtension(&Extensions::stencilIndex8);
// GLES1 extensions
map["GL_OES_point_size_array"] = enableableExtension(&Extensions::pointSizeArrayOES);
map["GL_OES_texture_cube_map"] = enableableExtension(&Extensions::textureCubeMapOES);
......
......@@ -176,5 +176,9 @@
[
[ "GL_RGBA", "GL_RGBA", "GL_UNSIGNED_INT_2_10_10_10_REV" ],
[ "GL_RGB", "GL_RGB", "GL_UNSIGNED_INT_2_10_10_10_REV" ]
],
"From GL_OES_texture_stencil8":
[
[ "GL_STENCIL_INDEX8", "GL_STENCIL_INDEX", "GL_UNSIGNED_BYTE" ]
]
}
......@@ -608,6 +608,7 @@ bool ValidES3Format(GLenum format)
case GL_RG_INTEGER:
case GL_SRGB_ALPHA_EXT:
case GL_SRGB_EXT:
case GL_STENCIL_INDEX:
return true;
default:
......@@ -1397,6 +1398,37 @@ bool ValidES3FormatCombination(GLenum format, GLenum type, GLenum internalFormat
}
break;
case GL_DEPTH_STENCIL:
switch (type)
{
case GL_UNSIGNED_INT_24_8:
{
switch (internalFormat)
{
case GL_DEPTH_STENCIL:
case GL_DEPTH24_STENCIL8:
return true;
default:
break;
}
break;
}
case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
{
switch (internalFormat)
{
case GL_DEPTH32F_STENCIL8:
return true;
default:
break;
}
break;
}
default:
break;
}
break;
case GL_RED:
switch (type)
{
......@@ -1543,26 +1575,14 @@ bool ValidES3FormatCombination(GLenum format, GLenum type, GLenum internalFormat
}
break;
case GL_DEPTH_STENCIL:
case GL_STENCIL_INDEX:
switch (type)
{
case GL_UNSIGNED_INT_24_8:
{
switch (internalFormat)
{
case GL_DEPTH_STENCIL:
case GL_DEPTH24_STENCIL8:
return true;
default:
break;
}
break;
}
case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
case GL_UNSIGNED_BYTE:
{
switch (internalFormat)
{
case GL_DEPTH32F_STENCIL8:
case GL_STENCIL_INDEX8:
return true;
default:
break;
......
......@@ -992,8 +992,8 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
// - Multisampled buffer are disallowed for non-normalized integer component types and we want to support it for STENCIL_INDEX8
// - All other stencil formats (all depth-stencil) are either float or normalized
// - It affects only validation of internalformat in RenderbufferStorageMultisample.
// | Internal format |sized|D |S |X | Format | Type | Component type | Texture supported | Filterable | Texture attachment | Renderbuffer | Blend
AddDepthStencilFormat(&map, GL_STENCIL_INDEX8, true, 0, 8, 0, GL_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, NeverSupported, RequireES<1, 0>, RequireES<1, 0>, RequireES<1, 0>);
// | Internal format |sized|D |S |X | Format | Type | Component type | Texture supported | Filterable | Texture attachment | Renderbuffer | Blend
AddDepthStencilFormat(&map, GL_STENCIL_INDEX8, true, 0, 8, 0, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireESOrExt<1, 0, &Extensions::stencilIndex8>, NeverSupported, RequireESOrExt<1, 0, &Extensions::stencilIndex8>, RequireES<1, 0>, RequireES<1, 0>);
// From GL_ANGLE_lossy_etc_decode
// | Internal format |W |H |D |BS |CC| SRGB | Texture supported | Filterable | Texture attachment | Renderbuffer | Blend
......
......@@ -639,6 +639,9 @@
}
},
"GL_STENCIL_INDEX8": {
"S8_UINT": {
"GL_UNSIGNED_BYTE": "LoadToNative<GLubyte, 1>"
},
"NONE": {
"GL_UNSIGNED_BYTE": "UnimplementedLoadFunction"
}
......
......@@ -3126,6 +3126,18 @@ LoadImageFunctionInfo SRGB8_ALPHA8_to_R8G8B8A8_UNORM_SRGB(GLenum type)
}
}
LoadImageFunctionInfo STENCIL_INDEX8_to_S8_UINT(GLenum type)
{
switch (type)
{
case GL_UNSIGNED_BYTE:
return LoadImageFunctionInfo(LoadToNative<GLubyte, 1>, false);
default:
UNREACHABLE();
return LoadImageFunctionInfo(UnreachableLoadFunction, true);
}
}
LoadImageFunctionInfo STENCIL_INDEX8_to_default(GLenum type)
{
switch (type)
......@@ -4508,7 +4520,15 @@ LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, FormatID angleFormat)
break;
}
case GL_STENCIL_INDEX8:
return STENCIL_INDEX8_to_default;
{
switch (angleFormat)
{
case FormatID::S8_UINT:
return STENCIL_INDEX8_to_S8_UINT;
default:
return STENCIL_INDEX8_to_default;
}
}
default:
break;
......
......@@ -421,13 +421,12 @@ gl::SwizzleState GetFormatSwizzle(const ContextVk *contextVk,
{
if (angleFormat.hasDepthOrStencilBits())
{
bool hasRed = angleFormat.depthBits > 0;
// In OES_depth_texture/ARB_depth_texture, depth
// textures are treated as luminance.
// If the internalformat was not sized, use OES_depth_texture behavior
bool hasGB = hasRed && !sized;
bool hasGB = (angleFormat.depthBits > 0) && !sized;
internalSwizzle.swizzleRed = hasRed ? GL_RED : GL_ZERO;
internalSwizzle.swizzleRed = GL_RED;
internalSwizzle.swizzleGreen = hasGB ? GL_RED : GL_ZERO;
internalSwizzle.swizzleBlue = hasGB ? GL_RED : GL_ZERO;
internalSwizzle.swizzleAlpha = GL_ONE;
......
......@@ -1416,6 +1416,16 @@ bool ValidateES2TexImageParametersBase(const Context *context,
return false;
}
break;
case GL_STENCIL_INDEX:
switch (type)
{
case GL_UNSIGNED_BYTE:
break;
default:
context->validationError(GL_INVALID_OPERATION, kMismatchedTypeAndFormat);
return false;
}
break;
default:
context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false;
......@@ -1543,6 +1553,35 @@ bool ValidateES2TexImageParametersBase(const Context *context,
}
}
break;
case GL_STENCIL_INDEX:
if (!context->getExtensions().stencilIndex8)
{
context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
return false;
}
switch (target)
{
case TextureTarget::_2D:
case TextureTarget::_2DArray:
case TextureTarget::CubeMapNegativeX:
case TextureTarget::CubeMapNegativeY:
case TextureTarget::CubeMapNegativeZ:
case TextureTarget::CubeMapPositiveX:
case TextureTarget::CubeMapPositiveY:
case TextureTarget::CubeMapPositiveZ:
break;
default:
context->validationError(GL_INVALID_OPERATION, kMismatchedTargetAndFormat);
return false;
}
if (internalformat != GL_STENCIL_INDEX8)
{
context->validationError(GL_INVALID_OPERATION, kMismatchedTargetAndFormat);
return false;
}
break;
default:
break;
}
......@@ -1627,6 +1666,14 @@ bool ValidateES2TexImageParametersBase(const Context *context,
}
break;
case GL_STENCIL_INDEX8:
if (!context->getExtensions().stencilIndex8)
{
context->validationError(GL_INVALID_ENUM, kInvalidFormat);
return false;
}
break;
case GL_RED:
case GL_RG:
if (!context->getExtensions().textureRG)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment