tests: align viewports/scissor encoding with mesa.

This just realigns some of the encoder code with mesa.
macos/master
Dave Airlie 9 years ago
parent fd8116476b
commit 016341850c
  1. 6
      tests/test_virgl_cmd.c
  2. 36
      tests/testvirgl_encode.c
  3. 8
      tests/testvirgl_encode.h

@ -414,7 +414,7 @@ START_TEST(virgl_test_render_simple)
vp.translate[0] = half_w + 0;
vp.translate[1] = half_h + 0;
vp.translate[2] = half_d + znear;
virgl_encoder_set_viewport_state(&ctx, &vp);
virgl_encoder_set_viewport_states(&ctx, 0, 1, &vp);
}
/* draw */
@ -670,7 +670,7 @@ START_TEST(virgl_test_render_geom_simple)
vp.translate[0] = half_w + 0;
vp.translate[1] = half_h + 0;
vp.translate[2] = half_d + znear;
virgl_encoder_set_viewport_state(&ctx, &vp);
virgl_encoder_set_viewport_states(&ctx, 0, 1, &vp);
}
/* draw */
@ -915,7 +915,7 @@ START_TEST(virgl_test_render_xfb)
vp.translate[0] = half_w + 0;
vp.translate[1] = half_h + 0;
vp.translate[2] = half_d + znear;
virgl_encoder_set_viewport_state(&ctx, &vp);
virgl_encoder_set_viewport_states(&ctx, 0, 1, &vp);
}
/* draw */

@ -296,16 +296,20 @@ int virgl_encoder_set_framebuffer_state(struct virgl_context *ctx,
return 0;
}
int virgl_encoder_set_viewport_state(struct virgl_context *ctx,
const struct pipe_viewport_state *state)
int virgl_encoder_set_viewport_states(struct virgl_context *ctx,
int start_slot,
int num_viewports,
const struct pipe_viewport_state *states)
{
int i;
virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_VIEWPORT_STATE, 0, VIRGL_SET_VIEWPORT_STATE_SIZE(1)));
virgl_encoder_write_dword(ctx->cbuf, 0);
for (i = 0; i < 3; i++)
virgl_encoder_write_dword(ctx->cbuf, fui(state->scale[i]));
for (i = 0; i < 3; i++)
virgl_encoder_write_dword(ctx->cbuf, fui(state->translate[i]));
int i,v;
virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_VIEWPORT_STATE, 0, VIRGL_SET_VIEWPORT_STATE_SIZE(num_viewports)));
virgl_encoder_write_dword(ctx->cbuf, start_slot);
for (v = 0; v < num_viewports; v++) {
for (i = 0; i < 3; i++)
virgl_encoder_write_dword(ctx->cbuf, fui(states[v].scale[i]));
for (i = 0; i < 3; i++)
virgl_encoder_write_dword(ctx->cbuf, fui(states[v].translate[i]));
}
return 0;
}
@ -664,16 +668,16 @@ int virgl_encoder_set_blend_color(struct virgl_context *ctx,
}
int virgl_encoder_set_scissor_state(struct virgl_context *ctx,
int start_slot,
int num_scissors,
const struct pipe_scissor_state *ss)
unsigned start_slot,
int num_scissors,
const struct pipe_scissor_state *ss)
{
int s;
int i;
virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_SET_SCISSOR_STATE, 0, VIRGL_SET_SCISSOR_STATE_SIZE(num_scissors)));
virgl_encoder_write_dword(ctx->cbuf, start_slot);
for (s = 0; s < num_scissors; s++) {
virgl_encoder_write_dword(ctx->cbuf, (ss[s].minx | ss[s].miny << 16));
virgl_encoder_write_dword(ctx->cbuf, (ss[s].maxx | ss[s].maxy << 16));
for (i = 0; i < num_scissors; i++) {
virgl_encoder_write_dword(ctx->cbuf, (ss[i].minx | ss[i].miny << 16));
virgl_encoder_write_dword(ctx->cbuf, (ss[i].maxx | ss[i].maxy << 16));
}
return 0;
}

@ -102,8 +102,10 @@ int virgl_encode_delete_object(struct virgl_context *ctx,
int virgl_encoder_set_framebuffer_state(struct virgl_context *ctx,
const struct pipe_framebuffer_state *state);
int virgl_encoder_set_viewport_state(struct virgl_context *ctx,
const struct pipe_viewport_state *state);
int virgl_encoder_set_viewport_states(struct virgl_context *ctx,
int start_slot,
int num_viewports,
const struct pipe_viewport_state *states);
int virgl_encoder_draw_vbo(struct virgl_context *ctx,
const struct pipe_draw_info *info);
@ -181,7 +183,7 @@ int virgl_encoder_set_blend_color(struct virgl_context *ctx,
const struct pipe_blend_color *color);
int virgl_encoder_set_scissor_state(struct virgl_context *ctx,
int start_slot,
unsigned start_slot,
int num_scissors,
const struct pipe_scissor_state *ss);

Loading…
Cancel
Save