diff options
| author | Liam <byteslice@airmail.cc> | 2024-01-14 21:11:28 -0500 |
|---|---|---|
| committer | Liam <byteslice@airmail.cc> | 2024-01-31 11:27:20 -0500 |
| commit | b90eff4bc666548a77eb58ac152408c80ff952b3 (patch) | |
| tree | 1b7532cf61703be3cfe496a74481eeac31a06e92 /src/video_core/renderer_opengl/present/util.h | |
| parent | 0c2e5b64c9fb985a40e5afec898d1f370cbad23e (diff) | |
renderer_opengl: split out SMAA
Diffstat (limited to 'src/video_core/renderer_opengl/present/util.h')
| -rw-r--r-- | src/video_core/renderer_opengl/present/util.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/present/util.h b/src/video_core/renderer_opengl/present/util.h new file mode 100644 index 000000000..0aa8b110c --- /dev/null +++ b/src/video_core/renderer_opengl/present/util.h @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include <string> + +#include "common/assert.h" +#include "video_core/renderer_opengl/gl_resource_manager.h" + +namespace OpenGL { + +static inline void ReplaceInclude(std::string& shader_source, std::string_view include_name, + std::string_view include_content) { + const std::string include_string = fmt::format("#include \"{}\"", include_name); + const std::size_t pos = shader_source.find(include_string); + ASSERT(pos != std::string::npos); + shader_source.replace(pos, include_string.size(), include_content); +}; + +static inline OGLSampler CreateBilinearSampler() { + OGLSampler sampler; + sampler.Create(); + glSamplerParameteri(sampler.handle, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glSamplerParameteri(sampler.handle, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glSamplerParameteri(sampler.handle, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glSamplerParameteri(sampler.handle, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glSamplerParameteri(sampler.handle, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); + return sampler; +} + +} // namespace OpenGL |
