From bbd6df7e5eb2c1d8811fbcd1ac37a86e2f9237bb Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Sun, 6 Jun 2021 12:43:19 -0400 Subject: Fixed issue around 4xFloat16 texture on CUDA (#1874) * #include an absolute path didn't work - because paths were taken to always be relative. * Fixes around Float16. Incorrect calculation of 'elementSize'. --- tools/gfx/cuda/render-cuda.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tools/gfx/cuda/render-cuda.cpp') 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: -- cgit v1.2.3