Fix Skybox rendering regression

#2943
This commit is contained in:
Wojtek Figat
2024-09-24 23:01:13 +02:00
parent c8eed098ba
commit 2ad9c7f4d5
5 changed files with 31 additions and 0 deletions

View File

@@ -166,6 +166,8 @@ public:
// Binds the shared per-view constant buffer at slot 1 (see ViewData in MaterialCommon.hlsl)
void BindViewData();
// Binds the shared per-draw constant buffer at slot 2 (see DrawData in MaterialCommon.hlsl)
void BindDrawData();
};
/// <summary>

View File

@@ -84,6 +84,27 @@ void IMaterial::BindParameters::BindViewData()
GPUContext->BindCB(1, PerViewConstants);
}
void IMaterial::BindParameters::BindDrawData()
{
// Write draw call to the object buffer
auto& objectBuffer = RenderContext.List->TempObjectBuffer;
objectBuffer.Clear();
ShaderObjectData objData;
objData.Store(*DrawCall);
objectBuffer.Write(objData);
objectBuffer.Flush(GPUContext);
ObjectBuffer = objectBuffer.GetBuffer()->View();
// Setup data
MaterialShaderDataPerDraw perDraw;
perDraw.DrawPadding = Float3::Zero;
perDraw.DrawObjectIndex = 0;
// Update constants
GPUContext->UpdateCB(PerDrawConstants, &perDraw);
GPUContext->BindCB(2, PerDrawConstants);
}
GPUPipelineState* MaterialShader::PipelineStateCache::InitPS(CullMode mode, bool wireframe)
{
Desc.CullMode = mode;