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
1 changed files with 11 additions and 8 deletions

View File

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