mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 00:47:13 +00:00
Adding APICopyTextureToTextureInternal
This CL adds an internal method to copy textures, that will disregard the need of having CopySrc usage. This CL adds an intermediate helped method to be used by both APIContextTextureToTexture and APIContextTextureToTextureInternal. Fixed: dawn:1052 Change-Id: Icd28e0ef58ecfaa412eefe8c95e41cd2298a9acc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/58440 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Juanmi Huertas <juanmihd@chromium.org>
This commit is contained in:
@@ -115,6 +115,7 @@ TEST_F(TextureInternalUsageValidationTest, UsageValidation) {
|
||||
|
||||
// Test that internal usage does not add to the validated usage
|
||||
// for command encoding
|
||||
// This test also test the internal copy
|
||||
TEST_F(TextureInternalUsageValidationTest, CommandValidation) {
|
||||
wgpu::TextureDescriptor textureDesc = {};
|
||||
textureDesc.size = {1, 1};
|
||||
@@ -156,4 +157,27 @@ TEST_F(TextureInternalUsageValidationTest, CommandValidation) {
|
||||
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &extent3D);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
// Control with internal copy: src -> dst
|
||||
{
|
||||
wgpu::ImageCopyTexture srcImageCopyTexture = utils::CreateImageCopyTexture(src, 0, {0, 0});
|
||||
wgpu::ImageCopyTexture dstImageCopyTexture = utils::CreateImageCopyTexture(dst, 0, {0, 0});
|
||||
wgpu::Extent3D extent3D = {1, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToTextureInternal(&srcImageCopyTexture, &dstImageCopyTexture, &extent3D);
|
||||
encoder.Finish();
|
||||
}
|
||||
|
||||
// Valid with internal copy: src internal -> dst
|
||||
{
|
||||
wgpu::ImageCopyTexture srcImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(srcInternal, 0, {0, 0});
|
||||
wgpu::ImageCopyTexture dstImageCopyTexture = utils::CreateImageCopyTexture(dst, 0, {0, 0});
|
||||
wgpu::Extent3D extent3D = {1, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToTextureInternal(&srcImageCopyTexture, &dstImageCopyTexture, &extent3D);
|
||||
encoder.Finish();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user