obs/gs/effect: gs_get_device_type() requires graphics context

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-11-27 01:59:40 +01:00
parent 9859b44b1c
commit 2962be9d52

View file

@ -46,6 +46,8 @@ static std::string load_file_as_code(std::filesystem::path shader_file)
}
// Push Graphics API to shader.
{
auto gctx = streamfx::obs::gs::context();
switch (gs_get_device_type()) {
case GS_DEVICE_DIRECT3D_11:
shader_stream << "#define GS_DEVICE_DIRECT3D_11" << std::endl;
@ -55,6 +57,7 @@ static std::string load_file_as_code(std::filesystem::path shader_file)
shader_stream << "#define GS_DEVICE_OPENGL" << std::endl;
break;
}
}
// Pre-process the shader.
std::string line;