mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-07-01 21:36:09 +00:00
Port the tint shader
Some checks are pending
CI / Linux (python=3.13 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.11 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
Some checks are pending
CI / Linux (python=3.13 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.11 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
This commit is contained in:
parent
749b3c48b6
commit
296c9abdc3
1 changed files with 32 additions and 0 deletions
32
kitty/shaders/tint.slang
Normal file
32
kitty/shaders/tint.slang
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#language slang 2026
|
||||
// Copyright (C) 2026 Kovid Goyal <kovid at kovidgoyal.net>
|
||||
// Distributed under terms of the GPLv3 license.
|
||||
|
||||
// Main Vertex Shader Entry Point
|
||||
[shader("vertex")]
|
||||
float4 vertex_main(
|
||||
uint vertex_id : SV_VertexID,
|
||||
uniform float4 edges, // [ left, top, right, bottom ]
|
||||
) : SV_Position {
|
||||
// Extract boundaries from the edges vector
|
||||
float left = edges[0];
|
||||
float top = edges[1];
|
||||
float right = edges[2];
|
||||
float bottom = edges[3];
|
||||
|
||||
// Static mapping table for vertex positions
|
||||
const float2 pos_map[4] = {
|
||||
float2(left, top),
|
||||
float2(left, bottom),
|
||||
float2(right, bottom),
|
||||
float2(right, top)
|
||||
};
|
||||
|
||||
// Calculate final position
|
||||
return float4(pos_map[vertex_id], 0.0, 1.0);
|
||||
}
|
||||
|
||||
[shader("fragment")]
|
||||
float4 fragment_main(uniform float4 tint_color) : SV_Target {
|
||||
return tint_color;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue