mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 18:08:40 +02:00
st/mesa: move per-fragment shader fields to local vars
This commit is contained in:
parent
33681bcf56
commit
e90bc2e2ce
2 changed files with 19 additions and 20 deletions
|
|
@ -278,12 +278,14 @@ st_translate_fragment_program(struct st_context *st,
|
||||||
struct pipe_context *pipe = st->pipe;
|
struct pipe_context *pipe = st->pipe;
|
||||||
GLuint outputMapping[FRAG_RESULT_MAX];
|
GLuint outputMapping[FRAG_RESULT_MAX];
|
||||||
GLuint inputMapping[FRAG_ATTRIB_MAX];
|
GLuint inputMapping[FRAG_ATTRIB_MAX];
|
||||||
GLuint interpMode[16]; /* XXX size? */
|
GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */
|
||||||
GLuint attr;
|
GLuint attr;
|
||||||
enum pipe_error error;
|
enum pipe_error error;
|
||||||
const GLbitfield inputsRead = stfp->Base.Base.InputsRead;
|
const GLbitfield inputsRead = stfp->Base.Base.InputsRead;
|
||||||
struct ureg_program *ureg;
|
struct ureg_program *ureg;
|
||||||
|
|
||||||
|
ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
|
||||||
|
ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
|
||||||
uint fs_num_inputs = 0;
|
uint fs_num_inputs = 0;
|
||||||
|
|
||||||
ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
|
ubyte fs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS];
|
||||||
|
|
@ -301,28 +303,28 @@ st_translate_fragment_program(struct st_context *st,
|
||||||
|
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
case FRAG_ATTRIB_WPOS:
|
case FRAG_ATTRIB_WPOS:
|
||||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
|
input_semantic_name[slot] = TGSI_SEMANTIC_POSITION;
|
||||||
stfp->input_semantic_index[slot] = 0;
|
input_semantic_index[slot] = 0;
|
||||||
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
|
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
|
||||||
break;
|
break;
|
||||||
case FRAG_ATTRIB_COL0:
|
case FRAG_ATTRIB_COL0:
|
||||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
|
input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
|
||||||
stfp->input_semantic_index[slot] = 0;
|
input_semantic_index[slot] = 0;
|
||||||
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
|
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
|
||||||
break;
|
break;
|
||||||
case FRAG_ATTRIB_COL1:
|
case FRAG_ATTRIB_COL1:
|
||||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
|
input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
|
||||||
stfp->input_semantic_index[slot] = 1;
|
input_semantic_index[slot] = 1;
|
||||||
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
|
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
|
||||||
break;
|
break;
|
||||||
case FRAG_ATTRIB_FOGC:
|
case FRAG_ATTRIB_FOGC:
|
||||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
|
input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
|
||||||
stfp->input_semantic_index[slot] = 0;
|
input_semantic_index[slot] = 0;
|
||||||
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
||||||
break;
|
break;
|
||||||
case FRAG_ATTRIB_FACE:
|
case FRAG_ATTRIB_FACE:
|
||||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FACE;
|
input_semantic_name[slot] = TGSI_SEMANTIC_FACE;
|
||||||
stfp->input_semantic_index[slot] = 0;
|
input_semantic_index[slot] = 0;
|
||||||
interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
|
interpMode[slot] = TGSI_INTERPOLATE_CONSTANT;
|
||||||
break;
|
break;
|
||||||
case FRAG_ATTRIB_PNTC:
|
case FRAG_ATTRIB_PNTC:
|
||||||
|
|
@ -331,8 +333,8 @@ st_translate_fragment_program(struct st_context *st,
|
||||||
* shader input is the point coord attribute so that it can set
|
* shader input is the point coord attribute so that it can set
|
||||||
* up the right vertex attribute values.
|
* up the right vertex attribute values.
|
||||||
*/
|
*/
|
||||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
||||||
stfp->input_semantic_index[slot] = 0;
|
input_semantic_index[slot] = 0;
|
||||||
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -365,8 +367,8 @@ st_translate_fragment_program(struct st_context *st,
|
||||||
* readability of the generated TGSI.
|
* readability of the generated TGSI.
|
||||||
*/
|
*/
|
||||||
assert(attr >= FRAG_ATTRIB_TEX0);
|
assert(attr >= FRAG_ATTRIB_TEX0);
|
||||||
stfp->input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0);
|
input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0);
|
||||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
||||||
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -428,8 +430,8 @@ st_translate_fragment_program(struct st_context *st,
|
||||||
/* inputs */
|
/* inputs */
|
||||||
fs_num_inputs,
|
fs_num_inputs,
|
||||||
inputMapping,
|
inputMapping,
|
||||||
stfp->input_semantic_name,
|
input_semantic_name,
|
||||||
stfp->input_semantic_index,
|
input_semantic_index,
|
||||||
interpMode,
|
interpMode,
|
||||||
/* outputs */
|
/* outputs */
|
||||||
fs_num_outputs,
|
fs_num_outputs,
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,6 @@ struct st_fragment_program
|
||||||
struct gl_fragment_program Base;
|
struct gl_fragment_program Base;
|
||||||
GLuint serialNo;
|
GLuint serialNo;
|
||||||
|
|
||||||
ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS];
|
|
||||||
ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS];
|
|
||||||
|
|
||||||
struct pipe_shader_state tgsi;
|
struct pipe_shader_state tgsi;
|
||||||
void *driver_shader;
|
void *driver_shader;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue