Skip to content

Commit 55b4aa1

Browse files
committed
tests: try to apply IEEE consistency fixes to BC3 compression test from GameTechDev/ISPCTextureCompressor#20 but does not help (still 21 words different)
1 parent 19f0eb0 commit 55b4aa1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/code/tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static bool IspcCompressBC3Test()
269269
uint32_t ptrv = ptr[i], expv = exp[i];
270270
if (ptrv != expv)
271271
{
272-
printf(" does not match at index %i: got %08x exp %0x8\n", i, ptrv, expv);
272+
printf(" does not match at index %i: got %08x exp %08x\n", i, ptrv, expv);
273273
++printed;
274274
}
275275
}

tests/data/ispc-compress-bc3/kernel.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void compute_axis(out float axis[4], float covar[10], uint powerIterations, int
132132
for (p=0; p<channels; p++)
133133
norm_sq += axis[p]*axis[p];
134134

135-
float rnorm = rsqrt(norm_sq);
135+
float rnorm = 1.0 / sqrt(norm_sq);
136136
for (p=0; p<channels; p++) vec[p] *= rnorm;
137137
}
138138
}
@@ -159,7 +159,7 @@ void pick_endpoints(out float3 c0, out float3 c1, float3 block[16], float3 axis,
159159
}
160160

161161
float norm_sq = dot(axis, axis);
162-
float rnorm_sq = rcp(norm_sq);
162+
float rnorm_sq = 1.0 / norm_sq;
163163
c0 = clamp(dc+min_dot*rnorm_sq*axis, 0, 255);
164164
c1 = clamp(dc+max_dot*rnorm_sq*axis, 0, 255);
165165
}
@@ -171,7 +171,7 @@ uint fast_quant(float3 block[16], int p0, int p1)
171171

172172
float3 dir = c1-c0;
173173
float sq_norm = dot(dir, dir);
174-
float rsq_norm = rcp(sq_norm);
174+
float rsq_norm = 1.0 / sq_norm;
175175
dir *= rsq_norm*3;
176176

177177
float bias = 0.5;
@@ -230,7 +230,7 @@ void bc1_refine(int pe[2], float3 block[16], uint bits, float3 dc)
230230
float Cxx = 16*3*3-2*3*sum_q+sum_qq;
231231
float Cyy = sum_qq;
232232
float Cxy = 3*sum_q-sum_qq;
233-
float scale = 3 * rcp(Cxx*Cyy - Cxy*Cxy);
233+
float scale = 3 * (1.0 / (Cxx*Cyy - Cxy*Cxy));
234234

235235
c0 = (Atb1*Cyy - Atb2*Cxy)*scale;
236236
c1 = (Atb2*Cxx - Atb1*Cxy)*scale;

0 commit comments

Comments
 (0)