Misc fixes.
This commit is contained in:
parent
2fb2e27e28
commit
6bd390743d
|
@ -566,6 +566,9 @@ struct r300_vertex_shader_state {
|
||||||
int unknown_ptr3; /* pointer within program space */
|
int unknown_ptr3; /* pointer within program space */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define VERTPROG_ACTIVE(ctx) ( ctx->VertexProgram._Enabled && (R300_CONTEXT(ctx)->current_vp != NULL) && \
|
||||||
|
(R300_CONTEXT(ctx)->current_vp->translated) )
|
||||||
|
|
||||||
/* r300_vertex_shader_state and r300_vertex_program should probably be merged together someday.
|
/* r300_vertex_shader_state and r300_vertex_program should probably be merged together someday.
|
||||||
* Keeping them them seperate for now should ensure fixed pipeline keeps functioning properly.
|
* Keeping them them seperate for now should ensure fixed pipeline keeps functioning properly.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -254,7 +254,7 @@ void r300EmitArrays(GLcontext * ctx, GLboolean immd)
|
||||||
exit(-1); \
|
exit(-1); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (rmesa->current_vp == NULL) \
|
if (VERTPROG_ACTIVE(ctx) == GL_FALSE) \
|
||||||
rmesa->state.aos[nr-1].aos_reg = aa_vap_reg++; \
|
rmesa->state.aos[nr-1].aos_reg = aa_vap_reg++; \
|
||||||
rmesa->state.aos[nr-1].aos_format = f; \
|
rmesa->state.aos[nr-1].aos_format = f; \
|
||||||
if (immd) { \
|
if (immd) { \
|
||||||
|
@ -272,7 +272,7 @@ void r300EmitArrays(GLcontext * ctx, GLboolean immd)
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rmesa->current_vp != NULL && ctx->VertexProgram._Enabled) {
|
if (VERTPROG_ACTIVE(ctx)) {
|
||||||
if (rmesa->current_vp->inputs[VERT_ATTRIB_POS] != -1) {
|
if (rmesa->current_vp->inputs[VERT_ATTRIB_POS] != -1) {
|
||||||
inputs |= _TNL_BIT_POS;
|
inputs |= _TNL_BIT_POS;
|
||||||
rmesa->state.aos[nr++].aos_reg = rmesa->current_vp->inputs[VERT_ATTRIB_POS];
|
rmesa->state.aos[nr++].aos_reg = rmesa->current_vp->inputs[VERT_ATTRIB_POS];
|
||||||
|
@ -497,7 +497,7 @@ drm_radeon_cmd_header_t *cmd = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Stage 3: VAP output */
|
/* Stage 3: VAP output */
|
||||||
if (rmesa->current_vp != NULL && ctx->VertexProgram._Enabled)
|
if (VERTPROG_ACTIVE(ctx))
|
||||||
outputs = rmesa->current_vp->outputs;
|
outputs = rmesa->current_vp->outputs;
|
||||||
else
|
else
|
||||||
outputs = inputs;
|
outputs = inputs;
|
||||||
|
|
|
@ -759,7 +759,7 @@ static void r300_check_tcl_render(GLcontext *ctx, struct tnl_pipeline_stage *sta
|
||||||
stage->active = GL_FALSE;
|
stage->active = GL_FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if((r300->current_vp != NULL) && ctx->VertexProgram._Enabled) {
|
if(VERTPROG_ACTIVE(ctx)) {
|
||||||
stage->active = GL_TRUE;
|
stage->active = GL_TRUE;
|
||||||
stage->inputs = ctx->VertexProgram.Current->InputsRead;
|
stage->inputs = ctx->VertexProgram.Current->InputsRead;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1435,7 +1435,7 @@ void r300_setup_rs_unit(GLcontext *ctx)
|
||||||
cur_reg = 0;
|
cur_reg = 0;
|
||||||
r300->hw.rr.cmd[R300_RR_ROUTE_0] = 0;
|
r300->hw.rr.cmd[R300_RR_ROUTE_0] = 0;
|
||||||
|
|
||||||
if (r300->current_vp != NULL && ctx->VertexProgram._Enabled)
|
if (VERTPROG_ACTIVE(ctx))
|
||||||
vap_outputs = r300->current_vp->outputs;
|
vap_outputs = r300->current_vp->outputs;
|
||||||
else
|
else
|
||||||
vap_outputs = r300->state.render_inputs;
|
vap_outputs = r300->state.render_inputs;
|
||||||
|
@ -1693,7 +1693,7 @@ void r300SetupVertexShader(r300ContextPtr rmesa)
|
||||||
0x400 area might have something to do with pixel shaders as it appears right after pfs programming.
|
0x400 area might have something to do with pixel shaders as it appears right after pfs programming.
|
||||||
0x406 is set to { 0.0, 0.0, 1.0, 0.0 } most of the time but should change with smooth points and in other rare cases. */
|
0x406 is set to { 0.0, 0.0, 1.0, 0.0 } most of the time but should change with smooth points and in other rare cases. */
|
||||||
//setup_vertex_shader_fragment(rmesa, 0x406, &unk4);
|
//setup_vertex_shader_fragment(rmesa, 0x406, &unk4);
|
||||||
if(rmesa->current_vp != NULL && ctx->VertexProgram._Enabled){
|
if(VERTPROG_ACTIVE(ctx)){
|
||||||
r300SetupVertexProgram(rmesa);
|
r300SetupVertexProgram(rmesa);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,8 +357,10 @@ void vp_dump_inputs(struct r300_vertex_program *vp, char *caller)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(vp == NULL)
|
if(vp == NULL){
|
||||||
|
fprintf(stderr, "vp null in call to %s from %s\n", __FUNCTION__, caller);
|
||||||
return ;
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stderr, "%s:<", caller);
|
fprintf(stderr, "%s:<", caller);
|
||||||
for(i=0; i < VERT_ATTRIB_MAX; i++)
|
for(i=0; i < VERT_ATTRIB_MAX; i++)
|
||||||
|
@ -402,6 +404,18 @@ static unsigned long t_src(struct r300_vertex_program *vp, struct vp_src_registe
|
||||||
src->Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
|
src->Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned long t_src_scalar(struct r300_vertex_program *vp, struct vp_src_register *src)
|
||||||
|
{
|
||||||
|
|
||||||
|
return MAKE_VSF_SOURCE(t_src_index(vp, src),
|
||||||
|
t_swizzle(src->Swizzle[0]),
|
||||||
|
t_swizzle(src->Swizzle[0]),
|
||||||
|
t_swizzle(src->Swizzle[0]),
|
||||||
|
t_swizzle(src->Swizzle[0]),
|
||||||
|
t_src_class(src->File),
|
||||||
|
src->Negate ? VSF_FLAG_ALL : VSF_FLAG_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned long t_opcode(enum vp_opcode opcode)
|
static unsigned long t_opcode(enum vp_opcode opcode)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -461,6 +475,7 @@ static void translate_program(struct r300_vertex_program *vp)
|
||||||
VERTEX_SHADER_INSTRUCTION t2rs[1024];
|
VERTEX_SHADER_INSTRUCTION t2rs[1024];
|
||||||
VERTEX_SHADER_INSTRUCTION *o_inst;
|
VERTEX_SHADER_INSTRUCTION *o_inst;
|
||||||
unsigned long operands;
|
unsigned long operands;
|
||||||
|
int are_srcs_scalar;
|
||||||
/* Initial value should be last tmp reg that hw supports.
|
/* Initial value should be last tmp reg that hw supports.
|
||||||
Strangely enough r300 doesnt mind even though these would be out of range.
|
Strangely enough r300 doesnt mind even though these would be out of range.
|
||||||
Smart enough to realize that it doesnt need it? */
|
Smart enough to realize that it doesnt need it? */
|
||||||
|
@ -498,6 +513,8 @@ static void translate_program(struct r300_vertex_program *vp)
|
||||||
for(vpi=mesa_vp->Instructions; vpi->Opcode != VP_OPCODE_END; vpi++, o_inst++){
|
for(vpi=mesa_vp->Instructions; vpi->Opcode != VP_OPCODE_END; vpi++, o_inst++){
|
||||||
|
|
||||||
operands=op_operands(vpi->Opcode);
|
operands=op_operands(vpi->Opcode);
|
||||||
|
are_srcs_scalar=operands & SCALAR_FLAG;
|
||||||
|
operands &= ~SCALAR_FLAG;
|
||||||
|
|
||||||
for(i=0; i < operands; i++)
|
for(i=0; i < operands; i++)
|
||||||
src[i]=vpi->SrcReg[i];
|
src[i]=vpi->SrcReg[i];
|
||||||
|
@ -772,29 +789,56 @@ static void translate_program(struct r300_vertex_program *vp)
|
||||||
o_inst->op=MAKE_VSF_OP(t_opcode(vpi->Opcode), vpi->DstReg.Index,
|
o_inst->op=MAKE_VSF_OP(t_opcode(vpi->Opcode), vpi->DstReg.Index,
|
||||||
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
|
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
|
||||||
|
|
||||||
switch(operands){
|
if(are_srcs_scalar){
|
||||||
case 1:
|
switch(operands){
|
||||||
o_inst->src1=t_src(vp, &src[0]);
|
case 1:
|
||||||
o_inst->src2=0;
|
o_inst->src1=t_src_scalar(vp, &src[0]);
|
||||||
o_inst->src3=0;
|
o_inst->src2=0;
|
||||||
break;
|
o_inst->src3=0;
|
||||||
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
o_inst->src1=t_src(vp, &src[0]);
|
o_inst->src1=t_src_scalar(vp, &src[0]);
|
||||||
o_inst->src2=t_src(vp, &src[1]);
|
o_inst->src2=t_src_scalar(vp, &src[1]);
|
||||||
o_inst->src3=0;
|
o_inst->src3=0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
o_inst->src1=t_src(vp, &src[0]);
|
o_inst->src1=t_src_scalar(vp, &src[0]);
|
||||||
o_inst->src2=t_src(vp, &src[1]);
|
o_inst->src2=t_src_scalar(vp, &src[1]);
|
||||||
o_inst->src3=t_src(vp, &src[2]);
|
o_inst->src3=t_src_scalar(vp, &src[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "scalars and op RCC not handled yet");
|
fprintf(stderr, "scalars and op RCC not handled yet");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
switch(operands){
|
||||||
|
case 1:
|
||||||
|
o_inst->src1=t_src(vp, &src[0]);
|
||||||
|
o_inst->src2=0;
|
||||||
|
o_inst->src3=0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
o_inst->src1=t_src(vp, &src[0]);
|
||||||
|
o_inst->src2=t_src(vp, &src[1]);
|
||||||
|
o_inst->src3=0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
o_inst->src1=t_src(vp, &src[0]);
|
||||||
|
o_inst->src2=t_src(vp, &src[1]);
|
||||||
|
o_inst->src3=t_src(vp, &src[2]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "scalars and op RCC not handled yet");
|
||||||
|
exit(-1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
next: ;
|
next: ;
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -897,6 +941,7 @@ static void r300ProgramStringNotify(GLcontext *ctx, GLenum target,
|
||||||
switch(target) {
|
switch(target) {
|
||||||
case GL_VERTEX_PROGRAM_ARB:
|
case GL_VERTEX_PROGRAM_ARB:
|
||||||
vp->translated=GL_FALSE;
|
vp->translated=GL_FALSE;
|
||||||
|
break;
|
||||||
case GL_FRAGMENT_PROGRAM_ARB:
|
case GL_FRAGMENT_PROGRAM_ARB:
|
||||||
return ;
|
return ;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue