[Mesa-dev] [PATCH 08/17] st/mesa: simplify code due to unification to st_common_program
Brian Paul
brianp at vmware.com
Tue May 2 17:19:53 UTC 2017
On 05/02/2017 10:46 AM, Marek Olšák wrote:
>>> switch (shader->Stage) {
>>> case MESA_SHADER_VERTEX:
>>> stvp = (struct st_vertex_program *)prog;
>>> stvp->glsl_to_tgsi = v;
>>> break;
>>> case MESA_SHADER_FRAGMENT:
>>> stfp = (struct st_fragment_program *)prog;
>>> stfp->glsl_to_tgsi = v;
>>> break;
>>> - case MESA_SHADER_GEOMETRY:
>>> - stgp = (struct st_common_program *)prog;
>>> - stgp->glsl_to_tgsi = v;
>>> - break;
>>> case MESA_SHADER_TESS_CTRL:
>>> - sttcp = (struct st_common_program *)prog;
>>> - sttcp->glsl_to_tgsi = v;
>>> - break;
>>> case MESA_SHADER_TESS_EVAL:
>>> - sttep = (struct st_common_program *)prog;
>>> - sttep->glsl_to_tgsi = v;
>>> + case MESA_SHADER_GEOMETRY:
>>> + stp = (struct st_common_program *)prog;
>>> + stp->glsl_to_tgsi = v;
>>> break;
>>> case MESA_SHADER_COMPUTE:
>>> stcp = (struct st_compute_program *)prog;
>>> stcp->glsl_to_tgsi = v;
>>> break;
>>
>>
>> The TESS_CTRL, TESS_EVAL cases are no longer needed? Maybe there should be
>> a comment about that?
>
> The cases are still there, just merged with GS.
Yes, sorry, I misread that one.
-Brian
>
>>
>>
>>> default:
>>> assert(!"should not be reached");
>>> return NULL;
>>> }
>>>
>>> diff --git a/src/mesa/state_tracker/st_program.c
>>> b/src/mesa/state_tracker/st_program.c
>>> index 943b7d1..41ffac4 100644
>>> --- a/src/mesa/state_tracker/st_program.c
>>> +++ b/src/mesa/state_tracker/st_program.c
>>> @@ -1898,30 +1898,25 @@ destroy_program_variants(struct st_context *st,
>>> struct gl_program *target)
>>> }
>>> fpv = next;
>>> }
>>> }
>>> break;
>>> case GL_GEOMETRY_PROGRAM_NV:
>>> case GL_TESS_CONTROL_PROGRAM_NV:
>>> case GL_TESS_EVALUATION_PROGRAM_NV:
>>> case GL_COMPUTE_PROGRAM_NV:
>>> {
>>> - struct st_common_program *gp = (struct
>>> st_common_program*)target;
>>> - struct st_common_program *tcp = (struct
>>> st_common_program*)target;
>>> - struct st_common_program *tep = (struct
>>> st_common_program*)target;
>>> + struct st_common_program *p = (struct st_common_program*)target;
>>
>>
>> st_common_program() cast wrapper?
>
> Yes. I'll also switch all the other manual typecasts to the helper.
>
> Marek
>
More information about the mesa-dev
mailing list