Skip to content
  1. Nov 30, 2018
    • Faith Ekstrand's avatar
      STUFF · 8c5f8990
      Faith Ekstrand authored
      8c5f8990
    • Faith Ekstrand's avatar
      9a6088de
    • Faith Ekstrand's avatar
      SPIR-V HACKS · 5a1c1c50
      Faith Ekstrand authored
      5a1c1c50
    • Faith Ekstrand's avatar
      HACK · 6a78a411
      Faith Ekstrand authored
      6a78a411
    • Faith Ekstrand's avatar
      spirv: Add explicit pointer types · c34dc0dd
      Faith Ekstrand authored
      Instead of baking in uvec2 for UBO and SSBO pointers and uint for push
      constant and shared memory pointers, make it configurable.
      c34dc0dd
    • Faith Ekstrand's avatar
      nir/lower_io: Add "explicit" IO lowering · d632cd3d
      Faith Ekstrand authored
      This new pass is for lowering explicitly laid out memory coming in from
      SPIR-V or a similar source.  It's quite a bit more complicated than the
      normal lower_io because we have to be able to handle matrices.  The
      way the stride information is stored for matrices is awkward and dealing
      with row-major matrices is especially painful.
      d632cd3d
    • Faith Ekstrand's avatar
      bf34b824
    • Faith Ekstrand's avatar
      nir: Add a ptr_as_array deref type · 07b62bbf
      Faith Ekstrand authored
      07b62bbf
    • Faith Ekstrand's avatar
      nir: Handle casts in nir_remove_dead_variables · 111e5d37
      Faith Ekstrand authored
      We already detect any incomplete deref chains (where the deref is used
      for something other than another deref or a load/store) and flag the
      variable as used thanks to deref_used_for_not_store.  All that's left to
      do is to properly skip casts when cleaning up.
      111e5d37
    • Faith Ekstrand's avatar
      nir: Skip over casts in fixup_deref_modes · 92169f88
      Faith Ekstrand authored
      92169f88
    • Faith Ekstrand's avatar
      nir/deref: Support casts in comparisons · decf05be
      Faith Ekstrand authored
      The code which constructs deref paths already gives you the path
      starting at the nearest deref_cast or deref_var.  All we need to do is
      handle the case where the start of the path isn't a deref_var.
      decf05be
    • Faith Ekstrand's avatar
      nir: Allow intrinsic deref sources to consume anything · bf1ce1f2
      Faith Ekstrand authored
      This commit adds a new num_components value for intrinsic sources of -1
      which means that it consumes everything and the number of components
      effectively isn't validated.  This is useful for deref sources which
      just take the result of the deref and we leave it up to the driver to
      decide what that size should be.
      bf1ce1f2
    • Faith Ekstrand's avatar
    • Alejandro Piñeiro's avatar
      spirv/nir: fill glsl_type array stride · 98bbe576
      Alejandro Piñeiro authored and Faith Ekstrand's avatar Faith Ekstrand committed
      We need all the info when asking for the type, so we needed to call
      type_decoration_cb earlier, in order to get the ArrayStride.
      
      It is somewhat ugly to do this only for Array types, but we can't do
      it before the switch as type_decoration_cb have some asserts to ensure
      that the type and the decoration are compatible.
      
      One alternative would be keep the call to type_decoration_cb at the
      end, but create the glsl type for Arrays at the end, after calling
      it. Again we are treating Arrays in a different way.
      
      A full alternative to treat all types in the same way would be have a
      first switch(opcode) that would fill the base_type, call
      type_decoration_cb, and then a new switch(opcode) that would fill
      extra data and create the glsl_type. That looks like an overkill
      though.
      98bbe576
    • Alejandro Piñeiro's avatar
      glsl_types/nir: add explicit_array_stride plus nir wrapper helpers · b0e4f4c8
      Alejandro Piñeiro authored and Faith Ekstrand's avatar Faith Ekstrand committed
      >From ARB_gl_spirv:
          "Mapping of layouts
      
            std140/std430  ->  explicit *Offset*, *ArrayStride*, and *MatrixStride*
                               Decoration on struct members"
      
      That means that we would not have available any kind of layout info,
      and we should use explicit array strides.
      
      This commit adds explicit_array_stride. The default value is -1
      meaning that it is not set (as with offset). That should be the
      default value for GLSL.
      
      In general, the default constructor is ok. We just need to be careful
      with some array lowerings, as it should try to get the explicit array
      stride when creating new types.
      
      Note that this means that for the ARB_gl_spirv case
      std430_array_stride, std140_size etc are meaningless (unless you guess
      the layout, something that you shouldn't).
      
      v2: add missing glsl_full_array_type call, found while testing
          ARB_gl_spirv with borrowed tests (Alejandro)
      b0e4f4c8
    • Alejandro Piñeiro's avatar
      spirv/nir: fill glsl_struct_field explicit_matrix_stride · 1932e09b
      Alejandro Piñeiro authored and Faith Ekstrand's avatar Faith Ekstrand committed
      1932e09b
    • Alejandro Piñeiro's avatar
      glsl_types/nir: add matrix_stride plus nir wrapper helpers · 655f2004
      Alejandro Piñeiro authored and Faith Ekstrand's avatar Faith Ekstrand committed
      >From ARB_gl_spirv spec:
      
          "7.6.2.spv SPIR-V Uniform Offsets and Strides
      
          The SPIR-V decorations *GLSLShared* or *GLSLPacked* must not be
          used. A variable in the *Uniform* Storage Class decorated as a
          *Block* must be explicitly laid out using the *Offset*,
          *ArrayStride*, and *MatrixStride* decorations. If the variable is
          decorated as a *BufferBlock*, its offsets and strides must not
          contradict std430 alignment and minimum offset requirements.
          Otherwise, its offsets and strides must not contradict std140
          alignment and minimum offset requirements.
      
      >From that paragraph, the first conclusion is that we can rely on the
      content of the SPIR-V in order to compute the buffer sizes, as they
      are mandatory. That would make the buffer size computation easier. The
      second conclusion, from the last sentence, is that *we need* to do
      that. As if just needs to not contradict alignments and minimum
      offsets, providing a matrix stride of 16 when 8 is enough would be
      valid.
      
      This explicit matrix_stride is assumed to only be used on
      ARB_gl_spirv. On GLSL there is no way to set it, and it is internally
      handled and computed.
      655f2004
    • Alejandro Piñeiro's avatar
      nir/types: add three new wrapper helpers · 0c802b85
      Alejandro Piñeiro authored and Faith Ekstrand's avatar Faith Ekstrand committed
      To already existing fields on glsl_types. Specifically:
         * glsl_get_struct_field_offset
         * glsl_get_struct_field_matrix_layout
         * glsl_type_arrays_of_arrays_size
      0c802b85
    • Faith Ekstrand's avatar
      spirv: Emit NIR deref instructions on-the-fly · c38537ab
      Faith Ekstrand authored
      This simplifies our deref handling by emitting the actual NIR deref
      instructions on-the-fly instead of of building up a deref chain and then
      emitting them at the last moment.  In order for this to work with the
      parts of the compiler that assume they can chase deref chains, we have
      to run nir_rematerialize_derefs_in_use_blocks_impl to put the derefs
      back in the right places in cases like loops where dominance may not
      quite work out the way SPIR-V thinks it does.
      c38537ab
  2. Nov 29, 2018
Loading