summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2015-10-23 09:34:59 +1000
committerDave Airlie <airlied@redhat.com>2015-10-23 11:08:31 +1000
commit016341850c7f1438299b3436a93effb0eccde1bf (patch)
tree2ccb28306f48551e09e79f627b4c7ee6bd2d5a2c /tests
parentfd8116476b129288bf8fe6ecedc69135dae7b7a1 (diff)
tests: align viewports/scissor encoding with mesa.
This just realigns some of the encoder code with mesa.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_virgl_cmd.c6
-rw-r--r--tests/testvirgl_encode.c36
-rw-r--r--tests/testvirgl_encode.h8
3 files changed, 28 insertions, 22 deletions
diff --git a/tests/test_virgl_cmd.c b/tests/test_virgl_cmd.c
index d317327..b3c102e 100644
--- a/tests/test_virgl_cmd.c
+++ b/tests/test_virgl_cmd.c
@@ -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 */
diff --git a/tests/testvirgl_encode.c b/tests/testvirgl_encode.c
index a3beaf9..944cf20 100644
--- a/tests/testvirgl_encode.c
+++ b/tests/testvirgl_encode.c
@@ -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;
}
diff --git a/tests/testvirgl_encode.h b/tests/testvirgl_encode.h
index feb2be8..d717749 100644
--- a/tests/testvirgl_encode.h
+++ b/tests/testvirgl_encode.h
@@ -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);