rsx: misc fixes

- Supply explicit options for spv emit allowing optimizations (not yet compiled into the backend)
- Add epsilon fix to glslcommon
- Fix shader dialog crash when using qt (race condition)
This commit is contained in:
kd-11 2018-01-24 20:26:17 +03:00
parent 648fc92184
commit 2e04dceaf0
3 changed files with 17 additions and 4 deletions

View File

@ -337,7 +337,7 @@ namespace glsl
OS << " result.x = 1.;\n";
OS << " result.w = 1.;\n";
OS << " result.y = clamped_val.x;\n";
OS << " result.z = clamped_val.x > 0. ? exp(clamped_val.w * log(max(clamped_val.y, 0.000001))) : 0.;\n";
OS << " result.z = clamped_val.x > 0. ? exp(clamped_val.w * log(max(clamped_val.y, 0.0000000001))) : 0.;\n";
OS << " return result;\n";
OS << "}\n\n";

View File

@ -144,6 +144,10 @@ namespace vk
glslang::TProgram program;
glslang::TShader shader_object(lang);
shader_object.setEnvInput(glslang::EShSourceGlsl, lang, glslang::EShClientVulkan, 100);
shader_object.setEnvClient(glslang::EShClientVulkan, 100);
shader_object.setEnvTarget(glslang::EshTargetSpv, 0x00001000);
bool success = false;
const char *shader_text = shader.data();
@ -154,11 +158,13 @@ namespace vk
if (shader_object.parse(&g_default_config, 400, EProfile::ECoreProfile, false, true, msg))
{
program.addShader(&shader_object);
success = program.link(EShMsgVulkanRules);
success = program.link(msg);
if (success)
{
glslang::TIntermediate* bytes = program.getIntermediate(lang);
glslang::GlslangToSpv(*bytes, spv);
glslang::SpvOptions options;
options.disableOptimizer = false;
options.optimizeSize = true;
glslang::GlslangToSpv(*program.getIntermediate(lang), spv, &options);
}
}
else

View File

@ -282,6 +282,7 @@ namespace rsx
struct progress_dialog_helper
{
std::shared_ptr<MsgDialogBase> dlg;
atomic_t<bool> initialized{ false };
virtual void create()
{
@ -300,7 +301,13 @@ namespace rsx
Emu.CallAfter([&]()
{
dlg->Create("Preloading cached shaders from disk.\nPlease wait...");
initialized.store(true);
});
while (!initialized.load() && !Emu.IsStopped())
{
_mm_pause();
}
}
virtual void update_msg(u32 processed, u32 entry_count)