ShaderGen: Store light color uniforms as integers.

This commit is contained in:
Tony Wasserka
2013-10-27 13:57:40 +01:00
parent 68e91f0d55
commit 4bf57565e8
8 changed files with 65 additions and 54 deletions

View File

@ -294,7 +294,8 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
DeclareUniform(out, ApiType, C_FOG, "float4", I_FOG"[2]");
// For pixel lighting - TODO: Should only be defined when per pixel lighting is enabled!
DeclareUniform(out, ApiType, C_PLIGHTS, "float4", I_PLIGHTS"[40]");
DeclareUniform(out, ApiType, C_PLIGHT_COLORS, "int4", I_PLIGHT_COLORS"[8]");
DeclareUniform(out, ApiType, C_PLIGHTS, "float4", I_PLIGHTS"[32]");
DeclareUniform(out, ApiType, C_PMATERIALS, "float4", I_PMATERIALS"[4]");
if (ApiType == API_OPENGL)
@ -416,10 +417,11 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
"\tfloat3 ldir, h;\n"
"\tfloat dist, dist2, attn;\n");
out.SetConstantsUsed(C_PLIGHTS, C_PLIGHTS+39); // TODO: Can be optimized further
out.SetConstantsUsed(C_PLIGHT_COLORS, C_PLIGHT_COLORS+7); // TODO: Can be optimized further
out.SetConstantsUsed(C_PLIGHTS, C_PLIGHTS+31); // TODO: Can be optimized further
out.SetConstantsUsed(C_PMATERIALS, C_PMATERIALS+3);
uid_data.components = components;
GenerateLightingShader<T>(out, uid_data.lighting, components, I_PMATERIALS, I_PLIGHTS, "colors_", "colors_");
GenerateLightingShader<T>(out, uid_data.lighting, components, I_PMATERIALS, I_PLIGHT_COLORS, I_PLIGHTS, "colors_", "colors_");
}
out.Write("\tclipPos = float4(rawpos.x, rawpos.y, clipPos.z, clipPos.w);\n");