mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-05-23 01:01:15 +00:00
fix sub pixel gaps on 2D visuals due to MSAA
This commit is contained in:
parent
733ad1181b
commit
d75b33bbd6
1 changed files with 12 additions and 2 deletions
|
|
@ -133,7 +133,7 @@ int gShaderFlags[SHADER_FLAG_MAX] = { 0 };
|
|||
f32 gDefaultShaderFlagValues[SHADER_FLAG_MAX] = {
|
||||
[SHADER_FLAG_HUE] = 0.0f,
|
||||
[SHADER_FLAG_SATURATION] = 1.0f,
|
||||
[SHADER_FLAG_BRIGHTNESS] = 1.0f,
|
||||
[SHADER_FLAG_BRIGHTNESS] = 1.0f,
|
||||
[SHADER_FLAG_CONTRAST] = 1.0f,
|
||||
[SHADER_FLAG_EXPOSURE] = 1.0f,
|
||||
[SHADER_FLAG_DITHERING] = 0.0f,
|
||||
|
|
@ -718,7 +718,17 @@ static void gfx_sp_pop_matrix(uint32_t count) {
|
|||
}
|
||||
|
||||
static float gfx_adjust_x_for_aspect_ratio(float x) {
|
||||
return x * gfx_current_dimensions.x_adjust_ratio;
|
||||
float adjusted = x * gfx_current_dimensions.x_adjust_ratio;
|
||||
|
||||
// Force 2D coordinates to be aligned perfectly on the nearest pixel
|
||||
// This prevents MSAA sub-pixel gaps (e.g. on vanilla dialog boxes)
|
||||
if (rsp.P_matrix[3][3] > 0.5f) {
|
||||
float pixelX = rdp.viewport.x + (adjusted + 1.0f) * 0.5f * rdp.viewport.width;
|
||||
pixelX = floorf(pixelX + 0.5f);
|
||||
adjusted = ((pixelX - rdp.viewport.x) / rdp.viewport.width) * 2.0f - 1.0f;
|
||||
}
|
||||
|
||||
return adjusted;
|
||||
}
|
||||
|
||||
static OPTIMIZE_O3 void gfx_local_to_world_space(VEC_OUT Vec3f pos, VEC_OUT Vec3f normal) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue