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 floats.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4728cf1286
commit
aef9e9ea62
@ -749,12 +749,17 @@ static void shader_dump_src_param(struct vkd3d_d3d_asm_compiler *compiler,
|
|||||||
static void shader_print_float_literal(struct vkd3d_d3d_asm_compiler *compiler,
|
static void shader_print_float_literal(struct vkd3d_d3d_asm_compiler *compiler,
|
||||||
const char *prefix, float f, const char *suffix)
|
const char *prefix, float f, const char *suffix)
|
||||||
{
|
{
|
||||||
|
const char *sign = "";
|
||||||
|
|
||||||
if (isfinite(f) && signbit(f))
|
if (isfinite(f) && signbit(f))
|
||||||
vkd3d_string_buffer_printf(&compiler->buffer, "%s-%s%.8e%s%s",
|
{
|
||||||
prefix, compiler->colours.literal, -f, compiler->colours.reset, suffix);
|
sign = "-";
|
||||||
else
|
f = -f;
|
||||||
vkd3d_string_buffer_printf(&compiler->buffer, "%s%s%.8e%s%s",
|
}
|
||||||
prefix, compiler->colours.literal, f, compiler->colours.reset, suffix);
|
|
||||||
|
vkd3d_string_buffer_printf(&compiler->buffer, "%s%s%s", prefix, sign, compiler->colours.literal);
|
||||||
|
vkd3d_string_buffer_print_f32(&compiler->buffer, f);
|
||||||
|
vkd3d_string_buffer_printf(&compiler->buffer, "%s%s", compiler->colours.reset, suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shader_print_double_literal(struct vkd3d_d3d_asm_compiler *compiler,
|
static void shader_print_double_literal(struct vkd3d_d3d_asm_compiler *compiler,
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "vkd3d_version.h"
|
#include "vkd3d_version.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
VKD3D_DEBUG_ENV_NAME("VKD3D_SHADER_DEBUG");
|
VKD3D_DEBUG_ENV_NAME("VKD3D_SHADER_DEBUG");
|
||||||
|
|
||||||
@ -91,6 +92,21 @@ int vkd3d_string_buffer_printf(struct vkd3d_string_buffer *buffer, const char *f
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int vkd3d_string_buffer_print_f32(struct vkd3d_string_buffer *buffer, float f)
|
||||||
|
{
|
||||||
|
unsigned int idx = buffer->content_size + 1;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!(ret = vkd3d_string_buffer_printf(buffer, "%.8e", f)) && isfinite(f))
|
||||||
|
{
|
||||||
|
if (signbit(f))
|
||||||
|
++idx;
|
||||||
|
buffer->buffer[idx] = '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
void vkd3d_string_buffer_trace_(const struct vkd3d_string_buffer *buffer, const char *function)
|
void vkd3d_string_buffer_trace_(const struct vkd3d_string_buffer *buffer, const char *function)
|
||||||
{
|
{
|
||||||
vkd3d_shader_trace_text_(buffer->buffer, buffer->content_size, function);
|
vkd3d_shader_trace_text_(buffer->buffer, buffer->content_size, function);
|
||||||
|
@ -993,6 +993,7 @@ struct vkd3d_string_buffer *vkd3d_string_buffer_get(struct vkd3d_string_buffer_c
|
|||||||
void vkd3d_string_buffer_init(struct vkd3d_string_buffer *buffer);
|
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_cleanup(struct vkd3d_string_buffer_cache *list);
|
||||||
void vkd3d_string_buffer_cache_init(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_printf(struct vkd3d_string_buffer *buffer, const char *format, ...) VKD3D_PRINTF_FUNC(2, 3);
|
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);
|
void vkd3d_string_buffer_release(struct vkd3d_string_buffer_cache *list, struct vkd3d_string_buffer *buffer);
|
||||||
#define vkd3d_string_buffer_trace(buffer) \
|
#define vkd3d_string_buffer_trace(buffer) \
|
||||||
|
Loading…
Reference in New Issue
Block a user