summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-11-30 15:56:39 -0800
committerJason Ekstrand <[email protected]>2017-12-05 22:01:54 -0800
commitcfb81f58a0c3f5f8dfde3d0783ff5211b657f895 (patch)
tree0c6a41593578f0c3e81fd4c0fffa45cb4a281c29
parentae54a4f84fb6b440d7a8a57651965a4d9eed725b (diff)
nir: Add a vulkan_resource_reindex intrinsic
This is required for being able to handle OpPtrAccessChain in SPIR-V where the base type of the incoming pointer requires us to add to the block index instead of the byte offset. Reviewed-by: Kristian H. Kristensen <[email protected]>
-rw-r--r--src/compiler/nir/nir_intrinsics.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_intrinsics.h b/src/compiler/nir/nir_intrinsics.h
index 20bef339ac4..ccf8e06336c 100644
--- a/src/compiler/nir/nir_intrinsics.h
+++ b/src/compiler/nir/nir_intrinsics.h
@@ -210,7 +210,7 @@ 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
+ * Vulkan descriptor set intrinsics
*
* The Vulkan API uses a different binding model from GL. In the Vulkan
* API, all external resources are represented by a tuple:
@@ -224,10 +224,17 @@ INTRINSIC(image_samples, 0, ARR(0), true, 1, 1, 0, xx, xx, xx,
*
* 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.
+ *
+ * The vulkan_resource_reindex intrinsic takes a resource index in src0
+ * (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, 1, ARR(1), true, 1, 0, 2,
DESC_SET, BINDING, xx,
NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
+INTRINSIC(vulkan_resource_reindex, 2, ARR(1, 1), true, 1, 0, 0, xx, xx, xx,
+ NIR_INTRINSIC_CAN_ELIMINATE | NIR_INTRINSIC_CAN_REORDER)
/*
* variable atomic intrinsics