mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-03 16:28:08 +02:00
r300g: make setting up fragment depth output less hackish
This commit is contained in:
parent
075d9698ed
commit
6793506faa
3 changed files with 18 additions and 16 deletions
|
|
@ -233,18 +233,6 @@ static uint32_t pack_float24(float f)
|
|||
return float24;
|
||||
}
|
||||
|
||||
static void r300_emit_fragment_depth_config(struct r300_context* r300)
|
||||
{
|
||||
CS_LOCALS(r300);
|
||||
if (r300_fragment_shader_writes_depth(r300_fs(r300))) {
|
||||
OUT_CS_REG(R300_FG_DEPTH_SRC, R300_FG_DEPTH_SRC_SHADER);
|
||||
OUT_CS_REG(R300_US_W_FMT, R300_W_FMT_W24 | R300_W_SRC_US);
|
||||
} else {
|
||||
OUT_CS_REG(R300_FG_DEPTH_SRC, R300_FG_DEPTH_SRC_SCAN);
|
||||
OUT_CS_REG(R300_US_W_FMT, R300_W_FMT_W0 | R300_W_SRC_US);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned r300_get_fs_atom_size(struct r300_context *r300)
|
||||
{
|
||||
struct r300_fragment_shader *fs = r300_fs(r300);
|
||||
|
|
@ -315,8 +303,8 @@ void r300_emit_fs(struct r300_context* r300, unsigned size, void *state)
|
|||
}
|
||||
}
|
||||
|
||||
r300_emit_fragment_depth_config(r300);
|
||||
cs_count -= 4;
|
||||
OUT_CS_REG(R300_FG_DEPTH_SRC, fs->shader->fg_depth_src);
|
||||
OUT_CS_REG(R300_US_W_FMT, fs->shader->us_out_w);
|
||||
END_CS;
|
||||
}
|
||||
|
||||
|
|
@ -435,8 +423,8 @@ void r500_emit_fs(struct r300_context* r300, unsigned size, void *state)
|
|||
}
|
||||
}
|
||||
|
||||
r300_emit_fragment_depth_config(r300);
|
||||
cs_count -= 4;
|
||||
OUT_CS_REG(R300_FG_DEPTH_SRC, fs->shader->fg_depth_src);
|
||||
OUT_CS_REG(R300_US_W_FMT, fs->shader->us_out_w);
|
||||
END_CS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
#include "r300_context.h"
|
||||
#include "r300_screen.h"
|
||||
#include "r300_fs.h"
|
||||
#include "r300_reg.h"
|
||||
#include "r300_tgsi_to_rc.h"
|
||||
|
||||
#include "radeon_code.h"
|
||||
|
|
@ -298,6 +299,15 @@ static void r300_translate_fragment_shader(
|
|||
}
|
||||
}
|
||||
|
||||
/* Setup shader depth output. */
|
||||
if (shader->code.writes_depth) {
|
||||
shader->fg_depth_src = R300_FG_DEPTH_SRC_SHADER;
|
||||
shader->us_out_w = R300_W_FMT_W24 | R300_W_SRC_US;
|
||||
} else {
|
||||
shader->fg_depth_src = R300_FG_DEPTH_SRC_SCAN;
|
||||
shader->us_out_w = R300_W_FMT_W0 | R300_W_SRC_US;
|
||||
}
|
||||
|
||||
/* And, finally... */
|
||||
rc_destroy(&compiler.Base);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,10 @@ struct r300_fragment_shader_code {
|
|||
unsigned immediates_count;
|
||||
unsigned rc_state_count;
|
||||
|
||||
/* Registers for fragment depth output setup. */
|
||||
uint32_t fg_depth_src; /* R300_FG_DEPTH_SRC: 0x4bd8 */
|
||||
uint32_t us_out_w; /* R300_US_W_FMT: 0x46b4 */
|
||||
|
||||
struct r300_fragment_program_external_state compare_state;
|
||||
struct rX00_fragment_program_code code;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue