wined3d: Introduce debug_color().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-03-15 10:52:47 +01:00 committed by Alexandre Julliard
parent 4a8b305ed7
commit c099f3a060
4 changed files with 29 additions and 37 deletions

View File

@ -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)

View File

@ -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)");

View File

@ -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)

View File

@ -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;