summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-12-24 07:20:10 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-12-24 07:20:10 +0000
commit72169d31c7f8a8e1f0a011e45b19ea7710eef985 (patch)
tree935085a90a27216001289ddfcea2f999ce6b90cc /Graphics/GraphicsEngineOpenGL
parentFixed CMake warning when processing SPIRV-Tools-shared on Mac (diff)
downloadDiligentCore-72169d31c7f8a8e1f0a011e45b19ea7710eef985.tar.gz
DiligentCore-72169d31c7f8a8e1f0a011e45b19ea7710eef985.zip
Fixed multiple unused variable warnings in clang release build
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp30
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp26
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp13
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp14
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp33
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp12
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp16
8 files changed, 89 insertions, 57 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp
index 21333984..5c334cc3 100644
--- a/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp
@@ -320,7 +320,7 @@ void BufferGLImpl::Unmap()
// occur only during the periods that a buffer's data store is mapped. If such corruption
// has occurred, glUnmapBuffer() returns FALSE, and the contents of the buffer's
// data store become undefined.
- VERIFY( Result != GL_FALSE, "Failed to unmap buffer. The data may have been corrupted" );
+ VERIFY( Result != GL_FALSE, "Failed to unmap buffer. The data may have been corrupted" ); (void)Result;
glBindBuffer(m_uiMapTarget, 0);
m_uiMapTarget = 0;
}
@@ -328,18 +328,22 @@ void BufferGLImpl::Unmap()
void BufferGLImpl::BufferMemoryBarrier( Uint32 RequiredBarriers, GLContextState &GLContextState )
{
#if GL_ARB_shader_image_load_store
- const Uint32 BufferBarriers =
- GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT |
- GL_ELEMENT_ARRAY_BARRIER_BIT |
- GL_UNIFORM_BARRIER_BIT |
- GL_COMMAND_BARRIER_BIT |
- GL_BUFFER_UPDATE_BARRIER_BIT |
- GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT |
- GL_SHADER_STORAGE_BARRIER_BIT |
- GL_TEXTURE_FETCH_BARRIER_BIT;
- VERIFY( (RequiredBarriers & BufferBarriers) !=0, "At least one buffer memory barrier flag should be set" );
- VERIFY( (RequiredBarriers & ~BufferBarriers) == 0, "Inappropriate buffer memory barrier flag" );
-
+ #ifdef _DEBUG
+ {
+ constexpr Uint32 BufferBarriers =
+ GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT |
+ GL_ELEMENT_ARRAY_BARRIER_BIT |
+ GL_UNIFORM_BARRIER_BIT |
+ GL_COMMAND_BARRIER_BIT |
+ GL_BUFFER_UPDATE_BARRIER_BIT |
+ GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT |
+ GL_SHADER_STORAGE_BARRIER_BIT |
+ GL_TEXTURE_FETCH_BARRIER_BIT;
+ VERIFY( (RequiredBarriers & BufferBarriers) !=0, "At least one buffer memory barrier flag should be set" );
+ VERIFY( (RequiredBarriers & ~BufferBarriers) == 0, "Inappropriate buffer memory barrier flag" );
+ }
+ #endif
+
GLContextState.EnsureMemoryBarrier( RequiredBarriers, this );
#endif
}
diff --git a/Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp b/Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp
index 238c1025..e92ec105 100644
--- a/Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp
@@ -189,21 +189,27 @@ const GLObjectWrappers::GLFrameBufferObj& FBOCache::GetFBO( Uint32 NumRenderTarg
if( ViewDesc.Format == TEX_FORMAT_D32_FLOAT ||
ViewDesc.Format == TEX_FORMAT_D16_UNORM )
{
- auto GLTexFmt = pTexGL->GetGLTexFormat();
- VERIFY( GLTexFmt == GL_DEPTH_COMPONENT32F || GLTexFmt == GL_DEPTH_COMPONENT16,
- "Inappropriate internal texture format (", GLTexFmt, ") for depth attachment. "
- "GL_DEPTH_COMPONENT32F or GL_DEPTH_COMPONENT16 is expected");
-
+#ifdef _DEBUG
+ {
+ const auto GLTexFmt = pTexGL->GetGLTexFormat();
+ VERIFY( GLTexFmt == GL_DEPTH_COMPONENT32F || GLTexFmt == GL_DEPTH_COMPONENT16,
+ "Inappropriate internal texture format (", GLTexFmt, ") for depth attachment. "
+ "GL_DEPTH_COMPONENT32F or GL_DEPTH_COMPONENT16 is expected");
+ }
+#endif
AttachmentPoint = GL_DEPTH_ATTACHMENT;
}
else if( ViewDesc.Format == TEX_FORMAT_D32_FLOAT_S8X24_UINT ||
ViewDesc.Format == TEX_FORMAT_D24_UNORM_S8_UINT )
{
- auto GLTexFmt = pTexGL->GetGLTexFormat();
- VERIFY( GLTexFmt == GL_DEPTH24_STENCIL8 || GLTexFmt == GL_DEPTH32F_STENCIL8,
- "Inappropriate internal texture format (", GLTexFmt, ") for depth-stencil attachment. "
- "GL_DEPTH24_STENCIL8 or GL_DEPTH32F_STENCIL8 is expected");
-
+#ifdef _DEBUG
+ {
+ const auto GLTexFmt = pTexGL->GetGLTexFormat();
+ VERIFY( GLTexFmt == GL_DEPTH24_STENCIL8 || GLTexFmt == GL_DEPTH32F_STENCIL8,
+ "Inappropriate internal texture format (", GLTexFmt, ") for depth-stencil attachment. "
+ "GL_DEPTH24_STENCIL8 or GL_DEPTH32F_STENCIL8 is expected");
+ }
+#endif
AttachmentPoint = GL_DEPTH_STENCIL_ATTACHMENT;
}
else
diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
index 3adbb081..6822d61f 100644
--- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp
@@ -612,7 +612,7 @@ void RenderDeviceGLImpl::TestTextureFormat( TEXTURE_FORMAT TexFormat )
{
glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, TestTextureDim, TestTextureDim);
} );
- VERIFY( Success, "Failed to create dummy render target texture" );
+ VERIFY( Success, "Failed to create dummy render target texture" ); (void)Success;
glFramebufferTexture2D( GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ColorTex, 0 );
CHECK_GL_ERROR( "Failed to set bind dummy render target to framebuffer" );
diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp
index 606bf469..a919ce4a 100644
--- a/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp
@@ -152,11 +152,14 @@ void Texture2DArray_OGL::UpdateData(GLContextState &ContextState, Uint32 MipLeve
((DstBox.MaxX % 4) == 0 || DstBox.MaxX == MipWidth) &&
((DstBox.MaxY % 4) == 0 || DstBox.MaxY == MipHeight),
"Compressed texture update region must be 4 pixel-aligned" );
- const auto &FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
- auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3)/4) * Uint32{FmtAttribs.ComponentSize};
- VERIFY( SubresData.Stride == BlockBytesInRow,
- "Compressed data stride (", SubresData.Stride, " must match the size of a row of compressed blocks (", BlockBytesInRow, ")" );
-
+#ifdef _DEBUG
+ {
+ const auto& FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
+ auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3)/4) * Uint32{FmtAttribs.ComponentSize};
+ VERIFY( SubresData.Stride == BlockBytesInRow,
+ "Compressed data stride (", SubresData.Stride, " must match the size of a row of compressed blocks (", BlockBytesInRow, ")" );
+ }
+#endif
//glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
//glPixelStorei(GL_UNPACK_COMPRESSED_BLOCK_WIDTH, 0);
auto UpdateRegionWidth = DstBox.MaxX - DstBox.MinX;
diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp
index 87f673de..173e563a 100644
--- a/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp
@@ -154,11 +154,15 @@ void Texture2D_OGL::UpdateData( GLContextState &ContextState, Uint32 MipLevel, U
((DstBox.MaxX % 4) == 0 || DstBox.MaxX == MipWidth) &&
((DstBox.MaxY % 4) == 0 || DstBox.MaxY == MipHeight),
"Compressed texture update region must be 4 pixel-aligned" );
- const auto &FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
- auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3)/4) * Uint32{FmtAttribs.ComponentSize};
- VERIFY( SubresData.Stride == BlockBytesInRow,
- "Compressed data stride (", SubresData.Stride, " must match the size of a row of compressed blocks (", BlockBytesInRow, ")" );
-
+#ifdef _DEBUG
+ {
+ const auto& FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
+ auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3)/4) * Uint32{FmtAttribs.ComponentSize};
+ VERIFY( SubresData.Stride == BlockBytesInRow,
+ "Compressed data stride (", SubresData.Stride, " must match the size of a row of compressed blocks (", BlockBytesInRow, ")" );
+ }
+#endif
+
//glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
//glPixelStorei(GL_UNPACK_COMPRESSED_BLOCK_WIDTH, 0);
auto UpdateRegionWidth = DstBox.MaxX - DstBox.MinX;
diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp
index a09cd189..9c0a60e2 100644
--- a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp
@@ -427,10 +427,13 @@ void TextureBaseGL :: CopyData(DeviceContextGLImpl *pDeviceCtxGL,
return;
}
- auto *pRenderDeviceGL = ValidatedCast<RenderDeviceGLImpl>(GetDevice());
- auto &TexViewObjAllocator = pRenderDeviceGL->GetTexViewObjAllocator();
- VERIFY( &TexViewObjAllocator == &m_dbgTexViewObjAllocator, "Texture view allocator does not match allocator provided during texture initialization" );
-
+ auto* pRenderDeviceGL = ValidatedCast<RenderDeviceGLImpl>(GetDevice());
+#ifdef _DEBUG
+ {
+ auto& TexViewObjAllocator = pRenderDeviceGL->GetTexViewObjAllocator();
+ VERIFY( &TexViewObjAllocator == &m_dbgTexViewObjAllocator, "Texture view allocator does not match allocator provided during texture initialization" );
+ }
+#endif
auto &TexRegionRender = pRenderDeviceGL->m_TexRegionRender;
TexRegionRender.SetStates(pDeviceCtxGL);
@@ -490,15 +493,19 @@ void TextureBaseGL :: CopyData(DeviceContextGLImpl *pDeviceCtxGL,
void TextureBaseGL::TextureMemoryBarrier( Uint32 RequiredBarriers, GLContextState &GLContextState )
{
#if GL_ARB_shader_image_load_store
- const Uint32 TextureBarriers =
- GL_TEXTURE_FETCH_BARRIER_BIT |
- GL_SHADER_IMAGE_ACCESS_BARRIER_BIT |
- GL_PIXEL_BUFFER_BARRIER_BIT |
- GL_TEXTURE_UPDATE_BARRIER_BIT |
- GL_FRAMEBUFFER_BARRIER_BIT;
- VERIFY( (RequiredBarriers & TextureBarriers) != 0, "At least one texture memory barrier flag should be set" );
- VERIFY( (RequiredBarriers & ~TextureBarriers) == 0, "Inappropriate texture memory barrier flag" );
-
+ #ifdef DEBUG
+ {
+ constexpr Uint32 TextureBarriers =
+ GL_TEXTURE_FETCH_BARRIER_BIT |
+ GL_SHADER_IMAGE_ACCESS_BARRIER_BIT |
+ GL_PIXEL_BUFFER_BARRIER_BIT |
+ GL_TEXTURE_UPDATE_BARRIER_BIT |
+ GL_FRAMEBUFFER_BARRIER_BIT;
+ VERIFY( (RequiredBarriers & TextureBarriers) != 0, "At least one texture memory barrier flag should be set" );
+ VERIFY( (RequiredBarriers & ~TextureBarriers) == 0, "Inappropriate texture memory barrier flag" );
+ }
+ #endif
+
GLContextState.EnsureMemoryBarrier( RequiredBarriers, this );
#endif
}
diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp
index 03654063..042f7575 100644
--- a/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp
@@ -138,10 +138,14 @@ void TextureCubeArray_OGL::UpdateData( GLContextState &ContextState, Uint32 MipL
((DstBox.MaxX % 4) == 0 || DstBox.MaxX == MipWidth) &&
((DstBox.MaxY % 4) == 0 || DstBox.MaxY == MipHeight),
"Compressed texture update region must be 4 pixel-aligned" );
- const auto &FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
- auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3)/4) * Uint32{FmtAttribs.ComponentSize};
- VERIFY( SubresData.Stride == BlockBytesInRow,
- "Compressed data stride (", SubresData.Stride, " must match the size of a row of compressed blocks (", BlockBytesInRow, ")" );
+#ifdef _DEBUG
+ {
+ const auto& FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
+ auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3)/4) * Uint32{FmtAttribs.ComponentSize};
+ VERIFY( SubresData.Stride == BlockBytesInRow,
+ "Compressed data stride (", SubresData.Stride, " must match the size of a row of compressed blocks (", BlockBytesInRow, ")" );
+ }
+#endif
// Every OpenGL API call that operates on cubemap array textures takes layer-faces, not array layers.
diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp
index 528cafe0..1b4c9b86 100644
--- a/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp
@@ -64,7 +64,7 @@ TextureCube_OGL::TextureCube_OGL( IReferenceCounters *pRefCounters,
if( InitData.pSubResources )
{
- auto ExpectedSubresources = m_Desc.MipLevels*6;
+ const auto ExpectedSubresources = m_Desc.MipLevels*6;
if( m_Desc.MipLevels*6 == InitData.NumSubresources )
{
for(Uint32 Face = 0; Face < 6; ++Face)
@@ -83,7 +83,7 @@ TextureCube_OGL::TextureCube_OGL( IReferenceCounters *pRefCounters,
}
else
{
- UNEXPECTED("Incorrect number of subresources. ", InitData.NumSubresources, " while ", ExpectedSubresources," is expected" );
+ UNEXPECTED("Incorrect number of subresources. ", InitData.NumSubresources, " while ", ExpectedSubresources," is expected" ); (void)ExpectedSubresources;
}
}
@@ -152,10 +152,14 @@ void TextureCube_OGL::UpdateData( GLContextState &ContextState, Uint32 MipLevel,
((DstBox.MaxX % 4) == 0 || DstBox.MaxX == MipWidth) &&
((DstBox.MaxY % 4) == 0 || DstBox.MaxY == MipHeight),
"Compressed texture update region must be 4 pixel-aligned" );
- const auto &FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
- auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3)/4) * Uint32{FmtAttribs.ComponentSize};
- VERIFY( SubresData.Stride == BlockBytesInRow,
- "Compressed data stride (", SubresData.Stride, " must match the size of a row of compressed blocks (", BlockBytesInRow, ")" );
+#ifdef _DEBUG
+ {
+ const auto &FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
+ auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3)/4) * Uint32{FmtAttribs.ComponentSize};
+ VERIFY( SubresData.Stride == BlockBytesInRow,
+ "Compressed data stride (", SubresData.Stride, " must match the size of a row of compressed blocks (", BlockBytesInRow, ")" );
+ }
+#endif
//glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
//glPixelStorei(GL_UNPACK_COMPRESSED_BLOCK_WIDTH, 0);