mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
r300/fragprog: Move wpos_attr and fog_attr where they belong
Signed-off-by: Nicolai Hähnle <nhaehnle@gmail.com>
This commit is contained in:
parent
790334883a
commit
e82a50a6a1
5 changed files with 21 additions and 22 deletions
|
|
@ -174,11 +174,6 @@ struct rX00_fragment_program_code {
|
|||
GLboolean writes_depth;
|
||||
|
||||
struct rc_constant_list constants;
|
||||
|
||||
/* attribute that we are sending the WPOS in */
|
||||
gl_frag_attrib wpos_attr;
|
||||
/* attribute that we are sending the fog coordinate in */
|
||||
gl_frag_attrib fog_attr;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -433,6 +433,11 @@ struct r300_fragment_program {
|
|||
|
||||
struct rX00_fragment_program_code code;
|
||||
GLbitfield InputsRead;
|
||||
|
||||
/* attribute that we are sending the WPOS in */
|
||||
gl_frag_attrib wpos_attr;
|
||||
/* attribute that we are sending the fog coordinate in */
|
||||
gl_frag_attrib fog_attr;
|
||||
};
|
||||
|
||||
struct r300_fragment_program_cont {
|
||||
|
|
|
|||
|
|
@ -95,24 +95,24 @@ static void build_state(
|
|||
* to read from a newly allocated temporary.
|
||||
*
|
||||
*/
|
||||
static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler)
|
||||
static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler, struct r300_fragment_program * fp)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!(compiler->Base.Program.InputsRead & FRAG_BIT_WPOS)) {
|
||||
compiler->code->wpos_attr = FRAG_ATTRIB_MAX;
|
||||
fp->wpos_attr = FRAG_ATTRIB_MAX;
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = FRAG_ATTRIB_TEX0; i <= FRAG_ATTRIB_TEX7; ++i)
|
||||
{
|
||||
if (!(compiler->Base.Program.InputsRead & (1 << i))) {
|
||||
compiler->code->wpos_attr = i;
|
||||
fp->wpos_attr = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
rc_transform_fragment_wpos(&compiler->Base, FRAG_ATTRIB_WPOS, compiler->code->wpos_attr);
|
||||
rc_transform_fragment_wpos(&compiler->Base, FRAG_ATTRIB_WPOS, fp->wpos_attr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -122,28 +122,27 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler)
|
|||
*
|
||||
* See also the counterpart rewriting for vertex programs.
|
||||
*/
|
||||
static void rewriteFog(struct r300_fragment_program_compiler *compiler)
|
||||
static void rewriteFog(struct r300_fragment_program_compiler *compiler, struct r300_fragment_program * fp)
|
||||
{
|
||||
struct rX00_fragment_program_code *code = compiler->code;
|
||||
struct prog_src_register src;
|
||||
int i;
|
||||
|
||||
if (!(compiler->Base.Program.InputsRead & FRAG_BIT_FOGC)) {
|
||||
code->fog_attr = FRAG_ATTRIB_MAX;
|
||||
fp->fog_attr = FRAG_ATTRIB_MAX;
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = FRAG_ATTRIB_TEX0; i <= FRAG_ATTRIB_TEX7; ++i)
|
||||
{
|
||||
if (!(compiler->Base.Program.InputsRead & (1 << i))) {
|
||||
code->fog_attr = i;
|
||||
fp->fog_attr = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
memset(&src, 0, sizeof(src));
|
||||
src.File = PROGRAM_INPUT;
|
||||
src.Index = code->fog_attr;
|
||||
src.Index = fp->fog_attr;
|
||||
src.Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ONE);
|
||||
rc_move_input(&compiler->Base, FRAG_ATTRIB_FOGC, src);
|
||||
}
|
||||
|
|
@ -220,9 +219,9 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog
|
|||
|
||||
rc_mesa_to_rc_program(&compiler.Base, &cont->Base.Base);
|
||||
|
||||
insert_WPOS_trailer(&compiler);
|
||||
insert_WPOS_trailer(&compiler, fp);
|
||||
|
||||
rewriteFog(&compiler);
|
||||
rewriteFog(&compiler, fp);
|
||||
|
||||
r3xx_compile_fragment_program(&compiler);
|
||||
fp->error = compiler.Base.Error;
|
||||
|
|
|
|||
|
|
@ -150,16 +150,16 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_
|
|||
ADD_ATTR(VERT_ATTRIB_POINT_SIZE, R300_DATA_TYPE_FLOAT_1, SWTCL_OVM_POINT_SIZE, swiz, MASK_X, 0);
|
||||
}
|
||||
|
||||
if (rmesa->selected_fp->code.wpos_attr != FRAG_ATTRIB_MAX) {
|
||||
int tex_id = rmesa->selected_fp->code.wpos_attr - FRAG_ATTRIB_TEX0;
|
||||
if (rmesa->selected_fp->wpos_attr != FRAG_ATTRIB_MAX) {
|
||||
int tex_id = rmesa->selected_fp->wpos_attr - FRAG_ATTRIB_TEX0;
|
||||
|
||||
VB->AttribPtr[VERT_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_POS];
|
||||
VB->TexCoordPtr[tex_id] = VB->AttribPtr[VERT_ATTRIB_POS];
|
||||
RENDERINPUTS_SET(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 + tex_id);
|
||||
}
|
||||
|
||||
if (rmesa->selected_fp->code.fog_attr != FRAG_ATTRIB_MAX) {
|
||||
int tex_id = rmesa->selected_fp->code.fog_attr - FRAG_ATTRIB_TEX0;
|
||||
if (rmesa->selected_fp->fog_attr != FRAG_ATTRIB_MAX) {
|
||||
int tex_id = rmesa->selected_fp->fog_attr - FRAG_ATTRIB_TEX0;
|
||||
|
||||
VB->AttribPtr[VERT_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_FOG];
|
||||
VB->TexCoordPtr[tex_id] = VB->AttribPtr[VERT_ATTRIB_FOG];
|
||||
|
|
|
|||
|
|
@ -268,8 +268,8 @@ struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx)
|
|||
|
||||
vpc = (struct r300_vertex_program_cont *)ctx->VertexProgram._Current;
|
||||
wanted_key.FpReads = r300->selected_fp->InputsRead;
|
||||
wanted_key.FogAttr = r300->selected_fp->code.fog_attr;
|
||||
wanted_key.WPosAttr = r300->selected_fp->code.wpos_attr;
|
||||
wanted_key.FogAttr = r300->selected_fp->fog_attr;
|
||||
wanted_key.WPosAttr = r300->selected_fp->wpos_attr;
|
||||
|
||||
for (vp = vpc->progs; vp; vp = vp->next) {
|
||||
if (_mesa_memcmp(&vp->key, &wanted_key, sizeof(wanted_key))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue