<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
Reviewed-by: Neha Bhende <bhenden@vmware.com><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 10pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p style="margin-top: 0px; margin-bottom: 0px;"><span style="font-size:11pt; font-family:Calibri,Helvetica,sans-serif"></span><span style="font-size:10pt; font-family:Calibri,Helvetica,sans-serif">Regards,</span></p>
<span style="font-size:10pt"></span><span style="font-size:11pt; font-family:Calibri,Helvetica,sans-serif"></span><span style="font-size:10pt"></span>
<p style="margin-top: 0px; margin-bottom: 0px;"><span style="font-size:10pt; font-family:Calibri,Helvetica,sans-serif">Neha</span><br>
</p>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Brian Paul <brianp@vmware.com><br>
<b>Sent:</b> Thursday, March 7, 2019 8:20 AM<br>
<b>To:</b> mesa-dev@lists.freedesktop.org<br>
<b>Cc:</b> Neha Bhende<br>
<b>Subject:</b> [PATCH] st/mesa: move, clean-up shader variant key decls/inits</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Move the variant key declarations inside the scope they're used.<br>
Use designated initializers instead of memset() calls.<br>
---<br>
src/mesa/state_tracker/st_atom_shader.c | 8 ++++----<br>
src/mesa/state_tracker/st_program.c | 9 +++------<br>
2 files changed, 7 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c<br>
index c6faa3f..ac7a1a5 100644<br>
--- a/src/mesa/state_tracker/st_atom_shader.c<br>
+++ b/src/mesa/state_tracker/st_atom_shader.c<br>
@@ -97,7 +97,6 @@ void<br>
st_update_fp( struct st_context *st )<br>
{<br>
struct st_fragment_program *stfp;<br>
- struct st_fp_variant_key key;<br>
<br>
assert(st->ctx->FragmentProgram._Current);<br>
stfp = st_fragment_program(st->ctx->FragmentProgram._Current);<br>
@@ -113,7 +112,8 @@ st_update_fp( struct st_context *st )<br>
!stfp->variants->key.bitmap) {<br>
shader = stfp->variants->driver_shader;<br>
} else {<br>
- memset(&key, 0, sizeof(key));<br>
+ struct st_fp_variant_key key = {0};<br>
+<br>
key.st = st->has_shareable_shaders ? NULL : st;<br>
<br>
/* _NEW_FRAG_CLAMP */<br>
@@ -155,7 +155,6 @@ void<br>
st_update_vp( struct st_context *st )<br>
{<br>
struct st_vertex_program *stvp;<br>
- struct st_vp_variant_key key;<br>
<br>
/* find active shader and params -- Should be covered by<br>
* ST_NEW_VERTEX_PROGRAM<br>
@@ -169,7 +168,8 @@ st_update_vp( struct st_context *st )<br>
stvp->variants->key.passthrough_edgeflags == st->vertdata_edgeflags) {<br>
st->vp_variant = stvp->variants;<br>
} else {<br>
- memset(&key, 0, sizeof key);<br>
+ struct st_vp_variant_key key = {0};<br>
+<br>
key.st = st->has_shareable_shaders ? NULL : st;<br>
<br>
/* When this is true, we will add an extra input to the vertex<br>
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c<br>
index c2daa4d..5e43a2e 100644<br>
--- a/src/mesa/state_tracker/st_program.c<br>
+++ b/src/mesa/state_tracker/st_program.c<br>
@@ -1772,9 +1772,8 @@ st_get_cp_variant(struct st_context *st,<br>
{<br>
struct pipe_context *pipe = st->pipe;<br>
struct st_basic_variant *v;<br>
- struct st_basic_variant_key key;<br>
+ struct st_basic_variant_key key = {0};<br>
<br>
- memset(&key, 0, sizeof(key));<br>
key.st = st->has_shareable_shaders ? NULL : st;<br>
<br>
/* Search for existing variant */<br>
@@ -1996,9 +1995,8 @@ st_precompile_shader_variant(struct st_context *st,<br>
switch (prog->Target) {<br>
case GL_VERTEX_PROGRAM_ARB: {<br>
struct st_vertex_program *p = (struct st_vertex_program *)prog;<br>
- struct st_vp_variant_key key;<br>
+ struct st_vp_variant_key key = {0};<br>
<br>
- memset(&key, 0, sizeof(key));<br>
key.st = st->has_shareable_shaders ? NULL : st;<br>
st_get_vp_variant(st, p, &key);<br>
break;<br>
@@ -2024,9 +2022,8 @@ st_precompile_shader_variant(struct st_context *st,<br>
<br>
case GL_FRAGMENT_PROGRAM_ARB: {<br>
struct st_fragment_program *p = (struct st_fragment_program *)prog;<br>
- struct st_fp_variant_key key;<br>
+ struct st_fp_variant_key key = {0};<br>
<br>
- memset(&key, 0, sizeof(key));<br>
key.st = st->has_shareable_shaders ? NULL : st;<br>
st_get_fp_variant(st, p, &key);<br>
break;<br>
-- <br>
1.8.5.6<br>
<br>
</div>
</span></font></div>
</body>
</html>