* IN THE SOFTWARE.
*/
+#include "broadcom/common/v3d_device_info.h"
#include "v3d_compiler.h"
int
}
bool
-vir_writes_r3(struct qinst *inst)
+vir_writes_r3(const struct v3d_device_info *devinfo, struct qinst *inst)
{
for (int i = 0; i < vir_get_nsrc(inst); i++) {
switch (inst->src[i].file) {
}
}
+ if (devinfo->ver < 41 && (inst->qpu.sig.ldvary ||
+ inst->qpu.sig.ldtlb ||
+ inst->qpu.sig.ldtlbu ||
+ inst->qpu.sig.ldvpm)) {
+ return true;
+ }
+
return false;
}
bool
-vir_writes_r4(struct qinst *inst)
+vir_writes_r4(const struct v3d_device_info *devinfo, struct qinst *inst)
{
switch (inst->dst.file) {
case QFILE_MAGIC:
break;
}
- if (inst->qpu.sig.ldtmu)
+ if (devinfo->ver < 41 && inst->qpu.sig.ldtmu)
return true;
return false;
v3d_lower_nir(struct v3d_compile *c)
{
struct nir_lower_tex_options tex_options = {
+ .lower_txd = true,
.lower_rect = false, /* XXX */
.lower_txp = ~0,
/* Apply swizzles to all samplers. */
for (int i = 0; i < ARRAY_SIZE(c->key->tex); i++) {
for (int j = 0; j < 4; j++)
tex_options.swizzles[i][j] = c->key->tex[i].swizzle[j];
+
+ if (c->key->tex[i].clamp_s)
+ tex_options.saturate_s |= 1 << i;
+ if (c->key->tex[i].clamp_t)
+ tex_options.saturate_t |= 1 << i;
+ if (c->key->tex[i].clamp_r)
+ tex_options.saturate_r |= 1 << i;
}
NIR_PASS_V(c->s, nir_lower_tex, &tex_options);
v3d_lower_nir_late(struct v3d_compile *c)
{
NIR_PASS_V(c->s, v3d_nir_lower_io, c);
+ NIR_PASS_V(c->s, v3d_nir_lower_txf_ms, c);
NIR_PASS_V(c->s, nir_lower_idiv);
}
memcpy(prog_data->input_slots, c->input_slots,
c->num_inputs * sizeof(*c->input_slots));
- memcpy(prog_data->flat_shade_flags, c->flat_shade_flags,
- sizeof(c->flat_shade_flags));
- memcpy(prog_data->shade_model_flags, c->shade_model_flags,
- sizeof(c->shade_model_flags));
+ STATIC_ASSERT(ARRAY_SIZE(prog_data->flat_shade_flags) >
+ (V3D_MAX_FS_INPUTS - 1) / 24);
+ for (int i = 0; i < V3D_MAX_FS_INPUTS; i++) {
+ if (BITSET_TEST(c->flat_shade_flags, i))
+ prog_data->flat_shade_flags[i / 24] |= 1 << (i % 24);
+ }
}
uint64_t *v3d_compile_fs(const struct v3d_compiler *compiler,