Skip to content

Commit

Permalink
Cover ImageBitmap option "colorSpaceConversion: none" (#2891)
Browse files Browse the repository at this point in the history
ImageBitmap creation could set option colorSpaceConversion:none. Cts
should cover this option to check whether it has side effect for
copyEI2T.
  • Loading branch information
shaoboyan authored Aug 11, 2023
1 parent dd5eaef commit 02b2301
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/webgpu/web_platform/copyToTexture/ImageBitmap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ g.test('from_ImageData')
u
.combine('alpha', ['none', 'premultiply'] as const)
.combine('orientation', ['none', 'flipY'] as const)
.combine('colorSpaceConversion', ['none', 'default'] as const)
.combine('srcDoFlipYDuringCopy', [true, false])
.combine('dstColorFormat', kValidTextureFormatsForCopyE2T)
.combine('dstPremultiplied', [true, false])
Expand All @@ -122,6 +123,7 @@ g.test('from_ImageData')
height,
alpha,
orientation,
colorSpaceConversion,
dstColorFormat,
dstPremultiplied,
srcDoFlipYDuringCopy,
Expand Down Expand Up @@ -149,6 +151,7 @@ g.test('from_ImageData')
const imageBitmap = await createImageBitmap(imageData, {
premultiplyAlpha: alpha,
imageOrientation: orientation,
colorSpaceConversion,
});

const dst = t.device.createTexture({
Expand Down Expand Up @@ -223,6 +226,7 @@ g.test('from_canvas')
.params(u =>
u
.combine('orientation', ['none', 'flipY'] as const)
.combine('colorSpaceConversion', ['none', 'default'] as const)
.combine('srcDoFlipYDuringCopy', [true, false])
.combine('dstColorFormat', kValidTextureFormatsForCopyE2T)
.combine('dstPremultiplied', [true, false])
Expand All @@ -238,6 +242,7 @@ g.test('from_canvas')
width,
height,
orientation,
colorSpaceConversion,
dstColorFormat,
dstPremultiplied,
srcDoFlipYDuringCopy,
Expand Down Expand Up @@ -293,6 +298,7 @@ g.test('from_canvas')
const imageBitmap = await createImageBitmap(imageCanvas as HTMLCanvasElement, {
premultiplyAlpha: 'premultiply',
imageOrientation: orientation,
colorSpaceConversion,
});

const dst = t.device.createTexture({
Expand Down Expand Up @@ -370,6 +376,7 @@ g.test('copy_subrect_from_ImageData')
u
.combine('alpha', ['none', 'premultiply'] as const)
.combine('orientation', ['none', 'flipY'] as const)
.combine('colorSpaceConversion', ['none', 'default'] as const)
.combine('srcDoFlipYDuringCopy', [true, false])
.combine('dstPremultiplied', [true, false])
.beginSubcases()
Expand All @@ -380,6 +387,7 @@ g.test('copy_subrect_from_ImageData')
copySubRectInfo,
alpha,
orientation,
colorSpaceConversion,
dstPremultiplied,
srcDoFlipYDuringCopy,
} = t.params;
Expand Down Expand Up @@ -408,6 +416,7 @@ g.test('copy_subrect_from_ImageData')
const imageBitmap = await createImageBitmap(imageData, {
premultiplyAlpha: alpha,
imageOrientation: orientation,
colorSpaceConversion,
});

const dst = t.device.createTexture({
Expand Down Expand Up @@ -483,13 +492,20 @@ g.test('copy_subrect_from_2D_Canvas')
.params(u =>
u
.combine('orientation', ['none', 'flipY'] as const)
.combine('colorSpaceConversion', ['none', 'default'] as const)
.combine('srcDoFlipYDuringCopy', [true, false])
.combine('dstPremultiplied', [true, false])
.beginSubcases()
.combine('copySubRectInfo', kCopySubrectInfo)
)
.fn(async t => {
const { copySubRectInfo, orientation, dstPremultiplied, srcDoFlipYDuringCopy } = t.params;
const {
copySubRectInfo,
orientation,
colorSpaceConversion,
dstPremultiplied,
srcDoFlipYDuringCopy,
} = t.params;

const { srcOrigin, dstOrigin, srcSize, dstSize, copyExtent } = copySubRectInfo;
const kColorFormat = 'rgba8unorm';
Expand Down Expand Up @@ -544,6 +560,7 @@ g.test('copy_subrect_from_2D_Canvas')
const imageBitmap = await createImageBitmap(imageCanvas as HTMLCanvasElement, {
premultiplyAlpha: 'premultiply',
imageOrientation: orientation,
colorSpaceConversion,
});

const dst = t.device.createTexture({
Expand Down

0 comments on commit 02b2301

Please sign in to comment.