upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/src
diff options
context:
space:
mode:
authorRyx <118130241+Ryx69@users.noreply.github.com>2026-11-22 00:21:53 +0100
committerRyx <118130241+Ryx69@users.noreply.github.com>2026-11-22 05:01:36 +0100
commit80e5cacabed8af5c0e9da9a35734a7c88198ff97 (patch)
tree3158cc3c46005770f05684e11cc6be2af60beedd /runtime/src
parent1267591716621f05c24c0d5570eb29bca157050d (diff)
Runtime: refuse PSOs below 144 bytes of push constants; push-constant stages from the stage table
Review feedback from IAmNotSiob: - Both PSO paths declared a 144-byte push-constant range without consulting #224's limit. On a device with maxPushConstantsSize 128 (the Vulkan minimum) that breaks VUID-VkPushConstantRange-size-00298 and returns a bare E_FAIL. Both paths now refuse with E_NOTIMPL and log the limit until the uniform-buffer tail exists. d3d12_compute_test checks this with a device that reports 128 bytes. - The graphics range's stage flags are now the whole stage table create_graphics accepts, kept in GraphicsPipeline::push_stages, and the replay pushes with the same flags. A geometry or mesh stage added to the table is covered without another change. docs/d3d12_vulkan.md section 5.2 now counts code-base readers per stage with the current translator: of the 662 shaders with s_getpc_b64, 53 VS, 92 PS, 246 MS and 263 CS read the code base. VS+PS pairs are only known at PSO creation.
Diffstat (limited to 'runtime/src')
-rw-r--r--runtime/src/vulkan_replay.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/src/vulkan_replay.h b/runtime/src/vulkan_replay.h
index 02f0acfe7..ec85bd156 100644
--- a/runtime/src/vulkan_replay.h
+++ b/runtime/src/vulkan_replay.h
@@ -597,6 +597,7 @@ struct ComputePipeline {
597struct GraphicsPipeline { 597struct GraphicsPipeline {
598 VkPipeline pipeline = VK_NULL_HANDLE; 598 VkPipeline pipeline = VK_NULL_HANDLE;
599 VkPipelineLayout layout = VK_NULL_HANDLE; 599 VkPipelineLayout layout = VK_NULL_HANDLE;
600 VkShaderStageFlags push_stages = 0; // the layout's push-constant range; vkCmdPushConstants must name the same
600 std::uint64_t code_base = 0; 601 std::uint64_t code_base = 0;
601 std::vector<VkFormat> color_formats; // by render-target slot 602 std::vector<VkFormat> color_formats; // by render-target slot
602 VkFormat depth_format = VK_FORMAT_UNDEFINED; 603 VkFormat depth_format = VK_FORMAT_UNDEFINED;
@@ -2028,8 +2029,7 @@ inline void emit(const PreparedList& prepared, VkCommandBuffer command_buffer, c
2028 data.heap_base = vk.heap_base; 2029 data.heap_base = vk.heap_base;
2029 data.code_base = p.graphics.code_base; 2030 data.code_base = p.graphics.code_base;
2030 vk.bind_pipeline(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, p.graphics.pipeline); 2031 vk.bind_pipeline(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, p.graphics.pipeline);
2031 vk.push_constants(command_buffer, p.graphics.layout, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 2032 vk.push_constants(command_buffer, p.graphics.layout, p.graphics.push_stages, 0, sizeof(data), &data);
2032 0, sizeof(data), &data);
2033 // Translated vertex shaders write D3D clip coordinates (y up); a negative-height viewport keeps the 2033 // Translated vertex shaders write D3D clip coordinates (y up); a negative-height viewport keeps the
2034 // image upright, and winding as D3D12 sees it. 2034 // image upright, and winding as D3D12 sees it.
2035 const Viewport& v = draw->viewport; 2035 const Viewport& v = draw->viewport;