#version 450 // Bloom 高斯模糊:可分离 9-tap,方向由 push 给出(H/V 各跑一次)。 // 源图为半分辨率,线性采样 + 权重对应的偏移天然抗锯齿。 layout(location = 0) in vec2 fragUV; layout(location = 0) out vec4 outColor; layout(set = 0, binding = 0) uniform sampler2D srcImage; layout(push_constant) uniform PushConstants { float exposure; // 未用(程序级统一布局) float stepX; // param0: UV 步长 x(水平 pass = 1/width,垂直 = 0) float stepY; // param1: UV 步长 y float _pad0; } pc; const float weights[5] = float[](0.227027, 0.1945946, 0.1216216, 0.054054, 0.016216); void main() { vec2 off = vec2(pc.stepX, pc.stepY); vec3 c = texture(srcImage, fragUV).rgb * weights[0]; for (int i = 1; i < 5; ++i) { c += texture(srcImage, fragUV + off * float(i)).rgb * weights[i]; c += texture(srcImage, fragUV - off * float(i)).rgb * weights[i]; } outColor = vec4(c, 1.0); }