Skip to content

Commit

Permalink
Test 1 layer 2d-array textures.
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Jan 28, 2025
1 parent 5a937b0 commit f720ad9
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,23 +302,35 @@ Parameters:
.combine('samplePoints', kSamplePointMethods)
.combine('C', ['i32', 'u32'] as const)
.combine('A', ['i32', 'u32'] as const)
.combine('depthOrArrayLayers', [1, 8] as const)
)
.beforeAllSubcases(t => {
t.skipIfTextureFormatNotSupported(t.params.format);
skipIfNeedsFilteringAndIsUnfilterableOrSelectDevice(t, t.params.filt, t.params.format);
})
.fn(async t => {
const { format, stage, samplePoints, C, A, modeU, modeV, filt: minFilter, offset } = t.params;
const {
format,
stage,
samplePoints,
C,
A,
modeU,
modeV,
filt: minFilter,
offset,
depthOrArrayLayers,
} = t.params;

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
const depthOrArrayLayers = 4;

const descriptor: GPUTextureDescriptor = {
format,
size: { width, height, depthOrArrayLayers },
mipLevelCount: 3,
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,
...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }),
};
const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor);
const sampler: GPUSamplerDescriptor = {
Expand Down Expand Up @@ -351,7 +363,7 @@ Parameters:
};
});
const textureType = appendComponentTypeForFormatToTextureType('texture_2d_array', format);
const viewDescriptor = {};
const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' };
const results = await doTextureCalls(
t,
texture,
Expand Down Expand Up @@ -692,24 +704,25 @@ Parameters:
.beginSubcases()
.combine('samplePoints', kSamplePointMethods)
.combine('A', ['i32', 'u32'] as const)
.combine('depthOrArrayLayers', [1, 8] as const)
)
.beforeAllSubcases(t => {
t.skipIfDepthTextureCanNotBeUsedWithNonComparisonSampler();
t.skipIfTextureFormatNotSupported(t.params.format);
t.selectDeviceForTextureFormatOrSkipTestCase(t.params.format);
})
.fn(async t => {
const { format, stage, samplePoints, A, modeU, modeV, offset } = t.params;
const { format, stage, samplePoints, A, modeU, modeV, offset, depthOrArrayLayers } = t.params;

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
const depthOrArrayLayers = 4;

const descriptor: GPUTextureDescriptor = {
format,
size: { width, height, depthOrArrayLayers },
mipLevelCount: 3,
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,
...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }),
};
const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor);
const sampler: GPUSamplerDescriptor = {
Expand All @@ -736,7 +749,7 @@ Parameters:
};
});
const textureType = 'texture_depth_2d_array';
const viewDescriptor = {};
const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' };
const results = await doTextureCalls(
t,
texture,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Parameters:
.combine('samplePoints', kSamplePointMethods)
.combine('A', ['i32', 'u32'] as const)
.combine('compare', kCompareFunctions)
.combine('depthOrArrayLayers', [1, 8] as const)
)
.beforeAllSubcases(t => {
t.skipIfTextureFormatNotSupported(t.params.format);
Expand All @@ -94,15 +95,17 @@ Parameters:
filt: minFilter,
compare,
offset,
depthOrArrayLayers,
} = t.params;

const viewDimension = '2d-array';
const size = chooseTextureSize({ minSize: 8, minBlocks: 4, format, viewDimension });
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
const size = { width, height, depthOrArrayLayers };

const descriptor: GPUTextureDescriptor = {
format,
size,
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,
...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }),
};
const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor, {
generator: makeRandomDepthComparisonTexelGenerator(descriptor, compare),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ Parameters:
{ C: 'u32', A: 'i32', L: 'u32' },
{ C: 'u32', A: 'u32', L: 'i32' },
] as const)
.combine('depthOrArrayLayers', [1, 8] as const)
)
.beforeAllSubcases(t => {
const { format, texture_type } = t.params;
Expand All @@ -630,15 +631,17 @@ Parameters:
t.selectDeviceForTextureFormatOrSkipTestCase(format);
})
.fn(async t => {
const { texture_type, format, stage, samplePoints, C, A, L } = t.params;
const { texture_type, format, stage, samplePoints, C, A, L, depthOrArrayLayers } = t.params;

// We want at least 4 blocks or something wide enough for 3 mip levels.
const size = chooseTextureSize({ minSize: 8, minBlocks: 4, format, viewDimension: '3d' });
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
const size = { width, height, depthOrArrayLayers };
const descriptor: GPUTextureDescriptor = {
format,
size,
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,
mipLevelCount: maxMipLevelCount({ size }),
...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }),
};
const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor);

Expand All @@ -660,7 +663,7 @@ Parameters:
};
});
const textureType = appendComponentTypeForFormatToTextureType(texture_type, texture.format);
const viewDescriptor = {};
const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' };
const sampler = undefined;
const results = await doTextureCalls(
t,
Expand Down Expand Up @@ -867,6 +870,7 @@ Parameters:
.combine('samplePoints', kSamplePointMethods)
.combine('C', ['i32', 'u32'] as const)
.combine('A', ['i32', 'u32'] as const)
.combine('depthOrArrayLayers', [1, 8] as const)
)
.beforeAllSubcases(t => {
t.skipIf(!t.hasLanguageFeature('readonly_and_readwrite_storage_textures'));
Expand All @@ -877,16 +881,18 @@ Parameters:
}
})
.fn(async t => {
const { format, stage, samplePoints, C, A } = t.params;
const { format, stage, samplePoints, C, A, depthOrArrayLayers } = t.params;

skipIfStorageTexturesNotSupportedInStage(t, stage);

// We want at least 3 blocks or something wide enough for 3 mip levels.
const size = chooseTextureSize({ minSize: 8, minBlocks: 4, format, viewDimension: '3d' });
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
const size = { width, height, depthOrArrayLayers };
const descriptor: GPUTextureDescriptor = {
format,
size,
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.STORAGE_BINDING,
...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }),
};
const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,23 +485,33 @@ Parameters:
.beginSubcases()
.combine('samplePoints', kSamplePointMethods)
.combine('A', ['i32', 'u32'] as const)
.combine('depthOrArrayLayers', [1, 8] as const)
)
.beforeAllSubcases(t =>
skipIfTextureFormatNotSupportedNotAvailableOrNotFilterable(t, t.params.format)
)
.fn(async t => {
const { format, samplePoints, A, modeU, modeV, filt: minFilter, offset } = t.params;
const {
format,
samplePoints,
A,
modeU,
modeV,
filt: minFilter,
offset,
depthOrArrayLayers,
} = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
const depthOrArrayLayers = 4;

const descriptor: GPUTextureDescriptor = {
format,
size: { width, height, depthOrArrayLayers },
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,
mipLevelCount: 3,
...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }),
};
const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor);
const sampler: GPUSamplerDescriptor = {
Expand Down Expand Up @@ -532,7 +542,7 @@ Parameters:
};
});
const textureType = 'texture_2d_array<f32>';
const viewDescriptor = {};
const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' };
const results = await doTextureCalls(
t,
texture,
Expand Down Expand Up @@ -789,19 +799,20 @@ Parameters:
.combine('samplePoints', kSamplePointMethods)
.combine('A', ['i32', 'u32'] as const)
.combine('L', ['i32', 'u32'] as const)
.combine('depthOrArrayLayers', [1, 8] as const)
)
.beforeAllSubcases(t => {
t.skipIfDepthTextureCanNotBeUsedWithNonComparisonSampler();
t.selectDeviceForTextureFormatOrSkipTestCase(t.params.format);
})
.fn(async t => {
const { format, samplePoints, mode, A, L, offset } = t.params;
const { format, samplePoints, mode, A, L, offset, depthOrArrayLayers } = t.params;

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
const descriptor: GPUTextureDescriptor = {
format,
size: { width, height },
size: { width, height, depthOrArrayLayers },
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,
mipLevelCount: 3,
...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,22 +260,34 @@ Parameters:
.combine('samplePoints', kSamplePointMethods)
.combine('A', ['i32', 'u32'] as const)
.combine('compare', kCompareFunctions)
.combine('depthOrArrayLayers', [1, 8] as const)
)
.beforeAllSubcases(t => {
t.skipIfTextureFormatNotSupported(t.params.format);
t.selectDeviceForTextureFormatOrSkipTestCase(t.params.format);
})
.fn(async t => {
const { format, samplePoints, A, modeU, modeV, filt: minFilter, compare, offset } = t.params;
const {
format,
samplePoints,
A,
modeU,
modeV,
filt: minFilter,
compare,
offset,
depthOrArrayLayers,
} = t.params;

const viewDimension = '2d-array';
const size = chooseTextureSize({ minSize: 16, minBlocks: 4, format, viewDimension });
const [width, height] = chooseTextureSize({ minSize: 16, minBlocks: 4, format });
const size = { width, height, depthOrArrayLayers };

const descriptor: GPUTextureDescriptor = {
format,
size,
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,
mipLevelCount: 3,
...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }),
};
const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor, {
generator: makeRandomDepthComparisonTexelGenerator(descriptor, compare),
Expand Down Expand Up @@ -312,7 +324,7 @@ Parameters:
};
});
const textureType = 'texture_depth_2d_array';
const viewDescriptor = {};
const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' };
const results = await doTextureCalls(
t,
texture,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ Parameters:
.combine('samplePoints', kSamplePointMethods)
.combine('A', ['i32', 'u32'] as const)
.combine('compare', kCompareFunctions)
.combine('depthOrArrayLayers', [1, 8] as const)
)
.beforeAllSubcases(t => {
t.skipIfTextureFormatNotSupported(t.params.format);
Expand All @@ -295,16 +296,18 @@ Parameters:
filt: minFilter,
compare,
offset,
depthOrArrayLayers,
} = t.params;

const viewDimension = '2d-array';
const size = chooseTextureSize({ minSize: 16, minBlocks: 4, format, viewDimension });
const [width, height] = chooseTextureSize({ minSize: 16, minBlocks: 4, format });
const size = { width, height, depthOrArrayLayers };

const descriptor: GPUTextureDescriptor = {
format,
size,
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,
mipLevelCount: 3,
...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }),
};
const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor, {
generator: makeRandomDepthComparisonTexelGenerator(descriptor, compare),
Expand Down Expand Up @@ -341,7 +344,7 @@ Parameters:
};
});
const textureType = 'texture_depth_2d_array';
const viewDescriptor = {};
const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' };
const results = await doTextureCalls(
t,
texture,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,23 +311,34 @@ Parameters:
.beginSubcases()
.combine('samplePoints', kSamplePointMethods)
.combine('A', ['i32', 'u32'] as const)
.combine('depthOrArrayLayers', [1, 8] as const)
)
.beforeAllSubcases(t =>
skipIfTextureFormatNotSupportedNotAvailableOrNotFilterable(t, t.params.format)
)
.fn(async t => {
const { format, stage, samplePoints, A, modeU, modeV, filt: minFilter, offset } = t.params;
const {
format,
stage,
samplePoints,
A,
modeU,
modeV,
filt: minFilter,
offset,
depthOrArrayLayers,
} = t.params;
skipIfNeedsFilteringAndIsUnfilterable(t, minFilter, format);

// We want at least 4 blocks or something wide enough for 3 mip levels.
const [width, height] = chooseTextureSize({ minSize: 8, minBlocks: 4, format });
const depthOrArrayLayers = 4;

const descriptor: GPUTextureDescriptor = {
format,
size: { width, height, depthOrArrayLayers },
usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING,
mipLevelCount: 3,
...(t.isCompatibility && { textureBindingViewDimension: '2d-array' }),
};
const { texels, texture } = await createTextureWithRandomDataAndGetTexels(t, descriptor);
const sampler: GPUSamplerDescriptor = {
Expand Down Expand Up @@ -359,7 +370,7 @@ Parameters:
};
});
const textureType = 'texture_2d_array<f32>';
const viewDescriptor = {};
const viewDescriptor: GPUTextureViewDescriptor = { dimension: '2d-array' };
const results = await doTextureCalls(
t,
texture,
Expand Down
Loading

0 comments on commit f720ad9

Please sign in to comment.