mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-30 04:11:57 -04:00
Certain draw calls were creating/destroying vertex buffers. Every call. That's kind of not a great thing to do, so instead use the new gs_draw_quadf() function to optimize rendering and reduce the need for swapping vertex buffers. Also uses a shader for DrawStripedLine so it does not have to split it up into separate draw calls.
39 lines
755 B
Plaintext
39 lines
755 B
Plaintext
uniform float4x4 ViewProj;
|
|
uniform float4 color = {1.0, 1.0, 1.0, 1.0};
|
|
uniform float2 size;
|
|
uniform float2 count_inv;
|
|
|
|
struct VertInOut {
|
|
float4 pos : POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
};
|
|
|
|
VertInOut VSStripedLine(VertInOut vert_in)
|
|
{
|
|
VertInOut vert_out;
|
|
vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
|
|
vert_out.uv = vert_in.uv;
|
|
return vert_out;
|
|
}
|
|
|
|
float4 PSStripedLine(VertInOut vert_in) : TARGET
|
|
{
|
|
float2 multiplier = floor(fmod(vert_in.uv * size * count_inv, float2(2.0, 2.0)));
|
|
if (size.x == 0.0) {
|
|
multiplier.x = 1.0;
|
|
} else {
|
|
multiplier.y = 1.0;
|
|
}
|
|
|
|
return color * multiplier.xxxx * multiplier.yyyy;
|
|
}
|
|
|
|
technique StripedLine
|
|
{
|
|
pass
|
|
{
|
|
vertex_shader = VSStripedLine(vert_in);
|
|
pixel_shader = PSStripedLine(vert_in);
|
|
}
|
|
}
|