-
Notifications
You must be signed in to change notification settings - Fork 344
Closed
Labels
apiWebGPU APIWebGPU APIapi resolvedResolved - waiting for a change to the API specificationResolved - waiting for a change to the API specificationbugpotentially breakingCould require a breaking change to the APICould require a breaking change to the API
Milestone
Description
The spec here https://gpuweb.github.io/gpuweb/#texture-creation validates descriptor.format against descriptor.usage, but it doesn't validate the descriptor.usage with descriptor.viewFormats.
It is indeed necessary on Vulkan to do so. Currently the following:
const texture = device.createTexture({
size: [4, 4],
format: 'rgba8unorm',
usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.STORAGE_BINDING,
viewFormats: ['rgba8unorm-srgb'],
});hits a validation error on Vulkan, because the rgba8unorm-srgb format doesn't support storage. The WebGPU spec also disallows storage usage of rgba8unorm-srgb this.
Doing do so will hit a VVL error like:
Error: VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251: Validation Error: [ VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251 ] | MessageID = 0xbebcae79 | vkCreateImage(): pCreateInfo The following parameters -
format (VK_FORMAT_R8G8B8A8_UNORM)
type (VK_IMAGE_TYPE_2D)
tiling (VK_IMAGE_TILING_OPTIMAL)
usage (VK_IMAGE_USAGE_TRANSFER_SRC_BIT|VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_STORAGE_BIT)
flags (VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT)
returned (VK_ERROR_FORMAT_NOT_SUPPORTED) when calling vkGetPhysicalDeviceImageFormatProperties2. The Vulkan spec states: Each of the following values (as described in Image Creation Limits) must not be undefined : imageCreateMaxMipLevels, imageCreateMaxArrayLayers, imageCreateMaxExtent, and imageCreateSampleCounts (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251)
Note that when I tested this, the WebGPU implementation (Dawn) is not directly calling vkGetPhysicalDeviceImageFormatProperties2. It's the VVL injecting a call to vkGetPhysicalDeviceImageFormatProperties2 to check that vkCreateImage is valid.
Metadata
Metadata
Assignees
Labels
apiWebGPU APIWebGPU APIapi resolvedResolved - waiting for a change to the API specificationResolved - waiting for a change to the API specificationbugpotentially breakingCould require a breaking change to the APICould require a breaking change to the API