Skip to content

Commit

Permalink
Fix textureSampleBias test (#3988)
Browse files Browse the repository at this point in the history
The derivative portion of mip level selection
was being incorrectly quantized. That quanization
is left over from a previous implementation but
now, quantization happens when the mip level is
chosen.
  • Loading branch information
greggman authored Oct 9, 2024
1 parent d48c080 commit 40f19fb
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2305,10 +2305,6 @@ const sumOfCharCodesOfString = (s: unknown) =>
.split('')
.reduce((sum, c) => sum + c.charCodeAt(0), 0);

function roundDownToMultipleOf(v: number, multiple: number) {
return Math.floor(v / multiple) * multiple;
}

/**
* Makes a function that fills a block portion of a Uint8Array with random valid data
* for an astc block.
Expand Down Expand Up @@ -3281,8 +3277,7 @@ function generateTextureBuiltinInputsImpl<T extends Dimensionality>(
// choose one axis to set
const ndx = makeRangeValue({ num: coords.length - 1, type: 'u32' }, i, 8);
assert(ndx < coords.length);
// Align to 3rds to avoid edge cases.
mult[ndx] = Math.pow(2, roundDownToMultipleOf(mipLevel, 1 / 3));
mult[ndx] = Math.pow(2, mipLevel);
return mult as T;
};

Expand Down Expand Up @@ -3815,8 +3810,7 @@ export function generateSamplePointsCube(
// choose one axis to set
const ndx = makeRangeValue({ num: coords.length - 1, type: 'u32' }, i, 8);
assert(ndx < coords.length);
// Align to 3rds to avoid edge cases.
mult[ndx] = Math.pow(2, roundDownToMultipleOf(mipLevel, 1 / 3));
mult[ndx] = Math.pow(2, mipLevel);
return mult as vec3;
};

Expand Down

0 comments on commit 40f19fb

Please sign in to comment.