mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-28 11:49:06 +00:00
VideoCommon: Clamp integer conversions.
This commit is contained in:
parent
b0770e2a0c
commit
0f2c72f0f8
3 changed files with 8 additions and 8 deletions
|
@ -487,7 +487,7 @@ static void WriteZ16Encoder(char*& p,API_TYPE ApiType)
|
|||
|
||||
WriteSampleColor(p, "r", "depth", 0, ApiType);
|
||||
|
||||
WRITE(p, " depth *= 16777216.0;\n");
|
||||
WRITE(p, " depth = clamp(depth * 16777216.0, 0, 0xFFFFFF);\n");
|
||||
WRITE(p, " expanded.r = floor(depth / (256.0 * 256.0));\n");
|
||||
WRITE(p, " depth -= expanded.r * 256.0 * 256.0;\n");
|
||||
WRITE(p, " expanded.g = floor(depth / 256.0);\n");
|
||||
|
@ -497,7 +497,7 @@ static void WriteZ16Encoder(char*& p,API_TYPE ApiType)
|
|||
|
||||
WriteSampleColor(p, "r", "depth", 1, ApiType);
|
||||
|
||||
WRITE(p, " depth *= 16777216.0;\n");
|
||||
WRITE(p, " depth = clamp(depth * 16777216.0, 0, 0xFFFFFF);\n");
|
||||
WRITE(p, " expanded.r = floor(depth / (256.0 * 256.0));\n");
|
||||
WRITE(p, " depth -= expanded.r * 256.0 * 256.0;\n");
|
||||
WRITE(p, " expanded.g = floor(depth / 256.0);\n");
|
||||
|
@ -519,7 +519,7 @@ static void WriteZ16LEncoder(char*& p,API_TYPE ApiType)
|
|||
|
||||
WriteSampleColor(p, "r", "depth", 0, ApiType);
|
||||
|
||||
WRITE(p, " depth *= 16777216.0;\n");
|
||||
WRITE(p, " depth = clamp(depth * 16777216.0, 0, 0xFFFFFF);\n");
|
||||
WRITE(p, " expanded.r = floor(depth / (256.0 * 256.0));\n");
|
||||
WRITE(p, " depth -= expanded.r * 256.0 * 256.0;\n");
|
||||
WRITE(p, " expanded.g = floor(depth / 256.0);\n");
|
||||
|
@ -531,7 +531,7 @@ static void WriteZ16LEncoder(char*& p,API_TYPE ApiType)
|
|||
|
||||
WriteSampleColor(p, "r", "depth", 1, ApiType);
|
||||
|
||||
WRITE(p, " depth *= 16777216.0;\n");
|
||||
WRITE(p, " depth = clamp(depth * 16777216.0, 0, 0xFFFFFF);\n");
|
||||
WRITE(p, " expanded.r = floor(depth / (256.0 * 256.0));\n");
|
||||
WRITE(p, " depth -= expanded.r * 256.0 * 256.0;\n");
|
||||
WRITE(p, " expanded.g = floor(depth / 256.0);\n");
|
||||
|
@ -558,7 +558,7 @@ static void WriteZ24Encoder(char*& p, API_TYPE ApiType)
|
|||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
WRITE(p, " depth%i *= 16777216.0;\n", i);
|
||||
WRITE(p, " depth%i = clamp(depth%i * 16777216.0, 0, 0xFFFFFF);\n", i, i);
|
||||
|
||||
WRITE(p, " expanded%i.r = floor(depth%i / (256.0 * 256.0));\n", i, i);
|
||||
WRITE(p, " depth%i -= expanded%i.r * 256.0 * 256.0;\n", i, i);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue