Add CreateDesc for D3D12ShaderResourceView
This commit is contained in:
@@ -29,5 +29,16 @@ void D3D12ShaderResourceView::Shutdown() {
|
||||
m_resource = nullptr;
|
||||
}
|
||||
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC D3D12ShaderResourceView::CreateDesc(Format format, D3D12_SRV_DIMENSION dimension, uint32_t mipLevels) {
|
||||
D3D12_SHADER_RESOURCE_VIEW_DESC desc = {};
|
||||
desc.Format = ToD3D12(format);
|
||||
desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
||||
desc.ViewDimension = dimension;
|
||||
if (dimension == D3D12_SRV_DIMENSION_TEXTURE2D) {
|
||||
desc.Texture2D.MipLevels = mipLevels;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
|
||||
Reference in New Issue
Block a user