mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-17 22:25:37 +00:00
HostDisplay: Fudge texture coordinates for better linear filtering
This commit is contained in:
parent
6bacbf3438
commit
e1d4c0b9d4
|
@ -418,8 +418,8 @@ void D3D11DisplayWindow::renderDisplay()
|
||||||
0, 1, m_display_linear_filtering ? m_linear_sampler.GetAddressOf() : m_point_sampler.GetAddressOf());
|
0, 1, m_display_linear_filtering ? m_linear_sampler.GetAddressOf() : m_point_sampler.GetAddressOf());
|
||||||
|
|
||||||
const float uniforms[4] = {
|
const float uniforms[4] = {
|
||||||
static_cast<float>(m_display_texture_view_x) / static_cast<float>(m_display_texture_width),
|
(static_cast<float>(m_display_texture_view_x) + 0.25f) / static_cast<float>(m_display_texture_width),
|
||||||
static_cast<float>(m_display_texture_view_y) / static_cast<float>(m_display_texture_height),
|
(static_cast<float>(m_display_texture_view_y) + 0.25f) / static_cast<float>(m_display_texture_height),
|
||||||
(static_cast<float>(m_display_texture_view_width) - 0.5f) / static_cast<float>(m_display_texture_width),
|
(static_cast<float>(m_display_texture_view_width) - 0.5f) / static_cast<float>(m_display_texture_width),
|
||||||
(static_cast<float>(m_display_texture_view_height) - 0.5f) / static_cast<float>(m_display_texture_height)};
|
(static_cast<float>(m_display_texture_view_height) - 0.5f) / static_cast<float>(m_display_texture_height)};
|
||||||
const auto map = m_display_uniform_buffer.Map(m_context.Get(), sizeof(uniforms), sizeof(uniforms));
|
const auto map = m_display_uniform_buffer.Map(m_context.Get(), sizeof(uniforms), sizeof(uniforms));
|
||||||
|
|
|
@ -475,10 +475,10 @@ void OpenGLDisplayWindow::renderDisplay()
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
m_display_program.Bind();
|
m_display_program.Bind();
|
||||||
m_display_program.Uniform4f(
|
m_display_program.Uniform4f(
|
||||||
0, static_cast<float>(m_display_texture_view_x) / static_cast<float>(m_display_texture_width),
|
0, (static_cast<float>(m_display_texture_view_x) + 0.25f) / static_cast<float>(m_display_texture_width),
|
||||||
static_cast<float>(m_display_texture_view_y) / static_cast<float>(m_display_texture_height),
|
(static_cast<float>(m_display_texture_view_y) - 0.25f) / static_cast<float>(m_display_texture_height),
|
||||||
(static_cast<float>(m_display_texture_view_width) - 0.5f) / static_cast<float>(m_display_texture_width),
|
(static_cast<float>(m_display_texture_view_width) - 0.5f) / static_cast<float>(m_display_texture_width),
|
||||||
(static_cast<float>(m_display_texture_view_height) - 0.5f) / static_cast<float>(m_display_texture_height));
|
(static_cast<float>(m_display_texture_view_height) + 0.5f) / static_cast<float>(m_display_texture_height));
|
||||||
glBindTexture(GL_TEXTURE_2D, static_cast<GLuint>(reinterpret_cast<uintptr_t>(m_display_texture_handle)));
|
glBindTexture(GL_TEXTURE_2D, static_cast<GLuint>(reinterpret_cast<uintptr_t>(m_display_texture_handle)));
|
||||||
glBindSampler(0, m_display_linear_filtering ? m_display_linear_sampler : m_display_nearest_sampler);
|
glBindSampler(0, m_display_linear_filtering ? m_display_linear_sampler : m_display_nearest_sampler);
|
||||||
glBindVertexArray(m_display_vao);
|
glBindVertexArray(m_display_vao);
|
||||||
|
|
|
@ -395,8 +395,8 @@ void D3D11HostDisplay::RenderDisplay()
|
||||||
0, 1, m_display_linear_filtering ? m_linear_sampler.GetAddressOf() : m_point_sampler.GetAddressOf());
|
0, 1, m_display_linear_filtering ? m_linear_sampler.GetAddressOf() : m_point_sampler.GetAddressOf());
|
||||||
|
|
||||||
const float uniforms[4] = {
|
const float uniforms[4] = {
|
||||||
static_cast<float>(m_display_texture_view_x) / static_cast<float>(m_display_texture_width),
|
(static_cast<float>(m_display_texture_view_x) + 0.25f) / static_cast<float>(m_display_texture_width),
|
||||||
static_cast<float>(m_display_texture_view_y) / static_cast<float>(m_display_texture_height),
|
(static_cast<float>(m_display_texture_view_y) + 0.25f) / static_cast<float>(m_display_texture_height),
|
||||||
(static_cast<float>(m_display_texture_view_width) - 0.5f) / static_cast<float>(m_display_texture_width),
|
(static_cast<float>(m_display_texture_view_width) - 0.5f) / static_cast<float>(m_display_texture_width),
|
||||||
(static_cast<float>(m_display_texture_view_height) - 0.5f) / static_cast<float>(m_display_texture_height)};
|
(static_cast<float>(m_display_texture_view_height) - 0.5f) / static_cast<float>(m_display_texture_height)};
|
||||||
const auto map = m_display_uniform_buffer.Map(m_context.Get(), sizeof(uniforms), sizeof(uniforms));
|
const auto map = m_display_uniform_buffer.Map(m_context.Get(), sizeof(uniforms), sizeof(uniforms));
|
||||||
|
|
|
@ -386,10 +386,10 @@ void OpenGLHostDisplay::RenderDisplay()
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
m_display_program.Bind();
|
m_display_program.Bind();
|
||||||
m_display_program.Uniform4f(
|
m_display_program.Uniform4f(
|
||||||
0, static_cast<float>(m_display_texture_view_x) / static_cast<float>(m_display_texture_width),
|
0, (static_cast<float>(m_display_texture_view_x) + 0.25f) / static_cast<float>(m_display_texture_width),
|
||||||
static_cast<float>(m_display_texture_view_y) / static_cast<float>(m_display_texture_height),
|
(static_cast<float>(m_display_texture_view_y) - 0.25f) / static_cast<float>(m_display_texture_height),
|
||||||
(static_cast<float>(m_display_texture_view_width) - 0.5f) / static_cast<float>(m_display_texture_width),
|
(static_cast<float>(m_display_texture_view_width) - 0.5f) / static_cast<float>(m_display_texture_width),
|
||||||
(static_cast<float>(m_display_texture_view_height) - 0.5f) / static_cast<float>(m_display_texture_height));
|
(static_cast<float>(m_display_texture_view_height) + 0.5f) / static_cast<float>(m_display_texture_height));
|
||||||
glBindTexture(GL_TEXTURE_2D, static_cast<GLuint>(reinterpret_cast<uintptr_t>(m_display_texture_handle)));
|
glBindTexture(GL_TEXTURE_2D, static_cast<GLuint>(reinterpret_cast<uintptr_t>(m_display_texture_handle)));
|
||||||
glBindSampler(0, m_display_linear_filtering ? m_display_linear_sampler : m_display_nearest_sampler);
|
glBindSampler(0, m_display_linear_filtering ? m_display_linear_sampler : m_display_nearest_sampler);
|
||||||
glBindVertexArray(m_display_vao);
|
glBindVertexArray(m_display_vao);
|
||||||
|
|
Loading…
Reference in a new issue