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 | |
| 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')
| -rw-r--r-- | runtime/shims/d3d12_vulkan_device.cpp | 13 | ||||
| -rw-r--r-- | runtime/test/shaders/check.py | 22 | ||||
| -rw-r--r-- | runtime/test/shaders/vs_base_ids.asm | 24 | ||||
| -rw-r--r-- | runtime/test/vk_bindless_test.cpp | 8 | ||||
| -rw-r--r-- | runtime/test/vk_harness.cpp | 18 | ||||
| -rw-r--r-- | runtime/test/vk_pipeline_check.cpp | 3 | ||||
| -rw-r--r-- | runtime/test/vk_texture_test.cpp | 4 |
7 files changed, 86 insertions, 6 deletions
diff --git a/runtime/shims/d3d12_vulkan_device.cpp b/runtime/shims/d3d12_vulkan_device.cpp index 399ae037f..fdb683de8 100644 --- a/runtime/shims/d3d12_vulkan_device.cpp +++ b/runtime/shims/d3d12_vulkan_device.cpp | |||
| @@ -3902,15 +3902,18 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { | |||
| 3902 | bool chosen_bc = false; | 3902 | bool chosen_bc = false; |
| 3903 | VkPhysicalDeviceFeatures chosen_features{}; | 3903 | VkPhysicalDeviceFeatures chosen_features{}; |
| 3904 | VkPhysicalDeviceVulkan12Features chosen12{}; | 3904 | VkPhysicalDeviceVulkan12Features chosen12{}; |
| 3905 | bool chosen_draw_params = false; | ||
| 3905 | for (VkPhysicalDevice candidate : physicals) { | 3906 | for (VkPhysicalDevice candidate : physicals) { |
| 3906 | VkPhysicalDeviceProperties props{}; | 3907 | VkPhysicalDeviceProperties props{}; |
| 3907 | vkGetPhysicalDeviceProperties(candidate, &props); | 3908 | vkGetPhysicalDeviceProperties(candidate, &props); |
| 3908 | if (props.apiVersion < VK_API_VERSION_1_3 || !leonida::vulkan_device_wanted(props.deviceName)) continue; | 3909 | if (props.apiVersion < VK_API_VERSION_1_3 || !leonida::vulkan_device_wanted(props.deviceName)) continue; |
| 3909 | VkPhysicalDeviceVulkan13Features f13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; | 3910 | VkPhysicalDeviceVulkan13Features f13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; |
| 3910 | VkPhysicalDeviceVulkan12Features f12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &f13}; | 3911 | VkPhysicalDeviceVulkan11Features f11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &f13}; |
| 3912 | VkPhysicalDeviceVulkan12Features f12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &f11}; | ||
| 3911 | VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &f12}; | 3913 | VkPhysicalDeviceFeatures2 features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, &f12}; |
| 3912 | vkGetPhysicalDeviceFeatures2(candidate, &features); | 3914 | vkGetPhysicalDeviceFeatures2(candidate, &features); |
| 3913 | const bool bc = features.features.textureCompressionBC; | 3915 | const bool bc = features.features.textureCompressionBC; |
| 3916 | const bool draw_params = f11.shaderDrawParameters; | ||
| 3914 | if (!f13.dynamicRendering || !f13.synchronization2 || !f12.timelineSemaphore || | 3917 | if (!f13.dynamicRendering || !f13.synchronization2 || !f12.timelineSemaphore || |
| 3915 | !f12.separateDepthStencilLayouts) | 3918 | !f12.separateDepthStencilLayouts) |
| 3916 | continue; | 3919 | continue; |
| @@ -3927,6 +3930,7 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { | |||
| 3927 | chosen_bc = bc; | 3930 | chosen_bc = bc; |
| 3928 | chosen_features = features.features; | 3931 | chosen_features = features.features; |
| 3929 | chosen12 = f12; | 3932 | chosen12 = f12; |
| 3933 | chosen_draw_params = draw_params; | ||
| 3930 | } | 3934 | } |
| 3931 | break; | 3935 | break; |
| 3932 | } | 3936 | } |
| @@ -3999,7 +4003,12 @@ HRESULT create_vulkan_device_standalone(REFIID riid, void** out) { | |||
| 3999 | VkPhysicalDeviceVulkan13Features enable13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES, ext_chain}; | 4003 | VkPhysicalDeviceVulkan13Features enable13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES, ext_chain}; |
| 4000 | enable13.dynamicRendering = VK_TRUE; | 4004 | enable13.dynamicRendering = VK_TRUE; |
| 4001 | enable13.synchronization2 = VK_TRUE; | 4005 | enable13.synchronization2 = VK_TRUE; |
| 4002 | VkPhysicalDeviceVulkan12Features enable12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &enable13}; | 4006 | // Translated vertex shaders read BaseVertex / BaseInstance (SPIR-V DrawParameters) to give v0 / v3 the |
| 4007 | // hardware's zero-based vertex and instance ids (docs/design.md, Inputs and outputs). | ||
| 4008 | VkPhysicalDeviceVulkan11Features enable11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES, &enable13}; | ||
| 4009 | enable11.shaderDrawParameters = chosen_draw_params ? VK_TRUE : VK_FALSE; | ||
| 4010 | if (!chosen_draw_params) std::fprintf(stderr, "[rt] d3d12: the GPU has no shaderDrawParameters\n"); | ||
| 4011 | VkPhysicalDeviceVulkan12Features enable12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, &enable11}; | ||
| 4003 | enable12.timelineSemaphore = VK_TRUE; | 4012 | enable12.timelineSemaphore = VK_TRUE; |
| 4004 | enable12.separateDepthStencilLayouts = VK_TRUE; | 4013 | enable12.separateDepthStencilLayouts = VK_TRUE; |
| 4005 | info.buffer_device_address = chosen12.bufferDeviceAddress == VK_TRUE; | 4014 | info.buffer_device_address = chosen12.bufferDeviceAddress == VK_TRUE; |
diff --git a/runtime/test/shaders/check.py b/runtime/test/shaders/check.py index ecc36571d..ea2ca37fc 100644 --- a/runtime/test/shaders/check.py +++ b/runtime/test/shaders/check.py | |||
| @@ -797,6 +797,27 @@ def interp_f16_high_problem(px): | |||
| 797 | return "" if err < 2e-3 else f"f16 halves off by {err:.3g}" | 797 | return "" if err < 2e-3 else f"f16 halves off by {err:.3g}" |
| 798 | 798 | ||
| 799 | 799 | ||
| 800 | def base_ids_test(tools, spirv): | ||
| 801 | """vs_base_ids with ps_flat, drawn with firstVertex 16 and firstInstance 7: the VS input VGPRs are zero-based on | ||
| 802 | the hardware, so every pixel must still see vertex 0 of instance 0 (0x101, 0x102), not 0x7111.""" | ||
| 803 | for n in ("vs_base_ids", "ps_flat"): | ||
| 804 | if not os.path.isfile(os.path.join(spirv, n + ".spv")): | ||
| 805 | return f"missing {n}.spv" | ||
| 806 | env = dict(os.environ, VKH_DRAW="16,7") | ||
| 807 | with tempfile.TemporaryDirectory(prefix="leonida-pixels-") as tmp: | ||
| 808 | raw = Path(tmp) / "pixels.raw" | ||
| 809 | code, out = run(os.path.join(tools, "vk_harness" + EXE), os.path.join(spirv, "vs_base_ids.spv"), | ||
| 810 | os.path.join(spirv, "ps_flat.spv"), raw, env=env) | ||
| 811 | if code == UNSUPPORTED: | ||
| 812 | m = re.search(r"unsupported: .*", out) | ||
| 813 | return Skip(f"SKIP ({m.group(0) if m else 'unsupported device'})") | ||
| 814 | if code or not raw.is_file(): | ||
| 815 | return out if out.startswith("could not start") else "vk_harness failed or returned no pixels" | ||
| 816 | px = list(struct.iter_unpack("<2I2f", raw.read_bytes())) | ||
| 817 | wrong = [p for p in px if (p[0], p[1]) != (0x101, 0x102)] | ||
| 818 | return "" if px and not wrong else f"{len(wrong)} of {len(px)} pixels differ, e.g. {hex(wrong[0][0]) if wrong else '-'}" | ||
| 819 | |||
| 820 | |||
| 800 | def pixel_test(tools, spirv, name): | 821 | def pixel_test(tools, spirv, name): |
| 801 | path = os.path.join(spirv, name + ".spv") | 822 | path = os.path.join(spirv, name + ".spv") |
| 802 | if not os.path.isfile(path): | 823 | if not os.path.isfile(path): |
| @@ -932,6 +953,7 @@ def main(): | |||
| 932 | for name in PIXEL_TESTS: | 953 | for name in PIXEL_TESTS: |
| 933 | results.append((name, pixel_test(tools, spirv, name))) | 954 | results.append((name, pixel_test(tools, spirv, name))) |
| 934 | results.append(("ps_gather_wrap", gather_wrap_test(tools, spirv))) | 955 | results.append(("ps_gather_wrap", gather_wrap_test(tools, spirv))) |
| 956 | results.append(("vs_base_ids", base_ids_test(tools, spirv))) | ||
| 935 | results.append(("ps_tex", bindless_test(tools, spirv))) | 957 | results.append(("ps_tex", bindless_test(tools, spirv))) |
| 936 | for name in MIP_TEST_PASSES: | 958 | for name in MIP_TEST_PASSES: |
| 937 | results.append((name, texture_mip_test(tools, spirv, name))) | 959 | results.append((name, texture_mip_test(tools, spirv, name))) |
diff --git a/runtime/test/shaders/vs_base_ids.asm b/runtime/test/shaders/vs_base_ids.asm new file mode 100644 index 000000000..27e905aea --- /dev/null +++ b/runtime/test/shaders/vs_base_ids.asm | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | ; Vertex shader for the base-vertex / base-instance test. On AMD hardware the VS input VGPRs are zero-based: v0 is | ||
| 2 | ; the vertex id without the draw's first vertex (Mesa: ac.vertex_id = load_vertex_id_zero_base, the base comes in | ||
| 3 | ; the base_vertex SGPR), and v3 the instance id without its first instance (ac.instance_id = load_instance_id, the | ||
| 4 | ; base in start_instance). Vulkan's VertexIndex / InstanceIndex include firstVertex / firstInstance. | ||
| 5 | ; Same full-screen triangle as vs_ids (from v0's low bits), param0 = (u, v, 0, 1), and param1.x = | ||
| 6 | ; 0x101 + v0 + 0x1000 * v3 as raw bits, so ps_flat (attr1.x from the provoking vertex) shows both ids. | ||
| 7 | ; Run: VKH_DRAW=16,7 vk_harness vs_base_ids.spv ps_flat.spv out.raw | ||
| 8 | ; -> mrt0 bits = 0x101, 0x102 on every pixel (vertex 0 of instance 0); 0x7111 means firstVertex/firstInstance | ||
| 9 | ; leaked into v0 / v3. With VKH_DRAW unset (0,0) both read 0x101, as vs_ids. | ||
| 10 | v_lshlrev_b32_e32 v8, 12, v3 | ||
| 11 | v_lshlrev_b32_e32 v1, 1, v0 | ||
| 12 | v_and_b32_e32 v1, 2, v1 | ||
| 13 | v_and_b32_e32 v2, 2, v0 | ||
| 14 | v_cvt_f32_u32_e32 v1, v1 | ||
| 15 | v_cvt_f32_u32_e32 v2, v2 | ||
| 16 | v_fma_f32 v3, v1, 2.0, -1.0 | ||
| 17 | v_fma_f32 v4, v2, 2.0, -1.0 | ||
| 18 | v_mov_b32_e32 v5, 0 | ||
| 19 | v_mov_b32_e32 v6, 1.0 | ||
| 20 | exp pos0 v3, v4, v5, v6 done | ||
| 21 | exp param0 v1, v2, v5, v6 | ||
| 22 | v_add3_u32 v7, v0, v8, 0x101 | ||
| 23 | exp param1 v7, v7, v7, v7 | ||
| 24 | s_endpgm | ||
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; |
diff --git a/runtime/test/vk_harness.cpp b/runtime/test/vk_harness.cpp index 535c7879f..df4e069db 100644 --- a/runtime/test/vk_harness.cpp +++ b/runtime/test/vk_harness.cpp | |||
| @@ -248,12 +248,22 @@ int main(int argc, char** argv) { | |||
| 248 | m8.maintenance8 = VK_TRUE; m8.pNext = chain; chain = &m8; | 248 | m8.maintenance8 = VK_TRUE; m8.pNext = chain; chain = &m8; |
| 249 | } | 249 | } |
| 250 | #endif | 250 | #endif |
| 251 | VkPhysicalDeviceVulkan11Features f11q{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES}; | ||
| 251 | VkPhysicalDeviceVulkan12Features f12q{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES}; | 252 | VkPhysicalDeviceVulkan12Features f12q{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES}; |
| 253 | f12q.pNext = &f11q; | ||
| 252 | VkPhysicalDeviceVulkan13Features f13q{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; | 254 | VkPhysicalDeviceVulkan13Features f13q{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; |
| 253 | f13q.pNext = &f12q; | 255 | f13q.pNext = &f12q; |
| 254 | VkPhysicalDeviceFeatures2 f2q{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; | 256 | VkPhysicalDeviceFeatures2 f2q{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2}; |
| 255 | f2q.pNext = &f13q; | 257 | f2q.pNext = &f13q; |
| 256 | vkGetPhysicalDeviceFeatures2(pd, &f2q); | 258 | vkGetPhysicalDeviceFeatures2(pd, &f2q); |
| 259 | // Translated vertex shaders read BaseVertex / BaseInstance (DrawParameters) to give v0 / v3 the hardware's | ||
| 260 | // zero-based ids. | ||
| 261 | VkPhysicalDeviceVulkan11Features f11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES}; | ||
| 262 | if (f11q.shaderDrawParameters) { | ||
| 263 | f11.shaderDrawParameters = VK_TRUE; | ||
| 264 | f11.pNext = chain; | ||
| 265 | chain = &f11; | ||
| 266 | } | ||
| 257 | VkPhysicalDeviceVulkan13Features f13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; | 267 | VkPhysicalDeviceVulkan13Features f13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; |
| 258 | if (f13q.subgroupSizeControl) { | 268 | if (f13q.subgroupSizeControl) { |
| 259 | f13.subgroupSizeControl = VK_TRUE; | 269 | f13.subgroupSizeControl = VK_TRUE; |
| @@ -574,8 +584,12 @@ int main(int argc, char** argv) { | |||
| 574 | vkCmdDraw(cmd, uint32_t(mesh_groups * mesh_prims * 3), 1, 0, 0); | 584 | vkCmdDraw(cmd, uint32_t(mesh_groups * mesh_prims * 3), 1, 0, 0); |
| 575 | else if (mesh) | 585 | else if (mesh) |
| 576 | reinterpret_cast<PFN_vkCmdDrawMeshTasksEXT>(vkGetDeviceProcAddr(dev, "vkCmdDrawMeshTasksEXT"))(cmd, groups[0], groups[1], groups[2]); | 586 | reinterpret_cast<PFN_vkCmdDrawMeshTasksEXT>(vkGetDeviceProcAddr(dev, "vkCmdDrawMeshTasksEXT"))(cmd, groups[0], groups[1], groups[2]); |
| 577 | else | 587 | else { |
| 578 | vkCmdDraw(cmd, 3, 1, 0, 0); | 588 | // VKH_DRAW=<firstVertex>,<firstInstance>: draw the triangle with non-zero bases (vs_base_ids). |
| 589 | unsigned first_vertex = 0, first_instance = 0; | ||
| 590 | if (const char* d = std::getenv("VKH_DRAW")) std::sscanf(d, "%u,%u", &first_vertex, &first_instance); | ||
| 591 | vkCmdDraw(cmd, 3, 1, first_vertex, first_instance); | ||
| 592 | } | ||
| 579 | vkCmdEndRenderPass(cmd); | 593 | vkCmdEndRenderPass(cmd); |
| 580 | VkBufferImageCopy reg{}; reg.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}; reg.imageExtent = {W, H, 1}; | 594 | VkBufferImageCopy reg{}; reg.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}; reg.imageExtent = {W, H, 1}; |
| 581 | vkCmdCopyImageToBuffer(cmd, img, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, buf, 1, ®); | 595 | vkCmdCopyImageToBuffer(cmd, img, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, buf, 1, ®); |
diff --git a/runtime/test/vk_pipeline_check.cpp b/runtime/test/vk_pipeline_check.cpp index 4c6a46adb..50482b049 100644 --- a/runtime/test/vk_pipeline_check.cpp +++ b/runtime/test/vk_pipeline_check.cpp | |||
| @@ -502,6 +502,7 @@ int main(int argc, char** argv) { | |||
| 502 | #endif | 502 | #endif |
| 503 | VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR exe{ | 503 | VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR exe{ |
| 504 | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR}; | 504 | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR}; |
| 505 | VkPhysicalDeviceVulkan11Features f11{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES}; | ||
| 505 | VkPhysicalDeviceVulkan12Features f12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES}; | 506 | VkPhysicalDeviceVulkan12Features f12{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES}; |
| 506 | VkPhysicalDeviceVulkan13Features f13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; | 507 | VkPhysicalDeviceVulkan13Features f13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES}; |
| 507 | void* chain = nullptr; | 508 | void* chain = nullptr; |
| @@ -512,6 +513,7 @@ int main(int argc, char** argv) { | |||
| 512 | b->pNext = static_cast<VkBaseOutStructure*>(chain); chain = s; | 513 | b->pNext = static_cast<VkBaseOutStructure*>(chain); chain = s; |
| 513 | return true; | 514 | return true; |
| 514 | }; | 515 | }; |
| 516 | link(&f11, reinterpret_cast<VkBaseOutStructure*>(&f11), nullptr, true); // shaderDrawParameters (VS v0/v3) | ||
| 515 | link(&f12, reinterpret_cast<VkBaseOutStructure*>(&f12), nullptr, true); | 517 | link(&f12, reinterpret_cast<VkBaseOutStructure*>(&f12), nullptr, true); |
| 516 | link(&f13, reinterpret_cast<VkBaseOutStructure*>(&f13), nullptr, true); | 518 | link(&f13, reinterpret_cast<VkBaseOutStructure*>(&f13), nullptr, true); |
| 517 | const bool ext_mesh = link(&mesh, reinterpret_cast<VkBaseOutStructure*>(&mesh), VK_EXT_MESH_SHADER_EXTENSION_NAME, want_mesh); | 519 | const bool ext_mesh = link(&mesh, reinterpret_cast<VkBaseOutStructure*>(&mesh), VK_EXT_MESH_SHADER_EXTENSION_NAME, want_mesh); |
| @@ -603,6 +605,7 @@ int main(int argc, char** argv) { | |||
| 603 | if (feat == "fragmentShaderPixelInterlock" && !(ext_lock && lock.fragmentShaderPixelInterlock)) return "no fragmentShaderPixelInterlock"; | 605 | if (feat == "fragmentShaderPixelInterlock" && !(ext_lock && lock.fragmentShaderPixelInterlock)) return "no fragmentShaderPixelInterlock"; |
| 604 | if (feat == "shaderFloat64" && !f2.features.shaderFloat64) return "no shaderFloat64"; | 606 | if (feat == "shaderFloat64" && !f2.features.shaderFloat64) return "no shaderFloat64"; |
| 605 | if (feat == "shaderInt64" && !f2.features.shaderInt64) return "no shaderInt64"; | 607 | if (feat == "shaderInt64" && !f2.features.shaderInt64) return "no shaderInt64"; |
| 608 | if (feat == "shaderDrawParameters" && !f11.shaderDrawParameters) return "no shaderDrawParameters"; | ||
| 606 | if (feat == "bufferDeviceAddress" && !f12.bufferDeviceAddress) return "no bufferDeviceAddress"; | 609 | if (feat == "bufferDeviceAddress" && !f12.bufferDeviceAddress) return "no bufferDeviceAddress"; |
| 607 | if (feat == "runtimeDescriptorArray" && !f12.runtimeDescriptorArray) return "no runtimeDescriptorArray"; | 610 | if (feat == "runtimeDescriptorArray" && !f12.runtimeDescriptorArray) return "no runtimeDescriptorArray"; |
| 608 | if (feat == "shaderImageGatherExtended" && !f2.features.shaderImageGatherExtended) return "no shaderImageGatherExtended"; | 611 | if (feat == "shaderImageGatherExtended" && !f2.features.shaderImageGatherExtended) return "no shaderImageGatherExtended"; |
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; |