Commit 5bb80251 authored by Alexandre Julliard's avatar Alexandre Julliard

vkd3d: Import upstream release 1.11.

parent ec2e266c
......@@ -13,6 +13,7 @@ Derek Lesho
Ethan Lee
Evan Tang
Fabian Maurer
Florian Weimer
Francisco Casas
Francois Gouget
Giovanni Mascellani
......@@ -33,6 +34,7 @@ Rémi Bernon
Robin Kertels
Stefan Dösinger
Sven Hesse
Victor Chiletto
Vinson Lee
Zebediah Figura
Zhiyi Zhang
Copyright 2016-2023 the Vkd3d project authors (see the file AUTHORS for a
Copyright 2016-2024 the Vkd3d project authors (see the file AUTHORS for a
complete list)
Vkd3d is free software; you can redistribute it and/or modify it under
......
......@@ -17,6 +17,7 @@ SOURCES = \
libs/vkd3d-shader/d3dbc.c \
libs/vkd3d-shader/dxbc.c \
libs/vkd3d-shader/dxil.c \
libs/vkd3d-shader/fx.c \
libs/vkd3d-shader/glsl.c \
libs/vkd3d-shader/hlsl.c \
libs/vkd3d-shader/hlsl.l \
......
#define PACKAGE_NAME "vkd3d"
#define PACKAGE_STRING "vkd3d 1.10"
#define PACKAGE_VERSION "1.10"
#define PACKAGE_STRING "vkd3d 1.11"
#define PACKAGE_VERSION "1.11"
#define PATH_MAX 1024
#define SONAME_LIBVULKAN "vulkan-1.dll"
......@@ -52,6 +52,7 @@
#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_FX10 VKD3D_MAKE_TAG('F', 'X', '1', '0')
#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')
......@@ -63,6 +64,7 @@
#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_SFI0 VKD3D_MAKE_TAG('S', 'F', 'I', '0')
#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')
......@@ -70,7 +72,7 @@
#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 uint64_t align(uint64_t addr, size_t alignment)
{
return (addr + (alignment - 1)) & ~(alignment - 1);
}
......@@ -80,7 +82,7 @@ static inline size_t align(size_t addr, size_t alignment)
# ifdef __MINGW_PRINTF_FORMAT
# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(__MINGW_PRINTF_FORMAT, fmt, args)))
# else
# define VKD3D_PRINTF_FUNC(fmt, args) /* __attribute__((format(printf, fmt, args))) */
# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(printf, fmt, args)))
# endif
# define VKD3D_UNUSED __attribute__((unused))
# define VKD3D_UNREACHABLE __builtin_unreachable()
......@@ -266,34 +268,42 @@ static inline int ascii_strcasecmp(const char *a, const char *b)
return c_a - c_b;
}
#ifndef _WIN32
# if HAVE_SYNC_ADD_AND_FETCH
static inline LONG InterlockedIncrement(LONG volatile *x)
static inline uint64_t vkd3d_atomic_add_fetch_u64(uint64_t volatile *x, uint64_t val)
{
return __sync_add_and_fetch(x, 1);
#if HAVE_SYNC_ADD_AND_FETCH
return __sync_add_and_fetch(x, val);
#elif defined(_WIN32)
return InterlockedAdd64((LONG64 *)x, val);
#else
# error "vkd3d_atomic_add_fetch_u64() not implemented for this platform"
#endif
}
static inline LONG64 InterlockedIncrement64(LONG64 volatile *x)
static inline uint32_t vkd3d_atomic_add_fetch_u32(uint32_t volatile *x, uint32_t val)
{
return __sync_add_and_fetch(x, 1);
#if HAVE_SYNC_ADD_AND_FETCH
return __sync_add_and_fetch(x, val);
#elif defined(_WIN32)
return InterlockedAdd((LONG *)x, val);
#else
# error "vkd3d_atomic_add_fetch_u32() not implemented for this platform"
#endif
}
static inline LONG InterlockedAdd(LONG volatile *x, LONG val)
static inline uint64_t vkd3d_atomic_increment_u64(uint64_t volatile *x)
{
return __sync_add_and_fetch(x, val);
return vkd3d_atomic_add_fetch_u64(x, 1);
}
# else
# error "InterlockedIncrement() not implemented for this platform"
# endif /* HAVE_SYNC_ADD_AND_FETCH */
# if HAVE_SYNC_SUB_AND_FETCH
static inline LONG InterlockedDecrement(LONG volatile *x)
static inline uint32_t vkd3d_atomic_decrement_u32(uint32_t volatile *x)
{
return __sync_sub_and_fetch(x, 1);
return vkd3d_atomic_add_fetch_u32(x, ~0u);
}
# else
# error "InterlockedDecrement() not implemented for this platform"
# endif
#endif /* _WIN32 */
static inline uint32_t vkd3d_atomic_increment_u32(uint32_t volatile *x)
{
return vkd3d_atomic_add_fetch_u32(x, 1);
}
static inline void vkd3d_parse_version(const char *version, int *major, int *minor)
{
......
......@@ -89,6 +89,10 @@ const char *debugstr_w(const WCHAR *wstr, size_t wchar_size);
#define TRACE_ON() (vkd3d_dbg_get_level() == VKD3D_DBG_LEVEL_TRACE)
#endif
#ifndef WARN_ON
#define WARN_ON() (vkd3d_dbg_get_level() >= VKD3D_DBG_LEVEL_WARN)
#endif
#define FIXME_ONCE VKD3D_DBG_LOG_ONCE(FIXME, WARN)
#define VKD3D_DEBUG_ENV_NAME(name) const char *const vkd3d_dbg_env_name = name
......@@ -104,6 +108,29 @@ static inline const char *debugstr_guid(const GUID *guid)
guid->Data4[5], guid->Data4[6], guid->Data4[7]);
}
static inline const char *debugstr_hresult(HRESULT hr)
{
switch (hr)
{
#define TO_STR(u) case u: return #u;
TO_STR(S_OK)
TO_STR(S_FALSE)
TO_STR(E_NOTIMPL)
TO_STR(E_NOINTERFACE)
TO_STR(E_POINTER)
TO_STR(E_ABORT)
TO_STR(E_FAIL)
TO_STR(E_OUTOFMEMORY)
TO_STR(E_INVALIDARG)
TO_STR(DXGI_ERROR_NOT_FOUND)
TO_STR(DXGI_ERROR_MORE_DATA)
TO_STR(DXGI_ERROR_UNSUPPORTED)
#undef TO_STR
default:
return vkd3d_dbg_sprintf("%#x", (int)hr);
}
}
unsigned int vkd3d_env_var_as_uint(const char *name, unsigned int default_value);
struct vkd3d_debug_option
......
......@@ -79,6 +79,7 @@ enum vkd3d_api_version
VKD3D_API_VERSION_1_8,
VKD3D_API_VERSION_1_9,
VKD3D_API_VERSION_1_10,
VKD3D_API_VERSION_1_11,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_API_VERSION),
};
......
......@@ -52,6 +52,7 @@ enum vkd3d_shader_api_version
VKD3D_SHADER_API_VERSION_1_8,
VKD3D_SHADER_API_VERSION_1_9,
VKD3D_SHADER_API_VERSION_1_10,
VKD3D_SHADER_API_VERSION_1_11,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_API_VERSION),
};
......@@ -196,6 +197,21 @@ enum vkd3d_shader_compile_option_fragment_coordinate_origin
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN),
};
/** Advertises feature availability. \since 1.11 */
enum vkd3d_shader_compile_option_feature_flags
{
/** The SPIR-V target environment supports 64-bit integer types. This
* corresponds to the "shaderInt64" feature in the Vulkan API, and the
* "GL_ARB_gpu_shader_int64" extension in the OpenGL API. */
VKD3D_SHADER_COMPILE_OPTION_FEATURE_INT64 = 0x00000001,
/** The SPIR-V target environment supports 64-bit floating-point types.
* This corresponds to the "shaderFloat64" feature in the Vulkan API, and
* the "GL_ARB_gpu_shader_fp64" extension in the OpenGL API. */
VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLOAT64 = 0x00000002,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_FEATURE_FLAGS),
};
enum vkd3d_shader_compile_option_name
{
/**
......@@ -253,6 +269,16 @@ enum vkd3d_shader_compile_option_name
* \since 1.10
*/
VKD3D_SHADER_COMPILE_OPTION_FRAGMENT_COORDINATE_ORIGIN = 0x00000009,
/**
* This option specifies the shader features available in the target
* environment. These are not extensions, i.e. they are always supported
* by the driver, but may not be supported by the available hardware.
*
* \a value is a member of enum vkd3d_shader_compile_option_feature_flags.
*
* \since 1.11
*/
VKD3D_SHADER_COMPILE_OPTION_FEATURE = 0x0000000a,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPILE_OPTION_NAME),
};
......@@ -767,6 +793,11 @@ enum vkd3d_shader_target_type
* An 'OpenGL Shading Language' shader. \since 1.3
*/
VKD3D_SHADER_TARGET_GLSL,
/**
* Binary format used by Direct3D 9/10.x/11 effects profiles.
* Output is a raw FX section without container. \since 1.11
*/
VKD3D_SHADER_TARGET_FX,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_TARGET_TYPE),
};
......@@ -853,6 +884,8 @@ enum vkd3d_shader_spirv_extension
VKD3D_SHADER_SPIRV_EXTENSION_EXT_DESCRIPTOR_INDEXING,
/** \since 1.3 */
VKD3D_SHADER_SPIRV_EXTENSION_EXT_STENCIL_EXPORT,
/** \since 1.11 */
VKD3D_SHADER_SPIRV_EXTENSION_EXT_VIEWPORT_INDEX_LAYER,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_SPIRV_EXTENSION),
};
......@@ -1252,6 +1285,8 @@ enum vkd3d_shader_descriptor_range_flags
VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE = 0x2,
VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE = 0x4,
VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_STATIC = 0x8,
/** \since 1.11 */
VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS = 0x10000,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_DESCRIPTOR_RANGE_FLAGS),
};
......@@ -1551,6 +1586,8 @@ enum vkd3d_shader_component_type
VKD3D_SHADER_COMPONENT_BOOL = 0x4,
/** 64-bit IEEE floating-point. */
VKD3D_SHADER_COMPONENT_DOUBLE = 0x5,
/** 64-bit unsigned integer. \since 1.11 */
VKD3D_SHADER_COMPONENT_UINT64 = 0x6,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_COMPONENT_TYPE),
};
......@@ -1747,10 +1784,10 @@ struct vkd3d_shader_dxbc_desc
* \endcode
*/
#define VKD3D_SHADER_SWIZZLE(x, y, z, w) \
vkd3d_shader_create_swizzle(VKD3D_SHADER_SWIZZLE_ ## x, \
VKD3D_SHADER_SWIZZLE_ ## y, \
VKD3D_SHADER_SWIZZLE_ ## z, \
VKD3D_SHADER_SWIZZLE_ ## w)
(VKD3D_SHADER_SWIZZLE_ ## x << VKD3D_SHADER_SWIZZLE_SHIFT(0) \
| VKD3D_SHADER_SWIZZLE_ ## y << VKD3D_SHADER_SWIZZLE_SHIFT(1) \
| VKD3D_SHADER_SWIZZLE_ ## z << VKD3D_SHADER_SWIZZLE_SHIFT(2) \
| VKD3D_SHADER_SWIZZLE_ ## w << VKD3D_SHADER_SWIZZLE_SHIFT(3))
/** The identity swizzle ".xyzw". */
#define VKD3D_SHADER_NO_SWIZZLE VKD3D_SHADER_SWIZZLE(X, Y, Z, W)
......@@ -1954,9 +1991,13 @@ VKD3D_SHADER_API const enum vkd3d_shader_target_type *vkd3d_shader_get_supported
* - VKD3D_SHADER_SOURCE_DXBC_TPF to VKD3D_SHADER_TARGET_SPIRV_TEXT
* (if vkd3d was compiled with SPIRV-Tools)
* - VKD3D_SHADER_SOURCE_DXBC_TPF to VKD3D_SHADER_TARGET_D3D_ASM
* - VKD3D_SHADER_SOURCE_D3D_BYTECODE to VKD3D_SHADER_TARGET_SPIRV_BINARY
* - VKD3D_SHADER_SOURCE_D3D_BYTECODE to VKD3D_SHADER_TARGET_SPIRV_TEXT
* (if vkd3d was compiled with SPIRV-Tools)
* - VKD3D_SHADER_SOURCE_D3D_BYTECODE to VKD3D_SHADER_TARGET_D3D_ASM
* - VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_DXBC_TPF
* - VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_D3D_BYTECODE
* - VKD3D_SHADER_SOURCE_HLSL to VKD3D_SHADER_TARGET_FX
*
* Supported transformations can also be detected at runtime with the functions
* vkd3d_shader_get_supported_source_types() and
......@@ -1964,14 +2005,17 @@ VKD3D_SHADER_API const enum vkd3d_shader_target_type *vkd3d_shader_get_supported
*
* Depending on the source and target types, this function may support the
* following chained structures:
* - vkd3d_shader_descriptor_offset_info
* - vkd3d_shader_hlsl_source_info
* - vkd3d_shader_interface_info
* - vkd3d_shader_varying_map_info
* - vkd3d_shader_preprocess_info
* - vkd3d_shader_scan_combined_resource_sampler_info
* - vkd3d_shader_scan_descriptor_info
* - vkd3d_shader_scan_signature_info
* - vkd3d_shader_spirv_domain_shader_target_info
* - vkd3d_shader_spirv_target_info
* - vkd3d_shader_transform_feedback_info
* - vkd3d_shader_varying_map_info
*
* \param compile_info A chained structure containing compilation parameters.
*
......
......@@ -26,7 +26,7 @@
struct vkd3d_blob
{
ID3D10Blob ID3DBlob_iface;
LONG refcount;
unsigned int refcount;
void *buffer;
SIZE_T size;
......@@ -58,7 +58,7 @@ static HRESULT STDMETHODCALLTYPE vkd3d_blob_QueryInterface(ID3DBlob *iface, REFI
static ULONG STDMETHODCALLTYPE vkd3d_blob_AddRef(ID3DBlob *iface)
{
struct vkd3d_blob *blob = impl_from_ID3DBlob(iface);
ULONG refcount = InterlockedIncrement(&blob->refcount);
unsigned int refcount = vkd3d_atomic_increment_u32(&blob->refcount);
TRACE("%p increasing refcount to %u.\n", blob, refcount);
......@@ -68,7 +68,7 @@ static ULONG STDMETHODCALLTYPE vkd3d_blob_AddRef(ID3DBlob *iface)
static ULONG STDMETHODCALLTYPE vkd3d_blob_Release(ID3DBlob *iface)
{
struct vkd3d_blob *blob = impl_from_ID3DBlob(iface);
ULONG refcount = InterlockedDecrement(&blob->refcount);
unsigned int refcount = vkd3d_atomic_decrement_u32(&blob->refcount);
TRACE("%p decreasing refcount to %u.\n", blob, refcount);
......
......@@ -126,10 +126,10 @@ void vkd3d_dbg_set_log_callback(PFN_vkd3d_log callback)
static char *get_buffer(void)
{
static char buffers[VKD3D_DEBUG_BUFFER_COUNT][VKD3D_DEBUG_BUFFER_SIZE];
static LONG buffer_index;
LONG current_index;
static unsigned int buffer_index;
unsigned int current_index;
current_index = InterlockedIncrement(&buffer_index) % ARRAY_SIZE(buffers);
current_index = vkd3d_atomic_increment_u32(&buffer_index) % ARRAY_SIZE(buffers);
return buffers[current_index];
}
......
......@@ -130,13 +130,13 @@ static void skip_dword_unknown(const char **ptr, unsigned int count)
}
}
static const char *shader_get_string(const char *data, size_t data_size, DWORD offset)
static const char *shader_get_string(const char *data, size_t data_size, size_t offset)
{
size_t len, max_len;
if (offset >= data_size)
{
WARN("Invalid offset %#x (data size %#lx).\n", offset, (long)data_size);
WARN("Invalid offset %#zx (data size %#zx).\n", offset, data_size);
return NULL;
}
......@@ -230,7 +230,7 @@ static int parse_dxbc(const struct vkd3d_shader_code *dxbc, struct vkd3d_shader_
chunk_offset = read_u32(&ptr);
TRACE("chunk %u at offset %#x\n", i, chunk_offset);
if (chunk_offset >= data_size || !require_space(chunk_offset, 2, sizeof(DWORD), data_size))
if (chunk_offset >= data_size || !require_space(chunk_offset, 2, sizeof(uint32_t), data_size))
{
WARN("Invalid chunk offset %#x (data size %zu).\n", chunk_offset, data_size);
vkd3d_shader_error(message_context, &location, VKD3D_SHADER_ERROR_DXBC_INVALID_CHUNK_OFFSET,
......@@ -399,7 +399,8 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s
for (i = 0; i < count; ++i)
{
uint32_t name_offset, mask;
size_t name_offset;
uint32_t mask;
e[i].sort_index = i;
......@@ -411,7 +412,7 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s
name_offset = read_u32(&ptr);
if (!(e[i].semantic_name = shader_get_string(data, section->data.size, name_offset)))
{
WARN("Invalid name offset %#x (data size %#zx).\n", name_offset, section->data.size);
WARN("Invalid name offset %#zx (data size %#zx).\n", name_offset, section->data.size);
vkd3d_free(e);
return VKD3D_ERROR_INVALID_ARGUMENT;
}
......@@ -431,10 +432,6 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s
case TAG_OSG5:
if (e[i].sysval_semantic == VKD3D_SHADER_SV_NONE)
e[i].sysval_semantic = map_fragment_output_sysval(e[i].semantic_name);
/* Fall through. */
case TAG_PCSG:
case TAG_PSG1:
e[i].used_mask = e[i].mask & ~e[i].used_mask;
break;
}
......@@ -596,7 +593,7 @@ static int shader_parse_descriptor_ranges(struct root_signature_parser_context *
const char *ptr;
unsigned int i;
if (!require_space(offset, 5 * count, sizeof(DWORD), context->data_size))
if (!require_space(offset, 5 * count, sizeof(uint32_t), context->data_size))
{
WARN("Invalid data size %#x (offset %u, count %u).\n", context->data_size, offset, count);
return VKD3D_ERROR_INVALID_ARGUMENT;
......@@ -627,7 +624,8 @@ static void shader_validate_descriptor_range1(const struct vkd3d_shader_descript
| VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_VOLATILE
| VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_VOLATILE
| VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_STATIC_WHILE_SET_AT_EXECUTE
| VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_STATIC);
| VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DATA_STATIC
| VKD3D_SHADER_DESCRIPTOR_RANGE_FLAG_DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS);
if (unknown_flags)
FIXME("Unknown descriptor range flags %#x.\n", unknown_flags);
......@@ -674,7 +672,7 @@ static int shader_parse_descriptor_table(struct root_signature_parser_context *c
unsigned int count;
const char *ptr;
if (!require_space(offset, 2, sizeof(DWORD), context->data_size))
if (!require_space(offset, 2, sizeof(uint32_t), context->data_size))
{
WARN("Invalid data size %#x (offset %u).\n", context->data_size, offset);
return VKD3D_ERROR_INVALID_ARGUMENT;
......@@ -701,7 +699,7 @@ static int shader_parse_descriptor_table1(struct root_signature_parser_context *
unsigned int count;
const char *ptr;
if (!require_space(offset, 2, sizeof(DWORD), context->data_size))
if (!require_space(offset, 2, sizeof(uint32_t), context->data_size))
{
WARN("Invalid data size %#x (offset %u).\n", context->data_size, offset);
return VKD3D_ERROR_INVALID_ARGUMENT;
......@@ -726,7 +724,7 @@ static int shader_parse_root_constants(struct root_signature_parser_context *con
{
const char *ptr;
if (!require_space(offset, 3, sizeof(DWORD), context->data_size))
if (!require_space(offset, 3, sizeof(uint32_t), context->data_size))
{
WARN("Invalid data size %#x (offset %u).\n", context->data_size, offset);
return VKD3D_ERROR_INVALID_ARGUMENT;
......@@ -748,7 +746,7 @@ static int shader_parse_root_descriptor(struct root_signature_parser_context *co
{
const char *ptr;
if (!require_space(offset, 2, sizeof(DWORD), context->data_size))
if (!require_space(offset, 2, sizeof(uint32_t), context->data_size))
{
WARN("Invalid data size %#x (offset %u).\n", context->data_size, offset);
return VKD3D_ERROR_INVALID_ARGUMENT;
......@@ -780,7 +778,7 @@ static int shader_parse_root_descriptor1(struct root_signature_parser_context *c
{
const char *ptr;
if (!require_space(offset, 3, sizeof(DWORD), context->data_size))
if (!require_space(offset, 3, sizeof(uint32_t), context->data_size))
{
WARN("Invalid data size %#x (offset %u).\n", context->data_size, offset);
return VKD3D_ERROR_INVALID_ARGUMENT;
......@@ -806,7 +804,7 @@ static int shader_parse_root_parameters(struct root_signature_parser_context *co
unsigned int i;
int ret;
if (!require_space(offset, 3 * count, sizeof(DWORD), context->data_size))
if (!require_space(offset, 3 * count, sizeof(uint32_t), context->data_size))
{
WARN("Invalid data size %#x (offset %u, count %u).\n", context->data_size, offset, count);
return VKD3D_ERROR_INVALID_ARGUMENT;
......@@ -848,13 +846,13 @@ static int shader_parse_root_parameters(struct root_signature_parser_context *co
}
static int shader_parse_root_parameters1(struct root_signature_parser_context *context,
uint32_t offset, DWORD count, struct vkd3d_shader_root_parameter1 *parameters)
uint32_t offset, unsigned int count, struct vkd3d_shader_root_parameter1 *parameters)
{
const char *ptr;
unsigned int i;
int ret;
if (!require_space(offset, 3 * count, sizeof(DWORD), context->data_size))
if (!require_space(offset, 3 * count, sizeof(uint32_t), context->data_size))
{
WARN("Invalid data size %#x (offset %u, count %u).\n", context->data_size, offset, count);
return VKD3D_ERROR_INVALID_ARGUMENT;
......@@ -901,7 +899,7 @@ static int shader_parse_static_samplers(struct root_signature_parser_context *co
const char *ptr;
unsigned int i;
if (!require_space(offset, 13 * count, sizeof(DWORD), context->data_size))
if (!require_space(offset, 13 * count, sizeof(uint32_t), context->data_size))
{
WARN("Invalid data size %#x (offset %u, count %u).\n", context->data_size, offset, count);
return VKD3D_ERROR_INVALID_ARGUMENT;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -91,7 +91,7 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *generator
}
int vkd3d_glsl_generator_generate(struct vkd3d_glsl_generator *generator,
struct vkd3d_shader_parser *parser, struct vkd3d_shader_code *out)
struct vsir_program *program, struct vkd3d_shader_code *out)
{
unsigned int i;
void *code;
......@@ -100,10 +100,10 @@ int vkd3d_glsl_generator_generate(struct vkd3d_glsl_generator *generator,
vkd3d_string_buffer_printf(&generator->buffer, "void main()\n{\n");
generator->location.column = 0;
for (i = 0; i < parser->instructions.count; ++i)
for (i = 0; i < program->instructions.count; ++i)
{
generator->location.line = i + 1;
vkd3d_glsl_handle_instruction(generator, &parser->instructions.elements[i]);
vkd3d_glsl_handle_instruction(generator, &program->instructions.elements[i]);
}
if (generator->failed)
......
......@@ -89,6 +89,7 @@ else {return KW_ELSE; }
extern {return KW_EXTERN; }
false {return KW_FALSE; }
for {return KW_FOR; }
fxgroup {return KW_FXGROUP; }
GeometryShader {return KW_GEOMETRYSHADER; }
groupshared {return KW_GROUPSHARED; }
if {return KW_IF; }
......@@ -105,6 +106,13 @@ packoffset {return KW_PACKOFFSET; }
pass {return KW_PASS; }
PixelShader {return KW_PIXELSHADER; }
precise {return KW_PRECISE; }
RasterizerOrderedBuffer {return KW_RASTERIZERORDEREDBUFFER; }
RasterizerOrderedStructuredBuffer {return KW_RASTERIZERORDEREDSTRUCTUREDBUFFER; }
RasterizerOrderedTexture1D {return KW_RASTERIZERORDEREDTEXTURE1D; }
RasterizerOrderedTexture1DArray {return KW_RASTERIZERORDEREDTEXTURE1DARRAY; }
RasterizerOrderedTexture2D {return KW_RASTERIZERORDEREDTEXTURE2D; }
RasterizerOrderedTexture2DArray {return KW_RASTERIZERORDEREDTEXTURE2DARRAY; }
RasterizerOrderedTexture3D {return KW_RASTERIZERORDEREDTEXTURE3D; }
RasterizerState {return KW_RASTERIZERSTATE; }
register {return KW_REGISTER; }
RenderTargetView {return KW_RENDERTARGETVIEW; }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -539,6 +539,7 @@ bool is_valid_feature_level(D3D_FEATURE_LEVEL feature_level)
{
static const D3D_FEATURE_LEVEL valid_feature_levels[] =
{
D3D_FEATURE_LEVEL_12_2,
D3D_FEATURE_LEVEL_12_1,
D3D_FEATURE_LEVEL_12_0,
D3D_FEATURE_LEVEL_11_1,
......@@ -548,6 +549,7 @@ bool is_valid_feature_level(D3D_FEATURE_LEVEL feature_level)
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1,
D3D_FEATURE_LEVEL_1_0_CORE,
};
unsigned int i;
......@@ -630,6 +632,11 @@ HRESULT return_interface(void *iface, REFIID iface_iid,
return hr;
}
const char *debug_cpu_handle(D3D12_CPU_DESCRIPTOR_HANDLE handle)
{
return vkd3d_dbg_sprintf("{%#"PRIxPTR"}", (uintptr_t)handle.ptr);
}
const char *debug_d3d12_box(const D3D12_BOX *box)
{
if (!box)
......@@ -671,6 +678,11 @@ const char *debug_d3d12_shader_component_mapping(unsigned int mapping)
debug_d3d12_shader_component(D3D12_DECODE_SHADER_4_COMPONENT_MAPPING(3, mapping)));
}
const char *debug_gpu_handle(D3D12_GPU_DESCRIPTOR_HANDLE handle)
{
return vkd3d_dbg_sprintf("{%#"PRIx64"}", handle.ptr);
}
const char *debug_vk_extent_3d(VkExtent3D extent)
{
return vkd3d_dbg_sprintf("(%u, %u, %u)",
......@@ -681,7 +693,7 @@ const char *debug_vk_extent_3d(VkExtent3D extent)
const char *debug_vk_queue_flags(VkQueueFlags flags)
{
char buffer[120];
char buffer[159];
buffer[0] = '\0';
#define FLAG_TO_STR(f) if (flags & f) { strcat(buffer, " | "#f); flags &= ~f; }
......@@ -689,6 +701,10 @@ const char *debug_vk_queue_flags(VkQueueFlags flags)
FLAG_TO_STR(VK_QUEUE_COMPUTE_BIT)
FLAG_TO_STR(VK_QUEUE_TRANSFER_BIT)
FLAG_TO_STR(VK_QUEUE_SPARSE_BINDING_BIT)
FLAG_TO_STR(VK_QUEUE_PROTECTED_BIT)
#undef FLAG_TO_STR
#define FLAG_TO_STR(f, n) if (flags & f) { strcat(buffer, " | "#n); flags &= ~f; }
FLAG_TO_STR(0x20, VK_QUEUE_VIDEO_DECODE_BIT_KHR)
#undef FLAG_TO_STR
if (flags)
FIXME("Unrecognized flag(s) %#x.\n", flags);
......@@ -727,10 +743,8 @@ const char *debug_vk_memory_property_flags(VkMemoryPropertyFlags flags)
FLAG_TO_STR(VK_MEMORY_PROPERTY_HOST_CACHED_BIT)
FLAG_TO_STR(VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT)
FLAG_TO_STR(VK_MEMORY_PROPERTY_PROTECTED_BIT)
#undef FLAG_TO_STR
#define FLAG_TO_STR(f, n) if (flags & f) { strcat(buffer, " | "#n); flags &= ~f; }
FLAG_TO_STR(0x40, VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD)
FLAG_TO_STR(0x80, VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD)
FLAG_TO_STR(VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD)
FLAG_TO_STR(VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD)
#undef FLAG_TO_STR
if (flags)
FIXME("Unrecognized flag(s) %#x.\n", flags);
......
......@@ -60,7 +60,7 @@ HRESULT vkd3d_create_device(const struct vkd3d_device_create_info *create_info,
}
else if (FAILED(hr = vkd3d_create_instance(create_info->instance_create_info, &instance)))
{
WARN("Failed to create instance, hr %#x.\n", hr);
WARN("Failed to create instance, hr %s.\n", debugstr_hresult(hr));
return E_FAIL;
}
......@@ -71,18 +71,18 @@ HRESULT vkd3d_create_device(const struct vkd3d_device_create_info *create_info,
if (!device)
{
ID3D12Device_Release(&object->ID3D12Device5_iface);
ID3D12Device_Release(&object->ID3D12Device7_iface);
return S_FALSE;
}
return return_interface(&object->ID3D12Device5_iface, &IID_ID3D12Device, iid, device);
return return_interface(&object->ID3D12Device7_iface, &IID_ID3D12Device, iid, device);
}
/* ID3D12RootSignatureDeserializer */
struct d3d12_root_signature_deserializer
{
ID3D12RootSignatureDeserializer ID3D12RootSignatureDeserializer_iface;
LONG refcount;
unsigned int refcount;
union
{
......@@ -123,7 +123,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_root_signature_deserializer_QueryInterfac
static ULONG STDMETHODCALLTYPE d3d12_root_signature_deserializer_AddRef(ID3D12RootSignatureDeserializer *iface)
{
struct d3d12_root_signature_deserializer *deserializer = impl_from_ID3D12RootSignatureDeserializer(iface);
ULONG refcount = InterlockedIncrement(&deserializer->refcount);
unsigned int refcount = vkd3d_atomic_increment_u32(&deserializer->refcount);
TRACE("%p increasing refcount to %u.\n", deserializer, refcount);
......@@ -133,7 +133,7 @@ static ULONG STDMETHODCALLTYPE d3d12_root_signature_deserializer_AddRef(ID3D12Ro
static ULONG STDMETHODCALLTYPE d3d12_root_signature_deserializer_Release(ID3D12RootSignatureDeserializer *iface)
{
struct d3d12_root_signature_deserializer *deserializer = impl_from_ID3D12RootSignatureDeserializer(iface);
ULONG refcount = InterlockedDecrement(&deserializer->refcount);
unsigned int refcount = vkd3d_atomic_decrement_u32(&deserializer->refcount);
TRACE("%p decreasing refcount to %u.\n", deserializer, refcount);
......@@ -222,8 +222,8 @@ HRESULT vkd3d_create_root_signature_deserializer(const void *data, SIZE_T data_s
struct d3d12_root_signature_deserializer *object;
HRESULT hr;
TRACE("data %p, data_size %lu, iid %s, deserializer %p.\n",
data, data_size, debugstr_guid(iid), deserializer);
TRACE("data %p, data_size %"PRIuPTR", iid %s, deserializer %p.\n",
data, (uintptr_t)data_size, debugstr_guid(iid), deserializer);
if (!(object = vkd3d_malloc(sizeof(*object))))
return E_OUTOFMEMORY;
......@@ -242,7 +242,7 @@ HRESULT vkd3d_create_root_signature_deserializer(const void *data, SIZE_T data_s
struct d3d12_versioned_root_signature_deserializer
{
ID3D12VersionedRootSignatureDeserializer ID3D12VersionedRootSignatureDeserializer_iface;
LONG refcount;
unsigned int refcount;
union
{
......@@ -284,7 +284,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_versioned_root_signature_deserializer_Que
static ULONG STDMETHODCALLTYPE d3d12_versioned_root_signature_deserializer_AddRef(ID3D12VersionedRootSignatureDeserializer *iface)
{
struct d3d12_versioned_root_signature_deserializer *deserializer = impl_from_ID3D12VersionedRootSignatureDeserializer(iface);
ULONG refcount = InterlockedIncrement(&deserializer->refcount);
unsigned int refcount = vkd3d_atomic_increment_u32(&deserializer->refcount);
TRACE("%p increasing refcount to %u.\n", deserializer, refcount);
......@@ -294,7 +294,7 @@ static ULONG STDMETHODCALLTYPE d3d12_versioned_root_signature_deserializer_AddRe
static ULONG STDMETHODCALLTYPE d3d12_versioned_root_signature_deserializer_Release(ID3D12VersionedRootSignatureDeserializer *iface)
{
struct d3d12_versioned_root_signature_deserializer *deserializer = impl_from_ID3D12VersionedRootSignatureDeserializer(iface);
ULONG refcount = InterlockedDecrement(&deserializer->refcount);
unsigned int refcount = vkd3d_atomic_decrement_u32(&deserializer->refcount);
TRACE("%p decreasing refcount to %u.\n", deserializer, refcount);
......@@ -406,8 +406,8 @@ HRESULT vkd3d_create_versioned_root_signature_deserializer(const void *data, SIZ
struct vkd3d_shader_code dxbc = {data, data_size};
HRESULT hr;
TRACE("data %p, data_size %lu, iid %s, deserializer %p.\n",
data, data_size, debugstr_guid(iid), deserializer);
TRACE("data %p, data_size %"PRIuPTR", iid %s, deserializer %p.\n",
data, (uintptr_t)data_size, debugstr_guid(iid), deserializer);
if (!(object = vkd3d_malloc(sizeof(*object))))
return E_OUTOFMEMORY;
......@@ -456,7 +456,7 @@ HRESULT vkd3d_serialize_root_signature(const D3D12_ROOT_SIGNATURE_DESC *desc,
if (error_blob && messages)
{
if (FAILED(hr = vkd3d_blob_create(messages, strlen(messages), error_blob)))
ERR("Failed to create error blob, hr %#x.\n", hr);
ERR("Failed to create error blob, hr %s.\n", debugstr_hresult(hr));
}
return hresult_from_vkd3d_result(ret);
}
......@@ -464,7 +464,7 @@ HRESULT vkd3d_serialize_root_signature(const D3D12_ROOT_SIGNATURE_DESC *desc,
if (FAILED(hr = vkd3d_blob_create((void *)dxbc.code, dxbc.size, blob)))
{
WARN("Failed to create blob object, hr %#x.\n", hr);
WARN("Failed to create blob object, hr %s.\n", debugstr_hresult(hr));
vkd3d_shader_free_shader_code(&dxbc);
}
return hr;
......@@ -497,7 +497,7 @@ HRESULT vkd3d_serialize_versioned_root_signature(const D3D12_VERSIONED_ROOT_SIGN
if (error_blob && messages)
{
if (FAILED(hr = vkd3d_blob_create(messages, strlen(messages), error_blob)))
ERR("Failed to create error blob, hr %#x.\n", hr);
ERR("Failed to create error blob, hr %s.\n", debugstr_hresult(hr));
}
return hresult_from_vkd3d_result(ret);
}
......@@ -505,7 +505,7 @@ HRESULT vkd3d_serialize_versioned_root_signature(const D3D12_VERSIONED_ROOT_SIGN
if (FAILED(hr = vkd3d_blob_create((void *)dxbc.code, dxbc.size, blob)))
{
WARN("Failed to create blob object, hr %#x.\n", hr);
WARN("Failed to create blob object, hr %s.\n", debugstr_hresult(hr));
vkd3d_shader_free_shader_code(&dxbc);
}
return hr;
......
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