From ce6e946f6f4882aba8a62392ae791c948633e2e3 Mon Sep 17 00:00:00 2001 From: lucy96chen <47800040+lucy96chen@users.noreply.github.com> Date: Mon, 25 Jul 2022 13:36:43 -0700 Subject: Split render-cuda.cpp into smaller files (#2334) * render-cuda split, compile errors galore due to missing includes etc. * render-cuda split and fully compiles * Ran premake.bat to disable cuda; Added all new files * Removed render-cuda files * CI fixes * Rerun CI --- tools/gfx/cuda/cuda-buffer.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tools/gfx/cuda/cuda-buffer.cpp (limited to 'tools/gfx/cuda/cuda-buffer.cpp') diff --git a/tools/gfx/cuda/cuda-buffer.cpp b/tools/gfx/cuda/cuda-buffer.cpp new file mode 100644 index 000000000..1cd162841 --- /dev/null +++ b/tools/gfx/cuda/cuda-buffer.cpp @@ -0,0 +1,51 @@ +// cuda-buffer.cpp +#include "cuda-buffer.h" + +#include "cuda-helper-functions.h" + +namespace gfx +{ +#ifdef GFX_ENABLE_CUDA +using namespace Slang; + +namespace cuda +{ + +BufferResourceImpl::~BufferResourceImpl() +{ + if (m_cudaMemory) + { + SLANG_CUDA_ASSERT_ON_FAIL(cudaFree(m_cudaMemory)); + } +} + +uint64_t BufferResourceImpl::getBindlessHandle() { return (uint64_t)m_cudaMemory; } + +DeviceAddress BufferResourceImpl::getDeviceAddress() +{ + return (DeviceAddress)m_cudaMemory; +} + +Result BufferResourceImpl::getNativeResourceHandle(InteropHandle* outHandle) +{ + outHandle->handleValue = getBindlessHandle(); + outHandle->api = InteropHandleAPI::CUDA; + return SLANG_OK; +} + +Result BufferResourceImpl::map(MemoryRange* rangeToRead, void** outPointer) +{ + SLANG_UNUSED(rangeToRead); + SLANG_UNUSED(outPointer); + return SLANG_FAIL; +} + +Result BufferResourceImpl::unmap(MemoryRange* writtenRange) +{ + SLANG_UNUSED(writtenRange); + return SLANG_FAIL; +} + +} // namespace cuda +#endif +} // namespace gfx -- cgit v1.2.3