Bug 1956004 - Part 1: Fixes for WebGPU CTS image_copy tests r=ErichDonGubler,webgpu-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D244412
This commit is contained in:
@@ -61,6 +61,7 @@ void CommandEncoder::ConvertTextureCopyViewToFFI(
|
||||
} else {
|
||||
MOZ_CRASH("Unexpected origin type");
|
||||
}
|
||||
aViewFFI->aspect = ConvertTextureAspect(aCopy.mAspect);
|
||||
}
|
||||
|
||||
static ffi::WGPUTexelCopyTextureInfo ConvertTextureCopyView(
|
||||
|
||||
@@ -152,11 +152,6 @@ void Queue::WriteTexture(const dom::GPUTexelCopyTextureInfo& aDestination,
|
||||
ConvertExtent3DToFFI(aSize, &extent);
|
||||
|
||||
dom::ProcessTypedArraysFixed(aData, [&](const Span<const uint8_t>& aData) {
|
||||
if (aData.IsEmpty()) {
|
||||
aRv.ThrowOperationError("Input size cannot be zero.");
|
||||
return;
|
||||
}
|
||||
|
||||
const auto checkedSize =
|
||||
CheckedInt<size_t>(aData.Length()) - aDataLayout.mOffset;
|
||||
if (!checkedSize.isValid()) {
|
||||
@@ -176,6 +171,8 @@ void Queue::WriteTexture(const dom::GPUTexelCopyTextureInfo& aDestination,
|
||||
|
||||
memcpy(mapping.DataAs<uint8_t>(), aData.Elements() + aDataLayout.mOffset,
|
||||
size);
|
||||
} else {
|
||||
handle = mozilla::ipc::MutableSharedMemoryHandle();
|
||||
}
|
||||
|
||||
ipc::ByteBuf bb;
|
||||
|
||||
@@ -385,7 +385,7 @@ ffi::WGPUTextureFormat ConvertTextureFormat(
|
||||
result.tag = ffi::WGPUTextureFormat_Etc2Rgba8Unorm;
|
||||
break;
|
||||
case dom::GPUTextureFormat::Etc2_rgba8unorm_srgb:
|
||||
result.tag = ffi::WGPUTextureFormat_Etc2Rgb8UnormSrgb;
|
||||
result.tag = ffi::WGPUTextureFormat_Etc2Rgba8UnormSrgb;
|
||||
break;
|
||||
case dom::GPUTextureFormat::Eac_r11unorm:
|
||||
result.tag = ffi::WGPUTextureFormat_EacR11Unorm;
|
||||
@@ -412,6 +412,29 @@ ffi::WGPUTextureFormat ConvertTextureFormat(
|
||||
return result;
|
||||
}
|
||||
|
||||
ffi::WGPUTextureAspect ConvertTextureAspect(
|
||||
const dom::GPUTextureAspect& aAspect) {
|
||||
ffi::WGPUTextureAspect result = ffi::WGPUTextureAspect_Sentinel;
|
||||
switch (aAspect) {
|
||||
case dom::GPUTextureAspect::All:
|
||||
result = ffi::WGPUTextureAspect_All;
|
||||
break;
|
||||
case dom::GPUTextureAspect::Depth_only:
|
||||
result = ffi::WGPUTextureAspect_DepthOnly;
|
||||
break;
|
||||
case dom::GPUTextureAspect::Stencil_only:
|
||||
result = ffi::WGPUTextureAspect_StencilOnly;
|
||||
break;
|
||||
}
|
||||
|
||||
// Clang will check for us that the switch above is exhaustive,
|
||||
// but not if we add a 'default' case. So, check this here.
|
||||
MOZ_RELEASE_ASSERT(result != ffi::WGPUTextureAspect_Sentinel,
|
||||
"unexpected texture aspect enum");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
ffi::WGPUVertexFormat ConvertVertexFormat(const dom::GPUVertexFormat& aFormat) {
|
||||
ffi::WGPUVertexFormat result = ffi::WGPUVertexFormat_Sentinel;
|
||||
switch (aFormat) {
|
||||
|
||||
@@ -41,6 +41,9 @@ ffi::WGPUCompareFunction ConvertCompareFunction(
|
||||
ffi::WGPUTextureFormat ConvertTextureFormat(
|
||||
const dom::GPUTextureFormat& aFormat);
|
||||
|
||||
ffi::WGPUTextureAspect ConvertTextureAspect(
|
||||
const dom::GPUTextureAspect& aAspect);
|
||||
|
||||
ffi::WGPUVertexFormat ConvertVertexFormat(const dom::GPUVertexFormat& aFormat);
|
||||
|
||||
ffi::WGPUMultisampleState ConvertMultisampleState(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user