From eb4d20ef3181c42741bad790e4ac87fa39f0b6b5 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 23 Sep 2012 22:14:49 +0200 Subject: [PATCH] wined3d: Take the data type of immediates into account in shader_glsl_get_register_name(). --- dlls/wined3d/glsl_shader.c | 44 ++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 5c0cdfbcde4..14d165be5ea 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1478,13 +1478,49 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * switch (reg->immconst_type) { case WINED3D_IMMCONST_SCALAR: - sprintf(register_name, "%.8e", *(const float *)reg->immconst_data); + switch (reg->data_type) + { + case WINED3D_DATA_FLOAT: + sprintf(register_name, "%.8e", *(const float *)reg->immconst_data); + break; + case WINED3D_DATA_INT: + sprintf(register_name, "%#x", reg->immconst_data[0]); + break; + case WINED3D_DATA_RESOURCE: + case WINED3D_DATA_SAMPLER: + case WINED3D_DATA_UINT: + sprintf(register_name, "%#xu", reg->immconst_data[0]); + break; + default: + sprintf(register_name, "", reg->data_type); + break; + } break; case WINED3D_IMMCONST_VEC4: - sprintf(register_name, "vec4(%.8e, %.8e, %.8e, %.8e)", - *(const float *)®->immconst_data[0], *(const float *)®->immconst_data[1], - *(const float *)®->immconst_data[2], *(const float *)®->immconst_data[3]); + switch (reg->data_type) + { + case WINED3D_DATA_FLOAT: + sprintf(register_name, "vec4(%.8e, %.8e, %.8e, %.8e)", + *(const float *)®->immconst_data[0], *(const float *)®->immconst_data[1], + *(const float *)®->immconst_data[2], *(const float *)®->immconst_data[3]); + break; + case WINED3D_DATA_INT: + sprintf(register_name, "ivec4(%#x, %#x, %#x, %#x)", + reg->immconst_data[0], reg->immconst_data[1], + reg->immconst_data[2], reg->immconst_data[3]); + break; + case WINED3D_DATA_RESOURCE: + case WINED3D_DATA_SAMPLER: + case WINED3D_DATA_UINT: + sprintf(register_name, "uvec4(%#xu, %#xu, %#xu, %#xu)", + reg->immconst_data[0], reg->immconst_data[1], + reg->immconst_data[2], reg->immconst_data[3]); + break; + default: + sprintf(register_name, "", reg->data_type); + break; + } break; default: