mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 17:01:49 +01:00
Retain Shader Binding State Across Stages
An instance of `Shader::Backend::Bindings` must be retained across all stages for correct emission of bindings, which is now done inside `GraphicsContext::GetShaderStages`.
This commit is contained in:
parent
550d12b7fa
commit
afa34e320a
@ -546,6 +546,7 @@ namespace skyline::gpu::interconnect {
|
||||
span<vk::PipelineShaderStageCreateInfo> GetShaderStages() {
|
||||
if (!activeShaderStagesInfoCount) {
|
||||
runtimeInfo.previous_stage_stores.mask.set(); // First stage should always have all bits set
|
||||
ShaderCompiler::Backend::Bindings bindings;
|
||||
|
||||
size_t count{};
|
||||
for (auto &shader : shaders) {
|
||||
@ -586,7 +587,7 @@ namespace skyline::gpu::interconnect {
|
||||
return std::nullopt;
|
||||
})};
|
||||
|
||||
shader.vkModule = gpu.shader.CompileGraphicsShader(shader.data, shader.stage, shader.offset, runtimeInfo);
|
||||
shader.vkModule = gpu.shader.CompileGraphicsShader(shader.data, shader.stage, shader.offset, runtimeInfo, bindings);
|
||||
}
|
||||
|
||||
shaderStagesInfo[count++] = vk::PipelineShaderStageCreateInfo{
|
||||
|
@ -125,13 +125,12 @@ namespace skyline::gpu {
|
||||
}
|
||||
};
|
||||
|
||||
vk::raii::ShaderModule ShaderManager::CompileGraphicsShader(const std::vector<u8> &binary, Shader::Stage stage, u32 baseOffset, Shader::RuntimeInfo& runtimeInfo) {
|
||||
vk::raii::ShaderModule ShaderManager::CompileGraphicsShader(const std::vector<u8> &binary, Shader::Stage stage, u32 baseOffset, Shader::RuntimeInfo &runtimeInfo, Shader::Backend::Bindings &bindings) {
|
||||
GraphicsEnvironment environment{binary, baseOffset, stage};
|
||||
Shader::Maxwell::Flow::CFG cfg(environment, flowBlockPool, Shader::Maxwell::Location{static_cast<u32>(baseOffset + sizeof(Shader::ProgramHeader))});
|
||||
|
||||
auto program{Shader::Maxwell::TranslateProgram(instPool, blockPool, environment, cfg, hostTranslateInfo)};
|
||||
|
||||
Shader::Backend::Bindings bindings{};
|
||||
auto spirv{Shader::Backend::SPIRV::EmitSPIRV(profile, runtimeInfo, program, bindings)};
|
||||
|
||||
runtimeInfo.previous_stage_stores = program.info.stores;
|
||||
|
@ -8,9 +8,10 @@
|
||||
#include <shader_compiler/frontend/maxwell/control_flow.h>
|
||||
#include <shader_compiler/frontend/ir/value.h>
|
||||
#include <shader_compiler/frontend/ir/basic_block.h>
|
||||
#include <shader_compiler/runtime_info.h>
|
||||
#include <shader_compiler/host_translate_info.h>
|
||||
#include <shader_compiler/profile.h>
|
||||
#include <shader_compiler/runtime_info.h>
|
||||
#include <shader_compiler/backend/bindings.h>
|
||||
#include <common.h>
|
||||
|
||||
namespace skyline::gpu {
|
||||
@ -27,11 +28,11 @@ namespace skyline::gpu {
|
||||
Shader::Profile profile;
|
||||
|
||||
public:
|
||||
ShaderManager(const DeviceState& state, GPU &gpu);
|
||||
ShaderManager(const DeviceState &state, GPU &gpu);
|
||||
|
||||
/**
|
||||
* @note `runtimeInfo::previous_stage_stores` will automatically be updated for the next stage
|
||||
*/
|
||||
vk::raii::ShaderModule CompileGraphicsShader(const std::vector<u8> &binary, Shader::Stage stage, u32 baseOffset, Shader::RuntimeInfo& runtimeInfo);
|
||||
vk::raii::ShaderModule CompileGraphicsShader(const std::vector<u8> &binary, Shader::Stage stage, u32 baseOffset, Shader::RuntimeInfo &runtimeInfo, Shader::Backend::Bindings &bindings);
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user