mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-25 15:15:40 +00:00
GPU/HW: Only apply vertex offset at 1x resolution scale
This commit is contained in:
parent
ea25b58dd3
commit
13e2b28f50
|
@ -399,9 +399,14 @@ std::string GPU_HW_ShaderGen::GenerateBatchVertexShader(bool textured)
|
|||
|
||||
ss << R"(
|
||||
{
|
||||
// Offset the vertex position by 0.5 to ensure correct interpolation of texture coordinates
|
||||
// at 1x resolution scale. This doesn't work at >1x, we adjust the texture coordinates before
|
||||
// uploading there instead.
|
||||
float vertex_offset = (RESOLUTION_SCALE == 1) ? 0.5 : 0.0;
|
||||
|
||||
// 0..+1023 -> -1..1
|
||||
float pos_x = ((float(a_pos.x) + 0.5) / 512.0) - 1.0;
|
||||
float pos_y = ((float(a_pos.y) + 0.5) / -256.0) + 1.0;
|
||||
float pos_x = ((float(a_pos.x) + vertex_offset) / 512.0) - 1.0;
|
||||
float pos_y = ((float(a_pos.y) + vertex_offset) / -256.0) + 1.0;
|
||||
|
||||
// OpenGL seems to be off by one pixel in the Y direction due to lower-left origin.
|
||||
#if API_OPENGL || API_OPENGL_ES
|
||||
|
|
Loading…
Reference in a new issue