st/mesa: move, clean-up shader variant key decls/inits
Move the variant key declarations inside the scope they're used. Use designated initializers instead of memset() calls. Reviewed-by: Neha Bhende <bhenden@vmware.com>
This commit is contained in:
@@ -97,7 +97,6 @@ void
|
|||||||
st_update_fp( struct st_context *st )
|
st_update_fp( struct st_context *st )
|
||||||
{
|
{
|
||||||
struct st_fragment_program *stfp;
|
struct st_fragment_program *stfp;
|
||||||
struct st_fp_variant_key key;
|
|
||||||
|
|
||||||
assert(st->ctx->FragmentProgram._Current);
|
assert(st->ctx->FragmentProgram._Current);
|
||||||
stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
|
stfp = st_fragment_program(st->ctx->FragmentProgram._Current);
|
||||||
@@ -113,7 +112,8 @@ st_update_fp( struct st_context *st )
|
|||||||
!stfp->variants->key.bitmap) {
|
!stfp->variants->key.bitmap) {
|
||||||
shader = stfp->variants->driver_shader;
|
shader = stfp->variants->driver_shader;
|
||||||
} else {
|
} else {
|
||||||
memset(&key, 0, sizeof(key));
|
struct st_fp_variant_key key = {0};
|
||||||
|
|
||||||
key.st = st->has_shareable_shaders ? NULL : st;
|
key.st = st->has_shareable_shaders ? NULL : st;
|
||||||
|
|
||||||
/* _NEW_FRAG_CLAMP */
|
/* _NEW_FRAG_CLAMP */
|
||||||
@@ -155,7 +155,6 @@ void
|
|||||||
st_update_vp( struct st_context *st )
|
st_update_vp( struct st_context *st )
|
||||||
{
|
{
|
||||||
struct st_vertex_program *stvp;
|
struct st_vertex_program *stvp;
|
||||||
struct st_vp_variant_key key;
|
|
||||||
|
|
||||||
/* find active shader and params -- Should be covered by
|
/* find active shader and params -- Should be covered by
|
||||||
* ST_NEW_VERTEX_PROGRAM
|
* ST_NEW_VERTEX_PROGRAM
|
||||||
@@ -169,7 +168,8 @@ st_update_vp( struct st_context *st )
|
|||||||
stvp->variants->key.passthrough_edgeflags == st->vertdata_edgeflags) {
|
stvp->variants->key.passthrough_edgeflags == st->vertdata_edgeflags) {
|
||||||
st->vp_variant = stvp->variants;
|
st->vp_variant = stvp->variants;
|
||||||
} else {
|
} else {
|
||||||
memset(&key, 0, sizeof key);
|
struct st_vp_variant_key key = {0};
|
||||||
|
|
||||||
key.st = st->has_shareable_shaders ? NULL : st;
|
key.st = st->has_shareable_shaders ? NULL : st;
|
||||||
|
|
||||||
/* When this is true, we will add an extra input to the vertex
|
/* When this is true, we will add an extra input to the vertex
|
||||||
|
|||||||
@@ -1772,9 +1772,8 @@ st_get_cp_variant(struct st_context *st,
|
|||||||
{
|
{
|
||||||
struct pipe_context *pipe = st->pipe;
|
struct pipe_context *pipe = st->pipe;
|
||||||
struct st_basic_variant *v;
|
struct st_basic_variant *v;
|
||||||
struct st_basic_variant_key key;
|
struct st_basic_variant_key key = {0};
|
||||||
|
|
||||||
memset(&key, 0, sizeof(key));
|
|
||||||
key.st = st->has_shareable_shaders ? NULL : st;
|
key.st = st->has_shareable_shaders ? NULL : st;
|
||||||
|
|
||||||
/* Search for existing variant */
|
/* Search for existing variant */
|
||||||
@@ -1996,9 +1995,8 @@ st_precompile_shader_variant(struct st_context *st,
|
|||||||
switch (prog->Target) {
|
switch (prog->Target) {
|
||||||
case GL_VERTEX_PROGRAM_ARB: {
|
case GL_VERTEX_PROGRAM_ARB: {
|
||||||
struct st_vertex_program *p = (struct st_vertex_program *)prog;
|
struct st_vertex_program *p = (struct st_vertex_program *)prog;
|
||||||
struct st_vp_variant_key key;
|
struct st_vp_variant_key key = {0};
|
||||||
|
|
||||||
memset(&key, 0, sizeof(key));
|
|
||||||
key.st = st->has_shareable_shaders ? NULL : st;
|
key.st = st->has_shareable_shaders ? NULL : st;
|
||||||
st_get_vp_variant(st, p, &key);
|
st_get_vp_variant(st, p, &key);
|
||||||
break;
|
break;
|
||||||
@@ -2024,9 +2022,8 @@ st_precompile_shader_variant(struct st_context *st,
|
|||||||
|
|
||||||
case GL_FRAGMENT_PROGRAM_ARB: {
|
case GL_FRAGMENT_PROGRAM_ARB: {
|
||||||
struct st_fragment_program *p = (struct st_fragment_program *)prog;
|
struct st_fragment_program *p = (struct st_fragment_program *)prog;
|
||||||
struct st_fp_variant_key key;
|
struct st_fp_variant_key key = {0};
|
||||||
|
|
||||||
memset(&key, 0, sizeof(key));
|
|
||||||
key.st = st->has_shareable_shaders ? NULL : st;
|
key.st = st->has_shareable_shaders ? NULL : st;
|
||||||
st_get_fp_variant(st, p, &key);
|
st_get_fp_variant(st, p, &key);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user