Hash :
22ed9877
Author :
Date :
2024-03-07T15:52:13
Vulkan: Generate fragment shading rates with compute Generating fragment shading rates on the CPU could cause avoidable stalls or increased latencies due to host<->device synchronization. Instead generate the rates using a compute shader. Optimize foveated rendering by treating a foveated draw with focal points whose gainX or gainY is 0 as if it were an un-foveated draw Bug: angleproject:42266906 Change-Id: If8c5504087997666c7d0c1cae8dcc5fab847187e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5754322 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
// GENERATED FILE - DO NOT EDIT.
// Generated by gen_vk_internal_shaders.py.
//
// Copyright 2018 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// shaders/gen/GenerateFragmentShadingRate.comp.00000000.inc:
// Pre-generated shader for the ANGLE Vulkan back-end.
#pragma once
constexpr uint8_t kGenerateFragmentShadingRate_comp_00000000[] = {
0x1f,0x8b,0x08,0x00,0x00,0x00,0x00,0x00,0x02,0xff,0x7d,0x96,0xdb,0x6f,0x55,0x55,
0x10,0xc6,0xd7,0x3a,0xe7,0xf4,0x72,0xa4,0x39,0x05,0xa5,0x95,0x72,0xb6,0x2d,0xd2,
0x34,0x62,0x39,0x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0xe8,
0xbe,0x45,0x1e,0x8d,0x79,0x1e,0xec,0x2f,0xea,0xb9,0xe5,0xf2,0xc5,0xf8,0xef,0x7c,
0x3d,0x2e,0x5f,0x29,0xe6,0x7e,0xab,0xa5,0x1c,0x73,0x0e,0xc5,0x4d,0x43,0x25,0xe6,
0x1a,0x56,0xe0,0x5f,0xe7,0x7a,0xb8,0x09,0x5b,0x63,0x66,0xe8,0x97,0xd6,0x98,0xe3,
0xda,0x93,0xda,0xaf,0x0b,0xe8,0x0b,0x9d,0xf7,0xc8,0x0d,0x54,0xa3,0x47,0x8b,0x71,
0x6d,0xc4,0xe9,0xbc,0x45,0xb8,0xaa,0xf4,0xab,0xed,0xbf,0xef,0xfd,0x76,0xa7,0xef,
0x76,0xa7,0x6f,0x11,0xef,0x82,0x69,0x59,0x1c,0x73,0xff,0x18,0x77,0x68,0xe6,0xfa,
0x56,0x7d,0x1d,0x32,0x3a,0xc9,0xdb,0x81,0x8e,0x0c,0xbb,0xd3,0xf1,0x2c,0x81,0xa7,
0x1f,0x1d,0x75,0x62,0xea,0xd4,0xa4,0x5a,0xef,0x8d,0x79,0xdc,0x38,0xdf,0x75,0xcf,
0x95,0xb9,0xf7,0xb1,0x97,0xf7,0x51,0xf3,0xe9,0x9a,0x7a,0xfc,0xe7,0x6e,0xfe,0x08,
0xff,0xb0,0xc4,0xea,0xb7,0xf8,0x13,0xb0,0x3e,0x37,0xc6,0xf8,0x2e,0x1f,0xc0,0x3f,
0x2a,0xf6,0x7e,0xee,0xf1,0x03,0x85,0xef,0xc0,0x74,0xea,0x8f,0x28,0xfb,0x17,0xc3,
0xdf,0x5e,0x68,0x45,0x0b,0x54,0x0c,0x00,0x00
};
// Generated from:
//
// #version 450 core
//
// struct FocalPoint {
// float focalX;
// float focalY;
// float gainX;
// float gainY;
// float foveaArea;
// };
//
// layout(push_constant)uniform PushConstants
// {
// uint textureWidth;
// uint textureHeight;
// uint attachmentWidth;
// uint attachmentHeight;
// uint attachmentBlockWidth;
// uint attachmentBlockHeight;
// uint numOfFocalPoints;
// FocalPoint focalPoints[2];
// } params;
//
// layout(binding = 0, r8ui)uniform writeonly uimage2D fragmentShadingRateImage;
// layout(local_size_x = 8, local_size_y = 8, local_size_z = 1)in;
//
// uint computeValue(ivec2 pos)
// {
// float minPixelDensity = 0.0f;
// float focalPointDensity = 0.0f;
// float px =((float(pos . x)* params . attachmentBlockWidth)/ params . textureWidth - 0.5f)* 2.0f;
// float py =((float(pos . y)* params . attachmentBlockHeight)/ params . textureHeight - 0.5f)* 2.0f;
//
// for(uint point = 0;point < params . numOfFocalPoints;point ++)
// {
// float density = 1.0f / max(pow(params . focalPoints[point]. focalX - px, 2)*
// pow(params . focalPoints[point]. gainX, 2)+
// pow(params . focalPoints[point]. focalY - py, 2)*
// pow(params . focalPoints[point]. gainY, 2)-
// params . focalPoints[point]. foveaArea,
// 1.0f);
//
// if(density > focalPointDensity)
// {
// focalPointDensity = density;
// }
// }
// minPixelDensity = max(minPixelDensity, focalPointDensity);
//
// uint val = 0;
// if(minPixelDensity > 0.75f)
// {
//
// val = 0;
// }
// else if(minPixelDensity > 0.5f)
// {
//
// val =(1 << 2);
// }
// else
// {
//
// val =(1 << 2)| 1;
// }
// return val;
// }
//
// void main()
// {
// uint i = gl_GlobalInvocationID . x;
// uint j = gl_GlobalInvocationID . y;
//
// if(i >= params . attachmentWidth || j >= params . attachmentHeight)
// {
// return;
// }
//
// ivec2 pos = ivec2(i, j);
// imageStore(fragmentShadingRateImage, pos, ivec4(computeValue(pos), 0, 0, 0));
// }