[GPU] --gpu_allow_invalid_fetch_constants to bypass invalid fetch constant type errors

This commit is contained in:
Triang3l
2020-02-16 19:35:26 +03:00
parent d18e63e6e2
commit 710d225d0a
10 changed files with 108 additions and 23 deletions

View File

@@ -20,6 +20,7 @@
#include "xenia/gpu/d3d12/d3d12_command_processor.h"
#include "xenia/gpu/d3d12/d3d12_graphics_system.h"
#include "xenia/gpu/d3d12/d3d12_shader.h"
#include "xenia/gpu/gpu_flags.h"
#include "xenia/gpu/xenos.h"
#include "xenia/ui/d3d12/d3d12_util.h"
@@ -1476,10 +1477,23 @@ bool D3D12CommandProcessor::IssueDraw(PrimitiveType primitive_type,
}
const auto& vfetch_constant = regs.Get<xenos::xe_gpu_vertex_fetch_t>(
XE_GPU_REG_SHADER_CONSTANT_FETCH_00_0 + vfetch_index * 2);
if (vfetch_constant.type != 3) {
XELOGW("Vertex fetch type is not 3 (fetch constant %u is %.8X %.8X)!",
vfetch_index, vfetch_constant.dword_0, vfetch_constant.dword_1);
return false;
switch (vfetch_constant.type) {
case xenos::FetchConstantType::kVertex:
break;
case xenos::FetchConstantType::kInvalidVertex:
if (cvars::gpu_allow_invalid_fetch_constants) {
break;
}
XELOGW(
"Vertex fetch constant %u (%.8X %.8X) has \"invalid\" type! This "
"is incorrect behavior, but you can try bypassing this by "
"launching Xenia with --gpu_allow_invalid_fetch_constants=true.",
vfetch_index, vfetch_constant.dword_0, vfetch_constant.dword_1);
return false;
default:
XELOGW("Vertex fetch constant %u (%.8X %.8X) is completely invalid!",
vfetch_index, vfetch_constant.dword_0, vfetch_constant.dword_1);
return false;
}
if (!shared_memory_->RequestRange(vfetch_constant.address << 2,
vfetch_constant.size << 2)) {

View File

@@ -1087,7 +1087,7 @@ bool RenderTargetCache::Resolve(SharedMemory* shared_memory,
// HACK: Vertices to use are always in vf0.
const auto& fetch = regs.Get<xenos::xe_gpu_vertex_fetch_t>(
XE_GPU_REG_SHADER_CONSTANT_FETCH_00_0);
assert_true(fetch.type == 3);
assert_true(fetch.type == xenos::FetchConstantType::kVertex);
assert_true(fetch.endian == Endian::k8in32);
assert_true(fetch.size == 6);
trace_writer_->WriteMemoryRead(fetch.address << 2, fetch.size << 2);

View File

@@ -21,6 +21,7 @@
#include "xenia/base/math.h"
#include "xenia/base/profiling.h"
#include "xenia/gpu/d3d12/d3d12_command_processor.h"
#include "xenia/gpu/gpu_flags.h"
#include "xenia/gpu/texture_info.h"
#include "xenia/gpu/texture_util.h"
#include "xenia/ui/d3d12/d3d12_util.h"
@@ -2094,13 +2095,28 @@ void TextureCache::BindingInfoFromFetchConstant(
*has_signed_out = false;
}
if (fetch.type != 2) {
XELOGW(
"Texture fetch type is not 2 - ignoring (fetch constant is %.8X %.8X "
"%.8X %.8X %.8X %.8X)!",
fetch.dword_0, fetch.dword_1, fetch.dword_2, fetch.dword_3,
fetch.dword_4, fetch.dword_5);
return;
switch (fetch.type) {
case xenos::FetchConstantType::kTexture:
break;
case xenos::FetchConstantType::kInvalidTexture:
if (cvars::gpu_allow_invalid_fetch_constants) {
break;
}
XELOGW(
"Texture fetch constant (%.8X %.8X %.8X %.8X %.8X %.8X) has "
"\"invalid\" type! This is incorrect behavior, but you can try "
"bypassing this by launching Xenia with "
"--gpu_allow_invalid_fetch_constants=true.",
fetch.dword_0, fetch.dword_1, fetch.dword_2, fetch.dword_3,
fetch.dword_4, fetch.dword_5);
return;
default:
XELOGW(
"Texture fetch constant (%.8X %.8X %.8X %.8X %.8X %.8X) is "
"completely invalid!",
fetch.dword_0, fetch.dword_1, fetch.dword_2, fetch.dword_3,
fetch.dword_4, fetch.dword_5);
return;
}
// Validate the dimensions, get the size and clamp the maximum mip level.