Commit graph

75506 commits

Author SHA1 Message Date
Jason Ekstrand
6f613abc2b anv/cmd_buffer: Add a new genX_cmd_buffer file for shared code
This file contains code that can be shared across gens modulo recompiling.
In particular, we can share STATE_BASE_ADDRESS setup and handling of the
vkPipelineBarrier call.  Not sharing STATE_BASE_ADDRESS setup has already
been a source of bugs and the gen7 and gen8 implementations of
PipelineBarrier were line-for-line identical.

Incidentally, this should fix MOCS settings for dynamic and surface state
on Haswell.
2015-11-18 12:26:57 -08:00
Jason Ekstrand
fb8b2f5f9e anv/gen7: A bunch of depth-stencil fixes
There are various bits which move around between Haswell and Ivy Bridge
that we weren't taking into account.  This also makes us actually set the
StencilWriteEnable in a sane way.
2015-11-18 11:43:52 -08:00
Jason Ekstrand
e9d634f4ad gen7/pipeline: Re-arrange stencil parameters to match gen8 2015-11-17 19:10:31 -08:00
Jason Ekstrand
9e39bdabad anv/gen7: Implement CmdPipelineBarrier 2015-11-17 17:09:27 -08:00
Jason Ekstrand
b707e90b6e anv/gen7: Don't use the upper bound on dynamic state base address
It doesn't do much for us and, if we have to resize the dynamic state block
pool for any reason, it becomes out-of-date.
2015-11-17 17:08:44 -08:00
Jason Ekstrand
f0390bcad6 anv: Add initial Haswell support 2015-11-17 12:14:24 -08:00
Jason Ekstrand
45320f677b anv: Add macros for doing per-gen compilation 2015-11-17 08:27:51 -08:00
Jason Ekstrand
92d164b1c3 anv/entrypoints: Add dispatch support for haswell 2015-11-17 08:27:51 -08:00
Jason Ekstrand
aa3002bd42 anv/entrypoints: Use devinfo instead of a gen number 2015-11-17 08:27:51 -08:00
Jason Ekstrand
0508046dc8 anv/cmd_buffer: Pack the 3DSTATE_VF packet on-demand 2015-11-17 08:27:51 -08:00
Jason Ekstrand
34d55d69cf anv/formats: Don't advertise stencil texture/blit prior to Broadwell 2015-11-17 08:23:29 -08:00
Jason Ekstrand
de54b4b18f anv: Only include the pack headers where needed
Previously, we were including gen7_pack.h, gen75_pack.h, and gen8_pack.h
in anv_private.h.  As we add more gens, this is going to become untenable.
This commit moves things around so that we only use the pack headers when
and if we need them.
2015-11-16 12:29:09 -08:00
Jason Ekstrand
cb9e2305f8 anv/cmd_buffer: Move gen-specific stuff into the appropreate files 2015-11-16 12:10:11 -08:00
Jason Ekstrand
22d024e031 nir/spirv: Add support for separate samplers and textures
This gets tricky in a few places because we have to pass vtn_sampled_image
values through OpAccessChain, but it works ok.  At some point, it probably
needs to be cleaned up but it doesn't occur to me exactly how to do that at
the moment.  We'll see how this approach goes.
2015-11-14 22:32:54 -08:00
Jason Ekstrand
002db3ee15 anv/cmd_buffer: Add a default descriptor type case
This silences a bunch of compiler warnings.
2015-11-14 09:16:55 -08:00
Jason Ekstrand
e9dba80430 anv/apply_pipeline_layout: Handle separate samplers and textures 2015-11-14 09:00:35 -08:00
Jason Ekstrand
b5d4027c35 Merge branch 'wip/i965-separate-sampler-tex' into vulkan 2015-11-14 08:23:27 -08:00
Jason Ekstrand
c7d504ad93 i965/vec4: Plumb separate surfaces and samplers through from NIR 2015-11-14 08:05:31 -08:00
Jason Ekstrand
3dd84822df i965/vec4: Separate the sampler from the surface in generate_tex 2015-11-14 08:05:31 -08:00
Jason Ekstrand
c09e140b65 i965/fs: Plumb separate surfaces and samplers through from NIR 2015-11-14 08:04:47 -08:00
Jason Ekstrand
c2a373ec85 i965/fs: Separate the sampler from the surface in generate_tex 2015-11-14 08:01:50 -08:00
Jason Ekstrand
b169bb902a nir: Separate texture from sampler in nir_tex_instr
This commit adds the capability to NIR to support separate textures and
samplers.  As it currently stands, glsl_to_nir only sets the sampler and
leaves the texture alone as it did before and nir_lower_samplers assumes
this.  However, backends can, if they wish, assume that they are separate
because nir_lower_samplers sets both texture and sampler index (they are
the same in this case).
2015-11-14 07:57:31 -08:00
Jason Ekstrand
1469ccb746 Merge remote-tracking branch 'mesa-public/master' into vulkan
This pulls in Matt's big compiler refactor.
2015-11-14 07:56:10 -08:00
Ilia Mirkin
f94e1d9738 nouveau: don't expose HEVC decoding support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
2015-11-14 10:32:10 -05:00
Jason Ekstrand
e8f51fe4de anv/gen8: Subtract 1 from num_elements when setting up buffer surface state 2015-11-13 22:50:54 -08:00
Jason Ekstrand
91bc4e7cec anv/pipeline: Don't free blend states that don't exist
Compute pipelines don't need a blend state so we shouldn't be
unconditionally freeing it.
2015-11-13 21:49:41 -08:00
Jason Ekstrand
c1733886a6 nir/spirv: Add support for SSBO stores
This only handles vector stores, not component-of-a-vector stores.
2015-11-13 21:41:52 -08:00
Jason Ekstrand
c68e28d766 nir/spirv: Refactor vtn_block_load
We pull the offset calculations out into their own function so we can
re-use it for stores.
2015-11-13 21:32:00 -08:00
Jason Ekstrand
99494b96f0 nir/spirv: Add support for image_load_store 2015-11-13 17:54:43 -08:00
Jason Ekstrand
164b3ca164 nir/builder: Add a nir_ssa_undef helper 2015-11-13 17:54:43 -08:00
Jason Ekstrand
ffbc31d13b nir/spirv: Add support for creating image variables 2015-11-13 17:54:43 -08:00
Jason Ekstrand
453239f6a5 nir/spirv: Add support for image types 2015-11-13 17:54:43 -08:00
Jason Ekstrand
0572444a0e nir/types: Add image type helpers 2015-11-13 17:54:43 -08:00
Jason Ekstrand
d5ba7a26d9 glsl/types: Add a get_image_instance helper 2015-11-13 17:54:43 -08:00
Vinson Lee
3a0fef0005 nir: Silence GCC maybe-uninitialized warnings.
nir/nir_control_flow.c: In function ‘split_block_cursor.isra.11’:
nir/nir_control_flow.c:460:15: warning: ‘after’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       *_after = after;
               ^
nir/nir_control_flow.c:458:16: warning: ‘before’ may be used uninitialized in this function [-Wmaybe-uninitialized]
       *_before = before;
                ^

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2015-11-13 16:19:11 -08:00
Kenneth Graunke
5480bbd90e i965: Add a SHADER_OPCODE_URB_READ_SIMD8_PER_SLOT opcode.
We need to use per-slot offsets when there's non-uniform indexing,
as each SIMD channel could have a different index.  We want to use
them for any non-constant index (even if uniform), as it lives in
the message header instead of the descriptor, allowing us to set
offsets in GRFs rather than immediates.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
2015-11-13 16:11:02 -08:00
Kenneth Graunke
511de1a80c glsl: Allow implicit int -> uint conversions for the % operator.
GLSL 4.00 and GL_ARB_gpu_shader5 introduced a new int -> uint implicit
conversion rule and updated the rules for modulus to use them.  (In
earlier languages, none of the implicit conversion rules did anything
relevant, so there was no point in applying them.)

This allows expressions such as:

   int foo;
   uint bar;
   uint mod = foo % bar;

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-11-13 16:09:58 -08:00
Kenneth Graunke
a4ba476c30 i965: Print input/output VUE maps on INTEL_DEBUG=vs, gs.
I've been carrying around a patch to do this for the last few months,
and it's been exceedingly useful for debugging GS and tessellation
problems.  I've caught lots of bugs by inspecting the interface
expectations of two adjacent stages.

It's not that much spam, so I figure we may as well just print it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Matt Turner <mattst88@gmail.com>
2015-11-13 16:08:51 -08:00
Kenneth Graunke
f88c175a29 i965: Make convert_attr_sources_to_hw_regs handle stride == 0.
This makes expressions like component(fs_reg(ATTR, n), 7) get a proper
<0,1,0> region instead of the invalid <0,8,0>.

Nobody uses this today, but I plan to.

v2: Rebase on Matt's changes; simplify.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com> [v1]
2015-11-13 15:17:58 -08:00
Kenneth Graunke
26f9469a46 nir: Add helpers for getting input/output intrinsic sources.
With the many variants of IO intrinsics, particular sources are often in
different locations.  It's convenient to say "give me the indirect
offset" or "give me the vertex index" and have it just work, without
having to think about exactly which kind of intrinsic you have.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-11-13 15:15:46 -08:00
Kenneth Graunke
d12bde0944 nir: Don't lower TCS outputs to temporaries.
We'd like to shadow these when possible, but the current code doesn't
work properly for TCS outputs.  For now, disable it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-11-13 15:15:46 -08:00
Kenneth Graunke
134728fdae nir: Allow outputs reads and add the relevant intrinsics.
Normally, we rely on nir_lower_outputs_to_temporaries to create shadow
variables for outputs, buffering the results and writing them all out
at the end of the program.  However, this is infeasible for tessellation
control shader outputs.

Tessellation control shaders can generate multiple output vertices, and
write per-vertex outputs.  These are arrays indexed by the vertex
number; each thread only writes one element, but can read any other
element - including those being concurrently written by other threads.
The barrier() intrinsic synchronizes between threads.

Even if we tried to shadow every output element (which is of dubious
value), we'd have to read updated values in at barrier() time, which
means we need to allow output reads.

Most stages should continue using nir_lower_outputs_to_temporaries(),
but in theory drivers could choose not to if they really wanted.

v2: Rebase to accomodate Jason's review feedback.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-11-13 15:15:41 -08:00
Kenneth Graunke
c51d7d5fe3 nir/lower_io: Introduce nir_store_per_vertex_output intrinsics.
Similar to nir_load_per_vertex_input, but for outputs.  This is not
useful in geometry shaders, but will be useful in tessellation shaders.

v2: Change stage_uses_per_vertex_outputs() to is_per_vertex_output(),
    taking a nir_variable (requested by Jason Ekstrand).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-11-13 15:15:10 -08:00
Kenneth Graunke
0df452cd0d nir/lower_io: Use load_per_vertex_input intrinsics for TCS and TES.
Tessellation control shader inputs are an array indexed by the vertex
number, like geometry shader inputs.  There aren't per-patch TCS inputs.

Tessellation evaluation shaders have both per-vertex and per-patch
inputs.  Per-vertex inputs get the new intrinsics; per-patch inputs
continue to use the ordinary load_input intrinsics, as they already
work like we want them to.

v2: Change stage_uses_per_vertex_inputs into is_per_vertex_input(),
    which takes a variable (requested by Jason Ekstrand).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-11-13 15:15:10 -08:00
Ian Romanick
1cb49eedb5 i965: Silence unused parameter warnings in get_buffer_rect
brw_meta_fast_clear.c: In function 'get_buffer_rect':
brw_meta_fast_clear.c:318:37: warning: unused parameter 'brw' [-Wunused-parameter]
 get_buffer_rect(struct brw_context *brw, struct gl_framebuffer *fb,
                                     ^
brw_meta_fast_clear.c:319:44: warning: unused parameter 'irb' [-Wunused-parameter]
                 struct intel_renderbuffer *irb, struct rect *rect)
                                            ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2015-11-13 12:29:57 -08:00
Ian Romanick
758f12fd98 meta/generate_mipmap: Don't leak the sampler object
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2015-11-13 12:29:56 -08:00
Matt Turner
7a879e422b i965: Remove unneeded #includes.
Some of these are no longer needed since all the backends switched to
NIR.
2015-11-13 12:16:48 -08:00
Matt Turner
386759b02d i965: Silence warning.
intel_asm_annotation.c: In function ‘annotation_insert_error’:
intel_asm_annotation.c:214:18:
warning: ‘ann’ may be used uninitialized in this function
[-Wmaybe-uninitialized]
       ann->error = ralloc_strdup(annotation->mem_ctx, error);
                         ^

I initially tried changing the type of ann_count to unsigned (is
currently int), since that in addition to the check that it's non-zero
at the beginning of the function seems sufficient to prove that it must
be greater than zero. Unfortunately that wasn't sufficient.
2015-11-13 12:13:14 -08:00
Juha-Pekka Heikkila
8b145d6a3d i965: Don't write beyond allocated memory.
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
2015-11-13 12:06:11 -08:00
Matt Turner
0eb3db117b i965: Use BRW_MRF_COMPR4 macro in more places.
Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-11-13 11:27:51 -08:00