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.h 2#pragma once 3 4#include "vk-base.h" 5#include "vk-buffer.h" 6#include "vk-device.h" 7#include "vk-texture.h" 8 9namespace gfx 10{ 11 12using namespace Slang ; 13 14namespace vk 15{ 16 17class ResourceViewImpl :public ResourceViewBase 18{ 19public : 20enum class ViewType 21 { 22Texture , 23TexelBuffer , 24PlainBuffer , 25 }; 26 27public : 28ResourceViewImpl (ViewType viewType ,DeviceImpl * device ) 29 :m_type (viewType ),m_device (device ) 30 { 31 } 32ViewType m_type ; 33RefPtr < DeviceImpl > m_device ; 34}; 35 36class TextureResourceViewImpl :public ResourceViewImpl 37{ 38public : 39TextureResourceViewImpl (DeviceImpl * device ) 40 :ResourceViewImpl (ViewType ::Texture ,device ) 41 { 42 } 43 ~TextureResourceViewImpl (); 44RefPtr < TextureResourceImpl > m_texture ; 45VkImageView m_view ; 46VkImageLayout m_layout ; 47 48virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle (InteropHandle * outHandle )override ; 49}; 50 51class TexelBufferResourceViewImpl :public ResourceViewImpl 52{ 53public : 54TexelBufferResourceViewImpl (DeviceImpl * device ); 55 ~TexelBufferResourceViewImpl (); 56RefPtr < BufferResourceImpl > m_buffer ; 57VkBufferView m_view ; 58virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle (InteropHandle * outHandle )override ; 59}; 60 61class PlainBufferResourceViewImpl :public ResourceViewImpl 62{ 63public : 64PlainBufferResourceViewImpl (DeviceImpl * device ); 65RefPtr < BufferResourceImpl > m_buffer ; 66VkDeviceSize offset ; 67VkDeviceSize size ; 68 69virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle (InteropHandle * outHandle )override ; 70}; 71 72class AccelerationStructureImpl :public AccelerationStructureBase 73{ 74public : 75VkAccelerationStructureKHR m_vkHandle = VK_NULL_HANDLE ; 76RefPtr < BufferResourceImpl > m_buffer ; 77VkDeviceSize m_offset ; 78VkDeviceSize m_size ; 79RefPtr < DeviceImpl > m_device ; 80 81public : 82virtual SLANG_NO_THROW DeviceAddress SLANG_MCALL getDeviceAddress ()override ; 83virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle ( InteropHandle * outHandle) override; 84~ AccelerationStructureImpl (); 85}; 86 87} // namespace vk 88} // namespace gfx