Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Graphics/GraphicsEngineOpenGL/include/GLStubsAndroid.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@
# define GL_MIRROR_CLAMP_TO_EDGE 0
#endif

// Define unsupported texture parameters
#ifndef GL_DEPTH_STENCIL_TEXTURE_MODE
# define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA
#endif

#ifndef GL_STENCIL_INDEX
# define GL_STENCIL_INDEX 0x1901
#endif

// Define unsupported bind points
#ifndef GL_ARB_draw_indirect
# define GL_ARB_draw_indirect 1
Expand Down
8 changes: 8 additions & 0 deletions Graphics/GraphicsEngineOpenGL/include/GLStubsIOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,14 @@
# define GL_DEPTH_CLAMP 0x864F
#endif

// Define unsupported texture parameters
#ifndef GL_DEPTH_STENCIL_TEXTURE_MODE
# define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA
#endif

#ifndef GL_STENCIL_INDEX
# define GL_STENCIL_INDEX 0x1901
#endif

// Define unsupported formats for OpenGL ES
#ifndef GL_RGBA16
Expand Down
4 changes: 2 additions & 2 deletions Graphics/GraphicsEngineOpenGL/src/GLTypeConversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class FormatToGLInternalTexFormatMap
m_FmtToGLFmtMap[TEX_FORMAT_R32G8X24_TYPELESS] = GL_DEPTH32F_STENCIL8;
m_FmtToGLFmtMap[TEX_FORMAT_D32_FLOAT_S8X24_UINT] = GL_DEPTH32F_STENCIL8;
m_FmtToGLFmtMap[TEX_FORMAT_R32_FLOAT_X8X24_TYPELESS]=GL_DEPTH32F_STENCIL8;
m_FmtToGLFmtMap[TEX_FORMAT_X32_TYPELESS_G8X24_UINT]= 0;//GL_DEPTH32F_STENCIL8;
m_FmtToGLFmtMap[TEX_FORMAT_X32_TYPELESS_G8X24_UINT]= GL_DEPTH32F_STENCIL8;

m_FmtToGLFmtMap[TEX_FORMAT_RGB10A2_TYPELESS] = GL_RGB10_A2;
m_FmtToGLFmtMap[TEX_FORMAT_RGB10A2_UNORM] = GL_RGB10_A2;
Expand Down Expand Up @@ -102,7 +102,7 @@ class FormatToGLInternalTexFormatMap
m_FmtToGLFmtMap[TEX_FORMAT_R24G8_TYPELESS] = GL_DEPTH24_STENCIL8;
m_FmtToGLFmtMap[TEX_FORMAT_D24_UNORM_S8_UINT] = GL_DEPTH24_STENCIL8;
m_FmtToGLFmtMap[TEX_FORMAT_R24_UNORM_X8_TYPELESS] = GL_DEPTH24_STENCIL8;
m_FmtToGLFmtMap[TEX_FORMAT_X24_TYPELESS_G8_UINT] = 0;//GL_DEPTH24_STENCIL8;
m_FmtToGLFmtMap[TEX_FORMAT_X24_TYPELESS_G8_UINT] = GL_DEPTH24_STENCIL8;

m_FmtToGLFmtMap[TEX_FORMAT_RG8_TYPELESS] = GL_RG8;
m_FmtToGLFmtMap[TEX_FORMAT_RG8_UNORM] = GL_RG8;
Expand Down
7 changes: 5 additions & 2 deletions Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1138,13 +1138,16 @@ void RenderDeviceGLImpl::FlagSupportedTexFormats()
{
const RenderDeviceInfo& DeviceInfo = GetDeviceInfo();
const bool bDekstopGL = DeviceInfo.Type == RENDER_DEVICE_TYPE_GL;
const bool bGL430OrAbove = DeviceInfo.Type == RENDER_DEVICE_TYPE_GL && DeviceInfo.APIVersion >= Version{4, 3};
const bool bGLES30OrAbove = DeviceInfo.Type == RENDER_DEVICE_TYPE_GLES && DeviceInfo.APIVersion >= Version{3, 0};
const bool bGLES31OrAbove = DeviceInfo.Type == RENDER_DEVICE_TYPE_GLES && DeviceInfo.APIVersion >= Version{3, 1};

const bool bRGTC = CheckExtension("GL_EXT_texture_compression_rgtc") || CheckExtension("GL_ARB_texture_compression_rgtc");
const bool bBPTC = CheckExtension("GL_EXT_texture_compression_bptc") || CheckExtension("GL_ARB_texture_compression_bptc");
const bool bS3TC = CheckExtension("GL_EXT_texture_compression_s3tc") || CheckExtension("GL_WEBGL_compressed_texture_s3tc");
const bool bTexNorm16 = bDekstopGL || CheckExtension("GL_EXT_texture_norm16"); // Only for ES3.1+
const bool bTexSwizzle = bDekstopGL || bGLES30OrAbove || CheckExtension("GL_ARB_texture_swizzle");
const bool bStencilTex = bGL430OrAbove || bGLES31OrAbove || CheckExtension("GL_ARB_stencil_texturing");

#if PLATFORM_WEB
const bool bETC2 = CheckExtension("GL_WEBGL_compressed_texture_etc");
Expand Down Expand Up @@ -1253,7 +1256,7 @@ void RenderDeviceGLImpl::FlagSupportedTexFormats()
FlagFormat(TEX_FORMAT_R32G8X24_TYPELESS, true );
FlagFormat(TEX_FORMAT_D32_FLOAT_S8X24_UINT, true, BIND_DEPTH_STENCIL );
FlagFormat(TEX_FORMAT_R32_FLOAT_X8X24_TYPELESS, true, TexBindFlags, bDekstopGL);
FlagFormat(TEX_FORMAT_X32_TYPELESS_G8X24_UINT, false );
FlagFormat(TEX_FORMAT_X32_TYPELESS_G8X24_UINT, bStencilTex, BIND_SHADER_RESOURCE, false);
FlagFormat(TEX_FORMAT_RGB10A2_TYPELESS, true );
FlagFormat(TEX_FORMAT_RGB10A2_UNORM, true, BindSrvRtvUav, true);
FlagFormat(TEX_FORMAT_RGB10A2_UINT, true, BindSrvRtvUav );
Expand All @@ -1278,7 +1281,7 @@ void RenderDeviceGLImpl::FlagSupportedTexFormats()
FlagFormat(TEX_FORMAT_R24G8_TYPELESS, true );
FlagFormat(TEX_FORMAT_D24_UNORM_S8_UINT, true, BIND_DEPTH_STENCIL );
FlagFormat(TEX_FORMAT_R24_UNORM_X8_TYPELESS, true, TexBindFlags, true);
FlagFormat(TEX_FORMAT_X24_TYPELESS_G8_UINT, false );
FlagFormat(TEX_FORMAT_X24_TYPELESS_G8_UINT, bStencilTex, BIND_SHADER_RESOURCE, false);
FlagFormat(TEX_FORMAT_RG8_TYPELESS, true );
FlagFormat(TEX_FORMAT_RG8_UNORM, true, U8BindFlags, true);
FlagFormat(TEX_FORMAT_RG8_UINT, true, UI8BindFlags );
Expand Down
22 changes: 22 additions & 0 deletions Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,28 @@ void TextureBaseGL::CreateViewInternal(const TextureViewDesc& OrigViewDesc, ITex
DEV_CHECK_GL_ERROR_AND_THROW("Failed to create texture view");
pViewOGL->SetBindTarget(GLViewTarget);

if (ViewDesc.Format == TEX_FORMAT_X24_TYPELESS_G8_UINT || ViewDesc.Format == TEX_FORMAT_X32_TYPELESS_G8X24_UINT)
{
const TextureFormatInfo& FmtInfo = pDeviceGLImpl->GetTextureFormatInfo(ViewDesc.Format);

if (FmtInfo.Supported)
{
RefCntAutoPtr<DeviceContextGLImpl> pDeviceContext = pDeviceGLImpl->GetImmediateContext(0);
VERIFY(pDeviceContext, "Immediate device context has been destroyed");
GLContextState& GLState = pDeviceContext->GetContextState();

GLState.BindTexture(-1, GLViewTarget, pViewOGL->GetHandle());
glTexParameteri(GLViewTarget, GL_DEPTH_STENCIL_TEXTURE_MODE, GL_STENCIL_INDEX);
Comment thread
hzqst marked this conversation as resolved.
DEV_CHECK_GL_ERROR("Failed to set GL_DEPTH_STENCIL_TEXTURE_MODE texture parameter");
GLState.BindTexture(-1, GLViewTarget, GLObjectWrappers::GLTextureObj::Null());
}
Comment thread
hzqst marked this conversation as resolved.
else
{
// Throw an error if the format is not supported
LOG_ERROR_AND_THROW("Format ", GetTextureFormatAttribs(ViewDesc.Format).Name, " is not supported");
}
}

if (!IsIdentityComponentMapping(ViewDesc.Swizzle))
{
RefCntAutoPtr<DeviceContextGLImpl> pDeviceContext = pDeviceGLImpl->GetImmediateContext(0);
Expand Down
Loading