From 0c133bbe554e98c55b88f3dd3fab7b885aa5abcb Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Mon, 15 Apr 2019 20:43:35 +0000 Subject: [PATCH] Rename DawnColorStateDescriptor.colorWriteMask to writeMask Bug: chromium:877147 Change-Id: I566cea409b89de8abd724f344f7ae83f80e56572 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6600 Reviewed-by: Corentin Wallez Reviewed-by: Kai Ninomiya Commit-Queue: Austin Eng --- dawn.json | 2 +- examples/CHelloTriangle.cpp | 2 +- src/dawn_native/RenderPipeline.cpp | 2 +- src/dawn_native/d3d12/RenderPipelineD3D12.cpp | 7 +++---- src/dawn_native/metal/RenderPipelineMTL.mm | 12 ++++++------ src/dawn_native/opengl/RenderPipelineGL.cpp | 8 ++++---- src/dawn_native/vulkan/RenderPipelineVk.cpp | 2 +- src/tests/end2end/ColorStateTests.cpp | 16 ++++++++-------- src/tests/unittests/wire/WireArgumentTests.cpp | 2 +- src/tests/unittests/wire/WireOptionalTests.cpp | 2 +- src/utils/ComboRenderPipelineDescriptor.cpp | 2 +- 11 files changed, 28 insertions(+), 29 deletions(-) diff --git a/dawn.json b/dawn.json index d1c321fecc..6044c9635d 100644 --- a/dawn.json +++ b/dawn.json @@ -121,7 +121,7 @@ {"name": "format", "type": "texture format"}, {"name": "alpha blend", "type": "blend descriptor"}, {"name": "color blend", "type": "blend descriptor"}, - {"name": "color write mask", "type": "color write mask"} + {"name": "write mask", "type": "color write mask"} ] }, "bool": { diff --git a/examples/CHelloTriangle.cpp b/examples/CHelloTriangle.cpp index d999868d6f..5a5d8bba69 100644 --- a/examples/CHelloTriangle.cpp +++ b/examples/CHelloTriangle.cpp @@ -81,7 +81,7 @@ void init() { colorStateDescriptor.format = swapChainFormat; colorStateDescriptor.alphaBlend = blendDescriptor; colorStateDescriptor.colorBlend = blendDescriptor; - colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL; + colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL; descriptor.colorStateCount = 1; DawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor}; diff --git a/src/dawn_native/RenderPipeline.cpp b/src/dawn_native/RenderPipeline.cpp index 7fddfc0b4c..4aa206fd5d 100644 --- a/src/dawn_native/RenderPipeline.cpp +++ b/src/dawn_native/RenderPipeline.cpp @@ -117,7 +117,7 @@ namespace dawn_native { DAWN_TRY(ValidateBlendOperation(descriptor->colorBlend.operation)); DAWN_TRY(ValidateBlendFactor(descriptor->colorBlend.srcFactor)); DAWN_TRY(ValidateBlendFactor(descriptor->colorBlend.dstFactor)); - DAWN_TRY(ValidateColorWriteMask(descriptor->colorWriteMask)); + DAWN_TRY(ValidateColorWriteMask(descriptor->writeMask)); dawn::TextureFormat format = descriptor->format; DAWN_TRY(ValidateTextureFormat(format)); diff --git a/src/dawn_native/d3d12/RenderPipelineD3D12.cpp b/src/dawn_native/d3d12/RenderPipelineD3D12.cpp index 2cc719bfa1..5df00b1a5e 100644 --- a/src/dawn_native/d3d12/RenderPipelineD3D12.cpp +++ b/src/dawn_native/d3d12/RenderPipelineD3D12.cpp @@ -188,7 +188,7 @@ namespace dawn_native { namespace d3d12 { } } - uint8_t D3D12RenderTargetWriteMask(dawn::ColorWriteMask colorWriteMask) { + uint8_t D3D12RenderTargetWriteMask(dawn::ColorWriteMask writeMask) { static_assert(static_cast(dawn::ColorWriteMask::Red) == D3D12_COLOR_WRITE_ENABLE_RED, "ColorWriteMask values must match"); @@ -201,7 +201,7 @@ namespace dawn_native { namespace d3d12 { static_assert(static_cast(dawn::ColorWriteMask::Alpha) == D3D12_COLOR_WRITE_ENABLE_ALPHA, "ColorWriteMask values must match"); - return static_cast(colorWriteMask); + return static_cast(writeMask); } D3D12_RENDER_TARGET_BLEND_DESC ComputeColorDesc(const ColorStateDescriptor* descriptor) { @@ -213,8 +213,7 @@ namespace dawn_native { namespace d3d12 { blendDesc.SrcBlendAlpha = D3D12Blend(descriptor->alphaBlend.srcFactor); blendDesc.DestBlendAlpha = D3D12Blend(descriptor->alphaBlend.dstFactor); blendDesc.BlendOpAlpha = D3D12BlendOperation(descriptor->alphaBlend.operation); - blendDesc.RenderTargetWriteMask = - D3D12RenderTargetWriteMask(descriptor->colorWriteMask); + blendDesc.RenderTargetWriteMask = D3D12RenderTargetWriteMask(descriptor->writeMask); blendDesc.LogicOpEnable = false; blendDesc.LogicOp = D3D12_LOGIC_OP_NOOP; return blendDesc; diff --git a/src/dawn_native/metal/RenderPipelineMTL.mm b/src/dawn_native/metal/RenderPipelineMTL.mm index a36cfecf8c..fa72c797f5 100644 --- a/src/dawn_native/metal/RenderPipelineMTL.mm +++ b/src/dawn_native/metal/RenderPipelineMTL.mm @@ -182,19 +182,19 @@ namespace dawn_native { namespace metal { } } - MTLColorWriteMask MetalColorWriteMask(dawn::ColorWriteMask colorWriteMask) { + MTLColorWriteMask MetalColorWriteMask(dawn::ColorWriteMask writeMask) { MTLColorWriteMask mask = MTLColorWriteMaskNone; - if (colorWriteMask & dawn::ColorWriteMask::Red) { + if (writeMask & dawn::ColorWriteMask::Red) { mask |= MTLColorWriteMaskRed; } - if (colorWriteMask & dawn::ColorWriteMask::Green) { + if (writeMask & dawn::ColorWriteMask::Green) { mask |= MTLColorWriteMaskGreen; } - if (colorWriteMask & dawn::ColorWriteMask::Blue) { + if (writeMask & dawn::ColorWriteMask::Blue) { mask |= MTLColorWriteMaskBlue; } - if (colorWriteMask & dawn::ColorWriteMask::Alpha) { + if (writeMask & dawn::ColorWriteMask::Alpha) { mask |= MTLColorWriteMaskAlpha; } @@ -214,7 +214,7 @@ namespace dawn_native { namespace metal { attachment.destinationAlphaBlendFactor = MetalBlendFactor(descriptor->alphaBlend.dstFactor, true); attachment.alphaBlendOperation = MetalBlendOperation(descriptor->alphaBlend.operation); - attachment.writeMask = MetalColorWriteMask(descriptor->colorWriteMask); + attachment.writeMask = MetalColorWriteMask(descriptor->writeMask); } MTLStencilOperation MetalStencilOperation(dawn::StencilOperation stencilOperation) { diff --git a/src/dawn_native/opengl/RenderPipelineGL.cpp b/src/dawn_native/opengl/RenderPipelineGL.cpp index f729370f8a..ada39b21bc 100644 --- a/src/dawn_native/opengl/RenderPipelineGL.cpp +++ b/src/dawn_native/opengl/RenderPipelineGL.cpp @@ -103,10 +103,10 @@ namespace dawn_native { namespace opengl { } else { glDisablei(GL_BLEND, attachment); } - glColorMaski(attachment, descriptor->colorWriteMask & dawn::ColorWriteMask::Red, - descriptor->colorWriteMask & dawn::ColorWriteMask::Green, - descriptor->colorWriteMask & dawn::ColorWriteMask::Blue, - descriptor->colorWriteMask & dawn::ColorWriteMask::Alpha); + glColorMaski(attachment, descriptor->writeMask & dawn::ColorWriteMask::Red, + descriptor->writeMask & dawn::ColorWriteMask::Green, + descriptor->writeMask & dawn::ColorWriteMask::Blue, + descriptor->writeMask & dawn::ColorWriteMask::Alpha); } GLuint OpenGLStencilOperation(dawn::StencilOperation stencilOperation) { diff --git a/src/dawn_native/vulkan/RenderPipelineVk.cpp b/src/dawn_native/vulkan/RenderPipelineVk.cpp index a9bab72997..e2cbca93d1 100644 --- a/src/dawn_native/vulkan/RenderPipelineVk.cpp +++ b/src/dawn_native/vulkan/RenderPipelineVk.cpp @@ -199,7 +199,7 @@ namespace dawn_native { namespace vulkan { attachment.srcAlphaBlendFactor = VulkanBlendFactor(descriptor->alphaBlend.srcFactor); attachment.dstAlphaBlendFactor = VulkanBlendFactor(descriptor->alphaBlend.dstFactor); attachment.alphaBlendOp = VulkanBlendOperation(descriptor->alphaBlend.operation); - attachment.colorWriteMask = VulkanColorWriteMask(descriptor->colorWriteMask); + attachment.colorWriteMask = VulkanColorWriteMask(descriptor->writeMask); return attachment; } diff --git a/src/tests/end2end/ColorStateTests.cpp b/src/tests/end2end/ColorStateTests.cpp index f71a5deaae..0ead520fa3 100644 --- a/src/tests/end2end/ColorStateTests.cpp +++ b/src/tests/end2end/ColorStateTests.cpp @@ -146,7 +146,7 @@ class ColorStateTest : public DawnTest { dawn::ColorStateDescriptor descriptor; descriptor.alphaBlend = blend; descriptor.colorBlend = blend; - descriptor.colorWriteMask = dawn::ColorWriteMask::All; + descriptor.writeMask = dawn::ColorWriteMask::All; SetupSingleSourcePipelines(descriptor); @@ -176,7 +176,7 @@ class ColorStateTest : public DawnTest { dawn::ColorStateDescriptor descriptor; descriptor.colorBlend = colorBlend; descriptor.alphaBlend = alphaBlend; - descriptor.colorWriteMask = dawn::ColorWriteMask::All; + descriptor.writeMask = dawn::ColorWriteMask::All; SetupSingleSourcePipelines(descriptor); @@ -298,7 +298,7 @@ TEST_P(ColorStateTest, Basic) { dawn::ColorStateDescriptor descriptor; descriptor.alphaBlend = blend; descriptor.colorBlend = blend; - descriptor.colorWriteMask = dawn::ColorWriteMask::All; + descriptor.writeMask = dawn::ColorWriteMask::All; SetupSingleSourcePipelines(descriptor); @@ -680,7 +680,7 @@ TEST_P(ColorStateTest, ColorWriteMask) { descriptor.alphaBlend = blend; { // Test single channel color write - descriptor.colorWriteMask = dawn::ColorWriteMask::Red; + descriptor.writeMask = dawn::ColorWriteMask::Red; SetupSingleSourcePipelines(descriptor); RGBA8 base(32, 64, 128, 192); @@ -692,7 +692,7 @@ TEST_P(ColorStateTest, ColorWriteMask) { { // Test multi channel color write - descriptor.colorWriteMask = dawn::ColorWriteMask::Green | dawn::ColorWriteMask::Alpha; + descriptor.writeMask = dawn::ColorWriteMask::Green | dawn::ColorWriteMask::Alpha; SetupSingleSourcePipelines(descriptor); RGBA8 base(32, 64, 128, 192); @@ -704,7 +704,7 @@ TEST_P(ColorStateTest, ColorWriteMask) { { // Test no channel color write - descriptor.colorWriteMask = dawn::ColorWriteMask::None; + descriptor.writeMask = dawn::ColorWriteMask::None; SetupSingleSourcePipelines(descriptor); RGBA8 base(32, 64, 128, 192); @@ -725,7 +725,7 @@ TEST_P(ColorStateTest, ColorWriteMaskBlendingDisabled) { descriptor.alphaBlend = blend; descriptor.colorBlend = blend; - descriptor.colorWriteMask = dawn::ColorWriteMask::Red; + descriptor.writeMask = dawn::ColorWriteMask::Red; SetupSingleSourcePipelines(descriptor); RGBA8 base(32, 64, 128, 192); @@ -1031,7 +1031,7 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) { testDescriptor.cVertexStage.module = vsModule; testDescriptor.cFragmentStage.module = fsModule; testDescriptor.cColorStates[0]->format = renderPass.colorFormat; - testDescriptor.cColorStates[0]->colorWriteMask = dawn::ColorWriteMask::Red; + testDescriptor.cColorStates[0]->writeMask = dawn::ColorWriteMask::Red; testPipeline = device.CreateRenderPipeline(&testDescriptor); diff --git a/src/tests/unittests/wire/WireArgumentTests.cpp b/src/tests/unittests/wire/WireArgumentTests.cpp index dc4c605258..965ab2c34c 100644 --- a/src/tests/unittests/wire/WireArgumentTests.cpp +++ b/src/tests/unittests/wire/WireArgumentTests.cpp @@ -94,7 +94,7 @@ TEST_F(WireArgumentTests, CStringArgument) { colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM; colorStateDescriptor.alphaBlend = blendDescriptor; colorStateDescriptor.colorBlend = blendDescriptor; - colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL; + colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL; // Create the input state DawnInputStateDescriptor inputState; diff --git a/src/tests/unittests/wire/WireOptionalTests.cpp b/src/tests/unittests/wire/WireOptionalTests.cpp index 2cf6c1e5d5..02a32510e0 100644 --- a/src/tests/unittests/wire/WireOptionalTests.cpp +++ b/src/tests/unittests/wire/WireOptionalTests.cpp @@ -84,7 +84,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) { colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM; colorStateDescriptor.alphaBlend = blendDescriptor; colorStateDescriptor.colorBlend = blendDescriptor; - colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL; + colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL; // Create the input state DawnInputStateDescriptor inputState; diff --git a/src/utils/ComboRenderPipelineDescriptor.cpp b/src/utils/ComboRenderPipelineDescriptor.cpp index c202ee1326..e0a1a1a041 100644 --- a/src/utils/ComboRenderPipelineDescriptor.cpp +++ b/src/utils/ComboRenderPipelineDescriptor.cpp @@ -92,7 +92,7 @@ namespace utils { colorStateDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; colorStateDescriptor.alphaBlend = blend; colorStateDescriptor.colorBlend = blend; - colorStateDescriptor.colorWriteMask = dawn::ColorWriteMask::All; + colorStateDescriptor.writeMask = dawn::ColorWriteMask::All; for (uint32_t i = 0; i < kMaxColorAttachments; ++i) { mColorStates[i] = colorStateDescriptor; cColorStates[i] = &mColorStates[i];