On 02/14/2018 03:46 PM, Charmaine Lee wrote:

From: Brian Paul <bri...@vmware.com>
Sent: Wednesday, February 14, 2018 1:15 PM
To: mesa-dev@lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 1/3] svga: call tgsi_scan_shader() for dummy shaders

If we fail to compile the normal VS or FS we fall back to a simple/
dummy shader.  We need to rescan the the shader to update the shader
info.  Otherwise, this can lead to further translations failures
because the shader info doesn't match the actual shader.

Found by adding some extra debug assertions in the state-update code
while debugging something else.
src/gallium/drivers/svga/svga_state_fs.c | 2 ++
src/gallium/drivers/svga/svga_state_vs.c | 2 ++
2 files changed, 4 insertions(+)

diff --git a/src/gallium/drivers/svga/svga_state_fs.c 
index 5e56899..f185a68 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -115,6 +115,8 @@ get_compiled_dummy_shader(struct svga_context *svga,
    FREE((void *) fs->base.tokens);
    fs->base.tokens = dummy;

+   tgsi_scan_shader(fs->base.tokens, &fs->base.info);

To be complete, we need to get the generic_inputs mask and call 
svga_remap_generics again.

Will do, though, these dummy shaders have no generic inputs/outputs.

v2 coming...


    variant = translate_fragment_program(svga, fs, key);
    return variant;
diff --git a/src/gallium/drivers/svga/svga_state_vs.c 
index a0ab868..1dcc161 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -105,6 +105,8 @@ get_compiled_dummy_vertex_shader(struct svga_context *svga,
    FREE((void *) vs->base.tokens);
    vs->base.tokens = dummy;

+   tgsi_scan_shader(vs->base.tokens, &vs->base.info);
Need to set the generic_outputs mask again.

    variant = translate_vertex_program(svga, vs, key);
    return variant;


mesa-dev mailing list

Reply via email to