KhronosGroup / KhronosGroup/Vulkan-ValidationLayers

Partially used push data

Open
#12,002 1 comment 0 reactions 1 assignee View on GitHub

@spencer-lunarg is already working on this.

Since Mar 29, 2026.

SpecChange
Dominant language
C++
Stars
1k
Forks
505
Avg merge
11h 25m
Merged PRs (30d)
229

Description

Question is, is it valid to not back push data that is not used?

TEST_F(PositiveDescriptorHeap, PartialPushData) {
    AddRequiredFeature(vkt::Feature::vertexPipelineStoresAndAtomics);
    RETURN_IF_SKIP(InitBasicDescriptorHeap());
    InitRenderTarget();

    char const* frag_source = R"glsl(
        #version 450
        layout(location = 0) out vec4 color;
        layout(push_constant) uniform PushConstant {
            float value1;
            float value2;
        };
        void main() {
            color = vec4(value1);
        }
    )glsl";

    VkShaderObj vert_module = VkShaderObj(*m_device, kVertexMinimalGlsl, VK_SHADER_STAGE_VERTEX_BIT);
    VkShaderObj frag_module = VkShaderObj(*m_device, frag_source, VK_SHADER_STAGE_FRAGMENT_BIT);

    VkPipelineCreateFlags2CreateInfoKHR pipeline_create_flags_2_create_info = vku::InitStructHelper();
    pipeline_create_flags_2_create_info.flags = VK_PIPELINE_CREATE_2_DESCRIPTOR_HEAP_BIT_EXT;

    VkPipelineShaderStageCreateInfo stages[2] = {vert_module.GetStageCreateInfo(), frag_module.GetStageCreateInfo()};

    CreatePipelineHelper pipe(*this, &pipeline_create_flags_2_create_info);
    pipe.gp_ci_.layout = VK_NULL_HANDLE;
    pipe.gp_ci_.stageCount = 2;
    pipe.gp_ci_.pStages = stages;
    pipe.CreateGraphicsPipeline(false);

    float push_data = 0.785f;
    VkPushDataInfoEXT push_data_info = vku::InitStructHelper();
    push_data_info.offset = 0;
    push_data_info.data.size = sizeof(push_data);
    push_data_info.data.address = &push_data;

    m_command_buffer.Begin();
    vk::CmdPushDataEXT(m_command_buffer, &push_data_info);
    vk::CmdBindPipeline(m_command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipe);
    m_command_buffer.BeginRenderPass(m_renderPassBeginInfo);
    vk::CmdDraw(m_command_buffer, 3u, 1u, 0u, 0u);
    m_command_buffer.EndRenderPass();

    m_command_buffer.End();
    m_default_queue->SubmitAndWait(m_command_buffer);
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.