Skip to content

Commit 948c723

Browse files
Minor updates on iOS platform
1 parent 9856f79 commit 948c723

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ elseif(PLATFORM_MACOS)
6262
set(GL_SUPPORTED TRUE CACHE INTERNAL "OpenGL supported on MacOS platform")
6363
target_compile_definitions(BuildSettings INTERFACE PLATFORM_MACOS=1)
6464
elseif(PLATFORM_IOS)
65-
set(GL_SUPPORTED TRUE CACHE INTERNAL "OpenGLES supported on iOS platform")
65+
set(GLES_SUPPORTED TRUE CACHE INTERNAL "OpenGLES supported on iOS platform")
6666
target_compile_definitions(BuildSettings INTERFACE PLATFORM_IOS=1)
6767
else()
6868
message(FATAL_ERROR "No PLATFORM_XXX variable defined. Make sure that 'DiligentCore' folder is processed first")

Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ TextureBaseGL::TextureBaseGL(IReferenceCounters *pRefCounters,
5252
LOG_ERROR_AND_THROW("Static Texture must be initialized with data at creation time");
5353
}
5454

55-
static GLenum GetTextureInternalFormat(DeviceContextGLImpl *pDeviceContextGL, GLenum BindTarget, const GLObjectWrappers::GLTextureObj& GLTex)
55+
static GLenum GetTextureInternalFormat(DeviceContextGLImpl *pDeviceContextGL, GLenum BindTarget, const GLObjectWrappers::GLTextureObj& GLTex, TEXTURE_FORMAT TexFmtFromDesc)
5656
{
5757
auto &ContextState = pDeviceContextGL->GetContextState();
5858
ContextState.BindTexture(-1, BindTarget, GLTex);
@@ -66,8 +66,12 @@ static GLenum GetTextureInternalFormat(DeviceContextGLImpl *pDeviceContextGL, GL
6666
glGetTexLevelParameteriv(QueryBindTarget, 0, GL_TEXTURE_INTERNAL_FORMAT, &GlFormat);
6767
CHECK_GL_ERROR( "Failed to get texture format through glGetTexLevelParameteriv()" );
6868
VERIFY(GlFormat != 0, "Unable to get texture format");
69+
VERIFY(TexFmtFromDesc == TEX_FORMAT_UNKNOWN || GlFormat == TexFormatToGLInternalTexFormat(TexFmtFromDesc), "Texture format does not match the format specified by the texture description");
6970
#else
70-
UNSUPPORTED("Texture format query is not supported");
71+
if(TexFmtFromDesc != TEX_FORMAT_UNKNOWN)
72+
GlFormat = TexFormatToGLInternalTexFormat(TexFmtFromDesc);
73+
else
74+
UNSUPPORTED("Texture format cannot be queried and must be provided by the texture description");
7175
#endif
7276
ContextState.BindTexture(-1, BindTarget, GLObjectWrappers::GLTextureObj(false) );
7377

@@ -172,7 +176,7 @@ TextureBaseGL::TextureBaseGL(IReferenceCounters *pRefCounters,
172176
// Create texture object wrapper, but use external texture handle
173177
m_GlTexture(true, GLObjectWrappers::GLTextureCreateReleaseHelper(GLTextureHandle)),
174178
m_BindTarget(BindTarget),
175-
m_GLTexFormat( GetTextureInternalFormat(pDeviceContext, BindTarget, m_GlTexture) )
179+
m_GLTexFormat( GetTextureInternalFormat(pDeviceContext, BindTarget, m_GlTexture, TexDesc.Format) )
176180
{
177181
}
178182

0 commit comments

Comments
 (0)