Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shrekshao committed Jan 31, 2023
1 parent 525ab73 commit edd3170
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/webgpu/api/operation/render_pipeline/sample_mask.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
export const description = `
Tests that the final sample mask is the logical AND of all the relevant masks, including
the rasterization mask, sample mask, fragment output mask, and alpha to coverage mask (when alphaToCoverageEnabled === true)
TODO: add a test without a 0th color attachment (sparse color attachment), with different color attachments and alpha value output.
The cross-platform behavior is unknown. could be any of:
- coverage is always 100%
- coverage is always 0%
- it uses the first non-null attachment
- it's an error
Details could be found at: https://github.com/gpuweb/cts/issues/2201
`;

import { makeTestGroup } from '../../../../common/framework/test_group.js';
Expand Down Expand Up @@ -242,7 +251,6 @@ class F extends GPUTest {
GPUTextureUsage.RENDER_ATTACHMENT,
}
);
this.trackForCleanup(this.sampleTexture);

this.sampler = this.device.createSampler({
magFilter: 'nearest',
Expand Down Expand Up @@ -693,7 +701,7 @@ color' <= color.
});

// { < 0, = 0, = 1/16, = 2/16, ..., = 15/16, = 1, > 1 }
const alpha0ParamsArray = [-0.1, ...range(16, i => i / 16), 1.1];
const alpha0ParamsArray = [-0.1, ...range(16, i => i / 16), 1.0, 1.1];

const colorResultPromises = [];
const depthResultPromises = [];
Expand Down Expand Up @@ -775,7 +783,7 @@ color' <= color.
if (alpha0 <= 0) {
const expected = getExpectedDataFn(sampleCount, rasterizationMask, sampleMask, 0x0);
const check = checkElementsEqual(result.data, expected);
t.expect(check === undefined, `alpha <= 0 should have alphaToCoverageMask be 0x0`);
t.expectOK(check);
} else if (alpha0 >= 1) {
const expected = getExpectedDataFn(
sampleCount,
Expand All @@ -784,7 +792,7 @@ color' <= color.
0xffffffff
);
const check = checkElementsEqual(result.data, expected);
t.expect(check === undefined, `alpha >= 1 should have alphaToCoverageMask be 0xffffffff`);
t.expectOK(check);
} else {
assert(i > 0);
const prevResult = results[i - 1];
Expand All @@ -796,10 +804,7 @@ color' <= color.
: value <= prevResult.data[index],
{}
);
t.expect(
check === undefined,
`alpha greater than other alpha1 should have at least as many bits set to 1 as the mask for alpha1`
);
t.expectOK(check);
}
}

Expand Down

0 comments on commit edd3170

Please sign in to comment.