[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

@@ -639,9 +639,24 @@ VkDescriptorSet BufferCache::PrepareVertexSet(
break;
}
if (fetch->type != 0x3) {
// TODO(DrChat): Some games use type 0x0 (with no data).
return nullptr;
// TODO(DrChat): Some games use type kInvalidTexture (with no data).
switch (fetch->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.",
vertex_binding.fetch_constant, fetch->dword_0, fetch->dword_1);
return nullptr;
default:
XELOGW("Vertex fetch constant %u (%.8X %.8X) is completely invalid!",
vertex_binding.fetch_constant, fetch->dword_0, fetch->dword_1);
return nullptr;
}
// TODO(benvanik): compute based on indices or vertex count.

View File

@@ -1501,9 +1501,28 @@ bool TextureCache::SetupTextureBinding(VkCommandBuffer command_buffer,
// Disabled?
// TODO(benvanik): reset sampler.
if (fetch.type != 0x2) {
XELOGGPU("Fetch type is not 2!");
return false;
switch (fetch.type) {
case xenos::FetchConstantType::kTexture:
break;
case xenos::FetchConstantType::kInvalidTexture:
if (cvars::gpu_allow_invalid_fetch_constants) {
break;
}
XELOGW(
"Texture fetch constant %u (%.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.",
binding.fetch_constant, fetch.dword_0, fetch.dword_1, fetch.dword_2,
fetch.dword_3, fetch.dword_4, fetch.dword_5);
return false;
default:
XELOGW(
"Texture fetch constant %u (%.8X %.8X %.8X %.8X %.8X %.8X) is "
"completely invalid!",
binding.fetch_constant, fetch.dword_0, fetch.dword_1, fetch.dword_2,
fetch.dword_3, fetch.dword_4, fetch.dword_5);
return false;
}
TextureInfo texture_info;

View File

@@ -966,7 +966,7 @@ bool VulkanCommandProcessor::IssueCopy() {
fetch = &group->vertex_fetch_2;
break;
}
assert_true(fetch->type == 3);
assert_true(fetch->type == xenos::FetchConstantType::kVertex);
assert_true(fetch->endian == Endian::k8in32);
assert_true(fetch->size == 6);
const uint8_t* vertex_addr = memory_->TranslatePhysical(fetch->address << 2);