mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxso] Handle multiplication by zero when emitting clip distances
This commit is contained in:
parent
337360cdc6
commit
11f8b8ba44
@ -3653,26 +3653,27 @@ void DxsoCompiler::emitControlFlowGenericLoop(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compute clip distances
|
// Compute clip distances
|
||||||
uint32_t positionId = m_module.opLoad(vec4Type, positionPtr);
|
DxsoRegisterValue position;
|
||||||
|
position.type = { DxsoScalarType::Float32, 4 };
|
||||||
|
position.id = m_module.opLoad(vec4Type, positionPtr);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < caps::MaxClipPlanes; i++) {
|
for (uint32_t i = 0; i < caps::MaxClipPlanes; i++) {
|
||||||
std::array<uint32_t, 2> blockMembers = {{
|
std::array<uint32_t, 2> blockMembers = {{
|
||||||
m_module.constu32(0),
|
m_module.constu32(0),
|
||||||
m_module.constu32(i),
|
m_module.constu32(i),
|
||||||
}};
|
}};
|
||||||
|
|
||||||
uint32_t planeId = m_module.opLoad(vec4Type,
|
DxsoRegisterValue plane;
|
||||||
m_module.opAccessChain(
|
plane.type = { DxsoScalarType::Float32, 4 };
|
||||||
m_module.defPointerType(vec4Type, spv::StorageClassUniform),
|
plane.id = m_module.opLoad(vec4Type, m_module.opAccessChain(
|
||||||
clipPlaneBlock, blockMembers.size(), blockMembers.data()));
|
m_module.defPointerType(vec4Type, spv::StorageClassUniform),
|
||||||
|
clipPlaneBlock, blockMembers.size(), blockMembers.data()));
|
||||||
uint32_t distId = m_module.opDot(floatType, positionId, planeId);
|
|
||||||
|
DxsoRegisterValue dist = emitDot(position, plane);
|
||||||
m_module.opStore(
|
|
||||||
m_module.opAccessChain(
|
m_module.opStore(m_module.opAccessChain(
|
||||||
m_module.defPointerType(floatType, spv::StorageClassOutput),
|
m_module.defPointerType(floatType, spv::StorageClassOutput),
|
||||||
clipDistArray, 1, &blockMembers[1]),
|
clipDistArray, 1, &blockMembers[1]), dist.id);
|
||||||
distId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user