diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-06-06 12:43:19 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-06 12:43:19 -0400 |
| commit | bbd6df7e5eb2c1d8811fbcd1ac37a86e2f9237bb (patch) | |
| tree | 3652b7180aa1e78e50389c2bd682d53627723df0 /tools/gfx/cuda | |
| parent | 688d5fa6eb2c7f5281e50ace1401737479911ebc (diff) | |
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'.
Diffstat (limited to 'tools/gfx/cuda')
| -rw-r--r-- | tools/gfx/cuda/render-cuda.cpp | 8 |
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: |
