diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index a13aa2910..f338cdc5e 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -1439,7 +1439,7 @@ void EditorComponent::Compose() //static Texture2D* clouds = nullptr; //if (clouds == nullptr) //{ - // Texture2DDesc desc; + // TextureDesc desc; // desc.ArraySize = 1; // desc.BindFlags = BIND_UNORDERED_ACCESS | BIND_SHADER_RESOURCE; // desc.CPUAccessFlags = 0; diff --git a/WickedEngine/Renderable3DComponent.cpp b/WickedEngine/Renderable3DComponent.cpp index 9c57c0a8f..44cf64a0c 100644 --- a/WickedEngine/Renderable3DComponent.cpp +++ b/WickedEngine/Renderable3DComponent.cpp @@ -143,7 +143,7 @@ void Renderable3DComponent::ResizeBuffers() SAFE_DELETE(smallDepth); - Texture2DDesc desc; + TextureDesc desc; desc.ArraySize = 1; desc.BindFlags = BIND_DEPTH_STENCIL; desc.CPUAccessFlags = 0; diff --git a/WickedEngine/wiDepthTarget.cpp b/WickedEngine/wiDepthTarget.cpp index 79ba51cfd..7612f07ef 100644 --- a/WickedEngine/wiDepthTarget.cpp +++ b/WickedEngine/wiDepthTarget.cpp @@ -23,7 +23,7 @@ void wiDepthTarget::Initialize(int width, int height, UINT MSAAC) SAFE_DELETE(texture_resolvedMSAA); resolvedMSAAUptodate = false; - Texture2DDesc depthDesc; + TextureDesc depthDesc; ZeroMemory(&depthDesc, sizeof(depthDesc)); // Set up the description of the depth buffer. @@ -55,7 +55,7 @@ void wiDepthTarget::InitializeCube(int size, bool independentFaces) SAFE_DELETE(texture_resolvedMSAA); resolvedMSAAUptodate = false; - Texture2DDesc depthGPUBufferDesc; + TextureDesc depthGPUBufferDesc; ZeroMemory(&depthGPUBufferDesc, sizeof(depthGPUBufferDesc)); // Set up the description of the depth buffer. diff --git a/WickedEngine/wiDepthTarget.h b/WickedEngine/wiDepthTarget.h index 5f6578b06..2eb2f592f 100644 --- a/WickedEngine/wiDepthTarget.h +++ b/WickedEngine/wiDepthTarget.h @@ -20,6 +20,6 @@ public: wiGraphicsTypes::Texture2D* GetTexture() const { return texture; } wiGraphicsTypes::Texture2D* GetTextureResolvedMSAA(GRAPHICSTHREAD threadID); - wiGraphicsTypes::Texture2DDesc GetDesc() const { return GetTexture()->GetDesc(); } + wiGraphicsTypes::TextureDesc GetDesc() const { return GetTexture()->GetDesc(); } }; diff --git a/WickedEngine/wiGraphicsDescriptors.h b/WickedEngine/wiGraphicsDescriptors.h index 51bdc3069..a4e0bb756 100644 --- a/WickedEngine/wiGraphicsDescriptors.h +++ b/WickedEngine/wiGraphicsDescriptors.h @@ -15,6 +15,7 @@ namespace wiGraphicsTypes class RasterizerState; class DepthStencilState; class VertexLayout; + class Texture; enum SHADERSTAGE { @@ -410,34 +411,13 @@ namespace wiGraphicsTypes SampleDesc() :Count( 1 ), Quality( 0 ) {} }; - struct Texture1DDesc - { - UINT Width; - UINT MipLevels; - UINT ArraySize; - FORMAT Format; - USAGE Usage; - UINT BindFlags; - UINT CPUAccessFlags; - UINT MiscFlags; - - Texture1DDesc(): - Width(0), - MipLevels(1), - ArraySize(1), - Format(FORMAT_UNKNOWN), - Usage(USAGE_DEFAULT), - BindFlags(0), - CPUAccessFlags(0), - MiscFlags(0) - {} - }; - struct Texture2DDesc + struct TextureDesc { UINT Width; UINT Height; - UINT MipLevels; + UINT Depth; UINT ArraySize; + UINT MipLevels; FORMAT Format; SampleDesc SampleDesc; USAGE Usage; @@ -445,34 +425,11 @@ namespace wiGraphicsTypes UINT CPUAccessFlags; UINT MiscFlags; - Texture2DDesc(): - Width(0), - Height(0), - MipLevels(1), - ArraySize(1), - Format(FORMAT_UNKNOWN), - Usage(USAGE_DEFAULT), - BindFlags(0), - CPUAccessFlags(0), - MiscFlags(0) - {} - }; - struct Texture3DDesc - { - UINT Width; - UINT Height; - UINT Depth; - UINT MipLevels; - FORMAT Format; - USAGE Usage; - UINT BindFlags; - UINT CPUAccessFlags; - UINT MiscFlags; - - Texture3DDesc(): + TextureDesc() : Width(0), Height(0), Depth(0), + ArraySize(1), MipLevels(1), Format(FORMAT_UNKNOWN), Usage(USAGE_DEFAULT), @@ -685,6 +642,14 @@ namespace wiGraphicsTypes SAFE_INIT(cs); } }; + struct RenderPassDesc + { + Texture* RTs[8] = {}; + Texture* DS = nullptr; + UINT NumRTs = 0; + + RenderPassDesc() {} + }; struct IndirectDrawArgsInstanced { UINT VertexCountPerInstance; diff --git a/WickedEngine/wiGraphicsDevice.h b/WickedEngine/wiGraphicsDevice.h index d949abee7..090362eda 100644 --- a/WickedEngine/wiGraphicsDevice.h +++ b/WickedEngine/wiGraphicsDevice.h @@ -28,9 +28,9 @@ namespace wiGraphicsTypes {} virtual HRESULT CreateBuffer(const GPUBufferDesc *pDesc, const SubresourceData* pInitialData, GPUBuffer *ppBuffer) = 0; - virtual HRESULT CreateTexture1D(const Texture1DDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) = 0; - virtual HRESULT CreateTexture2D(const Texture2DDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) = 0; - virtual HRESULT CreateTexture3D(const Texture3DDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) = 0; + virtual HRESULT CreateTexture1D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) = 0; + virtual HRESULT CreateTexture2D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) = 0; + virtual HRESULT CreateTexture3D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) = 0; virtual HRESULT CreateInputLayout(const VertexLayoutDesc *pInputElementDescs, UINT NumElements, const void *pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength, VertexLayout *pInputLayout) = 0; virtual HRESULT CreateVertexShader(const void *pShaderBytecode, SIZE_T BytecodeLength, VertexShader *pVertexShader) = 0; diff --git a/WickedEngine/wiGraphicsDevice_DX11.cpp b/WickedEngine/wiGraphicsDevice_DX11.cpp index d42d41384..2cca87c8a 100644 --- a/WickedEngine/wiGraphicsDevice_DX11.cpp +++ b/WickedEngine/wiGraphicsDevice_DX11.cpp @@ -830,7 +830,7 @@ inline DXGI_FORMAT _ConvertFormat(FORMAT value) return DXGI_FORMAT_UNKNOWN; } -inline D3D11_TEXTURE1D_DESC _ConvertTexture1DDesc(const Texture1DDesc* pDesc) +inline D3D11_TEXTURE1D_DESC _ConvertTextureDesc1D(const TextureDesc* pDesc) { D3D11_TEXTURE1D_DESC desc; desc.Width = pDesc->Width; @@ -844,7 +844,7 @@ inline D3D11_TEXTURE1D_DESC _ConvertTexture1DDesc(const Texture1DDesc* pDesc) return desc; } -inline D3D11_TEXTURE2D_DESC _ConvertTexture2DDesc(const Texture2DDesc* pDesc) +inline D3D11_TEXTURE2D_DESC _ConvertTextureDesc2D(const TextureDesc* pDesc) { D3D11_TEXTURE2D_DESC desc; desc.Width = pDesc->Width; @@ -861,7 +861,7 @@ inline D3D11_TEXTURE2D_DESC _ConvertTexture2DDesc(const Texture2DDesc* pDesc) return desc; } -inline D3D11_TEXTURE3D_DESC _ConvertTexture3DDesc(const Texture3DDesc* pDesc) +inline D3D11_TEXTURE3D_DESC _ConvertTextureDesc3D(const TextureDesc* pDesc) { D3D11_TEXTURE3D_DESC desc; desc.Width = pDesc->Width; @@ -1327,9 +1327,9 @@ inline USAGE _ConvertUsage_Inv(D3D11_USAGE value) return USAGE_DEFAULT; } -inline Texture1DDesc _ConvertTexture1DDesc_Inv(const D3D11_TEXTURE1D_DESC* pDesc) +inline TextureDesc _ConvertTextureDesc_Inv(const D3D11_TEXTURE1D_DESC* pDesc) { - Texture1DDesc desc; + TextureDesc desc; desc.Width = pDesc->Width; desc.MipLevels = pDesc->MipLevels; desc.ArraySize = pDesc->ArraySize; @@ -1341,9 +1341,9 @@ inline Texture1DDesc _ConvertTexture1DDesc_Inv(const D3D11_TEXTURE1D_DESC* pDesc return desc; } -inline Texture2DDesc _ConvertTexture2DDesc_Inv(const D3D11_TEXTURE2D_DESC* pDesc) +inline TextureDesc _ConvertTextureDesc_Inv(const D3D11_TEXTURE2D_DESC* pDesc) { - Texture2DDesc desc; + TextureDesc desc; desc.Width = pDesc->Width; desc.Height = pDesc->Height; desc.MipLevels = pDesc->MipLevels; @@ -1358,9 +1358,9 @@ inline Texture2DDesc _ConvertTexture2DDesc_Inv(const D3D11_TEXTURE2D_DESC* pDesc return desc; } -inline Texture3DDesc _ConvertTexture3DDesc_Inv(const D3D11_TEXTURE3D_DESC* pDesc) +inline TextureDesc _ConvertTextureDesc_Inv(const D3D11_TEXTURE3D_DESC* pDesc) { - Texture3DDesc desc; + TextureDesc desc; desc.Width = pDesc->Width; desc.Height = pDesc->Height; desc.Depth = pDesc->Depth; @@ -1697,7 +1697,7 @@ HRESULT GraphicsDevice_DX11::CreateBuffer(const GPUBufferDesc *pDesc, const Subr return hr; } -HRESULT GraphicsDevice_DX11::CreateTexture1D(const Texture1DDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) +HRESULT GraphicsDevice_DX11::CreateTexture1D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) { if ((*ppTexture1D) == nullptr) { @@ -1705,7 +1705,7 @@ HRESULT GraphicsDevice_DX11::CreateTexture1D(const Texture1DDesc* pDesc, const S } (*ppTexture1D)->desc = *pDesc; - D3D11_TEXTURE1D_DESC desc = _ConvertTexture1DDesc(&(*ppTexture1D)->desc); + D3D11_TEXTURE1D_DESC desc = _ConvertTextureDesc1D(&(*ppTexture1D)->desc); D3D11_SUBRESOURCE_DATA* data = nullptr; if (pInitialData != nullptr) @@ -1748,7 +1748,7 @@ HRESULT GraphicsDevice_DX11::CreateTexture1D(const Texture1DDesc* pDesc, const S return hr; } -HRESULT GraphicsDevice_DX11::CreateTexture2D(const Texture2DDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) +HRESULT GraphicsDevice_DX11::CreateTexture2D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) { if ((*ppTexture2D) == nullptr) { @@ -1768,7 +1768,7 @@ HRESULT GraphicsDevice_DX11::CreateTexture2D(const Texture2DDesc* pDesc, const S } } - D3D11_TEXTURE2D_DESC desc = _ConvertTexture2DDesc(&(*ppTexture2D)->desc); + D3D11_TEXTURE2D_DESC desc = _ConvertTextureDesc2D(&(*ppTexture2D)->desc); D3D11_SUBRESOURCE_DATA* data = nullptr; if (pInitialData != nullptr) @@ -1831,7 +1831,7 @@ HRESULT GraphicsDevice_DX11::CreateTexture2D(const Texture2DDesc* pDesc, const S return hr; } -HRESULT GraphicsDevice_DX11::CreateTexture3D(const Texture3DDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) +HRESULT GraphicsDevice_DX11::CreateTexture3D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) { if ((*ppTexture3D) == nullptr) { @@ -1839,7 +1839,7 @@ HRESULT GraphicsDevice_DX11::CreateTexture3D(const Texture3DDesc* pDesc, const S } (*ppTexture3D)->desc = *pDesc; - D3D11_TEXTURE3D_DESC desc = _ConvertTexture3DDesc(&(*ppTexture3D)->desc); + D3D11_TEXTURE3D_DESC desc = _ConvertTextureDesc3D(&(*ppTexture3D)->desc); D3D11_SUBRESOURCE_DATA* data = nullptr; if (pInitialData != nullptr) @@ -3504,7 +3504,7 @@ HRESULT GraphicsDevice_DX11::CreateTextureFromFile(const std::string& fileName, else { D3D11_TEXTURE2D_DESC desc; (*ppTexture)->texture2D_DX11->GetDesc(&desc); - (*ppTexture)->desc = _ConvertTexture2DDesc_Inv(&desc); + (*ppTexture)->desc = _ConvertTextureDesc_Inv(&desc); } return hr; diff --git a/WickedEngine/wiGraphicsDevice_DX11.h b/WickedEngine/wiGraphicsDevice_DX11.h index 6d0f54d79..bb0b82c6b 100644 --- a/WickedEngine/wiGraphicsDevice_DX11.h +++ b/WickedEngine/wiGraphicsDevice_DX11.h @@ -53,9 +53,9 @@ namespace wiGraphicsTypes ~GraphicsDevice_DX11(); virtual HRESULT CreateBuffer(const GPUBufferDesc *pDesc, const SubresourceData* pInitialData, GPUBuffer *ppBuffer) override; - virtual HRESULT CreateTexture1D(const Texture1DDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) override; - virtual HRESULT CreateTexture2D(const Texture2DDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) override; - virtual HRESULT CreateTexture3D(const Texture3DDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) override; + virtual HRESULT CreateTexture1D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) override; + virtual HRESULT CreateTexture2D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) override; + virtual HRESULT CreateTexture3D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) override; virtual HRESULT CreateInputLayout(const VertexLayoutDesc *pInputElementDescs, UINT NumElements, const void *pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength, VertexLayout *pInputLayout) override; virtual HRESULT CreateVertexShader(const void *pShaderBytecode, SIZE_T BytecodeLength, VertexShader *pVertexShader) override; diff --git a/WickedEngine/wiGraphicsDevice_DX12.cpp b/WickedEngine/wiGraphicsDevice_DX12.cpp index 2868f7fbc..a16123ee4 100644 --- a/WickedEngine/wiGraphicsDevice_DX12.cpp +++ b/WickedEngine/wiGraphicsDevice_DX12.cpp @@ -1136,9 +1136,9 @@ namespace wiGraphicsTypes return static_cast(value); } - inline Texture2DDesc _ConvertTexture2DDesc_Inv(const D3D12_RESOURCE_DESC& desc) + inline TextureDesc _ConvertTextureDesc_Inv(const D3D12_RESOURCE_DESC& desc) { - Texture2DDesc retVal; + TextureDesc retVal; retVal.Format = _ConvertFormat_Inv(desc.Format); retVal.Width = (UINT)desc.Width; @@ -2132,7 +2132,7 @@ namespace wiGraphicsTypes return hr; } - HRESULT GraphicsDevice_DX12::CreateTexture1D(const Texture1DDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) + HRESULT GraphicsDevice_DX12::CreateTexture1D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) { if ((*ppTexture1D) == nullptr) { @@ -2145,7 +2145,7 @@ namespace wiGraphicsTypes return hr; } - HRESULT GraphicsDevice_DX12::CreateTexture2D(const Texture2DDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) + HRESULT GraphicsDevice_DX12::CreateTexture2D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) { if ((*ppTexture2D) == nullptr) { @@ -2714,7 +2714,7 @@ namespace wiGraphicsTypes return hr; } - HRESULT GraphicsDevice_DX12::CreateTexture3D(const Texture3DDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) + HRESULT GraphicsDevice_DX12::CreateTexture3D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) { if ((*ppTexture3D) == nullptr) { @@ -3721,7 +3721,7 @@ namespace wiGraphicsTypes } else { D3D12_RESOURCE_DESC desc = (*ppTexture)->resource_DX12->GetDesc(); - (*ppTexture)->desc = _ConvertTexture2DDesc_Inv(desc); + (*ppTexture)->desc = _ConvertTextureDesc_Inv(desc); D3D12_SHADER_RESOURCE_VIEW_DESC srv_desc = {}; srv_desc.Format = desc.Format; diff --git a/WickedEngine/wiGraphicsDevice_DX12.h b/WickedEngine/wiGraphicsDevice_DX12.h index aa9a2f400..3c6faa17d 100644 --- a/WickedEngine/wiGraphicsDevice_DX12.h +++ b/WickedEngine/wiGraphicsDevice_DX12.h @@ -145,9 +145,9 @@ namespace wiGraphicsTypes ~GraphicsDevice_DX12(); virtual HRESULT CreateBuffer(const GPUBufferDesc *pDesc, const SubresourceData* pInitialData, GPUBuffer *ppBuffer) override; - virtual HRESULT CreateTexture1D(const Texture1DDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) override; - virtual HRESULT CreateTexture2D(const Texture2DDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) override; - virtual HRESULT CreateTexture3D(const Texture3DDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) override; + virtual HRESULT CreateTexture1D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) override; + virtual HRESULT CreateTexture2D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) override; + virtual HRESULT CreateTexture3D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) override; virtual HRESULT CreateInputLayout(const VertexLayoutDesc *pInputElementDescs, UINT NumElements, const void *pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength, VertexLayout *pInputLayout) override; virtual HRESULT CreateVertexShader(const void *pShaderBytecode, SIZE_T BytecodeLength, VertexShader *pVertexShader) override; diff --git a/WickedEngine/wiGraphicsDevice_Vulkan.cpp b/WickedEngine/wiGraphicsDevice_Vulkan.cpp index 17a060b62..428dbde97 100644 --- a/WickedEngine/wiGraphicsDevice_Vulkan.cpp +++ b/WickedEngine/wiGraphicsDevice_Vulkan.cpp @@ -2444,11 +2444,11 @@ namespace wiGraphicsTypes return hr; } - HRESULT GraphicsDevice_Vulkan::CreateTexture1D(const Texture1DDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) + HRESULT GraphicsDevice_Vulkan::CreateTexture1D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) { return E_FAIL; } - HRESULT GraphicsDevice_Vulkan::CreateTexture2D(const Texture2DDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) + HRESULT GraphicsDevice_Vulkan::CreateTexture2D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) { if ((*ppTexture2D) == nullptr) { @@ -2958,7 +2958,7 @@ namespace wiGraphicsTypes return hr; } - HRESULT GraphicsDevice_Vulkan::CreateTexture3D(const Texture3DDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) + HRESULT GraphicsDevice_Vulkan::CreateTexture3D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) { return E_FAIL; } @@ -4485,7 +4485,7 @@ namespace wiGraphicsTypes if (img.is_valid()) { - Texture2DDesc desc; + TextureDesc desc; desc.ArraySize = 1; desc.BindFlags = BIND_SHADER_RESOURCE; desc.CPUAccessFlags = 0; @@ -4565,7 +4565,7 @@ namespace wiGraphicsTypes if (rgb != nullptr) { - Texture2DDesc desc; + TextureDesc desc; desc.ArraySize = 1; desc.BindFlags = BIND_SHADER_RESOURCE; desc.CPUAccessFlags = 0; diff --git a/WickedEngine/wiGraphicsDevice_Vulkan.h b/WickedEngine/wiGraphicsDevice_Vulkan.h index 3e9340b04..f717a7e92 100644 --- a/WickedEngine/wiGraphicsDevice_Vulkan.h +++ b/WickedEngine/wiGraphicsDevice_Vulkan.h @@ -167,9 +167,9 @@ namespace wiGraphicsTypes ~GraphicsDevice_Vulkan(); virtual HRESULT CreateBuffer(const GPUBufferDesc *pDesc, const SubresourceData* pInitialData, GPUBuffer *ppBuffer) override; - virtual HRESULT CreateTexture1D(const Texture1DDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) override; - virtual HRESULT CreateTexture2D(const Texture2DDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) override; - virtual HRESULT CreateTexture3D(const Texture3DDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) override; + virtual HRESULT CreateTexture1D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture1D **ppTexture1D) override; + virtual HRESULT CreateTexture2D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture2D **ppTexture2D) override; + virtual HRESULT CreateTexture3D(const TextureDesc* pDesc, const SubresourceData *pInitialData, Texture3D **ppTexture3D) override; virtual HRESULT CreateInputLayout(const VertexLayoutDesc *pInputElementDescs, UINT NumElements, const void *pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength, VertexLayout *pInputLayout) override; virtual HRESULT CreateVertexShader(const void *pShaderBytecode, SIZE_T BytecodeLength, VertexShader *pVertexShader) override; diff --git a/WickedEngine/wiGraphicsResource.h b/WickedEngine/wiGraphicsResource.h index 9c6aa54b1..8329ed94b 100644 --- a/WickedEngine/wiGraphicsResource.h +++ b/WickedEngine/wiGraphicsResource.h @@ -277,6 +277,7 @@ namespace wiGraphicsTypes friend class GraphicsDevice_DX12; friend class GraphicsDevice_Vulkan; private: + TextureDesc desc; ID3D11RenderTargetView* RTV_DX11; std::vector additionalRTVs_DX11; D3D12_CPU_DESCRIPTOR_HANDLE* RTV_DX12; @@ -289,6 +290,7 @@ namespace wiGraphicsTypes bool independentSRVMIPs; bool independentUAVMIPs; public: + const TextureDesc& GetDesc() const { return desc; } Texture(); virtual ~Texture(); @@ -312,13 +314,9 @@ namespace wiGraphicsTypes friend class GraphicsDevice_Vulkan; private: ID3D11Texture1D* texture1D_DX11; - - Texture1DDesc desc; public: Texture1D(); virtual ~Texture1D(); - - Texture1DDesc GetDesc() const { return desc; } }; class Texture2D : public Texture @@ -335,13 +333,9 @@ namespace wiGraphicsTypes std::vector additionalDSVs_Vulkan; ID3D11Texture2D* texture2D_DX11; - - Texture2DDesc desc; public: Texture2D(); virtual ~Texture2D(); - - Texture2DDesc GetDesc() const { return desc; } }; class Texture3D : public Texture @@ -351,13 +345,9 @@ namespace wiGraphicsTypes friend class GraphicsDevice_Vulkan; private: ID3D11Texture3D* texture3D_DX11; - - Texture3DDesc desc; public: Texture3D(); virtual ~Texture3D(); - - Texture3DDesc GetDesc() const { return desc; } }; @@ -421,6 +411,23 @@ namespace wiGraphicsTypes ComputePSO(); ~ComputePSO(); }; + + class RenderPass + { + friend class GraphicsDevice_DX11; + friend class GraphicsDevice_DX12; + friend class GraphicsDevice_Vulkan; + private: + RenderPassDesc desc; + + public: + const RenderPassDesc& GetDesc() const { return desc; } + + RenderPass(); + ~RenderPass(); + + }; + } #endif // _GRAPHICSRESOURCE_H_ diff --git a/WickedEngine/wiOcean.cpp b/WickedEngine/wiOcean.cpp index 37d30b589..7a51aed97 100644 --- a/WickedEngine/wiOcean.cpp +++ b/WickedEngine/wiOcean.cpp @@ -82,7 +82,7 @@ void createBufferAndUAV(void* data, UINT byte_width, UINT byte_stride, GPUBuffer void createTextureAndViews(UINT width, UINT height, FORMAT format, Texture2D** ppTex) { // Create 2D texture - Texture2DDesc tex_desc; + TextureDesc tex_desc; tex_desc.Width = width; tex_desc.Height = height; tex_desc.MipLevels = 0; diff --git a/WickedEngine/wiRenderTarget.cpp b/WickedEngine/wiRenderTarget.cpp index e7fe0b5f5..e53d1408e 100644 --- a/WickedEngine/wiRenderTarget.cpp +++ b/WickedEngine/wiRenderTarget.cpp @@ -45,7 +45,7 @@ void wiRenderTarget::Initialize(UINT width, UINT height, bool hasDepth if (!depthOnly) { - Texture2DDesc textureDesc; + TextureDesc textureDesc; ZeroMemory(&textureDesc, sizeof(textureDesc)); textureDesc.Width = width; textureDesc.Height = height; @@ -101,7 +101,7 @@ void wiRenderTarget::InitializeCube(UINT size, bool hasDepth, FORMAT format, UIN if (!depthOnly) { - Texture2DDesc textureDesc; + TextureDesc textureDesc; ZeroMemory(&textureDesc, sizeof(textureDesc)); textureDesc.Width = size; textureDesc.Height = size; @@ -139,7 +139,7 @@ void wiRenderTarget::InitializeCube(UINT size, bool hasDepth, FORMAT format, UIN } void wiRenderTarget::Add(FORMAT format) { - Texture2DDesc desc = GetTexture(0)->GetDesc(); + TextureDesc desc = GetTexture(0)->GetDesc(); desc.Format = format; if (!renderTargets.empty()) @@ -259,7 +259,7 @@ Texture2D* wiRenderTarget::GetTextureResolvedMSAA(GRAPHICSTHREAD threadID, int v } UINT wiRenderTarget::GetMipCount() { - Texture2DDesc desc = GetDesc(); + TextureDesc desc = GetDesc(); if (desc.MipLevels>0) return desc.MipLevels; diff --git a/WickedEngine/wiRenderTarget.h b/WickedEngine/wiRenderTarget.h index cf6cec141..f5ec3f7a0 100644 --- a/WickedEngine/wiRenderTarget.h +++ b/WickedEngine/wiRenderTarget.h @@ -35,7 +35,7 @@ public: wiGraphicsTypes::Texture2D* GetTexture(int viewID = 0) const { return renderTargets[viewID]; } wiGraphicsTypes::Texture2D* GetTextureResolvedMSAA(GRAPHICSTHREAD threadID, int viewID = 0); - wiGraphicsTypes::Texture2DDesc GetDesc(int viewID = 0) const { assert(viewID < numViews); return GetTexture(viewID)->GetDesc(); } + wiGraphicsTypes::TextureDesc GetDesc(int viewID = 0) const { assert(viewID < numViews); return GetTexture(viewID)->GetDesc(); } UINT GetMipCount(); bool IsInitialized() const { return (numViews > 0 || depth != nullptr); } }; diff --git a/WickedEngine/wiRenderer.cpp b/WickedEngine/wiRenderer.cpp index 80527b600..91ed1ce02 100644 --- a/WickedEngine/wiRenderer.cpp +++ b/WickedEngine/wiRenderer.cpp @@ -3513,7 +3513,7 @@ void wiRenderer::UpdateRenderData(GRAPHICSTHREAD threadID) { if (textures[TEXTYPE_2D_CLOUDS] == nullptr) { - Texture2DDesc desc; + TextureDesc desc; desc.ArraySize = 1; desc.BindFlags = BIND_UNORDERED_ACCESS | BIND_SHADER_RESOURCE; desc.CPUAccessFlags = 0; @@ -4670,7 +4670,7 @@ void wiRenderer::SetShadowProps2D(int resolution, int count, int softShadowQuali Light::shadowMapArray_Transparent = new Texture2D; Light::shadowMapArray_Transparent->RequestIndependentRenderTargetArraySlices(true); - Texture2DDesc desc; + TextureDesc desc; ZeroMemory(&desc, sizeof(desc)); desc.Width = SHADOWRES_2D; desc.Height = SHADOWRES_2D; @@ -4700,7 +4700,7 @@ void wiRenderer::SetShadowPropsCube(int resolution, int count) Light::shadowMapArray_Cube->RequestIndependentRenderTargetArraySlices(true); Light::shadowMapArray_Cube->RequestIndependentRenderTargetCubemapFaces(false); - Texture2DDesc desc; + TextureDesc desc; ZeroMemory(&desc, sizeof(desc)); desc.Width = SHADOWRES_CUBE; desc.Height = SHADOWRES_CUBE; @@ -5584,7 +5584,7 @@ void wiRenderer::RefreshEnvProbes(GRAPHICSTHREAD threadID) if (textures[TEXTYPE_CUBEARRAY_ENVMAPARRAY] == nullptr) { - Texture2DDesc desc; + TextureDesc desc; desc.ArraySize = envmapCount * 6; desc.BindFlags = BIND_SHADER_RESOURCE | BIND_RENDER_TARGET; desc.CPUAccessFlags = 0; @@ -5605,7 +5605,7 @@ void wiRenderer::RefreshEnvProbes(GRAPHICSTHREAD threadID) static Texture2D* envrenderingDepthBuffer = nullptr; if (envrenderingDepthBuffer == nullptr) { - Texture2DDesc desc; + TextureDesc desc; desc.ArraySize = 6; desc.BindFlags = BIND_DEPTH_STENCIL; desc.CPUAccessFlags = 0; @@ -5776,7 +5776,7 @@ void wiRenderer::VoxelRadiance(GRAPHICSTHREAD threadID) if (textures[TEXTYPE_3D_VOXELRADIANCE] == nullptr) { - Texture3DDesc desc; + TextureDesc desc; ZeroMemory(&desc, sizeof(desc)); desc.Width = voxelSceneData.res; desc.Height = voxelSceneData.res; @@ -5796,7 +5796,7 @@ void wiRenderer::VoxelRadiance(GRAPHICSTHREAD threadID) } if (voxelSceneData.secondaryBounceEnabled && textures[TEXTYPE_3D_VOXELRADIANCE_HELPER] == nullptr) { - Texture3DDesc desc = ((Texture3D*)textures[TEXTYPE_3D_VOXELRADIANCE])->GetDesc(); + TextureDesc desc = ((Texture3D*)textures[TEXTYPE_3D_VOXELRADIANCE])->GetDesc(); textures[TEXTYPE_3D_VOXELRADIANCE_HELPER] = new Texture3D; textures[TEXTYPE_3D_VOXELRADIANCE_HELPER]->RequestIndependentShaderResourcesForMIPs(true); textures[TEXTYPE_3D_VOXELRADIANCE_HELPER]->RequestIndependentUnorderedAccessResourcesForMIPs(true); @@ -5975,7 +5975,7 @@ void wiRenderer::ComputeTiledLightCulling(bool deferred, GRAPHICSTHREAD threadID } if (deferred && (textures[TEXTYPE_2D_TILEDDEFERRED_DIFFUSEUAV] == nullptr || textures[TEXTYPE_2D_TILEDDEFERRED_SPECULARUAV] == nullptr)) { - Texture2DDesc desc; + TextureDesc desc; ZeroMemory(&desc, sizeof(desc)); desc.ArraySize = 1; desc.BindFlags = BIND_UNORDERED_ACCESS | BIND_SHADER_RESOURCE; @@ -6028,7 +6028,7 @@ void wiRenderer::ComputeTiledLightCulling(bool deferred, GRAPHICSTHREAD threadID { SAFE_DELETE(textures[TEXTYPE_2D_DEBUGUAV]); - Texture2DDesc desc; + TextureDesc desc; ZeroMemory(&desc, sizeof(desc)); desc.Width = (UINT)_width; desc.Height = (UINT)_height; @@ -6117,7 +6117,7 @@ void wiRenderer::ResolveMSAADepthBuffer(Texture2D* dst, Texture2D* src, GRAPHICS GetDevice()->BindResource(CS, src, TEXSLOT_ONDEMAND0, threadID); GetDevice()->BindUnorderedAccessResourceCS(dst, 0, threadID); - Texture2DDesc desc = src->GetDesc(); + TextureDesc desc = src->GetDesc(); GetDevice()->BindComputePSO(CPSO[CSTYPE_RESOLVEMSAADEPTHSTENCIL], threadID); GetDevice()->Dispatch((UINT)ceilf(desc.Width / 16.f), (UINT)ceilf(desc.Height / 16.f), 1, threadID); @@ -6134,7 +6134,7 @@ void wiRenderer::GenerateMipChain(Texture1D* texture, MIPGENFILTER filter, GRAPH } void wiRenderer::GenerateMipChain(Texture2D* texture, MIPGENFILTER filter, GRAPHICSTHREAD threadID) { - Texture2DDesc desc = texture->GetDesc(); + TextureDesc desc = texture->GetDesc(); if (desc.MipLevels < 2) { @@ -6187,7 +6187,7 @@ void wiRenderer::GenerateMipChain(Texture2D* texture, MIPGENFILTER filter, GRAPH } void wiRenderer::GenerateMipChain(Texture3D* texture, MIPGENFILTER filter, GRAPHICSTHREAD threadID) { - Texture3DDesc desc = texture->GetDesc(); + TextureDesc desc = texture->GetDesc(); if (desc.MipLevels < 2) { @@ -6244,9 +6244,9 @@ void wiRenderer::GenerateClouds(Texture2D* dst, UINT refinementCount, float rand { GetDevice()->EventBegin("Cloud Generator", threadID); - Texture2DDesc src_desc = wiTextureHelper::getInstance()->getRandom64x64()->GetDesc(); + TextureDesc src_desc = wiTextureHelper::getInstance()->getRandom64x64()->GetDesc(); - Texture2DDesc dst_desc = dst->GetDesc(); + TextureDesc dst_desc = dst->GetDesc(); assert(dst_desc.BindFlags & BIND_UNORDERED_ACCESS); GetDevice()->BindResource(CS, wiTextureHelper::getInstance()->getRandom64x64(), TEXSLOT_ONDEMAND0, threadID); @@ -6318,7 +6318,7 @@ void wiRenderer::ManageDecalAtlas(GRAPHICSTHREAD threadID) SAFE_DELETE(atlasTexture); - Texture2DDesc desc; + TextureDesc desc; ZeroMemory(&desc, sizeof(desc)); desc.Width = (UINT)bins[0].size.w; desc.Height = (UINT)bins[0].size.h; @@ -6352,7 +6352,7 @@ void wiRenderer::ManageDecalAtlas(GRAPHICSTHREAD threadID) } rect_xywhf rect = storedTextures[decal->texture]; - Texture2DDesc desc = atlasTexture->GetDesc(); + TextureDesc desc = atlasTexture->GetDesc(); decal->atlasMulAdd = XMFLOAT4((float)rect.w / (float)desc.Width, (float)rect.h / (float)desc.Height, (float)rect.x / (float)desc.Width, (float)rect.y / (float)desc.Height); } @@ -6550,7 +6550,7 @@ Texture2D* wiRenderer::GetLuminance(Texture2D* sourceImage, GRAPHICSTHREAD threa // lower power of two //UINT minRes = wiMath::GetNextPowerOfTwo(min(device->GetScreenWidth(), device->GetScreenHeight())) / 2; - Texture2DDesc desc; + TextureDesc desc; ZeroMemory(&desc, sizeof(desc)); desc.Width = 256; desc.Height = desc.Width; @@ -6580,14 +6580,14 @@ Texture2D* wiRenderer::GetLuminance(Texture2D* sourceImage, GRAPHICSTHREAD threa if (luminance_map != nullptr) { // Pass 1 : Create luminance map from scene tex - Texture2DDesc luminance_map_desc = luminance_map->GetDesc(); + TextureDesc luminance_map_desc = luminance_map->GetDesc(); device->BindComputePSO(CPSO[CSTYPE_LUMINANCE_PASS1], threadID); device->BindResource(CS, sourceImage, TEXSLOT_ONDEMAND0, threadID); device->BindUnorderedAccessResourceCS(luminance_map, 0, threadID); device->Dispatch(luminance_map_desc.Width/16, luminance_map_desc.Height/16, 1, threadID); // Pass 2 : Reduce for average luminance until we got an 1x1 texture - Texture2DDesc luminance_avg_desc; + TextureDesc luminance_avg_desc; for (size_t i = 0; i < luminance_avg.size(); ++i) { luminance_avg_desc = luminance_avg[i]->GetDesc(); diff --git a/WickedEngine/wiTextureHelper.cpp b/WickedEngine/wiTextureHelper.cpp index 6533d9e29..c7cf225e4 100644 --- a/WickedEngine/wiTextureHelper.cpp +++ b/WickedEngine/wiTextureHelper.cpp @@ -118,7 +118,7 @@ Texture2D* wiTextureHelper::wiTextureHelperInstance::getBlackCubeMap() vector4b(unsigned char r=0, unsigned char g=0, unsigned char b=0, unsigned char a=0) :r(r), g(g), b(b), a(a) {} }; - Texture2DDesc texDesc; + TextureDesc texDesc; texDesc.Width = width; texDesc.Height = height; texDesc.MipLevels = 1; diff --git a/WickedEngine/wiTextureHelper.h b/WickedEngine/wiTextureHelper.h index 18ef9ca8d..d76f39b59 100644 --- a/WickedEngine/wiTextureHelper.h +++ b/WickedEngine/wiTextureHelper.h @@ -53,7 +53,7 @@ public: } using namespace wiGraphicsTypes; - Texture2DDesc textureDesc; + TextureDesc textureDesc; ZeroMemory(&textureDesc, sizeof(textureDesc)); textureDesc.Width = width; textureDesc.Height = height;