From 8ee39e08c48a315163fe1850dbb12ca292020d4d Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 18 Feb 2020 14:14:16 -0500 Subject: First pass Texture Array support on CUDA/CPU (#1225) * Add cubemap support. * Add CUDA fence instrinsics. * Added Gather for CUDA. * Use the CUDA driver API as much as possible. * * Support 1D texture on CPU * WIP on 1D texture on CUDA * Added simplified texture test * Fix test. * Improve texture-simple tests. * * Add CPU support for 3d textures * Add support for mip maps to CUDA * Disable warnings in nvrtc * Update CUDA docs * WIP on 3d texture support. * Add support for 3d textures for CPU and CUDA. * CPU and CUDA support for cube maps. * Add CPU support for Texture1DArray. * Support CUDA Layered/Array type in meta library. --- source/slang/slang-emit-cuda.cpp | 44 ++++++++-------------------------------- 1 file changed, 8 insertions(+), 36 deletions(-) (limited to 'source/slang/slang-emit-cuda.cpp') diff --git a/source/slang/slang-emit-cuda.cpp b/source/slang/slang-emit-cuda.cpp index 0bbaafa5b..262a67784 100644 --- a/source/slang/slang-emit-cuda.cpp +++ b/source/slang/slang-emit-cuda.cpp @@ -81,57 +81,29 @@ static bool _isSingleNameBasicType(IROp op) SlangResult CUDASourceEmitter::_calcCUDATextureTypeName(IRTextureTypeBase* texType, StringBuilder& outName) { - // texture texRef; - // Not clear how to do this yet - if (texType->isMultisample() || texType->isArray()) + if (texType->isMultisample()) { return SLANG_FAIL; } - outName << "CUtexObject"; - -#if 0 - outName << "texture<"; - outName << _getTypeName(texType->getElementType()); - outName << ", "; - - switch (texType->GetBaseShape()) - { - case TextureFlavor::Shape::Shape1D: outName << "cudaTextureType1D"; break; - case TextureFlavor::Shape::Shape2D: outName << "cudaTextureType2D"; break; - case TextureFlavor::Shape::Shape3D: outName << "cudaTextureType3D"; break; - case TextureFlavor::Shape::ShapeCube: outName << "cudaTextureTypeCubemap"; break; - case TextureFlavor::Shape::ShapeBuffer: outName << "Buffer"; break; - default: - SLANG_DIAGNOSE_UNEXPECTED(getSink(), SourceLoc(), "unhandled resource shape"); - return SLANG_FAIL; - } - - outName << ", "; - switch (texType->getAccess()) { case SLANG_RESOURCE_ACCESS_READ: { - // Other value is cudaReadModeNormalizedFloat - - outName << "cudaReadModeElementType"; - break; + outName << "CUtexObject"; + return SLANG_OK; } - default: + case SLANG_RESOURCE_ACCESS_READ_WRITE: { - SLANG_DIAGNOSE_UNEXPECTED(getSink(), SourceLoc(), "unhandled resource access mode"); - return SLANG_FAIL; + outName << "CUsurfObject"; + return SLANG_OK; } + default: break; } - - outName << ">"; -#endif - return SLANG_OK; + return SLANG_FAIL; } - SlangResult CUDASourceEmitter::calcScalarFuncName(HLSLIntrinsic::Op op, IRBasicType* type, StringBuilder& outBuilder) { typedef HLSLIntrinsic::Op Op; -- cgit v1.2.3