mesa.git
8 years agoanv: Add anv_image::samples
Chad Versace [Thu, 21 Jan 2016 00:34:23 +0000 (16:34 -0800)]
anv: Add anv_image::samples

It's set but not yet used.

8 years agoanv: Use isl_device_get_sample_counts()
Chad Versace [Thu, 21 Jan 2016 00:04:28 +0000 (16:04 -0800)]
anv: Use isl_device_get_sample_counts()

Use it in vkGetPhysicalDeviceProperties.

8 years agoisl: Add func isl_device_get_sample_counts()
Chad Versace [Wed, 20 Jan 2016 23:53:54 +0000 (15:53 -0800)]
isl: Add func isl_device_get_sample_counts()

8 years agogen8/state: Remove SKL special-casing for MinimumArrayElement
Nanley Chery [Fri, 22 Jan 2016 23:07:12 +0000 (15:07 -0800)]
gen8/state: Remove SKL special-casing for MinimumArrayElement

MinimumArrayElement carries the same meaning for BDW and SKL.
Suggested by Jason.

No regressions in dEQP-VK.pipeline.image.view_type.cube_array.*
Fixes a number of cube tests, including cube_array_base_slice
and cube_base_slice tests.

8 years agoanv/state: Dedupe code for lowering surface format
Chad Versace [Fri, 22 Jan 2016 22:48:36 +0000 (14:48 -0800)]
anv/state: Dedupe code for lowering surface format

Add helper anv_surface_format().

8 years agoanv/meta: Set sampler type and instruction arrayness consistently in blit shader.
Francisco Jerez [Fri, 22 Jan 2016 23:57:02 +0000 (15:57 -0800)]
anv/meta: Set sampler type and instruction arrayness consistently in blit shader.

8 years agoanv/meta: Fix meta blit fragment shader for 1D arrays.
Francisco Jerez [Fri, 22 Jan 2016 23:57:01 +0000 (15:57 -0800)]
anv/meta: Fix meta blit fragment shader for 1D arrays.

8 years agogenX/state: Set CubeSurfaceControlMode to OVERRIDE
Jason Ekstrand [Sat, 23 Jan 2016 00:34:13 +0000 (16:34 -0800)]
genX/state: Set CubeSurfaceControlMode to OVERRIDE

This makes it act like the address mode is set to TEXCOORDMODE_CUBE
whenever this sampler is combined with a cube surface.  This *should* be
what we need for Vulkan.  Interestingly, the PRM contains a programming
note for this field that says simply, "This field must be set to
CUBECTRLMODE_PROGRAMMED".  However, emprical evidence suggests that it does
what the PRM says it does and OVERRIDE is just fine.

8 years agogen8/state: Divide depth by 6 for cube maps for GEN8
Jason Ekstrand [Sat, 23 Jan 2016 00:13:36 +0000 (16:13 -0800)]
gen8/state: Divide depth by 6 for cube maps for GEN8

For Broadwell cube maps, MinimumArrayElement is in terms of 2d slices (a
multiple of 6) but Depth is in terms of whole cubes.

8 years agogen8_state: Enable all cube faces
Nanley Chery [Fri, 22 Jan 2016 20:17:25 +0000 (12:17 -0800)]
gen8_state: Enable all cube faces

These fields are ignored for non-cube surfaces. For cube surfaces
these fields should be enabled when using TEXCOORDMODE_CLAMP and
TEXCOORDMODE_CUBE.

TODO: Determine if these are the only two modes used in Vulkan.

8 years agoisl/format_layout: R11G11B10_FLOAT is unsigned
Jason Ekstrand [Fri, 22 Jan 2016 19:57:49 +0000 (11:57 -0800)]
isl/format_layout: R11G11B10_FLOAT is unsigned

8 years agoanv/image: Move common code to anv_image.c
Jason Ekstrand [Fri, 22 Jan 2016 19:57:01 +0000 (11:57 -0800)]
anv/image: Move common code to anv_image.c

8 years agoanv/state: Refactor surface state setup into a "fill" function
Jason Ekstrand [Fri, 22 Jan 2016 19:40:56 +0000 (11:40 -0800)]
anv/state: Refactor surface state setup into a "fill" function

8 years agoanv/state: Add missing clflushes for storage image surface state.
Francisco Jerez [Fri, 22 Jan 2016 03:21:35 +0000 (19:21 -0800)]
anv/state: Add missing clflushes for storage image surface state.

8 years agoanv/state: Factor out surface state calculation from genX_image_view_init.
Francisco Jerez [Fri, 22 Jan 2016 03:21:34 +0000 (19:21 -0800)]
anv/state: Factor out surface state calculation from genX_image_view_init.

Some fields of the surface state template were dependent on the
surface type, which is dependent on the usage of the image view, which
wasn't known until the bottom of the function after the template had
been constructed.  This caused failures in all image load/store CTS
tests using cubemaps.  Refactor the surface state calculation into a
function that is called once for each required usage.

8 years agoi965/nir: Temporariliy disable mul+add fusion
Jason Ekstrand [Fri, 22 Jan 2016 19:09:24 +0000 (11:09 -0800)]
i965/nir: Temporariliy disable mul+add fusion

We don't want to do this in the long-run but it's needed for passing the
NoContraction tests at the moment.  Eventually, we want to plumb this
through NIR properly.

8 years agoisl: Fix indentation of isl_format_layout comment
Chad Versace [Fri, 22 Jan 2016 17:48:11 +0000 (09:48 -0800)]
isl: Fix indentation of isl_format_layout comment

8 years agoisl/tests: Give tests less cryptic names
Chad Versace [Fri, 22 Jan 2016 17:46:48 +0000 (09:46 -0800)]
isl/tests: Give tests less cryptic names

8 years agoisl: Fix isl_surf_get_image_offset_sa for gen4_3d layout
Chad Versace [Fri, 22 Jan 2016 16:32:00 +0000 (08:32 -0800)]
isl: Fix isl_surf_get_image_offset_sa for gen4_3d layout

Bug found by unit test
test_bdw_3d_r8g8b8a8_unorm_256x256x256_levels09_tiley0.

8 years agoisl/tests: Add test for bdw 3d surface
Chad Versace [Fri, 22 Jan 2016 16:31:29 +0000 (08:31 -0800)]
isl/tests: Add test for bdw 3d surface

test_bdw_3d_r8g8b8a8_unorm_256x256x256_levels09_tiley0

Currently fails.

8 years agoisl/tests: Remove copy-paste assertion
Chad Versace [Fri, 22 Jan 2016 15:17:34 +0000 (07:17 -0800)]
isl/tests: Remove copy-paste assertion

8 years agoisl/tests: Fix build
Chad Versace [Fri, 22 Jan 2016 15:17:06 +0000 (07:17 -0800)]
isl/tests: Fix build

isl_device_init() acquired a new param for bit6 swizzling.

8 years agoanv/batch_chain: Fix patching up of block pool relocations on Gen8+.
Francisco Jerez [Thu, 21 Jan 2016 22:14:07 +0000 (14:14 -0800)]
anv/batch_chain: Fix patching up of block pool relocations on Gen8+.

Relocations are 64 bits on Gen8+.  Most CTS tests that send
non-trivial work to the GPU would fail when run from a single deqp-vk
invocation because they were effectively relying on reloc presumed
offsets to be wrong so the kernel would come and apply relocations
correctly.

8 years agonir/spirv: Ignore cull distance
Jason Ekstrand [Fri, 22 Jan 2016 00:03:06 +0000 (16:03 -0800)]
nir/spirv: Ignore cull distance

8 years agonir/lower_system_values: Use the correct invication id for CS
Jason Ekstrand [Fri, 22 Jan 2016 00:00:47 +0000 (16:00 -0800)]
nir/lower_system_values: Use the correct invication id for CS

8 years agonir/spirv: Properly assign locations to split structures
Jason Ekstrand [Thu, 21 Jan 2016 20:41:45 +0000 (12:41 -0800)]
nir/spirv: Properly assign locations to split structures

8 years agonir/spirv: Improve handling of variable loads and copies
Jason Ekstrand [Thu, 21 Jan 2016 18:58:53 +0000 (10:58 -0800)]
nir/spirv: Improve handling of variable loads and copies

Before we were asuming that a deref would either be something in a block or
something that we could pass off to NIR directly.  However, it is possible
that someone would choose to load/store/copy a split structure all in one
go.  We need to be able to handle that.

8 years agonir/spirv: Make vectors a proper array time with an array_element
Jason Ekstrand [Thu, 21 Jan 2016 18:58:03 +0000 (10:58 -0800)]
nir/spirv: Make vectors a proper array time with an array_element

This makes dealing with single-component derefs easier

8 years agonir/spirv: Rework access chains a bit to allow for literals
Jason Ekstrand [Thu, 21 Jan 2016 18:20:50 +0000 (10:20 -0800)]
nir/spirv: Rework access chains a bit to allow for literals

This makes them much easier to construct because you can also just specify
a literal number and it doesn't have to be a valid SPIR-V id.

8 years agovtn/variables: Compact local loads/stores into one function
Jason Ekstrand [Thu, 21 Jan 2016 16:53:04 +0000 (08:53 -0800)]
vtn/variables: Compact local loads/stores into one function

This is similar to what we did for block loads/stores.

8 years agonir/spirv: Add an actual variable struct to spirv_to_nir
Jason Ekstrand [Thu, 21 Jan 2016 10:09:38 +0000 (02:09 -0800)]
nir/spirv: Add an actual variable struct to spirv_to_nir

This allows us, among other things, to do structure splitting on-the-fly to
more correctly handle input/output structs.

8 years agonir/spirv: Split variable handling out into its own file
Jason Ekstrand [Thu, 21 Jan 2016 01:40:49 +0000 (17:40 -0800)]
nir/spirv: Split variable handling out into its own file

It's 1300 lines all by itself and it will only grow.

8 years agonir/spirv: Rework access chains
Jason Ekstrand [Thu, 21 Jan 2016 01:11:55 +0000 (17:11 -0800)]
nir/spirv: Rework access chains

Previously, we were creating nir_deref's immediately.  Now, instead, we
have an intermediate vtn_access_chain structure.  While a little more
awkward initially, this will allow us to more easily do structure splitting
on-the-fly.

8 years agonir/spirv: Implement ModfStruct opcode.
Kenneth Graunke [Thu, 21 Jan 2016 22:56:34 +0000 (14:56 -0800)]
nir/spirv: Implement ModfStruct opcode.

8 years agonir/spirv: Delete stray fmod remnants.
Kenneth Graunke [Thu, 21 Jan 2016 22:53:44 +0000 (14:53 -0800)]
nir/spirv: Delete stray fmod remnants.

Jason left these stray code fragments in
22804de110b97dce1415318fd02c1003e16ef14a.

8 years agovk: Do render cache flush for GEN8+
Kristian Høgsberg Kristensen [Thu, 21 Jan 2016 22:14:01 +0000 (14:14 -0800)]
vk: Do render cache flush for GEN8+

This is needed for SKL as well.

8 years agovk: Emit surface state base address before renderpass
Kristian Høgsberg Kristensen [Thu, 21 Jan 2016 21:52:41 +0000 (13:52 -0800)]
vk: Emit surface state base address before renderpass

If we're continuing a render pass, make sure we don't emit the depth and
stencil buffer addresses before we set the state base addresses.

Fixes crucible func.cmd-buffer.small-secondaries

8 years agovk: Fix indirect push constants
Kristian Høgsberg Kristensen [Thu, 21 Jan 2016 18:43:32 +0000 (10:43 -0800)]
vk: Fix indirect push constants

This currently sets the base and size of all push constants to the
entire push constant block. The idea is that we'll use the base and size
to eventually optimize the amount we actually push, but for now we don't
do that.

8 years agoMerge remote-tracking branch 'jekstrand/wip/i965-uniforms' into vulkan
Kristian Høgsberg Kristensen [Thu, 21 Jan 2016 19:07:09 +0000 (11:07 -0800)]
Merge remote-tracking branch 'jekstrand/wip/i965-uniforms' into vulkan

8 years agonir/spirv: Handle compute shared atomics
Jordan Justen [Sun, 10 Jan 2016 19:12:17 +0000 (11:12 -0800)]
nir/spirv: Handle compute shared atomics

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/spirv: Support workgroup (shared) variable translation
Jordan Justen [Sat, 9 Jan 2016 03:45:45 +0000 (19:45 -0800)]
nir/spirv: Support workgroup (shared) variable translation

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen8: Set SLM size in interface descriptor
Jordan Justen [Sat, 9 Jan 2016 09:28:40 +0000 (01:28 -0800)]
anv/gen8: Set SLM size in interface descriptor

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen8+9: Invalidate color calc state when switching to the GPGPU pipeline
Jordan Justen [Thu, 21 Jan 2016 01:26:41 +0000 (17:26 -0800)]
anv/gen8+9: Invalidate color calc state when switching to the GPGPU pipeline

Port 044acb9256046bebec890cac7e42043754459fc2 to anv.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/gen8: Enable SLM in L3 cache control register
Jordan Justen [Sat, 9 Jan 2016 09:18:24 +0000 (01:18 -0800)]
anv/gen8: Enable SLM in L3 cache control register

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/pipeline: Set size of shared variables in prog_data
Jordan Justen [Mon, 18 Jan 2016 18:00:49 +0000 (10:00 -0800)]
anv/pipeline: Set size of shared variables in prog_data

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965/nir: Lower nir compute shader shared variables
Jordan Justen [Mon, 18 Jan 2016 17:45:46 +0000 (09:45 -0800)]
i965/nir: Lower nir compute shader shared variables

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Lower shared var atomics during nir_lower_io
Jordan Justen [Mon, 18 Jan 2016 17:59:19 +0000 (09:59 -0800)]
nir: Lower shared var atomics during nir_lower_io

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Add support for lowering load/stores of shared variables
Jordan Justen [Mon, 18 Jan 2016 17:44:31 +0000 (09:44 -0800)]
nir: Add support for lowering load/stores of shared variables

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Add atomic operations on variables
Jordan Justen [Mon, 18 Jan 2016 17:53:44 +0000 (09:53 -0800)]
nir: Add atomic operations on variables

This allows us to first generate atomic operations for shared
variables using these opcodes, and then later we can lower those to
the shared atomics intrinsics with nir_lower_io.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Add compute shader shared variable storage class
Jordan Justen [Sat, 9 Jan 2016 01:16:29 +0000 (17:16 -0800)]
nir: Add compute shader shared variable storage class

Previously we were receiving shared variable accesses via a lowered
intrinsic function from glsl. This change allows us to send in
variables instead. For example, when converting from SPIR-V.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/print: Add space after shader_storage var mode
Jordan Justen [Sun, 17 Jan 2016 07:11:16 +0000 (23:11 -0800)]
nir/print: Add space after shader_storage var mode

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965/fs/nir: Move shared variable load/store to nir_emit_cs_intrinsic
Jordan Justen [Sat, 16 Jan 2016 02:38:19 +0000 (18:38 -0800)]
i965/fs/nir: Move shared variable load/store to nir_emit_cs_intrinsic

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoanv/image: Stop including gen8_pack.h in common file
Chad Versace [Wed, 20 Jan 2016 23:41:25 +0000 (15:41 -0800)]
anv/image: Stop including gen8_pack.h in common file

8 years agoisl: Add a README
Chad Versace [Fri, 15 Jan 2016 18:00:13 +0000 (10:00 -0800)]
isl: Add a README

Most of the file-level comment in isl.h is moved to the README.

8 years agovk: Make maxSamplerAllocationCount more reasonable
Kristian Høgsberg Kristensen [Wed, 20 Jan 2016 22:36:52 +0000 (14:36 -0800)]
vk: Make maxSamplerAllocationCount more reasonable

We can't allocate 4 billion samplers. Let's go with 64k.

8 years agovk/tests: Add stub for anv_gem_get_bit6_swizzle()
Kristian Høgsberg Kristensen [Wed, 20 Jan 2016 21:46:54 +0000 (13:46 -0800)]
vk/tests: Add stub for anv_gem_get_bit6_swizzle()

8 years agovk/tests: Add isl include path
Kristian Høgsberg Kristensen [Wed, 20 Jan 2016 21:45:25 +0000 (13:45 -0800)]
vk/tests: Add isl include path

8 years agonir/spirv/glsl450: Use fabs not iabs in ldexp.
Kenneth Graunke [Wed, 20 Jan 2016 20:09:29 +0000 (12:09 -0800)]
nir/spirv/glsl450: Use fabs not iabs in ldexp.

This was just wrong.

8 years agoisl: Add ish.h to libsil_la_SOURCES
Kristian Høgsberg Kristensen [Wed, 20 Jan 2016 20:02:48 +0000 (12:02 -0800)]
isl: Add ish.h to libsil_la_SOURCES

8 years agonir/spirv/glsl450: Implement FrexpStruct
Jason Ekstrand [Wed, 20 Jan 2016 19:36:41 +0000 (11:36 -0800)]
nir/spirv/glsl450: Implement FrexpStruct

8 years agospirv/nir/glsl450: Use vtn_create_ssa_value to create SSA values
Jason Ekstrand [Wed, 20 Jan 2016 19:36:26 +0000 (11:36 -0800)]
spirv/nir/glsl450: Use vtn_create_ssa_value to create SSA values

8 years agoanv/device: Default to scalar GS on BDW+
Jason Ekstrand [Wed, 20 Jan 2016 19:16:44 +0000 (11:16 -0800)]
anv/device: Default to scalar GS on BDW+

8 years agonir/spirv: Pull texture dimensionality out of the image when available
Jason Ekstrand [Wed, 20 Jan 2016 19:11:30 +0000 (11:11 -0800)]
nir/spirv: Pull texture dimensionality out of the image when available

8 years agoanv/meta: fix UpdateBuffer in the case where we do multiple updates
Jason Ekstrand [Wed, 20 Jan 2016 15:56:48 +0000 (07:56 -0800)]
anv/meta: fix UpdateBuffer in the case where we do multiple updates

8 years agoanv/meta: Fix a finishme
Jason Ekstrand [Wed, 20 Jan 2016 15:33:41 +0000 (07:33 -0800)]
anv/meta: Fix a finishme

8 years agonir/spirv: Move OpPhi handling to vtn_cfg.c
Jason Ekstrand [Wed, 20 Jan 2016 02:58:31 +0000 (18:58 -0800)]
nir/spirv: Move OpPhi handling to vtn_cfg.c

Phi handling is somewhat intrinsically tied to the CFG.  Moving it here
makes it a bit easier to handle that.  In particular, we can now do SSA
repair after we've done the phi node second-pass.  This fixes 6 CTS tests.

8 years agonir/spirv: Handle OpLine and OpNoLine in foreach_instruction
Jason Ekstrand [Wed, 20 Jan 2016 02:44:44 +0000 (18:44 -0800)]
nir/spirv: Handle OpLine and OpNoLine in foreach_instruction

This way we don't have to explicitly handle them everywhere.

8 years agonir: Lower ldexp to arithmetic.
Kenneth Graunke [Wed, 20 Jan 2016 01:40:58 +0000 (17:40 -0800)]
nir: Lower ldexp to arithmetic.

This is a port of Matt's GLSL IR lowering pass to NIR.  It's required
because we translate SPIR-V directly to NIR, bypassing GLSL IR.

I haven't introduced a lower_ldexp flag, as I believe all current NIR
consumers would set the flag.  i965 wants this, vc4 doesn't implement
this feature, and st_glsl_to_tgsi currently lowers ldexp
unconditionally anyway.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir: Let nir_opt_algebraic rules contain unsigned constants > INT_MAX.
Kenneth Graunke [Wed, 20 Jan 2016 01:34:24 +0000 (17:34 -0800)]
nir: Let nir_opt_algebraic rules contain unsigned constants > INT_MAX.

struct.pack('i', val) interprets `val` as a signed integer, and dies
if `val` > INT_MAX.  For larger constants, we need to use 'I' which
interprets it as an unsigned value.

This patch makes us use 'I' for all values >= 0, and 'i' for negative
values.  This should work in all cases.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoanv/meta: Implement UpdateBuffer
Jason Ekstrand [Wed, 20 Jan 2016 00:39:48 +0000 (16:39 -0800)]
anv/meta: Implement UpdateBuffer

8 years agoanv/meta: Implement CmdFillBuffer
Jason Ekstrand [Wed, 20 Jan 2016 00:17:13 +0000 (16:17 -0800)]
anv/meta: Implement CmdFillBuffer

8 years agoanv/meta_clear: Call emit_clear directly in ClearImage
Jason Ekstrand [Tue, 19 Jan 2016 23:52:03 +0000 (15:52 -0800)]
anv/meta_clear: Call emit_clear directly in ClearImage

Using the load op means that we end up with recursive meta.  We shouldn't
be doing that.

8 years agoanv/meta_clear: Do save/restore in actual entry points
Jason Ekstrand [Tue, 19 Jan 2016 23:27:20 +0000 (15:27 -0800)]
anv/meta_clear: Do save/restore in actual entry points

8 years agoanv: Add support for VK_WHOLE_SIZE several places
Jason Ekstrand [Tue, 19 Jan 2016 23:01:10 +0000 (15:01 -0800)]
anv: Add support for VK_WHOLE_SIZE several places

8 years agonir/spirv/glsl450: Implement Frexp.
Kenneth Graunke [Wed, 20 Jan 2016 00:46:03 +0000 (16:46 -0800)]
nir/spirv/glsl450: Implement Frexp.

8 years agonir/spirv/glsl450: Blindly implement Atan2.
Kenneth Graunke [Tue, 19 Jan 2016 23:56:50 +0000 (15:56 -0800)]
nir/spirv/glsl450: Blindly implement Atan2.

This is untested and probably broken.

We already passed the atan2 CTS tests before implementing this opcode.
Presumably, glslang or something was giving us a plain Atan opcode
instead of Atan2.  I don't know why.

8 years agonir/spirv/glsl450: Implement Atan.
Kenneth Graunke [Tue, 19 Jan 2016 22:30:02 +0000 (14:30 -0800)]
nir/spirv/glsl450: Implement Atan.

8 years agonir/spirv/glsl450: Implement Asin and Acos.
Kenneth Graunke [Tue, 19 Jan 2016 20:15:36 +0000 (12:15 -0800)]
nir/spirv/glsl450: Implement Asin and Acos.

8 years agoanv/pipeline: Fix point size
Jason Ekstrand [Tue, 19 Jan 2016 20:02:53 +0000 (12:02 -0800)]
anv/pipeline: Fix point size

8 years agogetX/state: Set LOD pre-clamp to OpenGL mode
Jason Ekstrand [Tue, 19 Jan 2016 01:45:12 +0000 (17:45 -0800)]
getX/state: Set LOD pre-clamp to OpenGL mode

This gets us another couple hundred sampler tests

8 years agoisl/device: Add a flag for bit 6 swizzling
Jason Ekstrand [Tue, 5 Jan 2016 21:53:05 +0000 (13:53 -0800)]
isl/device: Add a flag for bit 6 swizzling

8 years agoanv/gem: Add a helper for getting bit6 swizzling information
Jason Ekstrand [Mon, 18 Jan 2016 23:42:41 +0000 (15:42 -0800)]
anv/gem: Add a helper for getting bit6 swizzling information

8 years agonir/spirv: Patch through image qualifiers
Jason Ekstrand [Tue, 19 Jan 2016 00:01:00 +0000 (16:01 -0800)]
nir/spirv: Patch through image qualifiers

8 years agonir/spirv: Implement ImageQuerySize for storage iamges
Jason Ekstrand [Tue, 5 Jan 2016 22:03:58 +0000 (14:03 -0800)]
nir/spirv: Implement ImageQuerySize for storage iamges

SPIR-V only has one ImageQuerySize opcode that has to work for both
textures and storage images.  Therefore, we have to special-case that one a
bit and look at the type of the incoming image handle.

8 years agonir/spirv: Insert movs around image intrinsics
Jason Ekstrand [Mon, 18 Jan 2016 23:00:01 +0000 (15:00 -0800)]
nir/spirv: Insert movs around image intrinsics

Image intrinsics always take a vec4 coordinate and always return a vec4.
This simplifies the intrinsics a but but also means that they don't
actually match the incomming SPIR-V.  In order to compensate for this, we
add swizzling movs for both source and destination to get the right number
of components.

8 years agoanv/meta: Improve meta clear cleanup a bit
Jason Ekstrand [Mon, 18 Jan 2016 22:07:46 +0000 (14:07 -0800)]
anv/meta: Improve meta clear cleanup a bit

8 years agoanv: Misc allocation scope fixes
Jason Ekstrand [Mon, 18 Jan 2016 22:04:13 +0000 (14:04 -0800)]
anv: Misc allocation scope fixes

8 years agoanv/meta: Add a meta allocator that uses SCOPE_DEVICE
Jason Ekstrand [Mon, 18 Jan 2016 22:03:20 +0000 (14:03 -0800)]
anv/meta: Add a meta allocator that uses SCOPE_DEVICE

The Vulkan spec requires all allocations that happen for device creation to
happen with SCOPE_DEVICE.  Since meta calls into other things that allocate
memory, the easiest way to do this is with an allocator.

8 years agoanv/meta: Initialize a handle to null
Jason Ekstrand [Mon, 18 Jan 2016 21:05:02 +0000 (13:05 -0800)]
anv/meta: Initialize a handle to null

8 years agogen8: Fix border color
Jason Ekstrand [Mon, 18 Jan 2016 20:16:31 +0000 (12:16 -0800)]
gen8: Fix border color

The border color packet is specified as a 64-byte aligned address relative
to dynamic state base address.  The way the packing functions are currently
set up, we need to provide it with (offset >> 6) because it just shoves the
bits in where the PRM says they go and isn't really aware that it's an
address.

8 years agogenX/pack: Add a __gen_fixed helper and use it for TextureLODBias
Jason Ekstrand [Mon, 18 Jan 2016 19:35:04 +0000 (11:35 -0800)]
genX/pack: Add a __gen_fixed helper and use it for TextureLODBias

The __gen_fixed helper properly clamps the value and also handles negative
values correctly.  Eventually, we need to make the scripts generate this
and use it for more things.

8 years agoanv/pack: Make TextureLODBias a proper 4.8 float
Jason Ekstrand [Mon, 18 Jan 2016 18:36:53 +0000 (10:36 -0800)]
anv/pack: Make TextureLODBias a proper 4.8 float

XXX: We need to update the generators so this doesn't get stompped.

8 years agonir/spirv: Handle if's where the merge is also a break or continue
Jason Ekstrand [Mon, 18 Jan 2016 18:10:47 +0000 (10:10 -0800)]
nir/spirv: Handle if's where the merge is also a break or continue

8 years agonir/spirv: Hanle continues that use SSA values from the loop body
Jason Ekstrand [Mon, 18 Jan 2016 17:33:56 +0000 (09:33 -0800)]
nir/spirv: Hanle continues that use SSA values from the loop body

Instead of emitting the continue before the loop body we emit it
afterwards.  Then, once we've finished with the entire function, we run
nir_repair_ssa to add whatever phi nodes are needed.

8 years agonir/lower_returns: Repair SSA after doing return lowering
Jason Ekstrand [Mon, 18 Jan 2016 17:24:07 +0000 (09:24 -0800)]
nir/lower_returns: Repair SSA after doing return lowering

8 years agonir: Add a pass to repair SSA form
Jason Ekstrand [Mon, 18 Jan 2016 17:19:01 +0000 (09:19 -0800)]
nir: Add a pass to repair SSA form

8 years agonir/vars_to_ssa: Use the new nir_phi_builder helper
Jason Ekstrand [Mon, 18 Jan 2016 16:40:16 +0000 (08:40 -0800)]
nir/vars_to_ssa: Use the new nir_phi_builder helper

The efficiency should be approximately the same.  We do a little more work
per phi node because we have to sort the predecessors.  However, we no
longer have to walk the blocks a second time to pop things off the stack.
The bigger advantage, however, is that we can now re-use the phi placement
and per-block SSA value tracking in other passes.

8 years agonir: Add a phi node placement helper
Jason Ekstrand [Mon, 18 Jan 2016 16:38:57 +0000 (08:38 -0800)]
nir: Add a phi node placement helper

Right now, we have phi placement code in two places and there are other
places where it would be nice to be able to do this analysis.  Instead of
repeating it all over the place, this commit adds a helper for placing all
of the needed phi nodes for a value.

8 years agoutil/bitset: Allow iterating over const bitsets
Jason Ekstrand [Sun, 17 Jan 2016 05:26:10 +0000 (21:26 -0800)]
util/bitset: Allow iterating over const bitsets

8 years agonir/lower_system_values: Lower vertexID to id+base if needed
Jason Ekstrand [Sat, 16 Jan 2016 00:15:50 +0000 (16:15 -0800)]
nir/lower_system_values: Lower vertexID to id+base if needed