| 506 | } |
| 507 | |
| 508 | std::optional<GLProgram> GLShaderCache::CompileAndAddComputeProgram( |
| 509 | const CacheIndexKey& key, const std::string_view glsl, const PreLinkCallback& callback) |
| 510 | { |
| 511 | #ifdef PCSX2_DEVBUILD |
| 512 | Common::Timer timer; |
| 513 | #endif |
| 514 | |
| 515 | std::optional<GLProgram> prog = CompileComputeProgram(glsl, callback, true); |
| 516 | if (!prog) |
| 517 | return std::nullopt; |
| 518 | |
| 519 | #ifdef PCSX2_DEVBUILD |
| 520 | const float compile_time = timer.GetTimeMilliseconds(); |
| 521 | timer.Reset(); |
| 522 | #endif |
| 523 | |
| 524 | std::vector<u8> prog_data; |
| 525 | u32 prog_format = 0; |
| 526 | if (!prog->GetBinary(&prog_data, &prog_format)) |
| 527 | return std::nullopt; |
| 528 | |
| 529 | #ifdef PCSX2_DEVBUILD |
| 530 | const float binary_time = timer.GetTimeMilliseconds(); |
| 531 | timer.Reset(); |
| 532 | #endif |
| 533 | |
| 534 | WriteToBlobFile(key, prog_data, prog_format); |
| 535 | |
| 536 | #ifdef PCSX2_DEVBUILD |
| 537 | const float write_time = timer.GetTimeMilliseconds(); |
| 538 | Console.WriteLn("Compiled and cached compute shader: Compile: %.2fms, Binary: %.2fms, Write: %.2fms", compile_time, |
| 539 | binary_time, write_time); |
| 540 | #endif |
| 541 | |
| 542 | return prog; |
| 543 | } |
nothing calls this directly
no test coverage detected