diff options
author | Christian Gmeiner <[email protected]> | 2019-05-05 11:35:41 +0200 |
---|---|---|
committer | Christian Gmeiner <[email protected]> | 2019-05-07 07:35:52 +0200 |
commit | 4e110eca42ac2c56c5763a1f502e7c80db67e064 (patch) | |
tree | 0eb3b8dc9c3e5bdb770884761adeae7fe563b9e3 | |
parent | 050b934a24072df862a1fdad424c8f33379e8e26 (diff) |
nir: nir_shader_compiler_options: drop native_integers
Driver which do not support native integers should use a lowering
pass to go from integers to floats.
Signed-off-by: Christian Gmeiner <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r-- | src/broadcom/compiler/nir_to_vir.c | 1 | ||||
-rw-r--r-- | src/compiler/glsl/glsl_to_nir.cpp | 2 | ||||
-rw-r--r-- | src/compiler/nir/nir.h | 6 | ||||
-rw-r--r-- | src/freedreno/ir3/ir3_nir.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/lima/lima_program.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/midgard/midgard_compile.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_get.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/vc4/vc4_program.c | 1 | ||||
-rw-r--r-- | src/intel/compiler/brw_compiler.c | 1 | ||||
-rw-r--r-- | src/mesa/program/prog_to_nir.c | 44 |
12 files changed, 11 insertions, 53 deletions
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index a3484c5c67a..1556dbee45e 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -2380,7 +2380,6 @@ const nir_shader_compiler_options v3d_nir_options = { .lower_ldexp = true, .lower_mul_high = true, .lower_wpos_pntc = true, - .native_integers = true, }; /** diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 0aeac769452..a2c2f13416f 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -263,7 +263,7 @@ glsl_to_nir(struct gl_context *ctx, nir_visitor::nir_visitor(gl_context *ctx, nir_shader *shader) { - this->supports_ints = shader->options->native_integers; + this->supports_ints = true; this->supports_std430 = ctx->Const.UseSTD430AsDefaultPacking; this->shader = shader; this->is_global = true; diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 450f10a70b9..0fd2cabcff6 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2300,12 +2300,6 @@ typedef struct nir_shader_compiler_options { bool lower_all_io_to_temps; bool lower_all_io_to_elements; - /** - * Does the driver support real 32-bit integers? (Otherwise, integers - * are simulated by floats.) - */ - bool native_integers; - /* Indicates that the driver only has zero-based vertex id */ bool vertex_id_zero_based; diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c index dffcf5f5ab7..3bc22fe5be5 100644 --- a/src/freedreno/ir3/ir3_nir.c +++ b/src/freedreno/ir3/ir3_nir.c @@ -45,7 +45,6 @@ static const nir_shader_compiler_options options = { .lower_uadd_carry = true, .lower_mul_high = true, .fuse_ffma = true, - .native_integers = true, .vertex_id_zero_based = true, .lower_extract_byte = true, .lower_extract_word = true, @@ -72,7 +71,6 @@ static const nir_shader_compiler_options options_a6xx = { .lower_uadd_carry = true, .lower_mul_high = true, .fuse_ffma = true, - .native_integers = true, .vertex_id_zero_based = false, .lower_extract_byte = true, .lower_extract_word = true, diff --git a/src/gallium/drivers/lima/lima_program.c b/src/gallium/drivers/lima/lima_program.c index 1c5057cc9f7..e1cea2463a6 100644 --- a/src/gallium/drivers/lima/lima_program.c +++ b/src/gallium/drivers/lima/lima_program.c @@ -50,7 +50,6 @@ static const nir_shader_compiler_options vs_nir_options = { .lower_ftrunc = true, /* could be implemented by clamp */ .lower_fsat = true, - .native_integers = true, }; static const nir_shader_compiler_options fs_nir_options = { @@ -60,7 +59,6 @@ static const nir_shader_compiler_options fs_nir_options = { .lower_flrp32 = true, .lower_flrp64 = true, .lower_fsign = true, - .native_integers = true, }; const void * diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index 423b6af3b64..6c865d75f6d 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -899,7 +899,6 @@ static const nir_shader_compiler_options nir_options = { .lower_extract_byte = true, .lower_extract_word = true, .lower_all_io_to_temps = false, - .native_integers = true, .lower_cs_local_index_from_id = true, .use_interpolated_input_intrinsics = true, .max_unroll_iterations = 32, diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index 79224ac99a7..fe80c7e9103 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -941,7 +941,6 @@ static const nir_shader_compiler_options nir_options = { .lower_extract_byte = true, .lower_extract_word = true, .lower_all_io_to_temps = false, - .native_integers = true, .vertex_id_zero_based = false, .lower_base_vertex = false, .lower_helper_invocation = false, diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.h b/src/gallium/drivers/panfrost/midgard/midgard_compile.h index 0724582d62c..6f02b3662f6 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard_compile.h +++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.h @@ -106,8 +106,6 @@ static const nir_shader_compiler_options midgard_nir_options = { .vertex_id_zero_based = true, .lower_extract_byte = true, .lower_extract_word = true, - - .native_integers = true }; #endif diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c index 4e23d283ab7..700777186d8 100644 --- a/src/gallium/drivers/radeonsi/si_get.c +++ b/src/gallium/drivers/radeonsi/si_get.c @@ -498,7 +498,6 @@ static const struct nir_shader_compiler_options nir_options = { .lower_extract_word = true, .optimize_sample_mask_in = true, .max_unroll_iterations = 32, - .native_integers = true, }; static const void * diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 7f6809c087c..2ca3f907135 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -2173,7 +2173,6 @@ static const nir_shader_compiler_options nir_options = { .lower_fsqrt = true, .lower_ldexp = true, .lower_negate = true, - .native_integers = true, .max_unroll_iterations = 32, }; diff --git a/src/intel/compiler/brw_compiler.c b/src/intel/compiler/brw_compiler.c index 44296083711..b119a758768 100644 --- a/src/intel/compiler/brw_compiler.c +++ b/src/intel/compiler/brw_compiler.c @@ -46,7 +46,6 @@ .lower_isign = true, \ .lower_ldexp = true, \ .lower_device_index_to_zero = true, \ - .native_integers = true, \ .use_interpolated_input_intrinsics = true, \ .vertex_id_zero_based = true, \ .lower_base_vertex = true diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c index cb1c19e9dfa..dda3cd91da9 100644 --- a/src/mesa/program/prog_to_nir.c +++ b/src/mesa/program/prog_to_nir.c @@ -362,18 +362,10 @@ ptn_lit(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src) nir_ssa_def *pow = nir_fpow(b, nir_fmax(b, src0_y, nir_imm_float(b, 0.0)), wclamp); - nir_ssa_def *z; - if (b->shader->options->native_integers) { - z = nir_bcsel(b, - nir_fge(b, nir_imm_float(b, 0.0), ptn_channel(b, src[0], X)), - nir_imm_float(b, 0.0), - pow); - } else { - z = nir_fcsel(b, - nir_sge(b, nir_imm_float(b, 0.0), ptn_channel(b, src[0], X)), - nir_imm_float(b, 0.0), - pow); - } + nir_ssa_def *z = nir_bcsel(b, + nir_fge(b, nir_imm_float(b, 0.0), ptn_channel(b, src[0], X)), + nir_imm_float(b, 0.0), + pow); ptn_move_dest_masked(b, dest, z, WRITEMASK_Z); } @@ -402,11 +394,7 @@ ptn_scs(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src) static void ptn_slt(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src) { - if (b->shader->options->native_integers) { - ptn_move_dest(b, dest, nir_b2f32(b, nir_flt(b, src[0], src[1]))); - } else { - ptn_move_dest(b, dest, nir_slt(b, src[0], src[1])); - } + ptn_move_dest(b, dest, nir_b2f32(b, nir_flt(b, src[0], src[1]))); } /** @@ -415,11 +403,7 @@ ptn_slt(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src) static void ptn_sge(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src) { - if (b->shader->options->native_integers) { - ptn_move_dest(b, dest, nir_b2f32(b, nir_fge(b, src[0], src[1]))); - } else { - ptn_move_dest(b, dest, nir_sge(b, src[0], src[1])); - } + ptn_move_dest(b, dest, nir_b2f32(b, nir_fge(b, src[0], src[1]))); } static void @@ -464,15 +448,9 @@ ptn_dph(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src) static void ptn_cmp(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src) { - if (b->shader->options->native_integers) { - ptn_move_dest(b, dest, nir_bcsel(b, - nir_flt(b, src[0], nir_imm_float(b, 0.0)), - src[1], src[2])); - } else { - ptn_move_dest(b, dest, nir_fcsel(b, - nir_slt(b, src[0], nir_imm_float(b, 0.0)), - src[1], src[2])); - } + ptn_move_dest(b, dest, nir_bcsel(b, + nir_flt(b, src[0], nir_imm_float(b, 0.0)), + src[1], src[2])); } static void @@ -484,9 +462,7 @@ ptn_lrp(nir_builder *b, nir_alu_dest dest, nir_ssa_def **src) static void ptn_kil(nir_builder *b, nir_ssa_def **src) { - nir_ssa_def *cmp = b->shader->options->native_integers ? - nir_bany(b, nir_flt(b, src[0], nir_imm_float(b, 0.0))) : - nir_fany_nequal4(b, nir_slt(b, src[0], nir_imm_float(b, 0.0)), nir_imm_float(b, 0.0)); + nir_ssa_def *cmp = nir_bany(b, nir_flt(b, src[0], nir_imm_float(b, 0.0))); nir_intrinsic_instr *discard = nir_intrinsic_instr_create(b->shader, nir_intrinsic_discard_if); |