Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion parallel-rdp/rdp_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ using namespace Vulkan;
if (cond) (flag) |= (mask); \
} while(0)

static bool is_dither_mode_forced = false;
static uint8_t forced_dither_mode = 0;

namespace RDP
{
CommandProcessor::CommandProcessor(Vulkan::Device &device_, void *rdram_ptr,
Expand Down Expand Up @@ -491,7 +494,7 @@ void CommandProcessor::op_set_other_modes(const uint32_t *words)

STATE_MASK(static_state.flags, bool(words[1] & (1 << 1)), RASTERIZATION_ALPHA_TEST_DITHER_BIT);
STATE_MASK(static_state.flags, bool(words[1] & (1 << 0)), RASTERIZATION_ALPHA_TEST_BIT);
static_state.dither = (words[0] >> 4) & 0x0f;
static_state.dither = (is_dither_mode_forced) ? (forced_dither_mode) : ((words[0] >> 4) & 0x0f);
STATE_MASK(depth_blend.flags, RGBDitherMode(static_state.dither >> 2) != RGBDitherMode::Off, DEPTH_BLEND_DITHER_ENABLE_BIT);
depth_blend.coverage_mode = static_cast<CoverageMode>((words[1] >> 8) & 3);
depth_blend.z_mode = static_cast<ZMode>((words[1] >> 10) & 3);
Expand Down Expand Up @@ -1124,6 +1127,11 @@ void CommandProcessor::drain_command_ring()

void CommandProcessor::scanout_async_buffer(VIScanoutBuffer &buffer, const ScanoutOptions &opts)
{
if (opts.force_dither_mode.enable)
{
is_dither_mode_forced = opts.force_dither_mode.enable;
forced_dither_mode = (opts.force_dither_mode.mode << 2);
}
auto handle = scanout(opts, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
if (!handle)
{
Expand Down
9 changes: 9 additions & 0 deletions parallel-rdp/video_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ struct ScanoutOptions
bool divot_filter = true;
bool gamma_dither = true;
} vi;

// If enabled, will force a specific dither mode to be used,
// rather than using the one that is native to the game.
struct
{
// Values equal to enum RGBDitherMode
uint8_t mode = 0;
bool enable = false;
} force_dither_mode;
};

struct VIScanoutBuffer
Expand Down