diff options
| author | S1m0ne1997 <347981799+S1m0ne1997@users.noreply.github.com> | 2026-11-22 00:51:57 +0100 |
|---|---|---|
| committer | S1m0ne1997 <347981799+S1m0ne1997@users.noreply.github.com> | 2026-11-22 11:59:04 +0100 |
| commit | 07bd05fa95c2c47be1d1f0b671fb5e484b23a904 (patch) | |
| tree | 0021b22b12f60c13dc7ee98e247cbcdea7bd7101 /runtime/test/vk_texture_test.cpp | |
| parent | c2967a5e60060e4068fb992196d8f4b494a5046c (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_texture_test.cpp')
| -rw-r--r-- | runtime/test/vk_texture_test.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/test/vk_texture_test.cpp b/runtime/test/vk_texture_test.cpp index 7698c5d6b..02df9b583 100644 --- a/runtime/test/vk_texture_test.cpp +++ b/runtime/test/vk_texture_test.cpp | |||
| @@ -162,7 +162,11 @@ int main(int argc, char** argv) { | |||
| 162 | float prio = 1; | 162 | float prio = 1; |
| 163 | VkDeviceQueueCreateInfo qci{VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO}; | 163 | VkDeviceQueueCreateInfo qci{VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO}; |
| 164 | qci.queueFamilyIndex = qi; qci.queueCount = 1; qci.pQueuePriorities = &prio; | 164 | qci.queueFamilyIndex = qi; qci.queueCount = 1; qci.pQueuePriorities = &prio; |
| 165 | // Translated vertex shaders read BaseVertex / BaseInstance (DrawParameters) for the zero-based v0 / v3. | ||
| 166 | VkPhysicalDeviceVulkan11Features f11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES}; | ||
| 167 | f11.shaderDrawParameters = VK_TRUE; | ||
| 165 | VkPhysicalDeviceVulkan12Features f12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES}; | 168 | VkPhysicalDeviceVulkan12Features f12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES}; |
| 169 | f12.pNext = &f11; | ||
| 166 | f12.bufferDeviceAddress = VK_TRUE; f12.runtimeDescriptorArray = VK_TRUE; f12.descriptorIndexing = VK_TRUE; | 170 | f12.bufferDeviceAddress = VK_TRUE; f12.runtimeDescriptorArray = VK_TRUE; f12.descriptorIndexing = VK_TRUE; |
| 167 | VkPhysicalDeviceFeatures2 f2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; f2.pNext = &f12; | 171 | VkPhysicalDeviceFeatures2 f2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; f2.pNext = &f12; |
| 168 | f2.features.shaderInt64 = VK_TRUE; | 172 | f2.features.shaderInt64 = VK_TRUE; |