upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/vk_bindless_test.cpp
diff options
context:
space:
mode:
authorS1m0ne1997 <347981799+S1m0ne1997@users.noreply.github.com>2026-11-22 00:51:57 +0100
committerS1m0ne1997 <347981799+S1m0ne1997@users.noreply.github.com>2026-11-22 11:59:04 +0100
commit07bd05fa95c2c47be1d1f0b671fb5e484b23a904 (patch)
tree0021b22b12f60c13dc7ee98e247cbcdea7bd7101 /runtime/test/vk_bindless_test.cpp
parentc2967a5e60060e4068fb992196d8f4b494a5046c (diff)
Translator: zero-based VS v0/v3 (VertexIndex - BaseVertex, InstanceIndex - BaseInstance); VS is legacy, not NGG (SHADER-33)
Corpus (scripts/vs_input_survey.py, all 2,236 VS): no exp prim, no s_sendmsg, no v_mbcnt, every VS exports pos0/param, so the console runs them as legacy hardware VS. Their input VGPRs are Mesa's GFX10 legacy layout (radv_shader_args.c, declare_vs_input_vgprs, not is_ngg): v0 vertex id, v1 unused, v2 primitive id, v3 instance id; no VS reads v1/v2 on entry, 788 start with the fetch call and read attributes from v4. Those ids are zero-based on the hardware (ac_nir_lower_intrinsics_to_args.c: vertex_id is load_vertex_id_zero_base, instance_id is load_instance_id; the bases come in SGPRs), while Vulkan's VertexIndex/InstanceIndex include firstVertex|vertexOffset/firstInstance. The translator now seeds v0 = VertexIndex - BaseVertex and v3 = InstanceIndex - BaseInstance (DrawParameters; feature shaderDrawParameters in every VS's metadata). GPU test vs_base_ids.asm, drawn with VKH_DRAW=16,7 (new vk_harness option): 0x101 on every pixel, where before it was 0x7111. Run by check.py and run_gpu_tests.py. vk_harness, vk_pipeline_check, vk_bindless_test, vk_texture_test and the runtime's Vulkan device enable shaderDrawParameters. design.md's "Inputs and outputs" row replaces the "unverified" note. AI-assisted (Claude Code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/vk_bindless_test.cpp')
-rw-r--r--runtime/test/vk_bindless_test.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/test/vk_bindless_test.cpp b/runtime/test/vk_bindless_test.cpp
index e245cf828..062008c1c 100644
--- a/runtime/test/vk_bindless_test.cpp
+++ b/runtime/test/vk_bindless_test.cpp
@@ -199,7 +199,8 @@ int main(int argc, char** argv) {
199 199
200 // The features ps_tex's metadata names (bufferDeviceAddress, runtimeDescriptorArray, shaderInt64), dynamic 200 // The features ps_tex's metadata names (bufferDeviceAddress, runtimeDescriptorArray, shaderInt64), dynamic
201 // indexing of the image array, and whichever descriptor-indexing flags the set can use. 201 // indexing of the image array, and whichever descriptor-indexing flags the set can use.
202 VkPhysicalDeviceVulkan12Features have12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES}; 202 VkPhysicalDeviceVulkan11Features have11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES};
203 VkPhysicalDeviceVulkan12Features have12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &have11};
203 VkPhysicalDeviceFeatures2 have{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &have12}; 204 VkPhysicalDeviceFeatures2 have{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &have12};
204 vkGetPhysicalDeviceFeatures2(pd, &have); 205 vkGetPhysicalDeviceFeatures2(pd, &have);
205 if (!have12.bufferDeviceAddress || !have12.runtimeDescriptorArray || !have.features.shaderInt64 || 206 if (!have12.bufferDeviceAddress || !have12.runtimeDescriptorArray || !have.features.shaderInt64 ||
@@ -213,7 +214,10 @@ int main(int argc, char** argv) {
213 have12.descriptorBindingStorageImageUpdateAfterBind && 214 have12.descriptorBindingStorageImageUpdateAfterBind &&
214 have12.descriptorBindingStorageBufferUpdateAfterBind; 215 have12.descriptorBindingStorageBufferUpdateAfterBind;
215 device_flags.partially_bound = have12.descriptorBindingPartiallyBound == VK_TRUE; 216 device_flags.partially_bound = have12.descriptorBindingPartiallyBound == VK_TRUE;
216 VkPhysicalDeviceVulkan12Features enable12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES}; 217 // Translated vertex shaders read BaseVertex / BaseInstance (DrawParameters) for the zero-based v0 / v3.
218 VkPhysicalDeviceVulkan11Features enable11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES};
219 enable11.shaderDrawParameters = have11.shaderDrawParameters;
220 VkPhysicalDeviceVulkan12Features enable12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &enable11};
217 enable12.bufferDeviceAddress = VK_TRUE; 221 enable12.bufferDeviceAddress = VK_TRUE;
218 enable12.runtimeDescriptorArray = VK_TRUE; 222 enable12.runtimeDescriptorArray = VK_TRUE;
219 enable12.descriptorIndexing = have12.descriptorIndexing; 223 enable12.descriptorIndexing = have12.descriptorIndexing;