Skip to content

Commit

Permalink
Address feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Nov 8, 2020
1 parent c75ed17 commit 2cb78e5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions GPU/Common/ReinterpretFramebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ static const VaryingDef varyings[1] = {
{ "vec2", "v_texcoord", "TEXCOORD0" },
};

// TODO: We could have an option to preserve any extra color precision. But gonna start without it.
// Requires full size integer math.
// TODO: We could possibly have an option to preserve any extra color precision? But gonna start without it.
// Requires full size integer math. It would be possible to make a floating point-only version with lots of
// modulo and stuff, might do it one day.
bool GenerateReinterpretFragmentShader(char *buffer, GEBufferFormat from, GEBufferFormat to, const ShaderLanguageDesc &lang) {
if (!lang.bitwiseOps) {
return false;
Expand All @@ -30,7 +31,7 @@ bool GenerateReinterpretFragmentShader(char *buffer, GEBufferFormat from, GEBuff
break;
case GE_FORMAT_5551:
writer.C(" uint color = uint(val.r * 31.99) | (uint(val.g * 31.99) << 5) | (uint(val.b * 31.99) << 10);\n");
writer.C(" if (val.a > 128.0) color |= 0x8000U;\n");
writer.C(" if (val.a >= 0.5) color |= 0x8000U;\n");
break;
case GE_FORMAT_565:
writer.C(" uint color = uint(val.r * 31.99) | (uint(val.g * 63.99) << 5) | (uint(val.b * 31.99) << 11);\n");
Expand Down

0 comments on commit 2cb78e5

Please sign in to comment.