From c099f3a0607f9e6bfbd7adf4692c42d8ed5dce6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Tue, 15 Mar 2016 10:52:47 +0100 Subject: [PATCH] wined3d: Introduce debug_color(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/device.c | 39 +++++++++++++--------------------- dlls/wined3d/state.c | 18 +++++----------- dlls/wined3d/utils.c | 8 +++++++ dlls/wined3d/wined3d_private.h | 1 + 4 files changed, 29 insertions(+), 37 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index d0321842fde..53e64203ee4 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1559,14 +1559,13 @@ HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, } /* Initialize the object. */ - TRACE("Light %d setting to type %d, Diffuse(%f,%f,%f,%f), Specular(%f,%f,%f,%f), Ambient(%f,%f,%f,%f)\n", - light_idx, light->type, - light->diffuse.r, light->diffuse.g, light->diffuse.b, light->diffuse.a, - light->specular.r, light->specular.g, light->specular.b, light->specular.a, - light->ambient.r, light->ambient.g, light->ambient.b, light->ambient.a); - TRACE("... Pos(%f,%f,%f), Dir(%f,%f,%f)\n", light->position.x, light->position.y, light->position.z, - light->direction.x, light->direction.y, light->direction.z); - TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n", + TRACE("Light %u setting to type %#x, diffuse %s, specular %s, ambient %s, " + "position {%.8e, %.8e, %.8e}, direction {%.8e, %.8e, %.8e}, " + "range %.8e, falloff %.8e, theta %.8e, phi %.8e.\n", + light_idx, light->type, debug_color(&light->diffuse), + debug_color(&light->specular), debug_color(&light->ambient), + light->position.x, light->position.y, light->position.z, + light->direction.x, light->direction.y, light->direction.z, light->range, light->falloff, light->theta, light->phi); /* Update the live definitions if the light is currently assigned a glIndex. */ @@ -1900,18 +1899,10 @@ void CDECL wined3d_device_get_material(const struct wined3d_device *device, stru *material = device->state.material; - TRACE("diffuse {%.8e, %.8e, %.8e, %.8e}\n", - material->diffuse.r, material->diffuse.g, - material->diffuse.b, material->diffuse.a); - TRACE("ambient {%.8e, %.8e, %.8e, %.8e}\n", - material->ambient.r, material->ambient.g, - material->ambient.b, material->ambient.a); - TRACE("specular {%.8e, %.8e, %.8e, %.8e}\n", - material->specular.r, material->specular.g, - material->specular.b, material->specular.a); - TRACE("emissive {%.8e, %.8e, %.8e, %.8e}\n", - material->emissive.r, material->emissive.g, - material->emissive.b, material->emissive.a); + TRACE("diffuse %s\n", debug_color(&material->diffuse)); + TRACE("ambient %s\n", debug_color(&material->ambient)); + TRACE("specular %s\n", debug_color(&material->specular)); + TRACE("emissive %s\n", debug_color(&material->emissive)); TRACE("power %.8e.\n", material->power); } @@ -3373,8 +3364,8 @@ HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { - TRACE("device %p, rect_count %u, rects %p, flags %#x, color {%.8e, %.8e, %.8e, %.8e}, depth %.8e, stencil %u.\n", - device, rect_count, rects, flags, color->r, color->g, color->b, color->a, depth, stencil); + TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n", + device, rect_count, rects, flags, debug_color(color), depth, stencil); if (!rect_count && rects) { @@ -4092,8 +4083,8 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi struct wined3d_resource *resource; RECT r; - TRACE("device %p, view %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n", - device, view, wine_dbgstr_rect(rect), color->r, color->g, color->b, color->a); + TRACE("device %p, view %p, rect %s, color %s.\n", + device, view, wine_dbgstr_rect(rect), debug_color(color)); resource = view->resource; if (resource->type != WINED3D_RTYPE_TEXTURE_2D) diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 55e91c5791c..ec49d568d2e 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -263,7 +263,7 @@ static void state_ambient(struct wined3d_context *context, const struct wined3d_ struct wined3d_color color; wined3d_color_from_d3dcolor(&color, state->render_states[WINED3D_RS_AMBIENT]); - TRACE("Setting ambient to {%.8e, %.8e, %.8e, %.8e}.\n", color.r, color.g, color.b, color.a); + TRACE("Setting ambient to %s.\n", debug_color(&color)); gl_info->gl_ops.gl.p_glLightModelfv(GL_LIGHT_MODEL_AMBIENT, &color.r); checkGLcall("glLightModel for MODEL_AMBIENT"); } @@ -712,18 +712,10 @@ static void state_specularenable(struct wined3d_context *context, const struct w } } - TRACE("diffuse {%.8e, %.8e, %.8e, %.8e}\n", - state->material.diffuse.r, state->material.diffuse.g, - state->material.diffuse.b, state->material.diffuse.a); - TRACE("ambient {%.8e, %.8e, %.8e, %.8e}\n", - state->material.ambient.r, state->material.ambient.g, - state->material.ambient.b, state->material.ambient.a); - TRACE("specular {%.8e, %.8e, %.8e, %.8e}\n", - state->material.specular.r, state->material.specular.g, - state->material.specular.b, state->material.specular.a); - TRACE("emissive {%.8e, %.8e, %.8e, %.8e}\n", - state->material.emissive.r, state->material.emissive.g, - state->material.emissive.b, state->material.emissive.a); + TRACE("diffuse %s\n", debug_color(&state->material.diffuse)); + TRACE("ambient %s\n", debug_color(&state->material.ambient)); + TRACE("specular %s\n", debug_color(&state->material.specular)); + TRACE("emissive %s\n", debug_color(&state->material.emissive)); gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.ambient); checkGLcall("glMaterialfv(GL_AMBIENT)"); diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 5cd482e6ba0..e210a8aefb7 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -3278,6 +3278,14 @@ const char *debug_box(const struct wined3d_box *box) box->right, box->bottom, box->back); } +const char *debug_color(const struct wined3d_color *color) +{ + if (!color) + return "(null)"; + return wine_dbg_sprintf("{%.8e, %.8e, %.8e, %.8e}", + color->r, color->g, color->b, color->a); +} + const char *debug_d3dformat(enum wined3d_format_id format_id) { switch (format_id) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index df16d636beb..ec7de5a1faa 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2991,6 +2991,7 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPE /* Trace routines */ const char *debug_box(const struct wined3d_box *box) DECLSPEC_HIDDEN; +const char *debug_color(const struct wined3d_color *color) DECLSPEC_HIDDEN; const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx) DECLSPEC_HIDDEN; const char *debug_d3dformat(enum wined3d_format_id format_id) DECLSPEC_HIDDEN; const char *debug_d3ddevicetype(enum wined3d_device_type device_type) DECLSPEC_HIDDEN;