Jason Ekstrand [Tue, 19 May 2015 02:56:32 +0000 (19:56 -0700)]
vk: Use a separate block pool and state stream for binding tables
The binding table pointers packet only allows for a 16-bit binding table
address so all binding tables have to be in the first 64 KB of the surface
state BO. We solve this by adding a slave block pool that pulls off the
first 64 KB worth of blocks and reserves them for binding tables.
Jason Ekstrand [Tue, 19 May 2015 02:55:34 +0000 (19:55 -0700)]
vk/allocator: Add a concept of a slave block pool
We probably need a better name but this will do for now.
Kristian Høgsberg [Tue, 19 May 2015 03:44:37 +0000 (20:44 -0700)]
vk/test: Add test that prints format features
Kristian Høgsberg [Tue, 19 May 2015 00:05:36 +0000 (17:05 -0700)]
vk/test: Test timestamps and occlusion queries
Kristian Høgsberg [Tue, 19 May 2015 00:04:32 +0000 (17:04 -0700)]
vk: Make timestamp command work correctly
This was using the wrong timestamp register and needs to write a 64 bit
value.
Kristian Høgsberg [Tue, 19 May 2015 00:03:58 +0000 (17:03 -0700)]
vk: Make occlusion query work, both copy and get functions
Kristian Høgsberg [Tue, 19 May 2015 00:00:52 +0000 (17:00 -0700)]
vk: Update generated header files
This fixes a problem where register addresses where incorrectly shifted.
Kristian Høgsberg [Mon, 18 May 2015 17:39:14 +0000 (10:39 -0700)]
vk: Only fill render targets for meta clear
Clear inherits the render targets from the current render pass. This
means we need to fill out the binding table after switching to meta
bindings. However, meta copies etc happen outside a render pass and
break when we try to fill in the render targets. This change fills the
render targets only for meta clear.
Jason Ekstrand [Mon, 18 May 2015 22:47:28 +0000 (15:47 -0700)]
vk/pipeline: Use a state_stream for storing programs
Previously, we were effectively using a state_stream, it was just
hand-rolled based on a block pool. Now we actually use the data structure.
Jason Ekstrand [Mon, 18 May 2015 19:06:02 +0000 (12:06 -0700)]
vk/allocator: Add support for valgrind tracking of state pools and streams
We leave the block pool untracked so that reads/writes to freed blocks
will get caught and do the tracking at the state pool/stream level. We
have to do a few extra gymnastics for streams because valgrind works in
terms of poitners and we work in terms of separate map and offset.
Fortunately, the users of the state pool and stream should always be using
the map pointer provided in the anv_state structure. We just have to
track, per block, the map that was used when we initially got the block.
Then we can make sure we always use that map and valgrind should stay
happy.
Jason Ekstrand [Mon, 18 May 2015 22:58:02 +0000 (15:58 -0700)]
vk/allocator: Don't use memfd when valgrind is detected
Jason Ekstrand [Mon, 18 May 2015 22:46:42 +0000 (15:46 -0700)]
vk/allocator: Assert that block_pool_grow succeeds
Jason Ekstrand [Mon, 18 May 2015 19:05:17 +0000 (12:05 -0700)]
vk/gem: VG_CLEAR the padding for the gem_mmap struct
Jason Ekstrand [Mon, 18 May 2015 17:41:09 +0000 (10:41 -0700)]
vk/meta: Rework the indentation style
No functional change.
Kristian Høgsberg [Mon, 18 May 2015 17:17:53 +0000 (10:17 -0700)]
vk: Provide more realistic values for device info
Kristian Høgsberg [Mon, 18 May 2015 16:05:11 +0000 (09:05 -0700)]
vk: Use a temporary buffer for formatting in finishme
This is more likely to avoid breaking up the message when racing with
other threads.
Jason Ekstrand [Mon, 18 May 2015 16:42:09 +0000 (09:42 -0700)]
vk/meta: Add an initial implementation of vkCmdCopyBuffer
Compile-tested only
Jason Ekstrand [Mon, 18 May 2015 16:16:04 +0000 (09:16 -0700)]
vk/meta: Add an initial implementation of vkCmdCopyBufferToImage
Compile-tested only
Jason Ekstrand [Mon, 18 May 2015 16:06:06 +0000 (09:06 -0700)]
vk/meta: Add an initial implementation of vkCmdBlitImage
Compile-tested only
Jason Ekstrand [Mon, 18 May 2015 16:03:27 +0000 (09:03 -0700)]
vk/meta: Add an initial implementation of vkCmdCopyImage
Compile-tested only
Jason Ekstrand [Mon, 18 May 2015 16:59:08 +0000 (09:59 -0700)]
vk/gem: Set the gem_mmap.flags parameter to 0 if it exists
Jason Ekstrand [Mon, 18 May 2015 16:57:12 +0000 (09:57 -0700)]
vk/gem: Only VK_CLEAR the addr_ptr in gen_mmap
Kristian Høgsberg [Mon, 18 May 2015 15:52:22 +0000 (08:52 -0700)]
vk: Add a logger wrapper for the generated entrypoint
Kristian Høgsberg [Mon, 18 May 2015 15:50:56 +0000 (08:50 -0700)]
vk/gem: Just return -1 from anv_gem_wait() on error
We were returning -errno, unlike all the other gem functions.
Kristian Høgsberg [Mon, 18 May 2015 15:50:04 +0000 (08:50 -0700)]
vk: Fix vkGetOjectInfo return values
We weren't properly returning the allocation count.
Kristian Høgsberg [Mon, 18 May 2015 15:49:15 +0000 (08:49 -0700)]
vk: Implement fences
This basic implementation uses a throw-away bo for synchronization.
Kristian Høgsberg [Mon, 18 May 2015 02:30:27 +0000 (19:30 -0700)]
vk/meta: Use anv_* internal entrypoints
Kristian Høgsberg [Mon, 18 May 2015 02:25:28 +0000 (19:25 -0700)]
vk: Implement allocation count query
Kristian Høgsberg [Mon, 18 May 2015 02:22:52 +0000 (19:22 -0700)]
vk: Change pData/pDataSize semantics
We now always copy the entire struct unless pData is NULL and
unconditionally write back the struct size. It's not clear this is
useful if the structs may grow over time, but it seems to be the
expected behaviour for now.
Kristian Høgsberg [Mon, 18 May 2015 01:39:12 +0000 (18:39 -0700)]
vk: Return VK_SUCCESS from vkAllocDescriptorSets
This should've been returning VK_SUCCESS all along.
Kristian Høgsberg [Mon, 18 May 2015 01:38:34 +0000 (18:38 -0700)]
vk: Return VK_SUCCESS for all descriptor pool entry points
Kristian Høgsberg [Mon, 18 May 2015 04:35:34 +0000 (21:35 -0700)]
vk: Start Implementing vkGetFormatInfo()
We move the format table and vkGetFormatInfo to their own file in the
process.
Kristian Høgsberg [Sun, 17 May 2015 23:33:48 +0000 (16:33 -0700)]
vk: Add script for generating ifunc entry points
This lets us generate a hash table for vkGetProcAddress and lets us call
public functions internally without the public entrypoint overhead.
Kristian Høgsberg [Sun, 17 May 2015 23:40:10 +0000 (16:40 -0700)]
vk: Fix vulkan header inconsistency
The function pointer typedef and the function prototype for
vkCmdClearColorImage() didn't agree. Fix the typedef to match the
prototype.
Kristian Høgsberg [Sun, 17 May 2015 23:39:20 +0000 (16:39 -0700)]
vk: Add function pointer typedef for intel extension
Also guard function prototype by VK_PROTOTYPES.
Kristian Høgsberg [Sat, 16 May 2015 05:05:09 +0000 (22:05 -0700)]
vk: Add missing VKAPI for vkQueueRemoveMemReferences
Jason Ekstrand [Sat, 16 May 2015 19:43:16 +0000 (12:43 -0700)]
Merge remote-tracking branch 'fdo-personal/wip/nir-vtn' into vulkan
This adds the SPIR-V -> NIR translator.
Jason Ekstrand [Sat, 16 May 2015 19:34:32 +0000 (12:34 -0700)]
nir/spirv: Don't assert that the current block is empty
It's possible that someone will give us SPIR-V code in which someone
needlessly branches to new blocks. We should handle that ok now.
Jason Ekstrand [Sat, 16 May 2015 19:34:15 +0000 (12:34 -0700)]
nir/spirv: Add initial support for samplers
Jason Ekstrand [Sat, 16 May 2015 19:33:29 +0000 (12:33 -0700)]
nir/spirv: Move Exp and Log to the list of currently unhandled ALU ops
NIR doesn't have the native opcodes for them anymore
Jason Ekstrand [Sat, 16 May 2015 19:32:58 +0000 (12:32 -0700)]
nir/types: Add support for sampler types
Jason Ekstrand [Wed, 6 May 2015 22:36:54 +0000 (15:36 -0700)]
nir/spirv: Make the global constants in spirv.h static
I've been promissed in a bug that this will be fixed in a future version of
the header. However, in the interest of my branch building, I'm adding
these changes in myself for the moment.
Jason Ekstrand [Wed, 6 May 2015 22:33:21 +0000 (15:33 -0700)]
nir/spirv: Handle jump-to-loop in a more general way
Jason Ekstrand [Wed, 6 May 2015 19:54:02 +0000 (12:54 -0700)]
nir/spirv: Handle boolean uniforms correctly
Jason Ekstrand [Wed, 6 May 2015 19:37:10 +0000 (12:37 -0700)]
nir/spirv: Handle control-flow with loops
Jason Ekstrand [Wed, 6 May 2015 19:36:31 +0000 (12:36 -0700)]
nir/spirv: Set a name on temporary variables
Jason Ekstrand [Wed, 6 May 2015 19:36:09 +0000 (12:36 -0700)]
nir/spirv: Use the correct length for copying string literals
Jason Ekstrand [Wed, 6 May 2015 19:35:30 +0000 (12:35 -0700)]
nir/spirv: Make vtn_ssa_value handle constants as well as ssa values
Jason Ekstrand [Mon, 4 May 2015 22:17:56 +0000 (15:17 -0700)]
nir/spirv: Add initial support for GLSL 4.50 builtins
Jason Ekstrand [Mon, 4 May 2015 19:25:09 +0000 (12:25 -0700)]
nir/spirv: Split the core datastructures into a header file
Jason Ekstrand [Mon, 4 May 2015 19:12:23 +0000 (12:12 -0700)]
nir/spirv: Use the builder for all instructions
We don't actually use it to create all the instructions but we do use it
for insertion always. This should make things far more consistent for
implementing extended instructions.
Jason Ekstrand [Mon, 4 May 2015 19:04:02 +0000 (12:04 -0700)]
nir/spirv: Add support for a bunch of ALU operations
Jason Ekstrand [Mon, 4 May 2015 19:02:57 +0000 (12:02 -0700)]
nir/spirv: Add support for indirect array accesses
Jason Ekstrand [Mon, 4 May 2015 19:02:24 +0000 (12:02 -0700)]
nir/spirv: Explicitly type constants and SSA values
Jason Ekstrand [Mon, 4 May 2015 17:23:09 +0000 (10:23 -0700)]
nir/spirv: Handle OpBranchConditional
We do control-flow handling as a two-step process. The first step is to
walk the instructions list and record various information about blocks and
functions. This is where the acutal nir_function_overload objects get
created. We also record the start/stop instruction for each block. Then
a second pass walks over each of the functions and over the blocks in each
function in a way that's NIR-friendly and actually parses the instructions.
Jason Ekstrand [Mon, 4 May 2015 17:22:52 +0000 (10:22 -0700)]
nir/spirv: Add a helper for getting a value as an SSA value
Jason Ekstrand [Fri, 1 May 2015 21:00:57 +0000 (14:00 -0700)]
nir/spirv: Split instruction handling into preamble and body sections
Jason Ekstrand [Fri, 1 May 2015 18:28:18 +0000 (11:28 -0700)]
nir/spirv: Implement load/store instructiosn
Jason Ekstrand [Mon, 4 May 2015 17:19:24 +0000 (10:19 -0700)]
nir: Add a helper for getting the tail of a deref chain
Jason Ekstrand [Fri, 1 May 2015 18:28:01 +0000 (11:28 -0700)]
nir/spirv: Actaully add variables to the funciton or shader
Jason Ekstrand [Fri, 1 May 2015 18:27:44 +0000 (11:27 -0700)]
nir/spirv: Add a vtn_untyped_value helper
Jason Ekstrand [Fri, 1 May 2015 18:27:21 +0000 (11:27 -0700)]
nir/spirv: Use vtn_value in the types code and fix a off-by-one error
Jason Ekstrand [Fri, 1 May 2015 18:26:40 +0000 (11:26 -0700)]
nir/types: Add an is_vector_or_scalar helper
Jason Ekstrand [Thu, 30 Apr 2015 03:56:36 +0000 (20:56 -0700)]
nir/spirv: Add support for deref chains
Jason Ekstrand [Thu, 30 Apr 2015 03:56:17 +0000 (20:56 -0700)]
nir/types: Add a scalar type constructor
Jason Ekstrand [Thu, 30 Apr 2015 03:19:34 +0000 (20:19 -0700)]
nir/spirv: Add support for OpLabel
Jason Ekstrand [Thu, 30 Apr 2015 03:10:20 +0000 (20:10 -0700)]
nir/spirv: Add support for declaring functions
Jason Ekstrand [Thu, 30 Apr 2015 03:09:36 +0000 (20:09 -0700)]
nir/types: Add accessors for function parameter/return types
Jason Ekstrand [Thu, 30 Apr 2015 02:37:41 +0000 (19:37 -0700)]
nir/spirv: Add support for declaring variables
Deref chains and variable load/store operations are still missing.
Jason Ekstrand [Thu, 30 Apr 2015 01:14:11 +0000 (18:14 -0700)]
nir/spirv: Add support for constants
Jason Ekstrand [Wed, 29 Apr 2015 21:36:01 +0000 (14:36 -0700)]
nir/spirv: Add basic support for types
Jason Ekstrand [Wed, 29 Apr 2015 21:28:37 +0000 (14:28 -0700)]
nir/types: Add more helpers for creating types
Jason Ekstrand [Wed, 29 Apr 2015 21:48:12 +0000 (14:48 -0700)]
glsl/types: Expose the function_param and struct_field structs to C
Previously, they were hidden behind a #ifdef __cplusplus so C wouldn't find
them. This commit simpliy moves the ifdef.
Jason Ekstrand [Wed, 25 Feb 2015 00:29:33 +0000 (16:29 -0800)]
glsl/types: Add support for function types
Jason Ekstrand [Wed, 25 Feb 2015 00:27:32 +0000 (16:27 -0800)]
glsl: Add GLSL_TYPE_FUNCTION to the base types enums
Jason Ekstrand [Wed, 29 Apr 2015 21:34:06 +0000 (14:34 -0700)]
nir/spirv: Rework the way values are added
Instead of having functions to add values and set various things, we just
have a function that does a few asserts and then returns the value. The
caller is then responsible for setting the various fields.
Jason Ekstrand [Wed, 29 Apr 2015 21:32:55 +0000 (14:32 -0700)]
nir/spirv: Add stub support for extension instructions
Jason Ekstrand [Wed, 29 Apr 2015 21:29:38 +0000 (14:29 -0700)]
REVERT: Add a simple helper program for testing SPIR-V -> NIR translation
Jason Ekstrand [Wed, 29 Apr 2015 21:30:22 +0000 (14:30 -0700)]
glsl/compiler: Move the error_no_memory stub to standalone_scaffolding.cpp
Jason Ekstrand [Wed, 29 Apr 2015 00:43:16 +0000 (17:43 -0700)]
nir: Add the start of a SPIR-V to NIR translator
At the moment, it can handle the very basics of strings and can ignore
debug instructions. It also has basic support for decorations.
Jason Ekstrand [Tue, 28 Apr 2015 04:13:44 +0000 (21:13 -0700)]
nir: Import the revision 30 SPIR-V header from Khronos
Jason Ekstrand [Sat, 16 May 2015 17:42:51 +0000 (10:42 -0700)]
vk/device: Use bias rather than layers for computing binding table size
Because we statically use the first 8 binding table entries for render
targets, we need to create a table of size 8 + surfaces.
Jason Ekstrand [Sat, 16 May 2015 17:23:43 +0000 (10:23 -0700)]
vk/meta: Make clear a no-op if no layers need clearing
Among other things, this prevents recursive meta.
Jason Ekstrand [Sat, 16 May 2015 17:28:04 +0000 (10:28 -0700)]
vk/meta: Save and restore the old bindings pointer
If we don't do this then recursive meta is completely broken. What happens
is that the outer meta call may change the bindings pointer and the inner
meta call will change it again and, when it exits set it back to the
default. However, the outer meta call may be relying on it being left
alone so it uses the non-meta descriptor sets instead of its own.
Jason Ekstrand [Sat, 16 May 2015 17:23:09 +0000 (10:23 -0700)]
vk/device: Simplify surface_count calculation
Jason Ekstrand [Sat, 16 May 2015 05:17:05 +0000 (22:17 -0700)]
vk/glsl_helpers: Fix GLSL_VK_SHADER with respect to commas
Previously, the GLSL_VK_SHADER macro didn't work if the shader contained
commas outside of parentheses due to the way the C preprocessor works.
This commit fixes this by making it variadic again and doing it correctly
this time.
Kristian Høgsberg [Sat, 16 May 2015 00:03:18 +0000 (17:03 -0700)]
vk: Make cmd_buffer->bindings a pointer
This lets us save and restore efficiently by just moving the pointer to
a temporary bindings struct for meta.
Kristian Høgsberg [Fri, 15 May 2015 23:34:31 +0000 (16:34 -0700)]
vk: Move vertex buffers into struct anv_bindings
Kristian Høgsberg [Fri, 15 May 2015 23:15:04 +0000 (16:15 -0700)]
vk: Fix GLSL_VK_SHADER macro
Stringify doesn't work with __ARGV__. The last macro argument swallows
up excess arguments and as such we can just stringify that.
Kristian Høgsberg [Fri, 15 May 2015 23:07:17 +0000 (16:07 -0700)]
vk: Fix warning from missing initializer
Struct initializers need to be { 0, } to zero out the variable they're
initializing.
Kristian Høgsberg [Fri, 15 May 2015 22:03:21 +0000 (15:03 -0700)]
vk: Build binding tables at bind descriptor time
This changes the way descriptor sets and layouts work so that we fill
out binding table contents at the time we bind descriptor sets. We
manipulate the binding table contents and sampler state in a shadow-copy
in anv_cmd_buffer. At draw time, we allocate the actual binding table
and sampler state and flush the anv_cmd_buffer copies.
Kristian Høgsberg [Fri, 15 May 2015 21:59:59 +0000 (14:59 -0700)]
vk: Update the bind map length to reflect MAX_SETS
Kristian Høgsberg [Thu, 14 May 2015 16:08:45 +0000 (09:08 -0700)]
vk: Flip back to using memfd for the allocators
Kristian Høgsberg [Wed, 13 May 2015 22:34:34 +0000 (15:34 -0700)]
vk: Rename dyn_state_pool to dynamic_state_pool
Given that we already tolerate surface_state_pool and the even longer
instruction_state_pool, there's no reason to arbitrarily abbreviate
dynamic.
Kristian Høgsberg [Wed, 13 May 2015 22:31:26 +0000 (15:31 -0700)]
vk: Consolidate image, buffer and color attachment views
These are all just surface state, offset and a bo.
Jason Ekstrand [Fri, 15 May 2015 02:07:50 +0000 (19:07 -0700)]
vk: Add a GLSL scraper utility
This new utility, glsl_scraper.py scrapes C files for instances of the
GLSL_VK_SHADER macro, pulls out the shader source, and compiles it to
SPIR-V. The compilation is done using glslValidator. The result is then
placed into another C file as arrays of dwords that can be easiliy handed
to a Vulkan driver.
Jason Ekstrand [Thu, 14 May 2015 18:58:58 +0000 (11:58 -0700)]
vk/meta: Add a magic GLSL shader source macro
Jason Ekstrand [Thu, 14 May 2015 18:39:32 +0000 (11:39 -0700)]
vk/meta: Add a better comment about the VS for blits
Jason Ekstrand [Thu, 14 May 2015 05:27:38 +0000 (22:27 -0700)]
vk/test: Use VK_IMAGE_TILING_OPTIMAL for the render target
Jason Ekstrand [Thu, 14 May 2015 05:18:37 +0000 (22:18 -0700)]
vk/test: Do a copy of the RT into a linear buffer and write that to a PNG