diff --git a/HPL2/include/graphics/ForgeRenderer.h b/HPL2/include/graphics/ForgeRenderer.h index 5e5148f2d..717959758 100644 --- a/HPL2/include/graphics/ForgeRenderer.h +++ b/HPL2/include/graphics/ForgeRenderer.h @@ -60,6 +60,7 @@ namespace hpl { void InitializeRenderer(window::NativeWindowWrapper* window); void InitializeResource(); + RendererApi GetApi(); struct SamplerPoolKey { union { diff --git a/HPL2/resource/deferred_resources.h.fsl b/HPL2/resource/deferred_resources.h.fsl index 870653708..71e405726 100644 --- a/HPL2/resource/deferred_resources.h.fsl +++ b/HPL2/resource/deferred_resources.h.fsl @@ -93,27 +93,27 @@ STRUCT(UniformObject) }; #endif -RES(Tex2D(float4), diffuseMap, UPDATE_FREQ_PER_BATCH, t2, binding = 3); -RES(Tex2D(float4), normalMap, UPDATE_FREQ_PER_BATCH, t3, binding = 4); -RES(Tex2D(float4), specularMap, UPDATE_FREQ_PER_BATCH, t4, binding = 5); -RES(Tex2D(float4), alphaMap, UPDATE_FREQ_PER_BATCH, t5, binding = 6); -RES(Tex2D(float4), heightMap, UPDATE_FREQ_PER_BATCH, t6, binding = 7); -RES(Tex2D(float4), illuminationMap, UPDATE_FREQ_PER_BATCH, t7, binding = 8); -RES(TexCube(float4), cubeMap, UPDATE_FREQ_PER_BATCH, t8, binding = 9); -RES(Tex2D(float4), dissolveAlphaMap, UPDATE_FREQ_PER_BATCH, t9, binding = 10); -RES(Tex2D(float4), cubeMapAlpha, UPDATE_FREQ_PER_BATCH, t10, binding = 11); - -RES(SamplerState, refractionSampler, UPDATE_FREQ_NONE, s1, binding = 12); -RES(SamplerState, dissolveSampler, UPDATE_FREQ_NONE, s2, binding = 13); -RES(SamplerState, nearestSampler, UPDATE_FREQ_NONE, s3, binding = 14); -RES(SamplerState, materialSampler, UPDATE_FREQ_NONE, s4, binding = 15); - -RES(Tex2D(float4), dissolveMap, UPDATE_FREQ_NONE, t11, binding = 16); - -RES(Buffer(UniformMaterial), uniformMaterialBuffer, UPDATE_FREQ_PER_FRAME, t0, binding = 1); -RES(Buffer(UniformObject), uniformObjectBuffer, UPDATE_FREQ_PER_FRAME, t1, binding = 2); -RES(Tex2D(float4), refractionMap, UPDATE_FREQ_PER_FRAME, t12, binding = 18); -RES(Tex2D(float4), reflectionMap[4], UPDATE_FREQ_PER_FRAME, t13, binding = 19); +RES(Tex2D(float4), diffuseMap, UPDATE_FREQ_PER_BATCH, t2, binding = 1); +RES(Tex2D(float4), normalMap, UPDATE_FREQ_PER_BATCH, t3, binding = 2); +RES(Tex2D(float4), specularMap, UPDATE_FREQ_PER_BATCH, t4, binding = 3); +RES(Tex2D(float4), alphaMap, UPDATE_FREQ_PER_BATCH, t5, binding = 4); +RES(Tex2D(float4), heightMap, UPDATE_FREQ_PER_BATCH, t6, binding = 5); +RES(Tex2D(float4), illuminationMap, UPDATE_FREQ_PER_BATCH, t7, binding = 6); +RES(TexCube(float4), cubeMap, UPDATE_FREQ_PER_BATCH, t8, binding = 7); +RES(Tex2D(float4), dissolveAlphaMap, UPDATE_FREQ_PER_BATCH, t9, binding = 8); +RES(Tex2D(float4), cubeMapAlpha, UPDATE_FREQ_PER_BATCH, t10, binding = 9); + +RES(SamplerState, refractionSampler, UPDATE_FREQ_NONE, s1, binding = 10); +RES(SamplerState, dissolveSampler, UPDATE_FREQ_NONE, s2, binding = 11); +RES(SamplerState, nearestSampler, UPDATE_FREQ_NONE, s3, binding = 12); +RES(SamplerState, materialSampler, UPDATE_FREQ_NONE, s4, binding = 13); + +RES(Tex2D(float4), dissolveMap, UPDATE_FREQ_NONE, t11, binding = 14); + +RES(Buffer(UniformMaterial), uniformMaterialBuffer, UPDATE_FREQ_PER_FRAME, t0, binding = 15); +RES(Buffer(UniformObject), uniformObjectBuffer, UPDATE_FREQ_PER_FRAME, t1, binding = 16); +RES(Tex2D(float4), refractionMap, UPDATE_FREQ_PER_FRAME, t12, binding = 17); +RES(Tex2D(float4), reflectionMap[4], UPDATE_FREQ_PER_FRAME, t13, binding = 18); PUSH_CONSTANT(materialRootConstant, b0) { diff --git a/HPL2/sources/graphics/ForgeRenderer.cpp b/HPL2/sources/graphics/ForgeRenderer.cpp index 44ab05843..d661c8fd6 100644 --- a/HPL2/sources/graphics/ForgeRenderer.cpp +++ b/HPL2/sources/graphics/ForgeRenderer.cpp @@ -14,8 +14,12 @@ #endif #include "renderdoc_app.h" #endif +extern RendererApi gSelectedRendererApi; namespace hpl { + RendererApi ForgeRenderer::GetApi() { + return gSelectedRendererApi; + } void ForgeRenderer::IncrementFrame() { // Stall if CPU is running "Swap Chain Buffer Count" frames ahead of GPU @@ -58,7 +62,7 @@ namespace hpl { { cmdBindRenderTargets(frame.m_cmd, 1, &swapChainTarget, NULL, NULL, NULL, NULL, -1, -1); uint32_t rootConstantIndex = getDescriptorIndexFromName(m_finalRootSignature , "uRootConstants"); - + cmdSetViewport(frame.m_cmd, 0.0f, 0.0f, static_cast(swapChainTarget->mWidth), static_cast(swapChainTarget->mHeight), 0.0f, 1.0f); cmdSetScissor(frame.m_cmd, 0, 0, static_cast(swapChainTarget->mWidth), static_cast(swapChainTarget->mHeight)); cmdBindPipeline(frame.m_cmd, m_finalPipeline.m_handle); @@ -121,7 +125,7 @@ namespace hpl { assert(ret == 1); } #endif - + #endif initRenderer("test", &desc, &m_renderer); diff --git a/HPL2/sources/graphics/RendererDeferred.cpp b/HPL2/sources/graphics/RendererDeferred.cpp index 0aeea86de..39353cb50 100644 --- a/HPL2/sources/graphics/RendererDeferred.cpp +++ b/HPL2/sources/graphics/RendererDeferred.cpp @@ -2508,8 +2508,13 @@ namespace hpl { cmdSetScissor(cmd, 0, 0, outputBuffer->mWidth, outputBuffer->mHeight); cmdBindPipeline(cmd, options.m_invert ? m_solidIlluminationPipelineCW.m_handle: m_solidIlluminationPipelineCCW.m_handle); - //cmdBindDescriptorSet(cmd, frameDescriptorIndex, m_materialSet.m_frameSet[frame.m_frameIndex].m_handle); + // for DirectX12 these frame descriptors are not used so its ommitied for the draw +#if defined(VULKAN) + if (frame.m_renderer->GetApi() == RENDERER_API_VULKAN) { + cmdBindDescriptorSet(cmd, frameDescriptorIndex, m_materialSet.m_frameSet[frame.m_frameIndex].m_handle); + } +#endif for (auto& illuminationItem : m_rendererList.GetRenderableItems(eRenderListType_Illumination)) { cMaterial* pMaterial = illuminationItem->GetMaterial(); iVertexBuffer* vertexBuffer = illuminationItem->GetVertexBuffer();