mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-21 08:18:21 -05:00
nvnflinger/gpu: implement blending
This commit is contained in:
@ -37,6 +37,7 @@ layout(set=0,binding=0) uniform sampler2D InputTexture;
|
||||
|
||||
#define A_GPU 1
|
||||
#define A_GLSL 1
|
||||
#define FSR_RCAS_PASSTHROUGH_ALPHA 1
|
||||
|
||||
#ifndef YUZU_USE_FP16
|
||||
#include "ffx_a.h"
|
||||
@ -71,9 +72,7 @@ layout(set=0,binding=0) uniform sampler2D InputTexture;
|
||||
|
||||
#include "ffx_fsr1.h"
|
||||
|
||||
#if USE_RCAS
|
||||
layout(location = 0) in vec2 frag_texcoord;
|
||||
#endif
|
||||
layout (location = 0) in vec2 frag_texcoord;
|
||||
layout (location = 0) out vec4 frag_color;
|
||||
|
||||
void CurrFilter(AU2 pos) {
|
||||
@ -81,22 +80,22 @@ void CurrFilter(AU2 pos) {
|
||||
#ifndef YUZU_USE_FP16
|
||||
AF3 c;
|
||||
FsrEasuF(c, pos, Const0, Const1, Const2, Const3);
|
||||
frag_color = AF4(c, 1.0);
|
||||
frag_color = AF4(c, texture(InputTexture, frag_texcoord).a);
|
||||
#else
|
||||
AH3 c;
|
||||
FsrEasuH(c, pos, Const0, Const1, Const2, Const3);
|
||||
frag_color = AH4(c, 1.0);
|
||||
frag_color = AH4(c, texture(InputTexture, frag_texcoord).a);
|
||||
#endif
|
||||
#endif
|
||||
#if USE_RCAS
|
||||
#ifndef YUZU_USE_FP16
|
||||
AF3 c;
|
||||
FsrRcasF(c.r, c.g, c.b, pos, Const0);
|
||||
frag_color = AF4(c, 1.0);
|
||||
AF4 c;
|
||||
FsrRcasF(c.r, c.g, c.b, c.a, pos, Const0);
|
||||
frag_color = c;
|
||||
#else
|
||||
AH3 c;
|
||||
FsrRcasH(c.r, c.g, c.b, pos, Const0);
|
||||
frag_color = AH4(c, 1.0);
|
||||
AH4 c;
|
||||
FsrRcasH(c.r, c.g, c.b, c.a, pos, Const0);
|
||||
frag_color = c;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -71,5 +71,5 @@ vec3 FxaaPixelShader(vec4 posPos, sampler2D tex) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
frag_color = vec4(FxaaPixelShader(posPos, input_texture), 1.0);
|
||||
frag_color = vec4(FxaaPixelShader(posPos, input_texture), texture(input_texture, posPos.xy).a);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ layout (location = 0) uniform uvec4 constants[4];
|
||||
|
||||
#define A_GPU 1
|
||||
#define A_GLSL 1
|
||||
#define FSR_RCAS_PASSTHROUGH_ALPHA 1
|
||||
|
||||
#ifdef YUZU_USE_FP16
|
||||
#define A_HALF
|
||||
@ -67,9 +68,7 @@ layout (location = 0) uniform uvec4 constants[4];
|
||||
|
||||
#include "ffx_fsr1.h"
|
||||
|
||||
#if USE_RCAS
|
||||
layout(location = 0) in vec2 frag_texcoord;
|
||||
#endif
|
||||
layout (location = 0) in vec2 frag_texcoord;
|
||||
layout (location = 0) out vec4 frag_color;
|
||||
|
||||
void CurrFilter(AU2 pos)
|
||||
@ -78,22 +77,22 @@ void CurrFilter(AU2 pos)
|
||||
#ifndef YUZU_USE_FP16
|
||||
AF3 c;
|
||||
FsrEasuF(c, pos, constants[0], constants[1], constants[2], constants[3]);
|
||||
frag_color = AF4(c, 1.0);
|
||||
frag_color = AF4(c, texture(InputTexture, frag_texcoord).a);
|
||||
#else
|
||||
AH3 c;
|
||||
FsrEasuH(c, pos, constants[0], constants[1], constants[2], constants[3]);
|
||||
frag_color = AH4(c, 1.0);
|
||||
frag_color = AH4(c, texture(InputTexture, frag_texcoord).a);
|
||||
#endif
|
||||
#endif
|
||||
#if USE_RCAS
|
||||
#ifndef YUZU_USE_FP16
|
||||
AF3 c;
|
||||
FsrRcasF(c.r, c.g, c.b, pos, constants[0]);
|
||||
frag_color = AF4(c, 1.0);
|
||||
AF4 c;
|
||||
FsrRcasF(c.r, c.g, c.b, c.a, pos, constants[0]);
|
||||
frag_color = c;
|
||||
#else
|
||||
AH3 c;
|
||||
FsrRcasH(c.r, c.g, c.b, pos, constants[0]);
|
||||
frag_color = AH4(c, 1.0);
|
||||
FsrRcasH(c.r, c.g, c.b, c.a, pos, constants[0]);
|
||||
frag_color = c;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -9,5 +9,5 @@ layout (location = 0) out vec4 color;
|
||||
layout (binding = 0) uniform sampler2D color_texture;
|
||||
|
||||
void main() {
|
||||
color = vec4(texture(color_texture, frag_tex_coord).rgb, 1.0f);
|
||||
color = vec4(texture(color_texture, frag_tex_coord));
|
||||
}
|
||||
|
@ -52,5 +52,5 @@ vec4 textureBicubic( sampler2D textureSampler, vec2 texCoords ) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
color = vec4(textureBicubic(color_texture, frag_tex_coord).rgb, 1.0f);
|
||||
color = textureBicubic(color_texture, frag_tex_coord);
|
||||
}
|
||||
|
@ -46,14 +46,14 @@ vec4 blurDiagonal(sampler2D textureSampler, vec2 coord, vec2 norm) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec3 base = texture(color_texture, vec2(frag_tex_coord)).rgb * weight[0];
|
||||
vec4 base = texture(color_texture, vec2(frag_tex_coord)) * weight[0];
|
||||
vec2 tex_offset = 1.0f / textureSize(color_texture, 0);
|
||||
|
||||
// TODO(Blinkhawk): This code can be optimized through shader group instructions.
|
||||
vec3 horizontal = blurHorizontal(color_texture, frag_tex_coord, tex_offset).rgb;
|
||||
vec3 vertical = blurVertical(color_texture, frag_tex_coord, tex_offset).rgb;
|
||||
vec3 diagonalA = blurDiagonal(color_texture, frag_tex_coord, tex_offset).rgb;
|
||||
vec3 diagonalB = blurDiagonal(color_texture, frag_tex_coord, tex_offset * vec2(1.0, -1.0)).rgb;
|
||||
vec3 combination = mix(mix(horizontal, vertical, 0.5f), mix(diagonalA, diagonalB, 0.5f), 0.5f);
|
||||
color = vec4(combination + base, 1.0f);
|
||||
vec4 horizontal = blurHorizontal(color_texture, frag_tex_coord, tex_offset);
|
||||
vec4 vertical = blurVertical(color_texture, frag_tex_coord, tex_offset);
|
||||
vec4 diagonalA = blurDiagonal(color_texture, frag_tex_coord, tex_offset);
|
||||
vec4 diagonalB = blurDiagonal(color_texture, frag_tex_coord, tex_offset * vec2(1.0, -1.0));
|
||||
vec4 combination = mix(mix(horizontal, vertical, 0.5f), mix(diagonalA, diagonalB, 0.5f), 0.5f);
|
||||
color = combination + base;
|
||||
}
|
||||
|
@ -6,5 +6,6 @@
|
||||
|
||||
#define YUZU_USE_FP16
|
||||
#define USE_EASU 1
|
||||
#define VERSION 1
|
||||
|
||||
#include "fidelityfx_fsr.frag"
|
||||
|
@ -5,5 +5,6 @@
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#define USE_EASU 1
|
||||
#define VERSION 1
|
||||
|
||||
#include "fidelityfx_fsr.frag"
|
||||
|
@ -6,5 +6,6 @@
|
||||
|
||||
#define YUZU_USE_FP16
|
||||
#define USE_RCAS 1
|
||||
#define VERSION 1
|
||||
|
||||
#include "fidelityfx_fsr.frag"
|
||||
|
@ -5,5 +5,6 @@
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#define USE_RCAS 1
|
||||
#define VERSION 1
|
||||
|
||||
#include "fidelityfx_fsr.frag"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#define VERSION 1
|
||||
#define VERSION 2
|
||||
#define YUZU_USE_FP16
|
||||
|
||||
#include "opengl_present_scaleforce.frag"
|
||||
|
@ -5,6 +5,6 @@
|
||||
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#define VERSION 1
|
||||
#define VERSION 2
|
||||
|
||||
#include "opengl_present_scaleforce.frag"
|
||||
|
Reference in New Issue
Block a user