// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #pragma once #include "ResourceOwnerDX12.h" #include "../IncludeDirectXHeaders.h" #if GRAPHICS_API_DIRECTX12 /// /// Interface for objects that can be bound to the shader slots in DirectX 12. /// class IShaderResourceDX12 { public: IShaderResourceDX12() : SubresourceIndex(D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES) { } IShaderResourceDX12(int32 subresourceIndex) : SubresourceIndex(subresourceIndex) { } public: /// /// Affected subresource index or -1 if use whole resource. /// int32 SubresourceIndex; // Note: this solves only resource states tracking per single subresource, not subresources range, if need to here should be range of subresources (for texture arrays, volume textures and cubemaps) public: /// /// Determines whether this resource is depth/stencil buffer. /// /// True if this resource is depth/stencil buffer, otherwise false. virtual bool IsDepthStencilResource() const = 0; /// /// Gets CPU handle to the shader resource view descriptor. /// /// SRV virtual D3D12_CPU_DESCRIPTOR_HANDLE SRV() const = 0; /// /// Gets CPU handle to the unordered access view descriptor. /// /// UAV virtual D3D12_CPU_DESCRIPTOR_HANDLE UAV() const = 0; /// /// Gets the resource owner. /// /// Owner object. virtual ResourceOwnerDX12* GetResourceOwner() const = 0; }; #endif