Skip to content

Commit 33abcd3

Browse files
authored
Merge pull request #100 from HHHHHHHHHHHHHHHHHHHHHCS/master
Fix AMD Crash, because upload buffer is not set
2 parents ef884d5 + 56c13b8 commit 33abcd3

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

content/shaders/Lighting.hlsli

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,11 @@ float3 GetBilinearInterpolationFromNeighbourProbes(float3 pos, float distanceBet
414414
// ==============================================================================================================
415415
int GetLightProbesCellIndex(float3 pos, float4 probesCellsCount, float4 sceneProbeBounds, float distanceBetweenProbes, float probeSkips = 1.0f)
416416
{
417+
if(probesCellsCount.w <= 0)
418+
{
419+
return -1;
420+
}
421+
417422
const bool is2DGrid = sceneProbeBounds.w < 0.0;
418423
int finalIndex = -1;
419424
float3 index = (pos - sceneProbeBounds.xyz) / (distanceBetweenProbes * probeSkips);

source/EveryRay_Core/ER_Illumination.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,10 @@ namespace EveryRay_Core {
11341134
}
11351135
else
11361136
{
1137+
mLightProbesConstantBuffer.Data.DiffuseProbesCellsCount = XMFLOAT4{ 0, 0, 0, 0 };
1138+
mLightProbesConstantBuffer.Data.SpecularProbesCellsCount = XMFLOAT4{ 0, 0, 0, 0 };
1139+
mLightProbesConstantBuffer.ApplyChanges(rhi);
1140+
11371141
if (rhi->IsRootConstantSupported())
11381142
{
11391143
rhi->SetConstantBuffers(ER_VERTEX, { mForwardLightingConstantBuffer.Buffer(), aObj->GetObjectsConstantBuffer().Buffer() }, 0, mForwardLightingRS, FORWARD_LIGHTING_PASS_ROOT_DESCRIPTOR_TABLE_CBV_INDEX);
@@ -1144,7 +1148,7 @@ namespace EveryRay_Core {
11441148
rhi->SetConstantBuffers(ER_VERTEX, { mForwardLightingConstantBuffer.Buffer(), aObj->GetObjectsConstantBuffer().Buffer() }, 0, mForwardLightingRS, FORWARD_LIGHTING_PASS_ROOT_DESCRIPTOR_TABLE_CBV_INDEX);
11451149
rhi->SetConstantBuffers(ER_VERTEX, { aObj->GetObjectsFakeRootConstantBuffer().Buffer() }, 3 /* we used 0-2 slots already*/, mForwardLightingRS, FORWARD_LIGHTING_PASS_ROOT_DESCRIPTOR_TABLE_CBV_INDEX);
11461150
}
1147-
rhi->SetConstantBuffers(ER_PIXEL, { mForwardLightingConstantBuffer.Buffer(), aObj->GetObjectsConstantBuffer().Buffer() }, 0, mForwardLightingRS, FORWARD_LIGHTING_PASS_ROOT_DESCRIPTOR_TABLE_CBV_INDEX);
1151+
rhi->SetConstantBuffers(ER_PIXEL, { mForwardLightingConstantBuffer.Buffer(), aObj->GetObjectsConstantBuffer().Buffer(), mLightProbesConstantBuffer.Buffer() }, 0, mForwardLightingRS, FORWARD_LIGHTING_PASS_ROOT_DESCRIPTOR_TABLE_CBV_INDEX);
11481152
}
11491153

11501154
std::vector<ER_RHI_GPUResource*> resources(LIGHTING_SRV_INDEX_MAX_RESERVED_FOR_TEXTURES + 1);

0 commit comments

Comments
 (0)