Make Texture format names match WebGPU
BUG=dawn:128 Change-Id: I73cc77082d02941d91fab8ee578e529db979fed1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8164 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
92cdeaaf81
commit
77fa31c5c6
16
dawn.json
16
dawn.json
|
@ -1034,14 +1034,14 @@
|
||||||
"texture format": {
|
"texture format": {
|
||||||
"category": "enum",
|
"category": "enum",
|
||||||
"values": [
|
"values": [
|
||||||
{"value": 0, "name": "r8 g8 b8 a8 unorm"},
|
{"value": 0, "name": "RGBA8 unorm"},
|
||||||
{"value": 1, "name": "r8 g8 unorm"},
|
{"value": 1, "name": "RG8 unorm"},
|
||||||
{"value": 2, "name": "r8 unorm"},
|
{"value": 2, "name": "R8 unorm"},
|
||||||
{"value": 3, "name": "r8 g8 b8 a8 uint"},
|
{"value": 3, "name": "RGBA8 uint"},
|
||||||
{"value": 4, "name": "r8 g8 uint"},
|
{"value": 4, "name": "RG8 uint"},
|
||||||
{"value": 5, "name": "r8 uint"},
|
{"value": 5, "name": "R8 uint"},
|
||||||
{"value": 6, "name": "b8 g8 r8 a8 unorm"},
|
{"value": 6, "name": "BGRA8 unorm"},
|
||||||
{"value": 7, "name": "d32 float s8 uint"},
|
{"value": 7, "name": "depth24 plus stencil8"},
|
||||||
{"value": 8, "name": "BC1 RGBA unorm"},
|
{"value": 8, "name": "BC1 RGBA unorm"},
|
||||||
{"value": 9, "name": "BC1 RGBA unorm srgb"},
|
{"value": 9, "name": "BC1 RGBA unorm srgb"},
|
||||||
{"value": 10, "name": "BC2 RGBA unorm"},
|
{"value": 10, "name": "BC2 RGBA unorm"},
|
||||||
|
|
|
@ -135,7 +135,7 @@ void initRender() {
|
||||||
descriptor.cVertexInput.cAttributes[2].shaderLocation = 2;
|
descriptor.cVertexInput.cAttributes[2].shaderLocation = 2;
|
||||||
descriptor.cVertexInput.cAttributes[2].format = dawn::VertexFormat::Float2;
|
descriptor.cVertexInput.cAttributes[2].format = dawn::VertexFormat::Float2;
|
||||||
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
||||||
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
|
descriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
|
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
|
||||||
|
|
||||||
renderPipeline = device.CreateRenderPipeline(&descriptor);
|
renderPipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
|
@ -56,7 +56,7 @@ void initTextures() {
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
|
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
|
||||||
texture = device.CreateTexture(&descriptor);
|
texture = device.CreateTexture(&descriptor);
|
||||||
|
@ -130,7 +130,7 @@ void init() {
|
||||||
descriptor.cVertexInput.cBuffers[0].attributeCount = 1;
|
descriptor.cVertexInput.cBuffers[0].attributeCount = 1;
|
||||||
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
|
descriptor.cVertexInput.cAttributes[0].format = dawn::VertexFormat::Float4;
|
||||||
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
||||||
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
|
descriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
|
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
|
@ -203,7 +203,7 @@ void init() {
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragmentStage.module = fsModule;
|
||||||
descriptor.vertexInput = &vertexInput;
|
descriptor.vertexInput = &vertexInput;
|
||||||
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
||||||
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
|
descriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
|
descriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
|
||||||
descriptor.cDepthStencilState.depthWriteEnabled = true;
|
descriptor.cDepthStencilState.depthWriteEnabled = true;
|
||||||
descriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less;
|
descriptor.cDepthStencilState.depthCompare = dawn::CompareFunction::Less;
|
||||||
|
@ -216,7 +216,7 @@ void init() {
|
||||||
pDescriptor.cFragmentStage.module = fsModule;
|
pDescriptor.cFragmentStage.module = fsModule;
|
||||||
pDescriptor.vertexInput = &vertexInput;
|
pDescriptor.vertexInput = &vertexInput;
|
||||||
pDescriptor.depthStencilState = &pDescriptor.cDepthStencilState;
|
pDescriptor.depthStencilState = &pDescriptor.cDepthStencilState;
|
||||||
pDescriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
|
pDescriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
pDescriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
|
pDescriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
|
||||||
pDescriptor.cDepthStencilState.stencilFront.passOp = dawn::StencilOperation::Replace;
|
pDescriptor.cDepthStencilState.stencilFront.passOp = dawn::StencilOperation::Replace;
|
||||||
pDescriptor.cDepthStencilState.stencilBack.passOp = dawn::StencilOperation::Replace;
|
pDescriptor.cDepthStencilState.stencilBack.passOp = dawn::StencilOperation::Replace;
|
||||||
|
@ -230,7 +230,7 @@ void init() {
|
||||||
rfDescriptor.cFragmentStage.module = fsReflectionModule;
|
rfDescriptor.cFragmentStage.module = fsReflectionModule;
|
||||||
rfDescriptor.vertexInput = &vertexInput;
|
rfDescriptor.vertexInput = &vertexInput;
|
||||||
rfDescriptor.depthStencilState = &rfDescriptor.cDepthStencilState;
|
rfDescriptor.depthStencilState = &rfDescriptor.cDepthStencilState;
|
||||||
rfDescriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
|
rfDescriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
rfDescriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
|
rfDescriptor.cColorStates[0]->format = GetPreferredSwapChainTextureFormat();
|
||||||
rfDescriptor.cDepthStencilState.stencilFront.compare = dawn::CompareFunction::Equal;
|
rfDescriptor.cDepthStencilState.stencilFront.compare = dawn::CompareFunction::Equal;
|
||||||
rfDescriptor.cDepthStencilState.stencilBack.compare = dawn::CompareFunction::Equal;
|
rfDescriptor.cDepthStencilState.stencilBack.compare = dawn::CompareFunction::Equal;
|
||||||
|
|
|
@ -163,7 +163,7 @@ dawn::TextureView CreateDefaultDepthStencilView(const dawn::Device& device) {
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::D32FloatS8Uint;
|
descriptor.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||||
auto depthStencilTexture = device.CreateTexture(&descriptor);
|
auto depthStencilTexture = device.CreateTexture(&descriptor);
|
||||||
|
|
|
@ -314,14 +314,14 @@ namespace dawn_native {
|
||||||
case dawn::TextureFormat::R8Unorm:
|
case dawn::TextureFormat::R8Unorm:
|
||||||
case dawn::TextureFormat::R8Uint:
|
case dawn::TextureFormat::R8Uint:
|
||||||
return 1;
|
return 1;
|
||||||
case dawn::TextureFormat::R8G8Unorm:
|
case dawn::TextureFormat::RG8Unorm:
|
||||||
case dawn::TextureFormat::R8G8Uint:
|
case dawn::TextureFormat::RG8Uint:
|
||||||
return 2;
|
return 2;
|
||||||
case dawn::TextureFormat::R8G8B8A8Unorm:
|
case dawn::TextureFormat::RGBA8Unorm:
|
||||||
case dawn::TextureFormat::R8G8B8A8Uint:
|
case dawn::TextureFormat::RGBA8Uint:
|
||||||
case dawn::TextureFormat::B8G8R8A8Unorm:
|
case dawn::TextureFormat::BGRA8Unorm:
|
||||||
return 4;
|
return 4;
|
||||||
case dawn::TextureFormat::D32FloatS8Uint:
|
case dawn::TextureFormat::Depth24PlusStencil8:
|
||||||
return 8;
|
return 8;
|
||||||
|
|
||||||
// BC formats
|
// BC formats
|
||||||
|
@ -349,7 +349,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
bool TextureFormatHasDepth(dawn::TextureFormat format) {
|
bool TextureFormatHasDepth(dawn::TextureFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case dawn::TextureFormat::D32FloatS8Uint:
|
case dawn::TextureFormat::Depth24PlusStencil8:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -358,7 +358,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
bool TextureFormatHasStencil(dawn::TextureFormat format) {
|
bool TextureFormatHasStencil(dawn::TextureFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case dawn::TextureFormat::D32FloatS8Uint:
|
case dawn::TextureFormat::Depth24PlusStencil8:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -367,7 +367,7 @@ namespace dawn_native {
|
||||||
|
|
||||||
bool TextureFormatHasDepthOrStencil(dawn::TextureFormat format) {
|
bool TextureFormatHasDepthOrStencil(dawn::TextureFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case dawn::TextureFormat::D32FloatS8Uint:
|
case dawn::TextureFormat::Depth24PlusStencil8:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -376,16 +376,16 @@ namespace dawn_native {
|
||||||
|
|
||||||
bool IsColorRenderableTextureFormat(dawn::TextureFormat format) {
|
bool IsColorRenderableTextureFormat(dawn::TextureFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case dawn::TextureFormat::B8G8R8A8Unorm:
|
case dawn::TextureFormat::BGRA8Unorm:
|
||||||
case dawn::TextureFormat::R8G8B8A8Uint:
|
case dawn::TextureFormat::RGBA8Uint:
|
||||||
case dawn::TextureFormat::R8G8B8A8Unorm:
|
case dawn::TextureFormat::RGBA8Unorm:
|
||||||
case dawn::TextureFormat::R8G8Uint:
|
case dawn::TextureFormat::RG8Uint:
|
||||||
case dawn::TextureFormat::R8G8Unorm:
|
case dawn::TextureFormat::RG8Unorm:
|
||||||
case dawn::TextureFormat::R8Uint:
|
case dawn::TextureFormat::R8Uint:
|
||||||
case dawn::TextureFormat::R8Unorm:
|
case dawn::TextureFormat::R8Unorm:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case dawn::TextureFormat::D32FloatS8Uint:
|
case dawn::TextureFormat::Depth24PlusStencil8:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -396,14 +396,14 @@ namespace dawn_native {
|
||||||
|
|
||||||
bool IsDepthStencilRenderableTextureFormat(dawn::TextureFormat format) {
|
bool IsDepthStencilRenderableTextureFormat(dawn::TextureFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case dawn::TextureFormat::D32FloatS8Uint:
|
case dawn::TextureFormat::Depth24PlusStencil8:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case dawn::TextureFormat::B8G8R8A8Unorm:
|
case dawn::TextureFormat::BGRA8Unorm:
|
||||||
case dawn::TextureFormat::R8G8B8A8Uint:
|
case dawn::TextureFormat::RGBA8Uint:
|
||||||
case dawn::TextureFormat::R8G8B8A8Unorm:
|
case dawn::TextureFormat::RGBA8Unorm:
|
||||||
case dawn::TextureFormat::R8G8Uint:
|
case dawn::TextureFormat::RG8Uint:
|
||||||
case dawn::TextureFormat::R8G8Unorm:
|
case dawn::TextureFormat::RG8Unorm:
|
||||||
case dawn::TextureFormat::R8Uint:
|
case dawn::TextureFormat::R8Uint:
|
||||||
case dawn::TextureFormat::R8Unorm:
|
case dawn::TextureFormat::R8Unorm:
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
}
|
}
|
||||||
|
|
||||||
dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
|
dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
|
||||||
return dawn::TextureFormat::R8G8B8A8Unorm;
|
return dawn::TextureFormat::RGBA8Unorm;
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace dawn_native::d3d12
|
}} // namespace dawn_native::d3d12
|
||||||
|
|
|
@ -93,21 +93,21 @@ namespace dawn_native { namespace d3d12 {
|
||||||
|
|
||||||
DXGI_FORMAT D3D12TextureFormat(dawn::TextureFormat format) {
|
DXGI_FORMAT D3D12TextureFormat(dawn::TextureFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case dawn::TextureFormat::R8G8B8A8Unorm:
|
case dawn::TextureFormat::RGBA8Unorm:
|
||||||
return DXGI_FORMAT_R8G8B8A8_UNORM;
|
return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||||
case dawn::TextureFormat::R8G8Unorm:
|
case dawn::TextureFormat::RG8Unorm:
|
||||||
return DXGI_FORMAT_R8G8_UNORM;
|
return DXGI_FORMAT_R8G8_UNORM;
|
||||||
case dawn::TextureFormat::R8Unorm:
|
case dawn::TextureFormat::R8Unorm:
|
||||||
return DXGI_FORMAT_R8_UNORM;
|
return DXGI_FORMAT_R8_UNORM;
|
||||||
case dawn::TextureFormat::R8G8B8A8Uint:
|
case dawn::TextureFormat::RGBA8Uint:
|
||||||
return DXGI_FORMAT_R8G8B8A8_UINT;
|
return DXGI_FORMAT_R8G8B8A8_UINT;
|
||||||
case dawn::TextureFormat::R8G8Uint:
|
case dawn::TextureFormat::RG8Uint:
|
||||||
return DXGI_FORMAT_R8G8_UINT;
|
return DXGI_FORMAT_R8G8_UINT;
|
||||||
case dawn::TextureFormat::R8Uint:
|
case dawn::TextureFormat::R8Uint:
|
||||||
return DXGI_FORMAT_R8_UINT;
|
return DXGI_FORMAT_R8_UINT;
|
||||||
case dawn::TextureFormat::B8G8R8A8Unorm:
|
case dawn::TextureFormat::BGRA8Unorm:
|
||||||
return DXGI_FORMAT_B8G8R8A8_UNORM;
|
return DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||||
case dawn::TextureFormat::D32FloatS8Uint:
|
case dawn::TextureFormat::Depth24PlusStencil8:
|
||||||
return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
|
return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
|
|
@ -108,9 +108,9 @@ namespace dawn_native { namespace metal {
|
||||||
ResultOrError<dawn::TextureFormat> GetFormatEquivalentToIOSurfaceFormat(uint32_t format) {
|
ResultOrError<dawn::TextureFormat> GetFormatEquivalentToIOSurfaceFormat(uint32_t format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case 'BGRA':
|
case 'BGRA':
|
||||||
return dawn::TextureFormat::B8G8R8A8Unorm;
|
return dawn::TextureFormat::BGRA8Unorm;
|
||||||
case '2C08':
|
case '2C08':
|
||||||
return dawn::TextureFormat::R8G8Unorm;
|
return dawn::TextureFormat::RG8Unorm;
|
||||||
case 'L008':
|
case 'L008':
|
||||||
return dawn::TextureFormat::R8Unorm;
|
return dawn::TextureFormat::R8Unorm;
|
||||||
default:
|
default:
|
||||||
|
@ -121,21 +121,21 @@ namespace dawn_native { namespace metal {
|
||||||
|
|
||||||
MTLPixelFormat MetalPixelFormat(dawn::TextureFormat format) {
|
MTLPixelFormat MetalPixelFormat(dawn::TextureFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case dawn::TextureFormat::R8G8B8A8Unorm:
|
case dawn::TextureFormat::RGBA8Unorm:
|
||||||
return MTLPixelFormatRGBA8Unorm;
|
return MTLPixelFormatRGBA8Unorm;
|
||||||
case dawn::TextureFormat::R8G8Unorm:
|
case dawn::TextureFormat::RG8Unorm:
|
||||||
return MTLPixelFormatRG8Unorm;
|
return MTLPixelFormatRG8Unorm;
|
||||||
case dawn::TextureFormat::R8Unorm:
|
case dawn::TextureFormat::R8Unorm:
|
||||||
return MTLPixelFormatR8Unorm;
|
return MTLPixelFormatR8Unorm;
|
||||||
case dawn::TextureFormat::R8G8B8A8Uint:
|
case dawn::TextureFormat::RGBA8Uint:
|
||||||
return MTLPixelFormatRGBA8Uint;
|
return MTLPixelFormatRGBA8Uint;
|
||||||
case dawn::TextureFormat::R8G8Uint:
|
case dawn::TextureFormat::RG8Uint:
|
||||||
return MTLPixelFormatRG8Uint;
|
return MTLPixelFormatRG8Uint;
|
||||||
case dawn::TextureFormat::R8Uint:
|
case dawn::TextureFormat::R8Uint:
|
||||||
return MTLPixelFormatR8Uint;
|
return MTLPixelFormatR8Uint;
|
||||||
case dawn::TextureFormat::B8G8R8A8Unorm:
|
case dawn::TextureFormat::BGRA8Unorm:
|
||||||
return MTLPixelFormatBGRA8Unorm;
|
return MTLPixelFormatBGRA8Unorm;
|
||||||
case dawn::TextureFormat::D32FloatS8Uint:
|
case dawn::TextureFormat::Depth24PlusStencil8:
|
||||||
return MTLPixelFormatDepth32Float_Stencil8;
|
return MTLPixelFormatDepth32Float_Stencil8;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
|
|
@ -350,7 +350,7 @@ namespace dawn_native { namespace null {
|
||||||
}
|
}
|
||||||
|
|
||||||
dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
|
dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
|
||||||
return dawn::TextureFormat::R8G8B8A8Unorm;
|
return dawn::TextureFormat::RGBA8Unorm;
|
||||||
}
|
}
|
||||||
|
|
||||||
// StagingBuffer
|
// StagingBuffer
|
||||||
|
|
|
@ -131,7 +131,7 @@ namespace dawn_native { namespace opengl {
|
||||||
|
|
||||||
GLint GetStencilMaskFromStencilFormat(dawn::TextureFormat depthStencilFormat) {
|
GLint GetStencilMaskFromStencilFormat(dawn::TextureFormat depthStencilFormat) {
|
||||||
switch (depthStencilFormat) {
|
switch (depthStencilFormat) {
|
||||||
case dawn::TextureFormat::D32FloatS8Uint:
|
case dawn::TextureFormat::Depth24PlusStencil8:
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -583,10 +583,10 @@ namespace dawn_native { namespace opengl {
|
||||||
// TODO(kainino@chromium.org): the color clears (later in
|
// TODO(kainino@chromium.org): the color clears (later in
|
||||||
// this function) may be undefined for non-normalized integer formats.
|
// this function) may be undefined for non-normalized integer formats.
|
||||||
dawn::TextureFormat format = textureView->GetTexture()->GetFormat();
|
dawn::TextureFormat format = textureView->GetTexture()->GetFormat();
|
||||||
ASSERT(format == dawn::TextureFormat::R8G8B8A8Unorm ||
|
ASSERT(format == dawn::TextureFormat::RGBA8Unorm ||
|
||||||
format == dawn::TextureFormat::R8G8Unorm ||
|
format == dawn::TextureFormat::RG8Unorm ||
|
||||||
format == dawn::TextureFormat::R8Unorm ||
|
format == dawn::TextureFormat::R8Unorm ||
|
||||||
format == dawn::TextureFormat::B8G8R8A8Unorm);
|
format == dawn::TextureFormat::BGRA8Unorm);
|
||||||
}
|
}
|
||||||
gl.DrawBuffers(attachmentCount, drawBuffers.data());
|
gl.DrawBuffers(attachmentCount, drawBuffers.data());
|
||||||
|
|
||||||
|
@ -614,7 +614,7 @@ namespace dawn_native { namespace opengl {
|
||||||
|
|
||||||
// TODO(kainino@chromium.org): the depth/stencil clears (later in
|
// TODO(kainino@chromium.org): the depth/stencil clears (later in
|
||||||
// this function) may be undefined for other texture formats.
|
// this function) may be undefined for other texture formats.
|
||||||
ASSERT(format == dawn::TextureFormat::D32FloatS8Uint);
|
ASSERT(format == dawn::TextureFormat::Depth24PlusStencil8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace dawn_native { namespace opengl {
|
||||||
DawnTextureUsageBit usage,
|
DawnTextureUsageBit usage,
|
||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height) {
|
uint32_t height) {
|
||||||
if (format != DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM) {
|
if (format != DAWN_TEXTURE_FORMAT_RGBA8_UNORM) {
|
||||||
return "unsupported format";
|
return "unsupported format";
|
||||||
}
|
}
|
||||||
ASSERT(width > 0);
|
ASSERT(width > 0);
|
||||||
|
@ -81,7 +81,7 @@ namespace dawn_native { namespace opengl {
|
||||||
}
|
}
|
||||||
|
|
||||||
dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
|
dawn::TextureFormat NativeSwapChainImpl::GetPreferredFormat() const {
|
||||||
return dawn::TextureFormat::R8G8B8A8Unorm;
|
return dawn::TextureFormat::RGBA8Unorm;
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace dawn_native::opengl
|
}} // namespace dawn_native::opengl
|
||||||
|
|
|
@ -64,22 +64,22 @@ namespace dawn_native { namespace opengl {
|
||||||
|
|
||||||
TextureFormatInfo GetGLFormatInfo(dawn::TextureFormat format) {
|
TextureFormatInfo GetGLFormatInfo(dawn::TextureFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case dawn::TextureFormat::R8G8B8A8Unorm:
|
case dawn::TextureFormat::RGBA8Unorm:
|
||||||
return {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE};
|
return {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE};
|
||||||
case dawn::TextureFormat::R8G8Unorm:
|
case dawn::TextureFormat::RG8Unorm:
|
||||||
return {GL_RG8, GL_RG, GL_UNSIGNED_BYTE};
|
return {GL_RG8, GL_RG, GL_UNSIGNED_BYTE};
|
||||||
case dawn::TextureFormat::R8Unorm:
|
case dawn::TextureFormat::R8Unorm:
|
||||||
return {GL_R8, GL_RED, GL_UNSIGNED_BYTE};
|
return {GL_R8, GL_RED, GL_UNSIGNED_BYTE};
|
||||||
case dawn::TextureFormat::R8G8B8A8Uint:
|
case dawn::TextureFormat::RGBA8Uint:
|
||||||
return {GL_RGBA8UI, GL_RGBA, GL_UNSIGNED_INT};
|
return {GL_RGBA8UI, GL_RGBA, GL_UNSIGNED_INT};
|
||||||
case dawn::TextureFormat::R8G8Uint:
|
case dawn::TextureFormat::RG8Uint:
|
||||||
return {GL_RG8UI, GL_RG, GL_UNSIGNED_INT};
|
return {GL_RG8UI, GL_RG, GL_UNSIGNED_INT};
|
||||||
case dawn::TextureFormat::R8Uint:
|
case dawn::TextureFormat::R8Uint:
|
||||||
return {GL_R8UI, GL_RED, GL_UNSIGNED_INT};
|
return {GL_R8UI, GL_RED, GL_UNSIGNED_INT};
|
||||||
case dawn::TextureFormat::B8G8R8A8Unorm:
|
case dawn::TextureFormat::BGRA8Unorm:
|
||||||
// This doesn't have an enum for the internal format in OpenGL, so use RGBA8.
|
// This doesn't have an enum for the internal format in OpenGL, so use RGBA8.
|
||||||
return {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE};
|
return {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE};
|
||||||
case dawn::TextureFormat::D32FloatS8Uint:
|
case dawn::TextureFormat::Depth24PlusStencil8:
|
||||||
return {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL,
|
return {GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL,
|
||||||
GL_FLOAT_32_UNSIGNED_INT_24_8_REV};
|
GL_FLOAT_32_UNSIGNED_INT_24_8_REV};
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
// driver. Need to generalize
|
// driver. Need to generalize
|
||||||
config->nativeFormat = VK_FORMAT_B8G8R8A8_UNORM;
|
config->nativeFormat = VK_FORMAT_B8G8R8A8_UNORM;
|
||||||
config->colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
|
config->colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
|
||||||
config->format = dawn::TextureFormat::B8G8R8A8Unorm;
|
config->format = dawn::TextureFormat::BGRA8Unorm;
|
||||||
config->minImageCount = 3;
|
config->minImageCount = 3;
|
||||||
// TODO(cwallez@chromium.org): This is upside down compared to what we want, at least
|
// TODO(cwallez@chromium.org): This is upside down compared to what we want, at least
|
||||||
// on Linux
|
// on Linux
|
||||||
|
|
|
@ -213,21 +213,21 @@ namespace dawn_native { namespace vulkan {
|
||||||
// Converts Dawn texture format to Vulkan formats.
|
// Converts Dawn texture format to Vulkan formats.
|
||||||
VkFormat VulkanImageFormat(dawn::TextureFormat format) {
|
VkFormat VulkanImageFormat(dawn::TextureFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case dawn::TextureFormat::R8G8B8A8Unorm:
|
case dawn::TextureFormat::RGBA8Unorm:
|
||||||
return VK_FORMAT_R8G8B8A8_UNORM;
|
return VK_FORMAT_R8G8B8A8_UNORM;
|
||||||
case dawn::TextureFormat::R8G8Unorm:
|
case dawn::TextureFormat::RG8Unorm:
|
||||||
return VK_FORMAT_R8G8_UNORM;
|
return VK_FORMAT_R8G8_UNORM;
|
||||||
case dawn::TextureFormat::R8Unorm:
|
case dawn::TextureFormat::R8Unorm:
|
||||||
return VK_FORMAT_R8_UNORM;
|
return VK_FORMAT_R8_UNORM;
|
||||||
case dawn::TextureFormat::R8G8B8A8Uint:
|
case dawn::TextureFormat::RGBA8Uint:
|
||||||
return VK_FORMAT_R8G8B8A8_UINT;
|
return VK_FORMAT_R8G8B8A8_UINT;
|
||||||
case dawn::TextureFormat::R8G8Uint:
|
case dawn::TextureFormat::RG8Uint:
|
||||||
return VK_FORMAT_R8G8_UINT;
|
return VK_FORMAT_R8G8_UINT;
|
||||||
case dawn::TextureFormat::R8Uint:
|
case dawn::TextureFormat::R8Uint:
|
||||||
return VK_FORMAT_R8_UINT;
|
return VK_FORMAT_R8_UINT;
|
||||||
case dawn::TextureFormat::B8G8R8A8Unorm:
|
case dawn::TextureFormat::BGRA8Unorm:
|
||||||
return VK_FORMAT_B8G8R8A8_UNORM;
|
return VK_FORMAT_B8G8R8A8_UNORM;
|
||||||
case dawn::TextureFormat::D32FloatS8Uint:
|
case dawn::TextureFormat::Depth24PlusStencil8:
|
||||||
return VK_FORMAT_D32_SFLOAT_S8_UINT;
|
return VK_FORMAT_D32_SFLOAT_S8_UINT;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
|
|
@ -247,7 +247,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
|
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
|
||||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
|
@ -72,8 +72,9 @@ class ClipSpaceTest : public DawnTest {
|
||||||
|
|
||||||
// Test that the clip space is correctly configured.
|
// Test that the clip space is correctly configured.
|
||||||
TEST_P(ClipSpaceTest, ClipSpace) {
|
TEST_P(ClipSpaceTest, ClipSpace) {
|
||||||
dawn::Texture colorTexture = Create2DTextureForTest(dawn::TextureFormat::R8G8B8A8Unorm);
|
dawn::Texture colorTexture = Create2DTextureForTest(dawn::TextureFormat::RGBA8Unorm);
|
||||||
dawn::Texture depthStencilTexture = Create2DTextureForTest(dawn::TextureFormat::D32FloatS8Uint);
|
dawn::Texture depthStencilTexture =
|
||||||
|
Create2DTextureForTest(dawn::TextureFormat::Depth24PlusStencil8);
|
||||||
|
|
||||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||||
{colorTexture.CreateDefaultView()}, depthStencilTexture.CreateDefaultView());
|
{colorTexture.CreateDefaultView()}, depthStencilTexture.CreateDefaultView());
|
||||||
|
|
|
@ -760,7 +760,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ class CopyTests_T2B : public CopyTests {
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = textureSpec.arraySize;
|
descriptor.arrayLayerCount = textureSpec.arraySize;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = textureSpec.level + 1;
|
descriptor.mipLevelCount = textureSpec.level + 1;
|
||||||
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc;
|
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc;
|
||||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
@ -196,7 +196,7 @@ protected:
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = textureSpec.level + 1;
|
descriptor.mipLevelCount = textureSpec.level + 1;
|
||||||
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc;
|
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc;
|
||||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
@ -275,7 +275,7 @@ class CopyTests_T2T : public CopyTests {
|
||||||
srcDescriptor.size.depth = 1;
|
srcDescriptor.size.depth = 1;
|
||||||
srcDescriptor.arrayLayerCount = srcSpec.arraySize;
|
srcDescriptor.arrayLayerCount = srcSpec.arraySize;
|
||||||
srcDescriptor.sampleCount = 1;
|
srcDescriptor.sampleCount = 1;
|
||||||
srcDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
srcDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
srcDescriptor.mipLevelCount = srcSpec.level + 1;
|
srcDescriptor.mipLevelCount = srcSpec.level + 1;
|
||||||
srcDescriptor.usage =
|
srcDescriptor.usage =
|
||||||
dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst;
|
dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst;
|
||||||
|
@ -288,7 +288,7 @@ class CopyTests_T2T : public CopyTests {
|
||||||
dstDescriptor.size.depth = 1;
|
dstDescriptor.size.depth = 1;
|
||||||
dstDescriptor.arrayLayerCount = dstSpec.arraySize;
|
dstDescriptor.arrayLayerCount = dstSpec.arraySize;
|
||||||
dstDescriptor.sampleCount = 1;
|
dstDescriptor.sampleCount = 1;
|
||||||
dstDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
dstDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
dstDescriptor.mipLevelCount = dstSpec.level + 1;
|
dstDescriptor.mipLevelCount = dstSpec.level + 1;
|
||||||
dstDescriptor.usage =
|
dstDescriptor.usage =
|
||||||
dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst;
|
dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst;
|
||||||
|
|
|
@ -32,7 +32,7 @@ class DepthStencilStateTest : public DawnTest {
|
||||||
renderTargetDescriptor.size.depth = 1;
|
renderTargetDescriptor.size.depth = 1;
|
||||||
renderTargetDescriptor.arrayLayerCount = 1;
|
renderTargetDescriptor.arrayLayerCount = 1;
|
||||||
renderTargetDescriptor.sampleCount = 1;
|
renderTargetDescriptor.sampleCount = 1;
|
||||||
renderTargetDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
renderTargetDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
renderTargetDescriptor.mipLevelCount = 1;
|
renderTargetDescriptor.mipLevelCount = 1;
|
||||||
renderTargetDescriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
renderTargetDescriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||||
renderTarget = device.CreateTexture(&renderTargetDescriptor);
|
renderTarget = device.CreateTexture(&renderTargetDescriptor);
|
||||||
|
@ -46,7 +46,7 @@ class DepthStencilStateTest : public DawnTest {
|
||||||
depthDescriptor.size.depth = 1;
|
depthDescriptor.size.depth = 1;
|
||||||
depthDescriptor.arrayLayerCount = 1;
|
depthDescriptor.arrayLayerCount = 1;
|
||||||
depthDescriptor.sampleCount = 1;
|
depthDescriptor.sampleCount = 1;
|
||||||
depthDescriptor.format = dawn::TextureFormat::D32FloatS8Uint;
|
depthDescriptor.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
depthDescriptor.mipLevelCount = 1;
|
depthDescriptor.mipLevelCount = 1;
|
||||||
depthDescriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
depthDescriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||||
depthTexture = device.CreateTexture(&depthDescriptor);
|
depthTexture = device.CreateTexture(&depthDescriptor);
|
||||||
|
@ -276,7 +276,7 @@ class DepthStencilStateTest : public DawnTest {
|
||||||
descriptor.cVertexStage.module = vsModule;
|
descriptor.cVertexStage.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragmentStage.module = fsModule;
|
||||||
descriptor.cDepthStencilState = test.depthStencilState;
|
descriptor.cDepthStencilState = test.depthStencilState;
|
||||||
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
|
descriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
||||||
|
|
||||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
|
|
|
@ -89,7 +89,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||||
pipelineDescriptor.cVertexStage.module = vsModule;
|
pipelineDescriptor.cVertexStage.module = vsModule;
|
||||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||||
pipelineDescriptor.cColorStates[0]->format = dawn::TextureFormat::R8G8B8A8Unorm;
|
pipelineDescriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
dawn::PipelineLayout pipelineLayout =
|
dawn::PipelineLayout pipelineLayout =
|
||||||
utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
||||||
pipelineDescriptor.layout = pipelineLayout;
|
pipelineDescriptor.layout = pipelineLayout;
|
||||||
|
|
|
@ -113,7 +113,7 @@ class IOSurfaceValidationTests : public IOSurfaceTestBase {
|
||||||
defaultIOSurface = CreateSinglePlaneIOSurface(10, 10, 'BGRA', 4);
|
defaultIOSurface = CreateSinglePlaneIOSurface(10, 10, 'BGRA', 4);
|
||||||
|
|
||||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||||
descriptor.format = dawn::TextureFormat::B8G8R8A8Unorm;
|
descriptor.format = dawn::TextureFormat::BGRA8Unorm;
|
||||||
descriptor.size = {10, 10, 1};
|
descriptor.size = {10, 10, 1};
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
|
@ -305,7 +305,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
||||||
descriptor.cVertexStage.module = vs;
|
descriptor.cVertexStage.module = vs;
|
||||||
descriptor.cFragmentStage.module = fs;
|
descriptor.cFragmentStage.module = fs;
|
||||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||||
descriptor.cColorStates[0]->format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||||
}
|
}
|
||||||
|
@ -392,7 +392,7 @@ TEST_P(IOSurfaceUsageTests, SampleFromRG8IOSurface) {
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, '2C08', 2);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, '2C08', 2);
|
||||||
|
|
||||||
uint16_t data = 0x0102; // Stored as (G, R)
|
uint16_t data = 0x0102; // Stored as (G, R)
|
||||||
DoSampleTest(ioSurface.get(), dawn::TextureFormat::R8G8Unorm, &data, sizeof(data),
|
DoSampleTest(ioSurface.get(), dawn::TextureFormat::RG8Unorm, &data, sizeof(data),
|
||||||
RGBA8(2, 1, 0, 255));
|
RGBA8(2, 1, 0, 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ TEST_P(IOSurfaceUsageTests, ClearRG8IOSurface) {
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, '2C08', 2);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, '2C08', 2);
|
||||||
|
|
||||||
uint16_t data = 0x0201;
|
uint16_t data = 0x0201;
|
||||||
DoClearTest(ioSurface.get(), dawn::TextureFormat::R8G8Unorm, &data, sizeof(data));
|
DoClearTest(ioSurface.get(), dawn::TextureFormat::RG8Unorm, &data, sizeof(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test sampling from a BGRA8 IOSurface
|
// Test sampling from a BGRA8 IOSurface
|
||||||
|
@ -411,7 +411,7 @@ TEST_P(IOSurfaceUsageTests, SampleFromBGRA8888IOSurface) {
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'BGRA', 4);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'BGRA', 4);
|
||||||
|
|
||||||
uint32_t data = 0x01020304; // Stored as (A, R, G, B)
|
uint32_t data = 0x01020304; // Stored as (A, R, G, B)
|
||||||
DoSampleTest(ioSurface.get(), dawn::TextureFormat::B8G8R8A8Unorm, &data, sizeof(data),
|
DoSampleTest(ioSurface.get(), dawn::TextureFormat::BGRA8Unorm, &data, sizeof(data),
|
||||||
RGBA8(2, 3, 4, 1));
|
RGBA8(2, 3, 4, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ TEST_P(IOSurfaceUsageTests, ClearBGRA8IOSurface) {
|
||||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'BGRA', 4);
|
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'BGRA', 4);
|
||||||
|
|
||||||
uint32_t data = 0x04010203;
|
uint32_t data = 0x04010203;
|
||||||
DoClearTest(ioSurface.get(), dawn::TextureFormat::B8G8R8A8Unorm, &data, sizeof(data));
|
DoClearTest(ioSurface.get(), dawn::TextureFormat::BGRA8Unorm, &data, sizeof(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(IOSurfaceValidationTests, MetalBackend);
|
DAWN_INSTANTIATE_TEST(IOSurfaceValidationTests, MetalBackend);
|
||||||
|
|
|
@ -173,8 +173,9 @@ class MultisampledRenderingTest : public DawnTest {
|
||||||
constexpr static uint32_t kWidth = 3;
|
constexpr static uint32_t kWidth = 3;
|
||||||
constexpr static uint32_t kHeight = 3;
|
constexpr static uint32_t kHeight = 3;
|
||||||
constexpr static uint32_t kSampleCount = 4;
|
constexpr static uint32_t kSampleCount = 4;
|
||||||
constexpr static dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
constexpr static dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||||
constexpr static dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::D32FloatS8Uint;
|
constexpr static dawn::TextureFormat kDepthStencilFormat =
|
||||||
|
dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
|
|
||||||
dawn::TextureView mMultisampledColorView;
|
dawn::TextureView mMultisampledColorView;
|
||||||
dawn::Texture mResolveTexture;
|
dawn::Texture mResolveTexture;
|
||||||
|
|
|
@ -35,7 +35,7 @@ TEST_P(NonzeroTextureCreationTests, TextureCreationClearsOneBits) {
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
@ -55,7 +55,7 @@ TEST_P(NonzeroTextureCreationTests, MipMapClears) {
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = mipLevels;
|
descriptor.mipLevelCount = mipLevels;
|
||||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
@ -80,7 +80,7 @@ TEST_P(NonzeroTextureCreationTests, ArrayLayerClears) {
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = arrayLayers;
|
descriptor.arrayLayerCount = arrayLayers;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
|
@ -64,7 +64,7 @@ class RenderPassLoadOpTests : public DawnTest {
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||||
renderTarget = device.CreateTexture(&descriptor);
|
renderTarget = device.CreateTexture(&descriptor);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "utils/DawnHelpers.h"
|
#include "utils/DawnHelpers.h"
|
||||||
|
|
||||||
constexpr uint32_t kRTSize = 16;
|
constexpr uint32_t kRTSize = 16;
|
||||||
constexpr dawn::TextureFormat kFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
constexpr dawn::TextureFormat kFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
class RenderPassTest : public DawnTest {
|
class RenderPassTest : public DawnTest {
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -88,7 +88,7 @@ protected:
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
|
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
|
||||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
constexpr static unsigned int kRTSize = 64;
|
constexpr static unsigned int kRTSize = 64;
|
||||||
constexpr dawn::TextureFormat kDefaultFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
constexpr dawn::TextureFormat kDefaultFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||||
constexpr uint32_t kBytesPerTexel = 4;
|
constexpr uint32_t kBytesPerTexel = 4;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -32,7 +32,7 @@ class TextureZeroInitTest : public DawnTest {
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.arrayLayerCount = arrayLayerCount;
|
descriptor.arrayLayerCount = arrayLayerCount;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = mipLevelCount;
|
descriptor.mipLevelCount = mipLevelCount;
|
||||||
descriptor.usage = usage;
|
descriptor.usage = usage;
|
||||||
return descriptor;
|
return descriptor;
|
||||||
|
@ -40,7 +40,7 @@ class TextureZeroInitTest : public DawnTest {
|
||||||
dawn::TextureViewDescriptor CreateTextureViewDescriptor(uint32_t baseMipLevel,
|
dawn::TextureViewDescriptor CreateTextureViewDescriptor(uint32_t baseMipLevel,
|
||||||
uint32_t baseArrayLayer) {
|
uint32_t baseArrayLayer) {
|
||||||
dawn::TextureViewDescriptor descriptor;
|
dawn::TextureViewDescriptor descriptor;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.baseArrayLayer = baseArrayLayer;
|
descriptor.baseArrayLayer = baseArrayLayer;
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
descriptor.baseMipLevel = baseMipLevel;
|
descriptor.baseMipLevel = baseMipLevel;
|
||||||
|
@ -73,7 +73,7 @@ TEST_P(TextureZeroInitTest, MipMapClearsToZero) {
|
||||||
dawn::TextureView view = texture.CreateView(&viewDescriptor);
|
dawn::TextureView view = texture.CreateView(&viewDescriptor);
|
||||||
|
|
||||||
utils::BasicRenderPass renderPass =
|
utils::BasicRenderPass renderPass =
|
||||||
utils::BasicRenderPass(kSize, kSize, texture, dawn::TextureFormat::R8G8B8A8Unorm);
|
utils::BasicRenderPass(kSize, kSize, texture, dawn::TextureFormat::RGBA8Unorm);
|
||||||
|
|
||||||
renderPass.renderPassInfo.cColorAttachmentsInfoPtr[0]->attachment = view;
|
renderPass.renderPassInfo.cColorAttachmentsInfoPtr[0]->attachment = view;
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
@ -102,7 +102,7 @@ TEST_P(TextureZeroInitTest, ArrayLayerClearsToZero) {
|
||||||
dawn::TextureView view = texture.CreateView(&viewDescriptor);
|
dawn::TextureView view = texture.CreateView(&viewDescriptor);
|
||||||
|
|
||||||
utils::BasicRenderPass renderPass =
|
utils::BasicRenderPass renderPass =
|
||||||
utils::BasicRenderPass(kSize, kSize, texture, dawn::TextureFormat::R8G8B8A8Unorm);
|
utils::BasicRenderPass(kSize, kSize, texture, dawn::TextureFormat::RGBA8Unorm);
|
||||||
|
|
||||||
renderPass.renderPassInfo.cColorAttachmentsInfoPtr[0]->attachment = view;
|
renderPass.renderPassInfo.cColorAttachmentsInfoPtr[0]->attachment = view;
|
||||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
|
|
@ -44,7 +44,7 @@ class BindGroupValidationTest : public ValidationTest {
|
||||||
descriptor.size = {16, 16, 1};
|
descriptor.size = {16, 16, 1};
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = dawn::TextureUsageBit::Sampled;
|
descriptor.usage = dawn::TextureUsageBit::Sampled;
|
||||||
mSampledTexture = device.CreateTexture(&descriptor);
|
mSampledTexture = device.CreateTexture(&descriptor);
|
||||||
|
@ -216,7 +216,7 @@ TEST_F(BindGroupValidationTest, TextureBindingType) {
|
||||||
// Setting the texture view to an error texture view is an error.
|
// Setting the texture view to an error texture view is an error.
|
||||||
{
|
{
|
||||||
dawn::TextureViewDescriptor viewDesc;
|
dawn::TextureViewDescriptor viewDesc;
|
||||||
viewDesc.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
viewDesc.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
viewDesc.dimension = dawn::TextureViewDimension::e2D;
|
viewDesc.dimension = dawn::TextureViewDimension::e2D;
|
||||||
viewDesc.baseMipLevel = 0;
|
viewDesc.baseMipLevel = 0;
|
||||||
viewDesc.mipLevelCount = 0;
|
viewDesc.mipLevelCount = 0;
|
||||||
|
@ -298,7 +298,7 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
|
||||||
descriptor.size = {16, 16, 1};
|
descriptor.size = {16, 16, 1};
|
||||||
descriptor.arrayLayerCount = 1;
|
descriptor.arrayLayerCount = 1;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||||
dawn::Texture outputTexture = device.CreateTexture(&descriptor);
|
dawn::Texture outputTexture = device.CreateTexture(&descriptor);
|
||||||
|
|
|
@ -238,7 +238,7 @@ TEST_F(CommandBufferValidationTest, TextureWithReadAndWriteUsage) {
|
||||||
// Create a texture that will be used both as a sampled texture and a render target
|
// Create a texture that will be used both as a sampled texture and a render target
|
||||||
dawn::TextureDescriptor textureDescriptor;
|
dawn::TextureDescriptor textureDescriptor;
|
||||||
textureDescriptor.usage = dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::OutputAttachment;
|
textureDescriptor.usage = dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::OutputAttachment;
|
||||||
textureDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
textureDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
textureDescriptor.dimension = dawn::TextureDimension::e2D;
|
textureDescriptor.dimension = dawn::TextureDimension::e2D;
|
||||||
textureDescriptor.size = {1, 1, 1};
|
textureDescriptor.size = {1, 1, 1};
|
||||||
textureDescriptor.arrayLayerCount = 1;
|
textureDescriptor.arrayLayerCount = 1;
|
||||||
|
|
|
@ -48,9 +48,9 @@ class CopyCommandTest : public ValidationTest {
|
||||||
// TODO(jiawei.shao@intel.com): support more pixel formats
|
// TODO(jiawei.shao@intel.com): support more pixel formats
|
||||||
uint32_t TextureFormatPixelSize(dawn::TextureFormat format) {
|
uint32_t TextureFormatPixelSize(dawn::TextureFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case dawn::TextureFormat::R8G8Unorm:
|
case dawn::TextureFormat::RG8Unorm:
|
||||||
return 2;
|
return 2;
|
||||||
case dawn::TextureFormat::R8G8B8A8Unorm:
|
case dawn::TextureFormat::RGBA8Unorm:
|
||||||
return 4;
|
return 4;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -62,7 +62,7 @@ class CopyCommandTest : public ValidationTest {
|
||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height,
|
uint32_t height,
|
||||||
uint32_t depth,
|
uint32_t depth,
|
||||||
dawn::TextureFormat format = dawn::TextureFormat::R8G8B8A8Unorm) {
|
dawn::TextureFormat format = dawn::TextureFormat::RGBA8Unorm) {
|
||||||
uint32_t bytesPerPixel = TextureFormatPixelSize(format);
|
uint32_t bytesPerPixel = TextureFormatPixelSize(format);
|
||||||
uint32_t rowPitch = Align(width * bytesPerPixel, kTextureRowPitchAlignment);
|
uint32_t rowPitch = Align(width * bytesPerPixel, kTextureRowPitchAlignment);
|
||||||
return (rowPitch * (height - 1) + width * bytesPerPixel) * depth;
|
return (rowPitch * (height - 1) + width * bytesPerPixel) * depth;
|
||||||
|
@ -270,8 +270,8 @@ class CopyCommandTest_B2T : public CopyCommandTest {
|
||||||
TEST_F(CopyCommandTest_B2T, Success) {
|
TEST_F(CopyCommandTest_B2T, Success) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// Different copies, including some that touch the OOB condition
|
// Different copies, including some that touch the OOB condition
|
||||||
{
|
{
|
||||||
|
@ -323,8 +323,8 @@ TEST_F(CopyCommandTest_B2T, Success) {
|
||||||
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// OOB on the buffer because we copy too many pixels
|
// OOB on the buffer because we copy too many pixels
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||||
|
@ -355,8 +355,8 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
||||||
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) {
|
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// OOB on the texture because x + width overflows
|
// OOB on the texture because x + width overflows
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {13, 12, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {13, 12, 0},
|
||||||
|
@ -382,8 +382,8 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) {
|
||||||
// Test that we force Z=0 and Depth=1 on copies to 2D textures
|
// Test that we force Z=0 and Depth=1 on copies to 2D textures
|
||||||
TEST_F(CopyCommandTest_B2T, ZDepthConstraintFor2DTextures) {
|
TEST_F(CopyCommandTest_B2T, ZDepthConstraintFor2DTextures) {
|
||||||
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// Z=1 on an empty copy still errors
|
// Z=1 on an empty copy still errors
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 1},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 1},
|
||||||
|
@ -398,10 +398,10 @@ TEST_F(CopyCommandTest_B2T, ZDepthConstraintFor2DTextures) {
|
||||||
TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
|
TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
|
||||||
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Buffer vertex = CreateBuffer(16 * 4, dawn::BufferUsageBit::Vertex);
|
dawn::Buffer vertex = CreateBuffer(16 * 4, dawn::BufferUsageBit::Vertex);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::Sampled);
|
dawn::TextureUsageBit::Sampled);
|
||||||
|
|
||||||
// Incorrect source usage
|
// Incorrect source usage
|
||||||
TestB2TCopy(utils::Expectation::Failure, vertex, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, vertex, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||||
|
@ -415,8 +415,8 @@ TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
|
||||||
TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
||||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// Default row pitch is not 256-byte aligned
|
// Default row pitch is not 256-byte aligned
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
|
||||||
|
@ -434,7 +434,7 @@ TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
||||||
TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
|
||||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// Image height is zero (Valid)
|
// Image height is zero (Valid)
|
||||||
|
@ -458,8 +458,8 @@ TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
||||||
TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
|
TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// Correct usage
|
// Correct usage
|
||||||
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 0, destination, 0, 0,
|
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 0, destination, 0, 0,
|
||||||
|
@ -480,7 +480,7 @@ TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
|
||||||
TEST_F(CopyCommandTest_B2T, CopyToMultisampledTexture) {
|
TEST_F(CopyCommandTest_B2T, CopyToMultisampledTexture) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
|
||||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst, 4);
|
dawn::TextureUsageBit::TransferDst, 4);
|
||||||
|
|
||||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||||
|
@ -505,9 +505,8 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
|
||||||
dawn::Extent3D extent3D = {1, 1, 1};
|
dawn::Extent3D extent3D = {1, 1, 1};
|
||||||
|
|
||||||
{
|
{
|
||||||
dawn::Texture destination =
|
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::TextureUsageBit::TransferDst);
|
||||||
dawn::TextureUsageBit::TransferDst);
|
|
||||||
dawn::TextureCopyView textureCopyView =
|
dawn::TextureCopyView textureCopyView =
|
||||||
utils::CreateTextureCopyView(destination, 0, 0, {1, 1, 1});
|
utils::CreateTextureCopyView(destination, 0, 0, {1, 1, 1});
|
||||||
|
|
||||||
|
@ -534,8 +533,8 @@ TEST_F(CopyCommandTest_B2T, TextureCopyBufferSizeLastRowComputation) {
|
||||||
constexpr uint32_t kWidth = 4;
|
constexpr uint32_t kWidth = 4;
|
||||||
constexpr uint32_t kHeight = 4;
|
constexpr uint32_t kHeight = 4;
|
||||||
|
|
||||||
constexpr std::array<dawn::TextureFormat, 2> kFormats = {dawn::TextureFormat::R8G8B8A8Unorm,
|
constexpr std::array<dawn::TextureFormat, 2> kFormats = {dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureFormat::R8G8Unorm};
|
dawn::TextureFormat::RG8Unorm};
|
||||||
|
|
||||||
{
|
{
|
||||||
// kRowPitch * (kHeight - 1) + kWidth is not large enough to be the valid buffer size in
|
// kRowPitch * (kHeight - 1) + kWidth is not large enough to be the valid buffer size in
|
||||||
|
@ -584,8 +583,8 @@ class CopyCommandTest_T2B : public CopyCommandTest {
|
||||||
// Test a successfull T2B copy
|
// Test a successfull T2B copy
|
||||||
TEST_F(CopyCommandTest_T2B, Success) {
|
TEST_F(CopyCommandTest_T2B, Success) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
// Different copies, including some that touch the OOB condition
|
// Different copies, including some that touch the OOB condition
|
||||||
|
@ -637,8 +636,8 @@ TEST_F(CopyCommandTest_T2B, Success) {
|
||||||
// Test OOB conditions on the texture
|
// Test OOB conditions on the texture
|
||||||
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
|
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
// OOB on the texture because x + width overflows
|
// OOB on the texture because x + width overflows
|
||||||
|
@ -661,8 +660,8 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
|
||||||
// Test OOB conditions on the buffer
|
// Test OOB conditions on the buffer
|
||||||
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
// OOB on the buffer because we copy too many pixels
|
// OOB on the buffer because we copy too many pixels
|
||||||
|
@ -692,8 +691,8 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
||||||
// Test that we force Z=0 and Depth=1 on copies from to 2D textures
|
// Test that we force Z=0 and Depth=1 on copies from to 2D textures
|
||||||
TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
|
TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
// Z=1 on an empty copy still errors
|
// Z=1 on an empty copy still errors
|
||||||
|
@ -708,10 +707,10 @@ TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
|
||||||
// Test T2B copies with incorrect buffer usage
|
// Test T2B copies with incorrect buffer usage
|
||||||
TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
|
TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::Sampled);
|
dawn::TextureUsageBit::Sampled);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
dawn::Buffer vertex = CreateBuffer(bufferSize, dawn::BufferUsageBit::Vertex);
|
dawn::Buffer vertex = CreateBuffer(bufferSize, dawn::BufferUsageBit::Vertex);
|
||||||
|
|
||||||
|
@ -725,8 +724,8 @@ TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
||||||
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||||
|
|
||||||
// Default row pitch is not 256-byte aligned
|
// Default row pitch is not 256-byte aligned
|
||||||
|
@ -744,7 +743,7 @@ TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
|
||||||
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
|
@ -768,7 +767,7 @@ TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
||||||
// Test T2B copies with incorrect buffer offset usage
|
// Test T2B copies with incorrect buffer offset usage
|
||||||
TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
|
TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
||||||
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
|
||||||
|
@ -787,7 +786,7 @@ TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
|
||||||
|
|
||||||
// Test multisampled textures cannot be used in T2B copies.
|
// Test multisampled textures cannot be used in T2B copies.
|
||||||
TEST_F(CopyCommandTest_T2B, CopyFromMultisampledTexture) {
|
TEST_F(CopyCommandTest_T2B, CopyFromMultisampledTexture) {
|
||||||
dawn::Texture source = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc, 4);
|
dawn::TextureUsageBit::TransferSrc, 4);
|
||||||
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
|
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
|
||||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||||
|
@ -825,9 +824,8 @@ TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
dawn::Texture destination =
|
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||||
Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::TextureUsageBit::TransferDst);
|
||||||
dawn::TextureUsageBit::TransferDst);
|
|
||||||
dawn::TextureCopyView textureCopyView =
|
dawn::TextureCopyView textureCopyView =
|
||||||
utils::CreateTextureCopyView(destination, 0, 0, {1, 1, 1});
|
utils::CreateTextureCopyView(destination, 0, 0, {1, 1, 1});
|
||||||
|
|
||||||
|
@ -843,8 +841,8 @@ TEST_F(CopyCommandTest_T2B, TextureCopyBufferSizeLastRowComputation) {
|
||||||
constexpr uint32_t kWidth = 4;
|
constexpr uint32_t kWidth = 4;
|
||||||
constexpr uint32_t kHeight = 4;
|
constexpr uint32_t kHeight = 4;
|
||||||
|
|
||||||
constexpr std::array<dawn::TextureFormat, 2> kFormats = {dawn::TextureFormat::R8G8B8A8Unorm,
|
constexpr std::array<dawn::TextureFormat, 2> kFormats = {dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureFormat::R8G8Unorm};
|
dawn::TextureFormat::RG8Unorm};
|
||||||
|
|
||||||
{
|
{
|
||||||
// kRowPitch * (kHeight - 1) + kWidth is not large enough to be the valid buffer size in
|
// kRowPitch * (kHeight - 1) + kWidth is not large enough to be the valid buffer size in
|
||||||
|
@ -891,9 +889,9 @@ TEST_F(CopyCommandTest_T2B, TextureCopyBufferSizeLastRowComputation) {
|
||||||
class CopyCommandTest_T2T : public CopyCommandTest {};
|
class CopyCommandTest_T2T : public CopyCommandTest {};
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_T2T, Success) {
|
TEST_F(CopyCommandTest_T2T, Success) {
|
||||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// Different copies, including some that touch the OOB condition
|
// Different copies, including some that touch the OOB condition
|
||||||
|
@ -944,9 +942,9 @@ TEST_F(CopyCommandTest_T2T, Success) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_T2T, IncorrectUsage) {
|
TEST_F(CopyCommandTest_T2T, IncorrectUsage) {
|
||||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// Incorrect source usage causes failure
|
// Incorrect source usage causes failure
|
||||||
|
@ -959,9 +957,9 @@ TEST_F(CopyCommandTest_T2T, IncorrectUsage) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_T2T, OutOfBounds) {
|
TEST_F(CopyCommandTest_T2T, OutOfBounds) {
|
||||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// OOB on source
|
// OOB on source
|
||||||
|
@ -1012,9 +1010,9 @@ TEST_F(CopyCommandTest_T2T, OutOfBounds) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_T2T, 2DTextureDepthConstraints) {
|
TEST_F(CopyCommandTest_T2T, 2DTextureDepthConstraints) {
|
||||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// Empty copy on source with z > 0 fails
|
// Empty copy on source with z > 0 fails
|
||||||
|
@ -1031,10 +1029,10 @@ TEST_F(CopyCommandTest_T2T, 2DTextureDepthConstraints) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_T2T, 2DTextureDepthStencil) {
|
TEST_F(CopyCommandTest_T2T, 2DTextureDepthStencil) {
|
||||||
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::D32FloatS8Uint,
|
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::D32FloatS8Uint,
|
dawn::Texture destination = Create2DTexture(
|
||||||
dawn::TextureUsageBit::TransferDst);
|
16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8, dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// Success when entire depth stencil subresource is copied
|
// Success when entire depth stencil subresource is copied
|
||||||
TestT2TCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 0, {0, 0, 0},
|
TestT2TCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 0, {0, 0, 0},
|
||||||
|
@ -1046,9 +1044,9 @@ TEST_F(CopyCommandTest_T2T, 2DTextureDepthStencil) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_T2T, FormatsMismatch) {
|
TEST_F(CopyCommandTest_T2T, FormatsMismatch) {
|
||||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Uint,
|
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Uint,
|
||||||
dawn::TextureUsageBit::TransferSrc);
|
dawn::TextureUsageBit::TransferSrc);
|
||||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||||
dawn::TextureUsageBit::TransferDst);
|
dawn::TextureUsageBit::TransferDst);
|
||||||
|
|
||||||
// Failure when formats don't match
|
// Failure when formats don't match
|
||||||
|
@ -1058,11 +1056,11 @@ TEST_F(CopyCommandTest_T2T, FormatsMismatch) {
|
||||||
|
|
||||||
TEST_F(CopyCommandTest_T2T, MultisampledCopies) {
|
TEST_F(CopyCommandTest_T2T, MultisampledCopies) {
|
||||||
dawn::Texture sourceMultiSampled1x = Create2DTexture(
|
dawn::Texture sourceMultiSampled1x = Create2DTexture(
|
||||||
16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm, dawn::TextureUsageBit::TransferSrc, 1);
|
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::TransferSrc, 1);
|
||||||
dawn::Texture sourceMultiSampled4x = Create2DTexture(
|
dawn::Texture sourceMultiSampled4x = Create2DTexture(
|
||||||
16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm, dawn::TextureUsageBit::TransferSrc, 4);
|
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::TransferSrc, 4);
|
||||||
dawn::Texture destinationMultiSampled4x = Create2DTexture(
|
dawn::Texture destinationMultiSampled4x = Create2DTexture(
|
||||||
16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm, dawn::TextureUsageBit::TransferDst, 4);
|
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::TransferDst, 4);
|
||||||
|
|
||||||
// Success when entire multisampled subresource is copied
|
// Success when entire multisampled subresource is copied
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,14 +82,15 @@ TEST_F(RenderPassDescriptorValidationTest, Empty) {
|
||||||
TEST_F(RenderPassDescriptorValidationTest, OneAttachment) {
|
TEST_F(RenderPassDescriptorValidationTest, OneAttachment) {
|
||||||
// One color attachment
|
// One color attachment
|
||||||
{
|
{
|
||||||
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||||
utils::ComboRenderPassDescriptor renderPass({color});
|
utils::ComboRenderPassDescriptor renderPass({color});
|
||||||
|
|
||||||
AssertBeginRenderPassSuccess(&renderPass);
|
AssertBeginRenderPassSuccess(&renderPass);
|
||||||
}
|
}
|
||||||
// One depth-stencil attachment
|
// One depth-stencil attachment
|
||||||
{
|
{
|
||||||
dawn::TextureView depthStencil = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint);
|
dawn::TextureView depthStencil =
|
||||||
|
Create2DAttachment(device, 1, 1, dawn::TextureFormat::Depth24PlusStencil8);
|
||||||
utils::ComboRenderPassDescriptor renderPass({}, depthStencil);
|
utils::ComboRenderPassDescriptor renderPass({}, depthStencil);
|
||||||
|
|
||||||
AssertBeginRenderPassSuccess(&renderPass);
|
AssertBeginRenderPassSuccess(&renderPass);
|
||||||
|
@ -98,14 +99,10 @@ TEST_F(RenderPassDescriptorValidationTest, OneAttachment) {
|
||||||
|
|
||||||
// Test OOB color attachment indices are handled
|
// Test OOB color attachment indices are handled
|
||||||
TEST_F(RenderPassDescriptorValidationTest, ColorAttachmentOutOfBounds) {
|
TEST_F(RenderPassDescriptorValidationTest, ColorAttachmentOutOfBounds) {
|
||||||
dawn::TextureView color1 = Create2DAttachment(device, 1, 1,
|
dawn::TextureView color1 = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||||
dawn::TextureFormat::R8G8B8A8Unorm);
|
dawn::TextureView color2 = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||||
dawn::TextureView color2 = Create2DAttachment(device, 1, 1,
|
dawn::TextureView color3 = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||||
dawn::TextureFormat::R8G8B8A8Unorm);
|
dawn::TextureView color4 = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||||
dawn::TextureView color3 = Create2DAttachment(device, 1, 1,
|
|
||||||
dawn::TextureFormat::R8G8B8A8Unorm);
|
|
||||||
dawn::TextureView color4 = Create2DAttachment(device, 1, 1,
|
|
||||||
dawn::TextureFormat::R8G8B8A8Unorm);
|
|
||||||
// For setting the color attachment, control case
|
// For setting the color attachment, control case
|
||||||
{
|
{
|
||||||
utils::ComboRenderPassDescriptor renderPass({color1, color2, color3, color4});
|
utils::ComboRenderPassDescriptor renderPass({color1, color2, color3, color4});
|
||||||
|
@ -129,8 +126,8 @@ TEST_F(RenderPassDescriptorValidationTest, ColorAttachmentOutOfBounds) {
|
||||||
colorAttachment3.attachment = color3;
|
colorAttachment3.attachment = color3;
|
||||||
colorAttachment4.attachment = color4;
|
colorAttachment4.attachment = color4;
|
||||||
|
|
||||||
dawn::TextureView color5 = Create2DAttachment(device, 1, 1,
|
dawn::TextureView color5 =
|
||||||
dawn::TextureFormat::R8G8B8A8Unorm);
|
Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||||
dawn::RenderPassColorAttachmentDescriptor colorAttachment5 = colorAttachment1;
|
dawn::RenderPassColorAttachmentDescriptor colorAttachment5 = colorAttachment1;
|
||||||
colorAttachment5.attachment = color5;
|
colorAttachment5.attachment = color5;
|
||||||
|
|
||||||
|
@ -149,12 +146,14 @@ TEST_F(RenderPassDescriptorValidationTest, ColorAttachmentOutOfBounds) {
|
||||||
|
|
||||||
// Attachments must have the same size
|
// Attachments must have the same size
|
||||||
TEST_F(RenderPassDescriptorValidationTest, SizeMustMatch) {
|
TEST_F(RenderPassDescriptorValidationTest, SizeMustMatch) {
|
||||||
dawn::TextureView color1x1A = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
dawn::TextureView color1x1A = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||||
dawn::TextureView color1x1B = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
dawn::TextureView color1x1B = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||||
dawn::TextureView color2x2 = Create2DAttachment(device, 2, 2, dawn::TextureFormat::R8G8B8A8Unorm);
|
dawn::TextureView color2x2 = Create2DAttachment(device, 2, 2, dawn::TextureFormat::RGBA8Unorm);
|
||||||
|
|
||||||
dawn::TextureView depthStencil1x1 = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint);
|
dawn::TextureView depthStencil1x1 =
|
||||||
dawn::TextureView depthStencil2x2 = Create2DAttachment(device, 2, 2, dawn::TextureFormat::D32FloatS8Uint);
|
Create2DAttachment(device, 1, 1, dawn::TextureFormat::Depth24PlusStencil8);
|
||||||
|
dawn::TextureView depthStencil2x2 =
|
||||||
|
Create2DAttachment(device, 2, 2, dawn::TextureFormat::Depth24PlusStencil8);
|
||||||
|
|
||||||
// Control case: all the same size (1x1)
|
// Control case: all the same size (1x1)
|
||||||
{
|
{
|
||||||
|
@ -177,8 +176,9 @@ TEST_F(RenderPassDescriptorValidationTest, SizeMustMatch) {
|
||||||
|
|
||||||
// Attachments formats must match whether they are used for color or depth-stencil
|
// Attachments formats must match whether they are used for color or depth-stencil
|
||||||
TEST_F(RenderPassDescriptorValidationTest, FormatMismatch) {
|
TEST_F(RenderPassDescriptorValidationTest, FormatMismatch) {
|
||||||
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||||
dawn::TextureView depthStencil = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint);
|
dawn::TextureView depthStencil =
|
||||||
|
Create2DAttachment(device, 1, 1, dawn::TextureFormat::Depth24PlusStencil8);
|
||||||
|
|
||||||
// Using depth-stencil for color
|
// Using depth-stencil for color
|
||||||
{
|
{
|
||||||
|
@ -198,8 +198,8 @@ TEST_F(RenderPassDescriptorValidationTest, FormatMismatch) {
|
||||||
TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepthStencil) {
|
TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepthStencil) {
|
||||||
constexpr uint32_t kLevelCount = 1;
|
constexpr uint32_t kLevelCount = 1;
|
||||||
constexpr uint32_t kSize = 32;
|
constexpr uint32_t kSize = 32;
|
||||||
constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||||
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::D32FloatS8Uint;
|
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
|
|
||||||
constexpr uint32_t kArrayLayers = 10;
|
constexpr uint32_t kArrayLayers = 10;
|
||||||
|
|
||||||
|
@ -291,8 +291,8 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
||||||
TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepthStencil) {
|
TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepthStencil) {
|
||||||
constexpr uint32_t kArrayLayers = 1;
|
constexpr uint32_t kArrayLayers = 1;
|
||||||
constexpr uint32_t kSize = 32;
|
constexpr uint32_t kSize = 32;
|
||||||
constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||||
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::D32FloatS8Uint;
|
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
|
|
||||||
constexpr uint32_t kLevelCount = 4;
|
constexpr uint32_t kLevelCount = 4;
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ TEST_F(RenderPassDescriptorValidationTest, NonMultisampledColorWithResolveTarget
|
||||||
static constexpr uint32_t kLevelCount = 1;
|
static constexpr uint32_t kLevelCount = 1;
|
||||||
static constexpr uint32_t kSize = 32;
|
static constexpr uint32_t kSize = 32;
|
||||||
static constexpr uint32_t kSampleCount = 1;
|
static constexpr uint32_t kSampleCount = 1;
|
||||||
static constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
static constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
dawn::Texture colorTexture = CreateTexture(
|
dawn::Texture colorTexture = CreateTexture(
|
||||||
device, dawn::TextureDimension::e2D, kColorFormat, kSize, kSize, kArrayLayers,
|
device, dawn::TextureDimension::e2D, kColorFormat, kSize, kSize, kArrayLayers,
|
||||||
|
@ -420,7 +420,7 @@ class MultisampledRenderPassDescriptorValidationTest : public RenderPassDescript
|
||||||
static constexpr uint32_t kLevelCount = 1;
|
static constexpr uint32_t kLevelCount = 1;
|
||||||
static constexpr uint32_t kSize = 32;
|
static constexpr uint32_t kSize = 32;
|
||||||
static constexpr uint32_t kSampleCount = 4;
|
static constexpr uint32_t kSampleCount = 4;
|
||||||
static constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
static constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
dawn::TextureView CreateColorTextureView(uint32_t sampleCount) {
|
dawn::TextureView CreateColorTextureView(uint32_t sampleCount) {
|
||||||
|
@ -532,7 +532,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, MultisampledColorWithReso
|
||||||
|
|
||||||
// It is not allowed to use a resolve target in a format different from the color attachment.
|
// It is not allowed to use a resolve target in a format different from the color attachment.
|
||||||
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetDifferentFormat) {
|
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetDifferentFormat) {
|
||||||
constexpr dawn::TextureFormat kColorFormat2 = dawn::TextureFormat::B8G8R8A8Unorm;
|
constexpr dawn::TextureFormat kColorFormat2 = dawn::TextureFormat::BGRA8Unorm;
|
||||||
dawn::Texture resolveTexture = CreateTexture(
|
dawn::Texture resolveTexture = CreateTexture(
|
||||||
device, dawn::TextureDimension::e2D, kColorFormat2, kSize, kSize, kArrayLayers,
|
device, dawn::TextureDimension::e2D, kColorFormat2, kSize, kSize, kArrayLayers,
|
||||||
kLevelCount);
|
kLevelCount);
|
||||||
|
@ -585,7 +585,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ColorAttachmentResolveTar
|
||||||
|
|
||||||
// Tests on the sample count of depth stencil attachment.
|
// Tests on the sample count of depth stencil attachment.
|
||||||
TEST_F(MultisampledRenderPassDescriptorValidationTest, DepthStencilAttachmentSampleCount) {
|
TEST_F(MultisampledRenderPassDescriptorValidationTest, DepthStencilAttachmentSampleCount) {
|
||||||
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::D32FloatS8Uint;
|
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
dawn::Texture multisampledDepthStencilTexture = CreateTexture(
|
dawn::Texture multisampledDepthStencilTexture = CreateTexture(
|
||||||
device, dawn::TextureDimension::e2D, kDepthStencilFormat, kSize, kSize, kArrayLayers,
|
device, dawn::TextureDimension::e2D, kDepthStencilFormat, kSize, kSize, kArrayLayers,
|
||||||
kLevelCount, kSampleCount);
|
kLevelCount, kSampleCount);
|
||||||
|
|
|
@ -97,8 +97,8 @@ TEST_F(RenderPipelineValidationTest, SampleCount) {
|
||||||
// in the render pass.
|
// in the render pass.
|
||||||
TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
||||||
constexpr uint32_t kMultisampledCount = 4;
|
constexpr uint32_t kMultisampledCount = 4;
|
||||||
constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||||
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::D32FloatS8Uint;
|
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
|
|
||||||
dawn::TextureDescriptor baseTextureDescriptor;
|
dawn::TextureDescriptor baseTextureDescriptor;
|
||||||
baseTextureDescriptor.size.width = 4;
|
baseTextureDescriptor.size.width = 4;
|
||||||
|
|
|
@ -45,7 +45,7 @@ class TextureValidationTest : public ValidationTest {
|
||||||
static constexpr uint32_t kDefaultMipLevels = 1;
|
static constexpr uint32_t kDefaultMipLevels = 1;
|
||||||
static constexpr uint32_t kDefaultSampleCount = 1;
|
static constexpr uint32_t kDefaultSampleCount = 1;
|
||||||
|
|
||||||
static constexpr dawn::TextureFormat kDefaultTextureFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
static constexpr dawn::TextureFormat kDefaultTextureFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Test the validation of sample count
|
// Test the validation of sample count
|
||||||
|
|
|
@ -23,7 +23,7 @@ constexpr uint32_t kWidth = 32u;
|
||||||
constexpr uint32_t kHeight = 32u;
|
constexpr uint32_t kHeight = 32u;
|
||||||
constexpr uint32_t kDefaultMipLevels = 6u;
|
constexpr uint32_t kDefaultMipLevels = 6u;
|
||||||
|
|
||||||
constexpr dawn::TextureFormat kDefaultTextureFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
constexpr dawn::TextureFormat kDefaultTextureFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
dawn::Texture Create2DArrayTexture(dawn::Device& device,
|
dawn::Texture Create2DArrayTexture(dawn::Device& device,
|
||||||
uint32_t arrayLayerCount,
|
uint32_t arrayLayerCount,
|
||||||
|
@ -213,7 +213,7 @@ TEST_F(TextureViewValidationTest, TextureViewFormatCompatibility) {
|
||||||
// It is an error to create a texture view in depth-stencil format on a RGBA texture.
|
// It is an error to create a texture view in depth-stencil format on a RGBA texture.
|
||||||
{
|
{
|
||||||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||||
descriptor.format = dawn::TextureFormat::D32FloatS8Uint;
|
descriptor.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,7 @@ void ValidationTest::OnDeviceError(const char* message, void* userdata) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidationTest::DummyRenderPass::DummyRenderPass(const dawn::Device& device)
|
ValidationTest::DummyRenderPass::DummyRenderPass(const dawn::Device& device)
|
||||||
: attachmentFormat(dawn::TextureFormat::R8G8B8A8Unorm), width(400), height(400) {
|
: attachmentFormat(dawn::TextureFormat::RGBA8Unorm), width(400), height(400) {
|
||||||
|
|
||||||
dawn::TextureDescriptor descriptor;
|
dawn::TextureDescriptor descriptor;
|
||||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||||
descriptor.size.width = width;
|
descriptor.size.width = width;
|
||||||
|
|
|
@ -37,7 +37,7 @@ class VertexInputTest : public ValidationTest {
|
||||||
descriptor.cVertexStage.module = vsModule;
|
descriptor.cVertexStage.module = vsModule;
|
||||||
descriptor.cFragmentStage.module = fsModule;
|
descriptor.cFragmentStage.module = fsModule;
|
||||||
descriptor.vertexInput = &state;
|
descriptor.vertexInput = &state;
|
||||||
descriptor.cColorStates[0]->format = dawn::TextureFormat::R8G8B8A8Unorm;
|
descriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||||
|
|
|
@ -111,7 +111,7 @@ TEST_F(WireArgumentTests, CStringArgument) {
|
||||||
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
||||||
DawnColorStateDescriptor colorStateDescriptor;
|
DawnColorStateDescriptor colorStateDescriptor;
|
||||||
colorStateDescriptor.nextInChain = nullptr;
|
colorStateDescriptor.nextInChain = nullptr;
|
||||||
colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_RGBA8_UNORM;
|
||||||
colorStateDescriptor.alphaBlend = blendDescriptor;
|
colorStateDescriptor.alphaBlend = blendDescriptor;
|
||||||
colorStateDescriptor.colorBlend = blendDescriptor;
|
colorStateDescriptor.colorBlend = blendDescriptor;
|
||||||
colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL;
|
colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL;
|
||||||
|
@ -141,7 +141,7 @@ TEST_F(WireArgumentTests, CStringArgument) {
|
||||||
|
|
||||||
DawnDepthStencilStateDescriptor depthStencilState;
|
DawnDepthStencilStateDescriptor depthStencilState;
|
||||||
depthStencilState.nextInChain = nullptr;
|
depthStencilState.nextInChain = nullptr;
|
||||||
depthStencilState.format = DAWN_TEXTURE_FORMAT_D32_FLOAT_S8_UINT;
|
depthStencilState.format = DAWN_TEXTURE_FORMAT_DEPTH24_PLUS_STENCIL8;
|
||||||
depthStencilState.depthWriteEnabled = false;
|
depthStencilState.depthWriteEnabled = false;
|
||||||
depthStencilState.depthCompare = DAWN_COMPARE_FUNCTION_ALWAYS;
|
depthStencilState.depthCompare = DAWN_COMPARE_FUNCTION_ALWAYS;
|
||||||
depthStencilState.stencilBack = stencilFace;
|
depthStencilState.stencilBack = stencilFace;
|
||||||
|
|
|
@ -81,7 +81,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
|
||||||
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
||||||
DawnColorStateDescriptor colorStateDescriptor;
|
DawnColorStateDescriptor colorStateDescriptor;
|
||||||
colorStateDescriptor.nextInChain = nullptr;
|
colorStateDescriptor.nextInChain = nullptr;
|
||||||
colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_RGBA8_UNORM;
|
||||||
colorStateDescriptor.alphaBlend = blendDescriptor;
|
colorStateDescriptor.alphaBlend = blendDescriptor;
|
||||||
colorStateDescriptor.colorBlend = blendDescriptor;
|
colorStateDescriptor.colorBlend = blendDescriptor;
|
||||||
colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL;
|
colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL;
|
||||||
|
@ -111,7 +111,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
|
||||||
|
|
||||||
DawnDepthStencilStateDescriptor depthStencilState;
|
DawnDepthStencilStateDescriptor depthStencilState;
|
||||||
depthStencilState.nextInChain = nullptr;
|
depthStencilState.nextInChain = nullptr;
|
||||||
depthStencilState.format = DAWN_TEXTURE_FORMAT_D32_FLOAT_S8_UINT;
|
depthStencilState.format = DAWN_TEXTURE_FORMAT_DEPTH24_PLUS_STENCIL8;
|
||||||
depthStencilState.depthWriteEnabled = false;
|
depthStencilState.depthWriteEnabled = false;
|
||||||
depthStencilState.depthCompare = DAWN_COMPARE_FUNCTION_ALWAYS;
|
depthStencilState.depthCompare = DAWN_COMPARE_FUNCTION_ALWAYS;
|
||||||
depthStencilState.stencilBack = stencilFace;
|
depthStencilState.stencilBack = stencilFace;
|
||||||
|
|
|
@ -88,7 +88,7 @@ namespace utils {
|
||||||
blend.srcFactor = dawn::BlendFactor::One;
|
blend.srcFactor = dawn::BlendFactor::One;
|
||||||
blend.dstFactor = dawn::BlendFactor::Zero;
|
blend.dstFactor = dawn::BlendFactor::Zero;
|
||||||
dawn::ColorStateDescriptor colorStateDescriptor;
|
dawn::ColorStateDescriptor colorStateDescriptor;
|
||||||
colorStateDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
colorStateDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||||
colorStateDescriptor.alphaBlend = blend;
|
colorStateDescriptor.alphaBlend = blend;
|
||||||
colorStateDescriptor.colorBlend = blend;
|
colorStateDescriptor.colorBlend = blend;
|
||||||
colorStateDescriptor.writeMask = dawn::ColorWriteMask::All;
|
colorStateDescriptor.writeMask = dawn::ColorWriteMask::All;
|
||||||
|
@ -106,7 +106,7 @@ namespace utils {
|
||||||
stencilFace.depthFailOp = dawn::StencilOperation::Keep;
|
stencilFace.depthFailOp = dawn::StencilOperation::Keep;
|
||||||
stencilFace.passOp = dawn::StencilOperation::Keep;
|
stencilFace.passOp = dawn::StencilOperation::Keep;
|
||||||
|
|
||||||
cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
|
cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||||
cDepthStencilState.depthWriteEnabled = false;
|
cDepthStencilState.depthWriteEnabled = false;
|
||||||
cDepthStencilState.depthCompare = dawn::CompareFunction::Always;
|
cDepthStencilState.depthCompare = dawn::CompareFunction::Always;
|
||||||
cDepthStencilState.stencilBack = stencilFace;
|
cDepthStencilState.stencilBack = stencilFace;
|
||||||
|
|
|
@ -195,7 +195,7 @@ namespace utils {
|
||||||
: width(0),
|
: width(0),
|
||||||
height(0),
|
height(0),
|
||||||
color(nullptr),
|
color(nullptr),
|
||||||
colorFormat(dawn::TextureFormat::R8G8B8A8Unorm),
|
colorFormat(dawn::TextureFormat::RGBA8Unorm),
|
||||||
renderPassInfo({}) {
|
renderPassInfo({}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ namespace utils {
|
||||||
uint32_t height) {
|
uint32_t height) {
|
||||||
DAWN_ASSERT(width > 0 && height > 0);
|
DAWN_ASSERT(width > 0 && height > 0);
|
||||||
|
|
||||||
dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
dawn::TextureDescriptor descriptor;
|
dawn::TextureDescriptor descriptor;
|
||||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace utils {
|
||||||
DawnTextureUsageBit usage,
|
DawnTextureUsageBit usage,
|
||||||
uint32_t width,
|
uint32_t width,
|
||||||
uint32_t height) {
|
uint32_t height) {
|
||||||
if (format != DAWN_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM) {
|
if (format != DAWN_TEXTURE_FORMAT_BGRA8_UNORM) {
|
||||||
return "unsupported format";
|
return "unsupported format";
|
||||||
}
|
}
|
||||||
ASSERT(width > 0);
|
ASSERT(width > 0);
|
||||||
|
@ -122,7 +122,7 @@ namespace utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
DawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
DawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||||
return DAWN_TEXTURE_FORMAT_B8_G8_R8_A8_UNORM;
|
return DAWN_TEXTURE_FORMAT_BGRA8_UNORM;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace utils {
|
||||||
return reinterpret_cast<uint64_t>(&mSwapchainImpl);
|
return reinterpret_cast<uint64_t>(&mSwapchainImpl);
|
||||||
}
|
}
|
||||||
DawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
DawnTextureFormat GetPreferredSwapChainTextureFormat() override {
|
||||||
return DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
return DAWN_TEXTURE_FORMAT_RGBA8_UNORM;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue