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 <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2019-04-15 20:43:35 +00:00 committed by Commit Bot service account
parent 2ec74dcc3f
commit 0c133bbe55
11 changed files with 28 additions and 29 deletions

View File

@ -121,7 +121,7 @@
{"name": "format", "type": "texture format"}, {"name": "format", "type": "texture format"},
{"name": "alpha blend", "type": "blend descriptor"}, {"name": "alpha blend", "type": "blend descriptor"},
{"name": "color 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": { "bool": {

View File

@ -81,7 +81,7 @@ void init() {
colorStateDescriptor.format = swapChainFormat; colorStateDescriptor.format = swapChainFormat;
colorStateDescriptor.alphaBlend = blendDescriptor; colorStateDescriptor.alphaBlend = blendDescriptor;
colorStateDescriptor.colorBlend = blendDescriptor; colorStateDescriptor.colorBlend = blendDescriptor;
colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL; colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL;
descriptor.colorStateCount = 1; descriptor.colorStateCount = 1;
DawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor}; DawnColorStateDescriptor* colorStatesPtr[] = {&colorStateDescriptor};

View File

@ -117,7 +117,7 @@ namespace dawn_native {
DAWN_TRY(ValidateBlendOperation(descriptor->colorBlend.operation)); DAWN_TRY(ValidateBlendOperation(descriptor->colorBlend.operation));
DAWN_TRY(ValidateBlendFactor(descriptor->colorBlend.srcFactor)); DAWN_TRY(ValidateBlendFactor(descriptor->colorBlend.srcFactor));
DAWN_TRY(ValidateBlendFactor(descriptor->colorBlend.dstFactor)); DAWN_TRY(ValidateBlendFactor(descriptor->colorBlend.dstFactor));
DAWN_TRY(ValidateColorWriteMask(descriptor->colorWriteMask)); DAWN_TRY(ValidateColorWriteMask(descriptor->writeMask));
dawn::TextureFormat format = descriptor->format; dawn::TextureFormat format = descriptor->format;
DAWN_TRY(ValidateTextureFormat(format)); DAWN_TRY(ValidateTextureFormat(format));

View File

@ -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<D3D12_COLOR_WRITE_ENABLE>(dawn::ColorWriteMask::Red) == static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(dawn::ColorWriteMask::Red) ==
D3D12_COLOR_WRITE_ENABLE_RED, D3D12_COLOR_WRITE_ENABLE_RED,
"ColorWriteMask values must match"); "ColorWriteMask values must match");
@ -201,7 +201,7 @@ namespace dawn_native { namespace d3d12 {
static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(dawn::ColorWriteMask::Alpha) == static_assert(static_cast<D3D12_COLOR_WRITE_ENABLE>(dawn::ColorWriteMask::Alpha) ==
D3D12_COLOR_WRITE_ENABLE_ALPHA, D3D12_COLOR_WRITE_ENABLE_ALPHA,
"ColorWriteMask values must match"); "ColorWriteMask values must match");
return static_cast<uint8_t>(colorWriteMask); return static_cast<uint8_t>(writeMask);
} }
D3D12_RENDER_TARGET_BLEND_DESC ComputeColorDesc(const ColorStateDescriptor* descriptor) { 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.SrcBlendAlpha = D3D12Blend(descriptor->alphaBlend.srcFactor);
blendDesc.DestBlendAlpha = D3D12Blend(descriptor->alphaBlend.dstFactor); blendDesc.DestBlendAlpha = D3D12Blend(descriptor->alphaBlend.dstFactor);
blendDesc.BlendOpAlpha = D3D12BlendOperation(descriptor->alphaBlend.operation); blendDesc.BlendOpAlpha = D3D12BlendOperation(descriptor->alphaBlend.operation);
blendDesc.RenderTargetWriteMask = blendDesc.RenderTargetWriteMask = D3D12RenderTargetWriteMask(descriptor->writeMask);
D3D12RenderTargetWriteMask(descriptor->colorWriteMask);
blendDesc.LogicOpEnable = false; blendDesc.LogicOpEnable = false;
blendDesc.LogicOp = D3D12_LOGIC_OP_NOOP; blendDesc.LogicOp = D3D12_LOGIC_OP_NOOP;
return blendDesc; return blendDesc;

View File

@ -182,19 +182,19 @@ namespace dawn_native { namespace metal {
} }
} }
MTLColorWriteMask MetalColorWriteMask(dawn::ColorWriteMask colorWriteMask) { MTLColorWriteMask MetalColorWriteMask(dawn::ColorWriteMask writeMask) {
MTLColorWriteMask mask = MTLColorWriteMaskNone; MTLColorWriteMask mask = MTLColorWriteMaskNone;
if (colorWriteMask & dawn::ColorWriteMask::Red) { if (writeMask & dawn::ColorWriteMask::Red) {
mask |= MTLColorWriteMaskRed; mask |= MTLColorWriteMaskRed;
} }
if (colorWriteMask & dawn::ColorWriteMask::Green) { if (writeMask & dawn::ColorWriteMask::Green) {
mask |= MTLColorWriteMaskGreen; mask |= MTLColorWriteMaskGreen;
} }
if (colorWriteMask & dawn::ColorWriteMask::Blue) { if (writeMask & dawn::ColorWriteMask::Blue) {
mask |= MTLColorWriteMaskBlue; mask |= MTLColorWriteMaskBlue;
} }
if (colorWriteMask & dawn::ColorWriteMask::Alpha) { if (writeMask & dawn::ColorWriteMask::Alpha) {
mask |= MTLColorWriteMaskAlpha; mask |= MTLColorWriteMaskAlpha;
} }
@ -214,7 +214,7 @@ namespace dawn_native { namespace metal {
attachment.destinationAlphaBlendFactor = attachment.destinationAlphaBlendFactor =
MetalBlendFactor(descriptor->alphaBlend.dstFactor, true); MetalBlendFactor(descriptor->alphaBlend.dstFactor, true);
attachment.alphaBlendOperation = MetalBlendOperation(descriptor->alphaBlend.operation); attachment.alphaBlendOperation = MetalBlendOperation(descriptor->alphaBlend.operation);
attachment.writeMask = MetalColorWriteMask(descriptor->colorWriteMask); attachment.writeMask = MetalColorWriteMask(descriptor->writeMask);
} }
MTLStencilOperation MetalStencilOperation(dawn::StencilOperation stencilOperation) { MTLStencilOperation MetalStencilOperation(dawn::StencilOperation stencilOperation) {

View File

@ -103,10 +103,10 @@ namespace dawn_native { namespace opengl {
} else { } else {
glDisablei(GL_BLEND, attachment); glDisablei(GL_BLEND, attachment);
} }
glColorMaski(attachment, descriptor->colorWriteMask & dawn::ColorWriteMask::Red, glColorMaski(attachment, descriptor->writeMask & dawn::ColorWriteMask::Red,
descriptor->colorWriteMask & dawn::ColorWriteMask::Green, descriptor->writeMask & dawn::ColorWriteMask::Green,
descriptor->colorWriteMask & dawn::ColorWriteMask::Blue, descriptor->writeMask & dawn::ColorWriteMask::Blue,
descriptor->colorWriteMask & dawn::ColorWriteMask::Alpha); descriptor->writeMask & dawn::ColorWriteMask::Alpha);
} }
GLuint OpenGLStencilOperation(dawn::StencilOperation stencilOperation) { GLuint OpenGLStencilOperation(dawn::StencilOperation stencilOperation) {

View File

@ -199,7 +199,7 @@ namespace dawn_native { namespace vulkan {
attachment.srcAlphaBlendFactor = VulkanBlendFactor(descriptor->alphaBlend.srcFactor); attachment.srcAlphaBlendFactor = VulkanBlendFactor(descriptor->alphaBlend.srcFactor);
attachment.dstAlphaBlendFactor = VulkanBlendFactor(descriptor->alphaBlend.dstFactor); attachment.dstAlphaBlendFactor = VulkanBlendFactor(descriptor->alphaBlend.dstFactor);
attachment.alphaBlendOp = VulkanBlendOperation(descriptor->alphaBlend.operation); attachment.alphaBlendOp = VulkanBlendOperation(descriptor->alphaBlend.operation);
attachment.colorWriteMask = VulkanColorWriteMask(descriptor->colorWriteMask); attachment.colorWriteMask = VulkanColorWriteMask(descriptor->writeMask);
return attachment; return attachment;
} }

View File

@ -146,7 +146,7 @@ class ColorStateTest : public DawnTest {
dawn::ColorStateDescriptor descriptor; dawn::ColorStateDescriptor descriptor;
descriptor.alphaBlend = blend; descriptor.alphaBlend = blend;
descriptor.colorBlend = blend; descriptor.colorBlend = blend;
descriptor.colorWriteMask = dawn::ColorWriteMask::All; descriptor.writeMask = dawn::ColorWriteMask::All;
SetupSingleSourcePipelines(descriptor); SetupSingleSourcePipelines(descriptor);
@ -176,7 +176,7 @@ class ColorStateTest : public DawnTest {
dawn::ColorStateDescriptor descriptor; dawn::ColorStateDescriptor descriptor;
descriptor.colorBlend = colorBlend; descriptor.colorBlend = colorBlend;
descriptor.alphaBlend = alphaBlend; descriptor.alphaBlend = alphaBlend;
descriptor.colorWriteMask = dawn::ColorWriteMask::All; descriptor.writeMask = dawn::ColorWriteMask::All;
SetupSingleSourcePipelines(descriptor); SetupSingleSourcePipelines(descriptor);
@ -298,7 +298,7 @@ TEST_P(ColorStateTest, Basic) {
dawn::ColorStateDescriptor descriptor; dawn::ColorStateDescriptor descriptor;
descriptor.alphaBlend = blend; descriptor.alphaBlend = blend;
descriptor.colorBlend = blend; descriptor.colorBlend = blend;
descriptor.colorWriteMask = dawn::ColorWriteMask::All; descriptor.writeMask = dawn::ColorWriteMask::All;
SetupSingleSourcePipelines(descriptor); SetupSingleSourcePipelines(descriptor);
@ -680,7 +680,7 @@ TEST_P(ColorStateTest, ColorWriteMask) {
descriptor.alphaBlend = blend; descriptor.alphaBlend = blend;
{ {
// Test single channel color write // Test single channel color write
descriptor.colorWriteMask = dawn::ColorWriteMask::Red; descriptor.writeMask = dawn::ColorWriteMask::Red;
SetupSingleSourcePipelines(descriptor); SetupSingleSourcePipelines(descriptor);
RGBA8 base(32, 64, 128, 192); RGBA8 base(32, 64, 128, 192);
@ -692,7 +692,7 @@ TEST_P(ColorStateTest, ColorWriteMask) {
{ {
// Test multi channel color write // Test multi channel color write
descriptor.colorWriteMask = dawn::ColorWriteMask::Green | dawn::ColorWriteMask::Alpha; descriptor.writeMask = dawn::ColorWriteMask::Green | dawn::ColorWriteMask::Alpha;
SetupSingleSourcePipelines(descriptor); SetupSingleSourcePipelines(descriptor);
RGBA8 base(32, 64, 128, 192); RGBA8 base(32, 64, 128, 192);
@ -704,7 +704,7 @@ TEST_P(ColorStateTest, ColorWriteMask) {
{ {
// Test no channel color write // Test no channel color write
descriptor.colorWriteMask = dawn::ColorWriteMask::None; descriptor.writeMask = dawn::ColorWriteMask::None;
SetupSingleSourcePipelines(descriptor); SetupSingleSourcePipelines(descriptor);
RGBA8 base(32, 64, 128, 192); RGBA8 base(32, 64, 128, 192);
@ -725,7 +725,7 @@ TEST_P(ColorStateTest, ColorWriteMaskBlendingDisabled) {
descriptor.alphaBlend = blend; descriptor.alphaBlend = blend;
descriptor.colorBlend = blend; descriptor.colorBlend = blend;
descriptor.colorWriteMask = dawn::ColorWriteMask::Red; descriptor.writeMask = dawn::ColorWriteMask::Red;
SetupSingleSourcePipelines(descriptor); SetupSingleSourcePipelines(descriptor);
RGBA8 base(32, 64, 128, 192); RGBA8 base(32, 64, 128, 192);
@ -1031,7 +1031,7 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
testDescriptor.cVertexStage.module = vsModule; testDescriptor.cVertexStage.module = vsModule;
testDescriptor.cFragmentStage.module = fsModule; testDescriptor.cFragmentStage.module = fsModule;
testDescriptor.cColorStates[0]->format = renderPass.colorFormat; testDescriptor.cColorStates[0]->format = renderPass.colorFormat;
testDescriptor.cColorStates[0]->colorWriteMask = dawn::ColorWriteMask::Red; testDescriptor.cColorStates[0]->writeMask = dawn::ColorWriteMask::Red;
testPipeline = device.CreateRenderPipeline(&testDescriptor); testPipeline = device.CreateRenderPipeline(&testDescriptor);

View File

@ -94,7 +94,7 @@ TEST_F(WireArgumentTests, CStringArgument) {
colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM; colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
colorStateDescriptor.alphaBlend = blendDescriptor; colorStateDescriptor.alphaBlend = blendDescriptor;
colorStateDescriptor.colorBlend = blendDescriptor; colorStateDescriptor.colorBlend = blendDescriptor;
colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL; colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL;
// Create the input state // Create the input state
DawnInputStateDescriptor inputState; DawnInputStateDescriptor inputState;

View File

@ -84,7 +84,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM; colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
colorStateDescriptor.alphaBlend = blendDescriptor; colorStateDescriptor.alphaBlend = blendDescriptor;
colorStateDescriptor.colorBlend = blendDescriptor; colorStateDescriptor.colorBlend = blendDescriptor;
colorStateDescriptor.colorWriteMask = DAWN_COLOR_WRITE_MASK_ALL; colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL;
// Create the input state // Create the input state
DawnInputStateDescriptor inputState; DawnInputStateDescriptor inputState;

View File

@ -92,7 +92,7 @@ namespace utils {
colorStateDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm; colorStateDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
colorStateDescriptor.alphaBlend = blend; colorStateDescriptor.alphaBlend = blend;
colorStateDescriptor.colorBlend = blend; colorStateDescriptor.colorBlend = blend;
colorStateDescriptor.colorWriteMask = dawn::ColorWriteMask::All; colorStateDescriptor.writeMask = dawn::ColorWriteMask::All;
for (uint32_t i = 0; i < kMaxColorAttachments; ++i) { for (uint32_t i = 0; i < kMaxColorAttachments; ++i) {
mColorStates[i] = colorStateDescriptor; mColorStates[i] = colorStateDescriptor;
cColorStates[i] = &mColorStates[i]; cColorStates[i] = &mColorStates[i];