struct ntt_compile {
nir_shader *s;
nir_function_impl *impl;
+ const struct nir_to_tgsi_options *options;
struct pipe_screen *screen;
struct ureg_program *ureg;
break;
case nir_op_fcsel:
- /* NIR is src0 != 0 ? src1 : src2.
- * TGSI is src0 < 0 ? src1 : src2.
+ /* NIR fcsel is src0 != 0 ? src1 : src2.
+ * TGSI CMP is src0 < 0 ? src1 : src2.
*
* However, fcsel so far as I can find only appears on bools-as-floats
* (1.0 or 0.0), so we can just negate it for the TGSI op. It's
* important to not have an abs here, as i915g has to make extra
* instructions to do the abs.
*/
- ureg_CMP(c->ureg, dst, ureg_negate(src[0]), src[1], src[2]);
+ if (c->options->lower_cmp) {
+ /* If the HW doesn't support TGSI CMP (r300 VS), then lower it to a
+ * LRP on the boolean 1.0/0.0 value, instead of requiring the
+ * backend to turn the src0 into 1.0/0.0 first.
+ *
+ * We don't use this in general because some hardware (i915 FS) the
+ * LRP gets expanded to MUL/MAD.
+ */
+ ureg_LRP(c->ureg, dst, src[0], src[1], src[2]);
+ } else {
+ ureg_CMP(c->ureg, dst, ureg_negate(src[0]), src[1], src[2]);
+ }
break;
/* It would be nice if we could get this left as scalar in NIR, since
}
static void
-ntt_fix_nir_options(struct pipe_screen *screen, struct nir_shader *s)
+ntt_fix_nir_options(struct pipe_screen *screen, struct nir_shader *s,
+ const struct nir_to_tgsi_options *ntt_options)
{
const struct nir_shader_compiler_options *options = s->options;
bool lower_fsqrt =
nir_lower_primid_sysval_to_input_lower, &input);
}
+const void *
+nir_to_tgsi(struct nir_shader *s,
+ struct pipe_screen *screen)
+{
+ static const struct nir_to_tgsi_options default_ntt_options = {0};
+ return nir_to_tgsi_options(s, screen, &default_ntt_options);
+}
+
/**
* Translates the NIR shader to TGSI.
*
* We take ownership of the NIR shader passed, returning a reference to the new
* TGSI tokens instead. If you need to keep the NIR, then pass us a clone.
*/
-const void *
-nir_to_tgsi(struct nir_shader *s,
- struct pipe_screen *screen)
+const void *nir_to_tgsi_options(struct nir_shader *s,
+ struct pipe_screen *screen,
+ const struct nir_to_tgsi_options *options)
{
struct ntt_compile *c;
const void *tgsi_tokens;
PIPE_SHADER_CAP_INTEGERS);
const struct nir_shader_compiler_options *original_options = s->options;
- ntt_fix_nir_options(screen, s);
+ ntt_fix_nir_options(screen, s, options);
NIR_PASS_V(s, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
type_size, (nir_lower_io_options)0);
c = rzalloc(NULL, struct ntt_compile);
c->screen = screen;
+ c->options = options;
c->needs_texcoord_semantic =
screen->get_param(screen, PIPE_CAP_TGSI_TEXCOORD);
dEQP-GLES2.functional.shaders.functions.control_flow.mixed_return_break_continue_vertex,Fail
dEQP-GLES2.functional.shaders.functions.control_flow.mixed_return_break_continue_fragment,Fail
-# "No free temporary to use for predicate stack counter."
-dEQP-GLES2.functional.shaders.indexing.tmp_array.float_const_write_dynamic_loop_read_vertex,Fail
-dEQP-GLES2.functional.shaders.indexing.tmp_array.vec2_const_write_dynamic_loop_read_vertex,Fail
-dEQP-GLES2.functional.shaders.indexing.tmp_array.vec3_const_write_dynamic_loop_read_vertex,Fail
-dEQP-GLES2.functional.shaders.indexing.tmp_array.vec4_const_write_dynamic_loop_read_vertex,Fail
-
# "Rewrite of inst 0 failed Can't allocate source for Inst 4 src_type=1 new_index=1 new_mask=1"
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_dynamic_subscript_write_component_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_dynamic_subscript_write_direct_read_fragment,Fail