diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-08-27 03:36:01 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-08-27 03:36:01 +0000 |
| commit | 09fae5afcd4c43d7e6d32af94e03f8aab32bced1 (patch) | |
| tree | be86e1082e52d94766c7ba1facfd58855e7d86da /Graphics | |
| parent | Fixed false warning about zero indices for indirect draw/dispatch commands (diff) | |
| download | DiligentCore-09fae5afcd4c43d7e6d32af94e03f8aab32bced1.tar.gz DiligentCore-09fae5afcd4c43d7e6d32af94e03f8aab32bced1.zip | |
Few minor updates
Diffstat (limited to 'Graphics')
8 files changed, 16 insertions, 10 deletions
diff --git a/Graphics/GraphicsEngine/include/BufferBase.h b/Graphics/GraphicsEngine/include/BufferBase.h index 40e251f4..c676190c 100644 --- a/Graphics/GraphicsEngine/include/BufferBase.h +++ b/Graphics/GraphicsEngine/include/BufferBase.h @@ -268,7 +268,7 @@ void BufferBase<BaseInterface, RenderDeviceImplType, BufferViewImplType, TBuffVi if (this->m_Desc.Mode == BUFFER_MODE_RAW && this->m_Desc.ElementByteStride == 0) LOG_ERROR_AND_THROW("To enable formatted views of a raw buffer, element byte must be specified during buffer initialization"); if (ViewElementStride != this->m_Desc.ElementByteStride) - LOG_ERROR_AND_THROW("Buffer element byte stride (", this->m_Desc.ElementByteStride, ") is not consistent with the size (", ViewElementStride, ") defined by the fromat of the view (", GetBufferFormatString(ViewDesc.Format), ')' ); + LOG_ERROR_AND_THROW("Buffer element byte stride (", this->m_Desc.ElementByteStride, ") is not consistent with the size (", ViewElementStride, ") defined by the format of the view (", GetBufferFormatString(ViewDesc.Format), ')' ); } if (this->m_Desc.Mode == BUFFER_MODE_RAW && ViewDesc.Format.ValueType == VT_UNDEFINED) diff --git a/Graphics/GraphicsEngine/interface/Buffer.h b/Graphics/GraphicsEngine/interface/Buffer.h index 1f2f8d2d..dad8af5f 100644 --- a/Graphics/GraphicsEngine/interface/Buffer.h +++ b/Graphics/GraphicsEngine/interface/Buffer.h @@ -54,7 +54,7 @@ enum BUFFER_MODE : Uint8 /// Raw buffer. /// In this mode, the buffer is accessed as raw bytes. Formatted views of a raw - /// buffer can be also created similar to formatted buffer. If formatted views + /// buffer can also be created similar to formatted buffer. If formatted views /// are to be created, the ElementByteStride member of BufferDesc must specify the /// size of the format. BUFFER_MODE_RAW, 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, ")" ); diff --git a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp index 8427ea78..d894d432 100644 --- a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp +++ b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp @@ -51,7 +51,7 @@ namespace Diligent if(FmtAttribs.NumComponents >= 4) GlFmt[pos++] = 'a'; VERIFY_EXPR(FmtAttribs.NumComponents <= 4); - auto ComponentSize = FmtAttribs.ComponentSize * 8; + auto ComponentSize = Uint32{FmtAttribs.ComponentSize} * 8; int pow10 = 1; while(ComponentSize / (10*pow10) != 0) pow10 *= 10; |
