Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • wine/vkd3d
  • stefan/vkd3d
  • cmccarthy/vkd3d
  • giomasce/vkd3d
  • fcasas/vkd3d
  • jactry/vkd3d
  • ReDress/vkd3d
  • mstorsjo/vkd3d
  • huw/vkd3d
  • julliard/vkd3d
  • bshanks/vkd3d
  • zfigura/vkd3d
  • hverbeet/vkd3d
  • DarkShadow44/vkd3d
  • nsivov/vkd3d
  • dhary686/vkd3d
  • Mystral/vkd3d
  • maljaf/vkd3d
  • smcv/vkd3d
  • flibitijibibo/vkd3d
  • q4a/vkd3d
  • jsikorski/vkd3d
  • alesliehughes/vkd3d-alesliehughes
  • vitorhnn/vkd3d
  • agusev/vkd3d
  • etang-cw/vkd3d
  • petrathekat/vkd3d
  • simon.mr995/vkd3d
  • sgwaki/vkd3d
  • jacek/vkd3d
  • fweimer/vkd3d
  • Clara/vkd3d
  • disini/vkd3d
  • antenabr2/vkd3d
  • gilvbp/vkd3d
  • yshui/vkd3d
  • shaunren/vkd3d
  • jennetsaryyewa96/vkd3d
  • Jamesattay/vkd3d
  • zacemmneeto77/vkd3d
  • GermanAizek/vkd3d
  • opespinach/vkd3d
  • ruslanboyka201/vkd3d
  • navi/vkd3d
  • Feifan/vkd3d
  • yashmhmdly172/vkd3d
  • Sec32fun32/vkd3d
  • ritalat/vkd3d
  • ivyl/vkd3d
  • baikaishiuc/vkd3d
  • austin987/vkd3d
  • TornadoCookie/vkd3d
52 results
Show changes
Commits on Source (27)
Showing
with 754 additions and 189 deletions
......@@ -2,8 +2,10 @@ stages:
- image
- build
- test
- deploy
include:
- local: "/gitlab/image.yml"
- local: "/gitlab/build.yml"
- local: "/gitlab/test.yml"
- local: "/gitlab/release.yml"
The Wine team is proud to announce that release 1.9 of vkd3d, the Direct3D to
The Wine team is proud to announce that release 1.10 of vkd3d, the Direct3D to
Vulkan translation library, is now available.
This release contains improvements that are listed in the release notes below.
The main highlights are:
- Yet more improvements to the HLSL compiler.
- A new utility to inspect the contents of DXBC blobs.
- libvkd3d exposes various newer Direct3D 12 interfaces.
- The HLSL compiler supports dynamic indexing of arrays.
- libvkd3d-utils implements various helper functions for manipulating DXBC
blobs.
- Miscellaneous bug fixes.
The source is available from the following location:
https://dl.winehq.org/vkd3d/source/vkd3d-1.9.tar.xz
<https://dl.winehq.org/vkd3d/source/vkd3d-1.10.tar.xz>
The current source can also be pulled directly from the git repository:
https://gitlab.winehq.org/wine/vkd3d.git
<https://gitlab.winehq.org/wine/vkd3d.git>
Vkd3d is available thanks to the work of multiple people. See the file AUTHORS
for the complete list.
----------------------------------------------------------------
What's new in vkd3d 1.9
=======================
*** libvkd3d
- Copying between depth/stencil and colour formats in
ID3D12GraphicsCommandList::CopyResource() is supported.
- The ID3D12Fence1 interface is supported.
*** libvkd3d-shader
- vkd3d_shader_scan() supports retrieving descriptor information for `d3dbc'
shaders. This is one of the requirements for eventual SPIR-V generation from
`d3dbc' sources.
- New features for the HLSL source type:
- Support for the following intrinsic functions:
- clip()
- ddx_coarse() and ddy_coarse()
- ddx_fine() and ddy_fine()
- tex1D(), tex2D(), texCUBE(), and tex3D()
- Constant folding support for more expression types. In particular:
- comparison operators
- floating-point min() and max()
- logical `and' and `or'
- dot products
- square roots
- logarithms
- Support for multi-sample texture object declarations without explicit
sample counts in shader model 4.1 and later shaders.
- Support for using constant expressions as sample counts in multi-sample
texture object declarations.
- Support for variable initialisers using variables declared earlier in the
same declaration list. E.g., `float a = 1, b = a, c = b + 1;'.
- The GetDimensions() texture object method is implemented.
- Matrix swizzles are implemented.
- Parser support for if-statement attributes like `[branch]' and
`[flatten]'.
- Support for the `inline' function modifier.
- Previously, vkd3d_shader_compile() would in some cases return VKD3D_OK
despite compilation failing when targeting legacy Direct3D bytecode. These
cases have been fixed.
- Various HLSL preprocessor fixes for edge cases related to stringification.
- SPIR-V target support for the `linear noperspective centroid' input
interpolation mode.
- New interfaces:
- The vkd3d_shader_scan_signature_info structure extends the
vkd3d_shader_compile_info structure, and can be used to retrieve
descriptions of `dxbc-tpf' and `d3dbc' shader inputs and outputs.
- vkd3d_shader_free_scan_signature_info() is used to free
vkd3d_shader_scan_signature_info structures.
- The VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ORDER compile option can be
used to specify the default matrix packing order for HLSL sources.
- The vkd3d_shader_varying_map_info structure extends the
vkd3d_shader_compile_info structure, and can be used to specify a mapping
between the outputs of a shader stage and the inputs of the next shader
stage.
- vkd3d_shader_build_varying_map() is used to build a mapping between the
outputs of a shader stage and the inputs of the next shader stage.
- The VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_RAW_BUFFER flag returned as part of
the vkd3d_shader_descriptor_info structure indicates the descriptor refers
to a byte-addressed (`raw') buffer resource.
*** vkd3d-compiler
- The `--matrix-storage-order' option can used to specify the default matrix
storage order for HLSL sources.
*** vkd3d-dxbc
- vkd3d-dxbc is a new utility that can be used to inspect the contents of DXBC
blobs.
# What's new in vkd3d 1.10
### libvkd3d
- Creating pipeline state objects from pipeline state stream descriptions is
implemented.
- Depth-bounds testing is implemented.
- When the VK\_KHR\_maintenance2 extension is available, libvkd3d will
explicitly specify the usage flags of Vulkan image views. This is
particularly useful on MoltenVK, where 2D-array views of 3D textures are
subject to usage restrictions.
- The D3D12\_FORMAT\_SUPPORT2\_UAV\_TYPED\_LOAD and/or
D3D12\_FORMAT\_SUPPORT2\_UAV\_TYPED\_STORE feature flags are reported for
UAV formats when the ‘shaderStorageImageReadWithoutFormat’ and/or
‘shaderStorageImageWriteWithoutFormat’ Vulkan device features are
supported.
- The ID3D12Device5 interface is supported.
- The ID3D12GraphicsCommandList5 interface is supported.
- The ID3D12Resource1 interface is supported.
### libvkd3d-shader
- New features for the HLSL source type:
- Support for the following intrinsic functions:
- ceil()
- degrees() and radians()
- fwidth()
- tan()
- tex2Dlod(), tex2Dproj(), texCUBEproj(), and tex3Dproj()
- Constant folding support for more expression types. In particular:
- ternary operators and branches
- reciprocal square roots
- exponentials
- logical ‘not’ on booleans
- bitwise complements
- left/right shifts
- ceil(), floor(), frac(), and saturate()
- Support for dynamic indexing of arrays.
- Support for ‘break’ and ‘continue’ statements.
- Support for ‘switch’ statements.
- The ‘linear’, ‘centroid’, and ‘noperspective’ interpolation modifiers
are supported.
- The ‘RWTexture1DArray’ and ‘RWTexture2DArray’ unordered access view
types are supported.
- ‘\[loop\]’ attributes are accepted on loops.
- u/U and l/L suffixes on integer constants.
- Floating-point values are explicitly clamped to the upper and lower bounds
of the target type by ‘ftoi’ and ‘ftou’ instructions when targeting
SPIR-V. Similarly, NaNs are flushed to zero. Some hardware/drivers would
already do this implicitly, but behaviour for such inputs is undefined as
far as SPIR-V is concerned.
- The VKD3D\_SHADER\_CONFIG environment variable can be used to modify the
behaviour of libvkd3d-shader at run-time, analogous to the existing
VKD3D\_CONFIG environment variable for libvkd3d. See the README for a list
of supported options.
- When scanning legacy Direct3D bytecode using vkd3d\_shader\_scan(),
descriptor information for shader model 2 and 3 combined resource-sampler
pairs is returned in the vkd3d\_shader\_scan\_descriptor\_info structure.
Note that this information is not yet available for shader model 1
sources, although this will likely be added in a future release.
- The Direct3D shader assembly target supports the ‘rasteriser ordered view’
flag (‘\_rov’) on unordered access view declarations.
- New interfaces:
- The VKD3D\_SHADER\_COMPILE\_OPTION\_BACKWARD\_COMPATIBILITY compile
option can be used to specify backward compatibility options. The
VKD3D\_SHADER\_COMPILE\_OPTION\_BACKCOMPAT\_MAP\_SEMANTIC\_NAMES flag is
the only currently supported flag, and can be used to specify that
shader model 1-3 semantic names should be mapped to their shader model
4+ system value equivalents when compiling HLSL sources.
- The VKD3D\_SHADER\_COMPILE\_OPTION\_FRAGMENT\_COORDINATE\_ORIGIN compile
option can be used to specify the origin of fragment coordinates for
SPIR-V targets. This is especially useful in OpenGL environments, where
the origin may be different than in Direct3D or Vulkan environments.
- The vkd3d\_shader\_scan\_combined\_resource\_sampler\_info structure
extends the vkd3d\_shader\_compile\_info structure, and can be used to
retrieve information about the combined resource-sampler pairs used by a
shader. This is especially useful when compiling shaders for usage in
environments without separate binding points for samplers and resources,
like OpenGL.
- vkd3d\_shader\_free\_scan\_combined\_resource\_sampler\_info() is used
to free vkd3d\_shader\_scan\_combined\_resource\_sampler\_info
structures.
### libvkd3d-utils
- Passing the D3DCOMPILE\_ENABLE\_BACKWARDS\_COMPATIBILITY flag to
D3DCompile() and D3DCompile2() will enable mapping shader model 1-3
semantic names to their shader model 4+ system value equivalents.
- New interfaces:
- D3DGetBlobPart() is used to retrieve specific parts of DXBC blobs.
- D3DGetDebugInfo() is used to retrieve debug information from DXBC blobs.
- D3DGetInputAndOutputSignatureBlob() is used to retrieve input and output
signatures from DXBC blobs.
- D3DGetInputSignatureBlob() is used to retrieve input signatures from
DXBC blobs.
- D3DGetOutputSignatureBlob() is used to retrieve output signatures from
DXBC blobs.
- D3DStripShader() is used to remove specific parts from DXBC blobs.
### vkd3d-compiler
- The ‘--fragment-coordinate-origin’ option can be used to specify the
origin of fragment coordinates for SPIR-V targets.
- The ‘--semantic-compat-map’ option can be used to specify that shader
model 1-3 semantic names should be mapped to their shader model 4+ system
value equivalents when compiling HLSL sources.
### vkd3d-dxbc
- The ‘--list’ and ‘--list-data’ options now also output the offsets of
sections inside the input data.
### build
- The minimum required version of Vulkan-Headers for this release is version
1.2.148.
- When available, the libEGL and libOpenGL libraries are used to run the
vkd3d tests in additional configurations. These libraries are not used by
vkd3d itself.
- The SONAME\_LIBDXCOMPILER configure variable can be used specify the
shared object name of the dxcompiler library. When available, it's used to
run the vkd3d tests in additional configurations. The dxcompiler library
is not used by vkd3d itself.
Akihiro Sagawa
Alexandre Julliard
Alistair Leslie-Hughes
Andrew Eikum
......@@ -18,6 +19,7 @@ Giovanni Mascellani
Hans-Kristian Arntzen
Henri Verbeet
Isabella Bosia
Jacek Caban
Jactry Zeng
Jan Sikorski
Joshua Ashton
......@@ -25,6 +27,7 @@ Józef Kucia
Martin Storsjö
Matteo Bruni
Nikolay Sivov
Petrichor Park
Philip Rebohle
Rémi Bernon
Robin Kertels
......
......@@ -307,7 +307,7 @@ libvkd3d_shader_la_SOURCES = \
libs/vkd3d-shader/vkd3d_shader_main.c \
libs/vkd3d-shader/vkd3d_shader_private.h
libvkd3d_shader_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_SHADER_SOURCE -I$(srcdir)/libs/vkd3d-shader @SPIRV_TOOLS_CFLAGS@
libvkd3d_shader_la_LDFLAGS = $(AM_LDFLAGS) -version-info 8:0:7
libvkd3d_shader_la_LDFLAGS = $(AM_LDFLAGS) -version-info 9:0:8
libvkd3d_shader_la_LIBADD = libvkd3d-common.la @SPIRV_TOOLS_LIBS@ -lm
if HAVE_LD_VERSION_SCRIPT
libvkd3d_shader_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libs/vkd3d-shader/vkd3d_shader.map
......@@ -342,7 +342,7 @@ libvkd3d_la_SOURCES = \
libs/vkd3d/vkd3d_shaders.h \
libs/vkd3d/vulkan_procs.h
libvkd3d_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_SOURCE
libvkd3d_la_LDFLAGS = $(AM_LDFLAGS) -version-info 10:0:9
libvkd3d_la_LDFLAGS = $(AM_LDFLAGS) -version-info 11:0:10
libvkd3d_la_LIBADD = libvkd3d-common.la libvkd3d-shader.la @DL_LIBS@ @PTHREAD_LIBS@
if HAVE_LD_VERSION_SCRIPT
libvkd3d_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libs/vkd3d/vkd3d.map
......@@ -354,7 +354,7 @@ libvkd3d_utils_la_SOURCES = \
libs/vkd3d-utils/vkd3d_utils_main.c \
libs/vkd3d-utils/vkd3d_utils_private.h
libvkd3d_utils_la_CFLAGS = $(AM_CFLAGS) -DLIBVKD3D_UTILS_SOURCE
libvkd3d_utils_la_LDFLAGS = $(AM_LDFLAGS) -version-info 4:5:3
libvkd3d_utils_la_LDFLAGS = $(AM_LDFLAGS) -version-info 5:0:4
libvkd3d_utils_la_LIBADD = libvkd3d-common.la libvkd3d-shader.la libvkd3d.la @PTHREAD_LIBS@
if HAVE_LD_VERSION_SCRIPT
libvkd3d_utils_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libs/vkd3d-utils/vkd3d_utils.map
......@@ -483,7 +483,7 @@ cross_implibs = crosslibs/d3d12
CROSS_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/include/private -I$(builddir)/include -I$(builddir)/tests
CROSS_CFLAGS = -g -O2 -Wall -municode ${CROSS_CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=0 -DVKD3D_CROSSTEST=1
EXTRA_DIST += $(cross_implibs:=.cross32.def) $(cross_implibs:=.cross64.def)
EXTRA_DIST += tests/shader_runner_d3d11.c tests/shader_runner_d3d9.c
EXTRA_DIST += tests/driver.c tests/shader_runner_d3d11.c tests/shader_runner_d3d9.c
shader_runner_cross_sources = \
$(srcdir)/tests/shader_runner.c \
......
......@@ -65,6 +65,11 @@ commas or semicolons.
* VKD3D_DISABLE_EXTENSIONS - a list of Vulkan extensions that libvkd3d should
not use even if available.
* VKD3D_SHADER_CONFIG - a list of options that change the behavior of
libvkd3d-shader.
* force_validation - Enable (additional) validation of libvkd3d-shader's
internal representation of shaders.
* VKD3D_SHADER_DEBUG - controls the debug level for log messages produced by
libvkd3d-shader. See VKD3D_DEBUG for accepted values.
......
AC_PREREQ([2.69])
AC_INIT([vkd3d],[1.9])
AC_INIT([vkd3d],[1.10])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])
......@@ -62,6 +62,7 @@ AS_IF([test "x${GCC}" = "xyes"],
VKD3D_CHECK_CFLAGS([-Wimplicit-fallthrough])
VKD3D_CHECK_CFLAGS([-Winit-self])
VKD3D_CHECK_CFLAGS([-Wmissing-prototypes])
VKD3D_CHECK_CFLAGS([-Wshadow])
VKD3D_CHECK_CFLAGS([-Wunused-but-set-parameter])
VKD3D_CHECK_CFLAGS([-Wvla])
VKD3D_CHECK_CFLAGS([-Wpointer-arith])
......
......@@ -19,7 +19,7 @@
#define VK_NO_PROTOTYPES
#define VK_USE_PLATFORM_XCB_KHR
#define VKD3D_UTILS_API_VERSION VKD3D_API_VERSION_1_9
#define VKD3D_UTILS_API_VERSION VKD3D_API_VERSION_1_10
#include "config.h"
#include <vkd3d.h>
#include <vkd3d_utils.h>
......
# CI script for creating releases
create-release:
stage: deploy
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG && $CI_PROJECT_PATH == "wine/vkd3d"
script:
- VERSION=$(expr "$CI_COMMIT_TAG" ":" 'vkd3d-\(.*\)')
- test -n "$VERSION" || exit 1
- URL=$(grep -o "https://dl.winehq.org/[^>]*" ANNOUNCE)
- FILEPATH=$(expr "$URL" ":" '.*\(/.*\)')
- release-cli create
--name "vkd3d $VERSION"
--tag-name "$CI_COMMIT_TAG"
--description ANNOUNCE
--assets-link "{\"name\":\"Source code\",\"url\":\"$URL\",\"link_type\":\"other\",\"filepath\":\"$FILEPATH\"}"
......@@ -78,6 +78,7 @@ enum vkd3d_api_version
VKD3D_API_VERSION_1_7,
VKD3D_API_VERSION_1_8,
VKD3D_API_VERSION_1_9,
VKD3D_API_VERSION_1_10,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_API_VERSION),
};
......
......@@ -51,6 +51,7 @@ enum vkd3d_shader_api_version
VKD3D_SHADER_API_VERSION_1_7,
VKD3D_SHADER_API_VERSION_1_8,
VKD3D_SHADER_API_VERSION_1_9,
VKD3D_SHADER_API_VERSION_1_10,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_API_VERSION),
};
......@@ -191,6 +192,8 @@ enum vkd3d_shader_compile_option_fragment_coordinate_origin
/** Fragment coordinates originate from the lower-left. This matches the
* traditional behaviour of OpenGL environments. */
VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN_LOWER_LEFT = 0x00000001,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN),
};
enum vkd3d_shader_compile_option_name
......@@ -2146,12 +2149,14 @@ VKD3D_SHADER_API int vkd3d_shader_convert_root_signature(struct vkd3d_shader_ver
*
* Currently this function supports the following code types:
* - VKD3D_SHADER_SOURCE_DXBC_TPF
* - VKD3D_SHADER_SOURCE_D3D_BYTECODE
*
* \param compile_info A chained structure containing scan parameters.
* \n
* The DXBC_TPF scanner supports the following chained structures:
* The scanner supports the following chained structures:
* - vkd3d_shader_scan_descriptor_info
* - vkd3d_shader_scan_signature_info
* - vkd3d_shader_scan_combined_resource_sampler_info
* \n
* Although the \a compile_info parameter is read-only, chained structures
* passed to this function need not be, and may serve as output parameters,
......
......@@ -2253,7 +2253,7 @@ static void write_sm1_jump(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
{
struct hlsl_reg *reg = &jump->condition.node->reg;
struct sm1_instruction instr =
struct sm1_instruction sm1_instr =
{
.opcode = D3DSIO_TEXKILL,
......@@ -2263,7 +2263,7 @@ static void write_sm1_jump(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
.has_dst = 1,
};
write_sm1_instruction(ctx, buffer, &instr);
write_sm1_instruction(ctx, buffer, &sm1_instr);
break;
}
......
This diff is collapsed.
......@@ -487,27 +487,27 @@ static void resolve_loop_continue(struct hlsl_ctx *ctx, struct hlsl_block *block
else if (instr->type == HLSL_IR_JUMP)
{
struct hlsl_ir_jump *jump = hlsl_ir_jump(instr);
struct hlsl_block block;
struct hlsl_block cond_block;
if (jump->type != HLSL_IR_JUMP_UNRESOLVED_CONTINUE)
continue;
if (type == LOOP_DO_WHILE)
{
if (!hlsl_clone_block(ctx, &block, cond))
if (!hlsl_clone_block(ctx, &cond_block, cond))
return;
if (!append_conditional_break(ctx, &block))
if (!append_conditional_break(ctx, &cond_block))
{
hlsl_block_cleanup(&block);
hlsl_block_cleanup(&cond_block);
return;
}
list_move_before(&instr->entry, &block.instrs);
list_move_before(&instr->entry, &cond_block.instrs);
}
else if (type == LOOP_FOR)
{
if (!hlsl_clone_block(ctx, &block, iter))
if (!hlsl_clone_block(ctx, &cond_block, iter))
return;
list_move_before(&instr->entry, &block.instrs);
list_move_before(&instr->entry, &cond_block.instrs);
}
jump->type = HLSL_IR_JUMP_CONTINUE;
}
......@@ -3553,7 +3553,7 @@ static bool intrinsic_tex(struct hlsl_ctx *ctx, const struct parse_initializer *
{
struct hlsl_resource_load_params load_params = { 0 };
const struct hlsl_type *sampler_type;
struct hlsl_ir_node *coords, *load;
struct hlsl_ir_node *coords, *sample;
if (params->args_count != 2 && params->args_count != 4)
{
......@@ -3688,9 +3688,9 @@ static bool intrinsic_tex(struct hlsl_ctx *ctx, const struct parse_initializer *
load_params.format = hlsl_get_vector_type(ctx, HLSL_TYPE_FLOAT, 4);
load_params.sampling_dim = dim;
if (!(load = hlsl_new_resource_load(ctx, &load_params, loc)))
if (!(sample = hlsl_new_resource_load(ctx, &load_params, loc)))
return false;
hlsl_block_add_instr(params->instrs, load);
hlsl_block_add_instr(params->instrs, sample);
return true;
}
......
......@@ -1090,7 +1090,7 @@ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
unsigned int dim_count = hlsl_sampler_dim_count(val->data_type->sampler_dim);
struct hlsl_ir_node *coords = index->idx.node;
struct hlsl_resource_load_params params = {0};
struct hlsl_ir_node *load;
struct hlsl_ir_node *resource_load;
assert(coords->data_type->class == HLSL_CLASS_VECTOR);
assert(coords->data_type->base_type == HLSL_TYPE_UINT);
......@@ -1104,9 +1104,9 @@ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
params.coords = coords;
params.format = val->data_type->e.resource_format;
if (!(load = hlsl_new_resource_load(ctx, &params, &instr->loc)))
if (!(resource_load = hlsl_new_resource_load(ctx, &params, &instr->loc)))
return false;
hlsl_block_add_instr(block, load);
hlsl_block_add_instr(block, resource_load);
return true;
}
......@@ -2301,7 +2301,6 @@ static bool normalize_switch_cases(struct hlsl_ctx *ctx, struct hlsl_ir_node *in
struct hlsl_ir_switch_case *c, *def = NULL;
bool missing_terminal_break = false;
struct hlsl_ir_node *node;
struct hlsl_ir_jump *jump;
struct hlsl_ir_switch *s;
if (instr->type != HLSL_IR_SWITCH)
......@@ -2320,10 +2319,7 @@ static bool normalize_switch_cases(struct hlsl_ctx *ctx, struct hlsl_ir_node *in
{
node = LIST_ENTRY(list_tail(&c->body.instrs), struct hlsl_ir_node, entry);
if (node->type == HLSL_IR_JUMP)
{
jump = hlsl_ir_jump(node);
terminal_break = jump->type == HLSL_IR_JUMP_BREAK;
}
terminal_break = (hlsl_ir_jump(node)->type == HLSL_IR_JUMP_BREAK);
}
missing_terminal_break |= !terminal_break;
......
......@@ -777,8 +777,9 @@ static bool shader_signature_merge(struct shader_signature *s, uint8_t range_map
f = &elements[j];
/* Merge different components of the same register unless sysvals are different,
* or it will be relative-addressed. */
* interpolation modes are different, or it will be relative-addressed. */
if (f->register_index != e->register_index || f->sysval_semantic != e->sysval_semantic
|| f->interpolation_mode != e->interpolation_mode
|| range_map_get_register_count(range_map, f->register_index, f->mask) > 1)
break;
......
......@@ -231,7 +231,7 @@ static inline bool register_is_constant_or_undef(const struct vkd3d_shader_regis
#define VKD3D_SPIRV_VERSION 0x00010000
#define VKD3D_SPIRV_GENERATOR_ID 18
#define VKD3D_SPIRV_GENERATOR_VERSION 9
#define VKD3D_SPIRV_GENERATOR_VERSION 10
#define VKD3D_SPIRV_GENERATOR_MAGIC vkd3d_make_u32(VKD3D_SPIRV_GENERATOR_VERSION, VKD3D_SPIRV_GENERATOR_ID)
struct vkd3d_spirv_stream
......@@ -1194,6 +1194,16 @@ static uint32_t vkd3d_spirv_get_op_constant64(struct vkd3d_spirv_builder *builde
(const uint32_t *)&value, 2, vkd3d_spirv_build_op_constant64);
}
static uint32_t vkd3d_spirv_build_op_constant_null(struct vkd3d_spirv_builder *builder, uint32_t result_type)
{
return vkd3d_spirv_build_op_tr(builder, &builder->global_stream, SpvOpConstantNull, result_type);
}
static uint32_t vkd3d_spirv_get_op_constant_null(struct vkd3d_spirv_builder *builder, uint32_t result_type)
{
return vkd3d_spirv_build_once1(builder, SpvOpConstantNull, result_type, vkd3d_spirv_build_op_constant_null);
}
static uint32_t vkd3d_spirv_build_op_constant_composite(struct vkd3d_spirv_builder *builder,
uint32_t result_type, const uint32_t *constituents, unsigned int constituent_count)
{
......@@ -2152,6 +2162,7 @@ static void vkd3d_symbol_make_register(struct vkd3d_symbol *symbol,
break;
case VKD3DSPR_IMMCONSTBUFFER:
symbol->key.reg.idx = reg->idx_count > 1 ? reg->idx[0].offset : 0;
break;
default:
......@@ -3498,7 +3509,7 @@ static void spirv_compiler_emit_dereference_register(struct spirv_compiler *comp
}
else if (reg->type == VKD3DSPR_IMMCONSTBUFFER)
{
indexes[index_count++] = spirv_compiler_emit_register_addressing(compiler, &reg->idx[0]);
indexes[index_count++] = spirv_compiler_emit_register_addressing(compiler, &reg->idx[reg->idx_count - 1]);
}
else if (reg->type == VKD3DSPR_IDXTEMP)
{
......@@ -3756,6 +3767,69 @@ static uint32_t spirv_compiler_emit_load_scalar(struct spirv_compiler *compiler,
return val_id;
}
static uint32_t spirv_compiler_emit_constant_array(struct spirv_compiler *compiler,
const struct vkd3d_shader_immediate_constant_buffer *icb, uint32_t *type_id_out)
{
uint32_t *elements, elem_type_id, length_id, type_id, const_id;
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
enum vkd3d_shader_component_type component_type;
unsigned int i, element_count, component_count;
element_count = icb->element_count;
component_type = vkd3d_component_type_from_data_type(icb->data_type);
component_count = icb->component_count;
elem_type_id = vkd3d_spirv_get_type_id_for_data_type(builder, icb->data_type, component_count);
length_id = spirv_compiler_get_constant_uint(compiler, element_count);
type_id = vkd3d_spirv_get_op_type_array(builder, elem_type_id, length_id);
if (type_id_out)
*type_id_out = type_id;
if (icb->is_null)
{
/* All values are null. Workgroup memory initialisers require OpConstantNull. */
return vkd3d_spirv_get_op_constant_null(builder, type_id);
}
if (!(elements = vkd3d_calloc(element_count, sizeof(*elements))))
{
ERR("Failed to allocate %u elements.", element_count);
spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_OUT_OF_MEMORY,
"Failed to allocate %u constant array elements.", element_count);
return 0;
}
switch (icb->data_type)
{
case VKD3D_DATA_FLOAT:
case VKD3D_DATA_INT:
case VKD3D_DATA_UINT:
for (i = 0; i < element_count; ++i)
elements[i] = spirv_compiler_get_constant(compiler, component_type, component_count,
&icb->data[component_count * i]);
break;
case VKD3D_DATA_DOUBLE:
case VKD3D_DATA_UINT64:
{
uint64_t *data = (uint64_t *)icb->data;
for (i = 0; i < element_count; ++i)
elements[i] = spirv_compiler_get_constant64(compiler, component_type, component_count,
&data[component_count * i]);
break;
}
default:
FIXME("Unhandled data type %u.\n", icb->data_type);
spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_INVALID_TYPE,
"Immediate constant buffer data type %u is unhandled.", icb->data_type);
break;
}
const_id = vkd3d_spirv_build_op_constant_composite(builder, type_id, elements, element_count);
vkd3d_free(elements);
return const_id;
}
static const struct ssa_register_info *spirv_compiler_get_ssa_register_info(const struct spirv_compiler *compiler,
const struct vkd3d_shader_register *reg)
{
......@@ -4455,7 +4529,7 @@ static const struct vkd3d_spirv_builtin *get_spirv_builtin_for_sysval(
enum vkd3d_shader_spirv_environment environment;
unsigned int i;
if (!sysval)
if (sysval == VKD3D_SHADER_SV_NONE || sysval == VKD3D_SHADER_SV_TARGET)
return NULL;
/* In pixel shaders, SV_Position is mapped to SpvBuiltInFragCoord. */
......@@ -4500,8 +4574,11 @@ static const struct vkd3d_spirv_builtin *vkd3d_get_spirv_builtin(const struct sp
if ((builtin = get_spirv_builtin_for_register(reg_type)))
return builtin;
if (sysval != VKD3D_SHADER_SV_NONE || (reg_type != VKD3DSPR_OUTPUT && reg_type != VKD3DSPR_PATCHCONST))
if ((sysval != VKD3D_SHADER_SV_NONE && sysval != VKD3D_SHADER_SV_TARGET)
|| (reg_type != VKD3DSPR_OUTPUT && reg_type != VKD3DSPR_PATCHCONST))
{
FIXME("Unhandled builtin (register type %#x, sysval %#x).\n", reg_type, sysval);
}
return NULL;
}
......@@ -4711,8 +4788,11 @@ static uint32_t spirv_compiler_emit_input(struct spirv_compiler *compiler,
array_sizes[0] = (reg->type == VKD3DSPR_PATCHCONST ? 0 : compiler->input_control_point_count);
array_sizes[1] = signature_element->register_count;
if (array_sizes[1] == 1 && !vsir_sysval_semantic_is_tess_factor(signature_element->sysval_semantic))
if (array_sizes[1] == 1 && !vsir_sysval_semantic_is_tess_factor(signature_element->sysval_semantic)
&& (!vsir_sysval_semantic_is_clip_cull(signature_element->sysval_semantic) || array_sizes[0]))
{
array_sizes[1] = 0;
}
write_mask = signature_element->mask;
......@@ -5487,39 +5567,40 @@ static void spirv_compiler_emit_dcl_indexable_temp(struct spirv_compiler *compil
{
const struct vkd3d_shader_indexable_temp *temp = &instruction->declaration.indexable_temp;
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
uint32_t id, type_id, length_id, ptr_type_id, init_id = 0;
enum vkd3d_shader_component_type component_type;
struct vkd3d_shader_register reg;
struct vkd3d_symbol reg_symbol;
SpvStorageClass storage_class;
size_t function_location;
uint32_t id;
if (temp->component_count != 4)
FIXME("Unhandled component count %u.\n", temp->component_count);
storage_class = SpvStorageClassFunction;
vsir_register_init(&reg, VKD3DSPR_IDXTEMP, VKD3D_DATA_FLOAT, 1);
reg.idx[0].offset = temp->register_idx;
if (temp->alignment)
WARN("Ignoring alignment %u.\n", temp->alignment);
if (temp->initialiser)
{
FIXME("Initialisers are not supported.\n");
spirv_compiler_error(compiler, VKD3D_SHADER_ERROR_SPV_NOT_IMPLEMENTED,
"Initialisers for indexable temps are not supported.");
}
function_location = spirv_compiler_get_current_function_location(compiler);
vkd3d_spirv_begin_function_stream_insertion(builder, function_location);
id = spirv_compiler_emit_array_variable(compiler, &builder->function_stream,
SpvStorageClassFunction, VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_VEC4_SIZE, &temp->register_size, 1);
component_type = vkd3d_component_type_from_data_type(temp->data_type);
type_id = vkd3d_spirv_get_type_id(builder, component_type, temp->component_count);
length_id = spirv_compiler_get_constant_uint(compiler, temp->register_size);
type_id = vkd3d_spirv_get_op_type_array(builder, type_id, length_id);
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, storage_class, type_id);
if (temp->initialiser)
init_id = spirv_compiler_emit_constant_array(compiler, temp->initialiser, NULL);
id = vkd3d_spirv_build_op_variable(builder, &builder->function_stream, ptr_type_id, storage_class, init_id);
spirv_compiler_emit_register_debug_name(builder, id, &reg);
vkd3d_spirv_end_function_stream_insertion(builder);
vkd3d_symbol_make_register(&reg_symbol, &reg);
vkd3d_symbol_set_register_info(&reg_symbol, id,
SpvStorageClassFunction, VKD3D_SHADER_COMPONENT_FLOAT, VKD3DSP_WRITEMASK_ALL);
vkd3d_symbol_set_register_info(&reg_symbol, id, storage_class,
component_type, vkd3d_write_mask_from_component_count(temp->component_count));
spirv_compiler_put_symbol(compiler, &reg_symbol);
}
......@@ -5737,34 +5818,24 @@ static void spirv_compiler_emit_dcl_immediate_constant_buffer(struct spirv_compi
const struct vkd3d_shader_instruction *instruction)
{
const struct vkd3d_shader_immediate_constant_buffer *icb = instruction->declaration.icb;
uint32_t *elements, length_id, type_id, const_id, ptr_type_id, icb_id;
struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
uint32_t type_id, const_id, ptr_type_id, icb_id;
struct vkd3d_shader_register reg;
struct vkd3d_symbol reg_symbol;
unsigned int i;
assert(icb->data_type == VKD3D_DATA_FLOAT);
assert(icb->component_count == VKD3D_VEC4_SIZE);
if (!(elements = vkd3d_calloc(icb->element_count, sizeof(*elements))))
return;
for (i = 0; i < icb->element_count; ++i)
elements[i] = spirv_compiler_get_constant(compiler,
VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_VEC4_SIZE, &icb->data[4 * i]);
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_FLOAT, VKD3D_VEC4_SIZE);
length_id = spirv_compiler_get_constant_uint(compiler, icb->element_count);
type_id = vkd3d_spirv_get_op_type_array(builder, type_id, length_id);
const_id = vkd3d_spirv_build_op_constant_composite(builder, type_id, elements, icb->element_count);
const_id = spirv_compiler_emit_constant_array(compiler, icb, &type_id);
ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, SpvStorageClassPrivate, type_id);
icb_id = vkd3d_spirv_build_op_variable(builder, &builder->global_stream,
ptr_type_id, SpvStorageClassPrivate, const_id);
vkd3d_spirv_build_op_name(builder, icb_id, "icb");
vkd3d_free(elements);
vsir_register_init(&reg, VKD3DSPR_IMMCONSTBUFFER, VKD3D_DATA_FLOAT, 0);
/* Set an index count of 2 so vkd3d_symbol_make_register() uses idx[0] as a buffer id. */
vsir_register_init(&reg, VKD3DSPR_IMMCONSTBUFFER, VKD3D_DATA_FLOAT, 2);
reg.idx[0].offset = icb->register_idx;
vkd3d_symbol_make_register(&reg_symbol, &reg);
vkd3d_symbol_set_register_info(&reg_symbol, icb_id, SpvStorageClassPrivate,
VKD3D_SHADER_COMPONENT_FLOAT, VKD3DSP_WRITEMASK_ALL);
vkd3d_component_type_from_data_type(icb->data_type),
vkd3d_write_mask_from_component_count(icb->component_count));
spirv_compiler_put_symbol(compiler, &reg_symbol);
}
......
......@@ -792,9 +792,11 @@ static void shader_sm4_read_shader_data(struct vkd3d_shader_instruction *ins, ui
ins->handler_idx = VKD3DSIH_INVALID;
return;
}
icb->register_idx = 0;
icb->data_type = VKD3D_DATA_FLOAT;
icb->component_count = VKD3D_VEC4_SIZE;
icb->element_count = icb_size / VKD3D_VEC4_SIZE;
icb->is_null = false;
memcpy(icb->data, tokens, sizeof(*tokens) * icb_size);
shader_instruction_array_add_icb(&priv->p.instructions, icb);
ins->declaration.icb = icb;
......@@ -1930,6 +1932,15 @@ static bool shader_sm4_read_param(struct vkd3d_shader_sm4_parser *priv, const ui
break;
}
}
else if (register_type == VKD3D_SM4_RT_IMMCONSTBUFFER)
{
if (param->idx_count != 1)
{
WARN("Unexpected idx count %u.\n", param->idx_count);
vkd3d_shader_parser_error(&priv->p, VKD3D_SHADER_ERROR_TPF_INVALID_REGISTER_INDEX_COUNT,
"Invalid index count %u for immediate const buffer register; expected count 1.", param->idx_count);
}
}
else if (!shader_is_sm_5_1(priv) && vsir_register_is_descriptor(param))
{
/* SM5.1 places a symbol identifier in idx[0] and moves
......
......@@ -890,6 +890,21 @@ static void vkd3d_shader_scan_combined_sampler_declaration(
&semantic->resource.range, semantic->resource_type, VKD3D_SHADER_RESOURCE_DATA_FLOAT);
}
static const struct vkd3d_shader_descriptor_info1 *find_descriptor(
const struct vkd3d_shader_scan_descriptor_info1 *info,
enum vkd3d_shader_descriptor_type type, unsigned int register_id)
{
for (unsigned int i = 0; i < info->descriptor_count; ++i)
{
const struct vkd3d_shader_descriptor_info1 *d = &info->descriptors[i];
if (d->type == type && d->register_id == register_id)
return d;
}
return NULL;
}
static void vkd3d_shader_scan_combined_sampler_usage(struct vkd3d_shader_scan_context *context,
const struct vkd3d_shader_register *resource, const struct vkd3d_shader_register *sampler)
{
......@@ -915,7 +930,6 @@ static void vkd3d_shader_scan_combined_sampler_usage(struct vkd3d_shader_scan_co
if (vkd3d_shader_ver_ge(context->version, 5, 1))
{
const struct vkd3d_shader_scan_descriptor_info1 *info = context->scan_descriptor_info;
const struct vkd3d_shader_descriptor_info1 *d;
bool dynamic_resource, dynamic_sampler;
......@@ -930,30 +944,13 @@ static void vkd3d_shader_scan_combined_sampler_usage(struct vkd3d_shader_scan_co
if (dynamic_resource || dynamic_sampler)
return;
for (i = 0; i < info->descriptor_count; ++i)
{
d = &info->descriptors[i];
if (d->type != VKD3D_SHADER_DESCRIPTOR_TYPE_SRV)
continue;
if (d->register_id != resource->idx[0].offset)
continue;
if ((d = find_descriptor(context->scan_descriptor_info,
VKD3D_SHADER_DESCRIPTOR_TYPE_SRV, resource->idx[0].offset)))
resource_space = d->register_space;
break;
}
if (sampler)
{
for (i = 0; i < info->descriptor_count; ++i)
{
d = &info->descriptors[i];
if (d->type != VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER)
continue;
if (d->register_id != sampler->idx[0].offset)
continue;
sampler_space = d->register_space;
break;
}
}
if (sampler && (d = find_descriptor(context->scan_descriptor_info,
VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER, sampler->idx[0].offset)))
sampler_space = d->register_space;
}
for (i = 0; i < info->combined_sampler_count; ++i)
......
......@@ -196,6 +196,7 @@ enum vkd3d_shader_error
VKD3D_SHADER_WARNING_DXIL_ENTRY_POINT_MISMATCH = 8306,
VKD3D_SHADER_WARNING_DXIL_INVALID_MASK = 8307,
VKD3D_SHADER_WARNING_DXIL_INVALID_OPERATION = 8308,
VKD3D_SHADER_WARNING_DXIL_IGNORING_ATTACHMENT = 8309,
VKD3D_SHADER_ERROR_VSIR_NOT_IMPLEMENTED = 9000,
VKD3D_SHADER_ERROR_VSIR_INVALID_HANDLER = 9001,
......@@ -793,10 +794,12 @@ struct vkd3d_shader_version
struct vkd3d_shader_immediate_constant_buffer
{
unsigned int register_idx;
enum vkd3d_data_type data_type;
/* total count is element_count * component_count */
unsigned int element_count;
unsigned int component_count;
bool is_null;
uint32_t data[];
};
......@@ -980,6 +983,11 @@ static inline bool vsir_sysval_semantic_is_tess_factor(enum vkd3d_shader_sysval_
&& sysval_semantic <= VKD3D_SHADER_SV_TESS_FACTOR_LINEDEN;
}
static inline bool vsir_sysval_semantic_is_clip_cull(enum vkd3d_shader_sysval_semantic sysval_semantic)
{
return sysval_semantic == VKD3D_SHADER_SV_CLIP_DISTANCE || sysval_semantic == VKD3D_SHADER_SV_CULL_DISTANCE;
}
struct signature_element *vsir_signature_find_element_for_reg(const struct shader_signature *signature,
unsigned int reg_idx, unsigned int write_mask);
void shader_signature_cleanup(struct shader_signature *signature);
......
......@@ -239,7 +239,7 @@ HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filen
option = &options[0];
option->name = VKD3D_SHADER_COMPILE_OPTION_API_VERSION;
option->value = VKD3D_SHADER_API_VERSION_1_9;
option->value = VKD3D_SHADER_API_VERSION_1_10;
compile_info.type = VKD3D_SHADER_STRUCTURE_TYPE_COMPILE_INFO;
compile_info.next = &preprocess_info;
......@@ -362,7 +362,7 @@ HRESULT WINAPI D3DPreprocess(const void *data, SIZE_T size, const char *filename
static const struct vkd3d_shader_compile_option options[] =
{
{VKD3D_SHADER_COMPILE_OPTION_API_VERSION, VKD3D_SHADER_API_VERSION_1_9},
{VKD3D_SHADER_COMPILE_OPTION_API_VERSION, VKD3D_SHADER_API_VERSION_1_10},
};
TRACE("data %p, size %lu, filename %s, macros %p, include %p, preprocessed_blob %p, messages_blob %p.\n",
......