}
}
-static int radeon_saturate_output(
- struct radeon_compiler * c,
- struct rc_instruction * inst,
- void* data)
-{
- const struct rc_opcode_info *info = rc_get_opcode_info(inst->U.I.Opcode);
-
- if (!info->HasDstReg || inst->U.I.DstReg.File != RC_FILE_OUTPUT)
- return 0;
-
- inst->U.I.SaturateMode = RC_SATURATE_ZERO_ONE;
- return 1;
-}
-
void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
{
int is_r500 = c->Base.is_r500;
int opt = !c->Base.disable_optimizations;
- int sat_out = c->state.frag_clamp;
/* Lists of instruction transformations. */
- struct radeon_program_transformation saturate_output[] = {
- { &radeon_saturate_output, c },
- { 0, 0 }
- };
-
struct radeon_program_transformation rewrite_tex[] = {
{ &radeonTransformTEX, c },
{ 0, 0 }
{"unroll loops", 1, is_r500, rc_unroll_loops, NULL},
{"transform loops", 1, !is_r500, rc_transform_loops, NULL},
{"emulate branches", 1, !is_r500, rc_emulate_branches, NULL},
- {"saturate output writes", 1, sat_out, rc_local_transform, saturate_output},
{"transform TEX", 1, 1, rc_local_transform, rewrite_tex},
{"transform IF", 1, is_r500, rc_local_transform, rewrite_if},
{"native rewrite", 1, is_r500, rc_local_transform, native_rewrite_r500},
struct r300_fragment_program_external_state* state)
{
struct r300_textures_state *texstate = r300->textures_state.state;
- struct r300_rs_state *rs = r300->rs_state.state;
unsigned i;
- state->frag_clamp = rs ? rs->rs.clamp_fragment_color : 0;
-
for (i = 0; i < texstate->sampler_state_count; i++) {
struct r300_sampler_state *s = texstate->sampler_states[i];
struct r300_sampler_view *v = texstate->sampler_views[i];
struct r300_rs_state* rs = (struct r300_rs_state*)state;
int last_sprite_coord_enable = r300->sprite_coord_enable;
boolean last_two_sided_color = r300->two_sided_color;
- boolean last_frag_clamp = r300->frag_clamp;
if (r300->draw && rs) {
draw_set_rasterizer_state(r300->draw, &rs->rs_draw, state);
r300->polygon_offset_enabled = rs->polygon_offset_enable;
r300->sprite_coord_enable = rs->rs.sprite_coord_enable;
r300->two_sided_color = rs->rs.light_twoside;
- r300->frag_clamp = rs->rs.clamp_fragment_color;
} else {
r300->polygon_offset_enabled = FALSE;
r300->sprite_coord_enable = 0;
r300->two_sided_color = FALSE;
- r300->frag_clamp = FALSE;
}
UPDATE_STATE(state, r300->rs_state);
last_two_sided_color != r300->two_sided_color) {
r300_mark_atom_dirty(r300, &r300->rs_block_state);
}
-
- if (last_frag_clamp != r300->frag_clamp &&
- r300->fs_status == FRAGMENT_SHADER_VALID) {
- r300->fs_status = FRAGMENT_SHADER_MAYBE_DIRTY;
- }
}
/* Free rasterizer state. */