Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
August 2018
- 62 participants
- 1399 messages
[PATCH 1/2] wbemprox: Add Win32_NetworkAdapterConfiguration::IPAddress property.
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
---
dlls/wbemprox/builtin.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
Aug. 1, 2018
[PATCH vkd3d 14/14] tests: Add test for incompletely initialized pixel shader outputs.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
tests/d3d12.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/tests/d3d12.c b/tests/d3d12.c
index dfc3da7bdec0..a0185951999d 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -7512,6 +7512,83 @@ static void test_shader_interstage_interface(void)
destroy_test_context(&context);
}
+static void test_incompletely_initialized_shader_outputs(void)
+{
+ static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f};
+ ID3D12GraphicsCommandList *command_list;
+ struct test_context_desc desc;
+ struct test_context context;
+ ID3D12CommandQueue *queue;
+ unsigned int i;
+
+ static const DWORD ps_code[] =
+ {
+#if 0
+ float3 color;
+
+ void main(out float4 o : SV_Target)
+ {
+ o.xyz = color;
+ }
+#endif
+ 0x43425844, 0xb5d86526, 0xc6c2455a, 0x8d02fe46, 0x5932818b, 0x00000001, 0x000000bc, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x0000080f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x00000044, 0x00000050, 0x00000011,
+ 0x0100086a, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x00102072, 0x00000000,
+ 0x06000036, 0x00102072, 0x00000000, 0x00208246, 0x00000000, 0x00000000, 0x0100003e,
+ };
+ static const D3D12_SHADER_BYTECODE ps = {ps_code, sizeof(ps_code)};
+ static struct
+ {
+ struct vec4 input;
+ struct vec4 output;
+ }
+ tests[] =
+ {
+ {{0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f}},
+ {{1.0f, 1.0f, 1.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 0.0f}},
+ {{1.0f, 2.0f, 3.0f, 4.0f}, {1.0f, 2.0f, 3.0f, 0.0f}},
+ };
+
+ memset(&desc, 0, sizeof(desc));
+ desc.rt_format = DXGI_FORMAT_R32G32B32A32_FLOAT;
+ desc.no_root_signature = true;
+ if (!init_test_context(&context, &desc))
+ return;
+ command_list = context.list;
+ queue = context.queue;
+
+ context.root_signature = create_32bit_constants_root_signature(context.device,
+ 0, 4, D3D12_SHADER_VISIBILITY_PIXEL);
+ context.pipeline_state = create_pipeline_state(context.device,
+ context.root_signature, desc.rt_format, NULL, &ps, NULL);
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
+ {
+ ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL);
+
+ ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, FALSE, NULL);
+ ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature);
+ ID3D12GraphicsCommandList_SetGraphicsRoot32BitConstants(command_list, 0, 4, &tests[i].input, 0);
+ ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state);
+ ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
+ ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport);
+ ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect);
+ ID3D12GraphicsCommandList_DrawInstanced(command_list, 4, 1, 0, 0);
+
+ transition_resource_state(command_list, context.render_target,
+ D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
+ check_sub_resource_vec4(context.render_target, 0, queue, command_list, &tests[i].output, 0);
+
+ reset_command_list(command_list, context.allocator);
+ transition_resource_state(command_list, context.render_target,
+ D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET);
+ }
+
+ destroy_test_context(&context);
+}
+
static void check_descriptor_range_(unsigned int line, const D3D12_DESCRIPTOR_RANGE *range,
const D3D12_DESCRIPTOR_RANGE *expected_range)
{
@@ -17992,6 +18069,7 @@ START_TEST(d3d12)
run_test(test_shader_instructions);
run_test(test_discard_instruction);
run_test(test_shader_interstage_interface);
+ run_test(test_incompletely_initialized_shader_outputs);
run_test(test_root_signature_byte_code);
run_test(test_cs_constant_buffer);
run_test(test_constant_buffer_relative_addressing);
--
2.16.4
Aug. 1, 2018
[PATCH vkd3d 13/14] libs/vkd3d-shader: Zero-initialize unused shader output components.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
libs/vkd3d-shader/spirv.c | 67 ++++++++++++++++++++++++++++++++++-------------
1 file changed, 49 insertions(+), 18 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index f3344c4763ba..a5dae19ef7cb 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -1863,7 +1863,7 @@ struct vkd3d_dxbc_compiler
bool after_declarations_section;
const struct vkd3d_shader_signature *input_signature;
const struct vkd3d_shader_signature *output_signature;
- struct
+ struct vkd3d_shader_output_info
{
uint32_t id;
enum vkd3d_component_type component_type;
@@ -2129,11 +2129,17 @@ static uint32_t vkd3d_dxbc_compiler_get_constant_float(struct vkd3d_dxbc_compile
return vkd3d_dxbc_compiler_get_constant(compiler, VKD3D_TYPE_FLOAT, 1, (uint32_t *)&value);
}
+static uint32_t vkd3d_dxbc_compiler_get_constant_vector(struct vkd3d_dxbc_compiler *compiler,
+ enum vkd3d_component_type component_type, unsigned int component_count, uint32_t value)
+{
+ const uint32_t values[] = {value, value, value, value};
+ return vkd3d_dxbc_compiler_get_constant(compiler, component_type, component_count, values);
+}
+
static uint32_t vkd3d_dxbc_compiler_get_constant_uint_vector(struct vkd3d_dxbc_compiler *compiler,
uint32_t value, unsigned int component_count)
{
- const uint32_t values[] = {value, value, value, value};
- return vkd3d_dxbc_compiler_get_constant(compiler, VKD3D_TYPE_UINT, component_count, values);
+ return vkd3d_dxbc_compiler_get_constant_vector(compiler, VKD3D_TYPE_UINT, component_count, value);
}
static uint32_t vkd3d_dxbc_compiler_get_constant_float_vector(struct vkd3d_dxbc_compiler *compiler,
@@ -6259,14 +6265,50 @@ void vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler
}
}
+static void vkd3d_dxbc_compiler_emit_store_shader_output(struct vkd3d_dxbc_compiler *compiler,
+ const struct vkd3d_shader_signature_element *output,
+ const struct vkd3d_shader_output_info *output_info, uint32_t val_id)
+{
+ struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
+ uint32_t write_mask, use_mask, uninit_mask, swizzle;
+ unsigned int component_count;
+ uint32_t type_id, zero_id;
+
+ write_mask = output->mask & 0xff;
+ use_mask = (output->mask >> 8) & 0xff;
+ swizzle = get_shader_output_swizzle(compiler, output->register_index);
+ val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler,
+ val_id, VKD3D_TYPE_FLOAT, swizzle, write_mask);
+
+ component_count = vkd3d_write_mask_component_count(write_mask);
+
+ if (output_info->component_type != VKD3D_TYPE_FLOAT)
+ {
+ type_id = vkd3d_spirv_get_type_id(builder, output_info->component_type, component_count);
+ val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
+ }
+
+ uninit_mask = write_mask & use_mask;
+ if (uninit_mask)
+ {
+ /* Set values to 0 for not initialized shader output components. */
+ zero_id = vkd3d_dxbc_compiler_get_constant_vector(compiler,
+ output_info->component_type, VKD3D_VEC4_SIZE, 0);
+ val_id = vkd3d_dxbc_compiler_emit_vector_shuffle(compiler,
+ val_id, zero_id, uninit_mask, output_info->component_type, component_count);
+ }
+
+ vkd3d_spirv_build_op_store(builder, output_info->id, val_id, SpvMemoryAccessMaskNone);
+}
+
static void vkd3d_dxbc_compiler_emit_output_setup_function(struct vkd3d_dxbc_compiler *compiler)
{
- uint32_t void_id, type_id, ptr_type_id, function_type_id, function_id, val_id;
uint32_t param_type_id[MAX_REG_OUTPUT + 1], param_id[MAX_REG_OUTPUT + 1] = {};
const struct vkd3d_shader_signature *signature = compiler->output_signature;
+ uint32_t void_id, type_id, ptr_type_id, function_type_id, function_id;
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
- DWORD write_mask, swizzle, variable_idx;
unsigned int i, count;
+ DWORD variable_idx;
function_id = compiler->output_setup_function_id;
@@ -6309,19 +6351,8 @@ static void vkd3d_dxbc_compiler_emit_output_setup_function(struct vkd3d_dxbc_com
if (!param_id[variable_idx])
continue;
- write_mask = signature->elements[i].mask & 0xff;
- swizzle = get_shader_output_swizzle(compiler, signature->elements[i].register_index);
- val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler,
- param_id[variable_idx], VKD3D_TYPE_FLOAT, swizzle, write_mask);
-
- if (compiler->output_info[i].component_type != VKD3D_TYPE_FLOAT)
- {
- type_id = vkd3d_spirv_get_type_id(builder, compiler->output_info[i].component_type,
- vkd3d_write_mask_component_count(write_mask));
- val_id = vkd3d_spirv_build_op_bitcast(builder, type_id, val_id);
- }
-
- vkd3d_spirv_build_op_store(builder, compiler->output_info[i].id, val_id, SpvMemoryAccessMaskNone);
+ vkd3d_dxbc_compiler_emit_store_shader_output(compiler,
+ &signature->elements[i], &compiler->output_info[i], param_id[variable_idx]);
}
vkd3d_spirv_build_op_return(&compiler->spirv_builder);
--
2.16.4
Aug. 1, 2018
[PATCH vkd3d 12/14] libs/vkd3d-shader: Factor out vkd3d_dxbc_compiler_emit_vector_shuffle().
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
libs/vkd3d-shader/spirv.c | 43 ++++++++++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 142993a42c44..f3344c4763ba 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -2475,6 +2475,30 @@ static uint32_t vkd3d_dxbc_compiler_emit_swizzle(struct vkd3d_dxbc_compiler *com
val_id, VKD3DSP_WRITEMASK_ALL, component_type, swizzle, write_mask);
}
+static uint32_t vkd3d_dxbc_compiler_emit_vector_shuffle(struct vkd3d_dxbc_compiler *compiler,
+ uint32_t vector1_id, uint32_t vector2_id, uint32_t write_mask,
+ enum vkd3d_component_type component_type, unsigned int component_count)
+{
+ struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
+ uint32_t components[VKD3D_VEC4_SIZE];
+ unsigned int i, component_idx;
+ uint32_t type_id;
+
+ assert(component_count <= ARRAY_SIZE(components));
+
+ for (i = 0, component_idx = 0; i < component_count; ++i)
+ {
+ if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
+ components[i] = VKD3D_VEC4_SIZE + component_idx++;
+ else
+ components[i] = i;
+ }
+
+ type_id = vkd3d_spirv_get_type_id(builder, component_type, component_count);
+ return vkd3d_spirv_build_op_vector_shuffle(builder,
+ type_id, vector1_id, vector2_id, components, component_count);
+}
+
static uint32_t vkd3d_dxbc_compiler_emit_load_constant(struct vkd3d_dxbc_compiler *compiler,
const struct vkd3d_shader_register *reg, DWORD swizzle, DWORD write_mask)
{
@@ -2700,9 +2724,8 @@ static void vkd3d_dxbc_compiler_emit_store_reg(struct vkd3d_dxbc_compiler *compi
const struct vkd3d_shader_register *reg, DWORD write_mask, uint32_t val_id)
{
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
- unsigned int i, component_idx, component_count;
- uint32_t components[VKD3D_VEC4_SIZE];
- uint32_t reg_id;
+ uint32_t reg_id, type_id, reg_val_id;
+ unsigned int component_count;
assert(reg->type != VKD3DSPR_IMMCONST);
assert(write_mask);
@@ -2722,21 +2745,11 @@ static void vkd3d_dxbc_compiler_emit_store_reg(struct vkd3d_dxbc_compiler *compi
if (component_count != VKD3D_VEC4_SIZE)
{
- uint32_t type_id, reg_val_id;
-
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_TYPE_FLOAT, VKD3D_VEC4_SIZE);
reg_val_id = vkd3d_spirv_build_op_load(builder, type_id, reg_id, SpvMemoryAccessMaskNone);
- for (i = 0, component_idx = 0; i < ARRAY_SIZE(components); ++i)
- {
- if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
- components[i] = VKD3D_VEC4_SIZE + component_idx++;
- else
- components[i] = i;
- }
-
- val_id = vkd3d_spirv_build_op_vector_shuffle(builder,
- type_id, reg_val_id, val_id, components, ARRAY_SIZE(components));
+ val_id = vkd3d_dxbc_compiler_emit_vector_shuffle(compiler,
+ reg_val_id, val_id, write_mask, VKD3D_TYPE_FLOAT, VKD3D_VEC4_SIZE);
}
vkd3d_spirv_build_op_store(builder, reg_id, val_id, SpvMemoryAccessMaskNone);
--
2.16.4
Aug. 1, 2018
[PATCH vkd3d 11/14] libs/vkd3d-shader: Determine shader output component count based on shader signature.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
libs/vkd3d-shader/spirv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 0549fb9a85bc..142993a42c44 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -3247,13 +3247,13 @@ static uint32_t vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *comp
else
{
component_type = signature_element ? signature_element->component_type : VKD3D_TYPE_FLOAT;
- output_component_count = component_count;
+ output_component_count = vkd3d_write_mask_component_count(signature_element->mask & 0xff);
}
assert(component_count <= output_component_count);
storage_class = SpvStorageClassOutput;
id = vkd3d_dxbc_compiler_emit_variable(compiler, &builder->global_stream,
- storage_class, component_type, component_count);
+ storage_class, component_type, output_component_count);
vkd3d_spirv_add_iface_variable(builder, id);
if (builtin)
{
--
2.16.4
Aug. 1, 2018
[PATCH vkd3d 10/14] libs/vkd3d-shader: Fix vkd3d_find_signature_element_for_reg().
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
The exact match of write masks between a shader signature and
dcl_input/dcl_output instructions isn't required.
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
libs/vkd3d-shader/spirv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 26052f2e2068..0549fb9a85bc 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -3016,7 +3016,7 @@ static const struct vkd3d_shader_signature_element *vkd3d_find_signature_element
for (signature_idx = 0; signature_idx < signature->element_count; ++signature_idx)
{
if (signature->elements[signature_idx].register_index == reg_idx
- && (signature->elements[signature_idx].mask & 0xff) == write_mask)
+ && (signature->elements[signature_idx].mask & write_mask) == write_mask)
{
if (signature_element_index)
*signature_element_index = signature_idx;
--
2.16.4
Aug. 1, 2018
[PATCH vkd3d 09/14] tests: Add tests for indexable temporary registers.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
tests/d3d12.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)
diff --git a/tests/d3d12.c b/tests/d3d12.c
index e61fd3b972c3..dfc3da7bdec0 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -5677,6 +5677,76 @@ static void test_shader_instructions(void)
0x0000d000, 0x001020c2, 0x00000000, 0x00208406, 0x00000000, 0x00000000, 0x0100003e,
};
static const D3D12_SHADER_BYTECODE ps_sincos = {ps_sincos_code, sizeof(ps_sincos_code)};
+ static const DWORD ps_indexable_temp_code[] =
+ {
+#if 0
+ float index;
+
+ float4 main() : SV_Target
+ {
+ float4 colors[] =
+ {
+ float4(1.0f, 0.0f, 0.0f, 1.0f),
+ float4(0.0f, 1.0f, 0.0f, 1.0f),
+ float4(0.0f, 0.0f, 1.0f, 1.0f),
+ };
+ return colors[index];
+ }
+#endif
+ 0x43425844, 0x82c65bbb, 0x5b713473, 0xa16ebe60, 0xdcc329be, 0x00000001, 0x00000170, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x000000f8, 0x00000050, 0x0000003e,
+ 0x0100086a, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000,
+ 0x02000068, 0x00000001, 0x04000069, 0x00000000, 0x00000003, 0x00000004, 0x09000036, 0x00203072,
+ 0x00000000, 0x00000000, 0x00004002, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x09000036,
+ 0x00203072, 0x00000000, 0x00000001, 0x00004002, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
+ 0x09000036, 0x00203072, 0x00000000, 0x00000002, 0x00004002, 0x00000000, 0x00000000, 0x3f800000,
+ 0x00000000, 0x0600001c, 0x00100012, 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x07000036,
+ 0x00102072, 0x00000000, 0x04203246, 0x00000000, 0x0010000a, 0x00000000, 0x05000036, 0x00102082,
+ 0x00000000, 0x00004001, 0x3f800000, 0x0100003e,
+ };
+ static const D3D12_SHADER_BYTECODE ps_indexable_temp = {ps_indexable_temp_code, sizeof(ps_indexable_temp_code)};
+ static const DWORD ps_indexable_temp2_code[] =
+ {
+#if 0
+ float index;
+
+ float4 main() : SV_Target
+ {
+ uint remap[] = {0, 1, 2, 2, 1, 0, 1, 1, 2, 2};
+ float4 colors[] =
+ {
+ float4(1.0f, 0.0f, 0.0f, 1.0f),
+ float4(0.0f, 1.0f, 0.0f, 1.0f),
+ float4(0.0f, 0.0f, 1.0f, 1.0f),
+ };
+ return colors[remap[index]];
+ }
+#endif
+ 0x43425844, 0xcacc5b8f, 0x19bb905e, 0x6af8eae1, 0x80654684, 0x00000001, 0x0000028c, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x00000214, 0x00000050, 0x00000085,
+ 0x0100086a, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000,
+ 0x02000068, 0x00000001, 0x04000069, 0x00000000, 0x0000000a, 0x00000004, 0x04000069, 0x00000001,
+ 0x00000003, 0x00000004, 0x06000036, 0x00203012, 0x00000000, 0x00000000, 0x00004001, 0x00000000,
+ 0x06000036, 0x00203012, 0x00000000, 0x00000001, 0x00004001, 0x00000001, 0x06000036, 0x00203012,
+ 0x00000000, 0x00000002, 0x00004001, 0x00000002, 0x06000036, 0x00203012, 0x00000000, 0x00000003,
+ 0x00004001, 0x00000002, 0x06000036, 0x00203012, 0x00000000, 0x00000004, 0x00004001, 0x00000001,
+ 0x06000036, 0x00203012, 0x00000000, 0x00000005, 0x00004001, 0x00000000, 0x06000036, 0x00203012,
+ 0x00000000, 0x00000006, 0x00004001, 0x00000001, 0x06000036, 0x00203012, 0x00000000, 0x00000007,
+ 0x00004001, 0x00000001, 0x06000036, 0x00203012, 0x00000000, 0x00000008, 0x00004001, 0x00000002,
+ 0x06000036, 0x00203012, 0x00000000, 0x00000009, 0x00004001, 0x00000002, 0x09000036, 0x00203072,
+ 0x00000001, 0x00000000, 0x00004002, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x09000036,
+ 0x00203072, 0x00000001, 0x00000001, 0x00004002, 0x00000000, 0x3f800000, 0x00000000, 0x00000000,
+ 0x09000036, 0x00203072, 0x00000001, 0x00000002, 0x00004002, 0x00000000, 0x00000000, 0x3f800000,
+ 0x00000000, 0x0600001c, 0x00100012, 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x07000036,
+ 0x00100012, 0x00000000, 0x0420300a, 0x00000000, 0x0010000a, 0x00000000, 0x07000036, 0x00102072,
+ 0x00000000, 0x04203246, 0x00000001, 0x0010000a, 0x00000000, 0x05000036, 0x00102082, 0x00000000,
+ 0x00004001, 0x3f800000, 0x0100003e,
+ };
+ static const D3D12_SHADER_BYTECODE ps_indexable_temp2 = {ps_indexable_temp2_code, sizeof(ps_indexable_temp2_code)};
static const DWORD ps_bfi_code[] =
{
#if 0
@@ -6509,6 +6579,21 @@ static void test_shader_instructions(void)
{&ps_sincos, {{ 0.0f, -0.0f, 0.0f, -0.0f}}, {{ 0.0f, -0.0f, 1.0f, 1.0f}}},
{&ps_sincos, {{ 0.0f, -0.0f, M_PI, -M_PI}}, {{ 0.0f, -0.0f, 1.0f, 1.0f}}},
+
+ {&ps_indexable_temp, {{0.0f}}, {{1.0f, 0.0f, 0.0f, 1.0f}}},
+ {&ps_indexable_temp, {{1.0f}}, {{0.0f, 1.0f, 0.0f, 1.0f}}},
+ {&ps_indexable_temp, {{2.0f}}, {{0.0f, 0.0f, 1.0f, 1.0f}}},
+
+ {&ps_indexable_temp2, {{0.0f}}, {{1.0f, 0.0f, 0.0f, 1.0f}}},
+ {&ps_indexable_temp2, {{1.0f}}, {{0.0f, 1.0f, 0.0f, 1.0f}}},
+ {&ps_indexable_temp2, {{2.0f}}, {{0.0f, 0.0f, 1.0f, 1.0f}}},
+ {&ps_indexable_temp2, {{3.0f}}, {{0.0f, 0.0f, 1.0f, 1.0f}}},
+ {&ps_indexable_temp2, {{4.0f}}, {{0.0f, 1.0f, 0.0f, 1.0f}}},
+ {&ps_indexable_temp2, {{5.0f}}, {{1.0f, 0.0f, 0.0f, 1.0f}}},
+ {&ps_indexable_temp2, {{6.0f}}, {{0.0f, 1.0f, 0.0f, 1.0f}}},
+ {&ps_indexable_temp2, {{7.0f}}, {{0.0f, 1.0f, 0.0f, 1.0f}}},
+ {&ps_indexable_temp2, {{8.0f}}, {{0.0f, 0.0f, 1.0f, 1.0f}}},
+ {&ps_indexable_temp2, {{9.0f}}, {{0.0f, 0.0f, 1.0f, 1.0f}}},
};
static const struct
--
2.16.4
Aug. 1, 2018
[PATCH vkd3d 08/14] libs/vkd3d-shader: Add support for indexable temporary registers.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
libs/vkd3d-shader/spirv.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 797ea1c4018e..26052f2e2068 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -2195,6 +2195,9 @@ static bool vkd3d_dxbc_compiler_get_register_name(char *buffer, unsigned int buf
case VKD3DSPR_GROUPSHAREDMEM:
snprintf(buffer, buffer_size, "g%u", reg->idx[0].offset);
break;
+ case VKD3DSPR_IDXTEMP:
+ snprintf(buffer, buffer_size, "x%u", idx);
+ break;
default:
FIXME("Unhandled register %#x.\n", reg->type);
snprintf(buffer, buffer_size, "unrecognized_%#x", reg->type);
@@ -2359,6 +2362,10 @@ static void vkd3d_dxbc_compiler_emit_dereference_register(struct vkd3d_dxbc_comp
{
indexes[index_count++] = vkd3d_dxbc_compiler_emit_register_addressing(compiler, ®->idx[0]);
}
+ else if (reg->type == VKD3DSPR_IDXTEMP)
+ {
+ indexes[index_count++] = vkd3d_dxbc_compiler_emit_register_addressing(compiler, ®->idx[1]);
+ }
else
{
if (reg->idx[0].rel_addr || reg->idx[1].rel_addr)
@@ -2387,6 +2394,7 @@ static uint32_t vkd3d_dxbc_compiler_get_register_id(struct vkd3d_dxbc_compiler *
switch (reg->type)
{
case VKD3DSPR_TEMP:
+ case VKD3DSPR_IDXTEMP:
case VKD3DSPR_INPUT:
case VKD3DSPR_OUTPUT:
case VKD3DSPR_COLOROUT:
@@ -3336,6 +3344,40 @@ static void vkd3d_dxbc_compiler_emit_dcl_temps(struct vkd3d_dxbc_compiler *compi
vkd3d_spirv_end_function_stream_insertion(builder);
}
+static void vkd3d_dxbc_compiler_emit_dcl_indexable_temp(struct vkd3d_dxbc_compiler *compiler,
+ const struct vkd3d_shader_instruction *instruction)
+{
+ const struct vkd3d_shader_indexable_temp *temp = &instruction->declaration.indexable_temp;
+ struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
+ struct vkd3d_shader_register reg;
+ struct vkd3d_symbol reg_symbol;
+ uint32_t id;
+
+ if (temp->component_count != 4)
+ FIXME("Unhandled component count %u.\n", temp->component_count);
+
+ memset(®, 0, sizeof(reg));
+ reg.type = VKD3DSPR_IDXTEMP;
+ reg.idx[0].offset = temp->register_idx;
+ reg.idx[1].offset = ~0u;
+
+ vkd3d_spirv_begin_function_stream_insertion(builder, builder->main_function_location);
+
+ id = vkd3d_dxbc_compiler_emit_array_variable(compiler, &builder->function_stream,
+ SpvStorageClassFunction, VKD3D_TYPE_FLOAT, VKD3D_VEC4_SIZE, temp->register_size);
+
+ vkd3d_dxbc_compiler_emit_register_debug_name(builder, id, ®);
+
+ vkd3d_spirv_end_function_stream_insertion(builder);
+
+ vkd3d_symbol_make_register(®_symbol, ®);
+ reg_symbol.id = id;
+ reg_symbol.info.reg.storage_class = SpvStorageClassFunction;
+ reg_symbol.info.reg.component_type = VKD3D_TYPE_FLOAT;
+ reg_symbol.info.reg.write_mask = VKD3DSP_WRITEMASK_ALL;
+ vkd3d_dxbc_compiler_put_symbol(compiler, ®_symbol);
+}
+
static void vkd3d_dxbc_compiler_emit_push_constant_buffers(struct vkd3d_dxbc_compiler *compiler)
{
const SpvStorageClass storage_class = SpvStorageClassPushConstant;
@@ -5932,6 +5974,9 @@ void vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler
case VKD3DSIH_DCL_TEMPS:
vkd3d_dxbc_compiler_emit_dcl_temps(compiler, instruction);
break;
+ case VKD3DSIH_DCL_INDEXABLE_TEMP:
+ vkd3d_dxbc_compiler_emit_dcl_indexable_temp(compiler, instruction);
+ break;
case VKD3DSIH_DCL_CONSTANT_BUFFER:
vkd3d_dxbc_compiler_emit_dcl_constant_buffer(compiler, instruction);
break;
--
2.16.4
Aug. 1, 2018
[PATCH vkd3d 07/14] libs/vkd3d-shader: Translate partial derivative instructions.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
libs/vkd3d-shader/spirv.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 21d6a1a33288..797ea1c4018e 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -4954,6 +4954,63 @@ static void vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_
}
}
+static void vkd3d_dxbc_compiler_emit_deriv_instruction(struct vkd3d_dxbc_compiler *compiler,
+ const struct vkd3d_shader_instruction *instruction)
+{
+ struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
+ const struct vkd3d_shader_dst_param *dst = instruction->dst;
+ const struct vkd3d_shader_src_param *src = instruction->src;
+ const struct instruction_info *info;
+ uint32_t type_id, src_id, val_id;
+ unsigned int component_count;
+ unsigned int i;
+
+ static const struct instruction_info
+ {
+ enum VKD3D_SHADER_INSTRUCTION_HANDLER handler_idx;
+ SpvOp op;
+ bool needs_derivative_control;
+ }
+ deriv_instructions[] =
+ {
+ {VKD3DSIH_DSX, SpvOpDPdx},
+ {VKD3DSIH_DSX_COARSE, SpvOpDPdxCoarse, true},
+ {VKD3DSIH_DSX_FINE, SpvOpDPdxFine, true},
+ {VKD3DSIH_DSY, SpvOpDPdy},
+ {VKD3DSIH_DSY_COARSE, SpvOpDPdyCoarse, true},
+ {VKD3DSIH_DSY_FINE, SpvOpDPdyFine, true},
+ };
+
+ info = NULL;
+ for (i = 0; i < ARRAY_SIZE(deriv_instructions); ++i)
+ {
+ if (deriv_instructions[i].handler_idx == instruction->handler_idx)
+ {
+ info = &deriv_instructions[i];
+ break;
+ }
+ }
+ if (!info)
+ {
+ ERR("Unexpected instruction %#x.\n", instruction->handler_idx);
+ return;
+ }
+
+ if (info->needs_derivative_control)
+ vkd3d_spirv_enable_capability(builder, SpvCapabilityDerivativeControl);
+
+ assert(instruction->dst_count == 1);
+ assert(instruction->src_count == 1);
+
+ component_count = vkd3d_write_mask_component_count(dst->write_mask);
+ type_id = vkd3d_spirv_get_type_id(builder,
+ vkd3d_component_type_from_data_type(dst->reg.data_type), component_count);
+
+ src_id = vkd3d_dxbc_compiler_emit_load_src(compiler, src, dst->write_mask);
+ val_id = vkd3d_spirv_build_op_tr1(builder, &builder->function_stream, info->op, type_id, src_id);
+ vkd3d_dxbc_compiler_emit_store_dst(compiler, dst, val_id);
+}
+
struct vkd3d_shader_image
{
uint32_t id;
@@ -6060,6 +6117,14 @@ void vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler
case VKD3DSIH_TEXKILL:
vkd3d_dxbc_compiler_emit_control_flow_instruction(compiler, instruction);
break;
+ case VKD3DSIH_DSX:
+ case VKD3DSIH_DSX_COARSE:
+ case VKD3DSIH_DSX_FINE:
+ case VKD3DSIH_DSY:
+ case VKD3DSIH_DSY_COARSE:
+ case VKD3DSIH_DSY_FINE:
+ vkd3d_dxbc_compiler_emit_deriv_instruction(compiler, instruction);
+ break;
case VKD3DSIH_LD:
vkd3d_dxbc_compiler_emit_ld(compiler, instruction);
break;
--
2.16.4
Aug. 1, 2018
[PATCH vkd3d 06/14] tests: Add test for sincos instruction.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
tests/d3d12.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 83ec6c83b6b4..e61fd3b972c3 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -5658,6 +5658,25 @@ static void test_shader_instructions(void)
0x06000081, 0x001020f2, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x0100003e,
};
static const D3D12_SHADER_BYTECODE ps_rcp_vector = {ps_rcp_vector_code, sizeof(ps_rcp_vector_code)};
+ static const DWORD ps_sincos_code[] =
+ {
+#if 0
+ float2 src0;
+
+ void main(out float4 dst : SV_Target)
+ {
+ sincos(src0, dst.xy, dst.zw);
+ }
+#endif
+ 0x43425844, 0xb47a22ec, 0xdb165106, 0xeee971d7, 0x8836fcc0, 0x00000001, 0x000000dc, 0x00000003,
+ 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f,
+ 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
+ 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x00000064, 0x00000050, 0x00000019,
+ 0x0100086a, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000,
+ 0x0700004d, 0x00102032, 0x00000000, 0x0000d000, 0x00208046, 0x00000000, 0x00000000, 0x0700004d,
+ 0x0000d000, 0x001020c2, 0x00000000, 0x00208406, 0x00000000, 0x00000000, 0x0100003e,
+ };
+ static const D3D12_SHADER_BYTECODE ps_sincos = {ps_sincos_code, sizeof(ps_sincos_code)};
static const DWORD ps_bfi_code[] =
{
#if 0
@@ -6487,6 +6506,9 @@ static void test_shader_instructions(void)
{&ps_rcp, {{ 2.0f}}, {{ 0.5f}}},
{&ps_rcp_vector, {{-1.0f, 1.0f, 4.0f, -4.0f}}, {{-1.0f, 1.0f, 0.25f, -0.25f}}},
+
+ {&ps_sincos, {{ 0.0f, -0.0f, 0.0f, -0.0f}}, {{ 0.0f, -0.0f, 1.0f, 1.0f}}},
+ {&ps_sincos, {{ 0.0f, -0.0f, M_PI, -M_PI}}, {{ 0.0f, -0.0f, 1.0f, 1.0f}}},
};
static const struct
--
2.16.4
Aug. 1, 2018