mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-02 04:51:26 +12:00
vk: Respect shader compile flags when linking
This commit is contained in:
parent
20b54f3086
commit
64866098e7
2 changed files with 31 additions and 16 deletions
|
@ -36,12 +36,12 @@ namespace vk
|
|||
{
|
||||
if (job.is_graphics_job)
|
||||
{
|
||||
auto compiled = int_compile_graphics_pipe(job.graphics_data, job.graphics_modules, job.inputs, {});
|
||||
auto compiled = int_compile_graphics_pipe(job.graphics_data, job.graphics_modules, job.inputs, {}, job.flags);
|
||||
job.callback_func(compiled);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto compiled = int_compile_compute_pipe(job.compute_data, job.inputs);
|
||||
auto compiled = int_compile_compute_pipe(job.compute_data, job.inputs, job.flags);
|
||||
job.callback_func(compiled);
|
||||
}
|
||||
}
|
||||
|
@ -52,20 +52,22 @@ namespace vk
|
|||
|
||||
std::unique_ptr<glsl::program> pipe_compiler::int_compile_compute_pipe(
|
||||
const VkComputePipelineCreateInfo& create_info,
|
||||
const std::vector<glsl::program_input>& cs_inputs)
|
||||
const std::vector<glsl::program_input>& cs_inputs,
|
||||
op_flags flags)
|
||||
{
|
||||
auto program = std::make_unique<glsl::program>(*m_device, create_info, cs_inputs);
|
||||
program->link(false);
|
||||
program->link(flags & SEPARATE_SHADER_OBJECTS);
|
||||
return program;
|
||||
}
|
||||
|
||||
std::unique_ptr<glsl::program> pipe_compiler::int_compile_graphics_pipe(
|
||||
const VkGraphicsPipelineCreateInfo& create_info,
|
||||
const std::vector<glsl::program_input>& vs_inputs,
|
||||
const std::vector<glsl::program_input>& fs_inputs)
|
||||
const std::vector<glsl::program_input>& fs_inputs,
|
||||
op_flags flags)
|
||||
{
|
||||
auto program = std::make_unique<glsl::program>(*m_device, create_info, vs_inputs, fs_inputs);
|
||||
program->link(true);
|
||||
program->link(flags & SEPARATE_SHADER_OBJECTS);
|
||||
return program;
|
||||
}
|
||||
|
||||
|
@ -73,7 +75,8 @@ namespace vk
|
|||
const vk::pipeline_props &create_info,
|
||||
VkShaderModule modules[2],
|
||||
const std::vector<glsl::program_input>& vs_inputs,
|
||||
const std::vector<glsl::program_input>& fs_inputs)
|
||||
const std::vector<glsl::program_input>& fs_inputs,
|
||||
op_flags flags)
|
||||
{
|
||||
VkPipelineShaderStageCreateInfo shader_stages[2] = {};
|
||||
shader_stages[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||
|
@ -167,7 +170,7 @@ namespace vk
|
|||
info.basePipelineHandle = VK_NULL_HANDLE;
|
||||
info.renderPass = vk::get_renderpass(*m_device, create_info.renderpass_key);
|
||||
|
||||
return int_compile_graphics_pipe(info, vs_inputs, fs_inputs);
|
||||
return int_compile_graphics_pipe(info, vs_inputs, fs_inputs, flags);
|
||||
}
|
||||
|
||||
std::unique_ptr<glsl::program> pipe_compiler::compile(
|
||||
|
@ -177,10 +180,10 @@ namespace vk
|
|||
{
|
||||
if (flags & COMPILE_INLINE)
|
||||
{
|
||||
return int_compile_compute_pipe(create_info, cs_inputs);
|
||||
return int_compile_compute_pipe(create_info, cs_inputs, flags);
|
||||
}
|
||||
|
||||
m_work_queue.push(create_info, cs_inputs, callback);
|
||||
m_work_queue.push(create_info, cs_inputs, flags, callback);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -192,7 +195,7 @@ namespace vk
|
|||
{
|
||||
// It is very inefficient to defer this as all pointers need to be saved
|
||||
ensure(flags & COMPILE_INLINE);
|
||||
return int_compile_graphics_pipe(create_info, vs_inputs, fs_inputs);
|
||||
return int_compile_graphics_pipe(create_info, vs_inputs, fs_inputs, flags);
|
||||
}
|
||||
|
||||
std::unique_ptr<glsl::program> pipe_compiler::compile(
|
||||
|
@ -206,10 +209,10 @@ namespace vk
|
|||
VkShaderModule modules[] = { vs, fs };
|
||||
if (flags & COMPILE_INLINE)
|
||||
{
|
||||
return int_compile_graphics_pipe(create_info, modules, vs_inputs, fs_inputs);
|
||||
return int_compile_graphics_pipe(create_info, modules, vs_inputs, fs_inputs, flags);
|
||||
}
|
||||
|
||||
m_work_queue.push(create_info, modules, vs_inputs, fs_inputs, callback);
|
||||
m_work_queue.push(create_info, modules, vs_inputs, fs_inputs, flags, callback);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -117,11 +117,14 @@ namespace vk
|
|||
VkShaderModule graphics_modules[2];
|
||||
std::vector<glsl::program_input> inputs;
|
||||
|
||||
op_flags flags;
|
||||
|
||||
pipe_compiler_job(
|
||||
const vk::pipeline_props& props,
|
||||
VkShaderModule modules[2],
|
||||
const std::vector<glsl::program_input>& vs_in,
|
||||
const std::vector<glsl::program_input>& fs_in,
|
||||
op_flags flags_,
|
||||
callback_t func)
|
||||
{
|
||||
callback_func = func;
|
||||
|
@ -129,6 +132,7 @@ namespace vk
|
|||
graphics_modules[0] = modules[0];
|
||||
graphics_modules[1] = modules[1];
|
||||
is_graphics_job = true;
|
||||
flags = flags_;
|
||||
|
||||
inputs.reserve(vs_in.size() + fs_in.size());
|
||||
inputs.insert(inputs.end(), vs_in.begin(), vs_in.end());
|
||||
|
@ -138,11 +142,16 @@ namespace vk
|
|||
pipe_compiler_job(
|
||||
const VkComputePipelineCreateInfo& props,
|
||||
const std::vector<glsl::program_input>& cs_in,
|
||||
op_flags flags_,
|
||||
callback_t func)
|
||||
{
|
||||
callback_func = func;
|
||||
compute_data = props;
|
||||
is_graphics_job = false;
|
||||
flags = flags_;
|
||||
|
||||
graphics_modules[0] = VK_NULL_HANDLE;
|
||||
graphics_modules[1] = VK_NULL_HANDLE;
|
||||
|
||||
inputs = cs_in;
|
||||
}
|
||||
|
@ -153,18 +162,21 @@ namespace vk
|
|||
|
||||
std::unique_ptr<glsl::program> int_compile_compute_pipe(
|
||||
const VkComputePipelineCreateInfo& create_info,
|
||||
const std::vector<glsl::program_input>& cs_inputs);
|
||||
const std::vector<glsl::program_input>& cs_inputs,
|
||||
op_flags flags);
|
||||
|
||||
std::unique_ptr<glsl::program> int_compile_graphics_pipe(
|
||||
const VkGraphicsPipelineCreateInfo& create_info,
|
||||
const std::vector<glsl::program_input>& vs_inputs,
|
||||
const std::vector<glsl::program_input>& fs_inputs);
|
||||
const std::vector<glsl::program_input>& fs_inputs,
|
||||
op_flags flags);
|
||||
|
||||
std::unique_ptr<glsl::program> int_compile_graphics_pipe(
|
||||
const vk::pipeline_props &create_info,
|
||||
VkShaderModule modules[2],
|
||||
const std::vector<glsl::program_input>& vs_inputs,
|
||||
const std::vector<glsl::program_input>& fs_inputs);
|
||||
const std::vector<glsl::program_input>& fs_inputs,
|
||||
op_flags flags);
|
||||
};
|
||||
|
||||
void initialize_pipe_compiler(int num_worker_threads = -1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue