2017-06-16 13:38:21 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Józef Kucia for CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2017-06-16 13:38:21 -07:00
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following copyright and
|
|
|
|
* permission notice:
|
|
|
|
*
|
|
|
|
* Copyright 2002-2003 The wine-d3d team
|
|
|
|
* Copyright 2002-2003 2004 Jason Edmeades
|
|
|
|
* Copyright 2002-2003 Raphael Junqueira
|
|
|
|
* Copyright 2005 Oliver Stieber
|
|
|
|
* Copyright 2006 Stefan Dösinger
|
|
|
|
* Copyright 2006-2011, 2013 Stefan Dösinger for CodeWeavers
|
|
|
|
* Copyright 2007 Henri Verbeet
|
2017-06-16 13:38:21 -07:00
|
|
|
* Copyright 2008-2009 Henri Verbeet for CodeWeavers
|
2017-06-16 13:38:21 -07:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2017-06-16 13:38:21 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VKD3D_SHADER_PRIVATE_H
|
|
|
|
#define __VKD3D_SHADER_PRIVATE_H
|
|
|
|
|
2017-06-27 04:16:47 -07:00
|
|
|
#define NONAMELESSUNION
|
2017-06-16 13:38:21 -07:00
|
|
|
#include "vkd3d_common.h"
|
|
|
|
#include "vkd3d_memory.h"
|
|
|
|
#include "vkd3d_shader.h"
|
|
|
|
#include "list.h"
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <stdbool.h>
|
2017-09-11 13:35:16 -07:00
|
|
|
#include <string.h>
|
2017-06-16 13:38:21 -07:00
|
|
|
|
|
|
|
#define VKD3D_VEC4_SIZE 4
|
2021-07-30 06:27:20 -07:00
|
|
|
#define VKD3D_DVEC2_SIZE 2
|
2017-06-16 13:38:21 -07:00
|
|
|
|
vkd3d-shader/spirv: Cache numeric types without through the general declaration cache.
Numeric types are used very frequently, and doing a tree search
each time one is needed tends to waste a lot of time.
I ran the compilation of ~1000 DXBC-TPF shaders randomly taken from
my collection and measured the performance using callgrind and the
kcachegrind "cycle count" estimation.
BEFORE:
* 1,764,035,136 cycles
* 1,767,948,767 cycles
* 1,773,927,734 cycles
AFTER:
* 1,472,384,755 cycles
* 1,469,506,188 cycles
* 1,470,191,425 cycles
So callgrind would estimate a 16% improvement at least.
2024-09-19 06:00:28 -07:00
|
|
|
#define VKD3D_SHADER_COMPONENT_TYPE_COUNT (VKD3D_SHADER_COMPONENT_UINT64 + 1)
|
2024-10-09 08:12:17 -07:00
|
|
|
#define VKD3D_SHADER_MINIMUM_PRECISION_COUNT (VKD3D_SHADER_MINIMUM_PRECISION_UINT_16 + 1)
|
vkd3d-shader/spirv: Cache numeric types without through the general declaration cache.
Numeric types are used very frequently, and doing a tree search
each time one is needed tends to waste a lot of time.
I ran the compilation of ~1000 DXBC-TPF shaders randomly taken from
my collection and measured the performance using callgrind and the
kcachegrind "cycle count" estimation.
BEFORE:
* 1,764,035,136 cycles
* 1,767,948,767 cycles
* 1,773,927,734 cycles
AFTER:
* 1,472,384,755 cycles
* 1,469,506,188 cycles
* 1,470,191,425 cycles
So callgrind would estimate a 16% improvement at least.
2024-09-19 06:00:28 -07:00
|
|
|
|
2020-07-23 02:11:25 -07:00
|
|
|
enum vkd3d_shader_error
|
|
|
|
{
|
2020-07-30 03:29:58 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXBC_INVALID_SIZE = 1,
|
|
|
|
VKD3D_SHADER_ERROR_DXBC_INVALID_MAGIC = 2,
|
|
|
|
VKD3D_SHADER_ERROR_DXBC_INVALID_CHECKSUM = 3,
|
|
|
|
VKD3D_SHADER_ERROR_DXBC_INVALID_VERSION = 4,
|
|
|
|
VKD3D_SHADER_ERROR_DXBC_INVALID_CHUNK_OFFSET = 5,
|
|
|
|
VKD3D_SHADER_ERROR_DXBC_INVALID_CHUNK_SIZE = 6,
|
2023-02-20 08:11:18 -08:00
|
|
|
VKD3D_SHADER_ERROR_DXBC_OUT_OF_MEMORY = 7,
|
2023-03-06 20:04:44 -08:00
|
|
|
VKD3D_SHADER_ERROR_DXBC_INVALID_SIGNATURE = 8,
|
2020-07-30 03:29:58 -07:00
|
|
|
|
|
|
|
VKD3D_SHADER_ERROR_TPF_MISMATCHED_CF = 1000,
|
2021-07-01 20:12:48 -07:00
|
|
|
VKD3D_SHADER_ERROR_TPF_INVALID_REGISTER_RANGE = 1001,
|
2023-01-19 17:35:38 -08:00
|
|
|
VKD3D_SHADER_ERROR_TPF_OUT_OF_MEMORY = 1002,
|
2023-05-03 00:10:37 -07:00
|
|
|
VKD3D_SHADER_ERROR_TPF_INVALID_REGISTER_INDEX_COUNT = 1003,
|
2023-05-03 00:17:24 -07:00
|
|
|
VKD3D_SHADER_ERROR_TPF_TOO_MANY_REGISTERS = 1004,
|
2023-05-03 00:24:24 -07:00
|
|
|
VKD3D_SHADER_ERROR_TPF_INVALID_IO_REGISTER = 1005,
|
2023-05-03 23:56:30 -07:00
|
|
|
VKD3D_SHADER_ERROR_TPF_INVALID_INDEX_RANGE_DCL = 1006,
|
2023-08-27 19:55:47 -07:00
|
|
|
VKD3D_SHADER_ERROR_TPF_INVALID_CASE_VALUE = 1007,
|
2023-08-07 18:38:26 -07:00
|
|
|
VKD3D_SHADER_ERROR_TPF_INVALID_REGISTER_DIMENSION = 1008,
|
|
|
|
VKD3D_SHADER_ERROR_TPF_INVALID_REGISTER_SWIZZLE = 1009,
|
2024-09-16 07:11:11 -07:00
|
|
|
VKD3D_SHADER_ERROR_TPF_INVALID_REGISTER_DCL = 1010,
|
2020-07-30 03:29:58 -07:00
|
|
|
|
2023-05-03 00:19:32 -07:00
|
|
|
VKD3D_SHADER_WARNING_TPF_MASK_NOT_CONTIGUOUS = 1300,
|
2023-05-03 23:56:30 -07:00
|
|
|
VKD3D_SHADER_WARNING_TPF_UNHANDLED_INDEX_RANGE_MASK = 1301,
|
2023-08-07 19:09:10 -07:00
|
|
|
VKD3D_SHADER_WARNING_TPF_UNHANDLED_REGISTER_MASK = 1302,
|
2023-08-07 19:29:20 -07:00
|
|
|
VKD3D_SHADER_WARNING_TPF_UNHANDLED_REGISTER_SWIZZLE = 1303,
|
2023-05-03 00:19:32 -07:00
|
|
|
|
2020-08-04 03:13:29 -07:00
|
|
|
VKD3D_SHADER_ERROR_SPV_DESCRIPTOR_BINDING_NOT_FOUND = 2000,
|
2020-08-04 03:13:30 -07:00
|
|
|
VKD3D_SHADER_ERROR_SPV_INVALID_REGISTER_TYPE = 2001,
|
2020-08-20 12:09:42 -07:00
|
|
|
VKD3D_SHADER_ERROR_SPV_INVALID_DESCRIPTOR_BINDING = 2002,
|
2021-07-23 06:01:37 -07:00
|
|
|
VKD3D_SHADER_ERROR_SPV_DESCRIPTOR_IDX_UNSUPPORTED = 2003,
|
2023-11-22 06:10:15 -08:00
|
|
|
VKD3D_SHADER_ERROR_SPV_UNSUPPORTED_FEATURE = 2004,
|
2023-05-17 22:51:53 -07:00
|
|
|
VKD3D_SHADER_ERROR_SPV_OUT_OF_MEMORY = 2005,
|
2023-11-03 07:16:44 -07:00
|
|
|
VKD3D_SHADER_ERROR_SPV_INVALID_TYPE = 2006,
|
2023-11-03 07:17:11 -07:00
|
|
|
VKD3D_SHADER_ERROR_SPV_INVALID_HANDLER = 2007,
|
2023-11-13 06:50:30 -08:00
|
|
|
VKD3D_SHADER_ERROR_SPV_NOT_IMPLEMENTED = 2008,
|
2023-09-25 06:00:12 -07:00
|
|
|
VKD3D_SHADER_ERROR_SPV_INVALID_SHADER = 2009,
|
2020-08-04 03:13:29 -07:00
|
|
|
|
2023-08-07 18:38:26 -07:00
|
|
|
VKD3D_SHADER_WARNING_SPV_INVALID_SWIZZLE = 2300,
|
2023-08-15 20:46:10 -07:00
|
|
|
VKD3D_SHADER_WARNING_SPV_INVALID_UAV_FLAGS = 2301,
|
2024-04-04 02:10:55 -07:00
|
|
|
VKD3D_SHADER_WARNING_SPV_IGNORING_FLAG = 2302,
|
2023-08-07 18:38:26 -07:00
|
|
|
|
2020-07-30 03:29:58 -07:00
|
|
|
VKD3D_SHADER_ERROR_RS_OUT_OF_MEMORY = 3000,
|
|
|
|
VKD3D_SHADER_ERROR_RS_INVALID_VERSION = 3001,
|
|
|
|
VKD3D_SHADER_ERROR_RS_INVALID_ROOT_PARAMETER_TYPE = 3002,
|
|
|
|
VKD3D_SHADER_ERROR_RS_INVALID_DESCRIPTOR_RANGE_TYPE = 3003,
|
|
|
|
VKD3D_SHADER_ERROR_RS_MIXED_DESCRIPTOR_RANGE_TYPES = 3004,
|
2020-12-15 15:13:20 -08:00
|
|
|
|
|
|
|
VKD3D_SHADER_ERROR_PP_INVALID_SYNTAX = 4000,
|
2021-01-14 12:47:50 -08:00
|
|
|
VKD3D_SHADER_ERROR_PP_ERROR_DIRECTIVE = 4001,
|
2021-01-07 09:48:09 -08:00
|
|
|
VKD3D_SHADER_ERROR_PP_INCLUDE_FAILED = 4002,
|
2020-12-21 12:37:06 -08:00
|
|
|
|
2021-01-07 09:48:06 -08:00
|
|
|
VKD3D_SHADER_WARNING_PP_ALREADY_DEFINED = 4300,
|
2020-12-21 12:37:06 -08:00
|
|
|
VKD3D_SHADER_WARNING_PP_INVALID_DIRECTIVE = 4301,
|
2021-01-12 14:14:19 -08:00
|
|
|
VKD3D_SHADER_WARNING_PP_ARGUMENT_COUNT_MISMATCH = 4302,
|
2020-12-21 12:37:06 -08:00
|
|
|
VKD3D_SHADER_WARNING_PP_UNKNOWN_DIRECTIVE = 4303,
|
2021-01-12 14:14:19 -08:00
|
|
|
VKD3D_SHADER_WARNING_PP_UNTERMINATED_MACRO = 4304,
|
2020-12-21 12:37:06 -08:00
|
|
|
VKD3D_SHADER_WARNING_PP_UNTERMINATED_IF = 4305,
|
2021-01-19 09:18:19 -08:00
|
|
|
VKD3D_SHADER_WARNING_PP_DIV_BY_ZERO = 4306,
|
2021-02-21 20:04:36 -08:00
|
|
|
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX = 5000,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER = 5001,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE = 5002,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_MODIFIES_CONST = 5003,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_MISSING_SEMANTIC = 5004,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_NOT_DEFINED = 5005,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_REDEFINED = 5006,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT = 5007,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_SIZE = 5008,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_MISSING_INITIALIZER = 5009,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_LVALUE = 5010,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_WRITEMASK = 5011,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_INDEX = 5012,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_SEMANTIC = 5013,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_RETURN = 5014,
|
2021-06-23 21:57:35 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_OVERLAPPING_RESERVATIONS = 5015,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION = 5016,
|
2021-08-13 07:03:24 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_NOT_IMPLEMENTED = 5017,
|
2022-01-26 06:35:30 -08:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_TEXEL_OFFSET = 5018,
|
2022-02-24 06:06:15 -08:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_OFFSET_OUT_OF_BOUNDS = 5019,
|
2022-02-28 03:23:43 -08:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_INCOMPATIBLE_PROFILE = 5020,
|
2022-04-14 03:52:39 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO = 5021,
|
2022-07-22 08:40:24 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_NON_STATIC_OBJECT_REF = 5022,
|
2021-08-16 15:29:34 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_THREAD_COUNT = 5023,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_MISSING_ATTRIBUTE = 5024,
|
2021-09-11 09:20:32 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_RECURSIVE_CALL = 5025,
|
2022-11-25 15:38:33 -08:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_INCONSISTENT_SAMPLER = 5026,
|
2023-07-05 01:39:04 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_NON_FINITE_RESULT = 5027,
|
2023-10-11 04:55:32 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_DUPLICATE_SWITCH_CASE = 5028,
|
2024-02-22 17:11:38 -08:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_MISSING_TECHNIQUE = 5029,
|
2024-02-24 17:42:54 -08:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_UNKNOWN_MODIFIER = 5030,
|
2024-06-06 14:50:05 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_STATE_BLOCK_ENTRY = 5031,
|
2024-04-11 07:11:14 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_FAILED_FORCED_UNROLL = 5032,
|
2024-06-24 14:30:46 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_PROFILE = 5033,
|
|
|
|
VKD3D_SHADER_ERROR_HLSL_MISPLACED_COMPILE = 5034,
|
2024-08-24 07:08:53 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_DOMAIN = 5035,
|
2024-09-03 12:30:40 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_CONTROL_POINT_COUNT = 5036,
|
2024-08-24 07:12:34 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_OUTPUT_PRIMITIVE = 5037,
|
2024-09-03 12:09:24 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_INVALID_PARTITIONING = 5038,
|
2024-08-26 13:43:20 -07:00
|
|
|
VKD3D_SHADER_ERROR_HLSL_MISPLACED_SAMPLER_STATE = 5039,
|
2021-02-21 20:04:36 -08:00
|
|
|
|
|
|
|
VKD3D_SHADER_WARNING_HLSL_IMPLICIT_TRUNCATION = 5300,
|
2022-04-14 03:52:39 -07:00
|
|
|
VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO = 5301,
|
2021-08-16 12:52:10 -07:00
|
|
|
VKD3D_SHADER_WARNING_HLSL_UNKNOWN_ATTRIBUTE = 5302,
|
2023-07-05 01:39:04 -07:00
|
|
|
VKD3D_SHADER_WARNING_HLSL_IMAGINARY_NUMERIC_RESULT = 5303,
|
2023-07-05 02:09:21 -07:00
|
|
|
VKD3D_SHADER_WARNING_HLSL_NON_FINITE_RESULT = 5304,
|
2023-08-10 01:03:49 -07:00
|
|
|
VKD3D_SHADER_WARNING_HLSL_IGNORED_ATTRIBUTE = 5305,
|
2024-06-25 15:36:32 -07:00
|
|
|
VKD3D_SHADER_WARNING_HLSL_IGNORED_DEFAULT_VALUE = 5306,
|
2021-08-17 21:19:14 -07:00
|
|
|
|
|
|
|
VKD3D_SHADER_ERROR_GLSL_INTERNAL = 6000,
|
2024-02-24 15:35:48 -08:00
|
|
|
VKD3D_SHADER_ERROR_GLSL_BINDING_NOT_FOUND = 6001,
|
2024-05-06 05:00:58 -07:00
|
|
|
VKD3D_SHADER_ERROR_GLSL_UNSUPPORTED = 6002,
|
2021-10-06 08:11:48 -07:00
|
|
|
|
|
|
|
VKD3D_SHADER_ERROR_D3DBC_UNEXPECTED_EOF = 7000,
|
|
|
|
VKD3D_SHADER_ERROR_D3DBC_INVALID_VERSION_TOKEN = 7001,
|
|
|
|
VKD3D_SHADER_ERROR_D3DBC_INVALID_OPCODE = 7002,
|
|
|
|
VKD3D_SHADER_ERROR_D3DBC_INVALID_RESOURCE_TYPE = 7003,
|
2023-01-19 17:13:01 -08:00
|
|
|
VKD3D_SHADER_ERROR_D3DBC_OUT_OF_MEMORY = 7004,
|
2023-02-24 11:12:30 -08:00
|
|
|
VKD3D_SHADER_ERROR_D3DBC_INVALID_REGISTER_INDEX = 7005,
|
|
|
|
VKD3D_SHADER_ERROR_D3DBC_UNDECLARED_SEMANTIC = 7006,
|
2024-05-23 18:22:04 -07:00
|
|
|
VKD3D_SHADER_ERROR_D3DBC_INVALID_REGISTER_TYPE = 7007,
|
2024-05-27 16:58:05 -07:00
|
|
|
VKD3D_SHADER_ERROR_D3DBC_INVALID_REGISTER_COUNT = 7008,
|
|
|
|
VKD3D_SHADER_ERROR_D3DBC_NOT_IMPLEMENTED = 7009,
|
|
|
|
VKD3D_SHADER_ERROR_D3DBC_INVALID_PROFILE = 7010,
|
2024-05-30 23:20:36 -07:00
|
|
|
VKD3D_SHADER_ERROR_D3DBC_INVALID_WRITEMASK = 7011,
|
2021-10-06 08:11:48 -07:00
|
|
|
|
|
|
|
VKD3D_SHADER_WARNING_D3DBC_IGNORED_INSTRUCTION_FLAGS= 7300,
|
2022-11-14 21:16:41 -08:00
|
|
|
|
|
|
|
VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY = 8000,
|
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_SIZE = 8001,
|
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_CHUNK_OFFSET = 8002,
|
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_CHUNK_SIZE = 8003,
|
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_BITCODE = 8004,
|
2023-05-11 22:59:42 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND_COUNT = 8005,
|
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_TYPE_TABLE = 8006,
|
2023-07-09 20:46:45 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_VALUE_SYMTAB = 8007,
|
2023-06-28 22:32:44 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_UNSUPPORTED_BITCODE_FORMAT = 8008,
|
2023-05-14 19:45:09 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_FUNCTION_DCL = 8009,
|
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_TYPE_ID = 8010,
|
2023-05-14 20:52:00 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_MODULE = 8011,
|
2023-07-30 23:23:08 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND = 8012,
|
2023-09-24 19:12:29 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_UNHANDLED_INTRINSIC = 8013,
|
2023-09-28 18:16:08 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_METADATA = 8014,
|
2023-09-27 23:25:39 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_ENTRY_POINT = 8015,
|
2023-09-27 23:33:11 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_SIGNATURE = 8016,
|
2023-10-02 22:06:29 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_PROPERTIES = 8017,
|
2023-10-14 20:38:11 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_RESOURCES = 8018,
|
2023-10-04 22:38:09 -07:00
|
|
|
VKD3D_SHADER_ERROR_DXIL_INVALID_RESOURCE_HANDLE = 8019,
|
2022-11-14 21:16:41 -08:00
|
|
|
|
|
|
|
VKD3D_SHADER_WARNING_DXIL_UNKNOWN_MAGIC_NUMBER = 8300,
|
|
|
|
VKD3D_SHADER_WARNING_DXIL_UNKNOWN_SHADER_TYPE = 8301,
|
|
|
|
VKD3D_SHADER_WARNING_DXIL_INVALID_BLOCK_LENGTH = 8302,
|
|
|
|
VKD3D_SHADER_WARNING_DXIL_INVALID_MODULE_LENGTH = 8303,
|
2023-05-11 22:59:42 -07:00
|
|
|
VKD3D_SHADER_WARNING_DXIL_IGNORING_OPERANDS = 8304,
|
2023-09-28 18:45:44 -07:00
|
|
|
VKD3D_SHADER_WARNING_DXIL_TYPE_MISMATCH = 8305,
|
2023-09-27 23:25:39 -07:00
|
|
|
VKD3D_SHADER_WARNING_DXIL_ENTRY_POINT_MISMATCH = 8306,
|
2023-10-01 19:24:04 -07:00
|
|
|
VKD3D_SHADER_WARNING_DXIL_INVALID_MASK = 8307,
|
2023-10-15 22:41:17 -07:00
|
|
|
VKD3D_SHADER_WARNING_DXIL_INVALID_OPERATION = 8308,
|
2023-11-26 22:55:29 -08:00
|
|
|
VKD3D_SHADER_WARNING_DXIL_IGNORING_ATTACHMENT = 8309,
|
2023-06-14 21:47:37 -07:00
|
|
|
VKD3D_SHADER_WARNING_DXIL_UNDEFINED_OPERAND = 8310,
|
2023-07-20 19:52:25 -07:00
|
|
|
|
|
|
|
VKD3D_SHADER_ERROR_VSIR_NOT_IMPLEMENTED = 9000,
|
2023-08-29 12:35:01 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_HANDLER = 9001,
|
2023-08-29 12:58:31 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE = 9002,
|
2023-08-29 13:17:28 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_WRITE_MASK = 9003,
|
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_MODIFIERS = 9004,
|
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_SHIFT = 9005,
|
2023-08-29 13:23:02 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_SWIZZLE = 9006,
|
2023-10-24 17:37:40 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_PRECISION = 9007,
|
2023-10-24 17:41:09 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE = 9008,
|
2023-10-24 17:43:31 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION = 9009,
|
2023-10-24 17:46:07 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT = 9010,
|
2023-10-24 18:08:00 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_DEST_COUNT = 9011,
|
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_SOURCE_COUNT = 9012,
|
2023-10-24 17:55:37 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_DUPLICATE_DCL_TEMPS = 9013,
|
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_DCL_TEMPS = 9014,
|
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX = 9015,
|
2024-01-12 00:28:14 -08:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_CONTROL_FLOW = 9016,
|
2024-01-10 02:58:44 -08:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_SSA_USAGE = 9017,
|
2024-04-04 20:54:25 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION = 9018,
|
2024-04-18 19:45:09 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_GS = 9019,
|
2024-07-16 17:48:48 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_PARAMETER = 9020,
|
|
|
|
VKD3D_SHADER_ERROR_VSIR_MISSING_SEMANTIC = 9021,
|
2024-10-08 06:01:12 -07:00
|
|
|
VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE = 9022,
|
2023-11-20 05:58:40 -08:00
|
|
|
|
|
|
|
VKD3D_SHADER_WARNING_VSIR_DYNAMIC_DESCRIPTOR_ARRAY = 9300,
|
2024-08-26 19:34:57 -07:00
|
|
|
|
|
|
|
VKD3D_SHADER_ERROR_MSL_INTERNAL = 10000,
|
2024-10-09 01:36:06 -07:00
|
|
|
VKD3D_SHADER_ERROR_MSL_BINDING_NOT_FOUND = 10001,
|
2024-10-04 14:36:28 -07:00
|
|
|
|
|
|
|
VKD3D_SHADER_ERROR_FX_NOT_IMPLEMENTED = 11000,
|
|
|
|
VKD3D_SHADER_ERROR_FX_INVALID_VERSION = 11001,
|
2024-10-17 02:36:34 -07:00
|
|
|
VKD3D_SHADER_ERROR_FX_INVALID_DATA = 11002,
|
2020-07-23 02:11:25 -07:00
|
|
|
};
|
|
|
|
|
2021-02-16 05:58:23 -08:00
|
|
|
enum vkd3d_shader_opcode
|
2017-06-16 13:38:21 -07:00
|
|
|
{
|
|
|
|
VKD3DSIH_ABS,
|
2024-01-21 21:26:16 -08:00
|
|
|
VKD3DSIH_ACOS,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_ADD,
|
|
|
|
VKD3DSIH_AND,
|
2024-01-21 21:26:16 -08:00
|
|
|
VKD3DSIH_ASIN,
|
|
|
|
VKD3DSIH_ATAN,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_ATOMIC_AND,
|
|
|
|
VKD3DSIH_ATOMIC_CMP_STORE,
|
|
|
|
VKD3DSIH_ATOMIC_IADD,
|
|
|
|
VKD3DSIH_ATOMIC_IMAX,
|
|
|
|
VKD3DSIH_ATOMIC_IMIN,
|
|
|
|
VKD3DSIH_ATOMIC_OR,
|
|
|
|
VKD3DSIH_ATOMIC_UMAX,
|
|
|
|
VKD3DSIH_ATOMIC_UMIN,
|
|
|
|
VKD3DSIH_ATOMIC_XOR,
|
|
|
|
VKD3DSIH_BEM,
|
|
|
|
VKD3DSIH_BFI,
|
|
|
|
VKD3DSIH_BFREV,
|
2024-01-04 06:55:51 -08:00
|
|
|
VKD3DSIH_BRANCH,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_BREAK,
|
|
|
|
VKD3DSIH_BREAKC,
|
|
|
|
VKD3DSIH_BREAKP,
|
|
|
|
VKD3DSIH_BUFINFO,
|
|
|
|
VKD3DSIH_CALL,
|
|
|
|
VKD3DSIH_CALLNZ,
|
|
|
|
VKD3DSIH_CASE,
|
2022-01-10 17:03:36 -08:00
|
|
|
VKD3DSIH_CHECK_ACCESS_FULLY_MAPPED,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_CMP,
|
|
|
|
VKD3DSIH_CND,
|
|
|
|
VKD3DSIH_CONTINUE,
|
|
|
|
VKD3DSIH_CONTINUEP,
|
|
|
|
VKD3DSIH_COUNTBITS,
|
|
|
|
VKD3DSIH_CRS,
|
|
|
|
VKD3DSIH_CUT,
|
|
|
|
VKD3DSIH_CUT_STREAM,
|
2021-07-30 06:27:24 -07:00
|
|
|
VKD3DSIH_DADD,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_DCL,
|
|
|
|
VKD3DSIH_DCL_CONSTANT_BUFFER,
|
|
|
|
VKD3DSIH_DCL_FUNCTION_BODY,
|
|
|
|
VKD3DSIH_DCL_FUNCTION_TABLE,
|
|
|
|
VKD3DSIH_DCL_GLOBAL_FLAGS,
|
|
|
|
VKD3DSIH_DCL_GS_INSTANCES,
|
|
|
|
VKD3DSIH_DCL_HS_FORK_PHASE_INSTANCE_COUNT,
|
|
|
|
VKD3DSIH_DCL_HS_JOIN_PHASE_INSTANCE_COUNT,
|
|
|
|
VKD3DSIH_DCL_HS_MAX_TESSFACTOR,
|
|
|
|
VKD3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER,
|
|
|
|
VKD3DSIH_DCL_INDEX_RANGE,
|
|
|
|
VKD3DSIH_DCL_INDEXABLE_TEMP,
|
|
|
|
VKD3DSIH_DCL_INPUT,
|
|
|
|
VKD3DSIH_DCL_INPUT_CONTROL_POINT_COUNT,
|
|
|
|
VKD3DSIH_DCL_INPUT_PRIMITIVE,
|
|
|
|
VKD3DSIH_DCL_INPUT_PS,
|
|
|
|
VKD3DSIH_DCL_INPUT_PS_SGV,
|
|
|
|
VKD3DSIH_DCL_INPUT_PS_SIV,
|
|
|
|
VKD3DSIH_DCL_INPUT_SGV,
|
|
|
|
VKD3DSIH_DCL_INPUT_SIV,
|
|
|
|
VKD3DSIH_DCL_INTERFACE,
|
|
|
|
VKD3DSIH_DCL_OUTPUT,
|
|
|
|
VKD3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT,
|
|
|
|
VKD3DSIH_DCL_OUTPUT_SIV,
|
|
|
|
VKD3DSIH_DCL_OUTPUT_TOPOLOGY,
|
|
|
|
VKD3DSIH_DCL_RESOURCE_RAW,
|
|
|
|
VKD3DSIH_DCL_RESOURCE_STRUCTURED,
|
|
|
|
VKD3DSIH_DCL_SAMPLER,
|
|
|
|
VKD3DSIH_DCL_STREAM,
|
|
|
|
VKD3DSIH_DCL_TEMPS,
|
|
|
|
VKD3DSIH_DCL_TESSELLATOR_DOMAIN,
|
|
|
|
VKD3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE,
|
|
|
|
VKD3DSIH_DCL_TESSELLATOR_PARTITIONING,
|
|
|
|
VKD3DSIH_DCL_TGSM_RAW,
|
|
|
|
VKD3DSIH_DCL_TGSM_STRUCTURED,
|
|
|
|
VKD3DSIH_DCL_THREAD_GROUP,
|
|
|
|
VKD3DSIH_DCL_UAV_RAW,
|
|
|
|
VKD3DSIH_DCL_UAV_STRUCTURED,
|
|
|
|
VKD3DSIH_DCL_UAV_TYPED,
|
|
|
|
VKD3DSIH_DCL_VERTICES_OUT,
|
2021-08-10 18:53:00 -07:00
|
|
|
VKD3DSIH_DDIV,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_DEF,
|
|
|
|
VKD3DSIH_DEFAULT,
|
|
|
|
VKD3DSIH_DEFB,
|
|
|
|
VKD3DSIH_DEFI,
|
2023-06-02 07:31:59 -07:00
|
|
|
VKD3DSIH_DEQO,
|
2021-08-09 08:12:31 -07:00
|
|
|
VKD3DSIH_DFMA,
|
2023-06-02 07:31:59 -07:00
|
|
|
VKD3DSIH_DGEO,
|
2023-04-20 19:20:33 -07:00
|
|
|
VKD3DSIH_DISCARD,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_DIV,
|
2021-08-03 19:56:09 -07:00
|
|
|
VKD3DSIH_DLT,
|
2021-08-09 08:12:28 -07:00
|
|
|
VKD3DSIH_DMAX,
|
2021-08-09 08:12:29 -07:00
|
|
|
VKD3DSIH_DMIN,
|
2021-07-27 07:26:10 -07:00
|
|
|
VKD3DSIH_DMOV,
|
2021-08-10 18:53:02 -07:00
|
|
|
VKD3DSIH_DMOVC,
|
2021-08-10 18:52:59 -07:00
|
|
|
VKD3DSIH_DMUL,
|
2021-08-03 19:56:10 -07:00
|
|
|
VKD3DSIH_DNE,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_DP2,
|
|
|
|
VKD3DSIH_DP2ADD,
|
|
|
|
VKD3DSIH_DP3,
|
|
|
|
VKD3DSIH_DP4,
|
2021-08-10 18:53:01 -07:00
|
|
|
VKD3DSIH_DRCP,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_DST,
|
|
|
|
VKD3DSIH_DSX,
|
|
|
|
VKD3DSIH_DSX_COARSE,
|
|
|
|
VKD3DSIH_DSX_FINE,
|
|
|
|
VKD3DSIH_DSY,
|
|
|
|
VKD3DSIH_DSY_COARSE,
|
|
|
|
VKD3DSIH_DSY_FINE,
|
2021-08-11 19:55:12 -07:00
|
|
|
VKD3DSIH_DTOF,
|
2021-08-11 19:55:13 -07:00
|
|
|
VKD3DSIH_DTOI,
|
2021-08-11 19:55:14 -07:00
|
|
|
VKD3DSIH_DTOU,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_ELSE,
|
|
|
|
VKD3DSIH_EMIT,
|
|
|
|
VKD3DSIH_EMIT_STREAM,
|
|
|
|
VKD3DSIH_ENDIF,
|
|
|
|
VKD3DSIH_ENDLOOP,
|
|
|
|
VKD3DSIH_ENDREP,
|
|
|
|
VKD3DSIH_ENDSWITCH,
|
2023-06-02 07:31:59 -07:00
|
|
|
VKD3DSIH_EQO,
|
|
|
|
VKD3DSIH_EQU,
|
2019-03-14 03:34:54 -07:00
|
|
|
VKD3DSIH_EVAL_CENTROID,
|
2018-05-29 03:50:31 -07:00
|
|
|
VKD3DSIH_EVAL_SAMPLE_INDEX,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_EXP,
|
|
|
|
VKD3DSIH_EXPP,
|
|
|
|
VKD3DSIH_F16TOF32,
|
|
|
|
VKD3DSIH_F32TOF16,
|
|
|
|
VKD3DSIH_FCALL,
|
|
|
|
VKD3DSIH_FIRSTBIT_HI,
|
|
|
|
VKD3DSIH_FIRSTBIT_LO,
|
|
|
|
VKD3DSIH_FIRSTBIT_SHI,
|
|
|
|
VKD3DSIH_FRC,
|
2023-05-24 19:06:22 -07:00
|
|
|
VKD3DSIH_FREM,
|
2021-08-11 19:55:11 -07:00
|
|
|
VKD3DSIH_FTOD,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_FTOI,
|
|
|
|
VKD3DSIH_FTOU,
|
|
|
|
VKD3DSIH_GATHER4,
|
|
|
|
VKD3DSIH_GATHER4_C,
|
2022-01-10 17:03:36 -08:00
|
|
|
VKD3DSIH_GATHER4_C_S,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_GATHER4_PO,
|
|
|
|
VKD3DSIH_GATHER4_PO_C,
|
2022-01-10 17:03:36 -08:00
|
|
|
VKD3DSIH_GATHER4_PO_C_S,
|
|
|
|
VKD3DSIH_GATHER4_PO_S,
|
|
|
|
VKD3DSIH_GATHER4_S,
|
2023-06-02 07:31:59 -07:00
|
|
|
VKD3DSIH_GEO,
|
|
|
|
VKD3DSIH_GEU,
|
2024-01-21 21:28:44 -08:00
|
|
|
VKD3DSIH_HCOS,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_HS_CONTROL_POINT_PHASE,
|
|
|
|
VKD3DSIH_HS_DECLS,
|
|
|
|
VKD3DSIH_HS_FORK_PHASE,
|
|
|
|
VKD3DSIH_HS_JOIN_PHASE,
|
2024-01-21 21:28:44 -08:00
|
|
|
VKD3DSIH_HSIN,
|
|
|
|
VKD3DSIH_HTAN,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_IADD,
|
|
|
|
VKD3DSIH_IBFE,
|
2023-05-24 19:07:26 -07:00
|
|
|
VKD3DSIH_IDIV,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_IEQ,
|
|
|
|
VKD3DSIH_IF,
|
|
|
|
VKD3DSIH_IFC,
|
|
|
|
VKD3DSIH_IGE,
|
|
|
|
VKD3DSIH_ILT,
|
|
|
|
VKD3DSIH_IMAD,
|
|
|
|
VKD3DSIH_IMAX,
|
|
|
|
VKD3DSIH_IMIN,
|
|
|
|
VKD3DSIH_IMM_ATOMIC_ALLOC,
|
|
|
|
VKD3DSIH_IMM_ATOMIC_AND,
|
|
|
|
VKD3DSIH_IMM_ATOMIC_CMP_EXCH,
|
|
|
|
VKD3DSIH_IMM_ATOMIC_CONSUME,
|
|
|
|
VKD3DSIH_IMM_ATOMIC_EXCH,
|
|
|
|
VKD3DSIH_IMM_ATOMIC_IADD,
|
|
|
|
VKD3DSIH_IMM_ATOMIC_IMAX,
|
|
|
|
VKD3DSIH_IMM_ATOMIC_IMIN,
|
|
|
|
VKD3DSIH_IMM_ATOMIC_OR,
|
|
|
|
VKD3DSIH_IMM_ATOMIC_UMAX,
|
|
|
|
VKD3DSIH_IMM_ATOMIC_UMIN,
|
|
|
|
VKD3DSIH_IMM_ATOMIC_XOR,
|
|
|
|
VKD3DSIH_IMUL,
|
|
|
|
VKD3DSIH_INE,
|
|
|
|
VKD3DSIH_INEG,
|
2024-01-21 21:18:27 -08:00
|
|
|
VKD3DSIH_ISFINITE,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_ISHL,
|
|
|
|
VKD3DSIH_ISHR,
|
2024-01-21 21:18:27 -08:00
|
|
|
VKD3DSIH_ISINF,
|
|
|
|
VKD3DSIH_ISNAN,
|
2021-08-11 19:55:15 -07:00
|
|
|
VKD3DSIH_ITOD,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_ITOF,
|
2023-10-31 22:31:24 -07:00
|
|
|
VKD3DSIH_ITOI,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_LABEL,
|
|
|
|
VKD3DSIH_LD,
|
|
|
|
VKD3DSIH_LD2DMS,
|
2022-01-10 17:03:36 -08:00
|
|
|
VKD3DSIH_LD2DMS_S,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_LD_RAW,
|
2022-01-10 17:03:36 -08:00
|
|
|
VKD3DSIH_LD_RAW_S,
|
|
|
|
VKD3DSIH_LD_S,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_LD_STRUCTURED,
|
2022-01-10 17:03:36 -08:00
|
|
|
VKD3DSIH_LD_STRUCTURED_S,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_LD_UAV_TYPED,
|
2022-01-10 17:03:36 -08:00
|
|
|
VKD3DSIH_LD_UAV_TYPED_S,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_LIT,
|
|
|
|
VKD3DSIH_LOD,
|
|
|
|
VKD3DSIH_LOG,
|
|
|
|
VKD3DSIH_LOGP,
|
|
|
|
VKD3DSIH_LOOP,
|
|
|
|
VKD3DSIH_LRP,
|
2023-06-02 07:31:59 -07:00
|
|
|
VKD3DSIH_LTO,
|
|
|
|
VKD3DSIH_LTU,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_M3x2,
|
|
|
|
VKD3DSIH_M3x3,
|
|
|
|
VKD3DSIH_M3x4,
|
|
|
|
VKD3DSIH_M4x3,
|
|
|
|
VKD3DSIH_M4x4,
|
|
|
|
VKD3DSIH_MAD,
|
|
|
|
VKD3DSIH_MAX,
|
|
|
|
VKD3DSIH_MIN,
|
|
|
|
VKD3DSIH_MOV,
|
|
|
|
VKD3DSIH_MOVA,
|
|
|
|
VKD3DSIH_MOVC,
|
2022-03-14 03:55:02 -07:00
|
|
|
VKD3DSIH_MSAD,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_MUL,
|
2023-06-02 07:31:59 -07:00
|
|
|
VKD3DSIH_NEO,
|
|
|
|
VKD3DSIH_NEU,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_NOP,
|
|
|
|
VKD3DSIH_NOT,
|
|
|
|
VKD3DSIH_NRM,
|
|
|
|
VKD3DSIH_OR,
|
2024-03-04 06:38:46 -08:00
|
|
|
VKD3DSIH_ORD,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_PHASE,
|
2023-11-23 17:23:09 -08:00
|
|
|
VKD3DSIH_PHI,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_POW,
|
2024-04-23 05:16:51 -07:00
|
|
|
VKD3DSIH_QUAD_READ_ACROSS_D,
|
|
|
|
VKD3DSIH_QUAD_READ_ACROSS_X,
|
|
|
|
VKD3DSIH_QUAD_READ_ACROSS_Y,
|
2024-04-23 05:31:40 -07:00
|
|
|
VKD3DSIH_QUAD_READ_LANE_AT,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_RCP,
|
|
|
|
VKD3DSIH_REP,
|
|
|
|
VKD3DSIH_RESINFO,
|
|
|
|
VKD3DSIH_RET,
|
|
|
|
VKD3DSIH_RETP,
|
|
|
|
VKD3DSIH_ROUND_NE,
|
|
|
|
VKD3DSIH_ROUND_NI,
|
|
|
|
VKD3DSIH_ROUND_PI,
|
|
|
|
VKD3DSIH_ROUND_Z,
|
|
|
|
VKD3DSIH_RSQ,
|
|
|
|
VKD3DSIH_SAMPLE,
|
|
|
|
VKD3DSIH_SAMPLE_B,
|
2022-01-10 17:03:36 -08:00
|
|
|
VKD3DSIH_SAMPLE_B_CL_S,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_SAMPLE_C,
|
2022-01-10 17:03:36 -08:00
|
|
|
VKD3DSIH_SAMPLE_C_CL_S,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_SAMPLE_C_LZ,
|
2022-01-10 17:03:36 -08:00
|
|
|
VKD3DSIH_SAMPLE_C_LZ_S,
|
|
|
|
VKD3DSIH_SAMPLE_CL_S,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_SAMPLE_GRAD,
|
2022-01-10 17:03:36 -08:00
|
|
|
VKD3DSIH_SAMPLE_GRAD_CL_S,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_SAMPLE_INFO,
|
|
|
|
VKD3DSIH_SAMPLE_LOD,
|
2022-01-10 17:03:36 -08:00
|
|
|
VKD3DSIH_SAMPLE_LOD_S,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_SAMPLE_POS,
|
|
|
|
VKD3DSIH_SETP,
|
|
|
|
VKD3DSIH_SGE,
|
|
|
|
VKD3DSIH_SGN,
|
|
|
|
VKD3DSIH_SINCOS,
|
|
|
|
VKD3DSIH_SLT,
|
|
|
|
VKD3DSIH_SQRT,
|
|
|
|
VKD3DSIH_STORE_RAW,
|
|
|
|
VKD3DSIH_STORE_STRUCTURED,
|
|
|
|
VKD3DSIH_STORE_UAV_TYPED,
|
|
|
|
VKD3DSIH_SUB,
|
|
|
|
VKD3DSIH_SWAPC,
|
|
|
|
VKD3DSIH_SWITCH,
|
2023-12-11 21:58:08 -08:00
|
|
|
VKD3DSIH_SWITCH_MONOLITHIC,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_SYNC,
|
2024-01-21 21:32:22 -08:00
|
|
|
VKD3DSIH_TAN,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_TEX,
|
|
|
|
VKD3DSIH_TEXBEM,
|
|
|
|
VKD3DSIH_TEXBEML,
|
|
|
|
VKD3DSIH_TEXCOORD,
|
|
|
|
VKD3DSIH_TEXDEPTH,
|
|
|
|
VKD3DSIH_TEXDP3,
|
|
|
|
VKD3DSIH_TEXDP3TEX,
|
|
|
|
VKD3DSIH_TEXKILL,
|
|
|
|
VKD3DSIH_TEXLDD,
|
|
|
|
VKD3DSIH_TEXLDL,
|
|
|
|
VKD3DSIH_TEXM3x2DEPTH,
|
|
|
|
VKD3DSIH_TEXM3x2PAD,
|
|
|
|
VKD3DSIH_TEXM3x2TEX,
|
|
|
|
VKD3DSIH_TEXM3x3,
|
|
|
|
VKD3DSIH_TEXM3x3DIFF,
|
|
|
|
VKD3DSIH_TEXM3x3PAD,
|
|
|
|
VKD3DSIH_TEXM3x3SPEC,
|
|
|
|
VKD3DSIH_TEXM3x3TEX,
|
|
|
|
VKD3DSIH_TEXM3x3VSPEC,
|
|
|
|
VKD3DSIH_TEXREG2AR,
|
|
|
|
VKD3DSIH_TEXREG2GB,
|
|
|
|
VKD3DSIH_TEXREG2RGB,
|
|
|
|
VKD3DSIH_UBFE,
|
|
|
|
VKD3DSIH_UDIV,
|
|
|
|
VKD3DSIH_UGE,
|
|
|
|
VKD3DSIH_ULT,
|
|
|
|
VKD3DSIH_UMAX,
|
|
|
|
VKD3DSIH_UMIN,
|
|
|
|
VKD3DSIH_UMUL,
|
2024-03-04 06:38:46 -08:00
|
|
|
VKD3DSIH_UNO,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_USHR,
|
2021-08-11 19:55:16 -07:00
|
|
|
VKD3DSIH_UTOD,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_UTOF,
|
2023-10-31 22:31:24 -07:00
|
|
|
VKD3DSIH_UTOU,
|
2024-04-17 18:18:29 -07:00
|
|
|
VKD3DSIH_WAVE_ACTIVE_ALL_EQUAL,
|
2024-04-23 03:57:43 -07:00
|
|
|
VKD3DSIH_WAVE_ACTIVE_BALLOT,
|
2024-04-23 04:10:24 -07:00
|
|
|
VKD3DSIH_WAVE_ACTIVE_BIT_AND,
|
|
|
|
VKD3DSIH_WAVE_ACTIVE_BIT_OR,
|
|
|
|
VKD3DSIH_WAVE_ACTIVE_BIT_XOR,
|
2024-04-23 04:40:12 -07:00
|
|
|
VKD3DSIH_WAVE_ALL_BIT_COUNT,
|
2024-04-17 18:32:52 -07:00
|
|
|
VKD3DSIH_WAVE_ALL_TRUE,
|
2024-04-17 18:32:52 -07:00
|
|
|
VKD3DSIH_WAVE_ANY_TRUE,
|
2024-04-23 04:53:53 -07:00
|
|
|
VKD3DSIH_WAVE_IS_FIRST_LANE,
|
2024-04-23 04:28:21 -07:00
|
|
|
VKD3DSIH_WAVE_OP_ADD,
|
|
|
|
VKD3DSIH_WAVE_OP_IMAX,
|
|
|
|
VKD3DSIH_WAVE_OP_IMIN,
|
|
|
|
VKD3DSIH_WAVE_OP_MAX,
|
|
|
|
VKD3DSIH_WAVE_OP_MIN,
|
|
|
|
VKD3DSIH_WAVE_OP_MUL,
|
|
|
|
VKD3DSIH_WAVE_OP_UMAX,
|
|
|
|
VKD3DSIH_WAVE_OP_UMIN,
|
2024-04-23 05:01:37 -07:00
|
|
|
VKD3DSIH_WAVE_PREFIX_BIT_COUNT,
|
2024-05-08 19:24:02 -07:00
|
|
|
VKD3DSIH_WAVE_READ_LANE_AT,
|
2024-04-23 06:33:56 -07:00
|
|
|
VKD3DSIH_WAVE_READ_LANE_FIRST,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIH_XOR,
|
2019-02-20 04:42:48 -08:00
|
|
|
|
|
|
|
VKD3DSIH_INVALID,
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum vkd3d_shader_register_type
|
|
|
|
{
|
|
|
|
VKD3DSPR_TEMP = 0,
|
|
|
|
VKD3DSPR_INPUT = 1,
|
|
|
|
VKD3DSPR_CONST = 2,
|
|
|
|
VKD3DSPR_ADDR = 3,
|
|
|
|
VKD3DSPR_TEXTURE = 3,
|
|
|
|
VKD3DSPR_RASTOUT = 4,
|
|
|
|
VKD3DSPR_ATTROUT = 5,
|
|
|
|
VKD3DSPR_TEXCRDOUT = 6,
|
|
|
|
VKD3DSPR_OUTPUT = 6,
|
|
|
|
VKD3DSPR_CONSTINT = 7,
|
|
|
|
VKD3DSPR_COLOROUT = 8,
|
|
|
|
VKD3DSPR_DEPTHOUT = 9,
|
2023-03-07 14:45:18 -08:00
|
|
|
VKD3DSPR_COMBINED_SAMPLER = 10,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSPR_CONST2 = 11,
|
|
|
|
VKD3DSPR_CONST3 = 12,
|
|
|
|
VKD3DSPR_CONST4 = 13,
|
|
|
|
VKD3DSPR_CONSTBOOL = 14,
|
|
|
|
VKD3DSPR_LOOP = 15,
|
|
|
|
VKD3DSPR_TEMPFLOAT16 = 16,
|
|
|
|
VKD3DSPR_MISCTYPE = 17,
|
|
|
|
VKD3DSPR_LABEL = 18,
|
|
|
|
VKD3DSPR_PREDICATE = 19,
|
|
|
|
VKD3DSPR_IMMCONST,
|
2021-07-30 06:27:20 -07:00
|
|
|
VKD3DSPR_IMMCONST64,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSPR_CONSTBUFFER,
|
|
|
|
VKD3DSPR_IMMCONSTBUFFER,
|
|
|
|
VKD3DSPR_PRIMID,
|
|
|
|
VKD3DSPR_NULL,
|
2023-03-07 14:45:18 -08:00
|
|
|
VKD3DSPR_SAMPLER,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSPR_RESOURCE,
|
|
|
|
VKD3DSPR_UAV,
|
|
|
|
VKD3DSPR_OUTPOINTID,
|
|
|
|
VKD3DSPR_FORKINSTID,
|
|
|
|
VKD3DSPR_JOININSTID,
|
|
|
|
VKD3DSPR_INCONTROLPOINT,
|
|
|
|
VKD3DSPR_OUTCONTROLPOINT,
|
|
|
|
VKD3DSPR_PATCHCONST,
|
|
|
|
VKD3DSPR_TESSCOORD,
|
|
|
|
VKD3DSPR_GROUPSHAREDMEM,
|
|
|
|
VKD3DSPR_THREADID,
|
|
|
|
VKD3DSPR_THREADGROUPID,
|
|
|
|
VKD3DSPR_LOCALTHREADID,
|
|
|
|
VKD3DSPR_LOCALTHREADINDEX,
|
|
|
|
VKD3DSPR_IDXTEMP,
|
|
|
|
VKD3DSPR_STREAM,
|
|
|
|
VKD3DSPR_FUNCTIONBODY,
|
|
|
|
VKD3DSPR_FUNCTIONPOINTER,
|
|
|
|
VKD3DSPR_COVERAGE,
|
|
|
|
VKD3DSPR_SAMPLEMASK,
|
|
|
|
VKD3DSPR_GSINSTID,
|
2018-05-29 03:50:31 -07:00
|
|
|
VKD3DSPR_DEPTHOUTGE,
|
|
|
|
VKD3DSPR_DEPTHOUTLE,
|
|
|
|
VKD3DSPR_RASTERIZER,
|
2021-10-18 09:28:12 -07:00
|
|
|
VKD3DSPR_OUTSTENCILREF,
|
2023-05-22 06:40:39 -07:00
|
|
|
VKD3DSPR_UNDEF,
|
2023-05-17 22:51:53 -07:00
|
|
|
VKD3DSPR_SSA,
|
2024-04-17 17:35:07 -07:00
|
|
|
VKD3DSPR_WAVELANECOUNT,
|
|
|
|
VKD3DSPR_WAVELANEINDEX,
|
2024-06-10 17:25:18 -07:00
|
|
|
VKD3DSPR_PARAMETER,
|
2024-10-15 17:04:19 -07:00
|
|
|
VKD3DSPR_POINT_COORD,
|
2018-04-13 03:37:37 -07:00
|
|
|
|
2023-07-19 09:19:02 -07:00
|
|
|
VKD3DSPR_COUNT,
|
|
|
|
|
2018-04-13 03:37:37 -07:00
|
|
|
VKD3DSPR_INVALID = ~0u,
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
2024-10-03 11:10:10 -07:00
|
|
|
enum vsir_rastout_register
|
|
|
|
{
|
|
|
|
VSIR_RASTOUT_POSITION = 0x0,
|
|
|
|
VSIR_RASTOUT_FOG = 0x1,
|
|
|
|
VSIR_RASTOUT_POINT_SIZE = 0x2,
|
|
|
|
};
|
|
|
|
|
2021-09-28 07:07:22 -07:00
|
|
|
enum vkd3d_shader_register_precision
|
|
|
|
{
|
|
|
|
VKD3D_SHADER_REGISTER_PRECISION_DEFAULT,
|
|
|
|
VKD3D_SHADER_REGISTER_PRECISION_MIN_FLOAT_16,
|
|
|
|
VKD3D_SHADER_REGISTER_PRECISION_MIN_FLOAT_10,
|
|
|
|
VKD3D_SHADER_REGISTER_PRECISION_MIN_INT_16,
|
|
|
|
VKD3D_SHADER_REGISTER_PRECISION_MIN_UINT_16,
|
|
|
|
|
2023-10-24 17:37:40 -07:00
|
|
|
VKD3D_SHADER_REGISTER_PRECISION_COUNT,
|
|
|
|
|
2021-09-28 07:07:22 -07:00
|
|
|
VKD3D_SHADER_REGISTER_PRECISION_INVALID = ~0u,
|
|
|
|
};
|
|
|
|
|
2017-06-16 13:38:21 -07:00
|
|
|
enum vkd3d_data_type
|
|
|
|
{
|
|
|
|
VKD3D_DATA_FLOAT,
|
|
|
|
VKD3D_DATA_INT,
|
|
|
|
VKD3D_DATA_UINT,
|
|
|
|
VKD3D_DATA_UNORM,
|
|
|
|
VKD3D_DATA_SNORM,
|
|
|
|
VKD3D_DATA_OPAQUE,
|
2020-09-25 17:05:36 -07:00
|
|
|
VKD3D_DATA_MIXED,
|
|
|
|
VKD3D_DATA_DOUBLE,
|
|
|
|
VKD3D_DATA_CONTINUED,
|
|
|
|
VKD3D_DATA_UNUSED,
|
2023-05-14 20:52:00 -07:00
|
|
|
VKD3D_DATA_UINT8,
|
2023-10-02 22:06:29 -07:00
|
|
|
VKD3D_DATA_UINT64,
|
2023-10-15 18:47:11 -07:00
|
|
|
VKD3D_DATA_BOOL,
|
2023-12-12 21:40:48 -08:00
|
|
|
VKD3D_DATA_UINT16,
|
|
|
|
VKD3D_DATA_HALF,
|
2023-10-24 17:41:09 -07:00
|
|
|
|
|
|
|
VKD3D_DATA_COUNT,
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
2023-05-16 07:09:19 -07:00
|
|
|
static inline bool data_type_is_integer(enum vkd3d_data_type data_type)
|
|
|
|
{
|
2023-12-12 21:40:48 -08:00
|
|
|
return data_type == VKD3D_DATA_INT || data_type == VKD3D_DATA_UINT8 || data_type == VKD3D_DATA_UINT16
|
|
|
|
|| data_type == VKD3D_DATA_UINT || data_type == VKD3D_DATA_UINT64;
|
2023-05-16 07:09:19 -07:00
|
|
|
}
|
|
|
|
|
2023-10-04 22:38:09 -07:00
|
|
|
static inline bool data_type_is_bool(enum vkd3d_data_type data_type)
|
|
|
|
{
|
|
|
|
return data_type == VKD3D_DATA_BOOL;
|
|
|
|
}
|
|
|
|
|
2023-12-05 22:49:17 -08:00
|
|
|
static inline bool data_type_is_floating_point(enum vkd3d_data_type data_type)
|
|
|
|
{
|
|
|
|
return data_type == VKD3D_DATA_HALF || data_type == VKD3D_DATA_FLOAT || data_type == VKD3D_DATA_DOUBLE;
|
|
|
|
}
|
|
|
|
|
2023-11-20 22:32:35 -08:00
|
|
|
static inline bool data_type_is_64_bit(enum vkd3d_data_type data_type)
|
|
|
|
{
|
2023-11-20 22:43:36 -08:00
|
|
|
return data_type == VKD3D_DATA_DOUBLE || data_type == VKD3D_DATA_UINT64;
|
2023-11-20 22:32:35 -08:00
|
|
|
}
|
|
|
|
|
2023-08-14 10:21:41 -07:00
|
|
|
enum vsir_dimension
|
2017-06-16 13:38:21 -07:00
|
|
|
{
|
2023-08-14 10:21:41 -07:00
|
|
|
VSIR_DIMENSION_NONE,
|
|
|
|
VSIR_DIMENSION_SCALAR,
|
|
|
|
VSIR_DIMENSION_VEC4,
|
2023-10-24 17:43:31 -07:00
|
|
|
|
|
|
|
VSIR_DIMENSION_COUNT,
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum vkd3d_shader_src_modifier
|
|
|
|
{
|
|
|
|
VKD3DSPSM_NONE = 0,
|
|
|
|
VKD3DSPSM_NEG = 1,
|
|
|
|
VKD3DSPSM_BIAS = 2,
|
|
|
|
VKD3DSPSM_BIASNEG = 3,
|
|
|
|
VKD3DSPSM_SIGN = 4,
|
|
|
|
VKD3DSPSM_SIGNNEG = 5,
|
|
|
|
VKD3DSPSM_COMP = 6,
|
|
|
|
VKD3DSPSM_X2 = 7,
|
|
|
|
VKD3DSPSM_X2NEG = 8,
|
|
|
|
VKD3DSPSM_DZ = 9,
|
|
|
|
VKD3DSPSM_DW = 10,
|
|
|
|
VKD3DSPSM_ABS = 11,
|
|
|
|
VKD3DSPSM_ABSNEG = 12,
|
|
|
|
VKD3DSPSM_NOT = 13,
|
2023-08-29 13:23:02 -07:00
|
|
|
VKD3DSPSM_COUNT,
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define VKD3DSP_WRITEMASK_0 0x1u /* .x r */
|
|
|
|
#define VKD3DSP_WRITEMASK_1 0x2u /* .y g */
|
|
|
|
#define VKD3DSP_WRITEMASK_2 0x4u /* .z b */
|
|
|
|
#define VKD3DSP_WRITEMASK_3 0x8u /* .w a */
|
|
|
|
#define VKD3DSP_WRITEMASK_ALL 0xfu /* all */
|
|
|
|
|
|
|
|
enum vkd3d_shader_dst_modifier
|
|
|
|
{
|
|
|
|
VKD3DSPDM_NONE = 0,
|
|
|
|
VKD3DSPDM_SATURATE = 1,
|
|
|
|
VKD3DSPDM_PARTIALPRECISION = 2,
|
|
|
|
VKD3DSPDM_MSAMPCENTROID = 4,
|
2023-08-29 13:17:28 -07:00
|
|
|
VKD3DSPDM_MASK = 7,
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum vkd3d_shader_interpolation_mode
|
|
|
|
{
|
2019-05-14 04:27:41 -07:00
|
|
|
VKD3DSIM_NONE = 0,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSIM_CONSTANT = 1,
|
|
|
|
VKD3DSIM_LINEAR = 2,
|
|
|
|
VKD3DSIM_LINEAR_CENTROID = 3,
|
|
|
|
VKD3DSIM_LINEAR_NOPERSPECTIVE = 4,
|
|
|
|
VKD3DSIM_LINEAR_NOPERSPECTIVE_CENTROID = 5,
|
|
|
|
VKD3DSIM_LINEAR_SAMPLE = 6,
|
|
|
|
VKD3DSIM_LINEAR_NOPERSPECTIVE_SAMPLE = 7,
|
2023-09-27 23:33:11 -07:00
|
|
|
|
|
|
|
VKD3DSIM_COUNT = 8,
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
2024-10-18 13:38:45 -07:00
|
|
|
enum vsir_global_flags
|
2017-06-16 13:38:21 -07:00
|
|
|
{
|
2018-10-11 06:33:33 -07:00
|
|
|
VKD3DSGF_REFACTORING_ALLOWED = 0x01,
|
2021-07-09 08:31:35 -07:00
|
|
|
VKD3DSGF_ENABLE_DOUBLE_PRECISION_FLOAT_OPS = 0x02,
|
2018-10-11 06:33:33 -07:00
|
|
|
VKD3DSGF_FORCE_EARLY_DEPTH_STENCIL = 0x04,
|
|
|
|
VKD3DSGF_ENABLE_RAW_AND_STRUCTURED_BUFFERS = 0x08,
|
2020-09-15 10:05:11 -07:00
|
|
|
VKD3DSGF_SKIP_OPTIMIZATION = 0x10,
|
2021-07-09 08:31:35 -07:00
|
|
|
VKD3DSGF_ENABLE_MINIMUM_PRECISION = 0x20,
|
|
|
|
VKD3DSGF_ENABLE_11_1_DOUBLE_EXTENSIONS = 0x40,
|
2023-10-02 21:50:09 -07:00
|
|
|
VKD3DSGF_ENABLE_SHADER_EXTENSIONS = 0x80, /* never emitted? */
|
|
|
|
VKD3DSGF_BIND_FOR_DURATION = 0x100,
|
|
|
|
VKD3DSGF_ENABLE_VP_AND_RT_ARRAY_INDEX = 0x200,
|
|
|
|
VKD3DSGF_ENABLE_INNER_COVERAGE = 0x400,
|
|
|
|
VKD3DSGF_ENABLE_STENCIL_REF = 0x800,
|
|
|
|
VKD3DSGF_ENABLE_TILED_RESOURCE_INTRINSICS = 0x1000,
|
|
|
|
VKD3DSGF_ENABLE_RELAXED_TYPED_UAV_FORMATS = 0x2000,
|
|
|
|
VKD3DSGF_ENABLE_LVL_9_COMPARISON_FILTERING = 0x4000,
|
|
|
|
VKD3DSGF_ENABLE_UP_TO_64_UAVS = 0x8000,
|
|
|
|
VKD3DSGF_ENABLE_UAVS_AT_EVERY_STAGE = 0x10000,
|
|
|
|
VKD3DSGF_ENABLE_CS4_RAW_STRUCTURED_BUFFERS = 0x20000,
|
|
|
|
VKD3DSGF_ENABLE_RASTERIZER_ORDERED_VIEWS = 0x40000,
|
|
|
|
VKD3DSGF_ENABLE_WAVE_INTRINSICS = 0x80000,
|
|
|
|
VKD3DSGF_ENABLE_INT64 = 0x100000,
|
|
|
|
VKD3DSGF_ENABLE_VIEWID = 0x200000,
|
|
|
|
VKD3DSGF_ENABLE_BARYCENTRICS = 0x400000,
|
|
|
|
VKD3DSGF_FORCE_NATIVE_LOW_PRECISION = 0x800000,
|
|
|
|
VKD3DSGF_ENABLE_SHADINGRATE = 0x1000000,
|
|
|
|
VKD3DSGF_ENABLE_RAYTRACING_TIER_1_1 = 0x2000000,
|
|
|
|
VKD3DSGF_ENABLE_SAMPLER_FEEDBACK = 0x4000000,
|
|
|
|
VKD3DSGF_ENABLE_ATOMIC_INT64_ON_TYPED_RESOURCE = 0x8000000,
|
|
|
|
VKD3DSGF_ENABLE_ATOMIC_INT64_ON_GROUP_SHARED = 0x10000000,
|
|
|
|
VKD3DSGF_ENABLE_DERIVATIVES_IN_MESH_AND_AMPLIFICATION_SHADERS = 0x20000000,
|
|
|
|
VKD3DSGF_ENABLE_RESOURCE_DESCRIPTOR_HEAP_INDEXING = 0x40000000,
|
|
|
|
VKD3DSGF_ENABLE_SAMPLER_DESCRIPTOR_HEAP_INDEXING = 0x80000000,
|
|
|
|
VKD3DSGF_ENABLE_ATOMIC_INT64_ON_DESCRIPTOR_HEAP_RESOURCE = 0x100000000ull,
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum vkd3d_shader_sync_flags
|
|
|
|
{
|
|
|
|
VKD3DSSF_THREAD_GROUP = 0x1,
|
|
|
|
VKD3DSSF_GROUP_SHARED_MEMORY = 0x2,
|
2023-08-15 20:46:10 -07:00
|
|
|
VKD3DSSF_THREAD_GROUP_UAV = 0x4,
|
2021-02-03 19:09:17 -08:00
|
|
|
VKD3DSSF_GLOBAL_UAV = 0x8,
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum vkd3d_shader_uav_flags
|
|
|
|
{
|
2023-08-27 21:17:17 -07:00
|
|
|
VKD3DSUF_GLOBALLY_COHERENT = 0x002,
|
|
|
|
VKD3DSUF_RASTERISER_ORDERED_VIEW = 0x004,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3DSUF_ORDER_PRESERVING_COUNTER = 0x100,
|
|
|
|
};
|
|
|
|
|
2024-02-29 22:03:47 -08:00
|
|
|
enum vkd3d_shader_atomic_rmw_flags
|
|
|
|
{
|
|
|
|
VKD3DARF_SEQ_CST = 0x1,
|
|
|
|
VKD3DARF_VOLATILE = 0x2,
|
|
|
|
};
|
|
|
|
|
2017-06-16 13:38:21 -07:00
|
|
|
enum vkd3d_tessellator_domain
|
|
|
|
{
|
2023-12-05 22:39:51 -08:00
|
|
|
VKD3D_TESSELLATOR_DOMAIN_INVALID = 0,
|
|
|
|
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3D_TESSELLATOR_DOMAIN_LINE = 1,
|
|
|
|
VKD3D_TESSELLATOR_DOMAIN_TRIANGLE = 2,
|
|
|
|
VKD3D_TESSELLATOR_DOMAIN_QUAD = 3,
|
2023-12-05 22:39:51 -08:00
|
|
|
|
|
|
|
VKD3D_TESSELLATOR_DOMAIN_COUNT = 4,
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
2018-06-05 04:52:57 -07:00
|
|
|
#define VKD3DSI_NONE 0x0
|
|
|
|
#define VKD3DSI_TEXLD_PROJECT 0x1
|
2024-05-21 12:38:44 -07:00
|
|
|
#define VKD3DSI_TEXLD_BIAS 0x2
|
2018-06-05 04:52:57 -07:00
|
|
|
#define VKD3DSI_INDEXED_DYNAMIC 0x4
|
|
|
|
#define VKD3DSI_RESINFO_RCP_FLOAT 0x1
|
|
|
|
#define VKD3DSI_RESINFO_UINT 0x2
|
|
|
|
#define VKD3DSI_SAMPLE_INFO_UINT 0x1
|
2017-06-16 13:38:21 -07:00
|
|
|
#define VKD3DSI_SAMPLER_COMPARISON_MODE 0x1
|
2023-11-22 05:58:44 -08:00
|
|
|
#define VKD3DSI_SHIFT_UNMASKED 0x1
|
2024-04-23 04:28:21 -07:00
|
|
|
#define VKD3DSI_WAVE_PREFIX 0x1
|
2017-06-16 13:38:21 -07:00
|
|
|
|
2018-05-29 03:50:30 -07:00
|
|
|
#define VKD3DSI_PRECISE_X 0x100
|
|
|
|
#define VKD3DSI_PRECISE_Y 0x200
|
|
|
|
#define VKD3DSI_PRECISE_Z 0x400
|
|
|
|
#define VKD3DSI_PRECISE_W 0x800
|
|
|
|
#define VKD3DSI_PRECISE_XYZW (VKD3DSI_PRECISE_X | VKD3DSI_PRECISE_Y \
|
|
|
|
| VKD3DSI_PRECISE_Z | VKD3DSI_PRECISE_W)
|
|
|
|
#define VKD3DSI_PRECISE_SHIFT 8
|
|
|
|
|
2017-06-16 13:38:21 -07:00
|
|
|
enum vkd3d_shader_rel_op
|
|
|
|
{
|
|
|
|
VKD3D_SHADER_REL_OP_GT = 1,
|
|
|
|
VKD3D_SHADER_REL_OP_EQ = 2,
|
|
|
|
VKD3D_SHADER_REL_OP_GE = 3,
|
|
|
|
VKD3D_SHADER_REL_OP_LT = 4,
|
|
|
|
VKD3D_SHADER_REL_OP_NE = 5,
|
|
|
|
VKD3D_SHADER_REL_OP_LE = 6,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum vkd3d_shader_conditional_op
|
|
|
|
{
|
|
|
|
VKD3D_SHADER_CONDITIONAL_OP_NZ = 0,
|
|
|
|
VKD3D_SHADER_CONDITIONAL_OP_Z = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MAX_REG_OUTPUT 32
|
|
|
|
|
|
|
|
enum vkd3d_shader_type
|
|
|
|
{
|
|
|
|
VKD3D_SHADER_TYPE_PIXEL,
|
|
|
|
VKD3D_SHADER_TYPE_VERTEX,
|
|
|
|
VKD3D_SHADER_TYPE_GEOMETRY,
|
|
|
|
VKD3D_SHADER_TYPE_HULL,
|
|
|
|
VKD3D_SHADER_TYPE_DOMAIN,
|
|
|
|
VKD3D_SHADER_TYPE_GRAPHICS_COUNT,
|
|
|
|
|
|
|
|
VKD3D_SHADER_TYPE_COMPUTE = VKD3D_SHADER_TYPE_GRAPHICS_COUNT,
|
2021-01-27 08:29:44 -08:00
|
|
|
|
|
|
|
VKD3D_SHADER_TYPE_EFFECT,
|
|
|
|
VKD3D_SHADER_TYPE_TEXTURE,
|
|
|
|
VKD3D_SHADER_TYPE_LIBRARY,
|
2017-06-16 13:38:21 -07:00
|
|
|
VKD3D_SHADER_TYPE_COUNT,
|
|
|
|
};
|
|
|
|
|
2024-03-13 06:37:45 -07:00
|
|
|
struct vkd3d_shader_message_context;
|
|
|
|
|
2017-06-16 13:38:21 -07:00
|
|
|
struct vkd3d_shader_version
|
|
|
|
{
|
|
|
|
enum vkd3d_shader_type type;
|
2018-12-11 06:48:05 -08:00
|
|
|
uint8_t major;
|
|
|
|
uint8_t minor;
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_immediate_constant_buffer
|
|
|
|
{
|
2023-11-14 22:27:41 -08:00
|
|
|
unsigned int register_idx;
|
2023-09-28 17:17:51 -07:00
|
|
|
enum vkd3d_data_type data_type;
|
|
|
|
/* total count is element_count * component_count */
|
|
|
|
unsigned int element_count;
|
|
|
|
unsigned int component_count;
|
2023-11-13 22:17:47 -08:00
|
|
|
bool is_null;
|
2023-01-19 17:35:38 -08:00
|
|
|
uint32_t data[];
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_indexable_temp
|
|
|
|
{
|
|
|
|
unsigned int register_idx;
|
|
|
|
unsigned int register_size;
|
2023-11-12 22:09:58 -08:00
|
|
|
unsigned int alignment;
|
|
|
|
enum vkd3d_data_type data_type;
|
2017-06-16 13:38:21 -07:00
|
|
|
unsigned int component_count;
|
2024-01-11 18:47:19 -08:00
|
|
|
bool has_function_scope;
|
2023-11-13 06:50:30 -08:00
|
|
|
const struct vkd3d_shader_immediate_constant_buffer *initialiser;
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_register_index
|
|
|
|
{
|
2024-01-17 07:10:17 -08:00
|
|
|
struct vkd3d_shader_src_param *rel_addr;
|
2017-06-16 13:38:21 -07:00
|
|
|
unsigned int offset;
|
2023-11-12 22:52:45 -08:00
|
|
|
/* address is known to fall within the object (for optimisation) */
|
|
|
|
bool is_in_bounds;
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_register
|
|
|
|
{
|
|
|
|
enum vkd3d_shader_register_type type;
|
2021-09-28 07:07:22 -07:00
|
|
|
enum vkd3d_shader_register_precision precision;
|
2021-09-28 07:07:23 -07:00
|
|
|
bool non_uniform;
|
2017-06-16 13:38:21 -07:00
|
|
|
enum vkd3d_data_type data_type;
|
2019-04-29 02:38:15 -07:00
|
|
|
struct vkd3d_shader_register_index idx[3];
|
2023-05-03 00:10:37 -07:00
|
|
|
unsigned int idx_count;
|
2023-08-14 10:21:41 -07:00
|
|
|
enum vsir_dimension dimension;
|
2023-11-21 18:42:23 -08:00
|
|
|
/* known address alignment for optimisation, or zero */
|
|
|
|
unsigned int alignment;
|
2017-06-16 13:38:21 -07:00
|
|
|
union
|
|
|
|
{
|
2023-12-05 14:24:36 -08:00
|
|
|
uint32_t immconst_u32[VKD3D_VEC4_SIZE];
|
2023-12-05 14:29:04 -08:00
|
|
|
float immconst_f32[VKD3D_VEC4_SIZE];
|
2023-12-05 14:31:18 -08:00
|
|
|
uint64_t immconst_u64[VKD3D_DVEC2_SIZE];
|
2023-12-05 14:33:16 -08:00
|
|
|
double immconst_f64[VKD3D_DVEC2_SIZE];
|
2017-06-16 13:38:21 -07:00
|
|
|
unsigned fp_body_idx;
|
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
2023-08-29 10:20:44 -07:00
|
|
|
void vsir_register_init(struct vkd3d_shader_register *reg, enum vkd3d_shader_register_type reg_type,
|
2023-05-16 07:09:19 -07:00
|
|
|
enum vkd3d_data_type data_type, unsigned int idx_count);
|
|
|
|
|
2023-11-11 09:48:12 -08:00
|
|
|
static inline bool vsir_register_is_descriptor(const struct vkd3d_shader_register *reg)
|
|
|
|
{
|
|
|
|
switch (reg->type)
|
|
|
|
{
|
|
|
|
case VKD3DSPR_SAMPLER:
|
|
|
|
case VKD3DSPR_RESOURCE:
|
|
|
|
case VKD3DSPR_CONSTBUFFER:
|
|
|
|
case VKD3DSPR_UAV:
|
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-16 13:38:21 -07:00
|
|
|
struct vkd3d_shader_dst_param
|
|
|
|
{
|
|
|
|
struct vkd3d_shader_register reg;
|
2023-09-28 23:51:52 -07:00
|
|
|
uint32_t write_mask;
|
2023-12-05 15:16:06 -08:00
|
|
|
uint32_t modifiers;
|
2023-12-05 15:22:37 -08:00
|
|
|
unsigned int shift;
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_src_param
|
|
|
|
{
|
|
|
|
struct vkd3d_shader_register reg;
|
2023-12-05 15:08:25 -08:00
|
|
|
uint32_t swizzle;
|
2017-06-16 13:38:21 -07:00
|
|
|
enum vkd3d_shader_src_modifier modifiers;
|
|
|
|
};
|
|
|
|
|
2023-11-23 19:14:44 -08:00
|
|
|
void vsir_src_param_init(struct vkd3d_shader_src_param *param, enum vkd3d_shader_register_type reg_type,
|
|
|
|
enum vkd3d_data_type data_type, unsigned int idx_count);
|
2024-01-03 07:18:50 -08:00
|
|
|
void vsir_dst_param_init(struct vkd3d_shader_dst_param *param, enum vkd3d_shader_register_type reg_type,
|
|
|
|
enum vkd3d_data_type data_type, unsigned int idx_count);
|
2024-01-11 19:20:32 -08:00
|
|
|
void vsir_src_param_init_label(struct vkd3d_shader_src_param *param, unsigned int label_id);
|
|
|
|
|
2017-06-16 13:38:21 -07:00
|
|
|
struct vkd3d_shader_index_range
|
|
|
|
{
|
2019-02-20 04:42:53 -08:00
|
|
|
struct vkd3d_shader_dst_param dst;
|
|
|
|
unsigned int register_count;
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
2021-06-23 21:03:46 -07:00
|
|
|
struct vkd3d_shader_register_range
|
|
|
|
{
|
|
|
|
unsigned int space;
|
|
|
|
unsigned int first, last;
|
|
|
|
};
|
|
|
|
|
2020-06-30 03:32:03 -07:00
|
|
|
struct vkd3d_shader_resource
|
|
|
|
{
|
|
|
|
struct vkd3d_shader_dst_param reg;
|
2021-06-23 21:03:46 -07:00
|
|
|
struct vkd3d_shader_register_range range;
|
2020-06-30 03:32:03 -07:00
|
|
|
};
|
|
|
|
|
2017-06-16 13:38:21 -07:00
|
|
|
enum vkd3d_decl_usage
|
|
|
|
{
|
|
|
|
VKD3D_DECL_USAGE_POSITION = 0,
|
|
|
|
VKD3D_DECL_USAGE_BLEND_WEIGHT = 1,
|
|
|
|
VKD3D_DECL_USAGE_BLEND_INDICES = 2,
|
|
|
|
VKD3D_DECL_USAGE_NORMAL = 3,
|
|
|
|
VKD3D_DECL_USAGE_PSIZE = 4,
|
|
|
|
VKD3D_DECL_USAGE_TEXCOORD = 5,
|
|
|
|
VKD3D_DECL_USAGE_TANGENT = 6,
|
|
|
|
VKD3D_DECL_USAGE_BINORMAL = 7,
|
|
|
|
VKD3D_DECL_USAGE_TESS_FACTOR = 8,
|
|
|
|
VKD3D_DECL_USAGE_POSITIONT = 9,
|
|
|
|
VKD3D_DECL_USAGE_COLOR = 10,
|
|
|
|
VKD3D_DECL_USAGE_FOG = 11,
|
|
|
|
VKD3D_DECL_USAGE_DEPTH = 12,
|
|
|
|
VKD3D_DECL_USAGE_SAMPLE = 13
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_semantic
|
|
|
|
{
|
|
|
|
enum vkd3d_decl_usage usage;
|
2018-02-15 06:43:53 -08:00
|
|
|
unsigned int usage_idx;
|
2017-06-16 13:38:21 -07:00
|
|
|
enum vkd3d_shader_resource_type resource_type;
|
2023-03-04 00:58:46 -08:00
|
|
|
unsigned int sample_count;
|
2020-09-25 17:05:37 -07:00
|
|
|
enum vkd3d_data_type resource_data_type[VKD3D_VEC4_SIZE];
|
2020-06-30 03:32:03 -07:00
|
|
|
struct vkd3d_shader_resource resource;
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
enum vkd3d_shader_input_sysval_semantic
|
|
|
|
{
|
|
|
|
VKD3D_SIV_NONE = 0,
|
|
|
|
VKD3D_SIV_POSITION = 1,
|
|
|
|
VKD3D_SIV_CLIP_DISTANCE = 2,
|
|
|
|
VKD3D_SIV_CULL_DISTANCE = 3,
|
|
|
|
VKD3D_SIV_RENDER_TARGET_ARRAY_INDEX = 4,
|
|
|
|
VKD3D_SIV_VIEWPORT_ARRAY_INDEX = 5,
|
|
|
|
VKD3D_SIV_VERTEX_ID = 6,
|
|
|
|
VKD3D_SIV_PRIMITIVE_ID = 7,
|
|
|
|
VKD3D_SIV_INSTANCE_ID = 8,
|
|
|
|
VKD3D_SIV_IS_FRONT_FACE = 9,
|
|
|
|
VKD3D_SIV_SAMPLE_INDEX = 10,
|
|
|
|
VKD3D_SIV_QUAD_U0_TESS_FACTOR = 11,
|
|
|
|
VKD3D_SIV_QUAD_V0_TESS_FACTOR = 12,
|
|
|
|
VKD3D_SIV_QUAD_U1_TESS_FACTOR = 13,
|
|
|
|
VKD3D_SIV_QUAD_V1_TESS_FACTOR = 14,
|
|
|
|
VKD3D_SIV_QUAD_U_INNER_TESS_FACTOR = 15,
|
|
|
|
VKD3D_SIV_QUAD_V_INNER_TESS_FACTOR = 16,
|
|
|
|
VKD3D_SIV_TRIANGLE_U_TESS_FACTOR = 17,
|
|
|
|
VKD3D_SIV_TRIANGLE_V_TESS_FACTOR = 18,
|
|
|
|
VKD3D_SIV_TRIANGLE_W_TESS_FACTOR = 19,
|
|
|
|
VKD3D_SIV_TRIANGLE_INNER_TESS_FACTOR = 20,
|
|
|
|
VKD3D_SIV_LINE_DETAIL_TESS_FACTOR = 21,
|
|
|
|
VKD3D_SIV_LINE_DENSITY_TESS_FACTOR = 22,
|
|
|
|
};
|
|
|
|
|
2023-10-27 10:44:08 -07:00
|
|
|
#define SM1_COLOR_REGISTER_OFFSET 8
|
2023-10-27 10:44:38 -07:00
|
|
|
#define SM1_RASTOUT_REGISTER_OFFSET 10
|
2023-10-27 10:44:08 -07:00
|
|
|
|
2023-07-31 10:46:55 -07:00
|
|
|
#define SIGNATURE_TARGET_LOCATION_UNUSED (~0u)
|
|
|
|
|
2023-04-03 23:22:57 -07:00
|
|
|
struct signature_element
|
|
|
|
{
|
2024-10-08 07:26:53 -07:00
|
|
|
/* sort_index is not a property of the signature element, it is just a
|
|
|
|
* convenience field used to retain the original order in a signature and
|
|
|
|
* recover it after having permuted the signature itself. */
|
2023-04-25 22:27:08 -07:00
|
|
|
unsigned int sort_index;
|
2023-04-03 23:22:57 -07:00
|
|
|
const char *semantic_name;
|
|
|
|
unsigned int semantic_index;
|
|
|
|
unsigned int stream_index;
|
|
|
|
enum vkd3d_shader_sysval_semantic sysval_semantic;
|
|
|
|
enum vkd3d_shader_component_type component_type;
|
2023-07-31 10:40:07 -07:00
|
|
|
/* Register index in the source shader. */
|
2023-04-03 23:22:57 -07:00
|
|
|
unsigned int register_index;
|
|
|
|
unsigned int register_count;
|
|
|
|
unsigned int mask;
|
|
|
|
unsigned int used_mask;
|
|
|
|
enum vkd3d_shader_minimum_precision min_precision;
|
2023-09-27 23:33:11 -07:00
|
|
|
enum vkd3d_shader_interpolation_mode interpolation_mode;
|
2023-07-31 10:46:55 -07:00
|
|
|
/* Register index / location in the target shader.
|
|
|
|
* If SIGNATURE_TARGET_LOCATION_UNUSED, this element should not be written. */
|
2023-07-31 10:40:07 -07:00
|
|
|
unsigned int target_location;
|
2023-04-03 23:22:57 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct shader_signature
|
|
|
|
{
|
|
|
|
struct signature_element *elements;
|
2023-02-24 11:12:30 -08:00
|
|
|
size_t elements_capacity;
|
2023-04-03 23:22:57 -07:00
|
|
|
unsigned int element_count;
|
|
|
|
};
|
|
|
|
|
2023-10-19 19:29:30 -07:00
|
|
|
static inline bool vsir_sysval_semantic_is_tess_factor(enum vkd3d_shader_sysval_semantic sysval_semantic)
|
|
|
|
{
|
|
|
|
return sysval_semantic >= VKD3D_SHADER_SV_TESS_FACTOR_QUADEDGE
|
|
|
|
&& sysval_semantic <= VKD3D_SHADER_SV_TESS_FACTOR_LINEDEN;
|
|
|
|
}
|
|
|
|
|
2023-12-05 21:07:18 -08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2023-10-19 19:34:41 -07:00
|
|
|
struct signature_element *vsir_signature_find_element_for_reg(const struct shader_signature *signature,
|
|
|
|
unsigned int reg_idx, unsigned int write_mask);
|
2023-04-03 23:22:57 -07:00
|
|
|
void shader_signature_cleanup(struct shader_signature *signature);
|
|
|
|
|
2024-03-01 04:52:37 -08:00
|
|
|
struct dxbc_shader_desc
|
|
|
|
{
|
|
|
|
const uint32_t *byte_code;
|
|
|
|
size_t byte_code_size;
|
|
|
|
bool is_dxil;
|
|
|
|
struct shader_signature input_signature;
|
|
|
|
struct shader_signature output_signature;
|
|
|
|
struct shader_signature patch_constant_signature;
|
|
|
|
};
|
|
|
|
|
2017-06-16 13:38:21 -07:00
|
|
|
struct vkd3d_shader_register_semantic
|
|
|
|
{
|
|
|
|
struct vkd3d_shader_dst_param reg;
|
|
|
|
enum vkd3d_shader_input_sysval_semantic sysval_semantic;
|
|
|
|
};
|
|
|
|
|
2019-04-29 02:38:15 -07:00
|
|
|
struct vkd3d_shader_sampler
|
|
|
|
{
|
|
|
|
struct vkd3d_shader_src_param src;
|
2021-06-23 21:03:47 -07:00
|
|
|
struct vkd3d_shader_register_range range;
|
2019-04-29 02:38:15 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_constant_buffer
|
|
|
|
{
|
|
|
|
struct vkd3d_shader_src_param src;
|
|
|
|
unsigned int size;
|
2021-06-23 21:03:48 -07:00
|
|
|
struct vkd3d_shader_register_range range;
|
2019-04-29 02:38:15 -07:00
|
|
|
};
|
|
|
|
|
2017-06-16 13:38:21 -07:00
|
|
|
struct vkd3d_shader_structured_resource
|
|
|
|
{
|
2020-06-30 03:32:03 -07:00
|
|
|
struct vkd3d_shader_resource resource;
|
2017-06-16 13:38:21 -07:00
|
|
|
unsigned int byte_stride;
|
2019-04-29 02:38:15 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_raw_resource
|
|
|
|
{
|
2020-06-30 03:32:03 -07:00
|
|
|
struct vkd3d_shader_resource resource;
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_tgsm
|
|
|
|
{
|
|
|
|
unsigned int size;
|
|
|
|
unsigned int stride;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_tgsm_raw
|
|
|
|
{
|
|
|
|
struct vkd3d_shader_dst_param reg;
|
2024-02-29 21:55:38 -08:00
|
|
|
unsigned int alignment;
|
2017-06-16 13:38:21 -07:00
|
|
|
unsigned int byte_count;
|
2023-11-30 18:54:08 -08:00
|
|
|
bool zero_init;
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_tgsm_structured
|
|
|
|
{
|
|
|
|
struct vkd3d_shader_dst_param reg;
|
2024-02-29 21:56:31 -08:00
|
|
|
unsigned int alignment;
|
2017-06-16 13:38:21 -07:00
|
|
|
unsigned int byte_stride;
|
|
|
|
unsigned int structure_count;
|
2023-11-30 18:54:08 -08:00
|
|
|
bool zero_init;
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
2024-10-05 14:27:56 -07:00
|
|
|
struct vsir_thread_group_size
|
2017-06-16 13:38:21 -07:00
|
|
|
{
|
|
|
|
unsigned int x, y, z;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_function_table_pointer
|
|
|
|
{
|
|
|
|
unsigned int index;
|
|
|
|
unsigned int array_size;
|
|
|
|
unsigned int body_count;
|
|
|
|
unsigned int table_count;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_texel_offset
|
|
|
|
{
|
|
|
|
signed char u, v, w;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum vkd3d_primitive_type
|
|
|
|
{
|
|
|
|
VKD3D_PT_UNDEFINED = 0,
|
|
|
|
VKD3D_PT_POINTLIST = 1,
|
|
|
|
VKD3D_PT_LINELIST = 2,
|
|
|
|
VKD3D_PT_LINESTRIP = 3,
|
|
|
|
VKD3D_PT_TRIANGLELIST = 4,
|
|
|
|
VKD3D_PT_TRIANGLESTRIP = 5,
|
|
|
|
VKD3D_PT_TRIANGLEFAN = 6,
|
|
|
|
VKD3D_PT_LINELIST_ADJ = 10,
|
|
|
|
VKD3D_PT_LINESTRIP_ADJ = 11,
|
|
|
|
VKD3D_PT_TRIANGLELIST_ADJ = 12,
|
|
|
|
VKD3D_PT_TRIANGLESTRIP_ADJ = 13,
|
|
|
|
VKD3D_PT_PATCH = 14,
|
2024-04-18 19:43:24 -07:00
|
|
|
|
|
|
|
VKD3D_PT_COUNT = 15,
|
2017-06-16 13:38:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_primitive_type
|
|
|
|
{
|
|
|
|
enum vkd3d_primitive_type type;
|
|
|
|
unsigned int patch_vertex_count;
|
|
|
|
};
|
|
|
|
|
2023-09-05 02:31:31 -07:00
|
|
|
struct vkd3d_shader_location
|
|
|
|
{
|
|
|
|
const char *source_name;
|
|
|
|
unsigned int line, column;
|
|
|
|
};
|
|
|
|
|
2017-06-16 13:38:21 -07:00
|
|
|
struct vkd3d_shader_instruction
|
|
|
|
{
|
2023-09-05 02:31:31 -07:00
|
|
|
struct vkd3d_shader_location location;
|
2024-04-24 11:34:42 -07:00
|
|
|
enum vkd3d_shader_opcode opcode;
|
2023-12-05 14:44:05 -08:00
|
|
|
uint32_t flags;
|
2017-06-16 13:38:21 -07:00
|
|
|
unsigned int dst_count;
|
|
|
|
unsigned int src_count;
|
2024-01-11 02:19:39 -08:00
|
|
|
struct vkd3d_shader_dst_param *dst;
|
|
|
|
struct vkd3d_shader_src_param *src;
|
2017-06-16 13:38:21 -07:00
|
|
|
struct vkd3d_shader_texel_offset texel_offset;
|
2020-09-04 15:57:04 -07:00
|
|
|
enum vkd3d_shader_resource_type resource_type;
|
2021-02-19 06:57:11 -08:00
|
|
|
unsigned int resource_stride;
|
2020-09-25 17:05:37 -07:00
|
|
|
enum vkd3d_data_type resource_data_type[VKD3D_VEC4_SIZE];
|
2021-02-19 06:57:12 -08:00
|
|
|
bool coissue, structured, raw;
|
2018-05-29 03:50:32 -07:00
|
|
|
const struct vkd3d_shader_src_param *predicate;
|
2017-06-16 13:38:21 -07:00
|
|
|
union
|
|
|
|
{
|
2024-10-18 13:38:45 -07:00
|
|
|
enum vsir_global_flags global_flags;
|
2017-06-16 13:38:21 -07:00
|
|
|
struct vkd3d_shader_semantic semantic;
|
|
|
|
struct vkd3d_shader_register_semantic register_semantic;
|
|
|
|
struct vkd3d_shader_primitive_type primitive_type;
|
|
|
|
struct vkd3d_shader_dst_param dst;
|
2019-04-29 02:38:15 -07:00
|
|
|
struct vkd3d_shader_constant_buffer cb;
|
|
|
|
struct vkd3d_shader_sampler sampler;
|
2017-06-16 13:38:21 -07:00
|
|
|
unsigned int count;
|
|
|
|
unsigned int index;
|
|
|
|
const struct vkd3d_shader_immediate_constant_buffer *icb;
|
2019-04-29 02:38:15 -07:00
|
|
|
struct vkd3d_shader_raw_resource raw_resource;
|
2017-06-16 13:38:21 -07:00
|
|
|
struct vkd3d_shader_structured_resource structured_resource;
|
|
|
|
struct vkd3d_shader_tgsm_raw tgsm_raw;
|
|
|
|
struct vkd3d_shader_tgsm_structured tgsm_structured;
|
2024-10-05 14:27:56 -07:00
|
|
|
struct vsir_thread_group_size thread_group_size;
|
2017-06-16 13:38:21 -07:00
|
|
|
enum vkd3d_tessellator_domain tessellator_domain;
|
2020-06-23 02:20:13 -07:00
|
|
|
enum vkd3d_shader_tessellator_output_primitive tessellator_output_primitive;
|
2020-06-23 02:20:14 -07:00
|
|
|
enum vkd3d_shader_tessellator_partitioning tessellator_partitioning;
|
2017-06-16 13:38:21 -07:00
|
|
|
float max_tessellation_factor;
|
|
|
|
struct vkd3d_shader_index_range index_range;
|
|
|
|
struct vkd3d_shader_indexable_temp indexable_temp;
|
|
|
|
struct vkd3d_shader_function_table_pointer fp;
|
|
|
|
} declaration;
|
|
|
|
};
|
|
|
|
|
2023-10-30 09:14:26 -07:00
|
|
|
static inline bool vkd3d_shader_ver_ge(const struct vkd3d_shader_version *v, unsigned int major, unsigned int minor)
|
|
|
|
{
|
|
|
|
return v->major > major || (v->major == major && v->minor >= minor);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool vkd3d_shader_ver_le(const struct vkd3d_shader_version *v, unsigned int major, unsigned int minor)
|
|
|
|
{
|
|
|
|
return v->major < major || (v->major == major && v->minor <= minor);
|
|
|
|
}
|
|
|
|
|
2024-04-24 11:34:42 -07:00
|
|
|
void vsir_instruction_init(struct vkd3d_shader_instruction *ins,
|
|
|
|
const struct vkd3d_shader_location *location, enum vkd3d_shader_opcode opcode);
|
2023-05-21 23:21:46 -07:00
|
|
|
|
2018-12-11 06:48:04 -08:00
|
|
|
static inline bool vkd3d_shader_instruction_has_texel_offset(const struct vkd3d_shader_instruction *ins)
|
2017-06-16 13:38:21 -07:00
|
|
|
{
|
|
|
|
return ins->texel_offset.u || ins->texel_offset.v || ins->texel_offset.w;
|
|
|
|
}
|
|
|
|
|
2023-08-07 19:09:10 -07:00
|
|
|
static inline bool register_is_constant(const struct vkd3d_shader_register *reg)
|
|
|
|
{
|
|
|
|
return (reg->type == VKD3DSPR_IMMCONST || reg->type == VKD3DSPR_IMMCONST64);
|
|
|
|
}
|
|
|
|
|
2024-01-24 19:28:46 -08:00
|
|
|
static inline bool register_is_undef(const struct vkd3d_shader_register *reg)
|
|
|
|
{
|
|
|
|
return reg->type == VKD3DSPR_UNDEF;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool register_is_constant_or_undef(const struct vkd3d_shader_register *reg)
|
|
|
|
{
|
|
|
|
return register_is_constant(reg) || register_is_undef(reg);
|
|
|
|
}
|
|
|
|
|
2023-12-04 22:52:46 -08:00
|
|
|
static inline bool register_is_scalar_constant_zero(const struct vkd3d_shader_register *reg)
|
|
|
|
{
|
|
|
|
return register_is_constant(reg) && reg->dimension == VSIR_DIMENSION_SCALAR
|
|
|
|
&& (data_type_is_64_bit(reg->data_type) ? !reg->u.immconst_u64[0] : !reg->u.immconst_u32[0]);
|
|
|
|
}
|
|
|
|
|
2024-02-14 18:08:46 -08:00
|
|
|
static inline bool register_is_numeric_array(const struct vkd3d_shader_register *reg)
|
|
|
|
{
|
|
|
|
return (reg->type == VKD3DSPR_IMMCONSTBUFFER || reg->type == VKD3DSPR_IDXTEMP
|
|
|
|
|| reg->type == VKD3DSPR_GROUPSHAREDMEM);
|
|
|
|
}
|
|
|
|
|
2024-01-04 06:55:51 -08:00
|
|
|
static inline bool vsir_register_is_label(const struct vkd3d_shader_register *reg)
|
|
|
|
{
|
|
|
|
return reg->type == VKD3DSPR_LABEL;
|
|
|
|
}
|
|
|
|
|
2023-11-23 17:23:09 -08:00
|
|
|
static inline bool register_is_ssa(const struct vkd3d_shader_register *reg)
|
|
|
|
{
|
|
|
|
return reg->type == VKD3DSPR_SSA;
|
|
|
|
}
|
|
|
|
|
2023-01-19 17:13:01 -08:00
|
|
|
struct vkd3d_shader_param_node
|
|
|
|
{
|
|
|
|
struct vkd3d_shader_param_node *next;
|
|
|
|
uint8_t param[];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_param_allocator
|
|
|
|
{
|
|
|
|
struct vkd3d_shader_param_node *head;
|
|
|
|
struct vkd3d_shader_param_node *current;
|
|
|
|
unsigned int count;
|
|
|
|
unsigned int stride;
|
|
|
|
unsigned int index;
|
|
|
|
};
|
|
|
|
|
|
|
|
void *shader_param_allocator_get(struct vkd3d_shader_param_allocator *allocator, unsigned int count);
|
|
|
|
|
|
|
|
static inline struct vkd3d_shader_src_param *shader_src_param_allocator_get(
|
|
|
|
struct vkd3d_shader_param_allocator *allocator, unsigned int count)
|
|
|
|
{
|
2024-08-05 07:50:30 -07:00
|
|
|
VKD3D_ASSERT(allocator->stride == sizeof(struct vkd3d_shader_src_param));
|
2023-01-19 17:13:01 -08:00
|
|
|
return shader_param_allocator_get(allocator, count);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct vkd3d_shader_dst_param *shader_dst_param_allocator_get(
|
|
|
|
struct vkd3d_shader_param_allocator *allocator, unsigned int count)
|
|
|
|
{
|
2024-08-05 07:50:30 -07:00
|
|
|
VKD3D_ASSERT(allocator->stride == sizeof(struct vkd3d_shader_dst_param));
|
2023-01-19 17:13:01 -08:00
|
|
|
return shader_param_allocator_get(allocator, count);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct vkd3d_shader_instruction_array
|
|
|
|
{
|
|
|
|
struct vkd3d_shader_instruction *elements;
|
|
|
|
size_t capacity;
|
|
|
|
size_t count;
|
|
|
|
|
|
|
|
struct vkd3d_shader_param_allocator src_params;
|
|
|
|
struct vkd3d_shader_param_allocator dst_params;
|
2023-01-19 17:35:38 -08:00
|
|
|
struct vkd3d_shader_immediate_constant_buffer **icbs;
|
|
|
|
size_t icb_capacity;
|
|
|
|
size_t icb_count;
|
2023-06-14 21:31:16 -07:00
|
|
|
|
|
|
|
struct vkd3d_shader_src_param *outpointid_param;
|
2023-01-19 17:13:01 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
bool shader_instruction_array_init(struct vkd3d_shader_instruction_array *instructions, unsigned int reserve);
|
|
|
|
bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *instructions, unsigned int reserve);
|
2024-01-10 12:23:04 -08:00
|
|
|
bool shader_instruction_array_insert_at(struct vkd3d_shader_instruction_array *instructions,
|
|
|
|
unsigned int idx, unsigned int count);
|
2023-11-14 17:54:03 -08:00
|
|
|
bool shader_instruction_array_add_icb(struct vkd3d_shader_instruction_array *instructions,
|
2023-01-19 17:35:38 -08:00
|
|
|
struct vkd3d_shader_immediate_constant_buffer *icb);
|
2023-02-28 17:59:28 -08:00
|
|
|
bool shader_instruction_array_clone_instruction(struct vkd3d_shader_instruction_array *instructions,
|
|
|
|
unsigned int dst, unsigned int src);
|
2023-01-19 17:13:01 -08:00
|
|
|
void shader_instruction_array_destroy(struct vkd3d_shader_instruction_array *instructions);
|
|
|
|
|
2023-08-29 12:20:35 -07:00
|
|
|
enum vkd3d_shader_config_flags
|
|
|
|
{
|
|
|
|
VKD3D_SHADER_CONFIG_FLAG_FORCE_VALIDATION = 0x00000001,
|
|
|
|
};
|
|
|
|
|
2024-09-10 13:22:24 -07:00
|
|
|
enum vsir_control_flow_type
|
|
|
|
{
|
|
|
|
VSIR_CF_STRUCTURED,
|
|
|
|
VSIR_CF_BLOCKS,
|
|
|
|
};
|
|
|
|
|
2024-10-17 12:56:39 -07:00
|
|
|
enum vsir_normalisation_level
|
|
|
|
{
|
|
|
|
VSIR_NOT_NORMALISED,
|
|
|
|
VSIR_NORMALISED_HULL_CONTROL_POINT_IO,
|
|
|
|
VSIR_FULLY_NORMALISED_IO,
|
|
|
|
};
|
|
|
|
|
2024-01-16 05:47:34 -08:00
|
|
|
struct vsir_program
|
|
|
|
{
|
2024-01-16 07:40:30 -08:00
|
|
|
struct vkd3d_shader_version shader_version;
|
2024-01-16 05:47:34 -08:00
|
|
|
struct vkd3d_shader_instruction_array instructions;
|
2024-01-17 11:39:55 -08:00
|
|
|
|
2024-03-01 04:36:11 -08:00
|
|
|
struct shader_signature input_signature;
|
|
|
|
struct shader_signature output_signature;
|
|
|
|
struct shader_signature patch_constant_signature;
|
|
|
|
|
2024-06-07 15:32:56 -07:00
|
|
|
unsigned int parameter_count;
|
|
|
|
const struct vkd3d_shader_parameter1 *parameters;
|
|
|
|
bool free_parameters;
|
|
|
|
|
2024-01-17 12:35:22 -08:00
|
|
|
unsigned int input_control_point_count, output_control_point_count;
|
2024-10-05 14:27:56 -07:00
|
|
|
struct vsir_thread_group_size thread_group_size;
|
2024-04-18 14:29:18 -07:00
|
|
|
unsigned int flat_constant_count[3];
|
2024-01-18 11:34:52 -08:00
|
|
|
unsigned int block_count;
|
2024-01-17 12:28:23 -08:00
|
|
|
unsigned int temp_count;
|
2024-01-17 12:14:41 -08:00
|
|
|
unsigned int ssa_count;
|
2024-10-18 13:38:45 -07:00
|
|
|
enum vsir_global_flags global_flags;
|
2024-01-17 11:39:55 -08:00
|
|
|
bool use_vocp;
|
2024-10-03 11:10:10 -07:00
|
|
|
bool has_point_size;
|
2024-10-15 17:04:19 -07:00
|
|
|
bool has_point_coord;
|
2024-09-10 13:22:24 -07:00
|
|
|
enum vsir_control_flow_type cf_type;
|
2024-10-17 12:56:39 -07:00
|
|
|
enum vsir_normalisation_level normalisation_level;
|
2024-01-18 11:41:27 -08:00
|
|
|
|
|
|
|
const char **block_names;
|
|
|
|
size_t block_name_count;
|
2024-01-16 05:47:34 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
void vsir_program_cleanup(struct vsir_program *program);
|
2024-04-18 14:51:54 -07:00
|
|
|
int vsir_program_compile(struct vsir_program *program, uint64_t config_flags,
|
|
|
|
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out,
|
|
|
|
struct vkd3d_shader_message_context *message_context);
|
2024-07-18 19:38:37 -07:00
|
|
|
const struct vkd3d_shader_parameter1 *vsir_program_get_parameter(
|
|
|
|
const struct vsir_program *program, enum vkd3d_shader_parameter_name name);
|
2024-06-07 15:32:56 -07:00
|
|
|
bool vsir_program_init(struct vsir_program *program, const struct vkd3d_shader_compile_info *compile_info,
|
2024-10-02 05:44:38 -07:00
|
|
|
const struct vkd3d_shader_version *version, unsigned int reserve, enum vsir_control_flow_type cf_type,
|
2024-10-17 12:56:39 -07:00
|
|
|
enum vsir_normalisation_level normalisation_level);
|
2024-09-05 11:20:03 -07:00
|
|
|
enum vkd3d_result vsir_program_transform(struct vsir_program *program, uint64_t config_flags,
|
2024-03-13 06:52:34 -07:00
|
|
|
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context);
|
2024-03-13 06:37:45 -07:00
|
|
|
enum vkd3d_result vsir_program_validate(struct vsir_program *program, uint64_t config_flags,
|
|
|
|
const char *source_name, struct vkd3d_shader_message_context *message_context);
|
2024-09-05 08:25:53 -07:00
|
|
|
struct vkd3d_shader_src_param *vsir_program_create_outpointid_param(
|
|
|
|
struct vsir_program *program);
|
2024-05-23 09:57:44 -07:00
|
|
|
bool vsir_instruction_init_with_params(struct vsir_program *program,
|
|
|
|
struct vkd3d_shader_instruction *ins, const struct vkd3d_shader_location *location,
|
|
|
|
enum vkd3d_shader_opcode opcode, unsigned int dst_count, unsigned int src_count);
|
2024-01-16 05:47:34 -08:00
|
|
|
|
2024-01-24 05:07:20 -08:00
|
|
|
static inline struct vkd3d_shader_dst_param *vsir_program_get_dst_params(
|
|
|
|
struct vsir_program *program, unsigned int count)
|
|
|
|
{
|
|
|
|
return shader_dst_param_allocator_get(&program->instructions.dst_params, count);
|
|
|
|
}
|
|
|
|
|
2024-01-24 05:26:35 -08:00
|
|
|
static inline struct vkd3d_shader_src_param *vsir_program_get_src_params(
|
|
|
|
struct vsir_program *program, unsigned int count)
|
|
|
|
{
|
|
|
|
return shader_src_param_allocator_get(&program->instructions.src_params, count);
|
|
|
|
}
|
|
|
|
|
2021-09-01 06:45:08 -07:00
|
|
|
struct vkd3d_shader_parser
|
|
|
|
{
|
2021-10-01 08:51:14 -07:00
|
|
|
struct vkd3d_shader_message_context *message_context;
|
2021-10-01 08:51:15 -07:00
|
|
|
struct vkd3d_shader_location location;
|
2024-05-16 02:41:58 -07:00
|
|
|
struct vsir_program *program;
|
2021-10-06 08:11:45 -07:00
|
|
|
bool failed;
|
2021-09-01 06:45:08 -07:00
|
|
|
};
|
|
|
|
|
2021-10-06 08:11:46 -07:00
|
|
|
void vkd3d_shader_parser_error(struct vkd3d_shader_parser *parser,
|
|
|
|
enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(3, 4);
|
2024-05-16 02:42:12 -07:00
|
|
|
void vkd3d_shader_parser_init(struct vkd3d_shader_parser *parser, struct vsir_program *program,
|
2024-05-16 02:42:29 -07:00
|
|
|
struct vkd3d_shader_message_context *message_context, const char *source_name);
|
2021-10-06 08:11:48 -07:00
|
|
|
void vkd3d_shader_parser_warning(struct vkd3d_shader_parser *parser,
|
|
|
|
enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(3, 4);
|
2023-01-19 17:13:01 -08:00
|
|
|
|
2024-05-16 02:42:16 -07:00
|
|
|
static inline enum vkd3d_result vkd3d_shader_parser_validate(struct vkd3d_shader_parser *parser, uint64_t config_flags)
|
2024-03-13 06:37:45 -07:00
|
|
|
{
|
2024-05-16 02:42:16 -07:00
|
|
|
return vsir_program_validate(parser->program, config_flags,
|
2024-03-13 06:37:45 -07:00
|
|
|
parser->location.source_name, parser->message_context);
|
|
|
|
}
|
|
|
|
|
2023-07-31 16:52:21 -07:00
|
|
|
struct vkd3d_shader_descriptor_info1
|
|
|
|
{
|
|
|
|
enum vkd3d_shader_descriptor_type type;
|
|
|
|
unsigned int register_space;
|
|
|
|
unsigned int register_index;
|
2023-07-31 16:59:16 -07:00
|
|
|
unsigned int register_id;
|
2023-07-31 16:52:21 -07:00
|
|
|
enum vkd3d_shader_resource_type resource_type;
|
|
|
|
enum vkd3d_shader_resource_data_type resource_data_type;
|
|
|
|
unsigned int flags;
|
2023-07-31 17:22:33 -07:00
|
|
|
unsigned int sample_count;
|
2023-07-31 17:34:23 -07:00
|
|
|
unsigned int buffer_size;
|
2023-07-31 17:56:43 -07:00
|
|
|
unsigned int structure_stride;
|
2023-07-31 16:52:21 -07:00
|
|
|
unsigned int count;
|
2023-08-15 07:09:11 -07:00
|
|
|
uint32_t uav_flags;
|
2023-07-31 16:52:21 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct vkd3d_shader_scan_descriptor_info1
|
|
|
|
{
|
|
|
|
struct vkd3d_shader_descriptor_info1 *descriptors;
|
|
|
|
unsigned int descriptor_count;
|
|
|
|
};
|
|
|
|
|
2024-10-08 06:29:52 -07:00
|
|
|
void vsir_program_trace(const struct vsir_program *program);
|
2021-07-01 20:12:48 -07:00
|
|
|
|
2021-10-06 08:11:47 -07:00
|
|
|
const char *shader_get_type_prefix(enum vkd3d_shader_type type);
|
2017-06-16 13:38:21 -07:00
|
|
|
|
2020-07-23 02:11:25 -07:00
|
|
|
struct vkd3d_string_buffer
|
|
|
|
{
|
|
|
|
char *buffer;
|
2021-09-30 12:36:16 -07:00
|
|
|
size_t buffer_size, content_size;
|
2020-07-23 02:11:25 -07:00
|
|
|
};
|
|
|
|
|
2021-02-27 16:03:09 -08:00
|
|
|
struct vkd3d_string_buffer_cache
|
|
|
|
{
|
|
|
|
struct vkd3d_string_buffer **buffers;
|
|
|
|
size_t count, max_count, capacity;
|
|
|
|
};
|
|
|
|
|
2024-01-17 14:14:33 -08:00
|
|
|
enum vsir_asm_flags
|
2023-11-30 03:09:04 -08:00
|
|
|
{
|
2024-01-17 14:14:33 -08:00
|
|
|
VSIR_ASM_FLAG_NONE = 0,
|
|
|
|
VSIR_ASM_FLAG_DUMP_TYPES = 0x1,
|
2024-09-26 13:19:55 -07:00
|
|
|
VSIR_ASM_FLAG_DUMP_ALL_INDICES = 0x2,
|
2023-11-30 03:09:04 -08:00
|
|
|
};
|
|
|
|
|
2024-03-11 07:23:57 -07:00
|
|
|
enum vkd3d_result d3d_asm_compile(const struct vsir_program *program,
|
|
|
|
const struct vkd3d_shader_compile_info *compile_info,
|
2024-01-17 14:14:33 -08:00
|
|
|
struct vkd3d_shader_code *out, enum vsir_asm_flags flags);
|
2021-08-08 23:11:49 -07:00
|
|
|
void vkd3d_string_buffer_cleanup(struct vkd3d_string_buffer *buffer);
|
|
|
|
struct vkd3d_string_buffer *vkd3d_string_buffer_get(struct vkd3d_string_buffer_cache *list);
|
|
|
|
void vkd3d_string_buffer_init(struct vkd3d_string_buffer *buffer);
|
|
|
|
void vkd3d_string_buffer_cache_cleanup(struct vkd3d_string_buffer_cache *list);
|
|
|
|
void vkd3d_string_buffer_cache_init(struct vkd3d_string_buffer_cache *list);
|
2024-01-30 06:07:50 -08:00
|
|
|
void vkd3d_string_buffer_clear(struct vkd3d_string_buffer *buffer);
|
2024-02-06 06:08:49 -08:00
|
|
|
void vkd3d_string_buffer_truncate(struct vkd3d_string_buffer *buffer, size_t size);
|
2022-03-01 04:21:33 -08:00
|
|
|
int vkd3d_string_buffer_print_f32(struct vkd3d_string_buffer *buffer, float f);
|
2022-03-01 04:21:34 -08:00
|
|
|
int vkd3d_string_buffer_print_f64(struct vkd3d_string_buffer *buffer, double d);
|
2021-08-08 23:11:49 -07:00
|
|
|
int vkd3d_string_buffer_printf(struct vkd3d_string_buffer *buffer, const char *format, ...) VKD3D_PRINTF_FUNC(2, 3);
|
|
|
|
void vkd3d_string_buffer_release(struct vkd3d_string_buffer_cache *list, struct vkd3d_string_buffer *buffer);
|
2020-12-07 10:56:30 -08:00
|
|
|
#define vkd3d_string_buffer_trace(buffer) \
|
|
|
|
vkd3d_string_buffer_trace_(buffer, __FUNCTION__)
|
2021-08-08 23:11:49 -07:00
|
|
|
void vkd3d_string_buffer_trace_(const struct vkd3d_string_buffer *buffer, const char *function);
|
|
|
|
int vkd3d_string_buffer_vprintf(struct vkd3d_string_buffer *buffer, const char *format, va_list args);
|
2024-01-10 07:16:23 -08:00
|
|
|
void vkd3d_shader_code_from_string_buffer(struct vkd3d_shader_code *code, struct vkd3d_string_buffer *buffer);
|
2020-07-23 02:11:25 -07:00
|
|
|
|
2021-07-26 13:51:29 -07:00
|
|
|
struct vkd3d_bytecode_buffer
|
|
|
|
{
|
|
|
|
uint8_t *data;
|
|
|
|
size_t size, capacity;
|
|
|
|
int status;
|
|
|
|
};
|
|
|
|
|
2023-04-05 14:55:50 -07:00
|
|
|
/* Align to the next 4-byte offset, and return that offset. */
|
|
|
|
size_t bytecode_align(struct vkd3d_bytecode_buffer *buffer);
|
2021-08-08 23:11:49 -07:00
|
|
|
size_t bytecode_put_bytes(struct vkd3d_bytecode_buffer *buffer, const void *bytes, size_t size);
|
2024-02-06 05:21:46 -08:00
|
|
|
size_t bytecode_put_bytes_unaligned(struct vkd3d_bytecode_buffer *buffer, const void *bytes, size_t size);
|
2023-11-05 13:07:01 -08:00
|
|
|
size_t bytecode_reserve_bytes(struct vkd3d_bytecode_buffer *buffer, size_t size);
|
2021-08-08 23:11:49 -07:00
|
|
|
void set_u32(struct vkd3d_bytecode_buffer *buffer, size_t offset, uint32_t value);
|
2023-11-05 13:07:01 -08:00
|
|
|
void set_string(struct vkd3d_bytecode_buffer *buffer, size_t offset, const char *string, size_t length);
|
2021-07-26 13:51:29 -07:00
|
|
|
|
|
|
|
static inline size_t put_u32(struct vkd3d_bytecode_buffer *buffer, uint32_t value)
|
|
|
|
{
|
|
|
|
return bytecode_put_bytes(buffer, &value, sizeof(value));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline size_t put_f32(struct vkd3d_bytecode_buffer *buffer, float value)
|
|
|
|
{
|
|
|
|
return bytecode_put_bytes(buffer, &value, sizeof(value));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline size_t put_string(struct vkd3d_bytecode_buffer *buffer, const char *string)
|
|
|
|
{
|
|
|
|
return bytecode_put_bytes(buffer, string, strlen(string) + 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline size_t bytecode_get_size(struct vkd3d_bytecode_buffer *buffer)
|
|
|
|
{
|
|
|
|
return buffer->size;
|
|
|
|
}
|
|
|
|
|
2022-05-11 07:39:08 -07:00
|
|
|
uint32_t vkd3d_parse_integer(const char *s);
|
|
|
|
|
2020-12-15 09:01:32 -08:00
|
|
|
struct vkd3d_shader_message_context
|
|
|
|
{
|
|
|
|
enum vkd3d_shader_log_level log_level;
|
2020-07-23 02:11:25 -07:00
|
|
|
struct vkd3d_string_buffer messages;
|
|
|
|
};
|
|
|
|
|
2021-08-08 23:11:49 -07:00
|
|
|
void vkd3d_shader_message_context_cleanup(struct vkd3d_shader_message_context *context);
|
|
|
|
bool vkd3d_shader_message_context_copy_messages(struct vkd3d_shader_message_context *context, char **out);
|
2020-10-08 23:14:03 -07:00
|
|
|
void vkd3d_shader_message_context_init(struct vkd3d_shader_message_context *context,
|
2021-08-08 23:11:49 -07:00
|
|
|
enum vkd3d_shader_log_level log_level);
|
2020-07-30 03:29:57 -07:00
|
|
|
void vkd3d_shader_message_context_trace_messages_(const struct vkd3d_shader_message_context *context,
|
2021-08-08 23:11:49 -07:00
|
|
|
const char *function);
|
2020-07-30 03:29:57 -07:00
|
|
|
#define vkd3d_shader_message_context_trace_messages(context) \
|
|
|
|
vkd3d_shader_message_context_trace_messages_(context, __FUNCTION__)
|
2020-12-15 09:01:32 -08:00
|
|
|
void vkd3d_shader_error(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
|
2021-08-08 23:11:49 -07:00
|
|
|
enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(4, 5);
|
2020-12-15 09:01:32 -08:00
|
|
|
void vkd3d_shader_verror(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
|
2021-08-08 23:11:49 -07:00
|
|
|
enum vkd3d_shader_error error, const char *format, va_list args);
|
2021-02-21 20:04:38 -08:00
|
|
|
void vkd3d_shader_vnote(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
|
2021-08-08 23:11:49 -07:00
|
|
|
enum vkd3d_shader_log_level level, const char *format, va_list args);
|
2023-12-15 05:07:21 -08:00
|
|
|
void vkd3d_shader_warning(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
|
|
|
|
enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(4, 5);
|
2020-12-21 12:37:06 -08:00
|
|
|
void vkd3d_shader_vwarning(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location,
|
2021-08-08 23:11:49 -07:00
|
|
|
enum vkd3d_shader_error error, const char *format, va_list args);
|
2020-07-23 02:11:25 -07:00
|
|
|
|
2024-05-16 02:42:16 -07:00
|
|
|
uint64_t vkd3d_shader_init_config_flags(void);
|
2021-09-16 20:36:35 -07:00
|
|
|
void vkd3d_shader_trace_text_(const char *text, size_t size, const char *function);
|
|
|
|
#define vkd3d_shader_trace_text(text, size) \
|
|
|
|
vkd3d_shader_trace_text_(text, size, __FUNCTION__)
|
2021-01-27 08:29:44 -08:00
|
|
|
|
2024-10-04 11:22:42 -07:00
|
|
|
bool sm1_register_from_semantic_name(const struct vkd3d_shader_version *version, const char *semantic_name,
|
|
|
|
unsigned int semantic_index, bool output, enum vkd3d_shader_register_type *type, unsigned int *reg);
|
|
|
|
bool sm1_usage_from_semantic_name(const char *semantic_name,
|
|
|
|
uint32_t semantic_index, enum vkd3d_decl_usage *usage, uint32_t *usage_idx);
|
2024-10-07 13:21:32 -07:00
|
|
|
bool sm4_register_from_semantic_name(const struct vkd3d_shader_version *version,
|
|
|
|
const char *semantic_name, bool output, enum vkd3d_shader_register_type *type, bool *has_idx);
|
2024-10-04 10:01:08 -07:00
|
|
|
bool sm4_sysval_semantic_from_semantic_name(enum vkd3d_shader_sysval_semantic *sysval_semantic,
|
2024-10-15 13:33:21 -07:00
|
|
|
const struct vkd3d_shader_version *version, bool semantic_compat_mapping, enum vkd3d_tessellator_domain domain,
|
|
|
|
const char *semantic_name, unsigned int semantic_idx, bool output, bool is_patch_constant_func);
|
2024-10-04 11:22:42 -07:00
|
|
|
|
2024-05-16 02:42:22 -07:00
|
|
|
int d3dbc_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags,
|
|
|
|
struct vkd3d_shader_message_context *message_context, struct vsir_program *program);
|
2024-05-16 02:42:29 -07:00
|
|
|
int dxil_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags,
|
|
|
|
struct vkd3d_shader_message_context *message_context, struct vsir_program *program);
|
2024-05-16 02:42:26 -07:00
|
|
|
int tpf_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags,
|
|
|
|
struct vkd3d_shader_message_context *message_context, struct vsir_program *program);
|
2024-10-04 14:36:28 -07:00
|
|
|
int fx_parse(const struct vkd3d_shader_compile_info *compile_info,
|
|
|
|
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);
|
2021-10-01 08:51:11 -07:00
|
|
|
|
2024-03-01 04:52:37 -08:00
|
|
|
void free_dxbc_shader_desc(struct dxbc_shader_desc *desc);
|
2017-06-16 13:38:21 -07:00
|
|
|
|
2023-04-20 03:11:22 -07:00
|
|
|
int shader_extract_from_dxbc(const struct vkd3d_shader_code *dxbc,
|
2024-03-01 04:52:37 -08:00
|
|
|
struct vkd3d_shader_message_context *message_context, const char *source_name, struct dxbc_shader_desc *desc);
|
2023-02-20 05:57:27 -08:00
|
|
|
int shader_parse_input_signature(const struct vkd3d_shader_code *dxbc,
|
2023-04-03 23:22:57 -07:00
|
|
|
struct vkd3d_shader_message_context *message_context, struct shader_signature *signature);
|
2017-09-11 13:35:16 -07:00
|
|
|
|
2024-02-24 06:13:06 -08:00
|
|
|
int glsl_compile(struct vsir_program *program, uint64_t config_flags,
|
2024-02-24 15:35:48 -08:00
|
|
|
const struct vkd3d_shader_scan_descriptor_info1 *descriptor_info,
|
2024-05-06 05:00:58 -07:00
|
|
|
const struct vkd3d_shader_scan_combined_resource_sampler_info *combined_sampler_info,
|
2024-02-24 15:35:48 -08:00
|
|
|
const struct vkd3d_shader_compile_info *compile_info,
|
|
|
|
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);
|
2021-08-19 07:48:13 -07:00
|
|
|
|
2022-03-12 13:47:38 -08:00
|
|
|
#define SPIRV_MAX_SRC_COUNT 6
|
|
|
|
|
2024-04-18 13:14:18 -07:00
|
|
|
int spirv_compile(struct vsir_program *program, uint64_t config_flags,
|
2023-07-31 16:52:21 -07:00
|
|
|
const struct vkd3d_shader_scan_descriptor_info1 *scan_descriptor_info,
|
2022-08-06 16:39:40 -07:00
|
|
|
const struct vkd3d_shader_compile_info *compile_info,
|
|
|
|
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);
|
2017-06-19 09:05:53 -07:00
|
|
|
|
2024-08-28 10:21:39 -07:00
|
|
|
int msl_compile(struct vsir_program *program, uint64_t config_flags,
|
2024-10-09 01:36:06 -07:00
|
|
|
const struct vkd3d_shader_scan_descriptor_info1 *descriptor_info,
|
2024-08-28 10:21:39 -07:00
|
|
|
const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context);
|
2024-08-26 19:34:57 -07:00
|
|
|
|
2024-08-12 06:17:30 -07:00
|
|
|
enum vkd3d_md5_variant
|
|
|
|
{
|
|
|
|
VKD3D_MD5_STANDARD,
|
|
|
|
VKD3D_MD5_DXBC,
|
|
|
|
};
|
|
|
|
|
|
|
|
void vkd3d_compute_md5(const void *dxbc, size_t size, uint32_t checksum[4], enum vkd3d_md5_variant variant);
|
2018-12-17 12:21:15 -08:00
|
|
|
|
2020-12-07 10:56:30 -08:00
|
|
|
int preproc_lexer_parse(const struct vkd3d_shader_compile_info *compile_info,
|
2021-08-08 23:11:49 -07:00
|
|
|
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);
|
2020-12-07 10:56:30 -08:00
|
|
|
|
2021-03-04 15:33:28 -08:00
|
|
|
int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d_shader_compile_info *compile_info,
|
2022-02-28 03:23:43 -08:00
|
|
|
struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context);
|
2021-01-27 08:29:44 -08:00
|
|
|
|
2020-07-10 05:14:00 -07:00
|
|
|
static inline enum vkd3d_shader_component_type vkd3d_component_type_from_data_type(
|
2017-06-20 04:34:44 -07:00
|
|
|
enum vkd3d_data_type data_type)
|
|
|
|
{
|
|
|
|
switch (data_type)
|
|
|
|
{
|
2023-12-12 21:40:48 -08:00
|
|
|
case VKD3D_DATA_HALF: /* Minimum precision. TODO: native 16-bit */
|
2017-06-20 04:34:44 -07:00
|
|
|
case VKD3D_DATA_FLOAT:
|
2019-12-06 11:03:18 -08:00
|
|
|
case VKD3D_DATA_UNORM:
|
|
|
|
case VKD3D_DATA_SNORM:
|
2020-07-10 05:14:00 -07:00
|
|
|
return VKD3D_SHADER_COMPONENT_FLOAT;
|
2023-12-12 21:40:48 -08:00
|
|
|
case VKD3D_DATA_UINT16: /* Minimum precision. TODO: native 16-bit */
|
2017-06-20 04:34:44 -07:00
|
|
|
case VKD3D_DATA_UINT:
|
2020-07-10 05:14:00 -07:00
|
|
|
return VKD3D_SHADER_COMPONENT_UINT;
|
2017-06-20 04:34:44 -07:00
|
|
|
case VKD3D_DATA_INT:
|
2020-07-10 05:14:00 -07:00
|
|
|
return VKD3D_SHADER_COMPONENT_INT;
|
2021-07-09 08:31:37 -07:00
|
|
|
case VKD3D_DATA_DOUBLE:
|
|
|
|
return VKD3D_SHADER_COMPONENT_DOUBLE;
|
2023-11-20 22:43:36 -08:00
|
|
|
case VKD3D_DATA_UINT64:
|
|
|
|
return VKD3D_SHADER_COMPONENT_UINT64;
|
2023-11-06 20:01:39 -08:00
|
|
|
case VKD3D_DATA_BOOL:
|
|
|
|
return VKD3D_SHADER_COMPONENT_BOOL;
|
2017-06-20 04:34:44 -07:00
|
|
|
default:
|
|
|
|
FIXME("Unhandled data type %#x.\n", data_type);
|
2022-02-28 03:23:45 -08:00
|
|
|
/* fall-through */
|
|
|
|
case VKD3D_DATA_MIXED:
|
2020-07-10 05:14:00 -07:00
|
|
|
return VKD3D_SHADER_COMPONENT_UINT;
|
2017-06-20 04:34:44 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-17 07:25:29 -07:00
|
|
|
static inline enum vkd3d_data_type vkd3d_data_type_from_component_type(
|
2020-07-10 05:14:00 -07:00
|
|
|
enum vkd3d_shader_component_type component_type)
|
2017-07-17 07:25:29 -07:00
|
|
|
{
|
|
|
|
switch (component_type)
|
|
|
|
{
|
2020-07-10 05:14:00 -07:00
|
|
|
case VKD3D_SHADER_COMPONENT_FLOAT:
|
2017-07-17 07:25:29 -07:00
|
|
|
return VKD3D_DATA_FLOAT;
|
2020-07-10 05:14:00 -07:00
|
|
|
case VKD3D_SHADER_COMPONENT_UINT:
|
2017-07-17 07:25:29 -07:00
|
|
|
return VKD3D_DATA_UINT;
|
2020-07-10 05:14:00 -07:00
|
|
|
case VKD3D_SHADER_COMPONENT_INT:
|
2017-07-17 07:25:29 -07:00
|
|
|
return VKD3D_DATA_INT;
|
2021-07-09 08:31:37 -07:00
|
|
|
case VKD3D_SHADER_COMPONENT_DOUBLE:
|
|
|
|
return VKD3D_DATA_DOUBLE;
|
2017-07-17 07:25:29 -07:00
|
|
|
default:
|
|
|
|
FIXME("Unhandled component type %#x.\n", component_type);
|
|
|
|
return VKD3D_DATA_FLOAT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-10 21:07:51 -07:00
|
|
|
static inline enum vkd3d_shader_component_type vkd3d_component_type_from_resource_data_type(
|
|
|
|
enum vkd3d_shader_resource_data_type data_type)
|
|
|
|
{
|
|
|
|
switch (data_type)
|
|
|
|
{
|
|
|
|
case VKD3D_SHADER_RESOURCE_DATA_FLOAT:
|
|
|
|
case VKD3D_SHADER_RESOURCE_DATA_UNORM:
|
|
|
|
case VKD3D_SHADER_RESOURCE_DATA_SNORM:
|
|
|
|
return VKD3D_SHADER_COMPONENT_FLOAT;
|
|
|
|
case VKD3D_SHADER_RESOURCE_DATA_UINT:
|
|
|
|
return VKD3D_SHADER_COMPONENT_UINT;
|
|
|
|
case VKD3D_SHADER_RESOURCE_DATA_INT:
|
|
|
|
return VKD3D_SHADER_COMPONENT_INT;
|
|
|
|
case VKD3D_SHADER_RESOURCE_DATA_DOUBLE:
|
|
|
|
case VKD3D_SHADER_RESOURCE_DATA_CONTINUED:
|
|
|
|
return VKD3D_SHADER_COMPONENT_DOUBLE;
|
|
|
|
default:
|
|
|
|
FIXME("Unhandled data type %#x.\n", data_type);
|
|
|
|
/* fall-through */
|
|
|
|
case VKD3D_SHADER_RESOURCE_DATA_MIXED:
|
|
|
|
return VKD3D_SHADER_COMPONENT_UINT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-12 00:49:26 -07:00
|
|
|
static inline bool component_type_is_64_bit(enum vkd3d_shader_component_type component_type)
|
|
|
|
{
|
|
|
|
return component_type == VKD3D_SHADER_COMPONENT_DOUBLE || component_type == VKD3D_SHADER_COMPONENT_UINT64;
|
|
|
|
}
|
|
|
|
|
2023-04-04 00:28:48 -07:00
|
|
|
enum vkd3d_shader_input_sysval_semantic vkd3d_siv_from_sysval_indexed(enum vkd3d_shader_sysval_semantic sysval,
|
|
|
|
unsigned int index);
|
|
|
|
|
|
|
|
static inline enum vkd3d_shader_input_sysval_semantic vkd3d_siv_from_sysval(enum vkd3d_shader_sysval_semantic sysval)
|
|
|
|
{
|
|
|
|
return vkd3d_siv_from_sysval_indexed(sysval, 0);
|
|
|
|
}
|
|
|
|
|
2023-12-05 13:19:07 -08:00
|
|
|
static inline unsigned int vsir_write_mask_get_component_idx(uint32_t write_mask)
|
2017-06-20 04:34:44 -07:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
2024-08-05 07:50:30 -07:00
|
|
|
VKD3D_ASSERT(write_mask);
|
2017-06-20 04:34:44 -07:00
|
|
|
for (i = 0; i < VKD3D_VEC4_SIZE; ++i)
|
|
|
|
{
|
|
|
|
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("Invalid write mask %#x.\n", write_mask);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-12-05 13:35:37 -08:00
|
|
|
static inline unsigned int vsir_write_mask_component_count(uint32_t write_mask)
|
2017-06-20 04:34:44 -07:00
|
|
|
{
|
2019-04-30 05:33:47 -07:00
|
|
|
unsigned int count = vkd3d_popcount(write_mask & VKD3DSP_WRITEMASK_ALL);
|
2024-08-05 07:50:30 -07:00
|
|
|
VKD3D_ASSERT(1 <= count && count <= VKD3D_VEC4_SIZE);
|
2019-04-30 05:33:47 -07:00
|
|
|
return count;
|
2017-06-20 04:34:44 -07:00
|
|
|
}
|
|
|
|
|
2018-06-26 05:41:44 -07:00
|
|
|
static inline unsigned int vkd3d_write_mask_from_component_count(unsigned int component_count)
|
|
|
|
{
|
2024-08-05 07:50:30 -07:00
|
|
|
VKD3D_ASSERT(component_count <= VKD3D_VEC4_SIZE);
|
2018-06-26 05:41:44 -07:00
|
|
|
return (VKD3DSP_WRITEMASK_0 << component_count) - 1;
|
|
|
|
}
|
|
|
|
|
2023-12-05 13:39:12 -08:00
|
|
|
static inline uint32_t vsir_write_mask_64_from_32(uint32_t write_mask32)
|
2021-07-27 07:26:10 -07:00
|
|
|
{
|
2024-01-20 14:30:23 -08:00
|
|
|
switch (write_mask32)
|
|
|
|
{
|
|
|
|
case VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_1:
|
|
|
|
return VKD3DSP_WRITEMASK_0;
|
|
|
|
|
|
|
|
case VKD3DSP_WRITEMASK_2 | VKD3DSP_WRITEMASK_3:
|
|
|
|
return VKD3DSP_WRITEMASK_1;
|
|
|
|
|
|
|
|
case VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_1 | VKD3DSP_WRITEMASK_2 | VKD3DSP_WRITEMASK_3:
|
|
|
|
return VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_1;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ERR("Invalid 32 bit writemask when converting to 64 bit: %#x.\n", write_mask32);
|
|
|
|
return VKD3DSP_WRITEMASK_0;
|
|
|
|
}
|
2021-07-27 07:26:10 -07:00
|
|
|
}
|
|
|
|
|
2023-12-05 13:42:32 -08:00
|
|
|
static inline uint32_t vsir_write_mask_32_from_64(uint32_t write_mask64)
|
2021-07-18 19:30:15 -07:00
|
|
|
{
|
2024-01-20 14:30:23 -08:00
|
|
|
switch (write_mask64)
|
|
|
|
{
|
|
|
|
case VKD3DSP_WRITEMASK_0:
|
|
|
|
return VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_1;
|
|
|
|
|
|
|
|
case VKD3DSP_WRITEMASK_1:
|
|
|
|
return VKD3DSP_WRITEMASK_2 | VKD3DSP_WRITEMASK_3;
|
|
|
|
|
|
|
|
case VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_1:
|
|
|
|
return VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_1 | VKD3DSP_WRITEMASK_2 | VKD3DSP_WRITEMASK_3;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ERR("Invalid 64 bit writemask: %#x.\n", write_mask64);
|
|
|
|
return VKD3DSP_WRITEMASK_0;
|
|
|
|
}
|
2021-07-18 19:30:15 -07:00
|
|
|
}
|
|
|
|
|
2024-01-22 08:15:36 -08:00
|
|
|
static inline uint32_t vsir_swizzle_64_from_32(uint32_t swizzle32)
|
2017-06-20 04:34:44 -07:00
|
|
|
{
|
2024-01-22 08:15:36 -08:00
|
|
|
switch (swizzle32)
|
|
|
|
{
|
|
|
|
case VKD3D_SHADER_SWIZZLE(X, Y, X, Y):
|
|
|
|
return VKD3D_SHADER_SWIZZLE(X, X, X, X);
|
|
|
|
|
|
|
|
case VKD3D_SHADER_SWIZZLE(X, Y, Z, W):
|
|
|
|
return VKD3D_SHADER_SWIZZLE(X, Y, X, X);
|
|
|
|
|
|
|
|
case VKD3D_SHADER_SWIZZLE(Z, W, X, Y):
|
|
|
|
return VKD3D_SHADER_SWIZZLE(Y, X, X, X);
|
|
|
|
|
|
|
|
case VKD3D_SHADER_SWIZZLE(Z, W, Z, W):
|
|
|
|
return VKD3D_SHADER_SWIZZLE(Y, Y, X, X);
|
|
|
|
|
|
|
|
default:
|
|
|
|
ERR("Invalid 32 bit swizzle when converting to 64 bit: %#x.\n", swizzle32);
|
|
|
|
return VKD3D_SHADER_SWIZZLE(X, X, X, X);
|
|
|
|
}
|
2017-06-20 04:34:44 -07:00
|
|
|
}
|
2021-07-30 06:27:21 -07:00
|
|
|
|
2024-01-22 08:15:36 -08:00
|
|
|
static inline uint32_t vsir_swizzle_32_from_64(uint32_t swizzle64)
|
2021-07-30 06:27:21 -07:00
|
|
|
{
|
2024-01-22 08:15:36 -08:00
|
|
|
switch (swizzle64)
|
|
|
|
{
|
|
|
|
case VKD3D_SHADER_SWIZZLE(X, X, X, X):
|
|
|
|
return VKD3D_SHADER_SWIZZLE(X, Y, X, Y);
|
|
|
|
|
|
|
|
case VKD3D_SHADER_SWIZZLE(X, Y, X, X):
|
|
|
|
return VKD3D_SHADER_SWIZZLE(X, Y, Z, W);
|
|
|
|
|
|
|
|
case VKD3D_SHADER_SWIZZLE(Y, X, X, X):
|
|
|
|
return VKD3D_SHADER_SWIZZLE(Z, W, X, Y);
|
|
|
|
|
|
|
|
case VKD3D_SHADER_SWIZZLE(Y, Y, X, X):
|
|
|
|
return VKD3D_SHADER_SWIZZLE(Z, W, Z, W);
|
|
|
|
|
|
|
|
default:
|
|
|
|
ERR("Invalid 64 bit swizzle: %#x.\n", swizzle64);
|
|
|
|
return VKD3D_SHADER_SWIZZLE(X, Y, X, Y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned int vsir_swizzle_get_component(uint32_t swizzle, unsigned int idx)
|
|
|
|
{
|
|
|
|
return (swizzle >> VKD3D_SHADER_SWIZZLE_SHIFT(idx)) & VKD3D_SHADER_SWIZZLE_MASK;
|
2021-07-30 06:27:21 -07:00
|
|
|
}
|
2017-06-20 04:34:44 -07:00
|
|
|
|
2023-12-05 14:05:40 -08:00
|
|
|
static inline unsigned int vkd3d_compact_swizzle(uint32_t swizzle, uint32_t write_mask)
|
2018-10-31 07:26:46 -07:00
|
|
|
{
|
|
|
|
unsigned int i, compacted_swizzle = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < VKD3D_VEC4_SIZE; ++i)
|
|
|
|
{
|
|
|
|
if (write_mask & (VKD3DSP_WRITEMASK_0 << i))
|
|
|
|
{
|
2020-07-10 05:14:02 -07:00
|
|
|
compacted_swizzle <<= VKD3D_SHADER_SWIZZLE_SHIFT(1);
|
2023-12-05 14:05:40 -08:00
|
|
|
compacted_swizzle |= vsir_swizzle_get_component(swizzle, i);
|
2018-10-31 07:26:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return compacted_swizzle;
|
|
|
|
}
|
|
|
|
|
2024-04-11 03:38:24 -07:00
|
|
|
static inline uint32_t vsir_swizzle_from_writemask(unsigned int writemask)
|
|
|
|
{
|
|
|
|
static const unsigned int swizzles[16] =
|
|
|
|
{
|
|
|
|
0,
|
|
|
|
VKD3D_SHADER_SWIZZLE(X, X, X, X),
|
|
|
|
VKD3D_SHADER_SWIZZLE(Y, Y, Y, Y),
|
|
|
|
VKD3D_SHADER_SWIZZLE(X, Y, X, X),
|
|
|
|
VKD3D_SHADER_SWIZZLE(Z, Z, Z, Z),
|
|
|
|
VKD3D_SHADER_SWIZZLE(X, Z, X, X),
|
|
|
|
VKD3D_SHADER_SWIZZLE(Y, Z, X, X),
|
|
|
|
VKD3D_SHADER_SWIZZLE(X, Y, Z, X),
|
|
|
|
VKD3D_SHADER_SWIZZLE(W, W, W, W),
|
|
|
|
VKD3D_SHADER_SWIZZLE(X, W, X, X),
|
|
|
|
VKD3D_SHADER_SWIZZLE(Y, W, X, X),
|
|
|
|
VKD3D_SHADER_SWIZZLE(X, Y, W, X),
|
|
|
|
VKD3D_SHADER_SWIZZLE(Z, W, X, X),
|
|
|
|
VKD3D_SHADER_SWIZZLE(X, Z, W, X),
|
|
|
|
VKD3D_SHADER_SWIZZLE(Y, Z, W, X),
|
|
|
|
VKD3D_SHADER_SWIZZLE(X, Y, Z, W),
|
|
|
|
};
|
|
|
|
|
|
|
|
return swizzles[writemask & 0xf];
|
|
|
|
}
|
|
|
|
|
2020-07-30 03:29:55 -07:00
|
|
|
struct vkd3d_struct
|
|
|
|
{
|
|
|
|
enum vkd3d_shader_structure_type type;
|
|
|
|
const void *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define vkd3d_find_struct(c, t) vkd3d_find_struct_(c, VKD3D_SHADER_STRUCTURE_TYPE_##t)
|
|
|
|
static inline void *vkd3d_find_struct_(const struct vkd3d_struct *chain,
|
|
|
|
enum vkd3d_shader_structure_type type)
|
|
|
|
{
|
|
|
|
while (chain)
|
|
|
|
{
|
|
|
|
if (chain->type == type)
|
|
|
|
return (void *)chain;
|
|
|
|
|
|
|
|
chain = chain->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2018-04-11 04:21:41 -07:00
|
|
|
#define VKD3D_DXBC_HEADER_SIZE (8 * sizeof(uint32_t))
|
2022-11-14 21:16:41 -08:00
|
|
|
#define VKD3D_DXBC_CHUNK_ALIGNMENT sizeof(uint32_t)
|
2017-06-20 05:14:44 -07:00
|
|
|
|
2024-10-15 13:33:21 -07:00
|
|
|
#define DXBC_MAX_SECTION_COUNT 7
|
2021-08-17 10:38:57 -07:00
|
|
|
|
|
|
|
struct dxbc_writer
|
|
|
|
{
|
|
|
|
unsigned int section_count;
|
2023-02-20 04:50:22 -08:00
|
|
|
struct vkd3d_shader_dxbc_section_desc sections[DXBC_MAX_SECTION_COUNT];
|
2021-08-17 10:38:57 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
void dxbc_writer_add_section(struct dxbc_writer *dxbc, uint32_t tag, const void *data, size_t size);
|
|
|
|
void dxbc_writer_init(struct dxbc_writer *dxbc);
|
|
|
|
int dxbc_writer_write(struct dxbc_writer *dxbc, struct vkd3d_shader_code *code);
|
|
|
|
|
2017-06-16 13:38:21 -07:00
|
|
|
#endif /* __VKD3D_SHADER_PRIVATE_H */
|