wined3d: Handle SM4 resource declarations.
This commit is contained in:
parent
f5cef43738
commit
f7e485dcf4
|
@ -663,6 +663,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WINED3DSPR_SAMPLER:
|
case WINED3DSPR_SAMPLER:
|
||||||
|
case WINED3DSPR_RESOURCE:
|
||||||
if (reg_idx >= ARRAY_SIZE(reg_maps->resource_type))
|
if (reg_idx >= ARRAY_SIZE(reg_maps->resource_type))
|
||||||
{
|
{
|
||||||
ERR("Invalid resource index %u.\n", reg_idx);
|
ERR("Invalid resource index %u.\n", reg_idx);
|
||||||
|
@ -1017,6 +1018,52 @@ static void shader_dump_decl_usage(const struct wined3d_shader_semantic *semanti
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (semantic->reg.reg.type == WINED3DSPR_RESOURCE)
|
||||||
|
{
|
||||||
|
TRACE("_resource_");
|
||||||
|
switch (semantic->resource_type)
|
||||||
|
{
|
||||||
|
case WINED3D_SHADER_RESOURCE_BUFFER:
|
||||||
|
TRACE("buffer");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3D_SHADER_RESOURCE_TEXTURE_1D:
|
||||||
|
TRACE("texture1d");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3D_SHADER_RESOURCE_TEXTURE_2D:
|
||||||
|
TRACE("texture2d");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3D_SHADER_RESOURCE_TEXTURE_2DMS:
|
||||||
|
TRACE("texture2dms");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3D_SHADER_RESOURCE_TEXTURE_3D:
|
||||||
|
TRACE("texture3d");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3D_SHADER_RESOURCE_TEXTURE_CUBE:
|
||||||
|
TRACE("texturecube");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY:
|
||||||
|
TRACE("texture1darray");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY:
|
||||||
|
TRACE("texture2darray");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY:
|
||||||
|
TRACE("texture2dmsarray");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
TRACE("unknown");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Pixel shaders 3.0 don't have usage semantics. */
|
/* Pixel shaders 3.0 don't have usage semantics. */
|
||||||
|
|
|
@ -29,6 +29,9 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_bytecode);
|
||||||
#define WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT 24
|
#define WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT 24
|
||||||
#define WINED3D_SM4_INSTRUCTION_LENGTH_MASK (0x1f << WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT)
|
#define WINED3D_SM4_INSTRUCTION_LENGTH_MASK (0x1f << WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT)
|
||||||
|
|
||||||
|
#define WINED3D_SM4_RESOURCE_TYPE_SHIFT 11
|
||||||
|
#define WINED3D_SM4_RESOURCE_TYPE_MASK (0xf << WINED3D_SM4_RESOURCE_TYPE_SHIFT)
|
||||||
|
|
||||||
#define WINED3D_SM4_PRIMITIVE_TYPE_SHIFT 11
|
#define WINED3D_SM4_PRIMITIVE_TYPE_SHIFT 11
|
||||||
#define WINED3D_SM4_PRIMITIVE_TYPE_MASK (0x7 << WINED3D_SM4_PRIMITIVE_TYPE_SHIFT)
|
#define WINED3D_SM4_PRIMITIVE_TYPE_MASK (0x7 << WINED3D_SM4_PRIMITIVE_TYPE_SHIFT)
|
||||||
|
|
||||||
|
@ -121,6 +124,7 @@ enum wined3d_sm4_opcode
|
||||||
WINED3D_SM4_OP_USHR = 0x55,
|
WINED3D_SM4_OP_USHR = 0x55,
|
||||||
WINED3D_SM4_OP_UTOF = 0x56,
|
WINED3D_SM4_OP_UTOF = 0x56,
|
||||||
WINED3D_SM4_OP_XOR = 0x57,
|
WINED3D_SM4_OP_XOR = 0x57,
|
||||||
|
WINED3D_SM4_OP_DCL_RESOURCE = 0x58,
|
||||||
WINED3D_SM4_OP_DCL_CONSTANT_BUFFER = 0x59,
|
WINED3D_SM4_OP_DCL_CONSTANT_BUFFER = 0x59,
|
||||||
WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY = 0x5c,
|
WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY = 0x5c,
|
||||||
WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE = 0x5d,
|
WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE = 0x5d,
|
||||||
|
@ -134,6 +138,7 @@ enum wined3d_sm4_register_type
|
||||||
WINED3D_SM4_RT_OUTPUT = 0x2,
|
WINED3D_SM4_RT_OUTPUT = 0x2,
|
||||||
WINED3D_SM4_RT_IMMCONST = 0x4,
|
WINED3D_SM4_RT_IMMCONST = 0x4,
|
||||||
WINED3D_SM4_RT_SAMPLER = 0x6,
|
WINED3D_SM4_RT_SAMPLER = 0x6,
|
||||||
|
WINED3D_SM4_RT_RESOURCE = 0x7,
|
||||||
WINED3D_SM4_RT_CONSTBUFFER = 0x8,
|
WINED3D_SM4_RT_CONSTBUFFER = 0x8,
|
||||||
WINED3D_SM4_RT_PRIMID = 0xb,
|
WINED3D_SM4_RT_PRIMID = 0xb,
|
||||||
WINED3D_SM4_RT_NULL = 0xd,
|
WINED3D_SM4_RT_NULL = 0xd,
|
||||||
|
@ -167,6 +172,19 @@ enum wined3d_sm4_immconst_type
|
||||||
WINED3D_SM4_IMMCONST_VEC4 = 0x2,
|
WINED3D_SM4_IMMCONST_VEC4 = 0x2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum wined3d_sm4_resource_type
|
||||||
|
{
|
||||||
|
WINED3D_SM4_RESOURCE_BUFFER = 0x1,
|
||||||
|
WINED3D_SM4_RESOURCE_TEXTURE_1D = 0x2,
|
||||||
|
WINED3D_SM4_RESOURCE_TEXTURE_2D = 0x3,
|
||||||
|
WINED3D_SM4_RESOURCE_TEXTURE_2DMS = 0x4,
|
||||||
|
WINED3D_SM4_RESOURCE_TEXTURE_3D = 0x5,
|
||||||
|
WINED3D_SM4_RESOURCE_TEXTURE_CUBE = 0x6,
|
||||||
|
WINED3D_SM4_RESOURCE_TEXTURE_1DARRAY = 0x7,
|
||||||
|
WINED3D_SM4_RESOURCE_TEXTURE_2DARRAY = 0x8,
|
||||||
|
WINED3D_SM4_RESOURCE_TEXTURE_2DMSARRAY = 0x9,
|
||||||
|
};
|
||||||
|
|
||||||
struct wined3d_shader_src_param_entry
|
struct wined3d_shader_src_param_entry
|
||||||
{
|
{
|
||||||
struct list entry;
|
struct list entry;
|
||||||
|
@ -264,6 +282,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] =
|
||||||
{WINED3D_SM4_OP_USHR, WINED3DSIH_USHR, "U", "UU"},
|
{WINED3D_SM4_OP_USHR, WINED3DSIH_USHR, "U", "UU"},
|
||||||
{WINED3D_SM4_OP_UTOF, WINED3DSIH_UTOF, "F", "U"},
|
{WINED3D_SM4_OP_UTOF, WINED3DSIH_UTOF, "F", "U"},
|
||||||
{WINED3D_SM4_OP_XOR, WINED3DSIH_XOR, "U", "UU"},
|
{WINED3D_SM4_OP_XOR, WINED3DSIH_XOR, "U", "UU"},
|
||||||
|
{WINED3D_SM4_OP_DCL_RESOURCE, WINED3DSIH_DCL, "R", ""},
|
||||||
{WINED3D_SM4_OP_DCL_CONSTANT_BUFFER, WINED3DSIH_DCL_CONSTANT_BUFFER, "", ""},
|
{WINED3D_SM4_OP_DCL_CONSTANT_BUFFER, WINED3DSIH_DCL_CONSTANT_BUFFER, "", ""},
|
||||||
{WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY, WINED3DSIH_DCL_OUTPUT_TOPOLOGY, "", ""},
|
{WINED3D_SM4_OP_DCL_OUTPUT_TOPOLOGY, WINED3DSIH_DCL_OUTPUT_TOPOLOGY, "", ""},
|
||||||
{WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE, WINED3DSIH_DCL_INPUT_PRIMITIVE, "", ""},
|
{WINED3D_SM4_OP_DCL_INPUT_PRIMITIVE, WINED3DSIH_DCL_INPUT_PRIMITIVE, "", ""},
|
||||||
|
@ -323,6 +342,20 @@ static const struct sysval_map sysval_map[] =
|
||||||
{WINED3D_SV_TARGET7, WINED3DSPR_COLOROUT, 7},
|
{WINED3D_SV_TARGET7, WINED3DSPR_COLOROUT, 7},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const enum wined3d_shader_resource_type resource_type_table[] =
|
||||||
|
{
|
||||||
|
/* 0 */ WINED3D_SHADER_RESOURCE_NONE,
|
||||||
|
/* WINED3D_SM4_RESOURCE_BUFFER */ WINED3D_SHADER_RESOURCE_BUFFER,
|
||||||
|
/* WINED3D_SM4_RESOURCE_TEXTURE_1D */ WINED3D_SHADER_RESOURCE_TEXTURE_1D,
|
||||||
|
/* WINED3D_SM4_RESOURCE_TEXTURE_2D */ WINED3D_SHADER_RESOURCE_TEXTURE_2D,
|
||||||
|
/* WINED3D_SM4_RESOURCE_TEXTURE_2DMS */ WINED3D_SHADER_RESOURCE_TEXTURE_2DMS,
|
||||||
|
/* WINED3D_SM4_RESOURCE_TEXTURE_3D */ WINED3D_SHADER_RESOURCE_TEXTURE_3D,
|
||||||
|
/* WINED3D_SM4_RESOURCE_TEXTURE_CUBE */ WINED3D_SHADER_RESOURCE_TEXTURE_CUBE,
|
||||||
|
/* WINED3D_SM4_RESOURCE_TEXTURE_1DARRAY */ WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY,
|
||||||
|
/* WINED3D_SM4_RESOURCE_TEXTURE_2DARRAY */ WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY,
|
||||||
|
/* WINED3D_SM4_RESOURCE_TEXTURE_2DMSARRAY */ WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY,
|
||||||
|
};
|
||||||
|
|
||||||
static BOOL shader_sm4_read_src_param(struct wined3d_sm4_data *priv, const DWORD **ptr,
|
static BOOL shader_sm4_read_src_param(struct wined3d_sm4_data *priv, const DWORD **ptr,
|
||||||
enum wined3d_data_type data_type, struct wined3d_shader_src_param *src_param);
|
enum wined3d_data_type data_type, struct wined3d_shader_src_param *src_param);
|
||||||
|
|
||||||
|
@ -743,7 +776,23 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi
|
||||||
FIXME("Skipping modifier 0x%08x.\n", modifier);
|
FIXME("Skipping modifier 0x%08x.\n", modifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opcode == WINED3D_SM4_OP_DCL_CONSTANT_BUFFER)
|
if (opcode == WINED3D_SM4_OP_DCL_RESOURCE)
|
||||||
|
{
|
||||||
|
enum wined3d_sm4_resource_type resource_type;
|
||||||
|
|
||||||
|
resource_type = (opcode_token & WINED3D_SM4_RESOURCE_TYPE_MASK) >> WINED3D_SM4_RESOURCE_TYPE_SHIFT;
|
||||||
|
if (!resource_type || (resource_type >= ARRAY_SIZE(resource_type_table)))
|
||||||
|
{
|
||||||
|
FIXME("Unhandled resource type %#x.\n", resource_type);
|
||||||
|
ins->declaration.semantic.resource_type = WINED3D_SHADER_RESOURCE_NONE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ins->declaration.semantic.resource_type = resource_type_table[resource_type];
|
||||||
|
}
|
||||||
|
shader_sm4_read_dst_param(priv, &p, WINED3D_DATA_RESOURCE, &ins->declaration.semantic.reg);
|
||||||
|
}
|
||||||
|
else if (opcode == WINED3D_SM4_OP_DCL_CONSTANT_BUFFER)
|
||||||
{
|
{
|
||||||
shader_sm4_read_src_param(priv, &p, WINED3D_DATA_FLOAT, &ins->declaration.src);
|
shader_sm4_read_src_param(priv, &p, WINED3D_DATA_FLOAT, &ins->declaration.src);
|
||||||
if (opcode_token & WINED3D_SM4_INDEX_TYPE_MASK)
|
if (opcode_token & WINED3D_SM4_INDEX_TYPE_MASK)
|
||||||
|
|
|
@ -286,10 +286,15 @@ extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN;
|
||||||
enum wined3d_shader_resource_type
|
enum wined3d_shader_resource_type
|
||||||
{
|
{
|
||||||
WINED3D_SHADER_RESOURCE_NONE,
|
WINED3D_SHADER_RESOURCE_NONE,
|
||||||
|
WINED3D_SHADER_RESOURCE_BUFFER,
|
||||||
WINED3D_SHADER_RESOURCE_TEXTURE_1D,
|
WINED3D_SHADER_RESOURCE_TEXTURE_1D,
|
||||||
WINED3D_SHADER_RESOURCE_TEXTURE_2D,
|
WINED3D_SHADER_RESOURCE_TEXTURE_2D,
|
||||||
|
WINED3D_SHADER_RESOURCE_TEXTURE_2DMS,
|
||||||
WINED3D_SHADER_RESOURCE_TEXTURE_3D,
|
WINED3D_SHADER_RESOURCE_TEXTURE_3D,
|
||||||
WINED3D_SHADER_RESOURCE_TEXTURE_CUBE,
|
WINED3D_SHADER_RESOURCE_TEXTURE_CUBE,
|
||||||
|
WINED3D_SHADER_RESOURCE_TEXTURE_1DARRAY,
|
||||||
|
WINED3D_SHADER_RESOURCE_TEXTURE_2DARRAY,
|
||||||
|
WINED3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define WINED3D_SHADER_CONST_VS_F 0x00000001
|
#define WINED3D_SHADER_CONST_VS_F 0x00000001
|
||||||
|
|
Loading…
Reference in New Issue