yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f65d756bf
master
1// metal-resource-views.h 2#pragma once 3 4#include "metal-base.h" 5#include "metal-buffer.h" 6#include "metal-device.h" 7#include "metal-texture.h" 8 9namespace gfx 10{ 11 12using namespace Slang ; 13 14namespace metal 15{ 16 17class ResourceViewImpl :public ResourceViewBase 18{ 19public : 20enum class ViewType 21 { 22Texture , 23Buffer , 24TexelBuffer , 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 ; 45NS ::SharedPtr < MTL ::Texture > m_textureView ; 46 47virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle (InteropHandle * outHandle )override ; 48}; 49 50class BufferResourceViewImpl :public ResourceViewImpl 51{ 52public : 53BufferResourceViewImpl (DeviceImpl * device ) 54 :ResourceViewImpl (ViewType ::Buffer ,device ) 55 { 56 } 57 ~BufferResourceViewImpl (); 58RefPtr < BufferResourceImpl > m_buffer ; 59Offset m_offset ; 60Size m_size ; 61 62virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle (InteropHandle * outHandle )override ; 63}; 64 65class TexelBufferResourceViewImpl :public ResourceViewImpl 66{ 67public : 68TexelBufferResourceViewImpl (DeviceImpl * device ); 69 ~TexelBufferResourceViewImpl (); 70RefPtr < BufferResourceImpl > m_buffer ; 71virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle (InteropHandle * outHandle )override ; 72}; 73 74class AccelerationStructureImpl :public AccelerationStructureBase 75{ 76public : 77RefPtr < BufferResourceImpl > m_buffer ; 78RefPtr < DeviceImpl > m_device ; 79 80public : 81virtual SLANG_NO_THROW DeviceAddress SLANG_MCALL getDeviceAddress ()override ; 82virtual SLANG_NO_THROW Result SLANG_MCALL getNativeHandle ( InteropHandle * outHandle) override; 83~ AccelerationStructureImpl (); 84}; 85 86} // namespace metal 87} // namespace gfx