7 changed files with 79 additions and 24 deletions
-
2src/video_core/CMakeLists.txt
-
4src/video_core/host_shaders/fxaa.vert
-
22src/video_core/renderer_opengl/gl_blit_screen.cpp
-
6src/video_core/renderer_opengl/gl_blit_screen.h
-
40src/video_core/renderer_opengl/present/fxaa.cpp
-
27src/video_core/renderer_opengl/present/fxaa.h
-
2src/video_core/renderer_vulkan/present/fxaa.cpp
@ -0,0 +1,40 @@ |
|||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
|
||||
|
#include "video_core/host_shaders/fxaa_frag.h"
|
||||
|
#include "video_core/host_shaders/fxaa_vert.h"
|
||||
|
#include "video_core/renderer_opengl/gl_shader_manager.h"
|
||||
|
#include "video_core/renderer_opengl/gl_shader_util.h"
|
||||
|
#include "video_core/renderer_opengl/present/fxaa.h"
|
||||
|
#include "video_core/renderer_opengl/present/util.h"
|
||||
|
|
||||
|
namespace OpenGL { |
||||
|
|
||||
|
FXAA::FXAA(u32 width, u32 height) { |
||||
|
vert_shader = CreateProgram(HostShaders::FXAA_VERT, GL_VERTEX_SHADER); |
||||
|
frag_shader = CreateProgram(HostShaders::FXAA_FRAG, GL_FRAGMENT_SHADER); |
||||
|
|
||||
|
sampler = CreateBilinearSampler(); |
||||
|
|
||||
|
framebuffer.Create(); |
||||
|
|
||||
|
texture.Create(GL_TEXTURE_2D); |
||||
|
glTextureStorage2D(texture.handle, 1, GL_RGBA16F, width, height); |
||||
|
glNamedFramebufferTexture(framebuffer.handle, GL_COLOR_ATTACHMENT0, texture.handle, 0); |
||||
|
} |
||||
|
|
||||
|
FXAA::~FXAA() = default; |
||||
|
|
||||
|
GLuint FXAA::Draw(ProgramManager& program_manager, GLuint input_texture) { |
||||
|
glFrontFace(GL_CCW); |
||||
|
|
||||
|
program_manager.BindPresentPrograms(vert_shader.handle, frag_shader.handle); |
||||
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer.handle); |
||||
|
glBindTextureUnit(0, input_texture); |
||||
|
glDrawArrays(GL_TRIANGLES, 0, 3); |
||||
|
glFrontFace(GL_CW); |
||||
|
|
||||
|
return texture.handle; |
||||
|
} |
||||
|
|
||||
|
} // namespace OpenGL
|
||||
@ -0,0 +1,27 @@ |
|||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project |
||||
|
// SPDX-License-Identifier: GPL-2.0-or-later |
||||
|
|
||||
|
#pragma once |
||||
|
|
||||
|
#include "video_core/renderer_opengl/gl_resource_manager.h" |
||||
|
|
||||
|
namespace OpenGL { |
||||
|
|
||||
|
class ProgramManager; |
||||
|
|
||||
|
class FXAA { |
||||
|
public: |
||||
|
explicit FXAA(u32 width, u32 height); |
||||
|
~FXAA(); |
||||
|
|
||||
|
GLuint Draw(ProgramManager& program_manager, GLuint input_texture); |
||||
|
|
||||
|
private: |
||||
|
OGLProgram vert_shader; |
||||
|
OGLProgram frag_shader; |
||||
|
OGLSampler sampler; |
||||
|
OGLFramebuffer framebuffer; |
||||
|
OGLTexture texture; |
||||
|
}; |
||||
|
|
||||
|
} // namespace OpenGL |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue