summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsTools
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-08-26 21:13:55 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-08-26 21:13:55 +0000
commit71f1ad60962386b6dc3e6dd6f1a7da598ce63965 (patch)
tree907d1d70fffc0da2bcca933c9bc065ccb7e962e6 /Graphics/GraphicsTools
parentAdded comment (diff)
downloadDiligentCore-71f1ad60962386b6dc3e6dd6f1a7da598ce63965.tar.gz
DiligentCore-71f1ad60962386b6dc3e6dd6f1a7da598ce63965.zip
Implemented raw buffers (fixed https://github.com/DiligentGraphics/DiligentCore/issues/18).
Diffstat (limited to 'Graphics/GraphicsTools')
-rw-r--r--Graphics/GraphicsTools/include/GraphicsUtilities.h2
-rw-r--r--Graphics/GraphicsTools/src/GraphicsUtilities.cpp6
-rw-r--r--Graphics/GraphicsTools/src/TextureUploaderD3D12.cpp2
-rw-r--r--Graphics/GraphicsTools/src/TextureUploaderGL.cpp2
4 files changed, 6 insertions, 6 deletions
diff --git a/Graphics/GraphicsTools/include/GraphicsUtilities.h b/Graphics/GraphicsTools/include/GraphicsUtilities.h
index 06a431d4..6f7b4361 100644
--- a/Graphics/GraphicsTools/include/GraphicsUtilities.h
+++ b/Graphics/GraphicsTools/include/GraphicsUtilities.h
@@ -32,6 +32,6 @@
namespace Diligent
{
-void CreateUniformBuffer( IRenderDevice *pDevice, Uint32 Size, const Char *Name, IBuffer **ppBuffer, USAGE Usage = USAGE_DYNAMIC, Uint32 BindFlag = BIND_UNIFORM_BUFFER, Uint32 CPUAccessFlags = CPU_ACCESS_WRITE );
+void CreateUniformBuffer( IRenderDevice *pDevice, Uint32 Size, const Char *Name, IBuffer **ppBuffer, USAGE Usage = USAGE_DYNAMIC, Uint32 BindFlag = BIND_UNIFORM_BUFFER, Uint8 CPUAccessFlags = CPU_ACCESS_WRITE );
void GenerateCheckerBoardPattern(Uint32 Width, Uint32 Height, TEXTURE_FORMAT Fmt, Uint32 HorzCells, Uint32 VertCells, Uint8 *pData, Uint32 StrideInBytes );
}
diff --git a/Graphics/GraphicsTools/src/GraphicsUtilities.cpp b/Graphics/GraphicsTools/src/GraphicsUtilities.cpp
index 7b987947..7db37e64 100644
--- a/Graphics/GraphicsTools/src/GraphicsUtilities.cpp
+++ b/Graphics/GraphicsTools/src/GraphicsUtilities.cpp
@@ -33,7 +33,7 @@
namespace Diligent
{
-void CreateUniformBuffer( IRenderDevice *pDevice, Uint32 Size, const Char *Name, IBuffer **ppBuffer, USAGE Usage, Uint32 BindFlag, Uint32 CPUAccessFlags)
+void CreateUniformBuffer( IRenderDevice *pDevice, Uint32 Size, const Char *Name, IBuffer **ppBuffer, USAGE Usage, Uint32 BindFlag, Uint8 CPUAccessFlags)
{
BufferDesc CBDesc;
CBDesc.Name = Name;
@@ -58,8 +58,8 @@ void GenerateCheckerBoardPatternInternal(Uint32 Width, Uint32 Height, TEXTURE_FO
val = std::max( std::min( val*20.f, +1.f), -1.f );
val = val * 0.5f + 1.f;
val = val * 0.5f + 0.25f;
- Uint8 *pDstTexel = pData + x * FmtAttribs.NumComponents * FmtAttribs.ComponentSize + y * StrideInBytes;
- Converter(pDstTexel, FmtAttribs.NumComponents, val);
+ Uint8 *pDstTexel = pData + x * Uint32{FmtAttribs.NumComponents} * Uint32{FmtAttribs.ComponentSize} + y * StrideInBytes;
+ Converter(pDstTexel, Uint32{FmtAttribs.NumComponents}, val);
}
}
}
diff --git a/Graphics/GraphicsTools/src/TextureUploaderD3D12.cpp b/Graphics/GraphicsTools/src/TextureUploaderD3D12.cpp
index 98b3f40f..9ad63d5f 100644
--- a/Graphics/GraphicsTools/src/TextureUploaderD3D12.cpp
+++ b/Graphics/GraphicsTools/src/TextureUploaderD3D12.cpp
@@ -226,7 +226,7 @@ namespace Diligent
BuffDesc.Usage = USAGE_CPU_ACCESSIBLE;
const auto &TexFmtInfo = m_pDevice->GetTextureFormatInfo(Desc.Format);
- Uint32 RowStride = Desc.Width * TexFmtInfo.ComponentSize * TexFmtInfo.NumComponents;
+ Uint32 RowStride = Desc.Width * Uint32{TexFmtInfo.ComponentSize} * Uint32{TexFmtInfo.NumComponents};
static_assert((D3D12_TEXTURE_DATA_PITCH_ALIGNMENT & (D3D12_TEXTURE_DATA_PITCH_ALIGNMENT - 1)) == 0, "Alginment is expected to be power of 2");
Uint32 AlignmentMask = D3D12_TEXTURE_DATA_PITCH_ALIGNMENT-1;
RowStride = (RowStride + AlignmentMask) & (~AlignmentMask);
diff --git a/Graphics/GraphicsTools/src/TextureUploaderGL.cpp b/Graphics/GraphicsTools/src/TextureUploaderGL.cpp
index 9dc02199..84d14fed 100644
--- a/Graphics/GraphicsTools/src/TextureUploaderGL.cpp
+++ b/Graphics/GraphicsTools/src/TextureUploaderGL.cpp
@@ -179,7 +179,7 @@ namespace Diligent
BuffDesc.Usage = USAGE_CPU_ACCESSIBLE;
const auto &TexFmtInfo = m_pDevice->GetTextureFormatInfo(Desc.Format);
- RowStride = Desc.Width * TexFmtInfo.ComponentSize * TexFmtInfo.NumComponents;
+ RowStride = Desc.Width * Uint32{TexFmtInfo.ComponentSize} * Uint32{TexFmtInfo.NumComponents};
const Uint32 Alignment = 16;
const Uint32 AlignmentMask = Alignment-1;
RowStride = (RowStride + AlignmentMask) & (~AlignmentMask);