yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f65d756bf
master
1// vk-resource-views.cpp 2#include "vk-resource-views.h" 3 4namespace gfx 5{ 6 7using namespace Slang ; 8 9namespace vk 10{ 11 12TextureResourceViewImpl ::~TextureResourceViewImpl () 13{ 14m_device -> m_api .vkDestroyImageView (m_device -> m_api .m_device ,m_view ,nullptr ); 15} 16 17Result TextureResourceViewImpl ::getNativeHandle (InteropHandle * outHandle ) 18{ 19outHandle -> api = InteropHandleAPI ::Vulkan ; 20outHandle -> handleValue = (uint64_t )(m_view ); 21return SLANG_OK ; 22} 23 24TexelBufferResourceViewImpl ::TexelBufferResourceViewImpl (DeviceImpl * device ) 25 :ResourceViewImpl (ViewType ::TexelBuffer ,device ) 26{ 27} 28 29TexelBufferResourceViewImpl ::~TexelBufferResourceViewImpl () 30{ 31m_device -> m_api .vkDestroyBufferView (m_device -> m_api .m_device ,m_view ,nullptr ); 32} 33 34Result TexelBufferResourceViewImpl ::getNativeHandle (InteropHandle * outHandle ) 35{ 36outHandle -> api = InteropHandleAPI ::Vulkan ; 37outHandle -> handleValue = (uint64_t )(m_view ); 38return SLANG_OK ; 39} 40 41PlainBufferResourceViewImpl ::PlainBufferResourceViewImpl (DeviceImpl * device ) 42 :ResourceViewImpl (ViewType ::PlainBuffer ,device ) 43{ 44} 45 46Result PlainBufferResourceViewImpl ::getNativeHandle (InteropHandle * outHandle ) 47{ 48return m_buffer -> getNativeResourceHandle (outHandle ); 49} 50 51DeviceAddress AccelerationStructureImpl ::getDeviceAddress () 52{ 53return m_buffer -> getDeviceAddress ()+ m_offset ; 54} 55 56Result AccelerationStructureImpl ::getNativeHandle (InteropHandle * outHandle ) 57{ 58outHandle -> api = InteropHandleAPI ::Vulkan ; 59outHandle -> handleValue = (uint64_t )(m_vkHandle ); 60return SLANG_OK ; 61} 62 63AccelerationStructureImpl ::~AccelerationStructureImpl () 64{ 65if (m_device ) 66 { 67m_device -> m_api .vkDestroyAccelerationStructureKHR ( 68m_device -> m_api .m_device , 69m_vkHandle , 70nullptr ); 71 } 72} 73 74}// namespace vk 75}// namespace gfx