src/: replace all instances of "fprintf to stderr" with "vrend_printf"

This way all output originating from virglrenderer will be redirected.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: David Riley <davidriley@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Gert Wollny 6 years ago committed by Dave Airlie
parent c6e9477693
commit 32c733fa47
  1. 18
      src/virgl_egl_context.c
  2. 4
      src/virglrenderer.c
  3. 6
      src/vrend_blitter.c
  4. 116
      src/vrend_renderer.c
  5. 66
      src/vrend_shader.c

@ -210,21 +210,21 @@ struct virgl_egl *virgl_egl_init(int fd, bool surfaceless, bool gles)
extension_list = eglQueryString(d->egl_display, EGL_EXTENSIONS); extension_list = eglQueryString(d->egl_display, EGL_EXTENSIONS);
#ifdef VIRGL_EGL_DEBUG #ifdef VIRGL_EGL_DEBUG
fprintf(stderr, "EGL major/minor: %d.%d\n", major, minor); vrend_printf( "EGL major/minor: %d.%d\n", major, minor);
fprintf(stderr, "EGL version: %s\n", vrend_printf( "EGL version: %s\n",
eglQueryString(d->egl_display, EGL_VERSION)); eglQueryString(d->egl_display, EGL_VERSION));
fprintf(stderr, "EGL vendor: %s\n", vrend_printf( "EGL vendor: %s\n",
eglQueryString(d->egl_display, EGL_VENDOR)); eglQueryString(d->egl_display, EGL_VENDOR));
fprintf(stderr, "EGL extensions: %s\n", extension_list); vrend_printf( "EGL extensions: %s\n", extension_list);
#endif #endif
/* require surfaceless context */ /* require surfaceless context */
if (!virgl_egl_has_extension_in_string(extension_list, "EGL_KHR_surfaceless_context")) { if (!virgl_egl_has_extension_in_string(extension_list, "EGL_KHR_surfaceless_context")) {
fprintf(stderr, "failed to find support for surfaceless context\n"); vrend_printf( "failed to find support for surfaceless context\n");
goto fail; goto fail;
} }
if (!virgl_egl_has_extension_in_string(extension_list, "EGL_KHR_create_context")) { if (!virgl_egl_has_extension_in_string(extension_list, "EGL_KHR_create_context")) {
fprintf(stderr, "failed to find EGL_KHR_create_context extensions\n"); vrend_printf( "failed to find EGL_KHR_create_context extensions\n");
goto fail; goto fail;
} }
@ -237,7 +237,7 @@ struct virgl_egl *virgl_egl_init(int fd, bool surfaceless, bool gles)
d->have_mesa_dma_buf_img_export = true; d->have_mesa_dma_buf_img_export = true;
if (d->have_mesa_drm_image == false && d->have_mesa_dma_buf_img_export == false) { if (d->have_mesa_drm_image == false && d->have_mesa_dma_buf_img_export == false) {
fprintf(stderr, "failed to find drm image extensions\n"); vrend_printf( "failed to find drm image extensions\n");
goto fail; goto fail;
} }
@ -409,7 +409,7 @@ int virgl_egl_get_fd_for_texture(struct virgl_egl *ve, uint32_t tex_id, int *fd)
if (!b) if (!b)
goto out_destroy; goto out_destroy;
fprintf(stderr,"image exported %d %d\n", handle, stride); vrend_printf("image exported %d %d\n", handle, stride);
r = drmPrimeHandleToFD(ve->fd, handle, DRM_CLOEXEC, fd); r = drmPrimeHandleToFD(ve->fd, handle, DRM_CLOEXEC, fd);
if (r < 0) if (r < 0)
@ -433,7 +433,7 @@ uint32_t virgl_egl_get_gbm_format(uint32_t format)
case VIRGL_FORMAT_B8G8R8A8_UNORM: case VIRGL_FORMAT_B8G8R8A8_UNORM:
return GBM_FORMAT_ARGB8888; return GBM_FORMAT_ARGB8888;
default: default:
fprintf(stderr, "unknown format to convert to GBM %d\n", format); vrend_printf( "unknown format to convert to GBM %d\n", format);
return 0; return 0;
} }
} }

@ -343,7 +343,7 @@ int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks
return -1; return -1;
use_context = CONTEXT_EGL; use_context = CONTEXT_EGL;
#else #else
fprintf(stderr, "EGL is not supported on this platform\n"); vrend_printf( "EGL is not supported on this platform\n");
return -1; return -1;
#endif #endif
} else if (flags & VIRGL_RENDERER_USE_GLX) { } else if (flags & VIRGL_RENDERER_USE_GLX) {
@ -353,7 +353,7 @@ int virgl_renderer_init(void *cookie, int flags, struct virgl_renderer_callbacks
return -1; return -1;
use_context = CONTEXT_GLX; use_context = CONTEXT_GLX;
#else #else
fprintf(stderr, "GLX is not supported on this platform\n"); vrend_printf( "GLX is not supported on this platform\n");
return -1; return -1;
#endif #endif
} }

@ -97,8 +97,8 @@ static bool build_and_check(GLuint id, const char *buf)
char infolog[65536]; char infolog[65536];
int len; int len;
glGetShaderInfoLog(id, 65536, &len, infolog); glGetShaderInfoLog(id, 65536, &len, infolog);
fprintf(stderr,"shader failed to compile\n%s\n", infolog); vrend_printf("shader failed to compile\n%s\n", infolog);
fprintf(stderr,"GLSL:\n%s\n", buf); vrend_printf("GLSL:\n%s\n", buf);
return false; return false;
} }
return true; return true;
@ -775,7 +775,7 @@ void vrend_renderer_blit_gl(UNUSED struct vrend_context *ctx,
char infolog[65536]; char infolog[65536];
int len; int len;
glGetProgramInfoLog(prog_id, 65536, &len, infolog); glGetProgramInfoLog(prog_id, 65536, &len, infolog);
fprintf(stderr,"got error linking\n%s\n", infolog); vrend_printf("got error linking\n%s\n", infolog);
/* dump shaders */ /* dump shaders */
glDeleteProgram(prog_id); glDeleteProgram(prog_id);
return; return;

@ -676,7 +676,7 @@ static void __report_context_error(const char *fname, struct vrend_context *ctx,
{ {
ctx->in_error = true; ctx->in_error = true;
ctx->last_error = error; ctx->last_error = error;
fprintf(stderr,"%s: context error reported %d \"%s\" %s %d\n", fname, ctx->ctx_id, ctx->debug_name, vrend_ctx_error_strings[error], value); vrend_printf("%s: context error reported %d \"%s\" %s %d\n", fname, ctx->ctx_id, ctx->debug_name, vrend_ctx_error_strings[error], value);
} }
#define report_context_error(ctx, error, value) __report_context_error(__func__, ctx, error, value) #define report_context_error(ctx, error, value) __report_context_error(__func__, ctx, error, value)
@ -696,7 +696,7 @@ static const char *vrend_core_profile_warn_strings[] = { "None", "Stipple", "Pol
static void __report_core_warn(const char *fname, struct vrend_context *ctx, enum virgl_ctx_errors error, uint32_t value) static void __report_core_warn(const char *fname, struct vrend_context *ctx, enum virgl_ctx_errors error, uint32_t value)
{ {
fprintf(stderr,"%s: core profile violation reported %d \"%s\" %s %d\n", fname, ctx->ctx_id, ctx->debug_name, vrend_core_profile_warn_strings[error], value); vrend_printf("%s: core profile violation reported %d \"%s\" %s %d\n", fname, ctx->ctx_id, ctx->debug_name, vrend_core_profile_warn_strings[error], value);
} }
#define report_core_warn(ctx, error, value) __report_core_warn(__func__, ctx, error, value) #define report_core_warn(ctx, error, value) __report_core_warn(__func__, ctx, error, value)
@ -730,7 +730,7 @@ static void __report_gles_warn(const char *fname, struct vrend_context *ctx, enu
{ {
int id = ctx ? ctx->ctx_id : -1; int id = ctx ? ctx->ctx_id : -1;
const char *name = ctx ? ctx->debug_name : "NO_CONTEXT"; const char *name = ctx ? ctx->debug_name : "NO_CONTEXT";
fprintf(stderr,"%s: gles violation reported %d \"%s\" %s %d\n", fname, id, name, vrend_gles_warn_strings[error], value); vrend_printf("%s: gles violation reported %d \"%s\" %s %d\n", fname, id, name, vrend_gles_warn_strings[error], value);
} }
#define report_gles_warn(ctx, error, value) __report_gles_warn(__func__, ctx, error, value) #define report_gles_warn(ctx, error, value) __report_gles_warn(__func__, ctx, error, value)
@ -738,7 +738,7 @@ static void __report_gles_missing_func(const char *fname, struct vrend_context *
{ {
int id = ctx ? ctx->ctx_id : -1; int id = ctx ? ctx->ctx_id : -1;
const char *name = ctx ? ctx->debug_name : "NO_CONTEXT"; const char *name = ctx ? ctx->debug_name : "NO_CONTEXT";
fprintf(stderr,"%s: gles violation reported %d \"%s\" %s is missing\n", fname, id, name, missf); vrend_printf("%s: gles violation reported %d \"%s\" %s is missing\n", fname, id, name, missf);
} }
#define report_gles_missing_func(ctx, missf) __report_gles_missing_func(__func__, ctx, missf) #define report_gles_missing_func(ctx, missf) __report_gles_missing_func(__func__, ctx, missf)
@ -865,8 +865,8 @@ static bool vrend_compile_shader(struct vrend_context *ctx,
int len; int len;
glGetShaderInfoLog(shader->id, 65536, &len, infolog); glGetShaderInfoLog(shader->id, 65536, &len, infolog);
report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_SHADER, 0); report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_SHADER, 0);
fprintf(stderr,"shader failed to compile\n%s\n", infolog); vrend_printf("shader failed to compile\n%s\n", infolog);
fprintf(stderr,"GLSL:\n%s\n", shader->glsl_prog); vrend_printf("GLSL:\n%s\n", shader->glsl_prog);
return false; return false;
} }
return true; return true;
@ -1207,7 +1207,7 @@ static void bind_image_locs(struct vrend_linked_shader_program *sprog,
snprintf(name, 32, "%simg%d[%d]", prefix, img_array->first, j); snprintf(name, 32, "%simg%d[%d]", prefix, img_array->first, j);
sprog->img_locs[id][img_array->first + j] = glGetUniformLocation(sprog->id, name); sprog->img_locs[id][img_array->first + j] = glGetUniformLocation(sprog->id, name);
if (sprog->img_locs[id][img_array->first + j] == -1) if (sprog->img_locs[id][img_array->first + j] == -1)
fprintf(stderr, "failed to get uniform loc for image %s\n", name); vrend_printf( "failed to get uniform loc for image %s\n", name);
} }
} }
} else if (mask) { } else if (mask) {
@ -1216,7 +1216,7 @@ static void bind_image_locs(struct vrend_linked_shader_program *sprog,
snprintf(name, 32, "%simg%d", prefix, i); snprintf(name, 32, "%simg%d", prefix, i);
sprog->img_locs[id][i] = glGetUniformLocation(sprog->id, name); sprog->img_locs[id][i] = glGetUniformLocation(sprog->id, name);
if (sprog->img_locs[id][i] == -1) if (sprog->img_locs[id][i] == -1)
fprintf(stderr, "failed to get uniform loc for image %s\n", name); vrend_printf( "failed to get uniform loc for image %s\n", name);
} else { } else {
sprog->img_locs[id][i] = -1; sprog->img_locs[id][i] = -1;
} }
@ -1240,10 +1240,10 @@ static struct vrend_linked_shader_program *add_cs_shader_program(struct vrend_co
char infolog[65536]; char infolog[65536];
int len; int len;
glGetProgramInfoLog(prog_id, 65536, &len, infolog); glGetProgramInfoLog(prog_id, 65536, &len, infolog);
fprintf(stderr,"got error linking\n%s\n", infolog); vrend_printf("got error linking\n%s\n", infolog);
/* dump shaders */ /* dump shaders */
report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_SHADER, 0); report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_SHADER, 0);
fprintf(stderr,"compute shader: %d GLSL\n%s\n", cs->id, cs->glsl_prog); vrend_printf("compute shader: %d GLSL\n%s\n", cs->id, cs->glsl_prog);
glDeleteProgram(prog_id); glDeleteProgram(prog_id);
free(sprog); free(sprog);
return NULL; return NULL;
@ -1364,13 +1364,13 @@ static struct vrend_linked_shader_program *add_shader_program(struct vrend_conte
char infolog[65536]; char infolog[65536];
int len; int len;
glGetProgramInfoLog(prog_id, 65536, &len, infolog); glGetProgramInfoLog(prog_id, 65536, &len, infolog);
fprintf(stderr,"got error linking\n%s\n", infolog); vrend_printf("got error linking\n%s\n", infolog);
/* dump shaders */ /* dump shaders */
report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_SHADER, 0); report_context_error(ctx, VIRGL_ERROR_CTX_ILLEGAL_SHADER, 0);
fprintf(stderr,"vert shader: %d GLSL\n%s\n", vs->id, vs->glsl_prog); vrend_printf("vert shader: %d GLSL\n%s\n", vs->id, vs->glsl_prog);
if (gs) if (gs)
fprintf(stderr,"geom shader: %d GLSL\n%s\n", gs->id, gs->glsl_prog); vrend_printf("geom shader: %d GLSL\n%s\n", gs->id, gs->glsl_prog);
fprintf(stderr,"frag shader: %d GLSL\n%s\n", fs->id, fs->glsl_prog); vrend_printf("frag shader: %d GLSL\n%s\n", fs->id, fs->glsl_prog);
glDeleteProgram(prog_id); glDeleteProgram(prog_id);
free(sprog); free(sprog);
return NULL; return NULL;
@ -1892,7 +1892,7 @@ static
void debug_texture(const char *f, const struct vrend_resource *gt) void debug_texture(const char *f, const struct vrend_resource *gt)
{ {
const struct pipe_resource *pr = &gt->base; const struct pipe_resource *pr = &gt->base;
#define PRINT_TARGET(X) case X: fprintf(stderr, #X); break #define PRINT_TARGET(X) case X: vrend_printf( #X); break
VREND_DEBUG_EXT(dbg_tex, NULL, VREND_DEBUG_EXT(dbg_tex, NULL,
vrend_printf("%s: ", f); vrend_printf("%s: ", f);
switch (tgsitargettogltarget(pr->target, pr->nr_samples)) { switch (tgsitargettogltarget(pr->target, pr->nr_samples)) {
@ -2166,7 +2166,7 @@ void vrend_set_framebuffer_state(struct vrend_context *ctx,
if (ctx->sub->nr_cbufs > 0 || ctx->sub->zsurf) { if (ctx->sub->nr_cbufs > 0 || ctx->sub->zsurf) {
status = glCheckFramebufferStatus(GL_FRAMEBUFFER); status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) if (status != GL_FRAMEBUFFER_COMPLETE)
fprintf(stderr,"failed to complete framebuffer 0x%x %s\n", status, ctx->debug_name); vrend_printf("failed to complete framebuffer 0x%x %s\n", status, ctx->debug_name);
} }
ctx->sub->shader_dirty = true; ctx->sub->shader_dirty = true;
@ -3084,14 +3084,14 @@ int vrend_create_shader(struct vrend_context *ctx,
} else { } else {
sel = vrend_object_lookup(ctx->sub->object_hash, handle, VIRGL_OBJECT_SHADER); sel = vrend_object_lookup(ctx->sub->object_hash, handle, VIRGL_OBJECT_SHADER);
if (!sel) { if (!sel) {
fprintf(stderr, "got continuation without original shader %d\n", handle); vrend_printf( "got continuation without original shader %d\n", handle);
ret = EINVAL; ret = EINVAL;
goto error; goto error;
} }
offlen &= ~VIRGL_OBJ_SHADER_OFFSET_CONT; offlen &= ~VIRGL_OBJ_SHADER_OFFSET_CONT;
if (offlen != sel->buf_offset) { if (offlen != sel->buf_offset) {
fprintf(stderr, "Got mismatched shader continuation %d vs %d\n", vrend_printf( "Got mismatched shader continuation %d vs %d\n",
offlen, sel->buf_offset); offlen, sel->buf_offset);
ret = EINVAL; ret = EINVAL;
goto error; goto error;
@ -3106,7 +3106,7 @@ int vrend_create_shader(struct vrend_context *ctx,
} }
if ((pkt_length * 4 + sel->buf_offset) > sel->buf_len) { if ((pkt_length * 4 + sel->buf_offset) > sel->buf_len) {
fprintf(stderr, "Got too large shader continuation %d vs %d\n", vrend_printf( "Got too large shader continuation %d vs %d\n",
pkt_length * 4 + sel->buf_offset, sel->buf_len); pkt_length * 4 + sel->buf_offset, sel->buf_len);
ret = EINVAL; ret = EINVAL;
goto error; goto error;
@ -3402,7 +3402,7 @@ static GLenum get_gs_xfb_mode(GLenum mode)
case GL_TRIANGLE_STRIP: case GL_TRIANGLE_STRIP:
return GL_TRIANGLES; return GL_TRIANGLES;
default: default:
fprintf(stderr, "illegal gs transform feedback mode %d\n", mode); vrend_printf( "illegal gs transform feedback mode %d\n", mode);
return GL_POINTS; return GL_POINTS;
} }
} }
@ -3418,7 +3418,7 @@ static GLenum get_tess_xfb_mode(int mode, bool is_point_mode)
case GL_LINES: case GL_LINES:
return GL_LINES; return GL_LINES;
default: default:
fprintf(stderr, "illegal gs transform feedback mode %d\n", mode); vrend_printf( "illegal gs transform feedback mode %d\n", mode);
return GL_POINTS; return GL_POINTS;
} }
} }
@ -3440,7 +3440,7 @@ static GLenum get_xfb_mode(GLenum mode)
case GL_LINE_STRIP: case GL_LINE_STRIP:
return GL_LINES; return GL_LINES;
default: default:
fprintf(stderr, "failed to translate TFB %d\n", mode); vrend_printf( "failed to translate TFB %d\n", mode);
return GL_POINTS; return GL_POINTS;
} }
} }
@ -3467,7 +3467,7 @@ static void vrend_draw_bind_vertex_legacy(struct vrend_context *ctx,
res = (struct vrend_resource *)ctx->sub->vbo[vbo_index].buffer; res = (struct vrend_resource *)ctx->sub->vbo[vbo_index].buffer;
if (!res) { if (!res) {
fprintf(stderr,"cannot find vbo buf %d %d %d\n", i, va->count, ctx->sub->prog->ss[PIPE_SHADER_VERTEX]->sel->sinfo.num_inputs); vrend_printf("cannot find vbo buf %d %d %d\n", i, va->count, ctx->sub->prog->ss[PIPE_SHADER_VERTEX]->sel->sinfo.num_inputs);
continue; continue;
} }
@ -3479,9 +3479,9 @@ static void vrend_draw_bind_vertex_legacy(struct vrend_context *ctx,
} else loc = -1; } else loc = -1;
if (loc == -1) { if (loc == -1) {
fprintf(stderr,"%s: cannot find loc %d %d %d\n", ctx->debug_name, i, va->count, ctx->sub->prog->ss[PIPE_SHADER_VERTEX]->sel->sinfo.num_inputs); vrend_printf("%s: cannot find loc %d %d %d\n", ctx->debug_name, i, va->count, ctx->sub->prog->ss[PIPE_SHADER_VERTEX]->sel->sinfo.num_inputs);
if (i == 0) { if (i == 0) {
fprintf(stderr,"%s: shader probably didn't compile - skipping rendering\n", ctx->debug_name); vrend_printf("%s: shader probably didn't compile - skipping rendering\n", ctx->debug_name);
return; return;
} }
continue; continue;
@ -3489,7 +3489,7 @@ static void vrend_draw_bind_vertex_legacy(struct vrend_context *ctx,
} }
if (ve->type == GL_FALSE) { if (ve->type == GL_FALSE) {
fprintf(stderr,"failed to translate vertex type - skipping render\n"); vrend_printf("failed to translate vertex type - skipping render\n");
return; return;
} }
@ -3816,7 +3816,7 @@ static void vrend_draw_bind_images_shader(struct vrend_context *ctx, int shader_
access = GL_READ_WRITE; access = GL_READ_WRITE;
break; break;
default: default:
fprintf(stderr, "Invalid access specified\n"); vrend_printf( "Invalid access specified\n");
return; return;
} }
@ -3900,7 +3900,7 @@ int vrend_draw_vbo(struct vrend_context *ctx,
bool dual_src = util_blend_state_is_dual(&ctx->sub->blend_state, 0); bool dual_src = util_blend_state_is_dual(&ctx->sub->blend_state, 0);
bool same_prog; bool same_prog;
if (!ctx->sub->shaders[PIPE_SHADER_VERTEX] || !ctx->sub->shaders[PIPE_SHADER_FRAGMENT]) { if (!ctx->sub->shaders[PIPE_SHADER_VERTEX] || !ctx->sub->shaders[PIPE_SHADER_FRAGMENT]) {
fprintf(stderr,"dropping rendering due to missing shaders: %s\n", ctx->debug_name); vrend_printf("dropping rendering due to missing shaders: %s\n", ctx->debug_name);
return 0; return 0;
} }
@ -3918,7 +3918,7 @@ int vrend_draw_vbo(struct vrend_context *ctx,
(ctx->sub->shaders[PIPE_SHADER_GEOMETRY] && !ctx->sub->shaders[PIPE_SHADER_GEOMETRY]->current) || (ctx->sub->shaders[PIPE_SHADER_GEOMETRY] && !ctx->sub->shaders[PIPE_SHADER_GEOMETRY]->current) ||
(ctx->sub->shaders[PIPE_SHADER_TESS_CTRL] && !ctx->sub->shaders[PIPE_SHADER_TESS_CTRL]->current) || (ctx->sub->shaders[PIPE_SHADER_TESS_CTRL] && !ctx->sub->shaders[PIPE_SHADER_TESS_CTRL]->current) ||
(ctx->sub->shaders[PIPE_SHADER_TESS_EVAL] && !ctx->sub->shaders[PIPE_SHADER_TESS_EVAL]->current)) { (ctx->sub->shaders[PIPE_SHADER_TESS_EVAL] && !ctx->sub->shaders[PIPE_SHADER_TESS_EVAL]->current)) {
fprintf(stderr, "failure to compile shader variants: %s\n", ctx->debug_name); vrend_printf( "failure to compile shader variants: %s\n", ctx->debug_name);
return 0; return 0;
} }
same_prog = true; same_prog = true;
@ -3978,7 +3978,7 @@ int vrend_draw_vbo(struct vrend_context *ctx,
} }
} }
if (!ctx->sub->prog) { if (!ctx->sub->prog) {
fprintf(stderr,"dropping rendering due to missing shaders: %s\n", ctx->debug_name); vrend_printf("dropping rendering due to missing shaders: %s\n", ctx->debug_name);
return 0; return 0;
} }
@ -3987,7 +3987,7 @@ int vrend_draw_vbo(struct vrend_context *ctx,
vrend_draw_bind_objects(ctx, new_program); vrend_draw_bind_objects(ctx, new_program);
if (!ctx->sub->ve) { if (!ctx->sub->ve) {
fprintf(stderr,"illegal VE setup - skipping renderering\n"); vrend_printf("illegal VE setup - skipping renderering\n");
return 0; return 0;
} }
float viewport_neg_val = ctx->sub->viewport_is_negative ? -1.0 : 1.0; float viewport_neg_val = ctx->sub->viewport_is_negative ? -1.0 : 1.0;
@ -4012,7 +4012,7 @@ int vrend_draw_vbo(struct vrend_context *ctx,
struct vrend_vertex_element *ve = &va->elements[i]; struct vrend_vertex_element *ve = &va->elements[i];
int vbo_index = ve->base.vertex_buffer_index; int vbo_index = ve->base.vertex_buffer_index;
if (!ctx->sub->vbo[vbo_index].buffer) { if (!ctx->sub->vbo[vbo_index].buffer) {
fprintf(stderr, "VBO missing vertex buffer\n"); vrend_printf( "VBO missing vertex buffer\n");
return 0; return 0;
} }
} }
@ -4144,13 +4144,13 @@ void vrend_launch_grid(struct vrend_context *ctx,
struct vrend_linked_shader_program *prog; struct vrend_linked_shader_program *prog;
bool cs_dirty; bool cs_dirty;
if (!ctx->sub->shaders[PIPE_SHADER_COMPUTE]) { if (!ctx->sub->shaders[PIPE_SHADER_COMPUTE]) {
fprintf(stderr,"dropping rendering due to missing shaders: %s\n", ctx->debug_name); vrend_printf("dropping rendering due to missing shaders: %s\n", ctx->debug_name);
return; return;
} }
vrend_shader_select(ctx, ctx->sub->shaders[PIPE_SHADER_COMPUTE], &cs_dirty); vrend_shader_select(ctx, ctx->sub->shaders[PIPE_SHADER_COMPUTE], &cs_dirty);
if (!ctx->sub->shaders[PIPE_SHADER_COMPUTE]->current) { if (!ctx->sub->shaders[PIPE_SHADER_COMPUTE]->current) {
fprintf(stderr, "failure to compile shader variants: %s\n", ctx->debug_name); vrend_printf( "failure to compile shader variants: %s\n", ctx->debug_name);
return; return;
} }
if (ctx->sub->shaders[PIPE_SHADER_COMPUTE]->current->id != (GLuint)ctx->sub->prog_ids[PIPE_SHADER_COMPUTE]) { if (ctx->sub->shaders[PIPE_SHADER_COMPUTE]->current->id != (GLuint)ctx->sub->prog_ids[PIPE_SHADER_COMPUTE]) {
@ -4360,7 +4360,7 @@ static void vrend_hw_emit_blend(struct vrend_context *ctx, struct pipe_blend_sta
if (state->rt[i].blend_enable) { if (state->rt[i].blend_enable) {
bool dual_src = util_blend_state_is_dual(&ctx->sub->blend_state, i); bool dual_src = util_blend_state_is_dual(&ctx->sub->blend_state, i);
if (dual_src && !has_feature(feat_dual_src_blend)) { if (dual_src && !has_feature(feat_dual_src_blend)) {
fprintf(stderr, "dual src blend requested but not supported for rt %d\n", i); vrend_printf( "dual src blend requested but not supported for rt %d\n", i);
continue; continue;
} }
@ -4386,7 +4386,7 @@ static void vrend_hw_emit_blend(struct vrend_context *ctx, struct pipe_blend_sta
if (state->rt[0].blend_enable) { if (state->rt[0].blend_enable) {
bool dual_src = util_blend_state_is_dual(&ctx->sub->blend_state, 0); bool dual_src = util_blend_state_is_dual(&ctx->sub->blend_state, 0);
if (dual_src && !has_feature(feat_dual_src_blend)) { if (dual_src && !has_feature(feat_dual_src_blend)) {
fprintf(stderr, "dual src blend requested but not supported for rt 0\n"); vrend_printf( "dual src blend requested but not supported for rt 0\n");
} }
glBlendFuncSeparate(translate_blend_factor(state->rt[0].rgb_src_factor), glBlendFuncSeparate(translate_blend_factor(state->rt[0].rgb_src_factor),
translate_blend_factor(state->rt[0].rgb_dst_factor), translate_blend_factor(state->rt[0].rgb_dst_factor),
@ -4789,7 +4789,7 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx)
glCullFace(GL_FRONT_AND_BACK); glCullFace(GL_FRONT_AND_BACK);
break; break;
default: default:
fprintf(stderr, "unhandled cull-face: %x\n", state->cull_face); vrend_printf( "unhandled cull-face: %x\n", state->cull_face);
} }
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
} else } else
@ -4961,7 +4961,7 @@ static void vrend_apply_sampler_state(struct vrend_context *ctx,
GLenum target = tex->base.target; GLenum target = tex->base.target;
if (!state) { if (!state) {
fprintf(stderr, "cannot find sampler state for %d %d\n", shader_type, id); vrend_printf( "cannot find sampler state for %d %d\n", shader_type, id);
return; return;
} }
if (res->base.nr_samples > 1) { if (res->base.nr_samples > 1) {
@ -5134,7 +5134,7 @@ static void wait_sync(struct vrend_fence *fence)
switch (glret) { switch (glret) {
case GL_WAIT_FAILED: case GL_WAIT_FAILED:
fprintf(stderr, "wait sync failed: illegal fence object %p\n", fence->syncobj); vrend_printf( "wait sync failed: illegal fence object %p\n", fence->syncobj);
break; break;
case GL_ALREADY_SIGNALED: case GL_ALREADY_SIGNALED:
case GL_CONDITION_SATISFIED: case GL_CONDITION_SATISFIED:
@ -5166,7 +5166,7 @@ static int thread_sync(UNUSED void *arg)
while (!vrend_state.stop_sync_thread) { while (!vrend_state.stop_sync_thread) {
if (LIST_IS_EMPTY(&vrend_state.fence_wait_list) && if (LIST_IS_EMPTY(&vrend_state.fence_wait_list) &&
pipe_condvar_wait(vrend_state.fence_cond, vrend_state.fence_mutex) != 0) { pipe_condvar_wait(vrend_state.fence_cond, vrend_state.fence_mutex) != 0) {
fprintf(stderr, "error while waiting on condition\n"); vrend_printf( "error while waiting on condition\n");
break; break;
} }
@ -5201,13 +5201,13 @@ static void vrend_renderer_use_threaded_sync(void)
vrend_state.sync_context = vrend_clicbs->create_gl_context(0, &ctx_params); vrend_state.sync_context = vrend_clicbs->create_gl_context(0, &ctx_params);
if (vrend_state.sync_context == NULL) { if (vrend_state.sync_context == NULL) {
fprintf(stderr, "failed to create sync opengl context\n"); vrend_printf( "failed to create sync opengl context\n");
return; return;
} }
vrend_state.eventfd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); vrend_state.eventfd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
if (vrend_state.eventfd == -1) { if (vrend_state.eventfd == -1) {
fprintf(stderr, "Failed to create eventfd\n"); vrend_printf( "Failed to create eventfd\n");
vrend_clicbs->destroy_gl_context(vrend_state.sync_context); vrend_clicbs->destroy_gl_context(vrend_state.sync_context);
return; return;
} }
@ -5238,7 +5238,7 @@ static void vrend_debug_cb(UNUSED GLenum source, GLenum type, UNUSED GLuint id,
return; return;
} }
fprintf(stderr, "ERROR: %s\n", message); vrend_printf( "ERROR: %s\n", message);
} }
int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags) int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
@ -5286,15 +5286,15 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
vrend_state.gl_minor_ver = gl_ver % 10; vrend_state.gl_minor_ver = gl_ver % 10;
if (gles) { if (gles) {
fprintf(stderr, "gl_version %d - es profile enabled\n", gl_ver); vrend_printf( "gl_version %d - es profile enabled\n", gl_ver);
vrend_state.use_gles = true; vrend_state.use_gles = true;
/* for now, makes the rest of the code use the most GLES 3.x like path */ /* for now, makes the rest of the code use the most GLES 3.x like path */
vrend_state.use_core_profile = 1; vrend_state.use_core_profile = 1;
} else if (gl_ver > 30 && !epoxy_has_gl_extension("GL_ARB_compatibility")) { } else if (gl_ver > 30 && !epoxy_has_gl_extension("GL_ARB_compatibility")) {
fprintf(stderr, "gl_version %d - core profile enabled\n", gl_ver); vrend_printf( "gl_version %d - core profile enabled\n", gl_ver);
vrend_state.use_core_profile = 1; vrend_state.use_core_profile = 1;
} else { } else {
fprintf(stderr, "gl_version %d - compat profile\n", gl_ver); vrend_printf( "gl_version %d - compat profile\n", gl_ver);
} }
init_features(gles ? 0 : gl_ver, init_features(gles ? 0 : gl_ver,
@ -5306,7 +5306,7 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
if (!has_feature(feat_arb_robustness) && if (!has_feature(feat_arb_robustness) &&
!has_feature(feat_gles_khr_robustness)) { !has_feature(feat_gles_khr_robustness)) {
fprintf(stderr,"WARNING: running without ARB/KHR robustness in place may crash\n"); vrend_printf("WARNING: running without ARB/KHR robustness in place may crash\n");
} }
/* callbacks for when we are cleaning up the object table */ /* callbacks for when we are cleaning up the object table */
@ -5725,7 +5725,7 @@ static int vrend_renderer_resource_allocate_texture(struct vrend_resource *gr,
gltype = tex_conv_table[pr->format].gltype; gltype = tex_conv_table[pr->format].gltype;
if (internalformat == 0) { if (internalformat == 0) {
fprintf(stderr,"unknown format is %d\n", pr->format); vrend_printf("unknown format is %d\n", pr->format);
FREE(gt); FREE(gt);
return EINVAL; return EINVAL;
} }
@ -5734,7 +5734,7 @@ static int vrend_renderer_resource_allocate_texture(struct vrend_resource *gr,
if (epoxy_has_gl_extension("GL_OES_EGL_image_external")) { if (epoxy_has_gl_extension("GL_OES_EGL_image_external")) {
glEGLImageTargetTexture2DOES(gr->target, (GLeglImageOES) image_oes); glEGLImageTargetTexture2DOES(gr->target, (GLeglImageOES) image_oes);
} else { } else {
fprintf(stderr, "missing GL_OES_EGL_image_external extension\n"); vrend_printf( "missing GL_OES_EGL_image_external extension\n");
FREE(gr); FREE(gr);
return EINVAL; return EINVAL;
} }
@ -6186,7 +6186,7 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
glBindBufferARB(res->target, res->id); glBindBufferARB(res->target, res->id);
data = glMapBufferRange(res->target, info->box->x, info->box->width, GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_WRITE_BIT); data = glMapBufferRange(res->target, info->box->x, info->box->width, GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_WRITE_BIT);
if (data == NULL) { if (data == NULL) {
fprintf(stderr,"map failed for element buffer\n"); vrend_printf("map failed for element buffer\n");
vrend_read_from_iovec_cb(iov, num_iovs, info->offset, info->box->width, &iov_buffer_upload, &d); vrend_read_from_iovec_cb(iov, num_iovs, info->offset, info->box->width, &iov_buffer_upload, &d);
} else { } else {
vrend_read_from_iovec(iov, num_iovs, info->offset, data, info->box->width); vrend_read_from_iovec(iov, num_iovs, info->offset, data, info->box->width);
@ -6518,7 +6518,7 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx,
send_size = util_format_get_nblocks(res->base.format, info->box->width, info->box->height) * info->box->depth * util_format_get_blocksize(res->base.format); send_size = util_format_get_nblocks(res->base.format, info->box->width, info->box->height) * info->box->depth * util_format_get_blocksize(res->base.format);
data = malloc(send_size); data = malloc(send_size);
if (!data) { if (!data) {
fprintf(stderr,"malloc failed %d\n", send_size); vrend_printf("malloc failed %d\n", send_size);
return ENOMEM; return ENOMEM;
} }
} else { } else {
@ -6599,13 +6599,13 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx,
type != GL_INT && type != GL_FLOAT) { type != GL_INT && type != GL_FLOAT) {
glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &imp); glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &imp);
if (imp != (GLint)type) { if (imp != (GLint)type) {
fprintf(stderr, "GL_IMPLEMENTATION_COLOR_READ_TYPE is not expected native type 0x%x != imp 0x%x\n", type, imp); vrend_printf( "GL_IMPLEMENTATION_COLOR_READ_TYPE is not expected native type 0x%x != imp 0x%x\n", type, imp);
} }
} }
if (format != GL_RGBA && format != GL_RGBA_INTEGER) { if (format != GL_RGBA && format != GL_RGBA_INTEGER) {
glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &imp); glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &imp);
if (imp != (GLint)format) { if (imp != (GLint)format) {
fprintf(stderr, "GL_IMPLEMENTATION_COLOR_READ_FORMAT is not expected native format 0x%x != imp 0x%x\n", format, imp); vrend_printf( "GL_IMPLEMENTATION_COLOR_READ_FORMAT is not expected native format 0x%x != imp 0x%x\n", format, imp);
} }
} }
} }
@ -6695,7 +6695,7 @@ static int vrend_renderer_transfer_send_iov(struct vrend_context *ctx,
glBindBufferARB(res->target, res->id); glBindBufferARB(res->target, res->id);
data = glMapBufferRange(res->target, info->box->x, info->box->width, GL_MAP_READ_BIT); data = glMapBufferRange(res->target, info->box->x, info->box->width, GL_MAP_READ_BIT);
if (!data) if (!data)
fprintf(stderr,"unable to open buffer for reading %d\n", res->target); vrend_printf("unable to open buffer for reading %d\n", res->target);
else else
vrend_write_to_iovec(iov, num_iovs, info->offset, data, send_size); vrend_write_to_iovec(iov, num_iovs, info->offset, data, send_size);
glUnmapBuffer(res->target); glUnmapBuffer(res->target);
@ -7023,7 +7023,7 @@ static void vrend_resource_copy_fallback(struct vrend_resource *src_res,
cube_slice = 6; cube_slice = 6;
if (src_res->base.format != dst_res->base.format) { if (src_res->base.format != dst_res->base.format) {
fprintf(stderr, "copy fallback failed due to mismatched formats %d %d\n", src_res->base.format, dst_res->base.format); vrend_printf( "copy fallback failed due to mismatched formats %d %d\n", src_res->base.format, dst_res->base.format);
return; return;
} }
@ -7600,7 +7600,7 @@ int vrend_renderer_create_fence(int client_fence_id, uint32_t ctx_id)
return 0; return 0;
fail: fail:
fprintf(stderr, "failed to create fence sync object\n"); vrend_printf( "failed to create fence sync object\n");
free(fence); free(fence);
return ENOMEM; return ENOMEM;
} }
@ -7814,7 +7814,7 @@ int vrend_create_query(struct vrend_context *ctx, uint32_t handle,
q->gltype = GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB; q->gltype = GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB;
break; break;
default: default:
fprintf(stderr,"unknown query object received %d\n", q->type); vrend_printf("unknown query object received %d\n", q->type);
break; break;
} }
@ -8015,7 +8015,7 @@ void vrend_render_condition(struct vrend_context *ctx,
glmode = condition ? GL_QUERY_BY_REGION_NO_WAIT_INVERTED : GL_QUERY_BY_REGION_NO_WAIT; glmode = condition ? GL_QUERY_BY_REGION_NO_WAIT_INVERTED : GL_QUERY_BY_REGION_NO_WAIT;
break; break;
default: default:
fprintf(stderr, "unhandled condition %x\n", mode); vrend_printf( "unhandled condition %x\n", mode);
} }
ctx->sub->cond_render_q_id = q->id; ctx->sub->cond_render_q_id = q->id;

@ -732,7 +732,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
i = ctx->num_inputs++; i = ctx->num_inputs++;
indirect = ctx_indirect_inputs(ctx); indirect = ctx_indirect_inputs(ctx);
if (ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) { if (ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) {
fprintf(stderr, "Number of inputs exceeded, max is %lu\n", ARRAY_SIZE(ctx->inputs)); vrend_printf( "Number of inputs exceeded, max is %lu\n", ARRAY_SIZE(ctx->inputs));
return false; return false;
} }
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) { if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX) {
@ -763,13 +763,13 @@ iter_declaration(struct tgsi_iterate_context *iter,
else if (decl->Semantic.Index == 1) else if (decl->Semantic.Index == 1)
name_prefix = "gl_SecondaryColor"; name_prefix = "gl_SecondaryColor";
else else
fprintf(stderr, "got illegal color semantic index %d\n", decl->Semantic.Index); vrend_printf( "got illegal color semantic index %d\n", decl->Semantic.Index);
ctx->inputs[i].glsl_no_index = true; ctx->inputs[i].glsl_no_index = true;
} else { } else {
if (ctx->key->color_two_side) { if (ctx->key->color_two_side) {
int j = ctx->num_inputs++; int j = ctx->num_inputs++;
if (ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) { if (ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) {
fprintf(stderr, "Number of inputs exceeded, max is %lu\n", ARRAY_SIZE(ctx->inputs)); vrend_printf( "Number of inputs exceeded, max is %lu\n", ARRAY_SIZE(ctx->inputs));
return false; return false;
} }
@ -787,7 +787,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
if (ctx->front_face_emitted == false) { if (ctx->front_face_emitted == false) {
int k = ctx->num_inputs++; int k = ctx->num_inputs++;
if (ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) { if (ctx->num_inputs > ARRAY_SIZE(ctx->inputs)) {
fprintf(stderr, "Number of inputs exceeded, max is %lu\n", ARRAY_SIZE(ctx->inputs)); vrend_printf( "Number of inputs exceeded, max is %lu\n", ARRAY_SIZE(ctx->inputs));
return false; return false;
} }
@ -980,7 +980,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
i = ctx->num_outputs++; i = ctx->num_outputs++;
indirect = ctx_indirect_outputs(ctx); indirect = ctx_indirect_outputs(ctx);
if (ctx->num_outputs > ARRAY_SIZE(ctx->outputs)) { if (ctx->num_outputs > ARRAY_SIZE(ctx->outputs)) {
fprintf(stderr, "Number of outputs exceeded, max is %lu\n", ARRAY_SIZE(ctx->outputs)); vrend_printf( "Number of outputs exceeded, max is %lu\n", ARRAY_SIZE(ctx->outputs));
return false; return false;
} }
@ -1003,7 +1003,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
iter->processor.Processor == TGSI_PROCESSOR_TESS_CTRL || iter->processor.Processor == TGSI_PROCESSOR_TESS_CTRL ||
iter->processor.Processor == TGSI_PROCESSOR_TESS_EVAL) { iter->processor.Processor == TGSI_PROCESSOR_TESS_EVAL) {
if (ctx->outputs[i].first > 0) if (ctx->outputs[i].first > 0)
fprintf(stderr,"Illegal position input\n"); vrend_printf("Illegal position input\n");
name_prefix = "gl_Position"; name_prefix = "gl_Position";
ctx->outputs[i].glsl_predefined_no_emit = true; ctx->outputs[i].glsl_predefined_no_emit = true;
ctx->outputs[i].glsl_no_index = true; ctx->outputs[i].glsl_no_index = true;
@ -1211,7 +1211,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
break; break;
case TGSI_FILE_SAMPLER_VIEW: case TGSI_FILE_SAMPLER_VIEW:
if (decl->Range.Last >= ARRAY_SIZE(ctx->samplers)) { if (decl->Range.Last >= ARRAY_SIZE(ctx->samplers)) {
fprintf(stderr, "Sampler view exceeded, max is %lu\n", ARRAY_SIZE(ctx->samplers)); vrend_printf( "Sampler view exceeded, max is %lu\n", ARRAY_SIZE(ctx->samplers));
return false; return false;
} }
if (!add_samplers(ctx, decl->Range.First, decl->Range.Last, decl->SamplerView.Resource, decl->SamplerView.ReturnTypeX)) if (!add_samplers(ctx, decl->Range.First, decl->Range.Last, decl->SamplerView.Resource, decl->SamplerView.ReturnTypeX))
@ -1220,7 +1220,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
case TGSI_FILE_IMAGE: case TGSI_FILE_IMAGE:
ctx->shader_req_bits |= SHADER_REQ_IMAGE_LOAD_STORE; ctx->shader_req_bits |= SHADER_REQ_IMAGE_LOAD_STORE;
if (decl->Range.Last >= ARRAY_SIZE(ctx->images)) { if (decl->Range.Last >= ARRAY_SIZE(ctx->images)) {
fprintf(stderr, "Image view exceeded, max is %lu\n", ARRAY_SIZE(ctx->images)); vrend_printf( "Image view exceeded, max is %lu\n", ARRAY_SIZE(ctx->images));
return false; return false;
} }
if (!add_images(ctx, decl->Range.First, decl->Range.Last, &decl->Image)) if (!add_images(ctx, decl->Range.First, decl->Range.Last, &decl->Image))
@ -1228,7 +1228,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
break; break;
case TGSI_FILE_BUFFER: case TGSI_FILE_BUFFER:
if (decl->Range.First >= 32) { if (decl->Range.First >= 32) {
fprintf(stderr, "Buffer view exceeded, max is 32\n"); vrend_printf( "Buffer view exceeded, max is 32\n");
return false; return false;
} }
ctx->ssbo_used_mask |= (1 << decl->Range.First); ctx->ssbo_used_mask |= (1 << decl->Range.First);
@ -1244,11 +1244,11 @@ iter_declaration(struct tgsi_iterate_context *iter,
case TGSI_FILE_CONSTANT: case TGSI_FILE_CONSTANT:
if (decl->Declaration.Dimension && decl->Dim.Index2D != 0) { if (decl->Declaration.Dimension && decl->Dim.Index2D != 0) {
if (decl->Dim.Index2D > 31) { if (decl->Dim.Index2D > 31) {
fprintf(stderr, "Number of uniforms exceeded, max is 32\n"); vrend_printf( "Number of uniforms exceeded, max is 32\n");
return false; return false;
} }
if (ctx->ubo_used_mask & (1 << decl->Dim.Index2D)) { if (ctx->ubo_used_mask & (1 << decl->Dim.Index2D)) {
fprintf(stderr, "UBO #%d is already defined\n", decl->Dim.Index2D); vrend_printf( "UBO #%d is already defined\n", decl->Dim.Index2D);
return false; return false;
} }
ctx->ubo_used_mask |= (1 << decl->Dim.Index2D); ctx->ubo_used_mask |= (1 << decl->Dim.Index2D);
@ -1269,7 +1269,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
case TGSI_FILE_SYSTEM_VALUE: case TGSI_FILE_SYSTEM_VALUE:
i = ctx->num_system_values++; i = ctx->num_system_values++;
if (ctx->num_system_values > ARRAY_SIZE(ctx->system_values)) { if (ctx->num_system_values > ARRAY_SIZE(ctx->system_values)) {
fprintf(stderr, "Number of system values exceeded, max is %lu\n", ARRAY_SIZE(ctx->system_values)); vrend_printf( "Number of system values exceeded, max is %lu\n", ARRAY_SIZE(ctx->system_values));
return false; return false;
} }
@ -1323,7 +1323,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
name_prefix = "gl_NumWorkGroups"; name_prefix = "gl_NumWorkGroups";
ctx->system_values[i].override_no_wm = false; ctx->system_values[i].override_no_wm = false;
} else { } else {
fprintf(stderr, "unsupported system value %d\n", decl->Semantic.Name); vrend_printf( "unsupported system value %d\n", decl->Semantic.Name);
name_prefix = "unknown"; name_prefix = "unknown";
} }
snprintf(ctx->system_values[i].glsl_name, 64, "%s", name_prefix); snprintf(ctx->system_values[i].glsl_name, 64, "%s", name_prefix);
@ -1333,7 +1333,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
break; break;
case TGSI_FILE_HW_ATOMIC: case TGSI_FILE_HW_ATOMIC:
if (ctx->num_abo >= ARRAY_SIZE(ctx->abo_idx)) { if (ctx->num_abo >= ARRAY_SIZE(ctx->abo_idx)) {
fprintf(stderr, "Number of atomic counter buffers exceeded, max is %lu\n", ARRAY_SIZE(ctx->abo_idx)); vrend_printf( "Number of atomic counter buffers exceeded, max is %lu\n", ARRAY_SIZE(ctx->abo_idx));
return false; return false;
} }
ctx->abo_idx[ctx->num_abo] = decl->Dim.Index2D; ctx->abo_idx[ctx->num_abo] = decl->Dim.Index2D;
@ -1342,7 +1342,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->num_abo++; ctx->num_abo++;
break; break;
default: default:
fprintf(stderr,"unsupported file %d declaration\n", decl->Declaration.File); vrend_printf("unsupported file %d declaration\n", decl->Declaration.File);
break; break;
} }
@ -1440,7 +1440,7 @@ iter_immediate(
uint32_t first = ctx->num_imm; uint32_t first = ctx->num_imm;
if (first >= ARRAY_SIZE(ctx->imm)) { if (first >= ARRAY_SIZE(ctx->imm)) {
fprintf(stderr, "Number of immediates exceeded, max is: %lu\n", ARRAY_SIZE(ctx->imm)); vrend_printf( "Number of immediates exceeded, max is: %lu\n", ARRAY_SIZE(ctx->imm));
return false; return false;
} }
@ -1523,7 +1523,7 @@ static void emit_alpha_test(struct dump_ctx *ctx)
snprintf(comp_buf, 128, "%s %s %f", "fsout_c0.w", atests[ctx->key->alpha_test], ctx->key->alpha_ref_val); snprintf(comp_buf, 128, "%s %s %f", "fsout_c0.w", atests[ctx->key->alpha_test], ctx->key->alpha_ref_val);
break; break;
default: default:
fprintf(stderr, "invalid alpha-test: %x\n", ctx->key->alpha_test); vrend_printf( "invalid alpha-test: %x\n", ctx->key->alpha_test);
set_buf_error(ctx); set_buf_error(ctx);
return; return;
} }
@ -1583,7 +1583,7 @@ static void emit_so_movs(struct dump_ctx *ctx)
char writemask[6]; char writemask[6];
if (ctx->so->num_outputs >= PIPE_MAX_SO_OUTPUTS) { if (ctx->so->num_outputs >= PIPE_MAX_SO_OUTPUTS) {
fprintf(stderr, "Num outputs exceeded, max is %u\n", PIPE_MAX_SO_OUTPUTS); vrend_printf( "Num outputs exceeded, max is %u\n", PIPE_MAX_SO_OUTPUTS);
set_buf_error(ctx); set_buf_error(ctx);
return; return;
} }
@ -1720,7 +1720,7 @@ static void set_texture_reqs(struct dump_ctx *ctx,
bool *is_shad) bool *is_shad)
{ {
if (sreg_index >= ARRAY_SIZE(ctx->samplers)) { if (sreg_index >= ARRAY_SIZE(ctx->samplers)) {
fprintf(stderr, "Sampler view exceeded, max is %lu\n", ARRAY_SIZE(ctx->samplers)); vrend_printf( "Sampler view exceeded, max is %lu\n", ARRAY_SIZE(ctx->samplers));
set_buf_error(ctx); set_buf_error(ctx);
return; return;
} }
@ -1761,7 +1761,7 @@ static void set_texture_reqs(struct dump_ctx *ctx,
*is_shad = true; *is_shad = true;
break; break;
default: default:
fprintf(stderr, "unhandled texture: %x\n", inst->Texture.Texture); vrend_printf( "unhandled texture: %x\n", inst->Texture.Texture);
set_buf_error(ctx); set_buf_error(ctx);
return; return;
} }
@ -1938,7 +1938,7 @@ static bool fill_offset_buffer(struct dump_ctx *ctx,
imd->val[inst->TexOffsets[0].SwizzleZ].i); imd->val[inst->TexOffsets[0].SwizzleZ].i);
break; break;
default: default:
fprintf(stderr, "unhandled texture: %x\n", inst->Texture.Texture); vrend_printf( "unhandled texture: %x\n", inst->Texture.Texture);
return false; return false;
} }
} else if (inst->TexOffsets[0].File == TGSI_FILE_TEMPORARY) { } else if (inst->TexOffsets[0].File == TGSI_FILE_TEMPORARY) {
@ -1975,7 +1975,7 @@ static bool fill_offset_buffer(struct dump_ctx *ctx,
get_swiz_char(inst->TexOffsets[0].SwizzleZ)); get_swiz_char(inst->TexOffsets[0].SwizzleZ));
break; break;
default: default:
fprintf(stderr, "unhandled texture: %x\n", inst->Texture.Texture); vrend_printf( "unhandled texture: %x\n", inst->Texture.Texture);
return false; return false;
break; break;
} }
@ -2014,7 +2014,7 @@ static bool fill_offset_buffer(struct dump_ctx *ctx,
get_swiz_char(inst->TexOffsets[0].SwizzleZ)); get_swiz_char(inst->TexOffsets[0].SwizzleZ));
break; break;
default: default:
fprintf(stderr, "unhandled texture: %x\n", inst->Texture.Texture); vrend_printf( "unhandled texture: %x\n", inst->Texture.Texture);
return false; return false;
break; break;
} }
@ -2215,7 +2215,7 @@ static void translate_tex(struct dump_ctx *ctx,
if (inst->Texture.NumOffsets == 1) { if (inst->Texture.NumOffsets == 1) {
if (inst->TexOffsets[0].Index >= (int)ARRAY_SIZE(ctx->imm)) { if (inst->TexOffsets[0].Index >= (int)ARRAY_SIZE(ctx->imm)) {
fprintf(stderr, "Immediate exceeded, max is %lu\n", ARRAY_SIZE(ctx->imm)); vrend_printf( "Immediate exceeded, max is %lu\n", ARRAY_SIZE(ctx->imm));
set_buf_error(ctx); set_buf_error(ctx);
return; return;
} }
@ -2341,7 +2341,7 @@ static bool is_integer_memory(struct dump_ctx *ctx, enum tgsi_file_type file_typ
case TGSI_FILE_MEMORY: case TGSI_FILE_MEMORY:
return ctx->integer_memory; return ctx->integer_memory;
default: default:
fprintf(stderr, "Invalid file type"); vrend_printf( "Invalid file type");
} }
return false; return false;
@ -2504,7 +2504,7 @@ static const char *get_atomic_opname(int tgsi_opcode, bool *is_cas)
opname = "Max"; opname = "Max";
break; break;
default: default:
fprintf(stderr, "illegal atomic opcode"); vrend_printf( "illegal atomic opcode");
return NULL; return NULL;
} }
return opname; return opname;
@ -3103,7 +3103,7 @@ get_source_info(struct dump_ctx *ctx,
sinfo->sreg_index = src->Register.Index; sinfo->sreg_index = src->Register.Index;
} else if (src->Register.File == TGSI_FILE_IMMEDIATE) { } else if (src->Register.File == TGSI_FILE_IMMEDIATE) {
if (src->Register.Index >= (int)ARRAY_SIZE(ctx->imm)) { if (src->Register.Index >= (int)ARRAY_SIZE(ctx->imm)) {
fprintf(stderr, "Immediate exceeded, max is %lu\n", ARRAY_SIZE(ctx->imm)); vrend_printf( "Immediate exceeded, max is %lu\n", ARRAY_SIZE(ctx->imm));
return false; return false;
} }
struct immed *imd = &ctx->imm[src->Register.Index]; struct immed *imd = &ctx->imm[src->Register.Index];
@ -3180,7 +3180,7 @@ get_source_info(struct dump_ctx *ctx,
snprintf(temp, 48, "%uU", imd->val[idx].ui); snprintf(temp, 48, "%uU", imd->val[idx].ui);
break; break;
default: default:
fprintf(stderr, "unhandled imm type: %x\n", imd->type); vrend_printf( "unhandled imm type: %x\n", imd->type);
return false; return false;
} }
strncat(srcs[i], temp, 255); strncat(srcs[i], temp, 255);
@ -3806,7 +3806,7 @@ iter_instruction(struct tgsi_iterate_context *iter,
emit_buff(ctx, "%s = uintBitsToFloat(clock2x32ARB());\n", dsts[0]); emit_buff(ctx, "%s = uintBitsToFloat(clock2x32ARB());\n", dsts[0]);
break; break;
default: default:
fprintf(stderr,"failed to convert opcode %d\n", inst->Instruction.Opcode); vrend_printf("failed to convert opcode %d\n", inst->Instruction.Opcode);
break; break;
} }
@ -4205,7 +4205,7 @@ const char *get_internalformat_string(int virgl_format, enum tgsi_return_type *s
return ""; return "";
default: default:
*stype = TGSI_RETURN_TYPE_UNORM; *stype = TGSI_RETURN_TYPE_UNORM;
fprintf(stderr, "illegal format %d\n", virgl_format); vrend_printf( "illegal format %d\n", virgl_format);
return ""; return "";
} }
} }
@ -4852,7 +4852,7 @@ static void emit_ios(struct dump_ctx *ctx)
ctx->num_interps = 0; ctx->num_interps = 0;
if (ctx->so && ctx->so->num_outputs >= PIPE_MAX_SO_OUTPUTS) { if (ctx->so && ctx->so->num_outputs >= PIPE_MAX_SO_OUTPUTS) {
fprintf(stderr, "Num outputs exceeded, max is %u\n", PIPE_MAX_SO_OUTPUTS); vrend_printf( "Num outputs exceeded, max is %u\n", PIPE_MAX_SO_OUTPUTS);
set_hdr_error(ctx); set_hdr_error(ctx);
return; return;
} }
@ -4904,7 +4904,7 @@ static boolean fill_fragment_interpolants(struct dump_ctx *ctx, struct vrend_sha
continue; continue;
if (index >= ctx->num_interps) { if (index >= ctx->num_interps) {
fprintf(stderr, "mismatch in number of interps %d %d\n", index, ctx->num_interps); vrend_printf( "mismatch in number of interps %d %d\n", index, ctx->num_interps);
return true; return true;
} }
sinfo->interpinfo[index].semantic_name = ctx->inputs[i].name; sinfo->interpinfo[index].semantic_name = ctx->inputs[i].name;
@ -5213,7 +5213,7 @@ bool vrend_patch_vertex_shader_interpolants(struct vrend_context *rctx,
replace_interp(program, glsl_name, pstring, auxstring); replace_interp(program, glsl_name, pstring, auxstring);
break; break;
default: default:
fprintf(stderr,"unhandled semantic: %x\n", fs_info->interpinfo[i].semantic_name); vrend_printf("unhandled semantic: %x\n", fs_info->interpinfo[i].semantic_name);
return false; return false;
} }
} }

Loading…
Cancel
Save