1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 08:12:53 +01:00
Files
OpenRCT2/data/shaders/drawline.vert
Matt 01b577fa58 Improve performance of panning the viewport with OpenGL renderer (#24413)
* Improve performance of panning the viewport with OpenGL renderer

* Use a shader to perform the copy rect operation

* Clear the frame buffer after its initialized

* Handle Y flip in shader, be explicit about FBO draw state

* Target 330 core, remove the y flip handling

* Explicitly use GL_RGB8 and not GL_RGB

* Add more error handling, clear depth when depth is created

* Lets try this

* Make sure blend and depth are disabled

* Bind the source fbo for reading

* Try this alternative approach

* Set read and draw buffer before glBlitFramebuffer

* Apple is forcing my hand

* Update changelog.txt
2025-05-21 18:35:05 +03:00

31 lines
605 B
GLSL

#version 330 core
// Allows for about 8 million draws per frame
const float DEPTH_INCREMENT = 1.0 / float(1u << 22u);
uniform ivec2 uScreenSize;
// clang-format off
in ivec4 vBounds;
in uint vColour;
in int vDepth;
// clang-format on
in mat4x2 vVertMat;
flat out uint fColour;
void main()
{
vec2 pos = vVertMat * vec4(vBounds);
// Transform screen coordinates to viewport coordinates
pos = (pos * (2.0 / vec2(uScreenSize))) - 1.0;
pos.y *= -1.0;
float depth = 1.0 - (float(vDepth) + 1.0) * DEPTH_INCREMENT;
fColour = vColour;
gl_Position = vec4(pos, depth, 1.0);
}