mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-17 05:57:11 -04:00
- Implement texture scaling/conversion/downloading for the main view so we can finally start getting data to output. Also, redesign how it works a bit, it will now properly wait one full frame for each step in the process: rendering the main texture, scaling the main texture to an output texture, staging/downloading the ouput texture, and then outputting that staged data. This way, the GPU will have more than enough time to fully complete each step. - Fix a bug with OpenGL plugin's texture staging function. Was using glBindBuffer instead of what should have been used: glBindTexture. - Change the naming scheme of the variables in default.effect. It's now named with the idea of just "color matrix" in mind instead of "yuv matrix", and instead of DrawRGBToYUV, it's now just DrawMatrix.
52 lines
912 B
Plaintext
52 lines
912 B
Plaintext
uniform float4x4 ViewProj;
|
|
uniform float4x4 color_matrix;
|
|
uniform texture2d diffuse;
|
|
|
|
sampler_state def_sampler {
|
|
Filter = Linear;
|
|
AddressU = Clamp;
|
|
AddressV = Clamp;
|
|
};
|
|
|
|
struct VertInOut {
|
|
float4 pos : POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
};
|
|
|
|
VertInOut VSDefault(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 PSDrawBare(VertInOut vert_in) : TARGET
|
|
{
|
|
return diffuse.Sample(def_sampler, vert_in.uv);
|
|
}
|
|
|
|
float4 PSDrawMatrix(VertInOut vert_in) : TARGET
|
|
{
|
|
float4 yuv = diffuse.Sample(def_sampler, vert_in.uv);
|
|
return saturate(mul(float4(yuv.xyz, 1.0), color_matrix));
|
|
}
|
|
|
|
technique Draw
|
|
{
|
|
pass
|
|
{
|
|
vertex_shader = VSDefault(vert_in);
|
|
pixel_shader = PSDrawBare(vert_in);
|
|
}
|
|
}
|
|
|
|
technique DrawMatrix
|
|
{
|
|
pass
|
|
{
|
|
vertex_shader = VSDefault(vert_in);
|
|
pixel_shader = PSDrawMatrix(vert_in);
|
|
}
|
|
}
|