2021-01-25 22:38:33 -08:00
|
|
|
ivec2 Helper_TexelFetchScale(ivec2 inputVec, int samplerIndex)
|
|
|
|
{
|
2021-08-11 12:33:43 -07:00
|
|
|
float scale = s_render_scale[1 + samplerIndex];
|
2021-01-25 22:38:33 -08:00
|
|
|
if (scale == 1.0)
|
|
|
|
{
|
2020-07-06 19:41:07 -07:00
|
|
|
return inputVec;
|
|
|
|
}
|
2021-01-25 22:38:33 -08:00
|
|
|
if (scale < 0.0) // If less than 0, try interpolate between texels by using the screen position.
|
|
|
|
{
|
2020-07-06 19:41:07 -07:00
|
|
|
return ivec2(vec2(inputVec) * (-scale) + mod(gl_FragCoord.xy, -scale));
|
2021-01-25 22:38:33 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-07-06 19:41:07 -07:00
|
|
|
return ivec2(vec2(inputVec) * scale);
|
|
|
|
}
|
2021-07-08 20:09:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int Helper_TextureSizeUnscale(int size, int samplerIndex)
|
|
|
|
{
|
2021-08-11 12:33:43 -07:00
|
|
|
float scale = abs(s_render_scale[1 + samplerIndex]);
|
2021-07-08 20:09:07 -07:00
|
|
|
if (scale == 1.0)
|
|
|
|
{
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
return int(float(size) / scale);
|
2020-07-06 19:41:07 -07:00
|
|
|
}
|