From 1f401d04e32c6feaeb35243ea5bfc2b14520344b Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 20 Feb 2020 18:24:00 -0500 Subject: WIP on RWTexture types on CUDA/CPU (#1234) * CUDA support for array of resources. * * Add support for Texture2DArray on CPU * Expand texture-simple.slang to test Texture2DArray * Reorganise CUDAComputeUtil to split out createTextureResource. * Add TextureCubeArray support for CPU/CUDA targets. * Pulled out CUDAResource Renamed derived classes to reflect that change. * Creation of SurfObject type. * Functions to return read/write access for simplifying future additions. * WIP for RWTexture access on CPU/CUDA. * CUsurfObject cannot have mips. * Ability to set number of mips on test data. Preliminary support for CUsurfObj and RWTexture1D on CUDA. CUDA docs improvements. * Fix typo. --- tools/render-test/shader-input-layout.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tools/render-test/shader-input-layout.cpp') diff --git a/tools/render-test/shader-input-layout.cpp b/tools/render-test/shader-input-layout.cpp index 108483a2a..f9d6a60e1 100644 --- a/tools/render-test/shader-input-layout.cpp +++ b/tools/render-test/shader-input-layout.cpp @@ -452,6 +452,12 @@ namespace renderer_test entry.textureDesc.format = format; entry.bufferDesc.format = format; } + else if(word == "mipMaps") + { + parser.Read("="); + entry.textureDesc.mipMapCount = int(parser.ReadInt()); + } + if (parser.LookAhead(",")) parser.Read(","); else @@ -974,7 +980,12 @@ namespace renderer_test arraySize *= 6; output.arraySize = arraySize; output.textureSize = inputDesc.size; - output.mipLevels = Math::Log2Floor(output.textureSize) + 1; + + const Index maxMipLevels = Math::Log2Floor(output.textureSize) + 1; + Index mipLevels = (inputDesc.mipMapCount <= 0) ? maxMipLevels : inputDesc.mipMapCount; + mipLevels = (mipLevels > maxMipLevels) ? maxMipLevels : mipLevels; + + output.mipLevels = int(mipLevels); output.dataBuffer.setCount(output.mipLevels * output.arraySize); int slice = 0; -- cgit v1.2.3