Rename setBlendColor->setBlendConstant

Matches most recent spec changes. setBlendColor has been marked as
deprecated.

Bug: chromium:1199057
Change-Id: I4584ce789bd7d14401244509d5ada62a46236a5d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47901
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
This commit is contained in:
Brandon Jones
2021-04-15 19:33:58 +00:00
committed by Commit Bot service account
parent 22b923cc91
commit 413dcf8a40
12 changed files with 56 additions and 30 deletions

View File

@@ -168,9 +168,9 @@ namespace dawn_native {
cmd->~SetScissorRectCmd();
break;
}
case Command::SetBlendColor: {
SetBlendColorCmd* cmd = commands->NextCommand<SetBlendColorCmd>();
cmd->~SetBlendColorCmd();
case Command::SetBlendConstant: {
SetBlendConstantCmd* cmd = commands->NextCommand<SetBlendConstantCmd>();
cmd->~SetBlendConstantCmd();
break;
}
case Command::SetBindGroup: {
@@ -315,8 +315,8 @@ namespace dawn_native {
commands->NextCommand<SetScissorRectCmd>();
break;
case Command::SetBlendColor:
commands->NextCommand<SetBlendColorCmd>();
case Command::SetBlendConstant:
commands->NextCommand<SetBlendConstantCmd>();
break;
case Command::SetBindGroup: {

View File

@@ -59,7 +59,7 @@ namespace dawn_native {
SetStencilReference,
SetViewport,
SetScissorRect,
SetBlendColor,
SetBlendConstant,
SetBindGroup,
SetIndexBuffer,
SetVertexBuffer,
@@ -231,7 +231,7 @@ namespace dawn_native {
uint32_t x, y, width, height;
};
struct SetBlendColorCmd {
struct SetBlendConstantCmd {
Color color;
};

View File

@@ -115,15 +115,22 @@ namespace dawn_native {
});
}
void RenderPassEncoder::APISetBlendColor(const Color* color) {
void RenderPassEncoder::APISetBlendConstant(const Color* color) {
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
SetBlendColorCmd* cmd = allocator->Allocate<SetBlendColorCmd>(Command::SetBlendColor);
SetBlendConstantCmd* cmd =
allocator->Allocate<SetBlendConstantCmd>(Command::SetBlendConstant);
cmd->color = *color;
return {};
});
}
void RenderPassEncoder::APISetBlendColor(const Color* color) {
GetDevice()->EmitDeprecationWarning(
"SetBlendColor has been deprecated in favor of SetBlendConstant.");
APISetBlendConstant(color);
}
void RenderPassEncoder::APISetViewport(float x,
float y,
float width,

View File

@@ -40,7 +40,8 @@ namespace dawn_native {
void APIEndPass();
void APISetStencilReference(uint32_t reference);
void APISetBlendColor(const Color* color);
void APISetBlendConstant(const Color* color);
void APISetBlendColor(const Color* color); // Deprecated
void APISetViewport(float x,
float y,
float width,

View File

@@ -1450,8 +1450,8 @@ namespace dawn_native { namespace d3d12 {
break;
}
case Command::SetBlendColor: {
SetBlendColorCmd* cmd = mCommands.NextCommand<SetBlendColorCmd>();
case Command::SetBlendConstant: {
SetBlendConstantCmd* cmd = mCommands.NextCommand<SetBlendConstantCmd>();
const std::array<float, 4> color = ConvertToFloatColor(cmd->color);
commandList->OMSetBlendFactor(color.data());
break;

View File

@@ -1281,8 +1281,8 @@ namespace dawn_native { namespace metal {
break;
}
case Command::SetBlendColor: {
SetBlendColorCmd* cmd = mCommands.NextCommand<SetBlendColorCmd>();
case Command::SetBlendConstant: {
SetBlendConstantCmd* cmd = mCommands.NextCommand<SetBlendConstantCmd>();
[encoder setBlendColorRed:cmd->color.r
green:cmd->color.g
blue:cmd->color.b

View File

@@ -1218,8 +1218,8 @@ namespace dawn_native { namespace opengl {
break;
}
case Command::SetBlendColor: {
SetBlendColorCmd* cmd = mCommands.NextCommand<SetBlendColorCmd>();
case Command::SetBlendConstant: {
SetBlendConstantCmd* cmd = mCommands.NextCommand<SetBlendConstantCmd>();
const std::array<float, 4> blendColor = ConvertToFloatColor(cmd->color);
gl.BlendColor(blendColor[0], blendColor[1], blendColor[2], blendColor[3]);
break;

View File

@@ -1209,8 +1209,8 @@ namespace dawn_native { namespace vulkan {
return {};
}
case Command::SetBlendColor: {
SetBlendColorCmd* cmd = mCommands.NextCommand<SetBlendColorCmd>();
case Command::SetBlendConstant: {
SetBlendConstantCmd* cmd = mCommands.NextCommand<SetBlendConstantCmd>();
const std::array<float, 4> blendConstants = ConvertToFloatColor(cmd->color);
device->fn.CmdSetBlendConstants(commands, blendConstants.data());
break;