Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Rob_S
Beginner
88 Views

Pixel shader parameters are not respecting 'sample' interpolation modifier in Vulkan

System Setup Information:
-----------------------------------------

System Used: Lenovo Thinkpad X1 Yoga 2nd Gen
CPU SKU: i7
GPU SKU: HD 620
Processor Line: U-Series
System BIOS Version: LENOVO N1NET33W (1.20)
CMOS settings: ???
Graphics Driver Version: 24.20.100.6286
GOP/VBIOS Version: 
Operating System: Windows 10 x64
OS Version: 10.0.18362
API: Vulkan
Occurs on non-Intel GPUs?: No

Steps to Reproduce:
-------------------------------
1. Set up 2x MSAA image + renderpass + framebuffer + graphics pipeline
2. Enable sample location shading during VkDevice creation
3. Use a pixel shader that has parameters (non-position inputs) that are interpolated with the `sample` modifier
4. Observe that the interpolation is still happening at the Pixel Center
5. Do not profit

Vulkan SDK installed: 1.1.130

Vulkan Instance version: 1.1.126

VkPhysicalDeviceProperties.apiVersion = 1.1.82

The position in the shader is correct, since I can see the geometry edges are what I expect them to be. Just the parameter interpolation is busted.

0 Kudos
1 Reply
Rob_S
Beginner
88 Views

I am in the process of adding support for `VK_EXT_sample_locations` to my application. I added a populated `VkPipelineSampleLocationsStateCreateInfoEXT` struct to the pipelines which were giving me problems (for unrelated reasons). Once I tested it on my Intel laptop, suddenly, `sample` interpolation works on the pipelines in question?? I'm using the same sample locations as the default MSAA 2X ({0.75, 0.75}, {0.25, 0.25}).

Besides the process of adding the VK_EXT_sample_locations extension to my device creation process, here's some code of what I changed during pipeline creation:

    VkPipelineSampleLocationsStateCreateInfoEXT
        m_vk_pipeline_sample_locations_ext = { 
        VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT };
    m_vk_pipeline_sample_locations_ext.sampleLocationsEnable = VK_TRUE;

    m_vk_pipeline_sample_locations_ext.sampleLocationsInfo = {
        VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT};
    m_vk_pipeline_sample_locations_ext.sampleLocationsInfo
        .sampleLocationsPerPixel = VK_SAMPLE_COUNT_2_BIT;
    m_vk_pipeline_sample_locations_ext.sampleLocationsInfo
        .sampleLocationGridSize = {1,1};
    m_vk_pipeline_sample_locations_ext.sampleLocationsInfo
        .sampleLocationsCount = 2;
    
    // This is fake code, I don't really allocate this on the stack
    VkSampleLocationEXT sample_locs[] = { {0.75, 0.75}, {0.25, 0.25}};
    m_vk_pipeline_sample_locations_ext.sampleLocationsInfo
         .pSampleLocations = &sample_locs[0]; 

    m_vk_pipeline_multisample.pNext = &m_vk_pipeline_sample_locations_ext;