[Mesa-dev] [PATCH 1/2] svga: pass NULL to ureg_get_tokens()
Timothy Arceri
tarceri at itsqueeze.com
Thu Mar 2 23:12:08 UTC 2017
The number of tokens in never used and the pointer is NULL checked
so just pass NULL.
---
src/gallium/drivers/svga/svga_state_fs.c | 3 +--
src/gallium/drivers/svga/svga_state_vs.c | 6 ++----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c
index 327d17a..4898744 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -54,32 +54,31 @@ get_dummy_fragment_shader(void)
{
#ifdef DEBUG
static const float color[4] = { 1.0, 0.0, 0.0, 0.0 }; /* red */
#else
static const float color[4] = { 0.0, 0.0, 0.0, 0.0 }; /* black */
#endif
struct ureg_program *ureg;
const struct tgsi_token *tokens;
struct ureg_src src;
struct ureg_dst dst;
- unsigned num_tokens;
ureg = ureg_create(PIPE_SHADER_FRAGMENT);
if (!ureg)
return NULL;
dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0);
src = ureg_DECL_immediate(ureg, color, 4);
ureg_MOV(ureg, dst, src);
ureg_END(ureg);
- tokens = ureg_get_tokens(ureg, &num_tokens);
+ tokens = ureg_get_tokens(ureg, NULL);
ureg_destroy(ureg);
return tokens;
}
static struct svga_shader_variant *
translate_fragment_program(struct svga_context *svga,
const struct svga_fragment_shader *fs,
diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c
index aa351bd..325ef3e 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -45,32 +45,31 @@
* that simply emits a (0,0,0,1) vertex position.
*/
static const struct tgsi_token *
get_dummy_vertex_shader(void)
{
static const float zero[4] = { 0.0, 0.0, 0.0, 1.0 };
struct ureg_program *ureg;
const struct tgsi_token *tokens;
struct ureg_src src;
struct ureg_dst dst;
- unsigned num_tokens;
ureg = ureg_create(PIPE_SHADER_VERTEX);
if (!ureg)
return NULL;
dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0);
src = ureg_DECL_immediate(ureg, zero, 4);
ureg_MOV(ureg, dst, src);
ureg_END(ureg);
- tokens = ureg_get_tokens(ureg, &num_tokens);
+ tokens = ureg_get_tokens(ureg, NULL);
ureg_destroy(ureg);
return tokens;
}
static struct svga_shader_variant *
translate_vertex_program(struct svga_context *svga,
const struct svga_vertex_shader *vs,
@@ -257,21 +256,20 @@ compile_passthrough_vs(struct svga_context *svga,
struct svga_shader_variant **out_variant)
{
struct svga_shader_variant *variant = NULL;
unsigned num_inputs;
unsigned i;
unsigned num_elements;
struct svga_vertex_shader new_vs;
struct ureg_src src[PIPE_MAX_SHADER_INPUTS];
struct ureg_dst dst[PIPE_MAX_SHADER_OUTPUTS];
struct ureg_program *ureg;
- unsigned num_tokens;
struct svga_compile_key key;
enum pipe_error ret;
assert(svga_have_vgpu10(svga));
assert(fs);
num_inputs = fs->base.info.num_inputs;
ureg = ureg_create(PIPE_SHADER_VERTEX);
if (!ureg)
@@ -306,21 +304,21 @@ compile_passthrough_vs(struct svga_context *svga,
}
}
for (i = 0; i < num_elements; i++) {
ureg_MOV(ureg, dst[i], src[i]);
}
ureg_END(ureg);
memset(&new_vs, 0, sizeof(new_vs));
- new_vs.base.tokens = ureg_get_tokens(ureg, &num_tokens);
+ new_vs.base.tokens = ureg_get_tokens(ureg, NULL);
tgsi_scan_shader(new_vs.base.tokens, &new_vs.base.info);
memset(&key, 0, sizeof(key));
key.vs.undo_viewport = 1;
ret = compile_vs(svga, &new_vs, &key, &variant);
if (ret != PIPE_OK)
return ret;
ureg_free_tokens(new_vs.base.tokens);
--
2.9.3
More information about the mesa-dev
mailing list