[Vulkan] Port ac6_ground_fix vertex-fetch nudge to SPIR-V
This commit is contained in:
@@ -14,14 +14,9 @@
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/base/string.h"
|
||||
#include "xenia/gpu/dxbc_shader_translator.h"
|
||||
#include "xenia/gpu/gpu_flags.h"
|
||||
#include "xenia/gpu/render_target_cache.h"
|
||||
|
||||
DEFINE_bool(
|
||||
ac6_ground_fix, false,
|
||||
"This fixes(hide) issues with black ground in AC6. Use only in AC6. "
|
||||
"Might cause issues in other titles.",
|
||||
"HACKS");
|
||||
|
||||
namespace xe {
|
||||
namespace gpu {
|
||||
using namespace ucode;
|
||||
|
||||
@@ -108,3 +108,9 @@ DEFINE_bool(
|
||||
"artifacts while pipelines are being created. When disabled, pipelines are "
|
||||
"created synchronously which causes stutter but no visual artifacts.",
|
||||
"GPU");
|
||||
|
||||
DEFINE_bool(
|
||||
ac6_ground_fix, false,
|
||||
"This fixes(hide) issues with black ground in AC6. Use only in AC6. "
|
||||
"Might cause issues in other titles.",
|
||||
"HACKS");
|
||||
|
||||
@@ -42,6 +42,8 @@ DECLARE_bool(async_shader_compilation);
|
||||
|
||||
DECLARE_bool(gpu_3d_to_2d_texture);
|
||||
|
||||
DECLARE_bool(ac6_ground_fix);
|
||||
|
||||
#define XE_GPU_FINE_GRAINED_DRAW_SCOPES 1
|
||||
|
||||
#endif // XENIA_GPU_GPU_FLAGS_H_
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "third_party/glslang/SPIRV/GLSL.std.450.h"
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/math.h"
|
||||
#include "xenia/gpu/gpu_flags.h"
|
||||
#include "xenia/gpu/render_target_cache.h"
|
||||
#include "xenia/gpu/spirv_compatibility.h"
|
||||
|
||||
@@ -81,6 +82,12 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction(
|
||||
if (instr.attributes.is_index_rounded) {
|
||||
index = builder_->createNoContractionBinOp(
|
||||
spv::OpFAdd, type_float_, index, builder_->makeFloatConstant(0.5f));
|
||||
} else if (cvars::ac6_ground_fix) {
|
||||
// UGLY HACK for AC6 copied from the DXBC translator.
|
||||
// Proper fix requires accurate RCP implementation.
|
||||
index = builder_->createNoContractionBinOp(
|
||||
spv::OpFAdd, type_float_, index,
|
||||
builder_->makeFloatConstant(0.00025f));
|
||||
}
|
||||
index = builder_->createUnaryOp(
|
||||
spv::OpConvertFToS, type_int_,
|
||||
|
||||
Reference in New Issue
Block a user