parent
f59de199cf
commit
ec4762f669
@ -0,0 +1,3 @@
|
||||
cgc -entry fxaa_pp fxaa_pp.cg -profile arbfp1 -O3 -fastmath -fastprecision -o fxaa_pp_arbfp1.txt
|
||||
cgc -entry fxaa_pp fxaa_pp.cg -profile ps_2_0 -O3 -fastmath -fastprecision -o fxaa_pp_ps_2_0.txt
|
||||
cgc -entry fxaa_vp fxaa_vp.cg -profile arbvp1 -fastmath -fastprecision -o fxaa_vp_arbvp1.txt
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,70 @@
|
||||
|
||||
#define FXAA_PS3 1
|
||||
#define FXAA_HLSL_3 1
|
||||
#define FXAA_QUALITY__PRESET 12
|
||||
#define FXAA_EARLY_EXIT 0
|
||||
|
||||
#define h4tex2Dlod tex2Dlod
|
||||
#define half4 float4
|
||||
#define half3 float3
|
||||
#define half2 float2
|
||||
#define half float
|
||||
|
||||
#include "fxaa3_11.h"
|
||||
|
||||
void fxaa_pp(
|
||||
// Per fragment parameters
|
||||
float2 pos : TEXCOORD0,
|
||||
float4 fxaaConsolePosPos : TEXCOORD1,
|
||||
|
||||
// Fragment program constants
|
||||
uniform float4 fxaaConsoleRcpFrameOpt,
|
||||
uniform float4 fxaaConsoleRcpFrameOpt2,
|
||||
uniform sampler2D nlTex0 : TEX0,
|
||||
|
||||
// Output color
|
||||
out float4 oCol : COLOR
|
||||
)
|
||||
{
|
||||
oCol = FxaaPixelShader(
|
||||
pos,
|
||||
fxaaConsolePosPos,
|
||||
nlTex0,
|
||||
fxaaConsoleRcpFrameOpt,
|
||||
fxaaConsoleRcpFrameOpt2
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
Have FXAA vertex shader run as a full screen triangle,
|
||||
and output "pos" and "fxaaConsolePosPos"
|
||||
such that inputs in the pixel shader provide,
|
||||
|
||||
// {xy} = center of pixel
|
||||
FxaaFloat2 pos,
|
||||
|
||||
// {xy__} = upper left of pixel
|
||||
// {__zw} = lower right of pixel
|
||||
FxaaFloat4 fxaaConsolePosPos,
|
||||
*/
|
||||
|
||||
// fxaaConsoleRcpFrameOpt:
|
||||
// Only used on FXAA Console.
|
||||
// This must be from a constant/uniform.
|
||||
// This effects sub-pixel AA quality and inversely sharpness.
|
||||
// Where N ranges between,
|
||||
// N = 0.50 (default)
|
||||
// N = 0.33 (sharper)
|
||||
// {x___} = -N/screenWidthInPixels
|
||||
// {_y__} = -N/screenHeightInPixels
|
||||
// {__z_} = N/screenWidthInPixels
|
||||
// {___w} = N/screenHeightInPixels
|
||||
|
||||
// fxaaConsoleRcpFrameOpt2:
|
||||
// Only used on FXAA Console.
|
||||
// Not used on 360, but used on PS3 and PC.
|
||||
// This must be from a constant/uniform.
|
||||
// {x___} = -2.0/screenWidthInPixels
|
||||
// {_y__} = -2.0/screenHeightInPixels
|
||||
// {__z_} = 2.0/screenWidthInPixels
|
||||
// {___w} = 2.0/screenHeightInPixels
|
@ -0,0 +1,76 @@
|
||||
!!ARBfp1.0
|
||||
OPTION ARB_precision_hint_fastest;
|
||||
# cgc version 3.1.0013, build date Apr 18 2012
|
||||
# command line args: -profile arbfp1 -O3 -fastmath -fastprecision
|
||||
# source file: fxaa_pp.cg
|
||||
#vendor NVIDIA Corporation
|
||||
#version 3.1.0.13
|
||||
#profile arbfp1
|
||||
#program fxaa_pp
|
||||
#semantic fxaa_pp.fxaaConsoleRcpFrameOpt
|
||||
#semantic fxaa_pp.fxaaConsoleRcpFrameOpt2
|
||||
#semantic fxaa_pp.nlTex0 : TEX0
|
||||
#var float2 pos : $vin.TEXCOORD0 : TEX0 : 0 : 1
|
||||
#var float4 fxaaConsolePosPos : $vin.TEXCOORD1 : TEX1 : 1 : 1
|
||||
#var float4 fxaaConsoleRcpFrameOpt : : c[0] : 2 : 1
|
||||
#var float4 fxaaConsoleRcpFrameOpt2 : : c[1] : 3 : 1
|
||||
#var sampler2D nlTex0 : TEX0 : texunit 0 : 4 : 1
|
||||
#var float4 oCol : $vout.COLOR : COL : 5 : 1
|
||||
#const c[2] = 0.125 0 -2 2
|
||||
#const c[3] = 0.001953125 0.5
|
||||
PARAM c[4] = { program.local[0..1],
|
||||
{ 0.125, 0, -2, 2 },
|
||||
{ 0.001953125, 0.5 } };
|
||||
TEMP R0;
|
||||
TEMP R1;
|
||||
TEMP R2;
|
||||
TEMP R3;
|
||||
TEMP R4;
|
||||
TEMP R5;
|
||||
TEX R1.w, fragment.texcoord[1].zyzw, texture[0], 2D;
|
||||
ADD R0.x, R1.w, c[3];
|
||||
TEX R0.w, fragment.texcoord[1].xwzw, texture[0], 2D;
|
||||
TEX R1.w, fragment.texcoord[1], texture[0], 2D;
|
||||
ADD R0.y, -R0.x, R0.w;
|
||||
ADD R0.z, R1.w, R0.y;
|
||||
TEX R2.w, fragment.texcoord[1].zwzw, texture[0], 2D;
|
||||
ADD R0.y, -R1.w, R0;
|
||||
ADD R1.x, R2.w, R0.y;
|
||||
ADD R1.y, R0.z, -R2.w;
|
||||
MUL R2.xy, R1, R1;
|
||||
ADD R0.y, R2.x, R2;
|
||||
RSQ R0.y, R0.y;
|
||||
MUL R2.xy, R0.y, R1;
|
||||
MAD R3.xy, R2, c[0].zwzw, fragment.texcoord[0];
|
||||
ABS R0.z, R2.y;
|
||||
ABS R0.y, R2.x;
|
||||
MIN R0.y, R0, R0.z;
|
||||
RCP R0.y, R0.y;
|
||||
MUL R1.xy, R0.y, R2;
|
||||
MUL R1.xy, R1, c[2].x;
|
||||
MIN R1.xy, R1, c[2].w;
|
||||
TEX R4, R3, texture[0], 2D;
|
||||
MAD R2.xy, -R2, c[0].zwzw, fragment.texcoord[0];
|
||||
TEX R3, R2, texture[0], 2D;
|
||||
ADD R3, R3, R4;
|
||||
MAX R1.xy, R1, c[2].z;
|
||||
MAD R2.xy, R1, c[1].zwzw, fragment.texcoord[0];
|
||||
MUL R5, R3, c[3].y;
|
||||
MAD R1.xy, -R1, c[1].zwzw, fragment.texcoord[0];
|
||||
MIN R0.z, R0.x, R2.w;
|
||||
MIN R0.y, R0.w, R1.w;
|
||||
MIN R0.y, R0, R0.z;
|
||||
MAX R0.z, R0.x, R2.w;
|
||||
MAX R0.x, R0.w, R1.w;
|
||||
MAX R0.x, R0, R0.z;
|
||||
TEX R4, R2, texture[0], 2D;
|
||||
TEX R3, R1, texture[0], 2D;
|
||||
ADD R3, R3, R4;
|
||||
MAD R3, R3, c[3].y, R5;
|
||||
MUL R3, R3, c[3].y;
|
||||
SLT R0.z, R0.x, R3.w;
|
||||
SLT R0.x, R3.w, R0.y;
|
||||
ADD_SAT R0.x, R0, R0.z;
|
||||
CMP result.color, -R0.x, R5, R3;
|
||||
END
|
||||
# 45 instructions, 6 R-regs
|
@ -0,0 +1,92 @@
|
||||
ps_2_0
|
||||
// cgc version 3.1.0013, build date Apr 18 2012
|
||||
// command line args: -profile ps_2_0 -O3 -fastmath -fastprecision
|
||||
// source file: fxaa_pp.cg
|
||||
//vendor NVIDIA Corporation
|
||||
//version 3.1.0.13
|
||||
//profile ps_2_0
|
||||
//program fxaa_pp
|
||||
//semantic fxaa_pp.fxaaConsoleRcpFrameOpt
|
||||
//semantic fxaa_pp.fxaaConsoleRcpFrameOpt2
|
||||
//semantic fxaa_pp.nlTex0 : TEX0
|
||||
//var float2 pos : $vin.TEXCOORD0 : TEX0 : 0 : 1
|
||||
//var float4 fxaaConsolePosPos : $vin.TEXCOORD1 : TEX1 : 1 : 1
|
||||
//var float4 fxaaConsoleRcpFrameOpt : : c[0] : 2 : 1
|
||||
//var float4 fxaaConsoleRcpFrameOpt2 : : c[1] : 3 : 1
|
||||
//var sampler2D nlTex0 : TEX0 : texunit 0 : 4 : 1
|
||||
//var float4 oCol : $vout.COLOR : COL : 5 : 1
|
||||
//const c[2] = 0.001953125 0.125 2 -2
|
||||
//const c[3] = 0.5 0 1
|
||||
dcl_2d s0
|
||||
def c2, 0.00195313, 0.12500000, 2.00000000, -2.00000000
|
||||
def c3, 0.50000000, 0.00000000, 1.00000000, 0
|
||||
dcl t1
|
||||
dcl t0.xy
|
||||
texld r5, t1, s0
|
||||
mov r1.y, t1.w
|
||||
mov r1.x, t1.z
|
||||
mov r2.xy, r1
|
||||
mov r0.y, t1.w
|
||||
mov r0.x, t1
|
||||
mov r1.y, t1
|
||||
mov r1.x, t1.z
|
||||
texld r1, r1, s0
|
||||
texld r0, r0, s0
|
||||
texld r6, r2, s0
|
||||
add r0.x, r1.w, c2
|
||||
add r2.x, -r0, r0.w
|
||||
add r1.x, r5.w, r2
|
||||
add r2.z, r1.x, -r6.w
|
||||
add r2.x, -r5.w, r2
|
||||
add r2.x, r6.w, r2
|
||||
mov r3.x, r2
|
||||
mov r3.y, r2.z
|
||||
mov r2.y, r2.z
|
||||
mov r1.y, r2.z
|
||||
mov r1.x, r2
|
||||
mul r1.xy, r3, r1
|
||||
add r1.x, r1, r1.y
|
||||
rsq r1.x, r1.x
|
||||
mul r4.xy, r1.x, r2
|
||||
abs r2.x, r4.y
|
||||
abs r1.x, r4
|
||||
min r1.x, r1, r2
|
||||
rcp r1.x, r1.x
|
||||
mul r1.xy, r1.x, r4
|
||||
mul r1.xy, r1, c2.y
|
||||
min r1.xy, r1, c2.z
|
||||
max r2.xy, r1, c2.w
|
||||
mov r1.y, c1.w
|
||||
mov r1.x, c1.z
|
||||
mad r3.xy, r2, r1, t0
|
||||
mov r1.y, c1.w
|
||||
mov r1.x, c1.z
|
||||
mad r5.xy, -r2, r1, t0
|
||||
mov r1.y, c0.w
|
||||
mov r1.x, c0.z
|
||||
mad r2.xy, -r4, r1, t0
|
||||
mov r1.y, c0.w
|
||||
mov r1.x, c0.z
|
||||
mad r1.xy, r4, r1, t0
|
||||
texld r4, r5, s0
|
||||
texld r3, r3, s0
|
||||
texld r1, r1, s0
|
||||
texld r2, r2, s0
|
||||
add r1, r2, r1
|
||||
mul r2, r1, c3.x
|
||||
add r1, r4, r3
|
||||
max r3.x, r0, r6.w
|
||||
mad r1, r1, c3.x, r2
|
||||
mul r4, r1, c3.x
|
||||
max r1.x, r0.w, r5.w
|
||||
max r1.x, r1, r3
|
||||
add r1.x, -r4.w, r1
|
||||
min r3.x, r0.w, r5.w
|
||||
min r0.x, r0, r6.w
|
||||
min r0.x, r3, r0
|
||||
add r0.x, r4.w, -r0
|
||||
cmp r1.x, r1, c3.y, c3.z
|
||||
cmp r0.x, r0, c3.y, c3.z
|
||||
add_pp_sat r0.x, r0, r1
|
||||
cmp r0, -r0.x, r4, r2
|
||||
mov oC0, r0
|
@ -0,0 +1,20 @@
|
||||
|
||||
void fxaa_vp(
|
||||
// Per vertex parameters
|
||||
float3 position : POSITION,
|
||||
float2 texCoord0 : TEXCOORD0,
|
||||
|
||||
// Vertex program constants
|
||||
uniform float4x4 modelViewProjection,
|
||||
uniform float4 fxaaConsolePosPos,
|
||||
|
||||
// Output position
|
||||
out float4 oPosition : POSITION,
|
||||
out float2 oTexCoord0 : TEXCOORD0,
|
||||
out float4 oTexCoord1 : TEXCOORD1
|
||||
)
|
||||
{
|
||||
oPosition = mul(modelViewProjection, float4(position, 0.0));
|
||||
oTexCoord0 = texCoord0;
|
||||
oTexCoord1 = texCoord0.xyxy + fxaaConsolePosPos;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
!!ARBvp1.0
|
||||
# cgc version 3.1.0013, build date Apr 18 2012
|
||||
# command line args: -profile arbvp1 -fastmath -fastprecision
|
||||
# source file: fxaa_vp.cg
|
||||
#vendor NVIDIA Corporation
|
||||
#version 3.1.0.13
|
||||
#profile arbvp1
|
||||
#program fxaa_vp
|
||||
#semantic fxaa_vp.modelViewProjection
|
||||
#semantic fxaa_vp.fxaaConsolePosPos
|
||||
#var float3 position : $vin.POSITION : POSITION : 0 : 1
|
||||
#var float2 texCoord0 : $vin.TEXCOORD0 : TEXCOORD0 : 1 : 1
|
||||
#var float4x4 modelViewProjection : : c[1], 4 : 2 : 1
|
||||
#var float4 fxaaConsolePosPos : : c[5] : 3 : 1
|
||||
#var float4 oPosition : $vout.POSITION : HPOS : 4 : 1
|
||||
#var float2 oTexCoord0 : $vout.TEXCOORD0 : TEX0 : 5 : 1
|
||||
#var float4 oTexCoord1 : $vout.TEXCOORD1 : TEX1 : 6 : 1
|
||||
#const c[0] = 0
|
||||
PARAM c[6] = { { 0 },
|
||||
program.local[1..5] };
|
||||
TEMP R0;
|
||||
MOV R0.w, c[0].x;
|
||||
MOV R0.xyz, vertex.position;
|
||||
DP4 result.position.w, R0, c[4];
|
||||
DP4 result.position.z, R0, c[3];
|
||||
DP4 result.position.y, R0, c[2];
|
||||
DP4 result.position.x, R0, c[1];
|
||||
ADD result.texcoord[1], vertex.texcoord[0].xyxy, c[5];
|
||||
MOV result.texcoord[0].xy, vertex.texcoord[0];
|
||||
END
|
||||
# 8 instructions, 1 R-regs
|
@ -0,0 +1,4 @@
|
||||
Compiled shaders are embedded in the source.
|
||||
Must compile and re-embed manually.
|
||||
|
||||
FXAA is in public domain.
|
Loading…
Reference in New Issue