obs-StreamFX/data/effects/mipgen.effect
Michael Fabian 'Xaymar' Dirks 4947d46aa1 gs-mipmapper: Update API usage, remove broken options and optimize
The new libOBS API allows us to directly access the underlying API instead of having to mess around in memory. By using it we can avoid crashing in case the compiler for it is different, or in case the actual back end structure changes.

Additionally the mostly unimplemented and unused options have also been removed, which streamlines the use of this class even further and reduces both shader and code complexity.

Finally by optimizing the use of the internal render target we can achieve a speed up of up to 3000% over the old way, allowing for many more mipmapped filters.
2023-03-28 12:40:40 +02:00

35 lines
573 B
Text

uniform float4x4 ViewProj;
uniform texture2d image;
uniform float2 imageTexel;
uniform int level;
sampler_state def_sampler {
Filter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
struct VertexData {
float4 pos : POSITION;
float2 uv : TEXCOORD0;
};
VertexData VSDefault(VertexData vtx)
{
vtx.pos = mul(float4(vtx.pos.xyz, 1.0), ViewProj);
return vtx;
}
float4 PSDefault(VertexData vtx) : TARGET
{
return image.SampleLevel(def_sampler, vtx.uv, level);
}
technique Draw
{
pass
{
vertex_shader = VSDefault(vtx);
pixel_shader = PSDefault(vtx);
}
}