Commit 23111d62 authored by Alexandre Julliard's avatar Alexandre Julliard

vkd3d: Import upstream release 1.10.

parent 0fea0db8
Akihiro Sagawa
Alexandre Julliard Alexandre Julliard
Alistair Leslie-Hughes Alistair Leslie-Hughes
Andrew Eikum Andrew Eikum
...@@ -18,6 +19,7 @@ Giovanni Mascellani ...@@ -18,6 +19,7 @@ Giovanni Mascellani
Hans-Kristian Arntzen Hans-Kristian Arntzen
Henri Verbeet Henri Verbeet
Isabella Bosia Isabella Bosia
Jacek Caban
Jactry Zeng Jactry Zeng
Jan Sikorski Jan Sikorski
Joshua Ashton Joshua Ashton
...@@ -25,6 +27,7 @@ Józef Kucia ...@@ -25,6 +27,7 @@ Józef Kucia
Martin Storsjö Martin Storsjö
Matteo Bruni Matteo Bruni
Nikolay Sivov Nikolay Sivov
Petrichor Park
Philip Rebohle Philip Rebohle
Rémi Bernon Rémi Bernon
Robin Kertels Robin Kertels
......
...@@ -2,7 +2,6 @@ EXTLIB = libvkd3d.a ...@@ -2,7 +2,6 @@ EXTLIB = libvkd3d.a
EXTRAINCL = $(VKD3D_PE_CFLAGS) -I$(srcdir)/include/private -I$(srcdir)/libs/vkd3d -I$(srcdir)/libs/vkd3d-shader EXTRAINCL = $(VKD3D_PE_CFLAGS) -I$(srcdir)/include/private -I$(srcdir)/libs/vkd3d -I$(srcdir)/libs/vkd3d-shader
EXTRADEFS = \ EXTRADEFS = \
-DWINE_NO_NAMELESS_EXTENSION \ -DWINE_NO_NAMELESS_EXTENSION \
-DCONST_VTABLE \
-DLIBVKD3D_SOURCE \ -DLIBVKD3D_SOURCE \
-DLIBVKD3D_SHADER_SOURCE \ -DLIBVKD3D_SHADER_SOURCE \
-DLIBVKD3D_UTILS_SOURCE -DLIBVKD3D_UTILS_SOURCE
......
#define PACKAGE_NAME "vkd3d" #define PACKAGE_NAME "vkd3d"
#define PACKAGE_STRING "vkd3d 1.9" #define PACKAGE_STRING "vkd3d 1.10"
#define PACKAGE_VERSION "1.9" #define PACKAGE_VERSION "1.10"
#define PATH_MAX 1024 #define PATH_MAX 1024
#define SONAME_LIBVULKAN "vulkan-1.dll" #define SONAME_LIBVULKAN "vulkan-1.dll"
...@@ -49,12 +49,33 @@ ...@@ -49,12 +49,33 @@
((uint32_t)(ch0) | ((uint32_t)(ch1) << 8) \ ((uint32_t)(ch0) | ((uint32_t)(ch1) << 8) \
| ((uint32_t)(ch2) << 16) | ((uint32_t)(ch3) << 24)) | ((uint32_t)(ch2) << 16) | ((uint32_t)(ch3) << 24))
#define TAG_AON9 VKD3D_MAKE_TAG('A', 'o', 'n', '9')
#define TAG_DXBC VKD3D_MAKE_TAG('D', 'X', 'B', 'C')
#define TAG_DXIL VKD3D_MAKE_TAG('D', 'X', 'I', 'L')
#define TAG_ISG1 VKD3D_MAKE_TAG('I', 'S', 'G', '1')
#define TAG_ISGN VKD3D_MAKE_TAG('I', 'S', 'G', 'N')
#define TAG_OSG1 VKD3D_MAKE_TAG('O', 'S', 'G', '1')
#define TAG_OSG5 VKD3D_MAKE_TAG('O', 'S', 'G', '5')
#define TAG_OSGN VKD3D_MAKE_TAG('O', 'S', 'G', 'N')
#define TAG_PCSG VKD3D_MAKE_TAG('P', 'C', 'S', 'G')
#define TAG_PSG1 VKD3D_MAKE_TAG('P', 'S', 'G', '1')
#define TAG_RD11 VKD3D_MAKE_TAG('R', 'D', '1', '1')
#define TAG_RDEF VKD3D_MAKE_TAG('R', 'D', 'E', 'F')
#define TAG_RTS0 VKD3D_MAKE_TAG('R', 'T', 'S', '0')
#define TAG_SDBG VKD3D_MAKE_TAG('S', 'D', 'B', 'G')
#define TAG_SHDR VKD3D_MAKE_TAG('S', 'H', 'D', 'R')
#define TAG_SHEX VKD3D_MAKE_TAG('S', 'H', 'E', 'X')
#define TAG_STAT VKD3D_MAKE_TAG('S', 'T', 'A', 'T')
#define TAG_TEXT VKD3D_MAKE_TAG('T', 'E', 'X', 'T')
#define TAG_XNAP VKD3D_MAKE_TAG('X', 'N', 'A', 'P')
#define TAG_XNAS VKD3D_MAKE_TAG('X', 'N', 'A', 'S')
static inline size_t align(size_t addr, size_t alignment) static inline size_t align(size_t addr, size_t alignment)
{ {
return (addr + (alignment - 1)) & ~(alignment - 1); return (addr + (alignment - 1)) & ~(alignment - 1);
} }
#ifdef __GNUC__ #if defined(__GNUC__) || defined(__clang__)
# define VKD3D_NORETURN __attribute__((noreturn)) # define VKD3D_NORETURN __attribute__((noreturn))
# ifdef __MINGW_PRINTF_FORMAT # ifdef __MINGW_PRINTF_FORMAT
# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(__MINGW_PRINTF_FORMAT, fmt, args))) # define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(__MINGW_PRINTF_FORMAT, fmt, args)))
......
...@@ -78,6 +78,7 @@ enum vkd3d_api_version ...@@ -78,6 +78,7 @@ enum vkd3d_api_version
VKD3D_API_VERSION_1_7, VKD3D_API_VERSION_1_7,
VKD3D_API_VERSION_1_8, VKD3D_API_VERSION_1_8,
VKD3D_API_VERSION_1_9, VKD3D_API_VERSION_1_9,
VKD3D_API_VERSION_1_10,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_API_VERSION), VKD3D_FORCE_32_BIT_ENUM(VKD3D_API_VERSION),
}; };
......
...@@ -51,6 +51,7 @@ enum vkd3d_shader_api_version ...@@ -51,6 +51,7 @@ enum vkd3d_shader_api_version
VKD3D_SHADER_API_VERSION_1_7, VKD3D_SHADER_API_VERSION_1_7,
VKD3D_SHADER_API_VERSION_1_8, VKD3D_SHADER_API_VERSION_1_8,
VKD3D_SHADER_API_VERSION_1_9, VKD3D_SHADER_API_VERSION_1_9,
VKD3D_SHADER_API_VERSION_1_10,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_API_VERSION), VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_API_VERSION),
}; };
...@@ -96,6 +97,11 @@ enum vkd3d_shader_structure_type ...@@ -96,6 +97,11 @@ enum vkd3d_shader_structure_type
* \since 1.9 * \since 1.9
*/ */
VKD3D_SHADER_STRUCTURE_TYPE_VARYING_MAP_INFO, VKD3D_SHADER_STRUCTURE_TYPE_VARYING_MAP_INFO,
/**
* The structure is a vkd3d_shader_scan_combined_resource_sampler_info structure.
* \since 1.10
*/
VKD3D_SHADER_STRUCTURE_TYPE_SCAN_COMBINED_RESOURCE_SAMPLER_INFO,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_STRUCTURE_TYPE), VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_STRUCTURE_TYPE),
}; };
...@@ -154,6 +160,42 @@ enum vkd3d_shader_compile_option_pack_matrix_order ...@@ -154,6 +160,42 @@ enum vkd3d_shader_compile_option_pack_matrix_order
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ORDER), VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ORDER),
}; };
/** Individual options to enable various backward compatibility features. \since 1.10 */
enum vkd3d_shader_compile_option_backward_compatibility
{
/**
* Causes compiler to convert SM1-3 semantics to corresponding System Value semantics,
* when compiling HLSL sources for SM4+ targets.
*
* This option does the following conversions:
*
* - POSITION to SV_Position for vertex shader outputs, pixel shader inputs,
* and geometry shader inputs and outputs;
* - COLORN to SV_TargetN for pixel shader outputs;
* - DEPTH to SV_Depth for pixel shader outputs.
*/
VKD3D_SHADER_COMPILE_OPTION_BACKCOMPAT_MAP_SEMANTIC_NAMES = 0x00000001,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_BACKWARD_COMPATIBILITY),
};
/**
* Determines the origin of fragment coordinates.
*
* \since 1.10
*/
enum vkd3d_shader_compile_option_fragment_coordinate_origin
{
/** Fragment coordinates originate from the upper-left. This is the
* default; it's also the only value supported by Vulkan environments. */
VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN_UPPER_LEFT = 0x00000000,
/** 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 enum vkd3d_shader_compile_option_name
{ {
/** /**
...@@ -193,6 +235,24 @@ enum vkd3d_shader_compile_option_name ...@@ -193,6 +235,24 @@ enum vkd3d_shader_compile_option_name
* \since 1.9 * \since 1.9
*/ */
VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ORDER = 0x00000007, VKD3D_SHADER_COMPILE_OPTION_PACK_MATRIX_ORDER = 0x00000007,
/**
* This option is used to enable various backward compatibility features.
*
* \a value is a mask of values from enum vkd3d_shader_compile_option_backward_compatibility.
*
* \since 1.10
*/
VKD3D_SHADER_COMPILE_OPTION_BACKWARD_COMPATIBILITY = 0x00000008,
/**
* This option specifies the origin of fragment coordinates for SPIR-V
* targets.
*
* \a value is a member of enum
* vkd3d_shader_compile_option_fragment_coordinate_origin.
*
* \since 1.10
*/
VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN = 0x00000009,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_NAME), VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_NAME),
}; };
...@@ -1383,19 +1443,33 @@ struct vkd3d_shader_descriptor_info ...@@ -1383,19 +1443,33 @@ struct vkd3d_shader_descriptor_info
* *
* This structure extends vkd3d_shader_compile_info. * This structure extends vkd3d_shader_compile_info.
* *
* When scanning a legacy Direct3D shader, vkd3d-shader enumerates each * When scanning a legacy Direct3D shader, vkd3d-shader enumerates descriptors
* constant register set used by the shader as a single constant buffer * as follows:
* descriptor, as follows: *
* - The \ref vkd3d_shader_descriptor_info.type field is set to * - Each constant register set used by the shader is scanned as a single
* constant buffer descriptor.
* There may therefore be up to three such descriptors, one for each register
* set used by the shader: float, integer, and boolean.
* The fields are set as follows:
* * The \ref vkd3d_shader_descriptor_info.type field is set to
* VKD3D_SHADER_DESCRIPTOR_TYPE_CBV. * VKD3D_SHADER_DESCRIPTOR_TYPE_CBV.
* - The \ref vkd3d_shader_descriptor_info.register_space field is set to zero. * * The \ref vkd3d_shader_descriptor_info.register_space field is set to zero.
* - The \ref vkd3d_shader_descriptor_info.register_index field is set to a * * The \ref vkd3d_shader_descriptor_info.register_index field is set to a
* member of enum vkd3d_shader_d3dbc_constant_register denoting which set * member of enum vkd3d_shader_d3dbc_constant_register denoting which set
* is used. * is used.
* - The \ref vkd3d_shader_descriptor_info.count field is set to one. * * The \ref vkd3d_shader_descriptor_info.count field is set to one.
* * - Each sampler used by the shader is scanned as two separate descriptors,
* In summary, there may be up to three such descriptors, one for each register * one representing the texture, and one representing the sampler state.
* set used by the shader: float, integer, and boolean. * If desired, these may be mapped back into a single combined sampler using
* struct vkd3d_shader_combined_resource_sampler.
* The fields are set as follows:
* * The \ref vkd3d_shader_descriptor_info.type field is set to
* VKD3D_SHADER_DESCRIPTOR_TYPE_SRV and VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER
* respectively.
* * The \ref vkd3d_shader_descriptor_info.register_space field is set to zero.
* * The \ref vkd3d_shader_descriptor_info.register_index field is set to the
* binding index of the original sampler, for both descriptors.
* * The \ref vkd3d_shader_descriptor_info.count field is set to one.
*/ */
struct vkd3d_shader_scan_descriptor_info struct vkd3d_shader_scan_descriptor_info
{ {
...@@ -1413,6 +1487,53 @@ struct vkd3d_shader_scan_descriptor_info ...@@ -1413,6 +1487,53 @@ struct vkd3d_shader_scan_descriptor_info
}; };
/** /**
* This structure describes a single resource-sampler pair. It is returned as
* part of struct vkd3d_shader_scan_combined_resource_sampler_info.
*
* \since 1.10
*/
struct vkd3d_shader_combined_resource_sampler_info
{
unsigned int resource_space;
unsigned int resource_index;
unsigned int sampler_space;
unsigned int sampler_index;
};
/**
* A chained structure describing the resource-sampler pairs used by a shader.
*
* This structure extends vkd3d_shader_compile_info.
*
* The information returned in this structure can be used to populate the
* \ref vkd3d_shader_interface_info.combined_samplers field. This is
* particularly useful when targeting environments without separate binding
* points for samplers and resources, like OpenGL.
*
* No resource-sampler pairs are returned for dynamic accesses to
* resource/sampler descriptor arrays, as can occur in Direct3D shader model
* 5.1 shaders.
*
* Members of this structure are allocated by vkd3d-shader and should be freed
* with vkd3d_shader_free_scan_combined_resource_sampler_info() when no longer
* needed.
*
* \since 1.10
*/
struct vkd3d_shader_scan_combined_resource_sampler_info
{
/** Must be set to VKD3D_SHADER_STRUCTURE_TYPE_SCAN_COMBINED_RESOURCE_SAMPLER_INFO. */
enum vkd3d_shader_structure_type type;
/** Optional pointer to a structure containing further parameters. */
const void *next;
/** Pointer to an array of resource-sampler pairs. */
struct vkd3d_shader_combined_resource_sampler_info *combined_samplers;
/** The number of resource-sampler pairs in \ref combined_samplers. */
unsigned int combined_sampler_count;
};
/**
* Data type of a shader varying, returned as part of struct * Data type of a shader varying, returned as part of struct
* vkd3d_shader_signature_element. * vkd3d_shader_signature_element.
*/ */
...@@ -2028,12 +2149,14 @@ VKD3D_SHADER_API int vkd3d_shader_convert_root_signature(struct vkd3d_shader_ver ...@@ -2028,12 +2149,14 @@ VKD3D_SHADER_API int vkd3d_shader_convert_root_signature(struct vkd3d_shader_ver
* *
* Currently this function supports the following code types: * Currently this function supports the following code types:
* - VKD3D_SHADER_SOURCE_DXBC_TPF * - VKD3D_SHADER_SOURCE_DXBC_TPF
* - VKD3D_SHADER_SOURCE_D3D_BYTECODE
* *
* \param compile_info A chained structure containing scan parameters. * \param compile_info A chained structure containing scan parameters.
* \n * \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_descriptor_info
* - vkd3d_shader_scan_signature_info * - vkd3d_shader_scan_signature_info
* - vkd3d_shader_scan_combined_resource_sampler_info
* \n * \n
* Although the \a compile_info parameter is read-only, chained structures * Although the \a compile_info parameter is read-only, chained structures
* passed to this function need not be, and may serve as output parameters, * passed to this function need not be, and may serve as output parameters,
...@@ -2313,6 +2436,21 @@ VKD3D_SHADER_API void vkd3d_shader_build_varying_map(const struct vkd3d_shader_s ...@@ -2313,6 +2436,21 @@ VKD3D_SHADER_API void vkd3d_shader_build_varying_map(const struct vkd3d_shader_s
const struct vkd3d_shader_signature *input_signature, const struct vkd3d_shader_signature *input_signature,
unsigned int *count, struct vkd3d_shader_varying_map *varyings); unsigned int *count, struct vkd3d_shader_varying_map *varyings);
/**
* Free members of struct vkd3d_shader_scan_combined_resource_sampler_info
* allocated by vkd3d_shader_scan().
*
* This function may free members of
* vkd3d_shader_scan_combined_resource_sampler_info, but does not free the
* structure itself.
*
* \param info Combined resource-sampler information to free.
*
* \since 1.10
*/
VKD3D_SHADER_API void vkd3d_shader_free_scan_combined_resource_sampler_info(
struct vkd3d_shader_scan_combined_resource_sampler_info *info);
#endif /* VKD3D_SHADER_NO_PROTOTYPES */ #endif /* VKD3D_SHADER_NO_PROTOTYPES */
/** Type of vkd3d_shader_get_version(). */ /** Type of vkd3d_shader_get_version(). */
...@@ -2385,6 +2523,10 @@ typedef void (*PFN_vkd3d_shader_build_varying_map)(const struct vkd3d_shader_sig ...@@ -2385,6 +2523,10 @@ typedef void (*PFN_vkd3d_shader_build_varying_map)(const struct vkd3d_shader_sig
/** Type of vkd3d_shader_free_scan_signature_info(). \since 1.9 */ /** Type of vkd3d_shader_free_scan_signature_info(). \since 1.9 */
typedef void (*PFN_vkd3d_shader_free_scan_signature_info)(struct vkd3d_shader_scan_signature_info *info); typedef void (*PFN_vkd3d_shader_free_scan_signature_info)(struct vkd3d_shader_scan_signature_info *info);
/** Type of vkd3d_shader_free_scan_combined_resource_sampler_info(). \since 1.10 */
typedef void (*PFN_vkd3d_shader_free_scan_combined_resource_sampler_info)(
struct vkd3d_shader_scan_combined_resource_sampler_info *info);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*/ */
#define COBJMACROS #define COBJMACROS
#define CONST_VTABLE
#include "vkd3d.h" #include "vkd3d.h"
#include "vkd3d_blob.h" #include "vkd3d_blob.h"
#include "vkd3d_debug.h" #include "vkd3d_debug.h"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -46,14 +46,13 @@ static void update_location(struct hlsl_ctx *ctx, YYLTYPE *loc); ...@@ -46,14 +46,13 @@ static void update_location(struct hlsl_ctx *ctx, YYLTYPE *loc);
%x pp pp_line pp_pragma pp_ignore %x pp pp_line pp_pragma pp_ignore
RESERVED1 auto|case|catch|char|class|const_cast|default|delete|dynamic_cast|enum RESERVED1 auto|catch|char|class|const_cast|delete|dynamic_cast|enum
RESERVED2 explicit|friend|goto|long|mutable|new|operator|private|protected|public RESERVED2 explicit|friend|goto|long|mutable|new|operator|private|protected|public
RESERVED3 reinterpret_cast|short|signed|sizeof|static_cast|template|this|throw|try RESERVED3 reinterpret_cast|short|signed|sizeof|static_cast|template|this|throw|try
RESERVED4 typename|union|unsigned|using|virtual RESERVED4 typename|union|unsigned|using|virtual
WS [ \t] WS [ \t]
NEWLINE (\n)|(\r\n) NEWLINE (\n)|(\r\n)
DOUBLESLASHCOMMENT "//"[^\n]*
STRING \"[^\"]*\" STRING \"[^\"]*\"
IDENTIFIER [A-Za-z_][A-Za-z0-9_]* IDENTIFIER [A-Za-z_][A-Za-z0-9_]*
...@@ -73,12 +72,16 @@ ANY (.) ...@@ -73,12 +72,16 @@ ANY (.)
BlendState {return KW_BLENDSTATE; } BlendState {return KW_BLENDSTATE; }
break {return KW_BREAK; } break {return KW_BREAK; }
Buffer {return KW_BUFFER; } Buffer {return KW_BUFFER; }
case {return KW_CASE; }
cbuffer {return KW_CBUFFER; } cbuffer {return KW_CBUFFER; }
centroid {return KW_CENTROID; }
column_major {return KW_COLUMN_MAJOR; }
compile {return KW_COMPILE; } compile {return KW_COMPILE; }
const {return KW_CONST; } const {return KW_CONST; }
continue {return KW_CONTINUE; } continue {return KW_CONTINUE; }
DepthStencilState {return KW_DEPTHSTENCILSTATE; } DepthStencilState {return KW_DEPTHSTENCILSTATE; }
DepthStencilView {return KW_DEPTHSTENCILVIEW; } DepthStencilView {return KW_DEPTHSTENCILVIEW; }
default {return KW_DEFAULT; }
discard {return KW_DISCARD; } discard {return KW_DISCARD; }
do {return KW_DO; } do {return KW_DO; }
double {return KW_DOUBLE; } double {return KW_DOUBLE; }
...@@ -92,31 +95,36 @@ if {return KW_IF; } ...@@ -92,31 +95,36 @@ if {return KW_IF; }
in {return KW_IN; } in {return KW_IN; }
inline {return KW_INLINE; } inline {return KW_INLINE; }
inout {return KW_INOUT; } inout {return KW_INOUT; }
linear {return KW_LINEAR; }
matrix {return KW_MATRIX; } matrix {return KW_MATRIX; }
namespace {return KW_NAMESPACE; } namespace {return KW_NAMESPACE; }
nointerpolation {return KW_NOINTERPOLATION; } nointerpolation {return KW_NOINTERPOLATION; }
noperspective {return KW_NOPERSPECTIVE; }
out {return KW_OUT; } out {return KW_OUT; }
packoffset {return KW_PACKOFFSET; } packoffset {return KW_PACKOFFSET; }
pass {return KW_PASS; } pass {return KW_PASS; }
PixelShader {return KW_PIXELSHADER; } PixelShader {return KW_PIXELSHADER; }
precise {return KW_PRECISE; } precise {return KW_PRECISE; }
RasterizerState {return KW_RASTERIZERSTATE; } RasterizerState {return KW_RASTERIZERSTATE; }
register {return KW_REGISTER; }
RenderTargetView {return KW_RENDERTARGETVIEW; } RenderTargetView {return KW_RENDERTARGETVIEW; }
return {return KW_RETURN; } return {return KW_RETURN; }
register {return KW_REGISTER; } row_major {return KW_ROW_MAJOR; }
RWBuffer {return KW_RWBUFFER; } RWBuffer {return KW_RWBUFFER; }
RWStructuredBuffer {return KW_RWSTRUCTUREDBUFFER; } RWStructuredBuffer {return KW_RWSTRUCTUREDBUFFER; }
RWTexture1D {return KW_RWTEXTURE1D; } RWTexture1D {return KW_RWTEXTURE1D; }
RWTexture1DArray {return KW_RWTEXTURE1DARRAY; }
RWTexture2D {return KW_RWTEXTURE2D; } RWTexture2D {return KW_RWTEXTURE2D; }
RWTexture2DArray {return KW_RWTEXTURE2DARRAY; }
RWTexture3D {return KW_RWTEXTURE3D; } RWTexture3D {return KW_RWTEXTURE3D; }
sampler {return KW_SAMPLER; } sampler {return KW_SAMPLER; }
sampler1D {return KW_SAMPLER1D; } sampler1D {return KW_SAMPLER1D; }
sampler2D {return KW_SAMPLER2D; } sampler2D {return KW_SAMPLER2D; }
sampler3D {return KW_SAMPLER3D; } sampler3D {return KW_SAMPLER3D; }
samplerCUBE {return KW_SAMPLERCUBE; }
sampler_state {return KW_SAMPLER_STATE; }
SamplerComparisonState {return KW_SAMPLERCOMPARISONSTATE;} SamplerComparisonState {return KW_SAMPLERCOMPARISONSTATE;}
samplerCUBE {return KW_SAMPLERCUBE; }
SamplerState {return KW_SAMPLER; } SamplerState {return KW_SAMPLER; }
sampler_state {return KW_SAMPLER_STATE; }
shared {return KW_SHARED; } shared {return KW_SHARED; }
stateblock {return KW_STATEBLOCK; } stateblock {return KW_STATEBLOCK; }
stateblock_state {return KW_STATEBLOCK_STATE; } stateblock_state {return KW_STATEBLOCK_STATE; }
...@@ -125,21 +133,22 @@ string {return KW_STRING; } ...@@ -125,21 +133,22 @@ string {return KW_STRING; }
struct {return KW_STRUCT; } struct {return KW_STRUCT; }
switch {return KW_SWITCH; } switch {return KW_SWITCH; }
tbuffer {return KW_TBUFFER; } tbuffer {return KW_TBUFFER; }
technique {return KW_TECHNIQUE; } (?i:technique) {return KW_TECHNIQUE; }
technique10 {return KW_TECHNIQUE10; } technique10 {return KW_TECHNIQUE10; }
technique11 {return KW_TECHNIQUE11; }
texture {return KW_TEXTURE; } texture {return KW_TEXTURE; }
texture1D {return KW_TEXTURE1D; }
Texture1D {return KW_TEXTURE1D; } Texture1D {return KW_TEXTURE1D; }
texture1D {return KW_TEXTURE1D; }
Texture1DArray {return KW_TEXTURE1DARRAY; } Texture1DArray {return KW_TEXTURE1DARRAY; }
texture2D {return KW_TEXTURE2D; }
Texture2D {return KW_TEXTURE2D; } Texture2D {return KW_TEXTURE2D; }
texture2D {return KW_TEXTURE2D; }
Texture2DArray {return KW_TEXTURE2DARRAY; } Texture2DArray {return KW_TEXTURE2DARRAY; }
Texture2DMS {return KW_TEXTURE2DMS; } Texture2DMS {return KW_TEXTURE2DMS; }
Texture2DMSArray {return KW_TEXTURE2DMSARRAY; } Texture2DMSArray {return KW_TEXTURE2DMSARRAY; }
texture3D {return KW_TEXTURE3D; }
Texture3D {return KW_TEXTURE3D; } Texture3D {return KW_TEXTURE3D; }
textureCUBE {return KW_TEXTURECUBE; } texture3D {return KW_TEXTURE3D; }
TextureCube {return KW_TEXTURECUBE; } TextureCube {return KW_TEXTURECUBE; }
textureCUBE {return KW_TEXTURECUBE; }
TextureCubeArray {return KW_TEXTURECUBEARRAY; } TextureCubeArray {return KW_TEXTURECUBEARRAY; }
true {return KW_TRUE; } true {return KW_TRUE; }
typedef {return KW_TYPEDEF; } typedef {return KW_TYPEDEF; }
...@@ -159,7 +168,6 @@ while {return KW_WHILE; } ...@@ -159,7 +168,6 @@ while {return KW_WHILE; }
\<\<= {return OP_LEFTSHIFTASSIGN; } \<\<= {return OP_LEFTSHIFTASSIGN; }
\>\> {return OP_RIGHTSHIFT; } \>\> {return OP_RIGHTSHIFT; }
\>\>= {return OP_RIGHTSHIFTASSIGN; } \>\>= {return OP_RIGHTSHIFTASSIGN; }
\.\.\. {return OP_ELLIPSIS; }
\<= {return OP_LE; } \<= {return OP_LE; }
\>= {return OP_GE; } \>= {return OP_GE; }
!= {return OP_NE; } != {return OP_NE; }
...@@ -171,13 +179,6 @@ while {return KW_WHILE; } ...@@ -171,13 +179,6 @@ while {return KW_WHILE; }
&= {return OP_ANDASSIGN; } &= {return OP_ANDASSIGN; }
\|= {return OP_ORASSIGN; } \|= {return OP_ORASSIGN; }
^= {return OP_XORASSIGN; } ^= {return OP_XORASSIGN; }
## {return OP_UNKNOWN1; }
#@ {return OP_UNKNOWN2; }
:: {return OP_UNKNOWN3; }
\-\> {return OP_UNKNOWN4; }
column_major {return KW_COLUMN_MAJOR; }
row_major {return KW_ROW_MAJOR; }
{IDENTIFIER} { {IDENTIFIER} {
struct hlsl_ctx *ctx = yyget_extra(yyscanner); struct hlsl_ctx *ctx = yyget_extra(yyscanner);
...@@ -203,20 +204,30 @@ row_major {return KW_ROW_MAJOR; } ...@@ -203,20 +204,30 @@ row_major {return KW_ROW_MAJOR; }
yylval->floatval = atof(yytext); yylval->floatval = atof(yytext);
return C_FLOAT; return C_FLOAT;
} }
0x[0-9a-fA-F]+ { 0x[0-9a-fA-F]+[lL]? {
yylval->intval = vkd3d_parse_integer(yytext); yylval->intval = vkd3d_parse_integer(yytext);
return C_INTEGER; return C_INTEGER;
} }
0[0-7]+ { 0[0-7]+[lL]? {
yylval->intval = vkd3d_parse_integer(yytext); yylval->intval = vkd3d_parse_integer(yytext);
return C_INTEGER; return C_INTEGER;
} }
[0-9]+ { [0-9]+[lL]? {
yylval->intval = vkd3d_parse_integer(yytext); yylval->intval = vkd3d_parse_integer(yytext);
return C_INTEGER; return C_INTEGER;
} }
0x[0-9a-fA-F]+([uU]|[uU][lL]|[lL][uU]) {
{DOUBLESLASHCOMMENT} {} yylval->intval = vkd3d_parse_integer(yytext);
return C_UNSIGNED;
}
0[0-7]+([uU]|[uU][lL]|[lL][uU]) {
yylval->intval = vkd3d_parse_integer(yytext);
return C_UNSIGNED;
}
[0-9]+([uU]|[uU][lL]|[lL][uU]) {
yylval->intval = vkd3d_parse_integer(yytext);
return C_UNSIGNED;
}
{WS}+ {} {WS}+ {}
{NEWLINE} { {NEWLINE} {
......
...@@ -71,11 +71,11 @@ HRESULT vkd3d_create_device(const struct vkd3d_device_create_info *create_info, ...@@ -71,11 +71,11 @@ HRESULT vkd3d_create_device(const struct vkd3d_device_create_info *create_info,
if (!device) if (!device)
{ {
ID3D12Device_Release(&object->ID3D12Device1_iface); ID3D12Device_Release(&object->ID3D12Device5_iface);
return S_FALSE; return S_FALSE;
} }
return return_interface(&object->ID3D12Device1_iface, &IID_ID3D12Device, iid, device); return return_interface(&object->ID3D12Device5_iface, &IID_ID3D12Device, iid, device);
} }
/* ID3D12RootSignatureDeserializer */ /* ID3D12RootSignatureDeserializer */
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION #define NONAMELESSUNION
#define VK_NO_PROTOTYPES #define VK_NO_PROTOTYPES
#define CONST_VTABLE
#ifdef _WIN32 #ifdef _WIN32
# define _WIN32_WINNT 0x0600 /* for condition variables */ # define _WIN32_WINNT 0x0600 /* for condition variables */
...@@ -121,6 +122,7 @@ struct vkd3d_vulkan_info ...@@ -121,6 +122,7 @@ struct vkd3d_vulkan_info
bool KHR_draw_indirect_count; bool KHR_draw_indirect_count;
bool KHR_get_memory_requirements2; bool KHR_get_memory_requirements2;
bool KHR_image_format_list; bool KHR_image_format_list;
bool KHR_maintenance2;
bool KHR_maintenance3; bool KHR_maintenance3;
bool KHR_push_descriptor; bool KHR_push_descriptor;
bool KHR_sampler_mirror_clamp_to_edge; bool KHR_sampler_mirror_clamp_to_edge;
...@@ -680,7 +682,7 @@ struct d3d12_heap ...@@ -680,7 +682,7 @@ struct d3d12_heap
}; };
HRESULT d3d12_heap_create(struct d3d12_device *device, const D3D12_HEAP_DESC *desc, HRESULT d3d12_heap_create(struct d3d12_device *device, const D3D12_HEAP_DESC *desc,
const struct d3d12_resource *resource, struct d3d12_heap **heap); const struct d3d12_resource *resource, ID3D12ProtectedResourceSession *protected_session, struct d3d12_heap **heap);
struct d3d12_heap *unsafe_impl_from_ID3D12Heap(ID3D12Heap *iface); struct d3d12_heap *unsafe_impl_from_ID3D12Heap(ID3D12Heap *iface);
#define VKD3D_RESOURCE_PUBLIC_FLAGS \ #define VKD3D_RESOURCE_PUBLIC_FLAGS \
...@@ -716,7 +718,7 @@ struct d3d12_resource_tile_info ...@@ -716,7 +718,7 @@ struct d3d12_resource_tile_info
/* ID3D12Resource */ /* ID3D12Resource */
struct d3d12_resource struct d3d12_resource
{ {
ID3D12Resource ID3D12Resource_iface; ID3D12Resource1 ID3D12Resource1_iface;
LONG refcount; LONG refcount;
LONG internal_refcount; LONG internal_refcount;
...@@ -748,7 +750,12 @@ struct d3d12_resource ...@@ -748,7 +750,12 @@ struct d3d12_resource
static inline struct d3d12_resource *impl_from_ID3D12Resource(ID3D12Resource *iface) static inline struct d3d12_resource *impl_from_ID3D12Resource(ID3D12Resource *iface)
{ {
return CONTAINING_RECORD(iface, struct d3d12_resource, ID3D12Resource_iface); return CONTAINING_RECORD(iface, struct d3d12_resource, ID3D12Resource1_iface);
}
static inline struct d3d12_resource *impl_from_ID3D12Resource1(ID3D12Resource1 *iface)
{
return CONTAINING_RECORD(iface, struct d3d12_resource, ID3D12Resource1_iface);
} }
static inline bool d3d12_resource_is_buffer(const struct d3d12_resource *resource) static inline bool d3d12_resource_is_buffer(const struct d3d12_resource *resource)
...@@ -771,7 +778,8 @@ void d3d12_resource_get_tiling(struct d3d12_device *device, const struct d3d12_r ...@@ -771,7 +778,8 @@ void d3d12_resource_get_tiling(struct d3d12_device *device, const struct d3d12_r
HRESULT d3d12_committed_resource_create(struct d3d12_device *device, HRESULT d3d12_committed_resource_create(struct d3d12_device *device,
const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags,
const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state,
const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource); const D3D12_CLEAR_VALUE *optimized_clear_value, ID3D12ProtectedResourceSession *protected_session,
struct d3d12_resource **resource);
HRESULT d3d12_placed_resource_create(struct d3d12_device *device, struct d3d12_heap *heap, uint64_t heap_offset, HRESULT d3d12_placed_resource_create(struct d3d12_device *device, struct d3d12_heap *heap, uint64_t heap_offset,
const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state,
const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource); const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource);
...@@ -835,6 +843,7 @@ struct vkd3d_texture_view_desc ...@@ -835,6 +843,7 @@ struct vkd3d_texture_view_desc
VkImageAspectFlags vk_image_aspect; VkImageAspectFlags vk_image_aspect;
VkComponentMapping components; VkComponentMapping components;
bool allowed_swizzle; bool allowed_swizzle;
VkImageUsageFlags usage;
}; };
struct vkd3d_desc_header struct vkd3d_desc_header
...@@ -1090,7 +1099,7 @@ HRESULT d3d12_query_heap_create(struct d3d12_device *device, ...@@ -1090,7 +1099,7 @@ HRESULT d3d12_query_heap_create(struct d3d12_device *device,
struct d3d12_query_heap *unsafe_impl_from_ID3D12QueryHeap(ID3D12QueryHeap *iface); struct d3d12_query_heap *unsafe_impl_from_ID3D12QueryHeap(ID3D12QueryHeap *iface);
/* A Vulkan query has to be issued at least one time before the result is /* A Vulkan query has to be issued at least one time before the result is
* available. In D3D12 it is legal to get query reults for not issued queries. * available. In D3D12 it is legal to get query results for not issued queries.
*/ */
static inline bool d3d12_query_heap_is_result_available(const struct d3d12_query_heap *heap, static inline bool d3d12_query_heap_is_result_available(const struct d3d12_query_heap *heap,
unsigned int query_index) unsigned int query_index)
...@@ -1308,10 +1317,38 @@ static inline bool d3d12_pipeline_state_has_unknown_dsv_format(struct d3d12_pipe ...@@ -1308,10 +1317,38 @@ static inline bool d3d12_pipeline_state_has_unknown_dsv_format(struct d3d12_pipe
return false; return false;
} }
struct d3d12_pipeline_state_desc
{
ID3D12RootSignature *root_signature;
D3D12_SHADER_BYTECODE vs;
D3D12_SHADER_BYTECODE ps;
D3D12_SHADER_BYTECODE ds;
D3D12_SHADER_BYTECODE hs;
D3D12_SHADER_BYTECODE gs;
D3D12_SHADER_BYTECODE cs;
D3D12_STREAM_OUTPUT_DESC stream_output;
D3D12_BLEND_DESC blend_state;
unsigned int sample_mask;
D3D12_RASTERIZER_DESC rasterizer_state;
D3D12_DEPTH_STENCIL_DESC1 depth_stencil_state;
D3D12_INPUT_LAYOUT_DESC input_layout;
D3D12_INDEX_BUFFER_STRIP_CUT_VALUE strip_cut_value;
D3D12_PRIMITIVE_TOPOLOGY_TYPE primitive_topology_type;
struct D3D12_RT_FORMAT_ARRAY rtv_formats;
DXGI_FORMAT dsv_format;
DXGI_SAMPLE_DESC sample_desc;
D3D12_VIEW_INSTANCING_DESC view_instancing_desc;
unsigned int node_mask;
D3D12_CACHED_PIPELINE_STATE cached_pso;
D3D12_PIPELINE_STATE_FLAGS flags;
};
HRESULT d3d12_pipeline_state_create_compute(struct d3d12_device *device, HRESULT d3d12_pipeline_state_create_compute(struct d3d12_device *device,
const D3D12_COMPUTE_PIPELINE_STATE_DESC *desc, struct d3d12_pipeline_state **state); const D3D12_COMPUTE_PIPELINE_STATE_DESC *desc, struct d3d12_pipeline_state **state);
HRESULT d3d12_pipeline_state_create_graphics(struct d3d12_device *device, HRESULT d3d12_pipeline_state_create_graphics(struct d3d12_device *device,
const D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc, struct d3d12_pipeline_state **state); const D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc, struct d3d12_pipeline_state **state);
HRESULT d3d12_pipeline_state_create(struct d3d12_device *device,
const D3D12_PIPELINE_STATE_STREAM_DESC *desc, struct d3d12_pipeline_state **state);
VkPipeline d3d12_pipeline_state_get_or_create_pipeline(struct d3d12_pipeline_state *state, VkPipeline d3d12_pipeline_state_get_or_create_pipeline(struct d3d12_pipeline_state *state,
D3D12_PRIMITIVE_TOPOLOGY topology, const uint32_t *strides, VkFormat dsv_format, VkRenderPass *vk_render_pass); D3D12_PRIMITIVE_TOPOLOGY topology, const uint32_t *strides, VkFormat dsv_format, VkRenderPass *vk_render_pass);
struct d3d12_pipeline_state *unsafe_impl_from_ID3D12PipelineState(ID3D12PipelineState *iface); struct d3d12_pipeline_state *unsafe_impl_from_ID3D12PipelineState(ID3D12PipelineState *iface);
...@@ -1426,7 +1463,7 @@ enum vkd3d_pipeline_bind_point ...@@ -1426,7 +1463,7 @@ enum vkd3d_pipeline_bind_point
/* ID3D12CommandList */ /* ID3D12CommandList */
struct d3d12_command_list struct d3d12_command_list
{ {
ID3D12GraphicsCommandList3 ID3D12GraphicsCommandList3_iface; ID3D12GraphicsCommandList5 ID3D12GraphicsCommandList5_iface;
LONG refcount; LONG refcount;
D3D12_COMMAND_LIST_TYPE type; D3D12_COMMAND_LIST_TYPE type;
...@@ -1709,7 +1746,7 @@ struct vkd3d_desc_object_cache ...@@ -1709,7 +1746,7 @@ struct vkd3d_desc_object_cache
/* ID3D12Device */ /* ID3D12Device */
struct d3d12_device struct d3d12_device
{ {
ID3D12Device1 ID3D12Device1_iface; ID3D12Device5 ID3D12Device5_iface;
LONG refcount; LONG refcount;
VkDevice vk_device; VkDevice vk_device;
...@@ -1775,27 +1812,27 @@ struct vkd3d_queue *d3d12_device_get_vkd3d_queue(struct d3d12_device *device, D3 ...@@ -1775,27 +1812,27 @@ struct vkd3d_queue *d3d12_device_get_vkd3d_queue(struct d3d12_device *device, D3
bool d3d12_device_is_uma(struct d3d12_device *device, bool *coherent); bool d3d12_device_is_uma(struct d3d12_device *device, bool *coherent);
void d3d12_device_mark_as_removed(struct d3d12_device *device, HRESULT reason, void d3d12_device_mark_as_removed(struct d3d12_device *device, HRESULT reason,
const char *message, ...) VKD3D_PRINTF_FUNC(3, 4); const char *message, ...) VKD3D_PRINTF_FUNC(3, 4);
struct d3d12_device *unsafe_impl_from_ID3D12Device1(ID3D12Device1 *iface); struct d3d12_device *unsafe_impl_from_ID3D12Device5(ID3D12Device5 *iface);
static inline HRESULT d3d12_device_query_interface(struct d3d12_device *device, REFIID iid, void **object) static inline HRESULT d3d12_device_query_interface(struct d3d12_device *device, REFIID iid, void **object)
{ {
return ID3D12Device1_QueryInterface(&device->ID3D12Device1_iface, iid, object); return ID3D12Device5_QueryInterface(&device->ID3D12Device5_iface, iid, object);
} }
static inline ULONG d3d12_device_add_ref(struct d3d12_device *device) static inline ULONG d3d12_device_add_ref(struct d3d12_device *device)
{ {
return ID3D12Device1_AddRef(&device->ID3D12Device1_iface); return ID3D12Device5_AddRef(&device->ID3D12Device5_iface);
} }
static inline ULONG d3d12_device_release(struct d3d12_device *device) static inline ULONG d3d12_device_release(struct d3d12_device *device)
{ {
return ID3D12Device1_Release(&device->ID3D12Device1_iface); return ID3D12Device5_Release(&device->ID3D12Device5_iface);
} }
static inline unsigned int d3d12_device_get_descriptor_handle_increment_size(struct d3d12_device *device, static inline unsigned int d3d12_device_get_descriptor_handle_increment_size(struct d3d12_device *device,
D3D12_DESCRIPTOR_HEAP_TYPE descriptor_type) D3D12_DESCRIPTOR_HEAP_TYPE descriptor_type)
{ {
return ID3D12Device1_GetDescriptorHandleIncrementSize(&device->ID3D12Device1_iface, descriptor_type); return ID3D12Device5_GetDescriptorHandleIncrementSize(&device->ID3D12Device5_iface, descriptor_type);
} }
/* utils */ /* utils */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment