=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d: Validate D3D12_BLEND_DESC.
Alexandre Julliard
julliard at winehq.org
Thu Aug 23 13:43:17 CDT 2018
Module: vkd3d
Branch: master
Commit: bdc848b27a255cc3e55179f1b0259f6e7786ae88
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=bdc848b27a255cc3e55179f1b0259f6e7786ae88
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Thu Aug 23 18:33:07 2018 +0200
vkd3d: Validate D3D12_BLEND_DESC.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d/command.c | 1 -
libs/vkd3d/state.c | 24 ++++++++++++++++++++----
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index 3c254c0..7aa1695 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -1786,7 +1786,6 @@ static bool d3d12_command_list_update_current_pipeline(struct d3d12_command_list
blend_desc.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
blend_desc.pNext = NULL;
blend_desc.flags = 0;
- /* FIXME: Logic ops are per-target in D3D. */
blend_desc.logicOpEnable = VK_FALSE;
blend_desc.logicOp = VK_LOGIC_OP_COPY;
blend_desc.attachmentCount = state->attachment_count - state->rt_idx;
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 43b1c15..5e401fd 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -1876,6 +1876,9 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
state->vk_set_layout = VK_NULL_HANDLE;
state->uav_counters = NULL;
state->uav_counter_mask = 0;
+ graphics->stage_count = 0;
+
+ memset(&input_signature, 0, sizeof(input_signature));
if (!(root_signature = unsafe_impl_from_ID3D12RootSignature(desc->pRootSignature)))
{
@@ -1943,7 +1946,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
for (i = 0; i < rt_count; ++i)
{
- unsigned int blend_idx = desc->BlendState.IndependentBlendEnable ? i : 0;
+ const D3D12_RENDER_TARGET_BLEND_DESC *rt_desc;
size_t idx = graphics->rt_idx + i;
if (!(format = vkd3d_get_format(desc->RTVFormats[i], false)))
@@ -1953,6 +1956,20 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
goto fail;
}
+ rt_desc = &desc->BlendState.RenderTarget[desc->BlendState.IndependentBlendEnable ? i : 0];
+ if (desc->BlendState.IndependentBlendEnable && rt_desc->LogicOpEnable)
+ {
+ WARN("IndependentBlendEnable must be FALSE when logic operations are enabled.\n");
+ hr = E_INVALIDARG;
+ goto fail;
+ }
+ if (rt_desc->BlendEnable && rt_desc->LogicOpEnable)
+ {
+ WARN("Only one of BlendEnable or LogicOpEnable can be set to TRUE.");
+ hr = E_INVALIDARG;
+ goto fail;
+ }
+
ps_output_swizzle[i] = vkd3d_get_rt_format_swizzle(format);
graphics->attachments[idx].flags = 0;
@@ -1968,7 +1985,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
graphics->attachment_references[idx].attachment = idx;
graphics->attachment_references[idx].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
- blend_attachment_from_d3d12(&graphics->blend_attachments[i], &desc->BlendState.RenderTarget[blend_idx]);
+ blend_attachment_from_d3d12(&graphics->blend_attachments[i], rt_desc);
}
graphics->attachment_count = graphics->rt_idx + rt_count;
@@ -1983,8 +2000,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
shader_interface.uav_counters = NULL;
shader_interface.uav_counter_count = 0;
- memset(&input_signature, 0, sizeof(input_signature));
- for (i = 0, graphics->stage_count = 0; i < ARRAY_SIZE(shader_stages); ++i)
+ for (i = 0; i < ARRAY_SIZE(shader_stages); ++i)
{
const D3D12_SHADER_BYTECODE *b = (const void *)((uintptr_t)desc + shader_stages[i].offset);
const struct vkd3d_shader_code dxbc = {b->pShaderBytecode, b->BytecodeLength};
More information about the wine-cvs
mailing list