nir/intrinsics: Add a vulkan_resource_index intrinsic

This is used to facilitate the Vulkan binding model where each resource is
described by a (descriptor set, binding, array index) tuple.

Reviewed-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
Jason Ekstrand
2016-03-25 10:17:28 -07:00
parent 1e0012e3e4
commit c825e29a82
3 changed files with 34 additions and 0 deletions

View File

@@ -175,6 +175,26 @@ INTRINSIC(image_size, 0, ARR(0), true, 4, 1, 0, xx, xx, xx,
INTRINSIC(image_samples, 0, ARR(0), true, 1, 1, 0, xx, xx, xx,
NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
/*
* Vulkan descriptor set intrinsic
*
* The Vulkan API uses a different binding model from GL. In the Vulkan
* API, all external resources are represented by a tuple:
*
* (descriptor set, binding, array index)
*
* where the array index is the only thing allowed to be indirect. The
* vulkan_surface_index intrinsic takes the descriptor set and binding as
* its first two indices and the array index as its source. The third
* index is a nir_variable_mode in case that's useful to the backend.
*
* The intended usage is that the shader will call vulkan_surface_index to
* get an index and then pass that as the buffer index ubo/ssbo calls.
*/
INTRINSIC(vulkan_resource_index, 1, ARR(1), true, 1, 0, 2,
DESC_SET, BINDING, xx,
NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
/*
* variable atomic intrinsics
*