mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 05:52:11 +01:00
[dxvk] Do not dispatch compute shaders if no pipeline is bound
Fixes crashes in Tomb Raider 2013.
This commit is contained in:
parent
e4d49aeb66
commit
d3fe3622cc
@ -513,10 +513,12 @@ namespace dxvk {
|
||||
uint32_t z) {
|
||||
this->commitComputeState();
|
||||
|
||||
if (m_cpActivePipeline != VK_NULL_HANDLE) {
|
||||
m_cmd->cmdDispatch(x, y, z);
|
||||
|
||||
this->commitComputeBarriers();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::dispatchIndirect(
|
||||
@ -525,12 +527,14 @@ namespace dxvk {
|
||||
|
||||
auto physicalSlice = buffer.physicalSlice();
|
||||
|
||||
if (m_cpActivePipeline != VK_NULL_HANDLE) {
|
||||
m_cmd->cmdDispatchIndirect(
|
||||
physicalSlice.handle(),
|
||||
physicalSlice.offset());
|
||||
|
||||
this->commitComputeBarriers();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::draw(
|
||||
@ -1150,9 +1154,18 @@ namespace dxvk {
|
||||
m_state.cp.pipeline = m_device->createComputePipeline(
|
||||
m_state.cp.cs.shader);
|
||||
|
||||
m_cmd->cmdBindPipeline(VK_PIPELINE_BIND_POINT_COMPUTE,
|
||||
m_state.cp.pipeline->getPipelineHandle());
|
||||
m_cpActivePipeline = m_state.cp.pipeline != nullptr
|
||||
? m_state.cp.pipeline->getPipelineHandle()
|
||||
: VK_NULL_HANDLE;
|
||||
|
||||
if (m_state.cp.pipeline != nullptr)
|
||||
m_cmd->trackResource(m_state.cp.pipeline);
|
||||
|
||||
if (m_cpActivePipeline != VK_NULL_HANDLE) {
|
||||
m_cmd->cmdBindPipeline(
|
||||
VK_PIPELINE_BIND_POINT_COMPUTE,
|
||||
m_cpActivePipeline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1166,6 +1179,7 @@ namespace dxvk {
|
||||
m_state.gp.vs.shader, m_state.gp.tcs.shader, m_state.gp.tes.shader,
|
||||
m_state.gp.gs.shader, m_state.gp.fs.shader);
|
||||
|
||||
if (m_state.gp.pipeline != nullptr)
|
||||
m_cmd->trackResource(m_state.gp.pipeline);
|
||||
}
|
||||
}
|
||||
@ -1183,8 +1197,9 @@ namespace dxvk {
|
||||
for (uint32_t i = m_state.gp.state.ilBindingCount; i < MaxNumVertexBindings; i++)
|
||||
m_state.gp.state.ilBindings[i].stride = 0;
|
||||
|
||||
m_gpActivePipeline = m_state.gp.pipeline
|
||||
->getPipelineHandle(m_state.gp.state);
|
||||
m_gpActivePipeline = m_state.gp.pipeline != nullptr
|
||||
? m_state.gp.pipeline->getPipelineHandle(m_state.gp.state)
|
||||
: VK_NULL_HANDLE;
|
||||
|
||||
if (m_gpActivePipeline != VK_NULL_HANDLE) {
|
||||
m_cmd->cmdBindPipeline(
|
||||
@ -1197,44 +1212,52 @@ namespace dxvk {
|
||||
|
||||
void DxvkContext::updateComputeShaderResources() {
|
||||
if (m_flags.test(DxvkContextFlag::CpDirtyResources)) {
|
||||
if (m_state.cp.pipeline != nullptr) {
|
||||
this->updateShaderResources(
|
||||
VK_PIPELINE_BIND_POINT_COMPUTE,
|
||||
m_state.cp.pipeline->layout());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::updateComputeShaderDescriptors() {
|
||||
if (m_flags.test(DxvkContextFlag::CpDirtyResources)) {
|
||||
m_flags.clr(DxvkContextFlag::CpDirtyResources);
|
||||
|
||||
if (m_state.cp.pipeline != nullptr) {
|
||||
this->updateShaderDescriptors(
|
||||
VK_PIPELINE_BIND_POINT_COMPUTE,
|
||||
m_state.cp.bs,
|
||||
m_state.cp.pipeline->layout());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::updateGraphicsShaderResources() {
|
||||
if (m_flags.test(DxvkContextFlag::GpDirtyResources)) {
|
||||
if (m_state.gp.pipeline != nullptr) {
|
||||
this->updateShaderResources(
|
||||
VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
m_state.gp.pipeline->layout());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::updateGraphicsShaderDescriptors() {
|
||||
if (m_flags.test(DxvkContextFlag::GpDirtyResources)) {
|
||||
m_flags.clr(DxvkContextFlag::GpDirtyResources);
|
||||
|
||||
if (m_state.gp.pipeline != nullptr) {
|
||||
this->updateShaderDescriptors(
|
||||
VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||
m_state.gp.state.bsBindingState,
|
||||
m_state.gp.pipeline->layout());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::updateShaderResources(
|
||||
|
@ -520,7 +520,7 @@ namespace dxvk {
|
||||
DxvkBarrierSet m_barriers;
|
||||
|
||||
VkPipeline m_gpActivePipeline = VK_NULL_HANDLE;
|
||||
// VkPipeline m_cpActivePipeline = VK_NULL_HANDLE; /* will be used later */
|
||||
VkPipeline m_cpActivePipeline = VK_NULL_HANDLE;
|
||||
|
||||
std::array<DxvkShaderResourceSlot, MaxNumResourceSlots> m_rc;
|
||||
std::array<DxvkDescriptorInfo, MaxNumResourceSlots> m_descriptors;
|
||||
|
Loading…
x
Reference in New Issue
Block a user