mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 05:16:24 -05:00
host_shaders: Add shader to render a full screen triangle
This commit is contained in:
parent
59c46f9de9
commit
5169ce9fcd
2 changed files with 30 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
set(SHADER_FILES
|
set(SHADER_FILES
|
||||||
block_linear_unswizzle_2d.comp
|
block_linear_unswizzle_2d.comp
|
||||||
block_linear_unswizzle_3d.comp
|
block_linear_unswizzle_3d.comp
|
||||||
|
full_screen_triangle.vert
|
||||||
opengl_present.frag
|
opengl_present.frag
|
||||||
opengl_present.vert
|
opengl_present.vert
|
||||||
pitch_unswizzle.comp
|
pitch_unswizzle.comp
|
||||||
|
|
29
src/video_core/host_shaders/full_screen_triangle.vert
Normal file
29
src/video_core/host_shaders/full_screen_triangle.vert
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright 2020 yuzu Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#version 450
|
||||||
|
|
||||||
|
#ifdef VULKAN
|
||||||
|
#define BEGIN_PUSH_CONSTANTS layout(push_constant) uniform PushConstants {
|
||||||
|
#define END_PUSH_CONSTANTS };
|
||||||
|
#define UNIFORM(n)
|
||||||
|
#else // ^^^ Vulkan ^^^ // vvv OpenGL vvv
|
||||||
|
#define BEGIN_PUSH_CONSTANTS
|
||||||
|
#define END_PUSH_CONSTANTS
|
||||||
|
#define UNIFORM(n) layout (location = n) uniform
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BEGIN_PUSH_CONSTANTS
|
||||||
|
UNIFORM(0) vec2 tex_scale;
|
||||||
|
UNIFORM(1) vec2 tex_offset;
|
||||||
|
END_PUSH_CONSTANTS
|
||||||
|
|
||||||
|
layout(location = 0) out vec2 texcoord;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
float x = float((gl_VertexIndex & 1) << 2);
|
||||||
|
float y = float((gl_VertexIndex & 2) << 1);
|
||||||
|
gl_Position = vec4(x - 1.0, y - 1.0, 0.0, 1.0);
|
||||||
|
texcoord = fma(vec2(x, y) / 2.0, tex_scale, tex_offset);
|
||||||
|
}
|
Loading…
Reference in a new issue