Skip to content

Instantly share code, notes, and snippets.

@gamax92
Created July 3, 2016 21:24
Show Gist options
  • Save gamax92/18f56a318f7ae8305ad168eaddbf7f96 to your computer and use it in GitHub Desktop.
Save gamax92/18f56a318f7ae8305ad168eaddbf7f96 to your computer and use it in GitHub Desktop.
#version 330
#define FORCE_EARLY_Z layout(depth_unchanged) out float gl_FragDepth
#extension GL_ARB_conservative_depth : enable
#extension GL_ARB_shading_language_420pack : enable
#define SAMPLER_BINDING(x) layout(binding = x)
#define float2 vec2
#define float3 vec3
#define float4 vec4
#define uint2 uvec2
#define uint3 uvec3
#define uint4 uvec4
#define int2 ivec2
#define int3 ivec3
#define int4 ivec4
#define float1x1 mat1
#define float2x2 mat2
#define float3x3 mat3
#define float4x4 mat4
#define float4x3 mat4x3
#define float3x4 mat3x4
#define frac fract
#define lerp mix
#define saturate(x) clamp(x, 0.0, 1.0)
#define mul(x, y) (y * x)
#define ddx dFdx
#define ddy dFdy
#define rsqrt inversesqrt
layout(std140, binding = 2) uniform VSBlock {
float4 cproj[4] ;
float4 cDepth ;
float4 cmtrl[4] ;
float4 clights[40] ;
float4 cphong[2] ;
float4 ctexmtx[24] ;
float4 ctrmtx[64] ;
float4 cnmtx[32] ;
float4 cpostmtx[64] ;
float4 cPLOffset[13] ;
};
struct VS_OUTPUT {
float4 pos;
float4 colors_0;
float4 colors_1;
float3 tex0;
float4 clipPos_2;
};
in float4 rawpos; // ATTR0,
in float fposmtx; // ATTR1,
in float4 color0; // ATTR5,
in float2 tex0; // ATTR8,
out float3 uv0_2;
out float3 uv1_2;
out float3 uv2_2;
out float3 uv3_2;
out float3 uv4_2;
out float3 uv5_2;
out float3 uv6_2;
out float3 uv7_2;
out float4 clipPos_2;
out float4 colors_0;
out float4 colors_1;
void main()
{
VS_OUTPUT o;
int posmtx = int(fposmtx);
float4 pos = float4(dot(ctrmtx[posmtx], rawpos), dot(ctrmtx[posmtx+1], rawpos), dot(ctrmtx[posmtx+2], rawpos), 1);
float3 _norm0 = float3(0.0, 0.0, 0.0);
o.pos = float4(dot(cproj[0], pos), dot(cproj[1], pos), dot(cproj[2], pos), dot(cproj[3], pos));
float4 mat, lacc;
float3 ldir, h;
float dist, dist2, attn;
int4 ilacc;
{
mat = round(color0 * 255.0);
lacc = float4(255.0,255.0,255.0,255.0);
lacc.w = 255.0;
ilacc = int4(round(lacc));
ilacc = clamp(ilacc, 0, 255);
ilacc += ilacc >> 7;
o.colors_0 = float4((int4(mat) * ilacc) >> 8) / 255.0;
}
o.colors_1 = o.colors_0;
float4 coord = float4(0.0, 0.0, 1.0, 1.0);
{
coord = float4(0.0, 0.0, 1.0, 1.0);
coord.xy = tex0.xy;
coord.z = 1.0;
o.tex0.xyz = float3(dot(coord, ctexmtx[0]), dot(coord, ctexmtx[1]), 1);
float4 P0 = cpostmtx[61];
float4 P1 = cpostmtx[62];
float4 P2 = cpostmtx[63];
o.tex0.xyz = float3(dot(P0.xyz, o.tex0.xyz) + P0.w, dot(P1.xyz, o.tex0.xyz) + P1.w, dot(P2.xyz, o.tex0.xyz) + P2.w);
if(o.tex0.z == 0.0f)
o.tex0.xy = clamp(o.tex0.xy / 2.0f, float2(-1.0f, -1.0f), float2(1.0f, 1.0f));
}
o.clipPos_2 = float4(pos.x,pos.y,o.pos.z,o.pos.w);
o.pos.z = -o.pos.z;
o.pos.xy = o.pos.xy + o.pos.w * cDepth.zw;
uv0_2.xyz = o.tex0;
uv1_2.xyz = float3(0.0, 0.0, 0.0);
uv2_2.xyz = float3(0.0, 0.0, 0.0);
uv3_2.xyz = float3(0.0, 0.0, 0.0);
uv4_2.xyz = float3(0.0, 0.0, 0.0);
uv5_2.xyz = float3(0.0, 0.0, 0.0);
uv6_2.xyz = float3(0.0, 0.0, 0.0);
uv7_2.xyz = float3(0.0, 0.0, 0.0);
clipPos_2 = o.clipPos;
colors_0 = o.colors_0;
colors_1 = o.colors_1;
gl_Position = o.pos;
}
0:124(14): error: cannot access field `clipPos' of structure
0:124(14): error: type mismatch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment