start subresource refactor
This commit is contained in:
@@ -102,6 +102,8 @@ void RegisterTexture2D(tinygltf::Image *image, const string& type_name)
|
||||
|
||||
if (!image->image.empty())
|
||||
{
|
||||
GraphicsDevice* device = wiRenderer::GetDevice();
|
||||
|
||||
TextureDesc desc;
|
||||
desc.ArraySize = 1;
|
||||
desc.BindFlags = BIND_SHADER_RESOURCE | BIND_UNORDERED_ACCESS;
|
||||
@@ -123,11 +125,18 @@ void RegisterTexture2D(tinygltf::Image *image, const string& type_name)
|
||||
}
|
||||
|
||||
Texture2D* tex = new Texture2D;
|
||||
tex->RequestIndependentShaderResourcesForMIPs(true);
|
||||
tex->RequestIndependentUnorderedAccessResourcesForMIPs(true);
|
||||
HRESULT hr = wiRenderer::GetDevice()->CreateTexture2D(&desc, InitData.data(), tex);
|
||||
HRESULT hr = device->CreateTexture2D(&desc, InitData.data(), tex);
|
||||
assert(SUCCEEDED(hr));
|
||||
|
||||
for (UINT i = 0; i < tex->GetDesc().MipLevels; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(tex, SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
subresource_index = device->CreateSubresource(tex, SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
|
||||
if (tex != nullptr)
|
||||
{
|
||||
wiRenderer::AddDeferredMIPGen(tex);
|
||||
|
||||
@@ -26,10 +26,17 @@ void RenderPath3D::ResizeBuffers()
|
||||
desc.Width = wiRenderer::GetInternalResolution().x / 2;
|
||||
desc.Height = wiRenderer::GetInternalResolution().y / 2;
|
||||
desc.MipLevels = 5;
|
||||
rtSSR.RequestIndependentUnorderedAccessResourcesForMIPs(true);
|
||||
rtSSR.RequestIndependentShaderResourcesForMIPs(true);
|
||||
device->CreateTexture2D(&desc, nullptr, &rtSSR);
|
||||
device->SetName(&rtSSR, "rtSSR");
|
||||
|
||||
for (UINT i = 0; i < rtSSR.GetDesc().MipLevels; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(&rtSSR, SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
subresource_index = device->CreateSubresource(&rtSSR, SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
}
|
||||
{
|
||||
TextureDesc desc;
|
||||
@@ -65,10 +72,17 @@ void RenderPath3D::ResizeBuffers()
|
||||
desc.Width = wiRenderer::GetInternalResolution().x;
|
||||
desc.Height = wiRenderer::GetInternalResolution().y;
|
||||
desc.MipLevels = 8;
|
||||
rtSceneCopy.RequestIndependentShaderResourcesForMIPs(true);
|
||||
rtSceneCopy.RequestIndependentUnorderedAccessResourcesForMIPs(true);
|
||||
device->CreateTexture2D(&desc, nullptr, &rtSceneCopy);
|
||||
device->SetName(&rtSceneCopy, "rtSceneCopy");
|
||||
|
||||
for (UINT i = 0; i < rtSceneCopy.GetDesc().MipLevels; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(&rtSceneCopy, SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
subresource_index = device->CreateSubresource(&rtSceneCopy, SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
}
|
||||
{
|
||||
TextureDesc desc;
|
||||
@@ -134,10 +148,17 @@ void RenderPath3D::ResizeBuffers()
|
||||
desc.Width = wiRenderer::GetInternalResolution().x / 4;
|
||||
desc.Height = wiRenderer::GetInternalResolution().y / 4;
|
||||
desc.MipLevels = 5;
|
||||
rtBloom.RequestIndependentShaderResourcesForMIPs(true);
|
||||
rtBloom.RequestIndependentUnorderedAccessResourcesForMIPs(true);
|
||||
device->CreateTexture2D(&desc, nullptr, &rtBloom);
|
||||
device->SetName(&rtBloom, "rtBloom");
|
||||
|
||||
for (UINT i = 0; i < rtBloom.GetDesc().MipLevels; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(&rtBloom, SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
subresource_index = device->CreateSubresource(&rtBloom, SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
}
|
||||
{
|
||||
TextureDesc desc;
|
||||
|
||||
@@ -262,6 +262,13 @@ namespace wiGraphics
|
||||
INDEXFORMAT_16BIT,
|
||||
INDEXFORMAT_32BIT,
|
||||
};
|
||||
enum SUBRESOURCE_TYPE
|
||||
{
|
||||
SRV,
|
||||
UAV,
|
||||
RTV,
|
||||
DSV,
|
||||
};
|
||||
|
||||
// Flags ////////////////////////////////////////////
|
||||
enum CLEAR_FLAG
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace wiGraphics
|
||||
virtual HRESULT CreateQuery(const GPUQueryDesc *pDesc, GPUQuery *pQuery) = 0;
|
||||
virtual HRESULT CreatePipelineState(const PipelineStateDesc* pDesc, PipelineState* pso) = 0;
|
||||
|
||||
virtual int CreateSubresource(Texture* texture, SUBRESOURCE_TYPE type, UINT firstSlice, UINT sliceCount = 1, UINT firstMip = 0, UINT mipCount = 0) = 0;
|
||||
|
||||
|
||||
virtual void DestroyResource(GPUResource* pResource) = 0;
|
||||
virtual void DestroyBuffer(GPUBuffer *pBuffer) = 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -88,6 +88,7 @@ namespace wiGraphics
|
||||
HRESULT CreateQuery(const GPUQueryDesc *pDesc, GPUQuery *pQuery) override;
|
||||
HRESULT CreatePipelineState(const PipelineStateDesc* pDesc, PipelineState* pso) override;
|
||||
|
||||
int CreateSubresource(Texture* texture, SUBRESOURCE_TYPE type, UINT firstSlice, UINT sliceCount = 1, UINT firstMip = 0, UINT mipCount = 0) override;
|
||||
|
||||
void DestroyResource(GPUResource* pResource) override;
|
||||
void DestroyBuffer(GPUBuffer *pBuffer) override;
|
||||
@@ -167,14 +168,6 @@ namespace wiGraphics
|
||||
void EventBegin(const std::string& name, CommandList cmd) override;
|
||||
void EventEnd(CommandList cmd) override;
|
||||
void SetMarker(const std::string& name, CommandList cmd) override;
|
||||
|
||||
private:
|
||||
HRESULT CreateShaderResourceView(Texture1D* pTexture);
|
||||
HRESULT CreateShaderResourceView(Texture2D* pTexture);
|
||||
HRESULT CreateShaderResourceView(Texture3D* pTexture);
|
||||
HRESULT CreateRenderTargetView(Texture2D* pTexture);
|
||||
HRESULT CreateRenderTargetView(Texture3D* pTexture);
|
||||
HRESULT CreateDepthStencilView(Texture2D* pTexture);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -224,6 +224,7 @@ namespace wiGraphics
|
||||
HRESULT CreateQuery(const GPUQueryDesc *pDesc, GPUQuery *pQuery) override;
|
||||
HRESULT CreatePipelineState(const PipelineStateDesc* pDesc, PipelineState* pso) override;
|
||||
|
||||
int CreateSubresource(Texture* texture, SUBRESOURCE_TYPE type, UINT firstSlice, UINT sliceCount = 1, UINT firstMip = 0, UINT mipCount = 0) override;
|
||||
|
||||
void DestroyResource(GPUResource* pResource) override;
|
||||
void DestroyBuffer(GPUBuffer *pBuffer) override;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -290,6 +290,7 @@ namespace wiGraphics
|
||||
HRESULT CreateQuery(const GPUQueryDesc *pDesc, GPUQuery *pQuery) override;
|
||||
HRESULT CreatePipelineState(const PipelineStateDesc* pDesc, PipelineState* pso) override;
|
||||
|
||||
int CreateSubresource(Texture* texture, SUBRESOURCE_TYPE type, UINT firstSlice, UINT sliceCount = 1, UINT firstMip = 0, UINT mipCount = 0) override;
|
||||
|
||||
void DestroyResource(GPUResource* pResource) override;
|
||||
void DestroyBuffer(GPUBuffer *pBuffer) override;
|
||||
|
||||
@@ -107,27 +107,6 @@ namespace wiGraphics
|
||||
}
|
||||
}
|
||||
|
||||
void Texture::RequestIndependentRenderTargetArraySlices(bool value)
|
||||
{
|
||||
independentRTVArraySlices = value;
|
||||
}
|
||||
void Texture::RequestIndependentRenderTargetCubemapFaces(bool value)
|
||||
{
|
||||
independentRTVCubemapFaces = value;
|
||||
}
|
||||
void Texture::RequestIndependentShaderResourceArraySlices(bool value)
|
||||
{
|
||||
independentSRVArraySlices = value;
|
||||
}
|
||||
void Texture::RequestIndependentShaderResourcesForMIPs(bool value)
|
||||
{
|
||||
independentSRVMIPs = value;
|
||||
}
|
||||
void Texture::RequestIndependentUnorderedAccessResourcesForMIPs(bool value)
|
||||
{
|
||||
independentUAVMIPs = value;
|
||||
}
|
||||
|
||||
Texture1D::~Texture1D()
|
||||
{
|
||||
if (device != nullptr)
|
||||
|
||||
@@ -98,11 +98,11 @@ namespace wiGraphics
|
||||
inline bool IsTexture() const { return type == TEXTURE_1D || type == TEXTURE_2D || type == TEXTURE_3D; }
|
||||
inline bool IsBuffer() const { return type == BUFFER; }
|
||||
|
||||
wiCPUHandle SRV = WI_NULL_HANDLE; // main resource SRV
|
||||
std::vector<wiCPUHandle> additionalSRVs; // can be used for sub-resources if requested
|
||||
wiCPUHandle SRV = WI_NULL_HANDLE;
|
||||
std::vector<wiCPUHandle> subresourceSRVs;
|
||||
|
||||
wiCPUHandle UAV = WI_NULL_HANDLE; // main resource UAV
|
||||
std::vector<wiCPUHandle> additionalUAVs; // can be used for sub-resources if requested
|
||||
wiCPUHandle UAV = WI_NULL_HANDLE;
|
||||
std::vector<wiCPUHandle> subresourceUAVs;
|
||||
|
||||
wiCPUHandle resource = WI_NULL_HANDLE;
|
||||
wiCPUHandle resourceMemory = WI_NULL_HANDLE;
|
||||
@@ -163,25 +163,9 @@ namespace wiGraphics
|
||||
{
|
||||
TextureDesc desc;
|
||||
wiCPUHandle RTV = WI_NULL_HANDLE;
|
||||
std::vector<wiCPUHandle> additionalRTVs;
|
||||
bool independentRTVArraySlices = false;
|
||||
bool independentRTVCubemapFaces = false;
|
||||
bool independentSRVArraySlices = false;
|
||||
bool independentSRVMIPs = false;
|
||||
bool independentUAVMIPs = false;
|
||||
std::vector<wiCPUHandle> subresourceRTVs;
|
||||
|
||||
const TextureDesc& GetDesc() const { return desc; }
|
||||
|
||||
// if true, then each array slice will get a unique rendertarget
|
||||
void RequestIndependentRenderTargetArraySlices(bool value);
|
||||
// if true, then each face of the cubemap will get a unique rendertarget
|
||||
void RequestIndependentRenderTargetCubemapFaces(bool value);
|
||||
// if true, then each array slice will get a unique shader resource
|
||||
void RequestIndependentShaderResourceArraySlices(bool value);
|
||||
// if true, then each miplevel will get unique shader resource
|
||||
void RequestIndependentShaderResourcesForMIPs(bool value);
|
||||
// if true, then each miplevel will get unique unordered access resource
|
||||
void RequestIndependentUnorderedAccessResourcesForMIPs(bool value);
|
||||
};
|
||||
|
||||
struct Texture1D : public Texture
|
||||
@@ -192,7 +176,7 @@ namespace wiGraphics
|
||||
struct Texture2D : public Texture
|
||||
{
|
||||
wiCPUHandle DSV = WI_NULL_HANDLE;
|
||||
std::vector<wiCPUHandle> additionalDSVs;
|
||||
std::vector<wiCPUHandle> subresourceDSVs;
|
||||
|
||||
virtual ~Texture2D();
|
||||
};
|
||||
|
||||
@@ -87,7 +87,8 @@ void createBufferAndUAV(void* data, UINT byte_width, UINT byte_stride, GPUBuffer
|
||||
|
||||
void createTextureAndViews(UINT width, UINT height, FORMAT format, Texture2D* pTex)
|
||||
{
|
||||
// Create 2D texture
|
||||
GraphicsDevice* device = wiRenderer::GetDevice();
|
||||
|
||||
TextureDesc tex_desc;
|
||||
tex_desc.Width = width;
|
||||
tex_desc.Height = height;
|
||||
@@ -100,10 +101,16 @@ void createTextureAndViews(UINT width, UINT height, FORMAT format, Texture2D* pT
|
||||
tex_desc.BindFlags = BIND_SHADER_RESOURCE | BIND_UNORDERED_ACCESS | BIND_RENDER_TARGET;
|
||||
tex_desc.CPUAccessFlags = 0;
|
||||
|
||||
pTex->RequestIndependentShaderResourcesForMIPs(true);
|
||||
pTex->RequestIndependentUnorderedAccessResourcesForMIPs(true);
|
||||
wiRenderer::GetDevice()->CreateTexture2D(&tex_desc, nullptr, pTex);
|
||||
device->CreateTexture2D(&tex_desc, nullptr, pTex);
|
||||
|
||||
for (UINT i = 0; i < pTex->GetDesc().MipLevels; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(pTex, SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
subresource_index = device->CreateSubresource(pTex, SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+71
-19
@@ -4936,8 +4936,7 @@ void SetShadowProps2D(int resolution, int count, int softShadowQuality)
|
||||
|
||||
if (SHADOWCOUNT_2D > 0 && SHADOWRES_2D > 0)
|
||||
{
|
||||
shadowMapArray_2D.RequestIndependentRenderTargetArraySlices(true);
|
||||
shadowMapArray_Transparent.RequestIndependentRenderTargetArraySlices(true);
|
||||
GraphicsDevice* device = GetDevice();
|
||||
|
||||
TextureDesc desc;
|
||||
desc.Width = SHADOWRES_2D;
|
||||
@@ -4952,11 +4951,20 @@ void SetShadowProps2D(int resolution, int count, int softShadowQuality)
|
||||
|
||||
desc.BindFlags = BIND_DEPTH_STENCIL | BIND_SHADER_RESOURCE;
|
||||
desc.Format = DSFormat_small_alias;
|
||||
GetDevice()->CreateTexture2D(&desc, nullptr, &shadowMapArray_2D);
|
||||
device->CreateTexture2D(&desc, nullptr, &shadowMapArray_2D);
|
||||
|
||||
desc.BindFlags = BIND_RENDER_TARGET | BIND_SHADER_RESOURCE;
|
||||
desc.Format = RTFormat_ldr;
|
||||
GetDevice()->CreateTexture2D(&desc, nullptr, &shadowMapArray_Transparent);
|
||||
device->CreateTexture2D(&desc, nullptr, &shadowMapArray_Transparent);
|
||||
|
||||
for (UINT i = 0; i < desc.ArraySize; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(&shadowMapArray_2D, DSV, i, 1);
|
||||
assert(subresource_index == i);
|
||||
subresource_index = device->CreateSubresource(&shadowMapArray_Transparent, RTV, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4973,8 +4981,7 @@ void SetShadowPropsCube(int resolution, int count)
|
||||
|
||||
if (SHADOWCOUNT_CUBE > 0 && SHADOWRES_CUBE > 0)
|
||||
{
|
||||
shadowMapArray_Cube.RequestIndependentRenderTargetArraySlices(true);
|
||||
shadowMapArray_Cube.RequestIndependentRenderTargetCubemapFaces(false);
|
||||
GraphicsDevice* device = GetDevice();
|
||||
|
||||
TextureDesc desc;
|
||||
desc.Width = SHADOWRES_CUBE;
|
||||
@@ -4988,7 +4995,14 @@ void SetShadowPropsCube(int resolution, int count)
|
||||
desc.BindFlags = BIND_DEPTH_STENCIL | BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.MiscFlags = RESOURCE_MISC_TEXTURECUBE;
|
||||
GetDevice()->CreateTexture2D(&desc, nullptr, &shadowMapArray_Cube);
|
||||
device->CreateTexture2D(&desc, nullptr, &shadowMapArray_Cube);
|
||||
|
||||
for (UINT i = 0; i < desc.ArraySize; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(&shadowMapArray_Cube, DSV, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6236,16 +6250,29 @@ void RefreshEnvProbes(CommandList cmd)
|
||||
desc.Height = envmapRes;
|
||||
desc.Width = envmapRes;
|
||||
desc.MipLevels = envmapMIPs;
|
||||
desc.MiscFlags = RESOURCE_MISC_TEXTURECUBE /*| RESOURCE_MISC_GENERATE_MIPS*/;
|
||||
desc.MiscFlags = RESOURCE_MISC_TEXTURECUBE;
|
||||
desc.Usage = USAGE_DEFAULT;
|
||||
|
||||
textures[TEXTYPE_CUBEARRAY_ENVMAPARRAY] = new Texture2D;
|
||||
textures[TEXTYPE_CUBEARRAY_ENVMAPARRAY]->RequestIndependentRenderTargetArraySlices(true);
|
||||
textures[TEXTYPE_CUBEARRAY_ENVMAPARRAY]->RequestIndependentShaderResourceArraySlices(true);
|
||||
textures[TEXTYPE_CUBEARRAY_ENVMAPARRAY]->RequestIndependentShaderResourcesForMIPs(true);
|
||||
textures[TEXTYPE_CUBEARRAY_ENVMAPARRAY]->RequestIndependentUnorderedAccessResourcesForMIPs(true);
|
||||
HRESULT hr = device->CreateTexture2D(&desc, nullptr, (Texture2D*)textures[TEXTYPE_CUBEARRAY_ENVMAPARRAY]);
|
||||
assert(SUCCEEDED(hr));
|
||||
|
||||
for (UINT i = 0; i < envmapCount; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(textures[TEXTYPE_CUBEARRAY_ENVMAPARRAY], RTV, i, 6);
|
||||
assert(subresource_index == i);
|
||||
subresource_index = device->CreateSubresource(textures[TEXTYPE_CUBEARRAY_ENVMAPARRAY], SRV, i, 6);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
for (UINT i = 0; i < textures[TEXTYPE_CUBEARRAY_ENVMAPARRAY]->GetDesc().MipLevels; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(textures[TEXTYPE_CUBEARRAY_ENVMAPARRAY], SRV, 0, desc.ArraySize, i, 1);
|
||||
assert(subresource_index == i);
|
||||
subresource_index = device->CreateSubresource(textures[TEXTYPE_CUBEARRAY_ENVMAPARRAY], UAV, 0, desc.ArraySize, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
}
|
||||
|
||||
static std::unique_ptr<Texture2D> envrenderingDepthBuffer;
|
||||
@@ -6473,11 +6500,17 @@ void RefreshImpostors(CommandList cmd)
|
||||
desc.MiscFlags = 0;
|
||||
|
||||
textures[TEXTYPE_2D_IMPOSTORARRAY] = new Texture2D;
|
||||
textures[TEXTYPE_2D_IMPOSTORARRAY]->RequestIndependentRenderTargetArraySlices(true);
|
||||
HRESULT hr = device->CreateTexture2D(&desc, nullptr, (Texture2D*)textures[TEXTYPE_2D_IMPOSTORARRAY]);
|
||||
assert(SUCCEEDED(hr));
|
||||
device->SetName(textures[TEXTYPE_2D_IMPOSTORARRAY], "ImpostorTarget");
|
||||
|
||||
for (UINT i = 0; i < desc.ArraySize; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(textures[TEXTYPE_2D_IMPOSTORARRAY], RTV, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
|
||||
desc.BindFlags = BIND_DEPTH_STENCIL;
|
||||
desc.ArraySize = 1;
|
||||
desc.Format = DSFormat_small;
|
||||
@@ -6647,19 +6680,33 @@ void VoxelRadiance(CommandList cmd)
|
||||
desc.MiscFlags = 0;
|
||||
|
||||
textures[TEXTYPE_3D_VOXELRADIANCE] = new Texture3D;
|
||||
textures[TEXTYPE_3D_VOXELRADIANCE]->RequestIndependentShaderResourcesForMIPs(true);
|
||||
textures[TEXTYPE_3D_VOXELRADIANCE]->RequestIndependentUnorderedAccessResourcesForMIPs(true);
|
||||
HRESULT hr = device->CreateTexture3D(&desc, nullptr, (Texture3D*)textures[TEXTYPE_3D_VOXELRADIANCE]);
|
||||
assert(SUCCEEDED(hr));
|
||||
|
||||
for (UINT i = 0; i < decalAtlas.GetDesc().MipLevels; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(textures[TEXTYPE_3D_VOXELRADIANCE], SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
subresource_index = device->CreateSubresource(textures[TEXTYPE_3D_VOXELRADIANCE], UAV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
}
|
||||
if (voxelSceneData.secondaryBounceEnabled && textures[TEXTYPE_3D_VOXELRADIANCE_HELPER] == nullptr)
|
||||
{
|
||||
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);
|
||||
HRESULT hr = device->CreateTexture3D(&desc, nullptr, (Texture3D*)textures[TEXTYPE_3D_VOXELRADIANCE_HELPER]);
|
||||
assert(SUCCEEDED(hr));
|
||||
|
||||
for (UINT i = 0; i < decalAtlas.GetDesc().MipLevels; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(textures[TEXTYPE_3D_VOXELRADIANCE_HELPER], SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
subresource_index = device->CreateSubresource(textures[TEXTYPE_3D_VOXELRADIANCE_HELPER], UAV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
}
|
||||
if (!resourceBuffers[RBTYPE_VOXELSCENE].IsValid())
|
||||
{
|
||||
@@ -7692,10 +7739,15 @@ void ManageDecalAtlas()
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.MiscFlags = 0;
|
||||
|
||||
decalAtlas.RequestIndependentUnorderedAccessResourcesForMIPs(true);
|
||||
|
||||
device->CreateTexture2D(&desc, nullptr, &decalAtlas);
|
||||
device->SetName(&decalAtlas, "decalAtlas");
|
||||
|
||||
for (UINT i = 0; i < decalAtlas.GetDesc().MipLevels; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(&decalAtlas, UAV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -237,6 +237,8 @@ const void* wiResourceManager::add(const wiHashString& name, Data_Type newType)
|
||||
|
||||
if (rgb != nullptr)
|
||||
{
|
||||
GraphicsDevice* device = wiRenderer::GetDevice();
|
||||
|
||||
TextureDesc desc;
|
||||
desc.ArraySize = 1;
|
||||
desc.BindFlags = BIND_SHADER_RESOURCE | BIND_UNORDERED_ACCESS;
|
||||
@@ -258,11 +260,18 @@ const void* wiResourceManager::add(const wiHashString& name, Data_Type newType)
|
||||
}
|
||||
|
||||
Texture2D* image = new Texture2D;
|
||||
image->RequestIndependentShaderResourcesForMIPs(true);
|
||||
image->RequestIndependentUnorderedAccessResourcesForMIPs(true);
|
||||
HRESULT hr = wiRenderer::GetDevice()->CreateTexture2D(&desc, InitData.data(), image);
|
||||
HRESULT hr = device->CreateTexture2D(&desc, InitData.data(), image);
|
||||
assert(SUCCEEDED(hr));
|
||||
wiRenderer::GetDevice()->SetName(image, nameStr);
|
||||
device->SetName(image, nameStr);
|
||||
|
||||
for (UINT i = 0; i < image->GetDesc().MipLevels; ++i)
|
||||
{
|
||||
int subresource_index;
|
||||
subresource_index = device->CreateSubresource(image, SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
subresource_index = device->CreateSubresource(image, SRV, 0, 1, i, 1);
|
||||
assert(subresource_index == i);
|
||||
}
|
||||
|
||||
if (image != nullptr && image->GetDesc().MipLevels > 1)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wiVersion
|
||||
// minor features, major updates
|
||||
const int minor = 28;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 23;
|
||||
const int revision = 24;
|
||||
|
||||
|
||||
long GetVersion()
|
||||
|
||||
Reference in New Issue
Block a user