mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/d3d-asm: Always use '.' as decimal separator when printing doubles.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
aef9e9ea62
commit
cea9f19bd4
@ -765,12 +765,17 @@ static void shader_print_float_literal(struct vkd3d_d3d_asm_compiler *compiler,
|
||||
static void shader_print_double_literal(struct vkd3d_d3d_asm_compiler *compiler,
|
||||
const char *prefix, double d, const char *suffix)
|
||||
{
|
||||
const char *sign = "";
|
||||
|
||||
if (isfinite(d) && signbit(d))
|
||||
vkd3d_string_buffer_printf(&compiler->buffer, "%s-%s%.15e%s%s",
|
||||
prefix, compiler->colours.literal, -d, compiler->colours.reset, suffix);
|
||||
else
|
||||
vkd3d_string_buffer_printf(&compiler->buffer, "%s%s%.15e%s%s",
|
||||
prefix, compiler->colours.literal, d, compiler->colours.reset, suffix);
|
||||
{
|
||||
sign = "-";
|
||||
d = -d;
|
||||
}
|
||||
|
||||
vkd3d_string_buffer_printf(&compiler->buffer, "%s%s%s", prefix, sign, compiler->colours.literal);
|
||||
vkd3d_string_buffer_print_f64(&compiler->buffer, d);
|
||||
vkd3d_string_buffer_printf(&compiler->buffer, "%s%s", compiler->colours.reset, suffix);
|
||||
}
|
||||
|
||||
static void shader_print_int_literal(struct vkd3d_d3d_asm_compiler *compiler,
|
||||
|
@ -107,6 +107,21 @@ int vkd3d_string_buffer_print_f32(struct vkd3d_string_buffer *buffer, float f)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int vkd3d_string_buffer_print_f64(struct vkd3d_string_buffer *buffer, double d)
|
||||
{
|
||||
unsigned int idx = buffer->content_size + 1;
|
||||
int ret;
|
||||
|
||||
if (!(ret = vkd3d_string_buffer_printf(buffer, "%.16e", d)) && isfinite(d))
|
||||
{
|
||||
if (signbit(d))
|
||||
++idx;
|
||||
buffer->buffer[idx] = '.';
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void vkd3d_string_buffer_trace_(const struct vkd3d_string_buffer *buffer, const char *function)
|
||||
{
|
||||
vkd3d_shader_trace_text_(buffer->buffer, buffer->content_size, function);
|
||||
|
@ -994,6 +994,7 @@ 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);
|
||||
int vkd3d_string_buffer_print_f32(struct vkd3d_string_buffer *buffer, float f);
|
||||
int vkd3d_string_buffer_print_f64(struct vkd3d_string_buffer *buffer, double d);
|
||||
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);
|
||||
#define vkd3d_string_buffer_trace(buffer) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user