summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_shader.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2014-02-08 09:51:14 -0800
committerBrian Paul <[email protected]>2014-02-14 08:21:44 -0700
commitf84c830b144fd4d53f862fc6ad05541e5bf60a3b (patch)
treefaf33d8578c4fed38058e337898d32b9e73beb2d /src/gallium/drivers/svga/svga_shader.c
parent2f1fc8db108eb771414aa5440d4c439f63f4e7c1 (diff)
svga: update shader code for GBS
Reviewed-by: Thomas Hellstrom <[email protected]> Cc: "10.1" <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_shader.c')
-rw-r--r--src/gallium/drivers/svga/svga_shader.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/gallium/drivers/svga/svga_shader.c b/src/gallium/drivers/svga/svga_shader.c
index 88877b27e98..6b6b441cb82 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -43,7 +43,17 @@ svga_define_shader(struct svga_context *svga,
{
unsigned codeLen = variant->nr_tokens * sizeof(variant->tokens[0]);
- {
+ if (svga_have_gb_objects(svga)) {
+ struct svga_winsys_screen *sws = svga_screen(svga->pipe.screen)->sws;
+
+ variant->gb_shader = sws->shader_create(sws, type,
+ variant->tokens, codeLen);
+ if (!variant->gb_shader)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ return PIPE_OK;
+ }
+ else {
enum pipe_error ret;
/* Allocate an integer ID for the shader */
@@ -79,6 +89,14 @@ svga_destroy_shader_variant(struct svga_context *svga,
{
enum pipe_error ret = PIPE_OK;
+ if (svga_have_gb_objects(svga)) {
+ struct svga_winsys_screen *sws = svga_screen(svga->pipe.screen)->sws;
+
+ sws->shader_destroy(sws, variant->gb_shader);
+ variant->gb_shader = NULL;
+ goto end;
+ }
+
/* first try */
if (variant->id != UTIL_BITMASK_INVALID_INDEX) {
ret = SVGA3D_DestroyShader(svga->swc, variant->id, type);
@@ -94,6 +112,7 @@ svga_destroy_shader_variant(struct svga_context *svga,
util_bitmask_clear(svga->shader_id_bm, variant->id);
}
+end:
FREE((unsigned *)variant->tokens);
FREE(variant);