nir/vtn: add support for SpvBuiltInGlobalLinearId
[mesa.git] / src / compiler / nir / nir_intrinsics.py
index ac8a67f44bb9fb69b2711596c51c8bee49087fa1..1ae453f757d8d15003736978ce68085a344ef271 100644 (file)
@@ -31,8 +31,8 @@ class Intrinsic(object):
    """Class that represents all the information about an intrinsic opcode.
    NOTE: this must be kept in sync with nir_intrinsic_info.
    """
-   def __init__(self, name, src_components, dest_components, num_variables,
-                indices, flags, sysval):
+   def __init__(self, name, src_components, dest_components,
+                indices, flags, sysval, bit_sizes):
        """Parameters:
 
        - name: the intrinsic name
@@ -42,17 +42,16 @@ class Intrinsic(object):
        - dest_components: number of destination components, -1 means no
          dest, 0 means number of components given in num_components field
          in nir_intrinsic_instr.
-       - num_variables: the number of variables
        - indices: list of constant indicies
        - flags: list of semantic flags
        - sysval: is this a system-value intrinsic
+       - bit_sizes: allowed dest bit_sizes
        """
        assert isinstance(name, str)
        assert isinstance(src_components, list)
        if src_components:
            assert isinstance(src_components[0], int)
        assert isinstance(dest_components, int)
-       assert isinstance(num_variables, int)
        assert isinstance(indices, list)
        if indices:
            assert isinstance(indices[0], str)
@@ -60,17 +59,19 @@ class Intrinsic(object):
        if flags:
            assert isinstance(flags[0], str)
        assert isinstance(sysval, bool)
+       if bit_sizes:
+           assert isinstance(bit_sizes[0], int)
 
        self.name = name
        self.num_srcs = len(src_components)
        self.src_components = src_components
        self.has_dest = (dest_components >= 0)
        self.dest_components = dest_components
-       self.num_variables = num_variables
        self.num_indices = len(indices)
        self.indices = indices
        self.flags = flags
        self.sysval = sysval
+       self.bit_sizes = bit_sizes
 
 #
 # Possible indices:
@@ -102,6 +103,21 @@ INTERP_MODE = "NIR_INTRINSIC_INTERP_MODE"
 REDUCTION_OP = "NIR_INTRINSIC_REDUCTION_OP"
 # Cluster size for reduction operations
 CLUSTER_SIZE = "NIR_INTRINSIC_CLUSTER_SIZE"
+# Parameter index for a load_param intrinsic
+PARAM_IDX = "NIR_INTRINSIC_PARAM_IDX"
+# Image dimensionality for image intrinsics
+IMAGE_DIM = "NIR_INTRINSIC_IMAGE_DIM"
+# Non-zero if we are accessing an array image
+IMAGE_ARRAY = "NIR_INTRINSIC_IMAGE_ARRAY"
+# Access qualifiers for image and memory access intrinsics
+ACCESS = "NIR_INTRINSIC_ACCESS"
+# Image format for image intrinsics
+FORMAT = "NIR_INTRINSIC_FORMAT"
+# Offset or address alignment
+ALIGN_MUL = "NIR_INTRINSIC_ALIGN_MUL"
+ALIGN_OFFSET = "NIR_INTRINSIC_ALIGN_OFFSET"
+# The vulkan descriptor type for vulkan_resource_index
+DESC_TYPE = "NIR_INTRINSIC_DESC_TYPE"
 
 #
 # Possible flags:
@@ -112,34 +128,37 @@ CAN_REORDER   = "NIR_INTRINSIC_CAN_REORDER"
 
 INTR_OPCODES = {}
 
-def intrinsic(name, src_comp=[], dest_comp=-1, num_vars=0, indices=[],
-              flags=[], sysval=False):
+def intrinsic(name, src_comp=[], dest_comp=-1, indices=[],
+              flags=[], sysval=False, bit_sizes=[]):
     assert name not in INTR_OPCODES
-    INTR_OPCODES[name] = Intrinsic(name, src_comp, dest_comp, num_vars,
-                                   indices, flags, sysval)
+    INTR_OPCODES[name] = Intrinsic(name, src_comp, dest_comp,
+                                   indices, flags, sysval, bit_sizes)
 
 intrinsic("nop", flags=[CAN_ELIMINATE])
 
-intrinsic("load_var", dest_comp=0, num_vars=1, flags=[CAN_ELIMINATE])
-intrinsic("store_var", src_comp=[0], num_vars=1, indices=[WRMASK])
-intrinsic("copy_var", num_vars=2)
+intrinsic("load_param", dest_comp=0, indices=[PARAM_IDX], flags=[CAN_ELIMINATE])
 
-# Interpolation of input.  The interp_var_at* intrinsics are similar to the
-# load_var intrinsic acting on a shader input except that they interpolate
-# the input differently.  The at_sample and at_offset intrinsics take an
+intrinsic("load_deref", dest_comp=0, src_comp=[-1],
+          indices=[ACCESS], flags=[CAN_ELIMINATE])
+intrinsic("store_deref", src_comp=[-1, 0], indices=[WRMASK, ACCESS])
+intrinsic("copy_deref", src_comp=[-1, -1])
+
+# Interpolation of input.  The interp_deref_at* intrinsics are similar to the
+# load_var intrinsic acting on a shader input except that they interpolate the
+# input differently.  The at_sample and at_offset intrinsics take an
 # additional source that is an integer sample id or a vec2 position offset
 # respectively.
 
-intrinsic("interp_var_at_centroid", dest_comp=0, num_vars=1,
+intrinsic("interp_deref_at_centroid", dest_comp=0, src_comp=[1],
           flags=[ CAN_ELIMINATE, CAN_REORDER])
-intrinsic("interp_var_at_sample", src_comp=[1], dest_comp=0, num_vars=1,
+intrinsic("interp_deref_at_sample", src_comp=[1, 1], dest_comp=0,
           flags=[CAN_ELIMINATE, CAN_REORDER])
-intrinsic("interp_var_at_offset", src_comp=[2], dest_comp=0, num_vars=1,
+intrinsic("interp_deref_at_offset", src_comp=[1, 2], dest_comp=0,
           flags=[CAN_ELIMINATE, CAN_REORDER])
 
 # Ask the driver for the size of a given buffer. It takes the buffer index
 # as source.
-intrinsic("get_buffer_size", src_comp=[1], dest_comp=1,
+intrinsic("get_buffer_size", src_comp=[-1], dest_comp=1,
           flags=[CAN_ELIMINATE, CAN_REORDER])
 
 # a barrier is an intrinsic with no inputs/outputs but which can't be moved
@@ -257,19 +276,20 @@ intrinsic("set_vertex_count", src_comp=[1])
 # lowered, variants take a constant buffer index and register offset.
 
 def atomic(name, flags=[]):
-    intrinsic(name + "_var", dest_comp=1, num_vars=1, flags=flags)
+    intrinsic(name + "_deref", src_comp=[-1], dest_comp=1, flags=flags)
     intrinsic(name, src_comp=[1], dest_comp=1, indices=[BASE], flags=flags)
 
 def atomic2(name):
-    intrinsic(name + "_var", src_comp=[1], dest_comp=1, num_vars=1)
+    intrinsic(name + "_deref", src_comp=[-1, 1], dest_comp=1)
     intrinsic(name, src_comp=[1, 1], dest_comp=1, indices=[BASE])
 
 def atomic3(name):
-    intrinsic(name + "_var", src_comp=[1, 1], dest_comp=1, num_vars=1)
+    intrinsic(name + "_deref", src_comp=[-1, 1, 1], dest_comp=1)
     intrinsic(name, src_comp=[1, 1, 1], dest_comp=1, indices=[BASE])
 
 atomic("atomic_counter_inc")
-atomic("atomic_counter_dec")
+atomic("atomic_counter_pre_dec")
+atomic("atomic_counter_post_dec")
 atomic("atomic_counter_read", flags=[CAN_ELIMINATE])
 atomic2("atomic_counter_add")
 atomic2("atomic_counter_min")
@@ -282,30 +302,47 @@ atomic3("atomic_counter_comp_swap")
 
 # Image load, store and atomic intrinsics.
 #
-# All image intrinsics take an image target passed as a nir_variable.  Image
-# variables contain a number of memory and layout qualifiers that influence
-# the semantics of the intrinsic.
+# All image intrinsics come in two versions.  One which take an image target
+# passed as a deref chain as the first source and one which takes an index or
+# handle as the first source.  In the first version, the image variable
+# contains the memory and layout qualifiers that influence the semantics of
+# the intrinsic.  In the second, the image format and access qualifiers are
+# provided as constant indices.
 #
 # All image intrinsics take a four-coordinate vector and a sample index as
-# first two sources, determining the location within the image that will be
+# 2nd and 3rd sources, determining the location within the image that will be
 # accessed by the intrinsic.  Components not applicable to the image target
 # in use are undefined.  Image store takes an additional four-component
 # argument with the value to be written, and image atomic operations take
 # either one or two additional scalar arguments with the same meaning as in
 # the ARB_shader_image_load_store specification.
-intrinsic("image_var_load", src_comp=[4, 1], dest_comp=4, num_vars=1,
-          flags=[CAN_ELIMINATE])
-intrinsic("image_var_store", src_comp=[4, 1, 4], num_vars=1)
-intrinsic("image_var_atomic_add",  src_comp=[4, 1, 1], dest_comp=1, num_vars=1)
-intrinsic("image_var_atomic_min",  src_comp=[4, 1, 1], dest_comp=1, num_vars=1)
-intrinsic("image_var_atomic_max",  src_comp=[4, 1, 1], dest_comp=1, num_vars=1)
-intrinsic("image_var_atomic_and",  src_comp=[4, 1, 1], dest_comp=1, num_vars=1)
-intrinsic("image_var_atomic_or",   src_comp=[4, 1, 1], dest_comp=1, num_vars=1)
-intrinsic("image_var_atomic_xor",  src_comp=[4, 1, 1], dest_comp=1, num_vars=1)
-intrinsic("image_var_atomic_exchange",  src_comp=[4, 1, 1], dest_comp=1, num_vars=1)
-intrinsic("image_var_atomic_comp_swap", src_comp=[4, 1, 1, 1], dest_comp=1, num_vars=1)
-intrinsic("image_var_size",    dest_comp=0, num_vars=1, flags=[CAN_ELIMINATE, CAN_REORDER])
-intrinsic("image_var_samples", dest_comp=1, num_vars=1, flags=[CAN_ELIMINATE, CAN_REORDER])
+def image(name, src_comp=[], **kwargs):
+    intrinsic("image_deref_" + name, src_comp=[1] + src_comp, **kwargs)
+    intrinsic("image_" + name, src_comp=[1] + src_comp,
+              indices=[IMAGE_DIM, IMAGE_ARRAY, FORMAT, ACCESS], **kwargs)
+
+image("load", src_comp=[4, 1], dest_comp=0, flags=[CAN_ELIMINATE])
+image("store", src_comp=[4, 1, 0])
+image("atomic_add",  src_comp=[4, 1, 1], dest_comp=1)
+image("atomic_min",  src_comp=[4, 1, 1], dest_comp=1)
+image("atomic_max",  src_comp=[4, 1, 1], dest_comp=1)
+image("atomic_and",  src_comp=[4, 1, 1], dest_comp=1)
+image("atomic_or",   src_comp=[4, 1, 1], dest_comp=1)
+image("atomic_xor",  src_comp=[4, 1, 1], dest_comp=1)
+image("atomic_exchange",  src_comp=[4, 1, 1], dest_comp=1)
+image("atomic_comp_swap", src_comp=[4, 1, 1, 1], dest_comp=1)
+image("atomic_fadd",  src_comp=[1, 4, 1, 1], dest_comp=1)
+image("size",    dest_comp=0, flags=[CAN_ELIMINATE, CAN_REORDER])
+image("samples", dest_comp=1, flags=[CAN_ELIMINATE, CAN_REORDER])
+
+# Intel-specific query for loading from the brw_image_param struct passed
+# into the shader as a uniform.  The variable is a deref to the image
+# variable. The const index specifies which of the six parameters to load.
+intrinsic("image_deref_load_param_intel", src_comp=[1], dest_comp=0,
+          indices=[BASE], flags=[CAN_ELIMINATE, CAN_REORDER])
+image("load_raw_intel", src_comp=[1], dest_comp=0,
+      flags=[CAN_ELIMINATE])
+image("store_raw_intel", src_comp=[1, 0])
 
 # Vulkan descriptor set intrinsics
 #
@@ -326,10 +363,13 @@ intrinsic("image_var_samples", dest_comp=1, num_vars=1, flags=[CAN_ELIMINATE, CA
 # (the result of a vulkan_resource_index or vulkan_resource_reindex) which
 # corresponds to the tuple (set, binding, index) and computes an index
 # corresponding to tuple (set, binding, idx + src1).
-intrinsic("vulkan_resource_index", src_comp=[1], dest_comp=1,
-          indices=[DESC_SET, BINDING], flags=[CAN_ELIMINATE, CAN_REORDER])
-intrinsic("vulkan_resource_reindex", src_comp=[1, 1], dest_comp=1,
+intrinsic("vulkan_resource_index", src_comp=[1], dest_comp=0,
+          indices=[DESC_SET, BINDING, DESC_TYPE],
           flags=[CAN_ELIMINATE, CAN_REORDER])
+intrinsic("vulkan_resource_reindex", src_comp=[0, 1], dest_comp=0,
+          indices=[DESC_TYPE], flags=[CAN_ELIMINATE, CAN_REORDER])
+intrinsic("load_vulkan_descriptor", src_comp=[-1], dest_comp=0,
+          indices=[DESC_TYPE], flags=[CAN_ELIMINATE, CAN_REORDER])
 
 # variable atomic intrinsics
 #
@@ -337,24 +377,27 @@ intrinsic("vulkan_resource_reindex", src_comp=[1, 1], dest_comp=1,
 # compute a new value using one of the operations below, write the new value
 # to memory, and return the original value read.
 #
-# All operations take 1 source except CompSwap that takes 2. These sources
+# All operations take 2 sources except CompSwap that takes 3. These sources
 # represent:
 #
-# 0: The data parameter to the atomic function (i.e. the value to add
+# 0: A deref to the memory on which to perform the atomic
+# 1: The data parameter to the atomic function (i.e. the value to add
 #    in shared_atomic_add, etc).
-# 1: For CompSwap only: the second data parameter.
-#
-# All operations take 1 variable deref.
-intrinsic("var_atomic_add",  src_comp=[1], dest_comp=1, num_vars=1)
-intrinsic("var_atomic_imin", src_comp=[1], dest_comp=1, num_vars=1)
-intrinsic("var_atomic_umin", src_comp=[1], dest_comp=1, num_vars=1)
-intrinsic("var_atomic_imax", src_comp=[1], dest_comp=1, num_vars=1)
-intrinsic("var_atomic_umax", src_comp=[1], dest_comp=1, num_vars=1)
-intrinsic("var_atomic_and",  src_comp=[1], dest_comp=1, num_vars=1)
-intrinsic("var_atomic_or",   src_comp=[1], dest_comp=1, num_vars=1)
-intrinsic("var_atomic_xor",  src_comp=[1], dest_comp=1, num_vars=1)
-intrinsic("var_atomic_exchange", src_comp=[1], dest_comp=1, num_vars=1)
-intrinsic("var_atomic_comp_swap", src_comp=[1, 1], dest_comp=1, num_vars=1)
+# 2: For CompSwap only: the second data parameter.
+intrinsic("deref_atomic_add",  src_comp=[-1, 1], dest_comp=1)
+intrinsic("deref_atomic_imin", src_comp=[-1, 1], dest_comp=1)
+intrinsic("deref_atomic_umin", src_comp=[-1, 1], dest_comp=1)
+intrinsic("deref_atomic_imax", src_comp=[-1, 1], dest_comp=1)
+intrinsic("deref_atomic_umax", src_comp=[-1, 1], dest_comp=1)
+intrinsic("deref_atomic_and",  src_comp=[-1, 1], dest_comp=1)
+intrinsic("deref_atomic_or",   src_comp=[-1, 1], dest_comp=1)
+intrinsic("deref_atomic_xor",  src_comp=[-1, 1], dest_comp=1)
+intrinsic("deref_atomic_exchange", src_comp=[-1, 1], dest_comp=1)
+intrinsic("deref_atomic_comp_swap", src_comp=[-1, 1, 1], dest_comp=1)
+intrinsic("deref_atomic_fadd",  src_comp=[-1, 1], dest_comp=1)
+intrinsic("deref_atomic_fmin",  src_comp=[-1, 1], dest_comp=1)
+intrinsic("deref_atomic_fmax",  src_comp=[-1, 1], dest_comp=1)
+intrinsic("deref_atomic_fcomp_swap", src_comp=[-1, 1, 1], dest_comp=1)
 
 # SSBO atomic intrinsics
 #
@@ -381,6 +424,10 @@ intrinsic("ssbo_atomic_or",   src_comp=[1, 1, 1], dest_comp=1)
 intrinsic("ssbo_atomic_xor",  src_comp=[1, 1, 1], dest_comp=1)
 intrinsic("ssbo_atomic_exchange", src_comp=[1, 1, 1], dest_comp=1)
 intrinsic("ssbo_atomic_comp_swap", src_comp=[1, 1, 1, 1], dest_comp=1)
+intrinsic("ssbo_atomic_fadd", src_comp=[1, 1, 1], dest_comp=1)
+intrinsic("ssbo_atomic_fmin", src_comp=[1, 1, 1], dest_comp=1)
+intrinsic("ssbo_atomic_fmax", src_comp=[1, 1, 1], dest_comp=1)
+intrinsic("ssbo_atomic_fcomp_swap", src_comp=[1, 1, 1, 1], dest_comp=1)
 
 # CS shared variable atomic intrinsics
 #
@@ -406,13 +453,46 @@ intrinsic("shared_atomic_or",   src_comp=[1, 1], dest_comp=1, indices=[BASE])
 intrinsic("shared_atomic_xor",  src_comp=[1, 1], dest_comp=1, indices=[BASE])
 intrinsic("shared_atomic_exchange", src_comp=[1, 1], dest_comp=1, indices=[BASE])
 intrinsic("shared_atomic_comp_swap", src_comp=[1, 1, 1], dest_comp=1, indices=[BASE])
+intrinsic("shared_atomic_fadd",  src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("shared_atomic_fmin",  src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("shared_atomic_fmax",  src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("shared_atomic_fcomp_swap", src_comp=[1, 1, 1], dest_comp=1, indices=[BASE])
 
-def system_value(name, dest_comp, indices=[]):
-    intrinsic("load_" + name, [], dest_comp, 0, indices,
-              flags=[CAN_ELIMINATE, CAN_REORDER], sysval=True)
+# Global atomic intrinsics
+#
+# All of the shared variable atomic memory operations read a value from
+# memory, compute a new value using one of the operations below, write the
+# new value to memory, and return the original value read.
+#
+# All operations take 2 sources except CompSwap that takes 3. These
+# sources represent:
+#
+# 0: The memory address that the atomic operation will operate on.
+# 1: The data parameter to the atomic function (i.e. the value to add
+#    in shared_atomic_add, etc).
+# 2: For CompSwap only: the second data parameter.
+intrinsic("global_atomic_add",  src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_imin", src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_umin", src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_imax", src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_umax", src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_and",  src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_or",   src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_xor",  src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_exchange", src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_comp_swap", src_comp=[1, 1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_fadd",  src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_fmin",  src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_fmax",  src_comp=[1, 1], dest_comp=1, indices=[BASE])
+intrinsic("global_atomic_fcomp_swap", src_comp=[1, 1, 1], dest_comp=1, indices=[BASE])
+
+def system_value(name, dest_comp, indices=[], bit_sizes=[32]):
+    intrinsic("load_" + name, [], dest_comp, indices,
+              flags=[CAN_ELIMINATE, CAN_REORDER], sysval=True,
+              bit_sizes=bit_sizes)
 
 system_value("frag_coord", 4)
-system_value("front_face", 1)
+system_value("front_face", 1, bit_sizes=[1, 32])
 system_value("vertex_id", 1)
 system_value("vertex_id_zero_base", 1)
 system_value("first_vertex", 1)
@@ -422,6 +502,9 @@ system_value("instance_id", 1)
 system_value("base_instance", 1)
 system_value("draw_id", 1)
 system_value("sample_id", 1)
+# sample_id_no_per_sample is like sample_id but does not imply per-
+# sample shading.  See the lower_helper_invocation option.
+system_value("sample_id_no_per_sample", 1)
 system_value("sample_pos", 2)
 system_value("sample_mask_in", 1)
 system_value("primitive_id", 1)
@@ -435,20 +518,32 @@ system_value("local_invocation_index", 1)
 system_value("work_group_id", 3)
 system_value("user_clip_plane", 4, indices=[UCP_ID])
 system_value("num_work_groups", 3)
-system_value("helper_invocation", 1)
+system_value("helper_invocation", 1, bit_sizes=[1, 32])
 system_value("alpha_ref_float", 1)
 system_value("layer_id", 1)
 system_value("view_index", 1)
 system_value("subgroup_size", 1)
 system_value("subgroup_invocation", 1)
-system_value("subgroup_eq_mask", 0)
-system_value("subgroup_ge_mask", 0)
-system_value("subgroup_gt_mask", 0)
-system_value("subgroup_le_mask", 0)
-system_value("subgroup_lt_mask", 0)
+system_value("subgroup_eq_mask", 0, bit_sizes=[32, 64])
+system_value("subgroup_ge_mask", 0, bit_sizes=[32, 64])
+system_value("subgroup_gt_mask", 0, bit_sizes=[32, 64])
+system_value("subgroup_le_mask", 0, bit_sizes=[32, 64])
+system_value("subgroup_lt_mask", 0, bit_sizes=[32, 64])
 system_value("num_subgroups", 1)
 system_value("subgroup_id", 1)
 system_value("local_group_size", 3)
+system_value("global_invocation_id", 3, bit_sizes=[32, 64])
+system_value("global_invocation_index", 1, bit_sizes=[32, 64])
+system_value("work_dim", 1)
+# Driver-specific viewport scale/offset parameters.
+#
+# VC4 and V3D need to emit a scaled version of the position in the vertex
+# shaders for binning, and having system values lets us move the math for that
+# into NIR.
+system_value("viewport_x_scale", 1)
+system_value("viewport_y_scale", 1)
+system_value("viewport_z_scale", 1)
+system_value("viewport_z_offset", 1)
 
 # Blend constant color values.  Float values are clamped.#
 system_value("blend_const_color_r_float", 1)
@@ -510,8 +605,8 @@ def load(name, num_srcs, indices=[], flags=[]):
 
 # src[] = { offset }. const_index[] = { base, range }
 load("uniform", 1, [BASE, RANGE], [CAN_ELIMINATE, CAN_REORDER])
-# src[] = { buffer_index, offset }. No const_index
-load("ubo", 2, flags=[CAN_ELIMINATE, CAN_REORDER])
+# src[] = { buffer_index, offset }. const_index[] = { align_mul, align_offset }
+load("ubo", 2, [ALIGN_MUL, ALIGN_OFFSET], flags=[CAN_ELIMINATE, CAN_REORDER])
 # src[] = { offset }. const_index[] = { base, component }
 load("input", 1, [BASE, COMPONENT], [CAN_ELIMINATE, CAN_REORDER])
 # src[] = { vertex, offset }. const_index[] = { base, component }
@@ -520,16 +615,22 @@ load("per_vertex_input", 2, [BASE, COMPONENT], [CAN_ELIMINATE, CAN_REORDER])
 intrinsic("load_interpolated_input", src_comp=[2, 1], dest_comp=0,
           indices=[BASE, COMPONENT], flags=[CAN_ELIMINATE, CAN_REORDER])
 
-# src[] = { buffer_index, offset }. No const_index
-load("ssbo", 2, flags=[CAN_ELIMINATE])
+# src[] = { buffer_index, offset }.
+# const_index[] = { access, align_mul, align_offset }
+load("ssbo", 2, [ACCESS, ALIGN_MUL, ALIGN_OFFSET], [CAN_ELIMINATE])
 # src[] = { offset }. const_index[] = { base, component }
 load("output", 1, [BASE, COMPONENT], flags=[CAN_ELIMINATE])
 # src[] = { vertex, offset }. const_index[] = { base }
 load("per_vertex_output", 2, [BASE, COMPONENT], [CAN_ELIMINATE])
-# src[] = { offset }. const_index[] = { base }
-load("shared", 1, [BASE], [CAN_ELIMINATE])
+# src[] = { offset }. const_index[] = { base, align_mul, align_offset }
+load("shared", 1, [BASE, ALIGN_MUL, ALIGN_OFFSET], [CAN_ELIMINATE])
 # src[] = { offset }. const_index[] = { base, range }
 load("push_constant", 1, [BASE, RANGE], [CAN_ELIMINATE, CAN_REORDER])
+# src[] = { offset }. const_index[] = { base, range }
+load("constant", 1, [BASE, RANGE], [CAN_ELIMINATE, CAN_REORDER])
+# src[] = { address }.
+# const_index[] = { access, align_mul, align_offset }
+load("global", 1, [ACCESS, ALIGN_MUL, ALIGN_OFFSET], [CAN_ELIMINATE])
 
 # Stores work the same way as loads, except now the first source is the value
 # to store and the second (and possibly third) source specify where to store
@@ -544,7 +645,12 @@ store("output", 2, [BASE, WRMASK, COMPONENT])
 # src[] = { value, vertex, offset }.
 # const_index[] = { base, write_mask, component }
 store("per_vertex_output", 3, [BASE, WRMASK, COMPONENT])
-# src[] = { value, block_index, offset }. const_index[] = { write_mask }
-store("ssbo", 3, [WRMASK])
-# src[] = { value, offset }. const_index[] = { base, write_mask }
-store("shared", 2, [BASE, WRMASK])
+# src[] = { value, block_index, offset }
+# const_index[] = { write_mask, access, align_mul, align_offset }
+store("ssbo", 3, [WRMASK, ACCESS, ALIGN_MUL, ALIGN_OFFSET])
+# src[] = { value, offset }.
+# const_index[] = { base, write_mask, align_mul, align_offset }
+store("shared", 2, [BASE, WRMASK, ALIGN_MUL, ALIGN_OFFSET])
+# src[] = { value, address }.
+# const_index[] = { write_mask, align_mul, align_offset }
+store("global", 2, [WRMASK, ACCESS, ALIGN_MUL, ALIGN_OFFSET])