acdream/src/AcDream.App/Rendering/Shaders/particle.vert
Erik 2cbf34a668 perf(rendering): preserve alpha order with bindless particles
Carry each billboard particle's resident texture handle in the instance ABI so stable retail alpha ordering can batch mixed textures without rebinding and redrawing each short texture run. Keep DAT blend transitions as the only billboard draw boundary.

The connected 0xC95B stress scene improved from 6 FPS / 171 ms to about 153 FPS / 6.6 ms at the same roughly 21,000 visible entities. Release build succeeds and all 5,916 tests pass with five intentional skips.

Co-authored-by: OpenAI Codex <codex@openai.com>
2026-07-18 08:32:21 +02:00

29 lines
735 B
GLSL

#version 430 core
// Unit quad vertex (XY -0.5..+0.5)
layout(location = 0) in vec2 aQuad;
layout(location = 1) in vec2 aTex;
// Per-instance: world-space center, authored sheet axes, color.
layout(location = 2) in vec4 aCenter;
layout(location = 3) in vec4 aAxisX;
layout(location = 4) in vec4 aAxisY;
layout(location = 5) in vec4 aColor;
layout(location = 6) in uvec2 aTextureHandle;
uniform mat4 uViewProjection;
out vec2 vTex;
out vec4 vColor;
flat out uvec2 vTextureHandle;
void main() {
vec3 world = aCenter.xyz
+ aAxisX.xyz * aQuad.x
+ aAxisY.xyz * aQuad.y;
vTex = aTex;
vColor = aColor;
vTextureHandle = aTextureHandle;
gl_Position = uViewProjection * vec4(world, 1.0);
}