mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-25 00:51:29 +11:00
dd9994482c
- Expose all the configuration settings used by the quality presets to allow fine-tuning of edge detection. - Changed default edge detection technique from luma to color since in my tests that always yields better results. - Increased quality to ultra in default preset. - Deleted the duplication of the fragment shader part of the lib, as I figured out how to include the lib twice with different defines for the vertex and fragment passes. That is necessary probably because discard cannot be used in vertex shaders in RetroArch, indicated in a comment in the lib as a possible restriction in some compilers. - Include license headers to make clear that all my contributions are released on the public domain under the terms of the Unlicense. Anyone can do whatever they want with this.
49 lines
1.3 KiB
Plaintext
49 lines
1.3 KiB
Plaintext
#version 450
|
|
// SPDX-License-Identifier: Unlicense
|
|
#pragma name SMAA_Pass2
|
|
//-----------------------------------------------------------------------------
|
|
// Neighborhood Blending Shader (Third Pass)
|
|
|
|
layout(push_constant) uniform Push {
|
|
vec4 SourceSize;
|
|
vec4 OriginalSize;
|
|
vec4 OutputSize;
|
|
uint FrameCount;
|
|
} params;
|
|
|
|
layout(std140, set = 0, binding = 0) uniform UBO {
|
|
mat4 MVP;
|
|
} global;
|
|
|
|
#define SMAA_RT_METRICS vec4(params.SourceSize.z, params.SourceSize.w, params.SourceSize.x, params.SourceSize.y)
|
|
#define SMAA_GLSL_4
|
|
|
|
#pragma stage vertex
|
|
layout(location = 0) in vec4 Position;
|
|
layout(location = 1) in vec2 TexCoord;
|
|
layout(location = 0) out vec2 vTexCoord;
|
|
layout(location = 1) out vec4 offset;
|
|
|
|
#define SMAA_INCLUDE_PS 0
|
|
#include "SMAA.hlsl"
|
|
|
|
void main() {
|
|
gl_Position = global.MVP * Position;
|
|
vTexCoord = TexCoord;
|
|
SMAANeighborhoodBlendingVS(TexCoord, offset);
|
|
}
|
|
|
|
#pragma stage fragment
|
|
layout(location = 0) in vec2 vTexCoord;
|
|
layout(location = 1) in vec4 offset;
|
|
layout(location = 0) out vec4 FragColor;
|
|
layout(set = 0, binding = 2) uniform sampler2D Source;
|
|
layout(set = 0, binding = 3) uniform sampler2D SMAA_Input;
|
|
|
|
#define SMAA_INCLUDE_VS 0
|
|
#include "SMAA.hlsl"
|
|
|
|
void main() {
|
|
FragColor = SMAANeighborhoodBlendingPS(vTexCoord, offset, SMAA_Input, Source);
|
|
}
|