mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-24 23:43:30 +00:00
Fix and enable -Wfour-char-constants
Bug: dawn:394 Change-Id: Ic11924bf81820f6d3a67bf5d70cce7104e70954f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20581 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
b2d1d7b2ce
commit
c85ef7927f
@ -114,7 +114,6 @@ config("dawn_internal") {
|
|||||||
|
|
||||||
# Flags for -pedantic warnings that haven't been fixed yet.
|
# Flags for -pedantic warnings that haven't been fixed yet.
|
||||||
cflags += [
|
cflags += [
|
||||||
"-Wno-four-char-constants",
|
|
||||||
"-Wno-gnu-anonymous-struct",
|
"-Wno-gnu-anonymous-struct",
|
||||||
"-Wno-gnu-zero-variadic-macro-arguments",
|
"-Wno-gnu-zero-variadic-macro-arguments",
|
||||||
"-Wno-language-extension-token",
|
"-Wno-language-extension-token",
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#include "dawn_native/metal/DeviceMTL.h"
|
#include "dawn_native/metal/DeviceMTL.h"
|
||||||
#include "dawn_native/metal/StagingBufferMTL.h"
|
#include "dawn_native/metal/StagingBufferMTL.h"
|
||||||
|
|
||||||
|
#include <CoreVideo/CVPixelBuffer.h>
|
||||||
|
|
||||||
namespace dawn_native { namespace metal {
|
namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -112,13 +114,13 @@ namespace dawn_native { namespace metal {
|
|||||||
|
|
||||||
ResultOrError<wgpu::TextureFormat> GetFormatEquivalentToIOSurfaceFormat(uint32_t format) {
|
ResultOrError<wgpu::TextureFormat> GetFormatEquivalentToIOSurfaceFormat(uint32_t format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case 'RGBA':
|
case kCVPixelFormatType_32RGBA:
|
||||||
return wgpu::TextureFormat::RGBA8Unorm;
|
return wgpu::TextureFormat::RGBA8Unorm;
|
||||||
case 'BGRA':
|
case kCVPixelFormatType_32BGRA:
|
||||||
return wgpu::TextureFormat::BGRA8Unorm;
|
return wgpu::TextureFormat::BGRA8Unorm;
|
||||||
case '2C08':
|
case kCVPixelFormatType_TwoComponent8:
|
||||||
return wgpu::TextureFormat::RG8Unorm;
|
return wgpu::TextureFormat::RG8Unorm;
|
||||||
case 'L008':
|
case kCVPixelFormatType_OneComponent8:
|
||||||
return wgpu::TextureFormat::R8Unorm;
|
return wgpu::TextureFormat::R8Unorm;
|
||||||
default:
|
default:
|
||||||
return DAWN_VALIDATION_ERROR("Unsupported IOSurface format");
|
return DAWN_VALIDATION_ERROR("Unsupported IOSurface format");
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "utils/WGPUHelpers.h"
|
#include "utils/WGPUHelpers.h"
|
||||||
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
#include <CoreVideo/CVPixelBuffer.h>
|
||||||
#include <IOSurface/IOSurface.h>
|
#include <IOSurface/IOSurface.h>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -115,7 +116,7 @@ namespace {
|
|||||||
class IOSurfaceValidationTests : public IOSurfaceTestBase {
|
class IOSurfaceValidationTests : public IOSurfaceTestBase {
|
||||||
public:
|
public:
|
||||||
IOSurfaceValidationTests() {
|
IOSurfaceValidationTests() {
|
||||||
defaultIOSurface = CreateSinglePlaneIOSurface(10, 10, 'BGRA', 4);
|
defaultIOSurface = CreateSinglePlaneIOSurface(10, 10, kCVPixelFormatType_32BGRA, 4);
|
||||||
|
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
||||||
@ -371,7 +372,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
|||||||
// Test sampling from a R8 IOSurface
|
// Test sampling from a R8 IOSurface
|
||||||
TEST_P(IOSurfaceUsageTests, SampleFromR8IOSurface) {
|
TEST_P(IOSurfaceUsageTests, SampleFromR8IOSurface) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'L008', 1);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, kCVPixelFormatType_OneComponent8, 1);
|
||||||
|
|
||||||
uint8_t data = 0x01;
|
uint8_t data = 0x01;
|
||||||
DoSampleTest(ioSurface.get(), wgpu::TextureFormat::R8Unorm, &data, sizeof(data),
|
DoSampleTest(ioSurface.get(), wgpu::TextureFormat::R8Unorm, &data, sizeof(data),
|
||||||
@ -381,7 +382,7 @@ TEST_P(IOSurfaceUsageTests, SampleFromR8IOSurface) {
|
|||||||
// Test clearing a R8 IOSurface
|
// Test clearing a R8 IOSurface
|
||||||
TEST_P(IOSurfaceUsageTests, ClearR8IOSurface) {
|
TEST_P(IOSurfaceUsageTests, ClearR8IOSurface) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'L008', 1);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, kCVPixelFormatType_OneComponent8, 1);
|
||||||
|
|
||||||
uint8_t data = 0x01;
|
uint8_t data = 0x01;
|
||||||
DoClearTest(ioSurface.get(), wgpu::TextureFormat::R8Unorm, &data, sizeof(data));
|
DoClearTest(ioSurface.get(), wgpu::TextureFormat::R8Unorm, &data, sizeof(data));
|
||||||
@ -390,7 +391,7 @@ TEST_P(IOSurfaceUsageTests, ClearR8IOSurface) {
|
|||||||
// Test sampling from a RG8 IOSurface
|
// Test sampling from a RG8 IOSurface
|
||||||
TEST_P(IOSurfaceUsageTests, SampleFromRG8IOSurface) {
|
TEST_P(IOSurfaceUsageTests, SampleFromRG8IOSurface) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, '2C08', 2);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, kCVPixelFormatType_TwoComponent8, 2);
|
||||||
|
|
||||||
uint16_t data = 0x0102; // Stored as (G, R)
|
uint16_t data = 0x0102; // Stored as (G, R)
|
||||||
DoSampleTest(ioSurface.get(), wgpu::TextureFormat::RG8Unorm, &data, sizeof(data),
|
DoSampleTest(ioSurface.get(), wgpu::TextureFormat::RG8Unorm, &data, sizeof(data),
|
||||||
@ -400,7 +401,7 @@ TEST_P(IOSurfaceUsageTests, SampleFromRG8IOSurface) {
|
|||||||
// Test clearing a RG8 IOSurface
|
// Test clearing a RG8 IOSurface
|
||||||
TEST_P(IOSurfaceUsageTests, ClearRG8IOSurface) {
|
TEST_P(IOSurfaceUsageTests, ClearRG8IOSurface) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, '2C08', 2);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, kCVPixelFormatType_TwoComponent8, 2);
|
||||||
|
|
||||||
uint16_t data = 0x0201;
|
uint16_t data = 0x0201;
|
||||||
DoClearTest(ioSurface.get(), wgpu::TextureFormat::RG8Unorm, &data, sizeof(data));
|
DoClearTest(ioSurface.get(), wgpu::TextureFormat::RG8Unorm, &data, sizeof(data));
|
||||||
@ -409,7 +410,7 @@ TEST_P(IOSurfaceUsageTests, ClearRG8IOSurface) {
|
|||||||
// Test sampling from a BGRA8 IOSurface
|
// Test sampling from a BGRA8 IOSurface
|
||||||
TEST_P(IOSurfaceUsageTests, SampleFromBGRA8IOSurface) {
|
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, kCVPixelFormatType_32BGRA, 4);
|
||||||
|
|
||||||
uint32_t data = 0x01020304; // Stored as (A, R, G, B)
|
uint32_t data = 0x01020304; // Stored as (A, R, G, B)
|
||||||
DoSampleTest(ioSurface.get(), wgpu::TextureFormat::BGRA8Unorm, &data, sizeof(data),
|
DoSampleTest(ioSurface.get(), wgpu::TextureFormat::BGRA8Unorm, &data, sizeof(data),
|
||||||
@ -419,7 +420,7 @@ TEST_P(IOSurfaceUsageTests, SampleFromBGRA8IOSurface) {
|
|||||||
// Test clearing a BGRA8 IOSurface
|
// Test clearing a BGRA8 IOSurface
|
||||||
TEST_P(IOSurfaceUsageTests, ClearBGRA8IOSurface) {
|
TEST_P(IOSurfaceUsageTests, ClearBGRA8IOSurface) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'BGRA', 4);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, kCVPixelFormatType_32BGRA, 4);
|
||||||
|
|
||||||
uint32_t data = 0x04010203;
|
uint32_t data = 0x04010203;
|
||||||
DoClearTest(ioSurface.get(), wgpu::TextureFormat::BGRA8Unorm, &data, sizeof(data));
|
DoClearTest(ioSurface.get(), wgpu::TextureFormat::BGRA8Unorm, &data, sizeof(data));
|
||||||
@ -428,7 +429,7 @@ TEST_P(IOSurfaceUsageTests, ClearBGRA8IOSurface) {
|
|||||||
// Test sampling from an RGBA8 IOSurface
|
// Test sampling from an RGBA8 IOSurface
|
||||||
TEST_P(IOSurfaceUsageTests, SampleFromRGBA8IOSurface) {
|
TEST_P(IOSurfaceUsageTests, SampleFromRGBA8IOSurface) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'RGBA', 4);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, kCVPixelFormatType_32RGBA, 4);
|
||||||
|
|
||||||
uint32_t data = 0x01020304; // Stored as (A, B, G, R)
|
uint32_t data = 0x01020304; // Stored as (A, B, G, R)
|
||||||
DoSampleTest(ioSurface.get(), wgpu::TextureFormat::RGBA8Unorm, &data, sizeof(data),
|
DoSampleTest(ioSurface.get(), wgpu::TextureFormat::RGBA8Unorm, &data, sizeof(data),
|
||||||
@ -438,7 +439,7 @@ TEST_P(IOSurfaceUsageTests, SampleFromRGBA8IOSurface) {
|
|||||||
// Test clearing an RGBA8 IOSurface
|
// Test clearing an RGBA8 IOSurface
|
||||||
TEST_P(IOSurfaceUsageTests, ClearRGBA8IOSurface) {
|
TEST_P(IOSurfaceUsageTests, ClearRGBA8IOSurface) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'RGBA', 4);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, kCVPixelFormatType_32RGBA, 4);
|
||||||
|
|
||||||
uint32_t data = 0x04030201;
|
uint32_t data = 0x04030201;
|
||||||
DoClearTest(ioSurface.get(), wgpu::TextureFormat::RGBA8Unorm, &data, sizeof(data));
|
DoClearTest(ioSurface.get(), wgpu::TextureFormat::RGBA8Unorm, &data, sizeof(data));
|
||||||
@ -448,7 +449,7 @@ TEST_P(IOSurfaceUsageTests, ClearRGBA8IOSurface) {
|
|||||||
TEST_P(IOSurfaceUsageTests, UnclearedTextureIsCleared) {
|
TEST_P(IOSurfaceUsageTests, UnclearedTextureIsCleared) {
|
||||||
DAWN_SKIP_TEST_IF(UsesWire());
|
DAWN_SKIP_TEST_IF(UsesWire());
|
||||||
|
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'RGBA', 4);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, kCVPixelFormatType_32RGBA, 4);
|
||||||
uint32_t data = 0x04030201;
|
uint32_t data = 0x04030201;
|
||||||
|
|
||||||
IOSurfaceLock(ioSurface.get(), 0, nullptr);
|
IOSurfaceLock(ioSurface.get(), 0, nullptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user