* lowered here to avoid duplicate work with shader variants.
*/
void
-agx_preprocess_nir(nir_shader *nir, bool support_lod_bias,
+agx_preprocess_nir(nir_shader *nir, bool support_lod_bias, bool allow_mediump,
struct agx_uncompiled_shader_info *out)
{
if (out)
glsl_type_size, 0);
NIR_PASS_V(nir, nir_lower_ssbo);
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
- uint64_t texcoord = agx_texcoord_mask(nir);
struct interp_masks masks = agx_interp_masks(nir);
NIR_PASS_V(nir, agx_nir_lower_frag_sidefx);
* hardware limitation. The resulting code (with an extra f2f16 at the end
* if needed) matches what Metal produces.
*/
- NIR_PASS_V(nir, nir_lower_mediump_io,
- nir_var_shader_in | nir_var_shader_out,
- ~(masks.flat | texcoord), false);
+ if (likely(allow_mediump)) {
+ uint64_t texcoord = agx_texcoord_mask(nir);
+
+ NIR_PASS_V(nir, nir_lower_mediump_io,
+ nir_var_shader_in | nir_var_shader_out,
+ ~(masks.flat | texcoord), false);
+ }
if (out) {
out->inputs_flat_shaded = masks.flat;
struct util_dynarray binary;
util_dynarray_init(&binary, NULL);
- agx_preprocess_nir(shader, false, NULL);
+ agx_preprocess_nir(shader, false, false, NULL);
if (tib) {
unsigned bindless_base = 0;
agx_nir_lower_tilebuffer(shader, tib, NULL, &bindless_base, NULL);
#include "util/u_prim.h"
#include "util/u_resource.h"
#include "util/u_transfer.h"
+#include "agx_device.h"
#include "agx_disk_cache.h"
#include "agx_tilebuffer.h"
#include "pool.h"
}
static void
-agx_shader_initialize(struct agx_uncompiled_shader *so, nir_shader *nir)
+agx_shader_initialize(struct agx_device *dev, struct agx_uncompiled_shader *so,
+ nir_shader *nir)
{
so->type = pipe_shader_type_from_mesa(nir->info.stage);
*/
NIR_PASS_V(nir, agx_nir_lower_bindings, &so->internal_bindless);
- agx_preprocess_nir(nir, true, &so->info);
+ bool allow_mediump = !(dev->debug & AGX_DBG_NO16);
+ agx_preprocess_nir(nir, true, allow_mediump, &so->info);
blob_init(&so->serialized_nir);
nir_serialize(&so->serialized_nir, nir, true);
asahi_fs_shader_key_equal);
}
- agx_shader_initialize(so, nir);
+ agx_shader_initialize(dev, so, nir);
/* We're done with the NIR, throw it away */
ralloc_free(nir);
agx_create_compute_state(struct pipe_context *pctx,
const struct pipe_compute_state *cso)
{
+ struct agx_device *dev = agx_device(pctx->screen);
struct agx_uncompiled_shader *so =
rzalloc(NULL, struct agx_uncompiled_shader);
assert(cso->ir_type == PIPE_SHADER_IR_NIR && "TGSI kernels unsupported");
nir_shader *nir = (void *)cso->prog;
- agx_shader_initialize(so, nir);
+ agx_shader_initialize(dev, so, nir);
agx_get_shader_variant(agx_screen(pctx->screen), so, &pctx->debug, &key);
/* We're done with the NIR, throw it away */