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. */ /* 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", TRACE("Light %u setting to type %#x, diffuse %s, specular %s, ambient %s, "
light_idx, light->type, "position {%.8e, %.8e, %.8e}, direction {%.8e, %.8e, %.8e}, "
light->diffuse.r, light->diffuse.g, light->diffuse.b, light->diffuse.a, "range %.8e, falloff %.8e, theta %.8e, phi %.8e.\n",
light->specular.r, light->specular.g, light->specular.b, light->specular.a, light_idx, light->type, debug_color(&light->diffuse),
light->ambient.r, light->ambient.g, light->ambient.b, light->ambient.a); debug_color(&light->specular), debug_color(&light->ambient),
TRACE("... Pos(%f,%f,%f), Dir(%f,%f,%f)\n", light->position.x, light->position.y, light->position.z, light->position.x, light->position.y, light->position.z,
light->direction.x, light->direction.y, light->direction.z); light->direction.x, light->direction.y, light->direction.z,
TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n",
light->range, light->falloff, light->theta, light->phi); light->range, light->falloff, light->theta, light->phi);
/* Update the live definitions if the light is currently assigned a glIndex. */ /* 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; *material = device->state.material;
TRACE("diffuse {%.8e, %.8e, %.8e, %.8e}\n", TRACE("diffuse %s\n", debug_color(&material->diffuse));
material->diffuse.r, material->diffuse.g, TRACE("ambient %s\n", debug_color(&material->ambient));
material->diffuse.b, material->diffuse.a); TRACE("specular %s\n", debug_color(&material->specular));
TRACE("ambient {%.8e, %.8e, %.8e, %.8e}\n", TRACE("emissive %s\n", debug_color(&material->emissive));
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("power %.8e.\n", material->power); 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, 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) 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", TRACE("device %p, rect_count %u, rects %p, flags %#x, color %s, depth %.8e, stencil %u.\n",
device, rect_count, rects, flags, color->r, color->g, color->b, color->a, depth, stencil); device, rect_count, rects, flags, debug_color(color), depth, stencil);
if (!rect_count && rects) if (!rect_count && rects)
{ {
@ -4092,8 +4083,8 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
struct wined3d_resource *resource; struct wined3d_resource *resource;
RECT r; RECT r;
TRACE("device %p, view %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n", TRACE("device %p, view %p, rect %s, color %s.\n",
device, view, wine_dbgstr_rect(rect), color->r, color->g, color->b, color->a); device, view, wine_dbgstr_rect(rect), debug_color(color));
resource = view->resource; resource = view->resource;
if (resource->type != WINED3D_RTYPE_TEXTURE_2D) 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; struct wined3d_color color;
wined3d_color_from_d3dcolor(&color, state->render_states[WINED3D_RS_AMBIENT]); 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); gl_info->gl_ops.gl.p_glLightModelfv(GL_LIGHT_MODEL_AMBIENT, &color.r);
checkGLcall("glLightModel for MODEL_AMBIENT"); 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", TRACE("diffuse %s\n", debug_color(&state->material.diffuse));
state->material.diffuse.r, state->material.diffuse.g, TRACE("ambient %s\n", debug_color(&state->material.ambient));
state->material.diffuse.b, state->material.diffuse.a); TRACE("specular %s\n", debug_color(&state->material.specular));
TRACE("ambient {%.8e, %.8e, %.8e, %.8e}\n", TRACE("emissive %s\n", debug_color(&state->material.emissive));
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);
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.ambient); gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.ambient);
checkGLcall("glMaterialfv(GL_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); 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) const char *debug_d3dformat(enum wined3d_format_id format_id)
{ {
switch (format_id) switch (format_id)

View File

@ -2991,6 +2991,7 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPE
/* Trace routines */ /* Trace routines */
const char *debug_box(const struct wined3d_box *box) DECLSPEC_HIDDEN; 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_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_d3dformat(enum wined3d_format_id format_id) DECLSPEC_HIDDEN;
const char *debug_d3ddevicetype(enum wined3d_device_type device_type) DECLSPEC_HIDDEN; const char *debug_d3ddevicetype(enum wined3d_device_type device_type) DECLSPEC_HIDDEN;