• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › Support v
« Previous 1 ... 472 473 474 475 476 ... 1189 Next »

Error with compiling shaders
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Error with compiling shaders
05-25-2015, 12:41 AM (This post was last modified: 05-25-2015, 10:12 AM by mbc07. Edit Reason: Mod Edit: use [code][/code] tags next time... )
#1
Shockwave555
Unregistered
 
Hi


I recently downloaded the Ishiiruka Dolphin launcher, and upon trying to play the wii version of zelda tp, it gave me an error that says "Failed to compile shader".


Here is an image of the error. I am not sure why it says my gpu is out of date, as it is one of the fastest on the market at the moment.

[Image: jhelrqW.png]


Here are the contents.

Code:
// Required variables
// Shouldn't be accessed directly by the PP shader
// Texture sampler
sampler samp8 : register(s8);
sampler samp9 : register(s9);
sampler samp10 : register(s10);
Texture2D Tex8 : register(t8);
Texture2DArray Tex9 : register(t9);
Texture2DArray Tex10 : register(t10);
Texture2DArray Tex11[4] : register(t11);

cbuffer ParamBuffer : register(b0)
{
uint Time;
int layer;
float native_gamma;
float padding;
float4 resolution;
float4 targetscale;
}

// Globals
static float2 uv0;
static float4 uv1, uv2, fragment_pos;
// Interfacing functions
float2 GetFragmentCoord()
{
return fragment_pos.xy;
}
float4 Sample(float2 location, int l)
{
return Tex9.Sample(samp9, float3(location, l));
}
float4 SampleLocationOffset(float2 location, int2 offset)
{
return Tex9.Sample(samp9, float3(location, layer), offset);
}
float2 FromSRCCoords(float2 location)
{
return (location - targetscale.xy) * targetscale.zw;
}
float2 ToSRCCoords(float2 location)
{
return location / targetscale.zw + targetscale.xy;
}
float4 SamplePrev(int idx, float2 location)
{
return Tex11[idx].Sample(samp9, float3(FromSRCCoords(location), 0));
}
float4 SamplePrevLocationOffset(int idx, float2 location, int2 offset)
{
return Tex11[idx].Sample(samp9, float3(FromSRCCoords(location), 0), offset);
}
float SampleDepth(float2 location, int l)
{
/*float Znear = 0.001;
float Zfar = 1.0;
float A  = (1 - ( Zfar / Znear ))/2;
float B = (1 + ( Zfar / Znear ))/2;*/
float A = -499.5;
float B =  500.5;
float depth = 1.0 - Tex10.Sample(samp10, float3(location, l)).x;
depth = 1.0 / (A * depth + B);
return depth;
}
float SampleDepthLoacationOffset(float2 location, int2 offset)
{
float A = -499.5;
float B =  500.5;
float depth = 1.0 - Tex10.Sample(samp10, float3(location, layer), offset).x;
depth = 1.0 / (A * depth + B);
return depth;
}

float4 Sample() { return Sample(uv0, layer); }
float4 SampleOffset(int2 offset) { return SampleLocationOffset(uv0, offset); }
float4 SamplePrev() { return SamplePrev(0, uv0); }
float4 SamplePrev(int idx) { return SamplePrev(idx, uv0); }
float4 SamplePrevOffset(int2 offset) { return SamplePrevLocationOffset(0, uv0, offset); }
float4 SamplePrevOffset(int idx, int2 offset) { return SamplePrevLocationOffset(idx, uv0, offset); }
float SampleDepth() { return SampleDepth(uv0, layer); }
float SampleDepthOffset(int2 offset) { return SampleDepthLoacationOffset(uv0, offset); }
float4 SampleLocation(float2 location) { return Sample(location, layer); }
float SampleDepthLocation(float2 location) { return SampleDepth(location, layer); }
float4 SamplePrevLocation(float2 location) { return SamplePrev(0, location); }
float4 SamplePrevLocation(int idx, float2 location) { return SamplePrev(idx, location); }
float4 SampleLayer(int l) { return Sample(uv0, l); }
float SampleDepthLayer(int l) { return SampleDepth(uv0, l); }
float4 SampleFontLocation(float2 location) { return Tex8.Sample(samp8, location); }

float4 ApplyGCGamma(float4 col)
{
return pow(col, native_gamma);
}
float2 GetResolution()
{
return resolution.xy;
}
float2 GetInvResolution()
{
return resolution.zw;
}
float2 GetCoordinates()
{
return uv0;
}
uint GetTime()
{
return Time;
}

#define SetOutput(color) ocol0 = color
#define mult(a, b) mul(b, a)
#define GetOption(x) (option_##x)
#define OptionEnabled(x) (option_##x != 0)

//Random
static float global_rnd_state;

float RandomSeedfloat(float2 seed)
{
float noise = frac(sin(dot(seed, float2(12.9898, 78.233)*2.0)) * 43758.5453);
return noise;
}

void rnd_advance()
{
   global_rnd_state = RandomSeedfloat(uv0 + global_rnd_state);
}

uint RandomSeeduint(float2 seed)
{
float noise = RandomSeedfloat(seed);
return uint(noise * 0xFFFFFF);
}

void Randomize()
{
global_rnd_state = frac(float(GetTime())*0.0001);
}

uint Rndint()
{
rnd_advance();
return uint(global_rnd_state * 0xFFFFFF);
}

float Rndfloat()
{
rnd_advance();
return global_rnd_state;
}

float2 Rndfloat2()
{
float2 val;
rnd_advance();
val.x = global_rnd_state;
rnd_advance();
val.y = global_rnd_state;
return val;
}

float3 Rndfloat3()
{
float3 val;
rnd_advance();
val.x = global_rnd_state;
rnd_advance();
val.y = global_rnd_state;
rnd_advance();
val.z = global_rnd_state;
return val;
}

float4 Rndfloat4()
{
float4 val;
rnd_advance();
val.x = global_rnd_state;
rnd_advance();
val.y = global_rnd_state;
rnd_advance();
val.z = global_rnd_state;
rnd_advance();
val.w = global_rnd_state;
return val;
}

cbuffer OptionBuffer : register(b1) {int     option_A_SSAO_MODE;
int     option_B_SSAO_SAMPLES;
float   option_C_SAMPLE_RANGE;
float   option_D_FILTER_LIMIT;
float   option_E_MAX_DEPTH;
float   option_F_MIN_DEPTH;
int     option_G_DOF;
float   option_H_BLUR;
float2 option_I_FOCUS_POS;
}
// Simple SSAO



/*



*/

float3 GetNormalFromDepth(float fDepth)

{

  float depth1 = SampleDepthOffset(int2(0, 1));

  float depth2 = SampleDepthOffset(int2(1, 0));

float2 invres = GetInvResolution();

  float3 p1 = float3(0,invres.y, depth1 - fDepth);

  float3 p2 = float3(invres.x, 0, depth2 - fDepth);

 

  float3 normal = cross(p1, p2);

  normal.z = -normal.z;

 

  return normalize(normal);

}

#define FILTER_RADIUS 4



float4 BlurPrev(int2 offsetmask, float depth)

{

float limit = GetOption(D_FILTER_LIMIT);

float4 Weight = float4(1,1,1,1);

float4 count = Weight;

float4 value = SamplePrev();



for(int i = 1; i < (FILTER_RADIUS + 1); i++)

{

int2 offset = offsetmask * i;

Weight.w = min(sign(limit - abs(SampleDepthOffset(offset) - depth)) + 1.0, 1.0);

value +=  SamplePrevOffset(offset) * Weight;

count += Weight;

offset = -offset;

Weight.w = min(sign(limit - abs(SampleDepthOffset(offset) - depth)) + 1.0, 1.0);

value +=  SamplePrevOffset(offset) * Weight;

count += Weight;

}

return value / count;

}



void BlurH(
out float4 ocol0 : SV_Target,
in float4 frag_pos : SV_Position,
in float2 _uv0 : TEXCOORD0,
in float4 _uv1 : TEXCOORD1,
in float4 _uv2 : TEXCOORD2)
{
fragment_pos = frag_pos;
uv0 = _uv0;
uv1 = _uv1;
uv2 = _uv2;


SetOutput(BlurPrev(int2(1,0), SampleDepth()));

}



void Merger(
out float4 ocol0 : SV_Target,
in float4 frag_pos : SV_Position,
in float2 _uv0 : TEXCOORD0,
in float4 _uv1 : TEXCOORD1,
in float4 _uv2 : TEXCOORD2)
{
fragment_pos = frag_pos;
uv0 = _uv0;
uv1 = _uv1;
uv2 = _uv2;


float depth = SampleDepth();

float4 blur = BlurPrev(int2(0,1), depth);

float4 value = float4(blur.wwww);

if(GetOption(A_SSAO_MODE) < 2)

{

float4 color = Sample();

if(GetOption(A_SSAO_MODE) == 0)

{

value = color;

}

else

{

value *= color;

}

}

SetOutput(value);

}



void DOF(
out float4 ocol0 : SV_Target,
in float4 frag_pos : SV_Position,
in float2 _uv0 : TEXCOORD0,
in float4 _uv1 : TEXCOORD1,
in float4 _uv2 : TEXCOORD2)
{
fragment_pos = frag_pos;
uv0 = _uv0;
uv1 = _uv1;
uv2 = _uv2;


float4 value = SamplePrev();

if(GetOption(G_DOF) == 1)

{

float2 coords = GetCoordinates();

float4 color = SamplePrev();

float4 blur = color;

float2 unit = GetInvResolution() * GetOption(H_BLUR);

blur += SamplePrevLocation(coords + unit * float2(-1.50, -0.66));

blur += SamplePrevLocation(coords + unit * float2(0.66, -1.50));

blur += SamplePrevLocation(coords + unit * float2(1.50, 0.66));

blur += SamplePrevLocation(coords + unit * float2(-0.66, 1.50));



float depth = SampleDepth();

float focusDepth = SampleDepthLocation(GetOption(I_FOCUS_POS).xy);

depth = clamp(abs((depth - focusDepth) / depth), 0.0, 1.0);

value = lerp(color, blur * 0.2, depth);

}

SetOutput(value);

}



void SSAO(
out float4 ocol0 : SV_Target,
in float4 frag_pos : SV_Position,
in float2 _uv0 : TEXCOORD0,
in float4 _uv1 : TEXCOORD1,
in float4 _uv2 : TEXCOORD2)
{
fragment_pos = frag_pos;
uv0 = _uv0;
uv1 = _uv1;
uv2 = _uv2;


float3 PoissonDisc[] = {

float3(-0.367046f, 0.692618f, 0.0136723f),

float3(0.262978f, -0.363506f, 0.231819f),

float3(-0.734306f, -0.451643f, 0.264779f),

float3(-0.532456f, 0.683096f, 0.552049f),

float3(0.672536f, 0.283731f, 0.0694296f),

float3(-0.194678f, 0.548204f, 0.56859f),

float3(-0.87347f, -0.572741f, 0.923795f),

float3(0.548936f, -0.717277f, 0.0201727f),

float3(0.48381f, 0.691397f, 0.699088f),

float3(-0.592273f, 0.41966f, 0.413953f),

float3(-0.448042f, -0.957396f, 0.123234f),

float3(-0.618458f, 0.112949f, 0.412946f),

float3(-0.412763f, 0.122227f, 0.732078f),

float3(0.816462f, -0.900815f, 0.741417f),

float3(-0.0381787f, 0.511521f, 0.799768f),

float3(-0.688284f, 0.310099f, 0.472732f),

float3(-0.368023f, 0.720572f, 0.544206f),

float3(-0.379192f, -0.55504f, 0.035371f),

float3(0.15482f, 0.0353709f, 0.543779f),

float3(0.153417f, -0.521409f, 0.943724f),

float3(-0.168371f, -0.702933f, 0.145665f),

float3(-0.673391f, -0.925657f, 0.61391f),

float3(-0.479171f, -0.131993f, 0.659932f),

float3(0.0549638f, -0.470809f, 0.420759f),

float3(0.899594f, 0.955077f, 0.54857f),

float3(-0.230689f, 0.660573f, 0.548112f),

float3(0.0421461f, -0.19895f, 0.121799f),

float3(-0.229774f, -0.30137f, 0.507492f),

float3(-0.983642f, 0.468551f, 0.0393994f),

float3(-0.00857568f, 0.440657f, 0.337046f),

float3(0.730461f, -0.283914f, 0.789941f),

float3(0.271828f, -0.226356f, 0.317026f),

float3(-0.178869f, -0.946837f, 0.073336f),

float3(0.389813f, -0.110508f, 0.0549944f),

float3(0.0242622f, 0.893613f, 0.26957f),

float3(-0.857601f, 0.0219429f, 0.45146f),

float3(-0.15659f, 0.550401f, 3.05185e-005f),

float3(0.0555742f, -0.354656f, 0.573412f),

float3(-0.267373f, 0.117466f, 0.488571f),

float3(-0.533799f, -0.431928f, 0.226661f),

float3(0.49852f, -0.750908f, 0.412427f),

float3(-0.300882f, 0.366314f, 0.558245f),

float3(-0.176f, 0.511521f, 0.722465f),

float3(-0.0514847f, -0.703543f, 0.180273f),

float3(-0.429914f, 0.0774255f, 0.161534f),

float3(-0.416791f, -0.788385f, 0.328135f),

float3(0.127293f, -0.115146f, 0.958586f),

float3(-0.34959f, -0.278481f, 0.168706f),

float3(-0.645192f, 0.168798f, 0.577105f),

float3(-0.190771f, -0.622669f, 0.257851f),

float3(0.718986f, -0.275369f, 0.602039f),

float3(-0.444258f, -0.872982f, 0.0275582f),

float3(0.793512f, 0.0511185f, 0.33964f),

float3(-0.143651f, 0.155614f, 0.368877f),

float3(-0.777093f, 0.246864f, 0.290628f),

float3(0.202979f, -0.61742f, 0.233802f),

float3(0.198523f, 0.425153f, 0.409162f),

float3(-0.629688f, 0.597461f, 0.120212f),

float3(0.0448316f, -0.689566f, 0.0241707f),

float3(-0.190039f, 0.426496f, 0.254463f),

float3(-0.255776f, 0.722831f, 0.527451f),

float3(-0.821528f, 0.303751f, 0.140172f),

float3(0.696646f, 0.168981f, 0.404492f),

float3(-0.240211f, -0.109653f, 0.463301f),

};



const float2 rndNorm[] =

{

float2(0.505277f, 0.862957f),

float2(-0.554562f, 0.832142f),

float2(0.663051f, 0.748574f),

float2(-0.584629f, -0.811301f),

float2(-0.702343f, 0.711838f),

float2(0.843108f, -0.537744f),

float2(0.85856f, 0.512713f),

float2(0.506966f, -0.861966f),

float2(0.614758f, -0.788716f),

float2(0.993426f, -0.114472f),

float2(-0.676375f, 0.736558f),

float2(-0.891668f, 0.45269f),

float2(0.226367f, 0.974042f),

float2(-0.853615f, -0.520904f),

float2(0.467359f, 0.884067f),

float2(-0.997111f, 0.0759529f),

};



float2 coords = GetCoordinates();

float fCurrDepth = SampleDepth();

float Occlusion = 1.0;

if(fCurrDepth<0.9999)

{

float3 vViewNormal = GetNormalFromDepth(fCurrDepth);

Randomize();

uint2 fragcoord = uint2(GetFragmentCoord()) & 3;

uint rndidx = fragcoord.y * 4 + fragcoord.x;

float3 vRandom = float3(rndNorm[rndidx], 0);

float fAO = 0;

const int NUMSAMPLES = GetOption(B_SSAO_SAMPLES);

for(int s = 0; s < NUMSAMPLES; s++)

{

float3 offset = PoissonDisc[s];

float3 vReflRay = reflect(offset, vRandom);



float fFlip = sign(dot(vViewNormal,vReflRay));

        vReflRay   *= fFlip;



float sD = fCurrDepth - (vReflRay.z * GetOption(C_SAMPLE_RANGE));

float fSampleDepth = SampleDepthLocation(saturate(coords + (GetOption(C_SAMPLE_RANGE) * vReflRay.xy / fCurrDepth)));

float fDepthDelta = saturate(sD - fSampleDepth);



fDepthDelta *= 1-smoothstep(0,GetOption(E_MAX_DEPTH),fDepthDelta);



if ( fDepthDelta > GetOption(F_MIN_DEPTH) && fDepthDelta < GetOption(E_MAX_DEPTH))

fAO += pow(1 - fDepthDelta, 2.5);

}

Occlusion = saturate(1 - (fAO / float(NUMSAMPLES)) + GetOption(C_SAMPLE_RANGE));

}

SetOutput(float4(Occlusion,Occlusion,Occlusion,Occlusion));

}



Here is the debug info


Code:
// Required variables
// Shouldn't be accessed directly by the PP shader
// Texture sampler
sampler samp8 : register(s8);
sampler samp9 : register(s9);
sampler samp10 : register(s10);
Texture2D Tex8 : register(t8);
Texture2DArray Tex9 : register(t9);
Texture2DArray Tex10 : register(t10);
Texture2DArray Tex11[4] : register(t11);

cbuffer ParamBuffer : register(b0)
{
uint Time;
int layer;
float native_gamma;
float padding;
float4 resolution;
float4 targetscale;
}

// Globals
static float2 uv0;
static float4 uv1, uv2, fragment_pos;
// Interfacing functions
float2 GetFragmentCoord()
{
return fragment_pos.xy;
}
float4 Sample(float2 location, int l)
{
return Tex9.Sample(samp9, float3(location, l));
}
float4 SampleLocationOffset(float2 location, int2 offset)
{
return Tex9.Sample(samp9, float3(location, layer), offset);
}
float2 FromSRCCoords(float2 location)
{
return (location - targetscale.xy) * targetscale.zw;
}
float2 ToSRCCoords(float2 location)
{
return location / targetscale.zw + targetscale.xy;
}
float4 SamplePrev(int idx, float2 location)
{
return Tex11[idx].Sample(samp9, float3(FromSRCCoords(location), 0));
}
float4 SamplePrevLocationOffset(int idx, float2 location, int2 offset)
{
return Tex11[idx].Sample(samp9, float3(FromSRCCoords(location), 0), offset);
}
float SampleDepth(float2 location, int l)
{
/*float Znear = 0.001;
float Zfar = 1.0;
float A  = (1 - ( Zfar / Znear ))/2;
float B = (1 + ( Zfar / Znear ))/2;*/
float A = -499.5;
float B =  500.5;
float depth = 1.0 - Tex10.Sample(samp10, float3(location, l)).x;
depth = 1.0 / (A * depth + B);
return depth;
}
float SampleDepthLoacationOffset(float2 location, int2 offset)
{
float A = -499.5;
float B =  500.5;
float depth = 1.0 - Tex10.Sample(samp10, float3(location, layer), offset).x;
depth = 1.0 / (A * depth + B);
return depth;
}

float4 Sample() { return Sample(uv0, layer); }
float4 SampleOffset(int2 offset) { return SampleLocationOffset(uv0, offset); }
float4 SamplePrev() { return SamplePrev(0, uv0); }
float4 SamplePrev(int idx) { return SamplePrev(idx, uv0); }
float4 SamplePrevOffset(int2 offset) { return SamplePrevLocationOffset(0, uv0, offset); }
float4 SamplePrevOffset(int idx, int2 offset) { return SamplePrevLocationOffset(idx, uv0, offset); }
float SampleDepth() { return SampleDepth(uv0, layer); }
float SampleDepthOffset(int2 offset) { return SampleDepthLoacationOffset(uv0, offset); }
float4 SampleLocation(float2 location) { return Sample(location, layer); }
float SampleDepthLocation(float2 location) { return SampleDepth(location, layer); }
float4 SamplePrevLocation(float2 location) { return SamplePrev(0, location); }
float4 SamplePrevLocation(int idx, float2 location) { return SamplePrev(idx, location); }
float4 SampleLayer(int l) { return Sample(uv0, l); }
float SampleDepthLayer(int l) { return SampleDepth(uv0, l); }
float4 SampleFontLocation(float2 location) { return Tex8.Sample(samp8, location); }

float4 ApplyGCGamma(float4 col)
{
return pow(col, native_gamma);
}
float2 GetResolution()
{
return resolution.xy;
}
float2 GetInvResolution()
{
return resolution.zw;
}
float2 GetCoordinates()
{
return uv0;
}
uint GetTime()
{
return Time;
}

#define SetOutput(color) ocol0 = color
#define mult(a, b) mul(b, a)
#define GetOption(x) (option_##x)
#define OptionEnabled(x) (option_##x != 0)

//Random
static float global_rnd_state;

float RandomSeedfloat(float2 seed)
{
float noise = frac(sin(dot(seed, float2(12.9898, 78.233)*2.0)) * 43758.5453);
return noise;
}

void rnd_advance()
{
   global_rnd_state = RandomSeedfloat(uv0 + global_rnd_state);
}

uint RandomSeeduint(float2 seed)
{
float noise = RandomSeedfloat(seed);
return uint(noise * 0xFFFFFF);
}

void Randomize()
{
global_rnd_state = frac(float(GetTime())*0.0001);
}

uint Rndint()
{
rnd_advance();
return uint(global_rnd_state * 0xFFFFFF);
}

float Rndfloat()
{
rnd_advance();
return global_rnd_state;
}

float2 Rndfloat2()
{
float2 val;
rnd_advance();
val.x = global_rnd_state;
rnd_advance();
val.y = global_rnd_state;
return val;
}

float3 Rndfloat3()
{
float3 val;
rnd_advance();
val.x = global_rnd_state;
rnd_advance();
val.y = global_rnd_state;
rnd_advance();
val.z = global_rnd_state;
return val;
}

float4 Rndfloat4()
{
float4 val;
rnd_advance();
val.x = global_rnd_state;
rnd_advance();
val.y = global_rnd_state;
rnd_advance();
val.z = global_rnd_state;
rnd_advance();
val.w = global_rnd_state;
return val;
}

cbuffer OptionBuffer : register(b1) {int     option_A_SSAO_MODE;
int     option_B_SSAO_SAMPLES;
float   option_C_SAMPLE_RANGE;
float   option_D_FILTER_LIMIT;
float   option_E_MAX_DEPTH;
float   option_F_MIN_DEPTH;
int     option_G_DOF;
float   option_H_BLUR;
float2 option_I_FOCUS_POS;
}
// Simple SSAO



/*



*/

float3 GetNormalFromDepth(float fDepth)

{

  float depth1 = SampleDepthOffset(int2(0, 1));

  float depth2 = SampleDepthOffset(int2(1, 0));

float2 invres = GetInvResolution();

  float3 p1 = float3(0,invres.y, depth1 - fDepth);

  float3 p2 = float3(invres.x, 0, depth2 - fDepth);

 

  float3 normal = cross(p1, p2);

  normal.z = -normal.z;

 

  return normalize(normal);

}

#define FILTER_RADIUS 4



float4 BlurPrev(int2 offsetmask, float depth)

{

float limit = GetOption(D_FILTER_LIMIT);

float4 Weight = float4(1,1,1,1);

float4 count = Weight;

float4 value = SamplePrev();



for(int i = 1; i < (FILTER_RADIUS + 1); i++)

{

int2 offset = offsetmask * i;

Weight.w = min(sign(limit - abs(SampleDepthOffset(offset) - depth)) + 1.0, 1.0);

value +=  SamplePrevOffset(offset) * Weight;

count += Weight;

offset = -offset;

Weight.w = min(sign(limit - abs(SampleDepthOffset(offset) - depth)) + 1.0, 1.0);

value +=  SamplePrevOffset(offset) * Weight;

count += Weight;

}

return value / count;

}



void BlurH(
out float4 ocol0 : SV_Target,
in float4 frag_pos : SV_Position,
in float2 _uv0 : TEXCOORD0,
in float4 _uv1 : TEXCOORD1,
in float4 _uv2 : TEXCOORD2)
{
fragment_pos = frag_pos;
uv0 = _uv0;
uv1 = _uv1;
uv2 = _uv2;


SetOutput(BlurPrev(int2(1,0), SampleDepth()));

}



void Merger(
out float4 ocol0 : SV_Target,
in float4 frag_pos : SV_Position,
in float2 _uv0 : TEXCOORD0,
in float4 _uv1 : TEXCOORD1,
in float4 _uv2 : TEXCOORD2)
{
fragment_pos = frag_pos;
uv0 = _uv0;
uv1 = _uv1;
uv2 = _uv2;


float depth = SampleDepth();

float4 blur = BlurPrev(int2(0,1), depth);

float4 value = float4(blur.wwww);

if(GetOption(A_SSAO_MODE) < 2)

{

float4 color = Sample();

if(GetOption(A_SSAO_MODE) == 0)

{

value = color;

}

else

{

value *= color;

}

}

SetOutput(value);

}



void DOF(
out float4 ocol0 : SV_Target,
in float4 frag_pos : SV_Position,
in float2 _uv0 : TEXCOORD0,
in float4 _uv1 : TEXCOORD1,
in float4 _uv2 : TEXCOORD2)
{
fragment_pos = frag_pos;
uv0 = _uv0;
uv1 = _uv1;
uv2 = _uv2;


float4 value = SamplePrev();

if(GetOption(G_DOF) == 1)

{

float2 coords = GetCoordinates();

float4 color = SamplePrev();

float4 blur = color;

float2 unit = GetInvResolution() * GetOption(H_BLUR);

blur += SamplePrevLocation(coords + unit * float2(-1.50, -0.66));

blur += SamplePrevLocation(coords + unit * float2(0.66, -1.50));

blur += SamplePrevLocation(coords + unit * float2(1.50, 0.66));

blur += SamplePrevLocation(coords + unit * float2(-0.66, 1.50));



float depth = SampleDepth();

float focusDepth = SampleDepthLocation(GetOption(I_FOCUS_POS).xy);

depth = clamp(abs((depth - focusDepth) / depth), 0.0, 1.0);

value = lerp(color, blur * 0.2, depth);

}

SetOutput(value);

}



void SSAO(
out float4 ocol0 : SV_Target,
in float4 frag_pos : SV_Position,
in float2 _uv0 : TEXCOORD0,
in float4 _uv1 : TEXCOORD1,
in float4 _uv2 : TEXCOORD2)
{
fragment_pos = frag_pos;
uv0 = _uv0;
uv1 = _uv1;
uv2 = _uv2;


float3 PoissonDisc[] = {

float3(-0.367046f, 0.692618f, 0.0136723f),

float3(0.262978f, -0.363506f, 0.231819f),

float3(-0.734306f, -0.451643f, 0.264779f),

float3(-0.532456f, 0.683096f, 0.552049f),

float3(0.672536f, 0.283731f, 0.0694296f),

float3(-0.194678f, 0.548204f, 0.56859f),

float3(-0.87347f, -0.572741f, 0.923795f),

float3(0.548936f, -0.717277f, 0.0201727f),

float3(0.48381f, 0.691397f, 0.699088f),

float3(-0.592273f, 0.41966f, 0.413953f),

float3(-0.448042f, -0.957396f, 0.123234f),

float3(-0.618458f, 0.112949f, 0.412946f),

float3(-0.412763f, 0.122227f, 0.732078f),

float3(0.816462f, -0.900815f, 0.741417f),

float3(-0.0381787f, 0.511521f, 0.799768f),

float3(-0.688284f, 0.310099f, 0.472732f),

float3(-0.368023f, 0.720572f, 0.544206f),

float3(-0.379192f, -0.55504f, 0.035371f),

float3(0.15482f, 0.0353709f, 0.543779f),

float3(0.153417f, -0.521409f, 0.943724f),

float3(-0.168371f, -0.702933f, 0.145665f),

float3(-0.673391f, -0.925657f, 0.61391f),

float3(-0.479171f, -0.131993f, 0.659932f),

float3(0.0549638f, -0.470809f, 0.420759f),

float3(0.899594f, 0.955077f, 0.54857f),

float3(-0.230689f, 0.660573f, 0.548112f),

float3(0.0421461f, -0.19895f, 0.121799f),

float3(-0.229774f, -0.30137f, 0.507492f),

float3(-0.983642f, 0.468551f, 0.0393994f),

float3(-0.00857568f, 0.440657f, 0.337046f),

float3(0.730461f, -0.283914f, 0.789941f),

float3(0.271828f, -0.226356f, 0.317026f),

float3(-0.178869f, -0.946837f, 0.073336f),

float3(0.389813f, -0.110508f, 0.0549944f),

float3(0.0242622f, 0.893613f, 0.26957f),

float3(-0.857601f, 0.0219429f, 0.45146f),

float3(-0.15659f, 0.550401f, 3.05185e-005f),

float3(0.0555742f, -0.354656f, 0.573412f),

float3(-0.267373f, 0.117466f, 0.488571f),

float3(-0.533799f, -0.431928f, 0.226661f),

float3(0.49852f, -0.750908f, 0.412427f),

float3(-0.300882f, 0.366314f, 0.558245f),

float3(-0.176f, 0.511521f, 0.722465f),

float3(-0.0514847f, -0.703543f, 0.180273f),

float3(-0.429914f, 0.0774255f, 0.161534f),

float3(-0.416791f, -0.788385f, 0.328135f),

float3(0.127293f, -0.115146f, 0.958586f),

float3(-0.34959f, -0.278481f, 0.168706f),

float3(-0.645192f, 0.168798f, 0.577105f),

float3(-0.190771f, -0.622669f, 0.257851f),

float3(0.718986f, -0.275369f, 0.602039f),

float3(-0.444258f, -0.872982f, 0.0275582f),

float3(0.793512f, 0.0511185f, 0.33964f),

float3(-0.143651f, 0.155614f, 0.368877f),

float3(-0.777093f, 0.246864f, 0.290628f),

float3(0.202979f, -0.61742f, 0.233802f),

float3(0.198523f, 0.425153f, 0.409162f),

float3(-0.629688f, 0.597461f, 0.120212f),

float3(0.0448316f, -0.689566f, 0.0241707f),

float3(-0.190039f, 0.426496f, 0.254463f),

float3(-0.255776f, 0.722831f, 0.527451f),

float3(-0.821528f, 0.303751f, 0.140172f),

float3(0.696646f, 0.168981f, 0.404492f),

float3(-0.240211f, -0.109653f, 0.463301f),

};



const float2 rndNorm[] =

{

float2(0.505277f, 0.862957f),

float2(-0.554562f, 0.832142f),

float2(0.663051f, 0.748574f),

float2(-0.584629f, -0.811301f),

float2(-0.702343f, 0.711838f),

float2(0.843108f, -0.537744f),

float2(0.85856f, 0.512713f),

float2(0.506966f, -0.861966f),

float2(0.614758f, -0.788716f),

float2(0.993426f, -0.114472f),

float2(-0.676375f, 0.736558f),

float2(-0.891668f, 0.45269f),

float2(0.226367f, 0.974042f),

float2(-0.853615f, -0.520904f),

float2(0.467359f, 0.884067f),

float2(-0.997111f, 0.0759529f),

};



float2 coords = GetCoordinates();

float fCurrDepth = SampleDepth();

float Occlusion = 1.0;

if(fCurrDepth<0.9999)

{

float3 vViewNormal = GetNormalFromDepth(fCurrDepth);

Randomize();

uint2 fragcoord = uint2(GetFragmentCoord()) & 3;

uint rndidx = fragcoord.y * 4 + fragcoord.x;

float3 vRandom = float3(rndNorm[rndidx], 0);

float fAO = 0;

const int NUMSAMPLES = GetOption(B_SSAO_SAMPLES);

for(int s = 0; s < NUMSAMPLES; s++)

{

float3 offset = PoissonDisc[s];

float3 vReflRay = reflect(offset, vRandom);



float fFlip = sign(dot(vViewNormal,vReflRay));

        vReflRay   *= fFlip;



float sD = fCurrDepth - (vReflRay.z * GetOption(C_SAMPLE_RANGE));

float fSampleDepth = SampleDepthLocation(saturate(coords + (GetOption(C_SAMPLE_RANGE) * vReflRay.xy / fCurrDepth)));

float fDepthDelta = saturate(sD - fSampleDepth);



fDepthDelta *= 1-smoothstep(0,GetOption(E_MAX_DEPTH),fDepthDelta);



if ( fDepthDelta > GetOption(F_MIN_DEPTH) && fDepthDelta < GetOption(E_MAX_DEPTH))

fAO += pow(1 - fDepthDelta, 2.5);

}

Occlusion = saturate(1 - (fAO / float(NUMSAMPLES)) + GetOption(C_SAMPLE_RANGE));

}

SetOutput(float4(Occlusion,Occlusion,Occlusion,Occlusion));

}
Reply
05-25-2015, 12:45 AM
#2
Fiora Offline
x86 JIT Princess
**********
Developers (Some Administrators and Super Moderators)
Posts: 237
Threads: 0
Joined: Aug 2014
Does it work without those postprocessing shaders?
Website Find
Reply
05-25-2015, 12:48 AM
#3
Shockwave555
Unregistered
 
Sad 
No, before I installed the shaders I still got the same error. I tried taking them out again but still got the same result.
Reply
05-25-2015, 02:29 AM
#4
Fiora Offline
x86 JIT Princess
**********
Developers (Some Administrators and Super Moderators)
Posts: 237
Threads: 0
Joined: Aug 2014
That's odd, because the error (cannot have gradients inside loops with divergent flow control) applies to loops, and as far as I know, only the postprocessing shaders have loops, not the main graphics pipeline.

I might be reading the shader wrong though; I'm not too familiar with GLSL.
Website Find
Reply
05-25-2015, 08:34 AM
#5
Shockwave555
Unregistered
 
Found out what the problem was.

Turns out I misunderstood what you were saying before about the post-processing effects. I found that SAOO was turned on, so when I turned it off the error subsided. Still wondering why it occurred in the first place though....
Reply
05-25-2015, 09:08 AM (This post was last modified: 05-25-2015, 09:08 AM by Fiora.)
#6
Fiora Offline
x86 JIT Princess
**********
Developers (Some Administrators and Super Moderators)
Posts: 237
Threads: 0
Joined: Aug 2014
It sounds like a bug in the SSAO shader. If the error message is correct, it's doing something kinda wrong.
Website Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode