[PATCH v2 3/5] wined3d: Mostly get rid of enum wined3d_data_type.
Matteo Bruni
mbruni at codeweavers.com
Wed Jun 20 17:48:24 CDT 2018
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
v2-ish: Leave the enum around only for the semantic data type /
shader_dump_decl_usage().
dlls/wined3d/glsl_shader.c | 100 ++++++++++++++++++++---------------------
dlls/wined3d/shader.c | 45 +++++++++++++------
dlls/wined3d/shader_sm1.c | 14 +++---
dlls/wined3d/shader_sm4.c | 56 +++++++++++------------
dlls/wined3d/wined3d_private.h | 4 +-
5 files changed, 117 insertions(+), 102 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index f1f3020d53d..cd4780a6419 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -88,7 +88,7 @@ struct glsl_sample_function
struct wined3d_string_buffer *name;
unsigned int coord_mask;
unsigned int deriv_mask;
- enum wined3d_data_type data_type;
+ enum wined3d_component_type data_type;
BOOL output_single_component;
unsigned int offset_size;
};
@@ -2522,17 +2522,15 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
switch (reg_maps->resource_info[entry->resource_idx].data_type)
{
- case WINED3D_DATA_FLOAT:
- case WINED3D_DATA_UNORM:
- case WINED3D_DATA_SNORM:
+ case WINED3D_TYPE_FLOAT:
sampler_type_prefix = "";
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
sampler_type_prefix = "i";
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
sampler_type_prefix = "u";
break;
@@ -2640,19 +2638,17 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
switch (reg_maps->uav_resource_info[i].data_type)
{
- case WINED3D_DATA_FLOAT:
- case WINED3D_DATA_UNORM:
- case WINED3D_DATA_SNORM:
+ case WINED3D_TYPE_FLOAT:
image_type_prefix = "";
read_format = "r32f";
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
image_type_prefix = "i";
read_format = "r32i";
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
image_type_prefix = "u";
read_format = "r32ui";
break;
@@ -2848,7 +2844,7 @@ static void shader_glsl_fixup_scalar_register_variable(char *register_name,
/** Writes the GLSL variable name that corresponds to the register that the
* DX opcode parameter is trying to access */
static void shader_glsl_get_register_name(const struct wined3d_shader_register *reg,
- enum wined3d_data_type data_type, char *register_name, BOOL *is_color,
+ enum wined3d_component_type data_type, char *register_name, BOOL *is_color,
const struct wined3d_shader_instruction *ins)
{
/* oPos, oFog and oPts in D3D */
@@ -3084,16 +3080,16 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
case WINED3D_IMMCONST_SCALAR:
switch (data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
sprintf(register_name, "uintBitsToFloat(%#xu)", reg->u.immconst_data[0]);
else
wined3d_ftoa(*(const float *)reg->u.immconst_data, register_name);
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
sprintf(register_name, "%#x", reg->u.immconst_data[0]);
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
sprintf(register_name, "%#xu", reg->u.immconst_data[0]);
break;
default:
@@ -3105,7 +3101,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
case WINED3D_IMMCONST_VEC4:
switch (data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
{
sprintf(register_name, "uintBitsToFloat(uvec4(%#xu, %#xu, %#xu, %#xu))",
@@ -3122,12 +3118,12 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
imm_str[0], imm_str[1], imm_str[2], imm_str[3]);
}
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
sprintf(register_name, "ivec4(%#x, %#x, %#x, %#x)",
reg->u.immconst_data[0], reg->u.immconst_data[1],
reg->u.immconst_data[2], reg->u.immconst_data[3]);
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
sprintf(register_name, "uvec4(%#xu, %#xu, %#xu, %#xu)",
reg->u.immconst_data[0], reg->u.immconst_data[1],
reg->u.immconst_data[2], reg->u.immconst_data[3]);
@@ -3323,22 +3319,22 @@ static void shader_glsl_get_swizzle(const struct wined3d_shader_src_param *param
}
static void shader_glsl_sprintf_cast(struct wined3d_string_buffer *dst_param, const char *src_param,
- enum wined3d_data_type dst_data_type, enum wined3d_data_type src_data_type)
+ enum wined3d_component_type dst_type, enum wined3d_component_type src_type)
{
- if (dst_data_type == src_data_type)
+ if (dst_type == src_type)
{
string_buffer_sprintf(dst_param, "%s", src_param);
return;
}
- if (src_data_type == WINED3D_DATA_FLOAT)
+ if (src_type == WINED3D_TYPE_FLOAT)
{
- switch (dst_data_type)
+ switch (dst_type)
{
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
string_buffer_sprintf(dst_param, "floatBitsToInt(%s)", src_param);
return;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
string_buffer_sprintf(dst_param, "floatBitsToUint(%s)", src_param);
return;
default:
@@ -3346,19 +3342,19 @@ static void shader_glsl_sprintf_cast(struct wined3d_string_buffer *dst_param, co
}
}
- if (src_data_type == WINED3D_DATA_UINT && dst_data_type == WINED3D_DATA_FLOAT)
+ if (src_type == WINED3D_TYPE_UINT && dst_type == WINED3D_TYPE_FLOAT)
{
string_buffer_sprintf(dst_param, "uintBitsToFloat(%s)", src_param);
return;
}
- if (src_data_type == WINED3D_DATA_INT && dst_data_type == WINED3D_DATA_FLOAT)
+ if (src_type == WINED3D_TYPE_INT && dst_type == WINED3D_TYPE_FLOAT)
{
string_buffer_sprintf(dst_param, "intBitsToFloat(%s)", src_param);
return;
}
- FIXME("Unhandled cast from %#x to %#x.\n", src_data_type, dst_data_type);
+ FIXME("Unhandled cast from %#x to %#x.\n", src_type, dst_type);
string_buffer_sprintf(dst_param, "%s", src_param);
}
@@ -3367,11 +3363,11 @@ static void shader_glsl_sprintf_cast(struct wined3d_string_buffer *dst_param, co
* caller needs this information as well. */
static void shader_glsl_add_src_param_ext(const struct wined3d_shader_instruction *ins,
const struct wined3d_shader_src_param *wined3d_src, DWORD mask, struct glsl_src_param *glsl_src,
- enum wined3d_data_type data_type)
+ enum wined3d_component_type data_type)
{
struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data;
struct wined3d_string_buffer *reg_name = string_buffer_get(priv->string_buffers);
- enum wined3d_data_type param_data_type;
+ enum wined3d_component_type param_data_type;
BOOL is_color = FALSE;
char swizzle_str[6];
@@ -3396,10 +3392,10 @@ static void shader_glsl_add_src_param_ext(const struct wined3d_shader_instructio
case WINED3DSPR_PRIMID:
case WINED3DSPR_THREADGROUPID:
case WINED3DSPR_THREADID:
- param_data_type = WINED3D_DATA_INT;
+ param_data_type = WINED3D_TYPE_INT;
break;
default:
- param_data_type = WINED3D_DATA_FLOAT;
+ param_data_type = WINED3D_TYPE_FLOAT;
break;
}
@@ -3434,7 +3430,7 @@ static DWORD shader_glsl_add_dst_param(const struct wined3d_shader_instruction *
/* Append the destination part of the instruction to the buffer, return the effective write mask */
static DWORD shader_glsl_append_dst_ext(struct wined3d_string_buffer *buffer,
const struct wined3d_shader_instruction *ins, const struct wined3d_shader_dst_param *dst,
- enum wined3d_data_type data_type)
+ enum wined3d_component_type data_type)
{
struct glsl_dst_param glsl_dst;
DWORD mask;
@@ -3443,15 +3439,15 @@ static DWORD shader_glsl_append_dst_ext(struct wined3d_string_buffer *buffer,
{
switch (data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
shader_addline(buffer, "%s%s = %s(",
glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]);
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
shader_addline(buffer, "%s%s = %sintBitsToFloat(",
glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]);
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
shader_addline(buffer, "%s%s = %suintBitsToFloat(",
glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]);
break;
@@ -4013,7 +4009,7 @@ static void shader_glsl_udiv(const struct wined3d_shader_instruction *ins)
shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param);
shader_addline(buffer, "%s %% %s);\n", src0_param.param_str, src1_param.param_str);
- shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], WINED3D_DATA_FLOAT);
+ shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], WINED3D_TYPE_FLOAT);
shader_addline(buffer, "tmp0%s);\n", dst_mask);
}
else
@@ -4291,7 +4287,7 @@ static void shader_glsl_bitwise_op(const struct wined3d_shader_instruction *ins)
dst.write_mask = ins->dst[0].write_mask & (WINED3DSP_WRITEMASK_0 << i);
if (tmp_dst && (write_mask = shader_glsl_get_write_mask(&dst, mask_char)))
shader_addline(buffer, "tmp0%s = %sBitsToFloat(", mask_char,
- dst.reg.data_type == WINED3D_DATA_INT ? "int" : "uint");
+ dst.reg.data_type == WINED3D_TYPE_INT ? "int" : "uint");
else if (!(write_mask = shader_glsl_append_dst_ext(buffer, ins, &dst, dst.reg.data_type)))
continue;
@@ -4305,7 +4301,7 @@ static void shader_glsl_bitwise_op(const struct wined3d_shader_instruction *ins)
if (tmp_dst)
{
- shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], WINED3D_DATA_FLOAT);
+ shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], WINED3D_TYPE_FLOAT);
shader_glsl_get_write_mask(&ins->dst[0], mask_char);
shader_addline(buffer, "tmp0%s);\n", mask_char);
}
@@ -5445,7 +5441,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
struct wined3d_string_buffer *buffer = ins->ctx->buffer;
enum wined3d_shader_resource_type resource_type;
struct wined3d_string_buffer *address;
- enum wined3d_data_type data_type;
+ enum wined3d_component_type data_type;
unsigned int resource_idx, stride;
const char *op, *resource;
DWORD coord_mask;
@@ -5461,7 +5457,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
return;
}
resource = "g";
- data_type = WINED3D_DATA_UINT;
+ data_type = WINED3D_TYPE_UINT;
coord_mask = 1;
stride = reg_maps->tgsm[resource_idx].stride;
}
@@ -5513,7 +5509,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
op = "atomicMax";
else
op = "imageAtomicMax";
- if (data_type != WINED3D_DATA_INT)
+ if (data_type != WINED3D_TYPE_INT)
{
FIXME("Unhandled opcode %#x for unsigned integers.\n", ins->handler_idx);
return;
@@ -5525,7 +5521,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
op = "atomicMin";
else
op = "imageAtomicMin";
- if (data_type != WINED3D_DATA_INT)
+ if (data_type != WINED3D_TYPE_INT)
{
FIXME("Unhandled opcode %#x for unsigned integers.\n", ins->handler_idx);
return;
@@ -5544,7 +5540,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
op = "atomicMax";
else
op = "imageAtomicMax";
- if (data_type != WINED3D_DATA_UINT)
+ if (data_type != WINED3D_TYPE_UINT)
{
FIXME("Unhandled opcode %#x for signed integers.\n", ins->handler_idx);
return;
@@ -5556,7 +5552,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
op = "atomicMin";
else
op = "imageAtomicMin";
- if (data_type != WINED3D_DATA_UINT)
+ if (data_type != WINED3D_TYPE_UINT)
{
FIXME("Unhandled opcode %#x for signed integers.\n", ins->handler_idx);
return;
@@ -5640,7 +5636,7 @@ static void shader_glsl_ld_uav(const struct wined3d_shader_instruction *ins)
const struct wined3d_shader_version *version = ®_maps->shader_version;
enum wined3d_shader_resource_type resource_type;
struct glsl_src_param image_coord_param;
- enum wined3d_data_type data_type;
+ enum wined3d_component_type data_type;
DWORD coord_mask, write_mask;
unsigned int uav_idx;
char dst_swizzle[6];
@@ -5761,7 +5757,7 @@ static void shader_glsl_store_uav(const struct wined3d_shader_instruction *ins)
const struct wined3d_shader_version *version = ®_maps->shader_version;
struct glsl_src_param image_coord_param, image_data_param;
enum wined3d_shader_resource_type resource_type;
- enum wined3d_data_type data_type;
+ enum wined3d_component_type data_type;
unsigned int uav_idx;
DWORD coord_mask;
@@ -5951,7 +5947,7 @@ static void shader_glsl_resinfo(const struct wined3d_shader_instruction *ins)
enum wined3d_shader_resource_type resource_type;
enum wined3d_shader_register_type reg_type;
unsigned int resource_idx, bind_idx, i;
- enum wined3d_data_type dst_data_type;
+ enum wined3d_component_type dst_data_type;
struct glsl_src_param lod_param;
BOOL supports_mipmaps;
char dst_swizzle[6];
@@ -5959,7 +5955,7 @@ static void shader_glsl_resinfo(const struct wined3d_shader_instruction *ins)
dst_data_type = ins->dst[0].reg.data_type;
if (ins->flags == WINED3DSI_RESINFO_UINT)
- dst_data_type = WINED3D_DATA_UINT;
+ dst_data_type = WINED3D_TYPE_UINT;
else if (ins->flags)
FIXME("Unhandled flags %#x.\n", ins->flags);
@@ -5987,7 +5983,7 @@ static void shader_glsl_resinfo(const struct wined3d_shader_instruction *ins)
write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], dst_data_type);
shader_glsl_get_swizzle(&ins->src[1], FALSE, write_mask, dst_swizzle);
- if (dst_data_type == WINED3D_DATA_UINT)
+ if (dst_data_type == WINED3D_TYPE_UINT)
shader_addline(buffer, "uvec4(");
else
shader_addline(buffer, "vec4(");
@@ -6040,21 +6036,21 @@ static void shader_glsl_sample_info(const struct wined3d_shader_instruction *ins
const struct wined3d_shader_dst_param *dst = ins->dst;
const struct wined3d_shader_src_param *src = ins->src;
enum wined3d_shader_resource_type resource_type;
- enum wined3d_data_type dst_data_type;
+ enum wined3d_component_type dst_data_type;
unsigned int resource_idx, bind_idx;
char dst_swizzle[6];
DWORD write_mask;
dst_data_type = dst->reg.data_type;
if (ins->flags == WINED3DSI_SAMPLE_INFO_UINT)
- dst_data_type = WINED3D_DATA_UINT;
+ dst_data_type = WINED3D_TYPE_UINT;
else if (ins->flags)
FIXME("Unhandled flags %#x.\n", ins->flags);
write_mask = shader_glsl_append_dst_ext(buffer, ins, dst, dst_data_type);
shader_glsl_get_swizzle(src, FALSE, write_mask, dst_swizzle);
- if (dst_data_type == WINED3D_DATA_UINT)
+ if (dst_data_type == WINED3D_TYPE_UINT)
shader_addline(buffer, "uvec4(");
else
shader_addline(buffer, "vec4(");
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 44879f8b7c4..7c6b1243d79 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1030,6 +1030,23 @@ static HRESULT shader_scan_output_signature(struct wined3d_shader *shader)
return WINED3D_OK;
}
+static enum wined3d_component_type component_type_from_data_type(enum wined3d_data_type type)
+{
+ switch (type)
+ {
+ case WINED3D_DATA_FLOAT:
+ case WINED3D_DATA_UNORM:
+ case WINED3D_DATA_SNORM:
+ return WINED3D_TYPE_FLOAT;
+ case WINED3D_DATA_INT:
+ return WINED3D_TYPE_INT;
+ case WINED3D_DATA_UINT:
+ return WINED3D_TYPE_UINT;
+ }
+ ERR("Unexpected data type %u.\n", type);
+ return WINED3D_TYPE_FLOAT;
+}
+
/* Note that this does not count the loop register as an address register. */
static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD constf_size)
{
@@ -1128,7 +1145,8 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
break;
}
reg_maps->resource_info[reg_idx].type = semantic->resource_type;
- reg_maps->resource_info[reg_idx].data_type = semantic->resource_data_type;
+ reg_maps->resource_info[reg_idx].data_type =
+ component_type_from_data_type(semantic->resource_data_type);
break;
case WINED3DSPR_UAV:
@@ -1138,7 +1156,8 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
break;
}
reg_maps->uav_resource_info[reg_idx].type = semantic->resource_type;
- reg_maps->uav_resource_info[reg_idx].data_type = semantic->resource_data_type;
+ reg_maps->uav_resource_info[reg_idx].data_type =
+ component_type_from_data_type(semantic->resource_data_type);
if (ins.flags)
FIXME("Ignoring typed UAV flags %#x.\n", ins.flags);
break;
@@ -1270,7 +1289,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
break;
}
reg_maps->resource_info[reg_idx].type = WINED3D_SHADER_RESOURCE_BUFFER;
- reg_maps->resource_info[reg_idx].data_type = WINED3D_DATA_UINT;
+ reg_maps->resource_info[reg_idx].data_type = WINED3D_TYPE_UINT;
reg_maps->resource_info[reg_idx].flags = WINED3D_VIEW_BUFFER_RAW;
}
else if (ins.handler_idx == WINED3DSIH_DCL_RESOURCE_STRUCTURED)
@@ -1282,7 +1301,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
break;
}
reg_maps->resource_info[reg_idx].type = WINED3D_SHADER_RESOURCE_BUFFER;
- reg_maps->resource_info[reg_idx].data_type = WINED3D_DATA_UINT;
+ reg_maps->resource_info[reg_idx].data_type = WINED3D_TYPE_UINT;
reg_maps->resource_info[reg_idx].flags = 0;
reg_maps->resource_info[reg_idx].stride = ins.declaration.structured_resource.byte_stride / 4;
}
@@ -1356,7 +1375,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
if (ins.flags)
FIXME("Ignoring raw UAV flags %#x.\n", ins.flags);
reg_maps->uav_resource_info[reg_idx].type = WINED3D_SHADER_RESOURCE_BUFFER;
- reg_maps->uav_resource_info[reg_idx].data_type = WINED3D_DATA_UINT;
+ reg_maps->uav_resource_info[reg_idx].data_type = WINED3D_TYPE_UINT;
reg_maps->uav_resource_info[reg_idx].flags = WINED3D_VIEW_BUFFER_RAW;
}
else if (ins.handler_idx == WINED3DSIH_DCL_UAV_STRUCTURED)
@@ -1370,7 +1389,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
if (ins.flags)
FIXME("Ignoring structured UAV flags %#x.\n", ins.flags);
reg_maps->uav_resource_info[reg_idx].type = WINED3D_SHADER_RESOURCE_BUFFER;
- reg_maps->uav_resource_info[reg_idx].data_type = WINED3D_DATA_UINT;
+ reg_maps->uav_resource_info[reg_idx].data_type = WINED3D_TYPE_UINT;
reg_maps->uav_resource_info[reg_idx].flags = 0;
reg_maps->uav_resource_info[reg_idx].stride = ins.declaration.structured_resource.byte_stride / 4;
}
@@ -1609,7 +1628,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
TRACE("Setting fake 2D resource for 1.x pixelshader.\n");
reg_maps->resource_info[reg_idx].type = WINED3D_SHADER_RESOURCE_TEXTURE_2D;
- reg_maps->resource_info[reg_idx].data_type = WINED3D_DATA_FLOAT;
+ reg_maps->resource_info[reg_idx].data_type = WINED3D_TYPE_FLOAT;
shader_record_sample(reg_maps, reg_idx, reg_idx, reg_idx);
/* texbem is only valid with < 1.4 pixel shaders */
@@ -2442,13 +2461,13 @@ static void shader_dump_register(struct wined3d_string_buffer *buffer,
case WINED3D_IMMCONST_SCALAR:
switch (reg->data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
shader_addline(buffer, "%.8e", *(const float *)reg->u.immconst_data);
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
shader_addline(buffer, "%d", reg->u.immconst_data[0]);
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
shader_addline(buffer, "%u", reg->u.immconst_data[0]);
break;
default:
@@ -2460,17 +2479,17 @@ static void shader_dump_register(struct wined3d_string_buffer *buffer,
case WINED3D_IMMCONST_VEC4:
switch (reg->data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
shader_addline(buffer, "%.8e, %.8e, %.8e, %.8e",
*(const float *)®->u.immconst_data[0], *(const float *)®->u.immconst_data[1],
*(const float *)®->u.immconst_data[2], *(const float *)®->u.immconst_data[3]);
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
shader_addline(buffer, "%d, %d, %d, %d",
reg->u.immconst_data[0], reg->u.immconst_data[1],
reg->u.immconst_data[2], reg->u.immconst_data[3]);
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
shader_addline(buffer, "%u, %u, %u, %u",
reg->u.immconst_data[0], reg->u.immconst_data[1],
reg->u.immconst_data[2], reg->u.immconst_data[3]);
diff --git a/dlls/wined3d/shader_sm1.c b/dlls/wined3d/shader_sm1.c
index 0c6bb933174..b57b67b8dcc 100644
--- a/dlls/wined3d/shader_sm1.c
+++ b/dlls/wined3d/shader_sm1.c
@@ -468,7 +468,7 @@ static void shader_parse_src_param(DWORD param, const struct wined3d_shader_src_
{
src->reg.type = ((param & WINED3D_SM1_REGISTER_TYPE_MASK) >> WINED3D_SM1_REGISTER_TYPE_SHIFT)
| ((param & WINED3D_SM1_REGISTER_TYPE_MASK2) >> WINED3D_SM1_REGISTER_TYPE_SHIFT2);
- src->reg.data_type = WINED3D_DATA_FLOAT;
+ src->reg.data_type = WINED3D_TYPE_FLOAT;
src->reg.idx[0].offset = param & WINED3D_SM1_REGISTER_NUMBER_MASK;
src->reg.idx[0].rel_addr = rel_addr;
src->reg.idx[1].offset = ~0U;
@@ -482,7 +482,7 @@ static void shader_parse_dst_param(DWORD param, const struct wined3d_shader_src_
{
dst->reg.type = ((param & WINED3D_SM1_REGISTER_TYPE_MASK) >> WINED3D_SM1_REGISTER_TYPE_SHIFT)
| ((param & WINED3D_SM1_REGISTER_TYPE_MASK2) >> WINED3D_SM1_REGISTER_TYPE_SHIFT2);
- dst->reg.data_type = WINED3D_DATA_FLOAT;
+ dst->reg.data_type = WINED3D_TYPE_FLOAT;
dst->reg.idx[0].offset = param & WINED3D_SM1_REGISTER_NUMBER_MASK;
dst->reg.idx[0].rel_addr = rel_addr;
dst->reg.idx[1].offset = ~0U;
@@ -645,12 +645,12 @@ static void shader_sm1_read_semantic(const DWORD **ptr, struct wined3d_shader_se
{
semantic->resource_type = resource_type_table[resource_type];
}
- semantic->resource_data_type = WINED3D_DATA_FLOAT;
+ semantic->resource_data_type = WINED3D_TYPE_FLOAT;
shader_parse_dst_param(dst_token, NULL, &semantic->reg);
}
static void shader_sm1_read_immconst(const DWORD **ptr, struct wined3d_shader_src_param *src_param,
- enum wined3d_immconst_type type, enum wined3d_data_type data_type)
+ enum wined3d_immconst_type type, enum wined3d_component_type data_type)
{
unsigned int count = type == WINED3D_IMMCONST_VEC4 ? 4 : 1;
src_param->reg.type = WINED3DSPR_IMMCONST;
@@ -761,17 +761,17 @@ static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wi
else if (ins->handler_idx == WINED3DSIH_DEF)
{
shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr);
- shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_VEC4, WINED3D_DATA_FLOAT);
+ shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_VEC4, WINED3D_TYPE_FLOAT);
}
else if (ins->handler_idx == WINED3DSIH_DEFB)
{
shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr);
- shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_SCALAR, WINED3D_DATA_UINT);
+ shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_SCALAR, WINED3D_TYPE_UINT);
}
else if (ins->handler_idx == WINED3DSIH_DEFI)
{
shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr);
- shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_VEC4, WINED3D_DATA_INT);
+ shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_VEC4, WINED3D_TYPE_INT);
}
else
{
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index acde7a56d1c..7508dda4e07 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -517,15 +517,15 @@ static const enum wined3d_data_type data_type_table[] =
};
static BOOL shader_sm4_read_src_param(struct wined3d_sm4_data *priv, const DWORD **ptr, const DWORD *end,
- enum wined3d_data_type data_type, struct wined3d_shader_src_param *src_param);
+ enum wined3d_component_type data_type, struct wined3d_shader_src_param *src_param);
static BOOL shader_sm4_read_dst_param(struct wined3d_sm4_data *priv, const DWORD **ptr, const DWORD *end,
- enum wined3d_data_type data_type, struct wined3d_shader_dst_param *dst_param);
+ enum wined3d_component_type data_type, struct wined3d_shader_dst_param *dst_param);
static void shader_sm4_read_conditional_op(struct wined3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &priv->src_param[0]);
+ shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT, &priv->src_param[0]);
ins->flags = (opcode_token & WINED3D_SM4_CONDITIONAL_NZ) ?
WINED3D_SHADER_CONDITIONAL_OP_NZ : WINED3D_SHADER_CONDITIONAL_OP_Z;
}
@@ -579,7 +579,7 @@ static void shader_sm4_read_dcl_resource(struct wined3d_shader_instruction *ins,
ins->declaration.semantic.resource_type = resource_type_table[resource_type];
}
uav = opcode != WINED3D_SM4_OP_DCL_RESOURCE;
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.semantic.reg);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT, &ins->declaration.semantic.reg);
components = *tokens++;
if ((components & 0xfff0) != (components & 0xf) * 0x1110)
@@ -589,7 +589,7 @@ static void shader_sm4_read_dcl_resource(struct wined3d_shader_instruction *ins,
if (!data_type || (data_type >= ARRAY_SIZE(data_type_table)))
{
FIXME("Unhandled data type %#x.\n", data_type);
- ins->declaration.semantic.resource_data_type = WINED3D_DATA_FLOAT;
+ ins->declaration.semantic.resource_data_type = WINED3D_TYPE_FLOAT;
}
else
{
@@ -604,7 +604,7 @@ static void shader_sm4_read_dcl_constant_buffer(struct wined3d_shader_instructio
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT, &ins->declaration.src);
+ shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT, &ins->declaration.src);
if (opcode_token & WINED3D_SM4_INDEX_TYPE_MASK)
ins->flags |= WINED3DSI_INDEXED_DYNAMIC;
}
@@ -616,14 +616,14 @@ static void shader_sm4_read_dcl_sampler(struct wined3d_shader_instruction *ins,
ins->flags = (opcode_token & WINED3D_SM4_SAMPLER_MODE_MASK) >> WINED3D_SM4_SAMPLER_MODE_SHIFT;
if (ins->flags & ~WINED3D_SM4_SAMPLER_COMPARISON)
FIXME("Unhandled sampler mode %#x.\n", ins->flags);
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT, &ins->declaration.dst);
}
static void shader_sm4_read_dcl_index_range(struct wined3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT,
&ins->declaration.index_range.first_register);
ins->declaration.index_range.last_register = *tokens;
}
@@ -680,14 +680,14 @@ static void shader_sm4_read_declaration_dst(struct wined3d_shader_instruction *i
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT, &ins->declaration.dst);
}
static void shader_sm4_read_declaration_register_semantic(struct wined3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT,
&ins->declaration.register_semantic.reg);
ins->declaration.register_semantic.sysval_semantic = *tokens;
}
@@ -697,7 +697,7 @@ static void shader_sm4_read_dcl_input_ps(struct wined3d_shader_instruction *ins,
struct wined3d_sm4_data *priv)
{
ins->flags = (opcode_token & WINED3D_SM4_INTERPOLATION_MODE_MASK) >> WINED3D_SM4_INTERPOLATION_MODE_SHIFT;
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT, &ins->declaration.dst);
}
static void shader_sm4_read_dcl_input_ps_siv(struct wined3d_shader_instruction *ins,
@@ -705,7 +705,7 @@ static void shader_sm4_read_dcl_input_ps_siv(struct wined3d_shader_instruction *
struct wined3d_sm4_data *priv)
{
ins->flags = (opcode_token & WINED3D_SM4_INTERPOLATION_MODE_MASK) >> WINED3D_SM4_INTERPOLATION_MODE_SHIFT;
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT,
&ins->declaration.register_semantic.reg);
ins->declaration.register_semantic.sysval_semantic = *tokens;
}
@@ -731,7 +731,7 @@ static void shader_sm5_read_fcall(struct wined3d_shader_instruction *ins,
struct wined3d_sm4_data *priv)
{
priv->src_param[0].reg.u.fp_body_idx = *tokens++;
- shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &priv->src_param[0]);
+ shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT, &priv->src_param[0]);
}
static void shader_sm5_read_dcl_function_body(struct wined3d_shader_instruction *ins,
@@ -812,7 +812,7 @@ static void shader_sm5_read_dcl_uav_raw(struct wined3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT, &ins->declaration.dst);
ins->flags = (opcode_token & WINED3D_SM5_UAV_FLAGS_MASK) >> WINED3D_SM5_UAV_FLAGS_SHIFT;
}
@@ -820,7 +820,7 @@ static void shader_sm5_read_dcl_uav_structured(struct wined3d_shader_instruction
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT,
&ins->declaration.structured_resource.reg);
ins->flags = (opcode_token & WINED3D_SM5_UAV_FLAGS_MASK) >> WINED3D_SM5_UAV_FLAGS_SHIFT;
ins->declaration.structured_resource.byte_stride = *tokens;
@@ -832,7 +832,7 @@ static void shader_sm5_read_dcl_tgsm_raw(struct wined3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT, &ins->declaration.tgsm_raw.reg);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT, &ins->declaration.tgsm_raw.reg);
ins->declaration.tgsm_raw.byte_count = *tokens;
if (ins->declaration.tgsm_raw.byte_count % 4)
FIXME("Byte count %u is not multiple of 4.\n", ins->declaration.tgsm_raw.byte_count);
@@ -842,7 +842,7 @@ static void shader_sm5_read_dcl_tgsm_structured(struct wined3d_shader_instructio
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT,
&ins->declaration.tgsm_structured.reg);
ins->declaration.tgsm_structured.byte_stride = *tokens++;
ins->declaration.tgsm_structured.structure_count = *tokens;
@@ -854,7 +854,7 @@ static void shader_sm5_read_dcl_resource_structured(struct wined3d_shader_instru
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT,
&ins->declaration.structured_resource.reg);
ins->declaration.structured_resource.byte_stride = *tokens;
if (ins->declaration.structured_resource.byte_stride % 4)
@@ -865,7 +865,7 @@ static void shader_sm5_read_dcl_resource_raw(struct wined3d_shader_instruction *
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT, &ins->declaration.dst);
}
static void shader_sm5_read_sync(struct wined3d_shader_instruction *ins,
@@ -1196,23 +1196,23 @@ static void map_register(const struct wined3d_sm4_data *priv, struct wined3d_sha
}
}
-static enum wined3d_data_type map_data_type(char t)
+static enum wined3d_component_type map_data_type(char t)
{
switch (t)
{
case 'f':
- return WINED3D_DATA_FLOAT;
+ return WINED3D_TYPE_FLOAT;
case 'i':
- return WINED3D_DATA_INT;
+ return WINED3D_TYPE_INT;
case 'u':
case 'O':
case 'R':
case 'S':
case 'U':
- return WINED3D_DATA_UINT;
+ return WINED3D_TYPE_UINT;
default:
ERR("Invalid data type '%c'.\n", t);
- return WINED3D_DATA_FLOAT;
+ return WINED3D_TYPE_FLOAT;
}
}
@@ -1376,7 +1376,7 @@ static BOOL shader_sm4_read_reg_idx(struct wined3d_sm4_data *priv, const DWORD *
reg_idx->offset = *(*ptr)++;
else
reg_idx->offset = 0;
- shader_sm4_read_src_param(priv, ptr, end, WINED3D_DATA_INT, rel_addr);
+ shader_sm4_read_src_param(priv, ptr, end, WINED3D_TYPE_INT, rel_addr);
}
else
{
@@ -1388,7 +1388,7 @@ static BOOL shader_sm4_read_reg_idx(struct wined3d_sm4_data *priv, const DWORD *
}
static BOOL shader_sm4_read_param(struct wined3d_sm4_data *priv, const DWORD **ptr, const DWORD *end,
- enum wined3d_data_type data_type, struct wined3d_shader_register *param,
+ enum wined3d_component_type data_type, struct wined3d_shader_register *param,
enum wined3d_shader_src_modifier *modifier)
{
enum wined3d_sm4_register_type register_type;
@@ -1520,7 +1520,7 @@ static BOOL shader_sm4_read_param(struct wined3d_sm4_data *priv, const DWORD **p
}
static BOOL shader_sm4_read_src_param(struct wined3d_sm4_data *priv, const DWORD **ptr, const DWORD *end,
- enum wined3d_data_type data_type, struct wined3d_shader_src_param *src_param)
+ enum wined3d_component_type data_type, struct wined3d_shader_src_param *src_param)
{
DWORD token;
@@ -1571,7 +1571,7 @@ static BOOL shader_sm4_read_src_param(struct wined3d_sm4_data *priv, const DWORD
}
static BOOL shader_sm4_read_dst_param(struct wined3d_sm4_data *priv, const DWORD **ptr, const DWORD *end,
- enum wined3d_data_type data_type, struct wined3d_shader_dst_param *dst_param)
+ enum wined3d_component_type data_type, struct wined3d_shader_dst_param *dst_param)
{
enum wined3d_shader_src_modifier modifier;
DWORD token;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b65288dc415..6aa1d497df1 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -933,7 +933,7 @@ struct wined3d_shader_version
struct wined3d_shader_resource_info
{
enum wined3d_shader_resource_type type;
- enum wined3d_data_type data_type;
+ enum wined3d_component_type data_type;
unsigned int flags;
unsigned int stride;
};
@@ -1071,7 +1071,7 @@ struct wined3d_shader_register_index
struct wined3d_shader_register
{
enum wined3d_shader_register_type type;
- enum wined3d_data_type data_type;
+ enum wined3d_component_type data_type;
struct wined3d_shader_register_index idx[2];
enum wined3d_immconst_type immconst_type;
union
--
2.16.4
More information about the wine-devel
mailing list