WrapIOSurface: Add support for RGBA8
BUG=dawn:112 Change-Id: I18d2e8bc0bcca2725f2087913955c8ecadbd5852 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9642 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Idan Raiter <idanr@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
351ea23830
commit
56f3a7b90d
|
@ -109,6 +109,8 @@ namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
ResultOrError<dawn::TextureFormat> GetFormatEquivalentToIOSurfaceFormat(uint32_t format) {
|
ResultOrError<dawn::TextureFormat> GetFormatEquivalentToIOSurfaceFormat(uint32_t format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
case 'RGBA':
|
||||||
|
return dawn::TextureFormat::RGBA8Unorm;
|
||||||
case 'BGRA':
|
case 'BGRA':
|
||||||
return dawn::TextureFormat::BGRA8Unorm;
|
return dawn::TextureFormat::BGRA8Unorm;
|
||||||
case '2C08':
|
case '2C08':
|
||||||
|
|
|
@ -407,7 +407,7 @@ TEST_P(IOSurfaceUsageTests, ClearRG8IOSurface) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test sampling from a BGRA8 IOSurface
|
// Test sampling from a BGRA8 IOSurface
|
||||||
TEST_P(IOSurfaceUsageTests, SampleFromBGRA8888IOSurface) {
|
TEST_P(IOSurfaceUsageTests, SampleFromBGRA8IOSurface) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'BGRA', 4);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'BGRA', 4);
|
||||||
|
|
||||||
|
@ -425,5 +425,24 @@ TEST_P(IOSurfaceUsageTests, ClearBGRA8IOSurface) {
|
||||||
DoClearTest(ioSurface.get(), dawn::TextureFormat::BGRA8Unorm, &data, sizeof(data));
|
DoClearTest(ioSurface.get(), dawn::TextureFormat::BGRA8Unorm, &data, sizeof(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test sampling from an RGBA8 IOSurface
|
||||||
|
TEST_P(IOSurfaceUsageTests, SampleFromRGBA8IOSurface) {
|
||||||
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'RGBA', 4);
|
||||||
|
|
||||||
|
uint32_t data = 0x01020304; // Stored as (A, B, G, R)
|
||||||
|
DoSampleTest(ioSurface.get(), dawn::TextureFormat::RGBA8Unorm, &data, sizeof(data),
|
||||||
|
RGBA8(4, 3, 2, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test clearing an RGBA8 IOSurface
|
||||||
|
TEST_P(IOSurfaceUsageTests, ClearRGBA8IOSurface) {
|
||||||
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'RGBA', 4);
|
||||||
|
|
||||||
|
uint32_t data = 0x04030201;
|
||||||
|
DoClearTest(ioSurface.get(), dawn::TextureFormat::RGBA8Unorm, &data, sizeof(data));
|
||||||
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(IOSurfaceValidationTests, MetalBackend);
|
DAWN_INSTANTIATE_TEST(IOSurfaceValidationTests, MetalBackend);
|
||||||
DAWN_INSTANTIATE_TEST(IOSurfaceUsageTests, MetalBackend);
|
DAWN_INSTANTIATE_TEST(IOSurfaceUsageTests, MetalBackend);
|
||||||
|
|
Loading…
Reference in New Issue