mirror of
https://github.com/cemu-project/cemu_graphic_packs.git
synced 2024-11-29 21:04:14 +01:00
110 lines
2.3 KiB
Plaintext
110 lines
2.3 KiB
Plaintext
|
#version 420
|
||
|
#extension GL_ARB_texture_gather : enable
|
||
|
#extension GL_ARB_separate_shader_objects : enable
|
||
|
// shader d61363e0854c74ad
|
||
|
uniform ivec4 uf_remappedPS[1];
|
||
|
layout(binding = 0) uniform samplerCubeArray textureUnitPS0;// Tex0 addr 0x1c778800 res 32x32x1 dim 3 tm: 4 format 0816 compSel: 0 1 2 5 mipView: 0x0 (num 0x2) sliceView: 0x0 (num 0x6) Sampler0 ClampX/Y/Z: 2 2 2 border: 1
|
||
|
layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x221ea000 res 2048x256x1 dim 1 tm: 4 format 0433 compSel: 0 1 2 3 mipView: 0x0 (num 0xc) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 0 0 2 border: 0
|
||
|
layout(location = 0) in vec4 passParameterSem0;
|
||
|
layout(location = 1) in vec4 passParameterSem1;
|
||
|
layout(location = 2) in vec4 passParameterSem2;
|
||
|
layout(location = 0) out vec4 passPixelColor0;
|
||
|
uniform vec2 uf_fragCoordScale;
|
||
|
void redcCUBE(vec4 src0, vec4 src1, out vec3 stm, out int faceId)
|
||
|
{
|
||
|
// stm -> x .. s, y .. t, z .. MajorAxis*2.0
|
||
|
vec3 inputCoord = normalize(vec3(src1.y, src1.x, src0.x));
|
||
|
float rx = inputCoord.x;
|
||
|
float ry = inputCoord.y;
|
||
|
float rz = inputCoord.z;
|
||
|
if( abs(rx) > abs(ry) && abs(rx) > abs(rz) )
|
||
|
{
|
||
|
stm.z = rx*2.0;
|
||
|
stm.xy = vec2(ry,rz);
|
||
|
if( rx >= 0.0 )
|
||
|
{
|
||
|
faceId = 0;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
faceId = 1;
|
||
|
}
|
||
|
}
|
||
|
else if( abs(ry) > abs(rx) && abs(ry) > abs(rz) )
|
||
|
{
|
||
|
stm.z = ry*2.0;
|
||
|
stm.xy = vec2(rx,rz);
|
||
|
if( ry >= 0.0 )
|
||
|
{
|
||
|
faceId = 2;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
faceId = 3;
|
||
|
}
|
||
|
}
|
||
|
else //if( abs(rz) > abs(ry) && abs(rz) > abs(rx) )
|
||
|
{
|
||
|
stm.z = rz*2.0;
|
||
|
stm.xy = vec2(rx,ry);
|
||
|
if( rz >= 0.0 )
|
||
|
{
|
||
|
faceId = 4;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
faceId = 5;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
vec3 redcCUBEReverse(vec2 st, int faceId)
|
||
|
{
|
||
|
st.yx = st.xy;
|
||
|
vec3 v;
|
||
|
float majorAxis = 1.0;
|
||
|
if( faceId == 0 )
|
||
|
{
|
||
|
v.yz = (st-vec2(1.5))*(majorAxis*2.0);
|
||
|
v.x = 1.0;
|
||
|
}
|
||
|
else if( faceId == 1 )
|
||
|
{
|
||
|
v.yz = (st-vec2(1.5))*(majorAxis*2.0);
|
||
|
v.x = -1.0;
|
||
|
}
|
||
|
else if( faceId == 2 )
|
||
|
{
|
||
|
v.xz = (st-vec2(1.5))*(majorAxis*2.0);
|
||
|
v.y = 1.0;
|
||
|
}
|
||
|
else if( faceId == 3 )
|
||
|
{
|
||
|
v.xz = (st-vec2(1.5))*(majorAxis*2.0);
|
||
|
v.y = -1.0;
|
||
|
}
|
||
|
else if( faceId == 4 )
|
||
|
{
|
||
|
v.xy = (st-vec2(1.5))*(majorAxis*2.0);
|
||
|
v.z = 1.0;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
v.xy = (st-vec2(1.5))*(majorAxis*2.0);
|
||
|
v.z = -1.0;
|
||
|
}
|
||
|
return v;
|
||
|
}
|
||
|
int clampFI32(int v)
|
||
|
{
|
||
|
if( v == 0x7FFFFFFF )
|
||
|
return floatBitsToInt(1.0);
|
||
|
else if( v == 0xFFFFFFFF )
|
||
|
return floatBitsToInt(0.0);
|
||
|
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
|
||
|
}
|
||
|
float mul_nonIEEE(float a, float b){ if( a == 0.0 || b == 0.0 ) return 0.0; return a*b; }
|
||
|
void main()
|
||
|
{
|
||
|
|
||
|
}
|