| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- #pragma once
- #include "BsD3D11Prerequisites.h"
- #include "BsTextureView.h"
- namespace BansheeEngine
- {
- /**
- * @brief DirectX implementation of a texture resource view.
- */
- class BS_D3D11_EXPORT D3D11TextureView : public TextureView
- {
- public:
- ~D3D11TextureView();
- /**
- * @brief Returns a shader resource view. Caller must take care this texture view
- * actually contains a shader resource view, otherwise it returns null.
- */
- ID3D11ShaderResourceView* getSRV() const { return mSRV; }
- /**
- * @brief Returns a render target view. Caller must take care this texture view
- * actually contains a render target view, otherwise it returns null.
- */
- ID3D11RenderTargetView* getRTV() const { return mRTV; }
- /**
- * @brief Returns a unordered access view. Caller must take care this texture view
- * actually contains a unordered access view, otherwise it returns null.
- */
- ID3D11UnorderedAccessView* getUAV() const { return mUAV; }
- /**
- * @brief Returns a depth stencil view. Caller must take care this texture view
- * actually contains a depth stencil view, otherwise it returns null.
- *
- * @param[in] readOnly Should the depth stencil view only support read operations (allows the bound texture to
- * be also used as a shader resource view while bound as a depth stencil target).
- */
- ID3D11DepthStencilView* getDSV(bool readOnly) const { return readOnly ? mRODSV : mDSV; }
- protected:
- friend class D3D11TextureCore;
- D3D11TextureView(const SPtr<TextureCore>& texture, const TEXTURE_VIEW_DESC& desc);
- private:
- /**
- * @brief Creates a shader resource view that allows the provided surfaces
- * to be bound as normal shader resources.
- *
- * @param texture Texture to create the resource view for.
- * @param mostDetailMip First mip level to create the resource view for (0 - base level).
- * @param numMips Number of mip levels to create the view for.
- * @param firstArraySlice First array slice to create the view for. This will be array index
- * for 1D and 2D array textures, texture slice index for 3D textures, and face
- * index for cube textures (cube index * 6).
- * @param numArraySlices Number of array slices to create the view for. This will be number of
- * array elements for 1D and 2D array textures, number of slices for 3D textures,
- * and number of cubes for cube textures.
- */
- ID3D11ShaderResourceView* createSRV(D3D11TextureCore* texture,
- UINT32 mostDetailMip, UINT32 numMips, UINT32 firstArraySlice, UINT32 numArraySlices);
- /**
- * @brief Creates a shader resource view that allows the provided surfaces
- * to be bound as render targets.
- *
- * @param texture Texture to create the resource view for.
- * @param mipSlice Mip level to create the resource view for (0 - base level).
- * @param firstArraySlice First array slice to create the view for. This will be array index
- * for 1D and 2D array textures, texture slice index for 3D textures, and face
- * index for cube textures (cube index * 6).
- * @param numArraySlices Number of array slices to create the view for. This will be number of
- * array elements for 1D and 2D array textures, number of slices for 3D textures,
- * and number of cubes for cube textures.
- */
- ID3D11RenderTargetView* createRTV(D3D11TextureCore* texture,
- UINT32 mipSlice, UINT32 firstArraySlice, UINT32 numArraySlices);
- /**
- * @brief Creates a shader resource view that allows the provided surfaces
- * to be bound as unordered access buffers.
- *
- * @param texture Texture to create the resource view for.
- * @param mipSlice Mip level to create the resource view for (0 - base level).
- * @param firstArraySlice First array slice to create the view for. This will be array index
- * for 1D and 2D array textures, texture slice index for 3D textures, and face
- * index for cube textures (cube index * 6).
- * @param numArraySlices Number of array slices to create the view for. This will be number of
- * array elements for 1D and 2D array textures, number of slices for 3D textures,
- * and number of cubes for cube textures.
- */
- ID3D11UnorderedAccessView* createUAV(D3D11TextureCore* texture,
- UINT32 mipSlice, UINT32 firstArraySlice, UINT32 numArraySlices);
- /**
- * @brief Creates a shader resource view that allows the provided surfaces
- * to be bound as depth stencil buffers.
- *
- * @param texture Texture to create the resource view for.
- * @param mipSlice Mip level to create the resource view for (0 - base level).
- * @param firstArraySlice First array slice to create the view for. This will be array index
- * for 1D and 2D array textures, texture slice index for 3D textures, and face
- * index for cube textures (cube index * 6).
- * @param numArraySlices Number of array slices to create the view for. This will be number of
- * array elements for 1D and 2D array textures, number of slices for 3D textures,
- * and number of cubes for cube textures.
- * @param readOnly Should the depth stencil view only support read operations (allows the bound texture to
- * be also used as a shader resource view while bound as a depth stencil target).
- */
- ID3D11DepthStencilView* createDSV(D3D11TextureCore* texture,
- UINT32 mipSlice, UINT32 firstArraySlice, UINT32 numArraySlices, bool readOnly);
- ID3D11ShaderResourceView* mSRV;
- ID3D11RenderTargetView* mRTV;
- ID3D11UnorderedAccessView* mUAV;
- ID3D11DepthStencilView* mDSV;
- ID3D11DepthStencilView* mRODSV;
- };
- }
|