summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAntonio Caggiano <antonio.caggiano@collabora.com>2021-10-25 17:38:38 +0200
committerGert Wollny <gw.fossdev@gmail.com>2021-11-23 14:41:02 +0000
commitba30df1bdce1654d736154c90e64e6c5f4047e4a (patch)
tree70986147d17260ae3e781a92ad52b4be572f17ad /tests
parent013d0db3e00916b64cd469ec407e52176ee6b6db (diff)
shader: Link shader command
Add a new command associated to glLinkProgram. With this we should be able to compile and link shaders when requested by the user. Together with the command we expect an array of shader handles attached to the program, where each position of the array corresponds to a pipe shader type. Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com> Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_virgl_cmd.c9
-rw-r--r--tests/testvirgl_encode.c12
-rw-r--r--tests/testvirgl_encode.h1
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_virgl_cmd.c b/tests/test_virgl_cmd.c
index 3c2fd24..4c8d689 100644
--- a/tests/test_virgl_cmd.c
+++ b/tests/test_virgl_cmd.c
@@ -372,6 +372,15 @@ START_TEST(virgl_test_render_simple)
virgl_encode_bind_shader(&ctx, fs_handle, PIPE_SHADER_FRAGMENT);
}
+ /* link shader */
+ {
+ uint32_t handles[PIPE_SHADER_TYPES];
+ memset(handles, 0, sizeof(handles));
+ handles[PIPE_SHADER_VERTEX] = vs_handle;
+ handles[PIPE_SHADER_FRAGMENT] = fs_handle;
+ virgl_encode_link_shader(&ctx, handles);
+ }
+
/* set blend state */
{
struct pipe_blend_state blend;
diff --git a/tests/testvirgl_encode.c b/tests/testvirgl_encode.c
index f44a640..38ad5e1 100644
--- a/tests/testvirgl_encode.c
+++ b/tests/testvirgl_encode.c
@@ -942,6 +942,18 @@ int virgl_encoder_destroy_sub_ctx(struct virgl_context *ctx, uint32_t sub_ctx_id
return 0;
}
+int virgl_encode_link_shader(struct virgl_context *ctx, uint32_t *handles)
+{
+ virgl_encoder_write_cmd_dword(ctx, VIRGL_CMD0(VIRGL_CCMD_LINK_SHADER, 0, VIRGL_LINK_SHADER_SIZE));
+ virgl_encoder_write_dword(ctx->cbuf, handles[PIPE_SHADER_VERTEX]);
+ virgl_encoder_write_dword(ctx->cbuf, handles[PIPE_SHADER_FRAGMENT]);
+ virgl_encoder_write_dword(ctx->cbuf, handles[PIPE_SHADER_GEOMETRY]);
+ virgl_encoder_write_dword(ctx->cbuf, handles[PIPE_SHADER_TESS_CTRL]);
+ virgl_encoder_write_dword(ctx->cbuf, handles[PIPE_SHADER_TESS_EVAL]);
+ virgl_encoder_write_dword(ctx->cbuf, handles[PIPE_SHADER_COMPUTE]);
+ return 0;
+}
+
int virgl_encode_bind_shader(struct virgl_context *ctx,
uint32_t handle, uint32_t type)
{
diff --git a/tests/testvirgl_encode.h b/tests/testvirgl_encode.h
index c5bd9c1..cd1ab2b 100644
--- a/tests/testvirgl_encode.h
+++ b/tests/testvirgl_encode.h
@@ -258,6 +258,7 @@ int virgl_encoder_render_condition(struct virgl_context *ctx,
int virgl_encoder_set_sub_ctx(struct virgl_context *ctx, uint32_t sub_ctx_id);
int virgl_encoder_create_sub_ctx(struct virgl_context *ctx, uint32_t sub_ctx_id);
int virgl_encoder_destroy_sub_ctx(struct virgl_context *ctx, uint32_t sub_ctx_id);
+int virgl_encode_link_shader(struct virgl_context *ctx, uint32_t *handles);
int virgl_encode_bind_shader(struct virgl_context *ctx,
uint32_t handle, uint32_t type);
#endif