alu.op = ALU_OP1_MOV;
alu.src[0].sel = R600_SHADER_BUFFER_INFO_SEL;
if (ctx->bc->chip_class >= EVERGREEN) {
- /* channel 0 or 2 of each word */
- alu.src[0].sel += (id / 2);
- alu.src[0].chan = (id % 2) * 2;
+ /* with eg each dword is either buf size or number of cubes */
+ alu.src[0].sel += id / 4;
+ alu.src[0].chan = id % 4;
} else {
/* r600 we have them at channel 2 of the second dword */
alu.src[0].sel += (id * 2) + 1;
alu.src[0].sel = R600_SHADER_BUFFER_INFO_SEL;
if (ctx->bc->chip_class >= EVERGREEN) {
- /* channel 1 or 3 of each word */
- alu.src[0].sel += (id / 2);
- alu.src[0].chan = ((id % 2) * 2) + 1;
+ /* with eg each dword is either buf size or number of cubes */
+ alu.src[0].sel += id / 4;
+ alu.src[0].chan = id % 4;
} else {
/* r600 we have them at channel 2 of the second dword */
alu.src[0].sel += (id * 2) + 1;
alu.op = ALU_OP1_MOV;
alu.src[0].sel = R600_SHADER_BUFFER_INFO_SEL;
- /* channel 1 or 3 of each word */
- alu.src[0].sel += (id / 2);
- alu.src[0].chan = ((id % 2) * 2) + 1;
+ /* with eg each dword is either buf size or number of cubes */
+ alu.src[0].sel += id / 4;
+ alu.src[0].chan = id % 4;
alu.src[0].kc_bank = R600_BUFFER_INFO_CONST_BUFFER;
tgsi_dst(ctx, &inst->Dst[0], 2, &alu.dst);
alu.last = 1;
unsigned pipe_shader_type)
{
struct r600_pipe_shader_selector *sel = CALLOC_STRUCT(r600_pipe_shader_selector);
- int i;
sel->type = pipe_shader_type;
sel->tokens = tgsi_dup_tokens(tokens);
samplers->views.dirty_buffer_constants = FALSE;
bits = util_last_bit(samplers->views.enabled_mask);
- array_size = bits * 8 * sizeof(uint32_t) * 4;
+ array_size = bits * 8 * sizeof(uint32_t);
constants = r600_alloc_buf_consts(rctx, shader_type, array_size, &base_offset);
} else
constants[offset + 4] = 0;
- constants[offset + 5] = samplers->views.views[i]->base.texture->width0 / util_format_get_blocksize(samplers->views.views[i]->base.format);
+ constants[offset + 5] = samplers->views.views[i]->base.u.buf.size /
+ util_format_get_blocksize(samplers->views.views[i]->base.format);
constants[offset + 6] = samplers->views.views[i]->base.texture->array_size / 6;
}
}
}
-/* On evergreen we store two values
- * 1. buffer size for TXQ
+/* On evergreen we store one value
+ * 1. buffer size for TXQ or
* 2. number of cube layers in a cube map array.
*/
void eg_setup_buffer_constants(struct r600_context *rctx, int shader_type)
img_bits = bits;
if (buffers)
bits += util_last_bit(buffers->enabled_mask);
- array_size = bits * 2 * sizeof(uint32_t) * 4;
+ array_size = bits * sizeof(uint32_t);
constants = r600_alloc_buf_consts(rctx, shader_type, array_size,
&base_offset);
for (i = 0; i < sview_bits; i++) {
if (samplers->views.enabled_mask & (1 << i)) {
- uint32_t offset = (base_offset / 4) + i * 2;
- constants[offset] = samplers->views.views[i]->base.texture->width0 / util_format_get_blocksize(samplers->views.views[i]->base.format);
- constants[offset + 1] = samplers->views.views[i]->base.texture->array_size / 6;
+ uint32_t offset = (base_offset / 4) + i;
+ if (samplers->views.views[i]->base.target == PIPE_BUFFER) {
+ constants[offset] = samplers->views.views[i]->base.u.buf.size /
+ util_format_get_blocksize(samplers->views.views[i]->base.format);
+ } else {
+ constants[offset] = samplers->views.views[i]->base.texture->array_size / 6;
+ }
}
}
if (images) {
for (i = sview_bits; i < img_bits; i++) {
int idx = i - sview_bits;
if (images->enabled_mask & (1 << idx)) {
- uint32_t offset = (base_offset / 4) + i * 2;
- constants[offset] = images->views[i].base.resource->width0 / util_format_get_blocksize(images->views[i].base.format);
- constants[offset + 1] = images->views[i].base.resource->array_size / 6;
+ uint32_t offset = (base_offset / 4) + i;
+ if (images->views[i].base.resource->target == PIPE_BUFFER) {
+ constants[offset] = images->views[i].base.u.buf.size /
+ util_format_get_blocksize(images->views[i].base.format);
+ } else {
+ constants[offset] = images->views[i].base.resource->array_size / 6;
+ }
}
}
}
for (i = img_bits; i < bits; i++) {
int idx = i - img_bits;
if (buffers->enabled_mask & (1 << idx)) {
- uint32_t offset = (base_offset / 4) + i * 2;
- constants[offset] = buffers->views[i].base.resource->width0 / util_format_get_blocksize(buffers->views[i].base.format);
- constants[offset + 1] = 0;
+ uint32_t offset = (base_offset / 4) + i;
+ assert(buffers->views[i].base.resource->target == PIPE_BUFFER);
+ constants[offset] = buffers->views[i].base.u.buf.size /
+ util_format_get_blocksize(buffers->views[i].base.format);
}
}
}