/** SAMPLER_STATE count and offset */
struct {
- GLuint count;
uint32_t offset;
} sampler;
uint32_t bind_bo_offset;
uint32_t surf_offset[BRW_MAX_VS_SURFACES];
+
+ uint32_t sampler_count;
} vs;
struct {
uint32_t bind_bo_offset;
uint32_t surf_offset[BRW_MAX_WM_SURFACES];
+ uint32_t sampler_count;
+
struct {
struct ra_regs *regs;
vs->vs5.sampler_count = 0; /* hardware requirement */
else {
/* CACHE_NEW_SAMPLER */
- vs->vs5.sampler_count = (brw->sampler.count + 3) / 4;
+ vs->vs5.sampler_count = (brw->vs.sampler_count + 3) / 4;
}
/* Set the sampler state pointer, and its reloc
*/
- if (brw->sampler.count) {
+ if (brw->vs.sampler_count) {
vs->vs5.sampler_state_pointer =
(brw->batch.bo->offset + brw->sampler.offset) >> 5;
drm_intel_bo_emit_reloc(brw->batch.bo,
/* ARB programs use the texture unit number as the sampler index, so we
* need to find the highest unit used. A bit-count will not work.
*/
- brw->sampler.count = _mesa_fls(SamplersUsed);
+ brw->wm.sampler_count = _mesa_fls(SamplersUsed);
+ /* Currently we only use one sampler state table. Mirror the count. */
+ brw->vs.sampler_count = brw->wm.sampler_count;
- if (brw->sampler.count == 0)
+ if (brw->wm.sampler_count == 0)
return;
samplers = brw_state_batch(brw, AUB_TRACE_SAMPLER_STATE,
- brw->sampler.count * sizeof(*samplers),
+ brw->wm.sampler_count * sizeof(*samplers),
32, &brw->sampler.offset);
- memset(samplers, 0, brw->sampler.count * sizeof(*samplers));
+ memset(samplers, 0, brw->wm.sampler_count * sizeof(*samplers));
- for (unsigned s = 0; s < brw->sampler.count; s++) {
+ for (unsigned s = 0; s < brw->wm.sampler_count; s++) {
if (SamplersUsed & (1 << s)) {
const unsigned unit = (fs->SamplersUsed & (1 << s)) ?
fs->SamplerUnits[s] : vs->SamplerUnits[s];
wm->wm4.sampler_count = 0; /* hardware requirement */
else {
/* CACHE_NEW_SAMPLER */
- wm->wm4.sampler_count = (brw->sampler.count + 1) / 4;
+ wm->wm4.sampler_count = (brw->wm.sampler_count + 1) / 4;
}
- if (brw->sampler.count) {
+ if (brw->wm.sampler_count) {
/* reloc */
wm->wm4.sampler_state_pointer = (brw->batch.bo->offset +
brw->sampler.offset) >> 5;
}
/* Emit sampler state relocation */
- if (brw->sampler.count != 0) {
+ if (brw->wm.sampler_count != 0) {
drm_intel_bo_emit_reloc(brw->batch.bo,
brw->wm.state_offset +
offsetof(struct brw_wm_unit_state, wm4),
OUT_BATCH(_3DSTATE_VS << 16 | (6 - 2));
OUT_BATCH(brw->vs.prog_offset);
OUT_BATCH(floating_point_mode |
- ((ALIGN(brw->sampler.count, 4)/4) << GEN6_VS_SAMPLER_COUNT_SHIFT));
+ ((ALIGN(brw->vs.sampler_count, 4)/4) << GEN6_VS_SAMPLER_COUNT_SHIFT));
if (brw->vs.prog_data->base.total_scratch) {
OUT_RELOC(brw->vs.scratch_bo,
dw2 |= GEN6_WM_FLOATING_POINT_MODE_ALT;
/* CACHE_NEW_SAMPLER */
- dw2 |= (ALIGN(brw->sampler.count, 4) / 4) << GEN6_WM_SAMPLER_COUNT_SHIFT;
+ dw2 |= (ALIGN(brw->wm.sampler_count, 4) / 4) << GEN6_WM_SAMPLER_COUNT_SHIFT;
dw4 |= (brw->wm.prog_data->first_curbe_grf <<
GEN6_WM_DISPATCH_START_GRF_SHIFT_0);
dw4 |= (brw->wm.prog_data->first_curbe_grf_16 <<
GLbitfield SamplersUsed = vs->SamplersUsed | fs->SamplersUsed;
- brw->sampler.count = _mesa_fls(SamplersUsed);
+ brw->wm.sampler_count = _mesa_fls(SamplersUsed);
+ /* Currently we only use one sampler state table. Mirror the count. */
+ brw->vs.sampler_count = brw->wm.sampler_count;
- if (brw->sampler.count == 0)
+ if (brw->wm.sampler_count == 0)
return;
samplers = brw_state_batch(brw, AUB_TRACE_SAMPLER_STATE,
- brw->sampler.count * sizeof(*samplers),
+ brw->wm.sampler_count * sizeof(*samplers),
32, &brw->sampler.offset);
- memset(samplers, 0, brw->sampler.count * sizeof(*samplers));
+ memset(samplers, 0, brw->wm.sampler_count * sizeof(*samplers));
- for (unsigned s = 0; s < brw->sampler.count; s++) {
+ for (unsigned s = 0; s < brw->wm.sampler_count; s++) {
if (SamplersUsed & (1 << s)) {
const unsigned unit = (fs->SamplersUsed & (1 << s)) ?
fs->SamplerUnits[s] : vs->SamplerUnits[s];
OUT_BATCH(_3DSTATE_VS << 16 | (6 - 2));
OUT_BATCH(brw->vs.prog_offset);
OUT_BATCH(floating_point_mode |
- ((ALIGN(brw->sampler.count, 4)/4) << GEN6_VS_SAMPLER_COUNT_SHIFT));
+ ((ALIGN(brw->vs.sampler_count, 4)/4) << GEN6_VS_SAMPLER_COUNT_SHIFT));
if (brw->vs.prog_data->base.total_scratch) {
OUT_RELOC(brw->vs.scratch_bo,
dw2 = dw4 = dw5 = 0;
/* CACHE_NEW_SAMPLER */
- dw2 |= (ALIGN(brw->sampler.count, 4) / 4) << GEN7_PS_SAMPLER_COUNT_SHIFT;
+ dw2 |= (ALIGN(brw->wm.sampler_count, 4) / 4) << GEN7_PS_SAMPLER_COUNT_SHIFT;
/* Use ALT floating point mode for ARB fragment programs, because they
* require 0^0 == 1. Even though _CurrentFragmentProgram is used for