mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 22:33:17 +00:00
Remove use of the llvm.round intrinsic as it apparently doesn't work in some environments
This commit is contained in:
parent
87e9ba0f05
commit
af7a7ab7d7
4 changed files with 18 additions and 7 deletions
|
@ -39,18 +39,25 @@ void DrawTriangleCodegen::Generate(TriDrawVariant variant, bool truecolor, SSAVa
|
|||
LoopBlockY(variant, truecolor);
|
||||
}
|
||||
|
||||
SSAInt DrawTriangleCodegen::FloatTo28_4(SSAFloat v)
|
||||
{
|
||||
// SSAInt(SSAFloat::round(16.0f * v), false);
|
||||
SSAInt a = SSAInt(v * 32.0f, false);
|
||||
return (a + (a.ashr(31) | SSAInt(1))).ashr(1);
|
||||
}
|
||||
|
||||
void DrawTriangleCodegen::Setup(TriDrawVariant variant, bool truecolor)
|
||||
{
|
||||
int pixelsize = truecolor ? 4 : 1;
|
||||
|
||||
// 28.4 fixed-point coordinates
|
||||
Y1 = SSAInt(SSAFloat::round(16.0f * v1.y), false);
|
||||
Y2 = SSAInt(SSAFloat::round(16.0f * v2.y), false);
|
||||
Y3 = SSAInt(SSAFloat::round(16.0f * v3.y), false);
|
||||
Y1 = FloatTo28_4(v1.y);
|
||||
Y2 = FloatTo28_4(v2.y);
|
||||
Y3 = FloatTo28_4(v3.y);
|
||||
|
||||
X1 = SSAInt(SSAFloat::round(16.0f * v1.x), false);
|
||||
X2 = SSAInt(SSAFloat::round(16.0f * v2.x), false);
|
||||
X3 = SSAInt(SSAFloat::round(16.0f * v3.x), false);
|
||||
X1 = FloatTo28_4(v1.x);
|
||||
X2 = FloatTo28_4(v2.x);
|
||||
X3 = FloatTo28_4(v3.x);
|
||||
|
||||
// Deltas
|
||||
DX12 = X1 - X2;
|
||||
|
|
|
@ -40,6 +40,7 @@ private:
|
|||
SSATriVertex LoadTriVertex(SSAValue v);
|
||||
void LoadUniforms(SSAValue uniforms);
|
||||
void Setup(TriDrawVariant variant, bool truecolor);
|
||||
SSAInt FloatTo28_4(SSAFloat v);
|
||||
void LoopBlockY(TriDrawVariant variant, bool truecolor);
|
||||
void LoopBlockX(TriDrawVariant variant, bool truecolor);
|
||||
void LoopFullBlock(TriDrawVariant variant, bool truecolor);
|
||||
|
|
|
@ -112,12 +112,15 @@ SSAFloat SSAFloat::fma(SSAFloat a, SSAFloat b, SSAFloat c)
|
|||
return SSAFloat::from_llvm(SSAScope::builder().CreateCall(SSAScope::intrinsic(llvm::Intrinsic::fma, params), args, SSAScope::hint()));
|
||||
}
|
||||
|
||||
/* This intrinsic isn't always available..
|
||||
SSAFloat SSAFloat::round(SSAFloat val)
|
||||
{
|
||||
|
||||
std::vector<llvm::Type *> params;
|
||||
params.push_back(SSAFloat::llvm_type());
|
||||
return SSAFloat::from_llvm(SSAScope::builder().CreateCall(SSAScope::intrinsic(llvm::Intrinsic::round, params), val.v, SSAScope::hint()));
|
||||
}
|
||||
*/
|
||||
|
||||
SSAFloat SSAFloat::floor(SSAFloat val)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
static SSAFloat exp(SSAFloat val);
|
||||
static SSAFloat log(SSAFloat val);
|
||||
static SSAFloat fma(SSAFloat a, SSAFloat b, SSAFloat c);
|
||||
static SSAFloat round(SSAFloat val);
|
||||
//static SSAFloat round(SSAFloat val);
|
||||
static SSAFloat floor(SSAFloat val);
|
||||
static SSAFloat MIN(SSAFloat a, SSAFloat b);
|
||||
static SSAFloat MAX(SSAFloat a, SSAFloat b);
|
||||
|
|
Loading…
Reference in a new issue