Workbench: Use int to fix compilation issues on certain platform
This commit is contained in:
@@ -65,11 +65,11 @@ float workbench_float_pair_encode(float v1, float v2)
|
||||
// const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
|
||||
// const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
|
||||
/* Same as above because some compiler are dumb af. and think we use mediump int. */
|
||||
const uint total_mask = 0xFFu;
|
||||
const uint v1_mask = 0x1Fu;
|
||||
const uint v2_mask = 0x7u;
|
||||
const int total_mask = 0xFF;
|
||||
const int v1_mask = 0x1F;
|
||||
const int v2_mask = 0x7;
|
||||
int iv1 = int(v1 * float(v1_mask));
|
||||
int iv2 = int(v2 * float(v2_mask)) << ROUGHNESS_BITS;
|
||||
int iv2 = int(v2 * float(v2_mask)) << int(ROUGHNESS_BITS);
|
||||
return float(iv1 | iv2) * (1.0 / float(total_mask));
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@ void workbench_float_pair_decode(float data, out float v1, out float v2)
|
||||
// const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS);
|
||||
// const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS);
|
||||
/* Same as above because some compiler are dumb af. and think we use mediump int. */
|
||||
const uint total_mask = 0xFFu;
|
||||
const uint v1_mask = 0x1Fu;
|
||||
const uint v2_mask = 0x7u;
|
||||
uint idata = uint(data * float(total_mask));
|
||||
const int total_mask = 0xFF;
|
||||
const int v1_mask = 0x1F;
|
||||
const int v2_mask = 0x7;
|
||||
int idata = int(data * float(total_mask));
|
||||
v1 = float(idata & v1_mask) * (1.0 / float(v1_mask));
|
||||
v2 = float(idata >> ROUGHNESS_BITS) * (1.0 / float(v2_mask));
|
||||
v2 = float(idata >> int(ROUGHNESS_BITS)) * (1.0 / float(v2_mask));
|
||||
}
|
||||
|
||||
float calculate_transparent_weight(float z, float alpha)
|
||||
|
||||
Reference in New Issue
Block a user