mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-11 13:20:04 +00:00
video_core: Add MMPX texture filter (#6564)
* video_core: Add MMPX texture shader * mmpx: Apply mix to mask alpha edge artifacting * mmpx: Do not use deprecated texture fuction.
This commit is contained in:
parent
b45c7188c7
commit
691e09473e
7 changed files with 160 additions and 1 deletions
|
@ -14,6 +14,7 @@
|
|||
#include "video_core/host_shaders/format_reinterpreter/rgba4_to_rgb5a1_frag.h"
|
||||
#include "video_core/host_shaders/full_screen_triangle_vert.h"
|
||||
#include "video_core/host_shaders/texture_filtering/bicubic_frag.h"
|
||||
#include "video_core/host_shaders/texture_filtering/mmpx_frag.h"
|
||||
#include "video_core/host_shaders/texture_filtering/nearest_neighbor_frag.h"
|
||||
#include "video_core/host_shaders/texture_filtering/refine_frag.h"
|
||||
#include "video_core/host_shaders/texture_filtering/scale_force_frag.h"
|
||||
|
@ -60,7 +61,8 @@ BlitHelper::BlitHelper(const Driver& driver_)
|
|||
nearest_program{CreateProgram(HostShaders::NEAREST_NEIGHBOR_FRAG)},
|
||||
scale_force_program{CreateProgram(HostShaders::SCALE_FORCE_FRAG)},
|
||||
xbrz_program{CreateProgram(HostShaders::XBRZ_FREESCALE_FRAG)},
|
||||
gradient_x_program{CreateProgram(HostShaders::X_GRADIENT_FRAG)},
|
||||
mmpx_program{CreateProgram(HostShaders::MMPX_FRAG)}, gradient_x_program{CreateProgram(
|
||||
HostShaders::X_GRADIENT_FRAG)},
|
||||
gradient_y_program{CreateProgram(HostShaders::Y_GRADIENT_FRAG)},
|
||||
refine_program{CreateProgram(HostShaders::REFINE_FRAG)},
|
||||
d24s8_to_rgba8{CreateProgram(HostShaders::D24S8_TO_RGBA8_FRAG)},
|
||||
|
@ -175,6 +177,9 @@ bool BlitHelper::Filter(Surface& surface, const VideoCore::TextureBlit& blit) {
|
|||
case TextureFilter::xBRZ:
|
||||
FilterXbrz(surface, blit);
|
||||
break;
|
||||
case TextureFilter::MMPX:
|
||||
FilterMMPX(surface, blit);
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR(Render_OpenGL, "Unknown texture filter {}", filter);
|
||||
}
|
||||
|
@ -270,6 +275,14 @@ void BlitHelper::FilterXbrz(Surface& surface, const VideoCore::TextureBlit& blit
|
|||
Draw(xbrz_program, surface.Handle(), draw_fbo.handle, blit.dst_level, blit.dst_rect);
|
||||
}
|
||||
|
||||
void BlitHelper::FilterMMPX(Surface& surface, const VideoCore::TextureBlit& blit) {
|
||||
const OpenGLState prev_state = OpenGLState::GetCurState();
|
||||
SCOPE_EXIT({ prev_state.Apply(); });
|
||||
state.texture_units[0].texture_2d = surface.Handle(0);
|
||||
SetParams(mmpx_program, surface.RealExtent(false), blit.src_rect);
|
||||
Draw(mmpx_program, surface.Handle(), draw_fbo.handle, blit.dst_level, blit.dst_rect);
|
||||
}
|
||||
|
||||
void BlitHelper::SetParams(OGLProgram& program, const VideoCore::Extent& src_extent,
|
||||
Common::Rectangle<u32> src_rect) {
|
||||
glProgramUniform2f(
|
||||
|
|
|
@ -40,6 +40,8 @@ private:
|
|||
|
||||
void FilterXbrz(Surface& surface, const VideoCore::TextureBlit& blit);
|
||||
|
||||
void FilterMMPX(Surface& surface, const VideoCore::TextureBlit& blit);
|
||||
|
||||
void SetParams(OGLProgram& program, const VideoCore::Extent& src_extent,
|
||||
Common::Rectangle<u32> src_rect);
|
||||
|
||||
|
@ -58,6 +60,7 @@ private:
|
|||
OGLProgram nearest_program;
|
||||
OGLProgram scale_force_program;
|
||||
OGLProgram xbrz_program;
|
||||
OGLProgram mmpx_program;
|
||||
OGLProgram gradient_x_program;
|
||||
OGLProgram gradient_y_program;
|
||||
OGLProgram refine_program;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue