~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/drivers/r300/r300_fs.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
                fs_inputs->color[index] = i;
59
59
                break;
60
60
 
 
61
            case TGSI_SEMANTIC_PCOORD:
 
62
                fs_inputs->pcoord = i;
 
63
                break;
 
64
 
 
65
            case TGSI_SEMANTIC_TEXCOORD:
 
66
                assert(index < ATTR_TEXCOORD_COUNT);
 
67
                fs_inputs->texcoord[index] = i;
 
68
                break;
 
69
 
61
70
            case TGSI_SEMANTIC_GENERIC:
62
71
                assert(index < ATTR_GENERIC_COUNT);
63
72
                fs_inputs->generic[index] = i;
133
142
            allocate(mydata, inputs->generic[i], reg++);
134
143
        }
135
144
    }
 
145
    for (i = 0; i < ATTR_TEXCOORD_COUNT; i++) {
 
146
        if (inputs->texcoord[i] != ATTR_UNUSED) {
 
147
            allocate(mydata, inputs->texcoord[i], reg++);
 
148
        }
 
149
    }
 
150
    if (inputs->pcoord != ATTR_UNUSED) {
 
151
        allocate(mydata, inputs->pcoord, reg++);
 
152
    }
136
153
    if (inputs->fog != ATTR_UNUSED) {
137
154
        allocate(mydata, inputs->fog, reg++);
138
155
    }
197
214
            }
198
215
 
199
216
            if (t->b.target == PIPE_TEXTURE_3D)
200
 
                state->unit[i].clamp_and_scale_before_fetch = TRUE;
 
217
                state->unit[i].clamp_and_scale_before_fetch = true;
201
218
        }
202
219
    }
203
220
}
226
243
 
227
244
    state.tokens = ureg_finalize(ureg);
228
245
 
229
 
    shader->dummy = TRUE;
 
246
    shader->dummy = true;
230
247
    r300_translate_fragment_shader(r300, shader, state.tokens);
231
248
 
232
249
    ureg_destroy(ureg);
436
453
    compiler.Base.is_r500 = r300->screen->caps.is_r500;
437
454
    compiler.Base.is_r400 = r300->screen->caps.is_r400;
438
455
    compiler.Base.disable_optimizations = DBG_ON(r300, DBG_NO_OPT);
439
 
    compiler.Base.has_half_swizzles = TRUE;
440
 
    compiler.Base.has_presub = TRUE;
441
 
    compiler.Base.has_omod = TRUE;
442
 
    compiler.Base.needs_trig_input_transform = DBG_ON(r300, DBG_USE_TGSI);
 
456
    compiler.Base.has_half_swizzles = true;
 
457
    compiler.Base.has_presub = true;
 
458
    compiler.Base.has_omod = true;
443
459
    compiler.Base.max_temp_regs =
444
460
        compiler.Base.is_r500 ? 128 : (compiler.Base.is_r400 ? 64 : 32);
445
461
    compiler.Base.max_constants = compiler.Base.is_r500 ? 256 : 32;
475
491
 
476
492
    if (!r300->screen->caps.is_r500 ||
477
493
        compiler.Base.Program.Constants.Count > 200) {
478
 
        compiler.Base.remove_unused_constants = TRUE;
 
494
        compiler.Base.remove_unused_constants = true;
479
495
    }
480
496
 
481
497
    /**
487
503
     * to read from a newly allocated temporary. */
488
504
    if (wpos != ATTR_UNUSED) {
489
505
        /* Moving the input to some other reg is not really necessary. */
490
 
        rc_transform_fragment_wpos(&compiler.Base, wpos, wpos, TRUE);
 
506
        rc_transform_fragment_wpos(&compiler.Base, wpos, wpos, true);
491
507
    }
492
508
 
493
509
    if (face != ATTR_UNUSED) {
559
575
    r300_emit_fs_code_to_buffer(r300, shader);
560
576
}
561
577
 
562
 
boolean r300_pick_fragment_shader(struct r300_context *r300,
563
 
                                  struct r300_fragment_shader* fs,
564
 
                                  struct r300_fragment_program_external_state *state)
 
578
bool r300_pick_fragment_shader(struct r300_context *r300,
 
579
                               struct r300_fragment_shader* fs,
 
580
                               struct r300_fragment_program_external_state *state)
565
581
{
566
582
    struct r300_fragment_shader_code* ptr;
567
583
 
571
587
 
572
588
        memcpy(&fs->shader->compare_state, state, sizeof(*state));
573
589
        r300_translate_fragment_shader(r300, fs->shader, fs->state.tokens);
574
 
        return TRUE;
 
590
        return true;
575
591
 
576
592
    } else {
577
593
        /* Check if the currently-bound shader has been compiled
583
599
                if (memcmp(&ptr->compare_state, state, sizeof(*state)) == 0) {
584
600
                    if (fs->shader != ptr) {
585
601
                        fs->shader = ptr;
586
 
                        return TRUE;
 
602
                        return true;
587
603
                    }
588
604
                    /* The currently-bound one is OK. */
589
 
                    return FALSE;
 
605
                    return false;
590
606
                }
591
607
                ptr = ptr->next;
592
608
            }
598
614
 
599
615
            memcpy(&ptr->compare_state, state, sizeof(*state));
600
616
            r300_translate_fragment_shader(r300, ptr, fs->state.tokens);
601
 
            return TRUE;
 
617
            return true;
602
618
        }
603
619
    }
604
620
 
605
 
    return FALSE;
 
621
    return false;
606
622
}