debug: Add flag and function for texture logging

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Jakob Bornecrantz <jakob@collabora.com>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
macos/master
Gert Wollny 6 years ago committed by Jakob Bornecrantz
parent 40db85e7ee
commit cbb6a487c9
  1. 1
      src/vrend_debug.c
  2. 1
      src/vrend_debug.h
  3. 35
      src/vrend_renderer.c

@ -111,6 +111,7 @@ static const struct debug_named_value vrend_debug_options[] = {
{"blit", dbg_blit, "Debug blit code path"},
{"copyres", dbg_copy_resource, "Debug copy resource code path"},
{"feat", dbg_features, "Log features found"},
{"tex", dbg_tex, "Log texture operations"},
DEBUG_NAMED_VALUE_END
};

@ -40,6 +40,7 @@ enum virgl_debug_flags {
dbg_blit = 1 << 5,
dbg_copy_resource = 1 << 6,
dbg_features = 1 << 7,
dbg_tex = 1 << 8,
dbg_feature_use = 1 << 17,
};

@ -1869,6 +1869,33 @@ int vrend_create_sampler_view(struct vrend_context *ctx,
return 0;
}
static
void debug_texture(const char *f, const struct vrend_resource *gt)
{
const struct pipe_resource *pr = &gt->base;
#define PRINT_TARGET(X) case X: fprintf(stderr, #X); break
VREND_DEBUG_EXT(dbg_tex, NULL,
fprintf(stderr, "%s: ", f);
switch (tgsitargettogltarget(pr->target, pr->nr_samples)) {
PRINT_TARGET(GL_TEXTURE_RECTANGLE_NV);
PRINT_TARGET(GL_TEXTURE_1D);
PRINT_TARGET(GL_TEXTURE_2D);
PRINT_TARGET(GL_TEXTURE_3D);
PRINT_TARGET(GL_TEXTURE_1D_ARRAY);
PRINT_TARGET(GL_TEXTURE_2D_ARRAY);
PRINT_TARGET(GL_TEXTURE_2D_MULTISAMPLE);
PRINT_TARGET(GL_TEXTURE_CUBE_MAP);
PRINT_TARGET(GL_TEXTURE_CUBE_MAP_ARRAY);
default:
fprintf(stderr, "UNKNOWN");
}
fprintf(stderr, " id:%d pipe_type:%d ms:%d format:%s size: %dx%dx%d mip:%d\n",
gt->id, pr->target, pr->nr_samples, util_format_name(pr->format),
pr->width0, pr->height0, pr->depth0, pr->last_level);
);
#undef PRINT_TARGET
}
static void vrend_fb_bind_texture_id(struct vrend_resource *res,
int id,
int idx,
@ -1877,6 +1904,8 @@ static void vrend_fb_bind_texture_id(struct vrend_resource *res,
const struct util_format_description *desc = util_format_description(res->base.format);
GLenum attachment = GL_COLOR_ATTACHMENT0 + idx;
debug_texture(__func__, res);
if (vrend_format_is_ds(res->base.format)) {
if (util_format_has_stencil(desc)) {
if (util_format_has_depth(desc))
@ -3567,6 +3596,8 @@ static void vrend_draw_bind_samplers_shader(struct vrend_context *ctx,
struct vrend_resource *texture = tview->texture;
GLenum target = tview->target;
debug_texture(__func__, tview->texture);
if (texture->is_buffer) {
id = texture->tbo_tex_id;
target = GL_TEXTURE_BUFFER;
@ -5268,7 +5299,7 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
list_inithead(&vrend_state.waiting_query_list);
list_inithead(&vrend_state.active_ctx_list);
/* create 0 context */
vrend_renderer_context_create_internal(0, 0, NULL);
vrend_renderer_context_create_internal(0, strlen("HOST"), "HOST");
vrend_state.eventfd = -1;
if (flags & VREND_USE_THREAD_SYNC) {
@ -5635,6 +5666,8 @@ static int vrend_renderer_resource_allocate_texture(struct vrend_resource *gr,
glGenTextures(1, &gr->id);
glBindTexture(gr->target, gr->id);
debug_texture(__func__, gr);
internalformat = tex_conv_table[pr->format].internalformat;
glformat = tex_conv_table[pr->format].glformat;
gltype = tex_conv_table[pr->format].gltype;

Loading…
Cancel
Save