summaryrefslogtreecommitdiffstats
path: root/tools/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gfx')
-rw-r--r--tools/gfx/cuda/render-cuda.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/gfx/cuda/render-cuda.cpp b/tools/gfx/cuda/render-cuda.cpp
index 263360018..0859524f0 100644
--- a/tools/gfx/cuda/render-cuda.cpp
+++ b/tools/gfx/cuda/render-cuda.cpp
@@ -1229,6 +1229,8 @@ public:
tex->m_cudaContext = m_context;
CUresourcetype resourceType;
+
+ // The size of the element/texel in bytes
size_t elementSize = 0;
// Our `ITextureResource::Desc` uses an enumeration to specify
@@ -1266,7 +1268,7 @@ public:
{
CUarray_format format = CU_AD_FORMAT_FLOAT;
int numChannels = 0;
-
+
switch (desc.format)
{
case Format::RGBA_Float32:
@@ -1278,7 +1280,7 @@ public:
const FormatInfo info = gfxGetFormatInfo(desc.format);
format = CU_AD_FORMAT_FLOAT;
numChannels = info.channelCount;
- elementSize = sizeof(float);
+ elementSize = sizeof(float) * numChannels;
break;
}
case Format::RGBA_Float16:
@@ -1288,7 +1290,7 @@ public:
const FormatInfo info = gfxGetFormatInfo(desc.format);
format = CU_AD_FORMAT_HALF;
numChannels = info.channelCount;
- elementSize = sizeof(uint16_t);
+ elementSize = sizeof(uint16_t) * numChannels;
break;
}
case Format::RGBA_Unorm_UInt8: