Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
-- Vertex

void main(void)
{
}

-- Geometry

layout(points) in;
layout(triangle_strip, max_vertices = 4) out;

out vec4 _posPos;

void main() {

    gl_Position = vec4(1.0, 1.0, 0.0, 1.0);
    g_out._texCoord = vec2(1.0, 1.0);
    EmitVertex();

    gl_Position = vec4(-1.0, 1.0, 0.0, 1.0);
    g_out._texCoord = vec2(0.0, 1.0);
    EmitVertex();

    gl_Position = vec4(1.0, -1.0, 0.0, 1.0);
    g_out._texCoord = vec2(1.0, 0.0);
    EmitVertex();

    gl_Position = vec4(-1.0, -1.0, 0.0, 1.0);
    g_out._texCoord = vec2(0.0, 0.0);
    EmitVertex();

    EndPrimitive();
}

-- Fragment

#include "utility.frag"

#define FXAA_PC 1
#define FXAA_GLSL_130 1
#define FXAA_QUALITY__PRESET 23
#define FXAA_GREEN_AS_LUMA 0
#include "Fxaa3_11.frag"

out vec4 _colourOut;
layout(binding = TEXTURE_UNIT0) uniform sampler2D texScreen;
uniform int dvd_qualityMultiplier;

void main(void)
{

    vec2 rcpFrame =  dvd_invScreenDimensions.xy;
    vec2 pos = gl_FragCoord.xy / dvd_ViewPort.zw;

    vec4 ConsolePosPos = vec4(0.0, 0.0, 0.0, 0.0);
    vec4 ConsoleRcpFrameOpt = vec4(0.0, 0.0, 0.0, 0.0);
    vec4 ConsoleRcpFrameOpt2 = vec4(0.0, 0.0, 0.0, 0.0);
    vec4 Console360RcpFrameOpt2 = vec4(0.0, 0.0, 0.0, 0.0);

    int qualityFactor = min(dvd_qualityMultiplier, 5);
    // Only used on FXAA Quality.
    // Choose the amount of sub-pixel aliasing removal.
    // This can effect sharpness.
    //   1.00 - upper limit (softer)
    //   0.75 - default amount of filtering
    //   0.50 - lower limit (sharper, less sub-pixel aliasing removal)
    //   0.25 - almost off
    //   0.00 - completely off
    float QualitySubpix = qualityFactor * 0.25;

    // The minimum amount of local contrast required to apply algorithm.
    //   0.333 - too little (faster)
    //   0.250 - low quality
    //   0.166 - default
    //   0.125 - high quality 
    //   0.033 - very high quality (slower)
    const float thresholdArray[5] = {0.333, 0.250, 0.166, 0.125, 0.033};

    float QualityEdgeThreshold = thresholdArray[qualityFactor];

    vec4  Console360ConstDir = vec4(1.0, -1.0, 0.25, -0.25);
    _colourOut = FxaaPixelShader(pos, ConsolePosPos, texScreen, texScreen, texScreen, rcpFrame, ConsoleRcpFrameOpt, ConsoleRcpFrameOpt2, Console360RcpFrameOpt2, QualitySubpix, QualityEdgeThreshold, 0.0, 8.0, 0.125, 0.05, Console360ConstDir);
    _colourOut.rgb = ToSRGB(_colourOut.rgb);
}

Commits for Divide-Framework/trunk/assets/shaders/GLSL/FXAA.glsl

Diff revisions: vs.
Revision Author Commited Message
721 Diff Diff IonutCava picture IonutCava Wed 08 Jun, 2016 15:47:49 +0000

[IonutCava]
- Spelling: change all references from our code of “color” to the PROPER British version of “colour” because it sounds 100x better

606 Diff Diff IonutCava picture IonutCava Tue 15 Dec, 2015 17:16:59 +0000

[IonutCava]
- More post-processing work:
— Average luminance calculation and tonemapping are no longer optional
— Split HDR and LDR based operators into their respective batches
- Allow disabling of specific Framebuffer render targets if needed

605 Diff Diff IonutCava picture IonutCava Mon 14 Dec, 2015 21:10:30 +0000

[IonutCava]
- Updated FXAA shader from v2 to v3.1.1
- LDR target conversion check and guarantee:
— Bloom/ToneMap always overwrites ldrTarget
— FXAA creates ldrTarget from hdrTarget if it wasn’t set by Bloom
— PreRenderBatch creates ldrTarget from hdrTarget if neither Bloom or Fxaa managed to create it
- Some Linear/SRGB corrections (still not 100% corect but getting there)

598 Diff Diff IonutCava picture IonutCava Mon 07 Dec, 2015 17:21:28 +0000

[IonutCava]
- Transform caching updates
- Light impostor rendering updates
- Temporarily disable persistent buffer mapping

576 Diff Diff IonutCava picture IonutCava Fri 20 Nov, 2015 11:54:22 +0000

[IonutCava]
- C++ based Interface block generation for GLSL

574 Diff Diff IonutCava picture IonutCava Thu 19 Nov, 2015 15:34:07 +0000

[IonutCava]
- Buffer size mismatch between C++ and GLSL fixes

566 Diff Diff IonutCava picture IonutCava Sat 14 Nov, 2015 18:34:27 +0000

[IonutCava]
- Cleanup GLSL UBO variables
- Cleanup mat4 class
- Fixed fog rendering
- Disable useless environment mipmap generation step

559 Diff Diff IonutCava picture IonutCava Tue 10 Nov, 2015 16:34:26 +0000

[IonutCava]
- Uniform cleanup:
— Grab most shader uniform calls and batch the data in a scene global shader buffer
- Fix a crash related to environment maps:
— Material instance does not own the REFLECTION texture (unlike the other texture types). Increase the incoming texture’s reference count instead

331 Diff Diff IonutCava picture IonutCava Sat 06 Dec, 2014 20:53:45 +0000

[Ionut]
- Limited line length to 132 characters to improve readability and diff-comparisons
- Refactored memory allocation/deallocation functions
- Fixed a few compatibility issues with HashMap.h
- Fixed a bug in GPU Skinning shaders (cast a float to int)

277 IonutCava picture IonutCava Tue 17 Jun, 2014 19:27:29 +0000

[Ionut] [[BR]]
- Change PostFX shader to be subroutine-based (instead of using if-else statements) [[BR]]