mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 11:40:10 +01:00
Merge branch 'r500test' of git://people.freedesktop.org/~csimpson/mesa into r500-support
This commit is contained in:
commit
0f07e0aea3
6 changed files with 536 additions and 2233 deletions
|
|
@ -774,6 +774,54 @@ struct r300_fragment_program {
|
|||
GLuint optimization;
|
||||
};
|
||||
|
||||
struct r500_fragment_program {
|
||||
struct gl_fragment_program mesa_program;
|
||||
|
||||
GLcontext *ctx;
|
||||
GLboolean translated;
|
||||
GLboolean error;
|
||||
struct r300_pfs_compile_state *cs;
|
||||
|
||||
struct {
|
||||
GLuint inst0;
|
||||
GLuint inst1;
|
||||
GLuint inst2;
|
||||
GLuint inst3;
|
||||
GLuint inst4;
|
||||
GLuint inst5;
|
||||
} inst[512];
|
||||
/* TODO: This is magic! */
|
||||
|
||||
struct {
|
||||
int tex_offset;
|
||||
int tex_end;
|
||||
int alu_offset;
|
||||
int alu_end;
|
||||
int flags;
|
||||
} node[4];
|
||||
int cur_node;
|
||||
int first_node_has_tex;
|
||||
|
||||
int alu_offset;
|
||||
int alu_end;
|
||||
int tex_offset;
|
||||
int tex_end;
|
||||
|
||||
/* Hardware constants.
|
||||
* Contains a pointer to the value. The destination of the pointer
|
||||
* is supposed to be updated when GL state changes.
|
||||
* Typically, this is either a pointer into
|
||||
* gl_program_parameter_list::ParameterValues, or a pointer to a
|
||||
* global constant (e.g. for sin/cos-approximation)
|
||||
*/
|
||||
const GLfloat *constant[PFS_NUM_CONST_REGS];
|
||||
int const_nr;
|
||||
|
||||
int max_temp_idx;
|
||||
|
||||
GLuint optimization;
|
||||
};
|
||||
|
||||
#define R300_MAX_AOS_ARRAYS 16
|
||||
|
||||
#define REG_COORDS 0
|
||||
|
|
|
|||
|
|
@ -2217,6 +2217,7 @@ static void update_params(struct r300_fragment_program *fp)
|
|||
void r300TranslateFragmentShader(r300ContextPtr r300,
|
||||
struct r300_fragment_program *fp)
|
||||
{
|
||||
|
||||
struct r300_pfs_compile_state *cs = NULL;
|
||||
|
||||
if (!fp->translated) {
|
||||
|
|
|
|||
|
|
@ -334,13 +334,26 @@ static GLboolean r300RunRender(GLcontext * ctx,
|
|||
static int r300Fallback(GLcontext * ctx)
|
||||
{
|
||||
r300ContextPtr r300 = R300_CONTEXT(ctx);
|
||||
struct r300_fragment_program *fp = (struct r300_fragment_program *)
|
||||
/* Do we need to use new-style shaders?
|
||||
* Also is there a better way to do this? */
|
||||
if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
|
||||
struct r500_fragment_program *fp = (struct r500_fragment_program *)
|
||||
(char *)ctx->FragmentProgram._Current;
|
||||
|
||||
if (fp) {
|
||||
if (!fp->translated)
|
||||
r300TranslateFragmentShader(r300, fp);
|
||||
FALLBACK_IF(!fp->translated);
|
||||
if (fp) {
|
||||
if (!fp->translated) {
|
||||
r500TranslateFragmentShader(r300, fp);
|
||||
FALLBACK_IF(!fp->translated);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
struct r300_fragment_program *fp = (struct r300_fragment_program *)
|
||||
(char *)ctx->FragmentProgram._Current;
|
||||
if (fp) {
|
||||
if (!fp->translated) {
|
||||
r300TranslateFragmentShader(r300, fp);
|
||||
FALLBACK_IF(!fp->translated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FALLBACK_IF(ctx->RenderMode != GL_RENDER);
|
||||
|
|
|
|||
|
|
@ -2380,54 +2380,33 @@ static void r300SetupPixelShader(r300ContextPtr rmesa)
|
|||
static void r500SetupPixelShader(r300ContextPtr rmesa)
|
||||
{
|
||||
GLcontext *ctx = rmesa->radeon.glCtx;
|
||||
struct r300_fragment_program *fp = (struct r300_fragment_program *)
|
||||
struct r500_fragment_program *fp = (struct r500_fragment_program *)
|
||||
(char *)ctx->FragmentProgram._Current;
|
||||
int i, k;
|
||||
|
||||
if (!fp) /* should only happenen once, just after context is created */
|
||||
return;
|
||||
|
||||
/* emit the standard zero shader */
|
||||
r500TranslateFragmentShader(rmesa, fp);
|
||||
if (!fp->translated) {
|
||||
fprintf(stderr, "%s: No valid fragment shader, exiting\n",
|
||||
__FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
R300_STATECHANGE(rmesa, r500fp);
|
||||
i = 1;
|
||||
rmesa->hw.r500fp.cmd[i++] = R500_INST_TYPE_OUT |
|
||||
R500_INST_TEX_SEM_WAIT |
|
||||
R500_INST_LAST |
|
||||
R500_INST_RGB_OMASK_R |
|
||||
R500_INST_RGB_OMASK_G |
|
||||
R500_INST_RGB_OMASK_B |
|
||||
R500_INST_ALPHA_OMASK;
|
||||
/* Emit our shader... */
|
||||
for (i = 0; i < fp->cs->nrslots; i++) {
|
||||
rmesa->hw.r500fp.cmd[i*6+1] = fp->inst[i].inst0;
|
||||
rmesa->hw.r500fp.cmd[i*6+2] = fp->inst[i].inst1;
|
||||
rmesa->hw.r500fp.cmd[i*6+3] = fp->inst[i].inst2;
|
||||
rmesa->hw.r500fp.cmd[i*6+4] = fp->inst[i].inst3;
|
||||
rmesa->hw.r500fp.cmd[i*6+5] = fp->inst[i].inst4;
|
||||
rmesa->hw.r500fp.cmd[i*6+6] = fp->inst[i].inst5;
|
||||
}
|
||||
|
||||
rmesa->hw.r500fp.cmd[i++] = R500_RGB_ADDR0(0) |
|
||||
R500_RGB_ADDR1(0) |
|
||||
R500_RGB_ADDR1_CONST |
|
||||
R500_RGB_ADDR2(0) |
|
||||
R500_RGB_ADDR2_CONST |
|
||||
R500_RGB_SRCP_OP_1_MINUS_2RGB0;
|
||||
rmesa->hw.r500fp.cmd[i++] = R500_ALPHA_ADDR0(0) |
|
||||
R500_ALPHA_ADDR1(0) |
|
||||
R500_ALPHA_ADDR1_CONST |
|
||||
R500_ALPHA_ADDR2(0) |
|
||||
R500_ALPHA_ADDR2_CONST |
|
||||
R500_ALPHA_SRCP_OP_1_MINUS_2A0;
|
||||
rmesa->hw.r500fp.cmd[i++] = R500_ALU_RGB_SEL_A_SRC0 |
|
||||
R500_ALU_RGB_R_SWIZ_A_R |
|
||||
R500_ALU_RGB_G_SWIZ_A_G |
|
||||
R500_ALU_RGB_B_SWIZ_A_B |
|
||||
R500_ALU_RGB_SEL_B_SRC0 |
|
||||
R500_ALU_RGB_R_SWIZ_B_1 |
|
||||
R500_ALU_RGB_B_SWIZ_B_1 |
|
||||
R500_ALU_RGB_G_SWIZ_B_1;
|
||||
rmesa->hw.r500fp.cmd[i++] = R500_ALPHA_OP_MAD |
|
||||
R500_ALPHA_SWIZ_A_A |
|
||||
R500_ALPHA_SWIZ_B_1;
|
||||
rmesa->hw.r500fp.cmd[i++] = R500_ALU_RGBA_OP_MAD |
|
||||
R500_ALU_RGBA_R_SWIZ_0 |
|
||||
R500_ALU_RGBA_G_SWIZ_0 |
|
||||
R500_ALU_RGBA_B_SWIZ_0 |
|
||||
R500_ALU_RGBA_A_SWIZ_0;
|
||||
bump_r500fp_count(rmesa->hw.r500fp.cmd, fp->cs->nrslots * 6);
|
||||
|
||||
bump_r500fp_count(rmesa->hw.r500fp.cmd, 6);
|
||||
|
||||
R300_STATECHANGE(rmesa, r500fp_const);
|
||||
for (i = 0; i < fp->const_nr; i++) {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -96,7 +96,10 @@ typedef struct r300_fragment_program_swizzle {
|
|||
#define DRI_CONF_FP_OPTIMIZATION_SPEED 0
|
||||
#define DRI_CONF_FP_OPTIMIZATION_QUALITY 1
|
||||
|
||||
struct r300_fragment_program;
|
||||
struct r500_fragment_program;
|
||||
|
||||
extern void r500TranslateFragmentShader(r300ContextPtr r300,
|
||||
struct r500_fragment_program *fp);
|
||||
|
||||
extern void r300TranslateFragmentShader(r300ContextPtr r300,
|
||||
struct r300_fragment_program *fp);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue