mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[dxvk] Implement proper graphics and compute state validation
Fixes crashes in various games, including Fallout 4.
This commit is contained in:
parent
eadf74264b
commit
e8c98eac95
@ -644,7 +644,7 @@ namespace dxvk {
|
||||
uint32_t z) {
|
||||
this->commitComputeState();
|
||||
|
||||
if (m_cpActivePipeline != VK_NULL_HANDLE) {
|
||||
if (this->validateComputeState()) {
|
||||
m_cmd->cmdDispatch(x, y, z);
|
||||
|
||||
this->commitComputeBarriers();
|
||||
@ -658,7 +658,7 @@ namespace dxvk {
|
||||
|
||||
auto physicalSlice = buffer.physicalSlice();
|
||||
|
||||
if (m_cpActivePipeline != VK_NULL_HANDLE) {
|
||||
if (this->validateComputeState()) {
|
||||
m_cmd->cmdDispatchIndirect(
|
||||
physicalSlice.handle(),
|
||||
physicalSlice.offset());
|
||||
@ -675,7 +675,7 @@ namespace dxvk {
|
||||
uint32_t firstInstance) {
|
||||
this->commitGraphicsState();
|
||||
|
||||
if (m_gpActivePipeline != VK_NULL_HANDLE) {
|
||||
if (this->validateGraphicsState()) {
|
||||
m_cmd->cmdDraw(
|
||||
vertexCount, instanceCount,
|
||||
firstVertex, firstInstance);
|
||||
@ -689,7 +689,7 @@ namespace dxvk {
|
||||
uint32_t stride) {
|
||||
this->commitGraphicsState();
|
||||
|
||||
if (m_gpActivePipeline != VK_NULL_HANDLE) {
|
||||
if (this->validateGraphicsState()) {
|
||||
auto physicalSlice = buffer.physicalSlice();
|
||||
|
||||
m_cmd->cmdDrawIndirect(
|
||||
@ -708,7 +708,7 @@ namespace dxvk {
|
||||
uint32_t firstInstance) {
|
||||
this->commitGraphicsState();
|
||||
|
||||
if (m_gpActivePipeline != VK_NULL_HANDLE) {
|
||||
if (this->validateGraphicsState()) {
|
||||
m_cmd->cmdDrawIndexed(
|
||||
indexCount, instanceCount,
|
||||
firstIndex, vertexOffset,
|
||||
@ -723,7 +723,7 @@ namespace dxvk {
|
||||
uint32_t stride) {
|
||||
this->commitGraphicsState();
|
||||
|
||||
if (m_gpActivePipeline != VK_NULL_HANDLE) {
|
||||
if (this->validateGraphicsState()) {
|
||||
auto physicalSlice = buffer.physicalSlice();
|
||||
|
||||
m_cmd->cmdDrawIndexedIndirect(
|
||||
@ -1644,6 +1644,22 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
bool DxvkContext::validateComputeState() {
|
||||
return m_cpActivePipeline != nullptr;
|
||||
}
|
||||
|
||||
|
||||
bool DxvkContext::validateGraphicsState() {
|
||||
if (m_gpActivePipeline == nullptr)
|
||||
return false;
|
||||
|
||||
if (!m_flags.test(DxvkContextFlag::GpRenderPassBound))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::commitComputeState() {
|
||||
this->renderPassEnd();
|
||||
this->updateComputePipeline();
|
||||
|
@ -616,6 +616,9 @@ namespace dxvk {
|
||||
void updateIndexBufferBinding();
|
||||
void updateVertexBufferBindings();
|
||||
|
||||
bool validateComputeState();
|
||||
bool validateGraphicsState();
|
||||
|
||||
void commitComputeState();
|
||||
void commitGraphicsState();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user