nir/spirv: Compute offsets for UBOs and SSBOs up-front

Now that we have a pointer wrapper class, we can create offsets for UBOs
and SSBOs up-front instead of waiting until we have the full access
chain.  For push constants, we still use the old mechanism because it
provides us with some nice range information.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
This commit is contained in:
Jason Ekstrand
2017-06-29 10:33:34 -07:00
committed by Jason Ekstrand
parent 604eda3712
commit 62ebca1fe6
2 changed files with 138 additions and 27 deletions

View File

@@ -284,14 +284,23 @@ struct vtn_pointer {
/** The dereferenced type of this pointer */
struct vtn_type *type;
/** The referenced variable */
/** The referenced variable, if known
*
* This field may be NULL if the pointer uses a (block_index, offset) pair
* instead of an access chain.
*/
struct vtn_variable *var;
/** An access chain describing how to get from var to the referenced data
*
* This field may be NULL if the pointer references the entire variable.
* This field may be NULL if the pointer references the entire variable or
* if a (block_index, offset) pair is used instead of an access chain.
*/
struct vtn_access_chain *chain;
/** A (block_index, offset) pair representing a UBO or SSBO position. */
struct nir_ssa_def *block_index;
struct nir_ssa_def *offset;
};
struct vtn_variable {