PixelShaderGen: Store tex scale as an integer.
This commit is contained in:
parent
16109fb453
commit
fa7173d099
|
@ -411,9 +411,6 @@ union TEXSCALE
|
|||
u32 rid : 8;
|
||||
};
|
||||
u32 hex;
|
||||
|
||||
float getScaleS(int i){return 1.0f/(float)(1<<(i?ss1:ss0));}
|
||||
float getScaleT(int i){return 1.0f/(float)(1<<(i?ts1:ts0));}
|
||||
};
|
||||
|
||||
union RAS1_IREF
|
||||
|
|
|
@ -16,7 +16,7 @@ struct PixelShaderConstants
|
|||
int4 alpha;
|
||||
float4 texdims[8];
|
||||
int4 zbias[2];
|
||||
float4 indtexscale[2];
|
||||
int4 indtexscale[2];
|
||||
int4 indtexmtx[6];
|
||||
int4 fogcolor;
|
||||
int4 fogi[1];
|
||||
|
|
|
@ -259,7 +259,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
|||
DeclareUniform(out, ApiType, C_ALPHA, "int4", I_ALPHA);
|
||||
DeclareUniform(out, ApiType, C_TEXDIMS, "float4", I_TEXDIMS"[8]");
|
||||
DeclareUniform(out, ApiType, C_ZBIAS, "int4", I_ZBIAS"[2]");
|
||||
DeclareUniform(out, ApiType, C_INDTEXSCALE, "float4", I_INDTEXSCALE"[2]");
|
||||
DeclareUniform(out, ApiType, C_INDTEXSCALE, "int4", I_INDTEXSCALE"[2]");
|
||||
DeclareUniform(out, ApiType, C_INDTEXMTX, "int4", I_INDTEXMTX"[6]");
|
||||
DeclareUniform(out, ApiType, C_FOGCOLOR, "int4", I_FOGCOLOR);
|
||||
DeclareUniform(out, ApiType, C_FOGI, "int4", I_FOGI"[1]");
|
||||
|
@ -352,7 +352,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
|||
" int3 comp16 = int3(1, 256, 0), comp24 = int3(1, 256, 256*256);\n"
|
||||
" int alphabump=0;\n"
|
||||
" int3 tevcoord=int3(0, 0, 0);\n"
|
||||
" int2 wrappedcoord=int2(0,0); float2 tempcoord=float2(0.0,0.0);\n\n");
|
||||
" int2 wrappedcoord=int2(0,0), tempcoord=int2(0,0);\n\n");
|
||||
|
||||
if (ApiType == API_OPENGL)
|
||||
{
|
||||
|
@ -441,13 +441,13 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
|||
if (texcoord < numTexgen)
|
||||
{
|
||||
out.SetConstantsUsed(C_INDTEXSCALE+i/2,C_INDTEXSCALE+i/2);
|
||||
out.Write("\ttempcoord = round(float2(fixpoint_uv%d.xy) * " I_INDTEXSCALE"[%d].%s) / 128.0;\n", texcoord, i / 2, (i & 1) ? "zw" : "xy"); // TODO: Make indtexscale an integer
|
||||
out.Write("\ttempcoord = fixpoint_uv%d >> " I_INDTEXSCALE"[%d].%s;\n", texcoord, i / 2, (i & 1) ? "zw" : "xy");
|
||||
}
|
||||
else
|
||||
out.Write("\ttempcoord = float2(0.0, 0.0);\n");
|
||||
out.Write("\ttempcoord = int2(0, 0);\n");
|
||||
|
||||
out.Write("\tint3 iindtex%d = ", i);
|
||||
SampleTexture<T>(out, "tempcoord", "abg", texmap, ApiType);
|
||||
SampleTexture<T>(out, "(float2(tempcoord)/128.0)", "abg", texmap, ApiType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -202,10 +202,10 @@ void PixelShaderManager::SetViewportChanged()
|
|||
|
||||
void PixelShaderManager::SetIndTexScaleChanged(bool high)
|
||||
{
|
||||
constants.indtexscale[high][0] = bpmem.texscale[high].getScaleS(0);
|
||||
constants.indtexscale[high][1] = bpmem.texscale[high].getScaleT(0);
|
||||
constants.indtexscale[high][2] = bpmem.texscale[high].getScaleS(1);
|
||||
constants.indtexscale[high][3] = bpmem.texscale[high].getScaleT(1);
|
||||
constants.indtexscale[high][0] = bpmem.texscale[high].ss0;
|
||||
constants.indtexscale[high][1] = bpmem.texscale[high].ts0;
|
||||
constants.indtexscale[high][2] = bpmem.texscale[high].ss1;
|
||||
constants.indtexscale[high][3] = bpmem.texscale[high].ts1;
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue