summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-08-27 03:36:01 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-08-27 03:36:01 +0000
commit09fae5afcd4c43d7e6d32af94e03f8aab32bced1 (patch)
treebe86e1082e52d94766c7ba1facfd58855e7d86da /Graphics/GraphicsEngineOpenGL
parentFixed false warning about zero indices for indirect draw/dispatch commands (diff)
downloadDiligentCore-09fae5afcd4c43d7e6d32af94e03f8aab32bced1.tar.gz
DiligentCore-09fae5afcd4c43d7e6d32af94e03f8aab32bced1.zip
Few minor updates
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/BufferViewGLImpl.cpp12
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp2
5 files changed, 13 insertions, 7 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/BufferViewGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/BufferViewGLImpl.cpp
index fc2022b6..4d049040 100644
--- a/Graphics/GraphicsEngineOpenGL/src/BufferViewGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/BufferViewGLImpl.cpp
@@ -40,7 +40,8 @@ namespace Diligent
TBuffViewBase(pRefCounters, pDevice, ViewDesc, pBuffer, bIsDefaultView ),
m_GLTexBuffer(false)
{
- if( ViewDesc.ViewType == BUFFER_VIEW_SHADER_RESOURCE && pBuffer->GetDesc().Mode == BUFFER_MODE_FORMATTED )
+ if( ViewDesc.ViewType == BUFFER_VIEW_SHADER_RESOURCE &&
+ (pBuffer->GetDesc().Mode == BUFFER_MODE_FORMATTED || pBuffer->GetDesc().Mode == BUFFER_MODE_RAW) )
{
#ifdef _MSC_VER
# pragma warning(push)
@@ -58,8 +59,13 @@ namespace Diligent
ContextState.BindTexture(-1, GL_TEXTURE_BUFFER, m_GLTexBuffer );
const auto &BuffFmt = ViewDesc.Format;
- VERIFY_EXPR(BuffFmt.ValueType != VT_UNDEFINED);
- auto GLFormat = TypeToGLTexFormat( BuffFmt.ValueType, BuffFmt.NumComponents, BuffFmt.IsNormalized );
+ GLenum GLFormat = 0;
+ if(pBuffer->GetDesc().Mode == BUFFER_MODE_FORMATTED || BuffFmt.ValueType != VT_UNDEFINED)
+ GLFormat = TypeToGLTexFormat( BuffFmt.ValueType, BuffFmt.NumComponents, BuffFmt.IsNormalized );
+ else
+ {
+ GLFormat = GL_R32UI;
+ }
glTexBuffer( GL_TEXTURE_BUFFER, GLFormat, pBuffer->GetGLHandle() );
CHECK_GL_ERROR_AND_THROW( "Failed to create texture buffer" );
diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp
index efa485dc..5368281a 100644
--- a/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp
@@ -152,7 +152,7 @@ void Texture2DArray_OGL::UpdateData(IDeviceContext *pContext, Uint32 MipLevel, U
((DstBox.MaxY % 4) == 0 || DstBox.MaxY == std::max(m_Desc.Height>>MipLevel, 1U)),
"Compressed texture update region must be 4 pixel-aligned" );
const auto &FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
- auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3)/4) * FmtAttribs.ComponentSize;
+ 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, ")" );
diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp
index d6bfaa50..f4171812 100644
--- a/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp
@@ -154,7 +154,7 @@ void Texture2D_OGL::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uint3
((DstBox.MaxY % 4) == 0 || DstBox.MaxY == std::max(m_Desc.Height>>MipLevel, 1U)),
"Compressed texture update region must be 4 pixel-aligned" );
const auto &FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
- auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3)/4) * FmtAttribs.ComponentSize;
+ 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, ")" );
diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp
index 945b137d..3851d31f 100644
--- a/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp
@@ -138,7 +138,7 @@ void TextureCubeArray_OGL::UpdateData( IDeviceContext *pContext, Uint32 MipLevel
((DstBox.MaxY % 4) == 0 || DstBox.MaxY == std::max(m_Desc.Height>>MipLevel, 1U)),
"Compressed texture update region must be 4 pixel-aligned" );
const auto &FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
- auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3)/4) * FmtAttribs.ComponentSize;
+ 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, ")" );
diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp
index 52414776..508ee6b2 100644
--- a/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp
@@ -152,7 +152,7 @@ void TextureCube_OGL::UpdateData( IDeviceContext *pContext, Uint32 MipLevel, Uin
((DstBox.MaxY % 4) == 0 || DstBox.MaxY == std::max(m_Desc.Height>>MipLevel, 1U)),
"Compressed texture update region must be 4 pixel-aligned" );
const auto &FmtAttribs = GetTextureFormatAttribs(m_Desc.Format);
- auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3)/4) * FmtAttribs.ComponentSize;
+ 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, ")" );