Skip to content

Instantly share code, notes, and snippets.

@usernameak
Created September 9, 2017 10:25
Show Gist options
  • Select an option

  • Save usernameak/8c7c41e7d9513d1334ec9df3fa0e7166 to your computer and use it in GitHub Desktop.

Select an option

Save usernameak/8c7c41e7d9513d1334ec9df3fa0e7166 to your computer and use it in GitHub Desktop.
#include "/home/usernameak/altona-remake/build/util/shaders.hpp"
/****************************************************************************/
#line 28 "/home/usernameak/altona-remake/util/shaders.asc"
void sSimpleMaterialPara::Set(const sViewport &view)
#line 29 "/home/usernameak/altona-remake/util/shaders.asc"
{
mvp = view.ModelScreen;
mv = view.ModelView;
m = view.Model;
const sMatrix44 &proj = view.PMatrix();
proj0.x = proj.i.x; proj0.y = proj.j.y; proj0.z = proj.k.z; proj0.w = proj.l.x;
proj1.x = proj.l.z; proj1.y = proj.l.y; proj1.z = proj.k.x; proj1.w = proj.k.y;
}
#line 24 "/home/usernameak/altona-remake/build/util/shaders.cpp"
#line 57 "/home/usernameak/altona-remake/util/shaders.asc"
void sSimpleMaterialEnvPara::Set(const sViewport &view,const sMaterialEnv &env)
#line 58 "/home/usernameak/altona-remake/util/shaders.asc"
{
sMatrix34 m;
sVector30 l[4];
mvp = view.ModelScreen;
mv = view.ModelView;
m = view.Model;
const sMatrix44 &proj = view.PMatrix();
proj0.x = proj.i.x; proj0.y = proj.j.y; proj0.z = proj.k.z; proj0.w = proj.l.x;
proj1.x = proj.l.z; proj1.y = proj.l.y; proj1.z = proj.k.x; proj1.w = proj.k.y;
m = view.Model;
m.Trans3();
l[0] = env.LightDir[0]*m;
l[1] = env.LightDir[1]*m;
l[2] = env.LightDir[2]*m;
l[3] = env.LightDir[3]*m;
ld[0].Init(-l[0].x,-l[1].x,-l[2].x,-l[3].x);
ld[1].Init(-l[0].y,-l[1].y,-l[2].y,-l[3].y);
ld[2].Init(-l[0].z,-l[1].z,-l[2].z,-l[3].z);
la .InitColor(env.AmbientColor);
lc[0].InitColor(env.LightColor[0]);
lc[1].InitColor(env.LightColor[1]);
lc[2].InitColor(env.LightColor[2]);
lc[3].InitColor(env.LightColor[3]);
}
#line 57 "/home/usernameak/altona-remake/build/util/shaders.cpp"
/****************************************************************************/
/****************************************************************************/
sShader *sSimpleMaterial::VS(sInt i)
{
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0000[] =
"!!ARBvp1.0\n"
"PARAM c[21] = { program.local[0..19],\n"
"{ 1 } };\n"
"TEMP R0;\n"
"MUL R0, vertex.attrib[0].y, c[1];\n"
"MAD R0, vertex.attrib[0].x, c[0], R0;\n"
"MAD R0, vertex.attrib[0].z, c[2], R0;\n"
"MOV result.color, c[20].x;\n"
"ADD result.position, R0, c[3];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0001[] =
"!!ARBvp1.0\n"
"PARAM c[4] = { program.local[0..3] };\n"
"TEMP R0;\n"
"MUL R0, vertex.attrib[0].y, c[1];\n"
"MAD R0, vertex.attrib[0].x, c[0], R0;\n"
"MAD R0, vertex.attrib[0].z, c[2], R0;\n"
"MOV result.color, vertex.attrib[3];\n"
"ADD result.position, R0, c[3];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0002[] =
"!!ARBvp1.0\n"
"PARAM c[21] = { program.local[0..19],\n"
"{ 1 } };\n"
"TEMP R0;\n"
"MUL R0, vertex.attrib[0].y, c[1];\n"
"MAD R0, vertex.attrib[0].x, c[0], R0;\n"
"MAD R0, vertex.attrib[0].z, c[2], R0;\n"
"MOV result.color, c[20].x;\n"
"ADD result.position, R0, c[3];\n"
"MOV result.texcoord[0].xy, vertex.attrib[8];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0003[] =
"!!ARBvp1.0\n"
"PARAM c[4] = { program.local[0..3] };\n"
"TEMP R0;\n"
"MUL R0, vertex.attrib[0].y, c[1];\n"
"MAD R0, vertex.attrib[0].x, c[0], R0;\n"
"MAD R0, vertex.attrib[0].z, c[2], R0;\n"
"MOV result.color, vertex.attrib[3];\n"
"ADD result.position, R0, c[3];\n"
"MOV result.texcoord[0].xy, vertex.attrib[8];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0006[] =
"!!ARBvp1.0\n"
"PARAM c[21] = { program.local[0..19],\n"
"{ 1 } };\n"
"TEMP R0;\n"
"MUL R0, vertex.attrib[0].y, c[1];\n"
"MAD R0, vertex.attrib[0].x, c[0], R0;\n"
"MAD R0, vertex.attrib[0].z, c[2], R0;\n"
"MOV result.color, c[20].x;\n"
"ADD result.position, R0, c[3];\n"
"MOV result.texcoord[0].xy, vertex.attrib[8];\n"
"MOV result.texcoord[1].xy, vertex.attrib[9];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0007[] =
"!!ARBvp1.0\n"
"PARAM c[4] = { program.local[0..3] };\n"
"TEMP R0;\n"
"MUL R0, vertex.attrib[0].y, c[1];\n"
"MAD R0, vertex.attrib[0].x, c[0], R0;\n"
"MAD R0, vertex.attrib[0].z, c[2], R0;\n"
"MOV result.color, vertex.attrib[3];\n"
"ADD result.position, R0, c[3];\n"
"MOV result.texcoord[0].xy, vertex.attrib[8];\n"
"MOV result.texcoord[1].xy, vertex.attrib[9];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0008[] =
"!!ARBvp1.0\n"
"PARAM c[21] = { program.local[0..19],\n"
"{ 0 } };\n"
"TEMP R0;\n"
"TEMP R1;\n"
"TEMP R2;\n"
"DP3 R0.x, vertex.attrib[2], vertex.attrib[2];\n"
"RSQ R0.x, R0.x;\n"
"MUL R0.xyz, R0.x, vertex.attrib[2];\n"
"MUL R1, R0.y, c[13];\n"
"MAD R1, R0.x, c[12], R1;\n"
"MAD R0, R0.z, c[14], R1;\n"
"MAX R2, R0, c[20].x;\n"
"MUL R0, R2.x, c[16];\n"
"ADD R0, R0, c[15];\n"
"MUL R1, vertex.attrib[0].y, c[1];\n"
"MAD R0, R2.y, c[17], R0;\n"
"MAD R1, vertex.attrib[0].x, c[0], R1;\n"
"MAD R0, R2.z, c[18], R0;\n"
"MAD R1, vertex.attrib[0].z, c[2], R1;\n"
"MAD result.color, R2.w, c[19], R0;\n"
"ADD result.position, R1, c[3];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0009[] =
"!!ARBvp1.0\n"
"PARAM c[21] = { program.local[0..19],\n"
"{ 0 } };\n"
"TEMP R0;\n"
"TEMP R1;\n"
"TEMP R2;\n"
"DP3 R0.x, vertex.attrib[2], vertex.attrib[2];\n"
"RSQ R0.x, R0.x;\n"
"MUL R0.xyz, R0.x, vertex.attrib[2];\n"
"MUL R1, R0.y, c[13];\n"
"MAD R1, R0.x, c[12], R1;\n"
"MAD R0, R0.z, c[14], R1;\n"
"MAX R2, R0, c[20].x;\n"
"MUL R0, R2.x, c[16];\n"
"ADD R0, R0, c[15];\n"
"MAD R0, R2.y, c[17], R0;\n"
"MUL R1, vertex.attrib[0].y, c[1];\n"
"MAD R0, R2.z, c[18], R0;\n"
"MAD R1, vertex.attrib[0].x, c[0], R1;\n"
"MAD R0, R2.w, c[19], R0;\n"
"MAD R1, vertex.attrib[0].z, c[2], R1;\n"
"MUL result.color, R0, vertex.attrib[3];\n"
"ADD result.position, R1, c[3];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_000a[] =
"!!ARBvp1.0\n"
"PARAM c[21] = { program.local[0..19],\n"
"{ 0 } };\n"
"TEMP R0;\n"
"TEMP R1;\n"
"TEMP R2;\n"
"DP3 R0.x, vertex.attrib[2], vertex.attrib[2];\n"
"RSQ R0.x, R0.x;\n"
"MUL R0.xyz, R0.x, vertex.attrib[2];\n"
"MUL R1, R0.y, c[13];\n"
"MAD R1, R0.x, c[12], R1;\n"
"MAD R0, R0.z, c[14], R1;\n"
"MAX R2, R0, c[20].x;\n"
"MUL R0, R2.x, c[16];\n"
"ADD R0, R0, c[15];\n"
"MUL R1, vertex.attrib[0].y, c[1];\n"
"MAD R0, R2.y, c[17], R0;\n"
"MAD R1, vertex.attrib[0].x, c[0], R1;\n"
"MAD R0, R2.z, c[18], R0;\n"
"MAD R1, vertex.attrib[0].z, c[2], R1;\n"
"MAD result.color, R2.w, c[19], R0;\n"
"ADD result.position, R1, c[3];\n"
"MOV result.texcoord[0].xy, vertex.attrib[8];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_000b[] =
"!!ARBvp1.0\n"
"PARAM c[21] = { program.local[0..19],\n"
"{ 0 } };\n"
"TEMP R0;\n"
"TEMP R1;\n"
"TEMP R2;\n"
"DP3 R0.x, vertex.attrib[2], vertex.attrib[2];\n"
"RSQ R0.x, R0.x;\n"
"MUL R0.xyz, R0.x, vertex.attrib[2];\n"
"MUL R1, R0.y, c[13];\n"
"MAD R1, R0.x, c[12], R1;\n"
"MAD R0, R0.z, c[14], R1;\n"
"MAX R2, R0, c[20].x;\n"
"MUL R0, R2.x, c[16];\n"
"ADD R0, R0, c[15];\n"
"MAD R0, R2.y, c[17], R0;\n"
"MUL R1, vertex.attrib[0].y, c[1];\n"
"MAD R0, R2.z, c[18], R0;\n"
"MAD R1, vertex.attrib[0].x, c[0], R1;\n"
"MAD R0, R2.w, c[19], R0;\n"
"MAD R1, vertex.attrib[0].z, c[2], R1;\n"
"MUL result.color, R0, vertex.attrib[3];\n"
"ADD result.position, R1, c[3];\n"
"MOV result.texcoord[0].xy, vertex.attrib[8];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_000e[] =
"!!ARBvp1.0\n"
"PARAM c[21] = { program.local[0..19],\n"
"{ 0 } };\n"
"TEMP R0;\n"
"TEMP R1;\n"
"TEMP R2;\n"
"DP3 R0.x, vertex.attrib[2], vertex.attrib[2];\n"
"RSQ R0.x, R0.x;\n"
"MUL R0.xyz, R0.x, vertex.attrib[2];\n"
"MUL R1, R0.y, c[13];\n"
"MAD R1, R0.x, c[12], R1;\n"
"MAD R0, R0.z, c[14], R1;\n"
"MAX R2, R0, c[20].x;\n"
"MUL R0, R2.x, c[16];\n"
"ADD R0, R0, c[15];\n"
"MUL R1, vertex.attrib[0].y, c[1];\n"
"MAD R0, R2.y, c[17], R0;\n"
"MAD R1, vertex.attrib[0].x, c[0], R1;\n"
"MAD R0, R2.z, c[18], R0;\n"
"MAD R1, vertex.attrib[0].z, c[2], R1;\n"
"MAD result.color, R2.w, c[19], R0;\n"
"ADD result.position, R1, c[3];\n"
"MOV result.texcoord[0].xy, vertex.attrib[8];\n"
"MOV result.texcoord[1].xy, vertex.attrib[9];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_000f[] =
"!!ARBvp1.0\n"
"PARAM c[21] = { program.local[0..19],\n"
"{ 0 } };\n"
"TEMP R0;\n"
"TEMP R1;\n"
"TEMP R2;\n"
"DP3 R0.x, vertex.attrib[2], vertex.attrib[2];\n"
"RSQ R0.x, R0.x;\n"
"MUL R0.xyz, R0.x, vertex.attrib[2];\n"
"MUL R1, R0.y, c[13];\n"
"MAD R1, R0.x, c[12], R1;\n"
"MAD R0, R0.z, c[14], R1;\n"
"MAX R2, R0, c[20].x;\n"
"MUL R0, R2.x, c[16];\n"
"ADD R0, R0, c[15];\n"
"MAD R0, R2.y, c[17], R0;\n"
"MUL R1, vertex.attrib[0].y, c[1];\n"
"MAD R0, R2.z, c[18], R0;\n"
"MAD R1, vertex.attrib[0].x, c[0], R1;\n"
"MAD R0, R2.w, c[19], R0;\n"
"MAD R1, vertex.attrib[0].z, c[2], R1;\n"
"MUL result.color, R0, vertex.attrib[3];\n"
"ADD result.position, R1, c[3];\n"
"MOV result.texcoord[0].xy, vertex.attrib[8];\n"
"MOV result.texcoord[1].xy, vertex.attrib[9];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 *codes[] =
{
(const sU8 *)data_0000,
(const sU8 *)data_0001,
(const sU8 *)data_0002,
(const sU8 *)data_0003,
0,
0,
(const sU8 *)data_0006,
(const sU8 *)data_0007,
(const sU8 *)data_0008,
(const sU8 *)data_0009,
(const sU8 *)data_000a,
(const sU8 *)data_000b,
0,
0,
(const sU8 *)data_000e,
(const sU8 *)data_000f,
};
static sDInt sizes[] =
{
sizeof(data_0000),
sizeof(data_0001),
sizeof(data_0002),
sizeof(data_0003),
0,
0,
sizeof(data_0006),
sizeof(data_0007),
sizeof(data_0008),
sizeof(data_0009),
sizeof(data_000a),
sizeof(data_000b),
0,
0,
sizeof(data_000e),
sizeof(data_000f),
};
sVERIFY(codes[i])
#endif
#if sRENDERER==sRENDER_DX11
return sCreateShaderRaw(sSTF_VERTEX|sSTF_HLSL45,(const sU8 *)codes[i],sizes[i]);
#elif sRENDERER==sRENDER_DX9
return sCreateShaderRaw(sSTF_VERTEX|sSTF_HLSL23,(const sU8 *)codes[i],sizes[i]);
#elif sRENDERER==sRENDER_OGL2
return sCreateShaderRaw(sSTF_VERTEX|sSTF_NVIDIA,(const sU8 *)codes[i],sizes[i]);
#else
return sCreateShaderRaw(sSTF_VERTEX,0,0);
#endif
}
sShader *sSimpleMaterial::PS(sInt i)
{
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0000[] =
"!!ARBfp1.0\n"
"MOV result.color, fragment.color.primary;\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0001[] =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"TEX R0, fragment.texcoord[0], texture[0], 2D;\n"
"MUL result.color, fragment.color.primary, R0;\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0003[] =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"TEMP R1;\n"
"TEX R0, fragment.texcoord[0], texture[0], 2D;\n"
"TEX R1, fragment.texcoord[1], texture[1], 2D;\n"
"MUL R0, fragment.color.primary, R0;\n"
"MUL result.color, R0, R1;\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0005[] =
"!!ARBfp1.0\n"
"TEMP R0;\n"
"TEMP R1;\n"
"TEX R1, fragment.texcoord[1], texture[1], 2D;\n"
"TEX R0, fragment.texcoord[0], texture[0], 2D;\n"
"MAD result.color, fragment.color.primary, R0, R1;\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 *codes[] =
{
(const sU8 *)data_0000,
(const sU8 *)data_0001,
0,
(const sU8 *)data_0003,
0,
(const sU8 *)data_0005,
0,
0,
};
static sDInt sizes[] =
{
sizeof(data_0000),
sizeof(data_0001),
0,
sizeof(data_0003),
0,
sizeof(data_0005),
0,
0,
};
sVERIFY(codes[i])
#endif
#if sRENDERER==sRENDER_DX11
return sCreateShaderRaw(sSTF_PIXEL|sSTF_HLSL45,(const sU8 *)codes[i],sizes[i]);
#elif sRENDERER==sRENDER_DX9
return sCreateShaderRaw(sSTF_PIXEL|sSTF_HLSL23,(const sU8 *)codes[i],sizes[i]);
#elif sRENDERER==sRENDER_OGL2
return sCreateShaderRaw(sSTF_PIXEL|sSTF_NVIDIA,(const sU8 *)codes[i],sizes[i]);
#else
return sCreateShaderRaw(sSTF_PIXEL,0,0);
#endif
}
sSimpleMaterial::sSimpleMaterial()
{
#line 116 "/home/usernameak/altona-remake/util/shaders.asc"
AddTex1 = 0;
#line 445 "/home/usernameak/altona-remake/build/util/shaders.cpp"
}
void sSimpleMaterial::SelectShaders(sVertexFormatHandle *format)
{
#line 121 "/home/usernameak/altona-remake/util/shaders.asc"
sInt n;
// pick vertex shader
n = 0;
if(format->GetAvailMask() & (1<<sVF_COLOR0))
n |= sSimpleMaterialVSPermMask_Color;
if(format->GetAvailMask() & (1<<sVF_UV0))
n |= sSimpleMaterialVSPermMask_UV0;
if(format->GetAvailMask() & (1<<sVF_UV1))
n |= sSimpleMaterialVSPermMask_UV1;
if((format->GetAvailMask() & (1<<sVF_NORMAL)) && (Flags & sMTRL_LIGHTING) )
n |= sSimpleMaterialVSPermMask_Light;
VertexShader = VS(n);
// pick pixel shader (number of textures)
n = 0;
if(Texture[0] || (TFlags[0]&sMTF_EXTERN))
n |= sSimpleMaterialPSPerm_T0Mul;
if(Texture[1] || (TFlags[1]&sMTF_EXTERN))
{
if(AddTex1)
n |= sSimpleMaterialPSPerm_T1Add;
else
n |= sSimpleMaterialPSPerm_T1Mul;
}
PixelShader = PS(n);
#line 480 "/home/usernameak/altona-remake/build/util/shaders.cpp"
}
sShader *sCubeMaterial::VS()
{
#if sRENDERER==sRENDER_OGL2
static const sU8 data[] =
"!!ARBvp1.0\n"
"PARAM c[4] = { program.local[0..3] };\n"
"TEMP R0;\n"
"MUL R0, vertex.attrib[0].y, c[1];\n"
"MAD R0, vertex.attrib[0].x, c[0], R0;\n"
"MAD R0, vertex.attrib[0].z, c[2], R0;\n"
"MAD result.position, vertex.attrib[0].w, c[3], R0;\n"
"MOV result.texcoord[0].xyz, vertex.attrib[2];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_DX11
return sCreateShaderRaw(sSTF_VERTEX|sSTF_HLSL45,(const sU8 *)data,sizeof(data));
#elif sRENDERER==sRENDER_DX9
return sCreateShaderRaw(sSTF_VERTEX|sSTF_HLSL23,(const sU8 *)data,sizeof(data));
#elif sRENDERER==sRENDER_OGL2
return sCreateShaderRaw(sSTF_VERTEX|sSTF_NVIDIA,(const sU8 *)data,sizeof(data));
#else
return sCreateShaderRaw(sSTF_VERTEX,0,0);
#endif
}
sShader *sCubeMaterial::PS()
{
#if sRENDERER==sRENDER_OGL2
static const sU8 data[] =
"!!ARBfp1.0\n"
"TEX result.color, fragment.texcoord[0], texture[0], CUBE;\n"
"END\n";
#endif
#if sRENDERER==sRENDER_DX11
return sCreateShaderRaw(sSTF_PIXEL|sSTF_HLSL45,(const sU8 *)data,sizeof(data));
#elif sRENDERER==sRENDER_DX9
return sCreateShaderRaw(sSTF_PIXEL|sSTF_HLSL23,(const sU8 *)data,sizeof(data));
#elif sRENDERER==sRENDER_OGL2
return sCreateShaderRaw(sSTF_PIXEL|sSTF_NVIDIA,(const sU8 *)data,sizeof(data));
#else
return sCreateShaderRaw(sSTF_PIXEL,0,0);
#endif
}
void sCubeMaterial::SelectShaders(sVertexFormatHandle *format)
{
VertexShader = sCubeMaterial::VS();
PixelShader = sCubeMaterial::PS();
}
sShader *sYUVMaterial::VS(sInt i)
{
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0000[] =
"!!ARBvp1.0\n"
"PARAM c[13] = { program.local[0..11],\n"
"{ 1 } };\n"
"TEMP R0;\n"
"MUL R0, vertex.attrib[0].y, c[1];\n"
"MAD R0, vertex.attrib[0].x, c[0], R0;\n"
"MAD R0, vertex.attrib[0].z, c[2], R0;\n"
"ADD result.position, R0, c[3];\n"
"MOV result.color, c[12].x;\n"
"MOV result.texcoord[0].xy, vertex.attrib[8];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0001[] =
"!!ARBvp1.0\n"
"PARAM c[4] = { program.local[0..3] };\n"
"TEMP R0;\n"
"MUL R0, vertex.attrib[0].y, c[1];\n"
"MAD R0, vertex.attrib[0].x, c[0], R0;\n"
"MAD R0, vertex.attrib[0].z, c[2], R0;\n"
"ADD result.position, R0, c[3];\n"
"MOV result.color, vertex.attrib[3];\n"
"MOV result.texcoord[0].xy, vertex.attrib[8];\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 *codes[] =
{
(const sU8 *)data_0000,
(const sU8 *)data_0001,
};
static sDInt sizes[] =
{
sizeof(data_0000),
sizeof(data_0001),
};
sVERIFY(codes[i])
#endif
#if sRENDERER==sRENDER_DX11
return sCreateShaderRaw(sSTF_VERTEX|sSTF_HLSL45,(const sU8 *)codes[i],sizes[i]);
#elif sRENDERER==sRENDER_DX9
return sCreateShaderRaw(sSTF_VERTEX|sSTF_HLSL23,(const sU8 *)codes[i],sizes[i]);
#elif sRENDERER==sRENDER_OGL2
return sCreateShaderRaw(sSTF_VERTEX|sSTF_NVIDIA,(const sU8 *)codes[i],sizes[i]);
#else
return sCreateShaderRaw(sSTF_VERTEX,0,0);
#endif
}
sShader *sYUVMaterial::PS(sInt i)
{
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0000[] =
"!!ARBfp1.0\n"
"PARAM c[2] = { { 1, 0.0625, 1.1686275, 2.0235295 },\n"
"{ 0.5, 0.39215687, 0.81568629, 1.6039215 } };\n"
"TEMP R0;\n"
"TEX R0.x, fragment.texcoord[0], texture[0], 2D;\n"
"ADD R0.y, R0.x, -c[0];\n"
"TEX R0.x, fragment.texcoord[0], texture[1], 2D;\n"
"ADD R0.z, R0.x, -c[1].x;\n"
"MUL R0.y, R0, c[0].z;\n"
"MAD_SAT R0.w, R0.z, c[0], R0.y;\n"
"TEX R0.x, fragment.texcoord[0], texture[2], 2D;\n"
"MAD R0.z, -R0, c[1].y, R0.y;\n"
"ADD R0.x, R0, -c[1];\n"
"MAD_SAT R0.z, -R0.x, c[1], R0;\n"
"MAD_SAT R0.x, R0, c[1].w, R0.y;\n"
"MOV R0.y, c[0].x;\n"
"MUL result.color, R0.xzwy, fragment.color.primary;\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 data_0001[] =
"!!ARBfp1.0\n"
"PARAM c[2] = { { 1, 0.0625, 1.1686275, 2.0235295 },\n"
"{ 0.5, 0.39215687, 0.81568629, 1.6039215 } };\n"
"TEMP R0;\n"
"TEMP R1;\n"
"TEX R0.x, fragment.texcoord[0], texture[0], 2D;\n"
"ADD R0.y, R0.x, -c[0];\n"
"TEX R0.x, fragment.texcoord[0], texture[1], 2D;\n"
"ADD R0.z, R0.x, -c[1].x;\n"
"MUL R0.y, R0, c[0].z;\n"
"MAD_SAT R1.z, R0, c[0].w, R0.y;\n"
"TEX R0.x, fragment.texcoord[0], texture[2], 2D;\n"
"ADD R0.x, R0, -c[1];\n"
"MAD R0.z, -R0, c[1].y, R0.y;\n"
"MAD_SAT R1.y, -R0.x, c[1].z, R0.z;\n"
"MAD_SAT R1.x, R0, c[1].w, R0.y;\n"
"MOV R1.w, c[0].x;\n"
"MUL R1, R1, fragment.color.primary;\n"
"TEX R0.w, fragment.texcoord[0], texture[3], 2D;\n"
"MUL result.color.w, R1, R0;\n"
"MOV result.color.xyz, R1;\n"
"END\n";
#endif
#if sRENDERER==sRENDER_OGL2
static const sU8 *codes[] =
{
(const sU8 *)data_0000,
(const sU8 *)data_0001,
};
static sDInt sizes[] =
{
sizeof(data_0000),
sizeof(data_0001),
};
sVERIFY(codes[i])
#endif
#if sRENDERER==sRENDER_DX11
return sCreateShaderRaw(sSTF_PIXEL|sSTF_HLSL45,(const sU8 *)codes[i],sizes[i]);
#elif sRENDERER==sRENDER_DX9
return sCreateShaderRaw(sSTF_PIXEL|sSTF_HLSL23,(const sU8 *)codes[i],sizes[i]);
#elif sRENDERER==sRENDER_OGL2
return sCreateShaderRaw(sSTF_PIXEL|sSTF_NVIDIA,(const sU8 *)codes[i],sizes[i]);
#else
return sCreateShaderRaw(sSTF_PIXEL,0,0);
#endif
}
void sYUVMaterial::SelectShaders(sVertexFormatHandle *format)
{
#line 278 "/home/usernameak/altona-remake/util/shaders.asc"
sInt n=0;
if(format->GetAvailMask() & (1<<sVF_COLOR0))
n |= sYUVMaterialVSPermMask_Color;
VertexShader = VS(n);
n=0;
if (Texture[3])
n |= sYUVMaterialPSPermMask_AlphaTex;
PixelShader = PS(n);
#line 674 "/home/usernameak/altona-remake/build/util/shaders.cpp"
}
/****************************************************************************/
/****************************************************************************/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment