summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
Commit message (Collapse)AuthorAgeFilesLines
* nir/lower_indirect_derefs: Use the direct array deref for recursionJason Ekstrand2016-06-031-1/+1
| | | | | | | | This fixes about 100 of the new Vulkan CTS tests. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "12.0" <[email protected]>
* nir/algebraic: support for power-of-two optimizationsRob Clark2016-06-036-5/+128
| | | | | | | | | | | | Some optimizations, like converting integer multiply/divide into left/ right shifts, have additional constraints on the search expression. Like requiring that a variable is a constant power of two. Support these cases by allowing a fxn name to be appended to the search var expression (ie. "a#32(is_power_of_two)"). Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965: Add nir channel_num system valueJordan Justen2016-06-011-0/+1
| | | | | | | | | v2: * simd16/32 fixes (curro) Cc: "12.0" <[email protected]> Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Make lowering gl_LocalInvocationIndex optionalJordan Justen2016-06-015-4/+20
| | | | | | Cc: "12.0" <[email protected]> Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: allow sat on all float destination typesIlia Mirkin2016-06-011-1/+3
| | | | | | | | | | | With the introduction of fp64 and fp16 to nir, there are now a bunch of float types running around. A F1 2015 shader ends up with an i2f.sat operation, which has a nir_type_float32 destination. Allow sat on all the float destination types. Signed-off-by: Ilia Mirkin <[email protected]> Cc: "12.0" <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/inline: Also rewrite param derefs for texture instructionsJason Ekstrand2016-05-271-6/+20
| | | | | | | Without this, samplers get left hanging as derefs to variables that don't actually exist. Reviewed-by: Connor Abbott <[email protected]>
* nir/inline: Break the guts of rewrite_param-derefs into a helperJason Ekstrand2016-05-271-19/+30
| | | | Reviewed-by: Connor Abbott <[email protected]>
* nir/inline: Make the rewrite_param_derefs helper work on instructionsJason Ekstrand2016-05-271-28/+25
| | | | | | | Now that we have the better nir_foreach_block macro, there's no reason to use the archaic block version for everything. Reviewed-by: Connor Abbott <[email protected]>
* nir/inline: Don't use foreach_instr_safe unless we need toJason Ekstrand2016-05-271-2/+2
| | | | Suggested-by: Connor Abbott <[email protected]>
* nir: Make nir_const_value a unionJason Ekstrand2016-05-262-10/+8
| | | | | | | | There's no good reason for it to be a struct of an anonymous union. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96221 Tested-by: Vinson Lee <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* compiler: Move glsl_to_nir to libglsl.laJason Ekstrand2016-05-262-2068/+0
| | | | | | | | Right now libglsl.la depends on libnir.la so putting it in libnir.la adds a dependency on libglsl.la that goes the wrong direction. Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* nir: Strengthen assertion that 'out' is nonnull.Matt Turner2016-05-251-1/+1
| | | | | Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* mesa: Add .gitignore entries for make check binariesKristian Høgsberg Kristensen2016-05-251-0/+1
| | | | | Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Acked-by: Matt Turner <[email protected]>
* nir: Add a lowering pass for YUV texturesKristian Høgsberg Kristensen2016-05-242-0/+126
| | | | | | | | This lowers sampling from YUV textures to 1) one or more texture instructions to sample each plane and 2) color space conversion to RGB. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Handle NULL in nir_copy_deref()Kristian Høgsberg Kristensen2016-05-241-0/+3
| | | | | Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Add new 'plane' texture source typeKristian Høgsberg Kristensen2016-05-242-0/+4
| | | | | | | | This will be used to select the plane to sample from for planar textures. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/lower_samplers: Protect against sampler index overflowJason Ekstrand2016-05-231-3/+6
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* nir/validate: fix null deref coverity warningRob Clark2016-05-231-0/+1
| | | | | | | | CID 1265536 (#1 of 2): Explicit null dereferenced (FORWARD_NULL)6. var_deref_op: Dereferencing null pointer parent. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: handle double-precision in fsign, fsat, fnot and frcpIago Toral Quiroga2016-05-231-4/+9
| | | | | | | | I think these are not strictly necessary since the floats in them should be automatically promoted to doubles when operated with double sources, but it makes things more explicit at least. Reviewed-by: Matt Turner <[email protected]>
* nir: handle double-precision in fabs, frsq and fsqrtIago Toral Quiroga2016-05-231-3/+3
| | | | Reviewed-by: Matt Turner <[email protected]>
* nir: Fix crash in nir_lower_wpos_center().Kenneth Graunke2016-05-201-1/+1
| | | | | | | | | Otherwise we rewrote the fadd to use itself, causing crashes in validation. Instead, start after the last use like we should. A brown paper bag fix. Fixes crashes in several Vulkan tests. Signed-off-by: Kenneth Graunke <[email protected]>
* nir: Add a simple nir_lower_wpos_center() pass for Vulkan drivers.Kenneth Graunke2016-05-202-0/+108
| | | | | | | | | | | | | | | | | | | | nir_lower_wpos_ytransform() is great for OpenGL, which allows applications to choose whether their coordinate system's origin is upper left/lower left, and whether the pixel center should be on integer/half-integer boundaries. Vulkan, however, has much simpler requirements: the pixel center is always half-integer, and the origin is always upper left. No coordinate transform is needed - we just need to add <0.5, 0.5>. This means that we can avoid using (and setting up) a uniform. I thought about adding more options to nir_lower_wpos_ytransform(), but making a new pass that never even touched uniforms seemed simpler. v2: Use normal iterator rather than _safe variant (noticed by Matt). Signed-off-by: Kenneth Graunke <[email protected]> Acked-by: Rob Clark <[email protected]>
* nir: Don't use ffma in nir_lower_wpos_ytransform().Kenneth Graunke2016-05-201-12/+8
| | | | | | | | | | | ffma is an explicitly fused multiply add with higher precision. The optimizer will take care of promoting mul/add to fma when it's beneficial to do so. This fixes failures on Gen4-5 when using this pass, as those platforms don't actually implement fma(). Signed-off-by: Kenneth Graunke <[email protected]>
* nir: Handle fddy_fine and fddy_coarse in nir_lower_wpos_ytransform.Kenneth Graunke2016-05-201-1/+3
| | | | | | | These also need flipping! Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* nir: Make lower_wpos_ytransform_block a void function.Kenneth Graunke2016-05-201-3/+1
| | | | | | | | The return value was used for the old nir_foreach_block callback system, but at this point it no longer means anything. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* nir: Make nir_lower_wpos_ytransform() match FragCoord by location.Kenneth Graunke2016-05-201-1/+2
| | | | | | | | | | | | | gl_FragCoord is a shader input with location == VARYING_SLOT_POS. ARB_fragment_programs have an equivalent input at VARYING_SLOT_POS, but it isn't called gl_FragCoord. We do want to transform it. Matching by location guarantees we catch both. Fixes several fp tests on a branch which uses this pass on i965. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* nir: Add interp_var_at_offset flipping.Kenneth Graunke2016-05-201-0/+21
| | | | | | | The Y-offset needs flipping as well, similar to ddy. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* nir: Fix fddy swizzles in nir_lower_wpos_ytransform().Kenneth Graunke2016-05-201-0/+3
| | | | | | | | | | | The original value might have been swizzled. That's taken care of in the fmul source - we don't want to reswizzle it again. Fixes validation failures in glsl-derivs-varyings on a branch of mine which uses this pass in i965. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* nir: Fix wpos_ytransform lowering state_slot swizzle.Kenneth Graunke2016-05-201-0/+2
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* nir/validate: assume() that hashtable entry existsRob Clark2016-05-201-0/+3
| | | | | | | | | | | | | | | At this point, it would require a logic error in nir_validate to not have already populated this hashtable entry, but coverity doesn't realize that: CID 1265547 (#1 of 1): Dereference null return value (NULL_RETURNS)3. dereference: Dereferencing a null pointer entry. CID 1271039 (#1 of 1): Dereference null return value (NULL_RETURNS)3. dereference: Dereferencing a null pointer entry. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* nir: coverity unitialized pointer readRob Clark2016-05-201-0/+2
| | | | | | | | | Not sure how coverity arrives at the conclusion that we can read comp[j] unitialized (around line 204), other than not being aware that ncomp is greater than 1 so it won't underflow in the 'if (tex->is_array)' case. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* nir: coverity sign-extension fixRob Clark2016-05-201-1/+1
| | | | | | | | | | | | | | | | Not 100% sure, but I think being an unsigned literal will help: CID 1358505 (#1 of 1): Unintended sign extension (SIGN_EXTENSION)sign_extension: Suspicious implicit sign extension: load1->def.num_components with type unsigned char (8 bits, unsigned) is promoted in load1->def.num_components * (load1->def.bit_size / 8) to type int (32 bits, signed), then sign-extended to type unsigned long (64 bits, unsigned). If load1->def.num_components * (load1->def.bit_size / 8) is greater than 0x7FFFFFFF, the upper bits of the result will all be 1. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* nir/glsl_to_nir: quell some uninit_member coverity errorsRob Clark2016-05-201-0/+6
| | | | | Signed-off-by: Rob Clark <[email protected]> Acked-by: Matt Turner <[email protected]>
* nir/validate: dump annotated shader with error msgsRob Clark2016-05-171-1/+62
| | | | | | | | | Log all the errors, and at the end dump the shader w/ error annotations to make it easier to see where the problems are. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir/validate: assert() -> validate_assert()Rob Clark2016-05-171-126/+128
| | | | | | | Prep work for next patch. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir/print: add support for print annotationsRob Clark2016-05-172-1/+35
| | | | | | | | | | | | | | | Caller can pass a hashtable mapping NIR object (currently instr or var, but I guess others could be added as needed) to annotation msg to print inline with the shader dump. As the annotation msg is printed, it is removed from the hashtable to give the caller a way to know about any unassociated msgs. This is used in the next patch, for nir_validate to try to associate error msgs to nir_print dump. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* nir: add double input bitmapJuan A. Suarez Romero2016-05-172-0/+3
| | | | | | This bitmap tracks which input attributes are double-precision. Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Mark nir_start_block()/nir_impl_last_block() with returns_nonnull.Matt Turner2016-05-161-4/+5
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Add a nir->info.uses_interp_var_at_offset flag.Kenneth Graunke2016-05-153-0/+10
| | | | | | | | | I've added this to nir_gather_info(), but also to glsl_to_nir() as a temporary measure, since the i965 GL driver today doesn't use nir_gather_info() yet. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: forward-declare 'struct gl_shader_program'Rob Clark2016-05-151-1/+2
| | | | | | | | Drop extra #include which is otherwise unneeded (and makes this header difficult to include from outside of src/mesa). Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: return progress from lower_idivRob Clark2016-05-152-7/+16
| | | | | | | | | | With algebraic-opt support for lowering div to shift, the driver would like to be able to run this pass *after* the main opt-loop, and then conditionally re-run the opt-loop if this pass actually lowered some- thing. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: fix comment typo about f2d/d2fRob Clark2016-05-151-2/+2
| | | | | Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Add texture opcodes and source types for multisample compressionJason Ekstrand2016-05-142-0/+12
| | | | | | | | | | | Intel hardware does a form of multisample compression that involves an auxilary surface called the MCS. When an MCS is in use, you have to first sample from the MCS with a special opcode and then pass the result of that operation into the next sample instrucion. Normally, we just do this ourselves in the back-end, but we want to expose that functionality to NIR so that we can use MCS values directly in NIR-based blorp. Reviewed-by: Kenneth Graunke <[email protected]>
* nir/builder: Add a helper for grabbing multiple channels from an ssa defJason Ekstrand2016-05-141-0/+14
| | | | | | | This is similar to nir_channel except that it lets you grab more than one channel by providing a mask. Reviewed-by: Kenneth Graunke <[email protected]>
* nir/builder: Generate the alu helpers directly in pythonJason Ekstrand2016-05-142-31/+13
| | | | | | | | | There's no reason for having a macro *and* a python generator. We can easily just do the whole thing in python. This has the advantage that we are no longer definining ALU# macros which conflict with the ones in brw_fs_builder.h. Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Add an info bit for uses_sample_qualifierJason Ekstrand2016-05-143-1/+13
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* nir: Remove empty visit_call_src and visit_load_const_src functionsIan Romanick2016-05-121-17/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The guts were removed in dfb3abba. It has been almost exactly a year, so I dont think we're going to "decide we want [predication] back." Silences several "unused parameter" warnings: nir/nir.c: In function ‘visit_call_src’: nir/nir.c:1052:32: warning: unused parameter ‘instr’ [-Wunused-parameter] visit_call_src(nir_call_instr *instr, nir_foreach_src_cb cb, void *state) ^ nir/nir.c:1052:58: warning: unused parameter ‘cb’ [-Wunused-parameter] visit_call_src(nir_call_instr *instr, nir_foreach_src_cb cb, void *state) ^ nir/nir.c:1052:68: warning: unused parameter ‘state’ [-Wunused-parameter] visit_call_src(nir_call_instr *instr, nir_foreach_src_cb cb, void *state) ^ nir/nir.c: In function ‘visit_load_const_src’: nir/nir.c:1058:44: warning: unused parameter ‘instr’ [-Wunused-parameter] visit_load_const_src(nir_load_const_instr *instr, nir_foreach_src_cb cb, ^ nir/nir.c:1058:70: warning: unused parameter ‘cb’ [-Wunused-parameter] visit_load_const_src(nir_load_const_instr *instr, nir_foreach_src_cb cb, ^ nir/nir.c:1059:28: warning: unused parameter ‘state’ [-Wunused-parameter] void *state) ^ v2: Add some comments in nir_foreach_src suggested by Jason. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Cc: Connor Abbott <[email protected]>
* nir: Silence unused parameter warningsIan Romanick2016-05-124-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These cases had the parameter removed: nir/nir_lower_vec_to_movs.c: In function ‘try_coalesce’: nir/nir_lower_vec_to_movs.c:124:66: warning: unused parameter ‘shader’ [-Wunused-parameter] try_coalesce(nir_alu_instr *vec, unsigned start_idx, nir_shader *shader) ^ nir/nir_lower_io.c: In function ‘load_op’: nir/nir_lower_io.c:147:32: warning: unused parameter ‘state’ [-Wunused-parameter] load_op(struct lower_io_state *state, ^ These cases had the parameter (void) silenced because the parameter was necessary for an interface: nir/glsl_to_nir.cpp:1900:32: warning: unused parameter 'ir' [-Wunused-parameter] nir_visitor::visit(ir_barrier *ir) ^ nir/nir.c: In function ‘remove_use_cb’: nir/nir.c:802:35: warning: unused parameter ‘state’ [-Wunused-parameter] remove_use_cb(nir_src *src, void *state) ^ nir/nir.c: In function ‘remove_def_cb’: nir/nir.c:811:37: warning: unused parameter ‘state’ [-Wunused-parameter] remove_def_cb(nir_dest *dest, void *state) ^ Number of total warnings in my build reduced from 2543 to 2538 (reduction of 5). Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* nir: glsl_get_bit_size() should take glsl_typeRob Clark2016-05-126-14/+13
| | | | | | | | It's what all the call-sites once, so gets rid of a bunch of inlined glsl_get_base_type() at the call-sites. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir/algebraic: Separate ffma lowering from fusingJason Ekstrand2016-05-112-1/+2
| | | | | | | | The i965 driver has its own pass for fusing mul+add combinations that's much smarter than what nir_opt_algebraic can do so we don't want to get the nir_opt_algebraic one just because we didn't set lower_ffma. Reviewed-by: Kenneth Graunke <[email protected]>