Add SetBlendColor command
This commit is contained in:
parent
476e5cbe30
commit
fb4265387c
12
next.json
12
next.json
|
@ -441,6 +441,15 @@
|
|||
{"name": "reference", "type": "uint32_t"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "set blend color",
|
||||
"args": [
|
||||
{"name": "r", "type": "float"},
|
||||
{"name": "g", "type": "float"},
|
||||
{"name": "b", "type": "float"},
|
||||
{"name": "a", "type": "float"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "set bind group",
|
||||
"args": [
|
||||
|
@ -688,6 +697,9 @@
|
|||
{"value": 1, "name":"linear"}
|
||||
]
|
||||
},
|
||||
"float": {
|
||||
"category": "native"
|
||||
},
|
||||
"framebuffer": {
|
||||
"category": "object"
|
||||
},
|
||||
|
|
|
@ -236,6 +236,12 @@ namespace backend {
|
|||
cmd->~SetStencilReferenceCmd();
|
||||
}
|
||||
break;
|
||||
case Command::SetBlendColor:
|
||||
{
|
||||
SetBlendColorCmd* cmd = commands->NextCommand<SetBlendColorCmd>();
|
||||
cmd->~SetBlendColorCmd();
|
||||
}
|
||||
break;
|
||||
case Command::SetBindGroup:
|
||||
{
|
||||
SetBindGroupCmd* cmd = commands->NextCommand<SetBindGroupCmd>();
|
||||
|
@ -345,6 +351,10 @@ namespace backend {
|
|||
commands->NextCommand<SetStencilReferenceCmd>();
|
||||
break;
|
||||
|
||||
case Command::SetBlendColor:
|
||||
commands->NextCommand<SetBlendColorCmd>();
|
||||
break;
|
||||
|
||||
case Command::SetBindGroup:
|
||||
commands->NextCommand<SetBindGroupCmd>();
|
||||
break;
|
||||
|
@ -570,6 +580,16 @@ namespace backend {
|
|||
}
|
||||
break;
|
||||
|
||||
case Command::SetBlendColor:
|
||||
{
|
||||
iterator.NextCommand<SetBlendColorCmd>();
|
||||
if (!state->HaveRenderPass()) {
|
||||
HandleError("Can't set blend color without an active render pass");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Command::SetBindGroup:
|
||||
{
|
||||
SetBindGroupCmd* cmd = iterator.NextCommand<SetBindGroupCmd>();
|
||||
|
@ -779,6 +799,15 @@ namespace backend {
|
|||
cmd->reference = reference;
|
||||
}
|
||||
|
||||
void CommandBufferBuilder::SetBlendColor(float r, float g, float b, float a) {
|
||||
SetBlendColorCmd* cmd = allocator.Allocate<SetBlendColorCmd>(Command::SetBlendColor);
|
||||
new(cmd) SetBlendColorCmd;
|
||||
cmd->r = r;
|
||||
cmd->g = g;
|
||||
cmd->b = b;
|
||||
cmd->a = a;
|
||||
}
|
||||
|
||||
void CommandBufferBuilder::SetBindGroup(uint32_t groupIndex, BindGroupBase* group) {
|
||||
if (groupIndex >= kMaxBindGroups) {
|
||||
HandleError("Setting bind group over the max");
|
||||
|
|
|
@ -81,6 +81,7 @@ namespace backend {
|
|||
void SetComputePipeline(ComputePipelineBase* pipeline);
|
||||
void SetRenderPipeline(RenderPipelineBase* pipeline);
|
||||
void SetStencilReference(uint32_t reference);
|
||||
void SetBlendColor(float r, float g, float b, float a);
|
||||
void SetBindGroup(uint32_t groupIndex, BindGroupBase* group);
|
||||
void SetIndexBuffer(BufferBase* buffer, uint32_t offset, nxt::IndexFormat format);
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace backend {
|
|||
SetRenderPipeline,
|
||||
SetPushConstants,
|
||||
SetStencilReference,
|
||||
SetBlendColor,
|
||||
SetBindGroup,
|
||||
SetIndexBuffer,
|
||||
SetVertexBuffers,
|
||||
|
@ -139,6 +140,10 @@ namespace backend {
|
|||
uint32_t reference;
|
||||
};
|
||||
|
||||
struct SetBlendColorCmd {
|
||||
float r, g, b, a;
|
||||
};
|
||||
|
||||
struct SetBindGroupCmd {
|
||||
uint32_t index;
|
||||
Ref<BindGroupBase> group;
|
||||
|
|
|
@ -485,6 +485,14 @@ namespace d3d12 {
|
|||
}
|
||||
break;
|
||||
|
||||
case Command::SetBlendColor:
|
||||
{
|
||||
SetBlendColorCmd* cmd = commands.NextCommand<SetBlendColorCmd>();
|
||||
ASSERT(lastRenderPipeline);
|
||||
commandList->OMSetBlendFactor(static_cast<const FLOAT*>(&cmd->r));
|
||||
}
|
||||
break;
|
||||
|
||||
case Command::SetBindGroup:
|
||||
{
|
||||
SetBindGroupCmd* cmd = commands.NextCommand<SetBindGroupCmd>();
|
||||
|
|
|
@ -402,6 +402,20 @@ namespace metal {
|
|||
}
|
||||
break;
|
||||
|
||||
case Command::SetBlendColor:
|
||||
{
|
||||
SetBlendColorCmd* cmd = commands.NextCommand<SetBlendColorCmd>();
|
||||
|
||||
ASSERT(encoders.render);
|
||||
|
||||
[encoders.render
|
||||
setBlendColorRed:cmd->r
|
||||
green:cmd->g
|
||||
blue:cmd->b
|
||||
alpha:cmd->a ];
|
||||
}
|
||||
break;
|
||||
|
||||
case Command::SetBindGroup:
|
||||
{
|
||||
SetBindGroupCmd* cmd = commands.NextCommand<SetBindGroupCmd>();
|
||||
|
|
|
@ -336,6 +336,12 @@ namespace opengl {
|
|||
}
|
||||
break;
|
||||
|
||||
case Command::SetBlendColor:
|
||||
{
|
||||
commands.NextCommand<SetBlendColorCmd>();
|
||||
}
|
||||
break;
|
||||
|
||||
case Command::SetBindGroup:
|
||||
{
|
||||
SetBindGroupCmd* cmd = commands.NextCommand<SetBindGroupCmd>();
|
||||
|
|
Loading…
Reference in New Issue