Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compat: Skip texture sync tests that use storage textures if 0 #4104

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Memory Synchronization Tests for Texture: read before write, read after write, a
import { makeTestGroup } from '../../../../../common/framework/test_group.js';
import { assert, memcpy, unreachable } from '../../../../../common/util/util.js';
import { EncodableTextureFormat } from '../../../../format_info.js';
import { GPUTest } from '../../../../gpu_test.js';
import { GPUTest, MaxLimitsTestMixin } from '../../../../gpu_test.js';
import { align } from '../../../../util/math.js';
import { getTextureCopyLayout } from '../../../../util/texture/layout.js';
import {
Expand All @@ -31,7 +31,7 @@ import {
kOpInfo,
} from './texture_sync_test.js';

export const g = makeTestGroup(GPUTest);
export const g = makeTestGroup(MaxLimitsTestMixin(GPUTest));

const fullscreenQuadWGSL = `
struct VertexOutput {
Expand All @@ -53,6 +53,18 @@ const fullscreenQuadWGSL = `
}
`;

function readOpNeedsStorageTexture({ op, in: context }: { op: Op; in: OperationContext }) {
return (
op === 'sample' && (context === 'render-pass-encoder' || context === 'render-bundle-encoder')
);
}

function writeOpNeedsStorageTexture({ op, in: context }: { op: Op; in: OperationContext }) {
return (
op === 'storage' && (context === 'render-pass-encoder' || context === 'render-bundle-encoder')
);
}

class TextureSyncTestHelper extends OperationContextHelper {
private texture: GPUTexture;

Expand All @@ -73,6 +85,29 @@ class TextureSyncTestHelper extends OperationContextHelper {
});
}

static skipIfNeedStorageTexturesAndNoStorageTextures(
t: GPUTest,
reads: { op: Op; in: OperationContext }[],
writes: { op: Op; in: OperationContext }[]
) {
if (!t.isCompatibility) {
return;
}

if (t.device.limits.maxStorageTexturesInFragmentStage! >= 1) {
return;
}

const needStorageTexture =
reads.reduce((need, read) => need || readOpNeedsStorageTexture(read), false) ||
writes.reduce((need, write) => need || writeOpNeedsStorageTexture(write), false);

t.skipIf(
needStorageTexture,
`maxStorageTexturesInFragmentStage(${t.device.limits.maxStorageTexturesInFragmentStage}) < 1`
);
}

/**
* Perform a read operation on the test texture.
* @return GPUTexture copy containing the contents.
Expand Down Expand Up @@ -558,6 +593,11 @@ g.test('rw')
})
)
.fn(t => {
TextureSyncTestHelper.skipIfNeedStorageTexturesAndNoStorageTextures(
t,
[t.params.read],
[t.params.write]
);
const helper = new TextureSyncTestHelper(t, {
usage:
GPUTextureUsage.COPY_DST |
Expand Down Expand Up @@ -610,6 +650,11 @@ g.test('wr')
})
)
.fn(t => {
TextureSyncTestHelper.skipIfNeedStorageTexturesAndNoStorageTextures(
t,
[t.params.read],
[t.params.write]
);
const helper = new TextureSyncTestHelper(t, {
usage: kOpInfo[t.params.read.op].readUsage | kOpInfo[t.params.write.op].writeUsage,
});
Expand Down Expand Up @@ -654,6 +699,12 @@ g.test('ww')
})
)
.fn(t => {
TextureSyncTestHelper.skipIfNeedStorageTexturesAndNoStorageTextures(
t,
[],
[t.params.first, t.params.second]
);

const helper = new TextureSyncTestHelper(t, {
usage:
GPUTextureUsage.COPY_SRC |
Expand Down
Loading