2020-12-05 13:08:24 +01:00
|
|
|
#pragma once
|
2021-05-12 23:56:01 +02:00
|
|
|
#include "../Program/VertexProgramDecompiler.h"
|
2016-02-21 16:50:49 +01:00
|
|
|
#include "Utilities/Thread.h"
|
|
|
|
|
#include "VulkanAPI.h"
|
2020-12-24 11:49:08 +01:00
|
|
|
#include "VKProgramPipeline.h"
|
2020-12-30 10:32:54 +01:00
|
|
|
#include "vkutils/pipeline_binding_table.h"
|
2016-02-21 16:50:49 +01:00
|
|
|
|
2020-04-09 19:50:27 +02:00
|
|
|
namespace vk
|
|
|
|
|
{
|
|
|
|
|
class shader_interpreter;
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-21 16:50:49 +01:00
|
|
|
struct VKVertexDecompilerThread : public VertexProgramDecompiler
|
|
|
|
|
{
|
2020-04-09 19:50:27 +02:00
|
|
|
friend class vk::shader_interpreter;
|
|
|
|
|
|
2016-02-21 16:50:49 +01:00
|
|
|
std::string &m_shader;
|
|
|
|
|
std::vector<vk::glsl::program_input> inputs;
|
|
|
|
|
class VKVertexProgram *vk_prog;
|
2020-01-08 17:30:35 +01:00
|
|
|
vk::pipeline_binding_table m_binding_table{};
|
2019-12-10 07:10:13 +01:00
|
|
|
|
|
|
|
|
struct
|
|
|
|
|
{
|
2021-04-11 16:51:57 +02:00
|
|
|
bool emulate_conditional_rendering{false};
|
2019-12-10 07:10:13 +01:00
|
|
|
}
|
|
|
|
|
m_device_props;
|
|
|
|
|
|
2016-02-21 16:50:49 +01:00
|
|
|
protected:
|
2020-12-18 08:39:54 +01:00
|
|
|
std::string getFloatTypeName(usz elementCount) override;
|
|
|
|
|
std::string getIntTypeName(usz elementCount) override;
|
2019-06-08 09:49:47 +02:00
|
|
|
std::string getFunction(FUNCTION) override;
|
|
|
|
|
std::string compareFunction(COMPARE, const std::string&, const std::string&, bool scalar) override;
|
|
|
|
|
|
|
|
|
|
void insertHeader(std::stringstream &OS) override;
|
|
|
|
|
void insertInputs(std::stringstream &OS, const std::vector<ParamType> &inputs) override;
|
|
|
|
|
void insertConstants(std::stringstream &OS, const std::vector<ParamType> &constants) override;
|
|
|
|
|
void insertOutputs(std::stringstream &OS, const std::vector<ParamType> &outputs) override;
|
|
|
|
|
void insertMainStart(std::stringstream &OS) override;
|
|
|
|
|
void insertMainEnd(std::stringstream &OS) override;
|
2016-02-21 16:50:49 +01:00
|
|
|
|
|
|
|
|
const RSXVertexProgram &rsx_vertex_program;
|
|
|
|
|
public:
|
2017-06-18 16:53:02 +02:00
|
|
|
VKVertexDecompilerThread(const RSXVertexProgram &prog, std::string& shader, ParamArray&, class VKVertexProgram &dst)
|
2016-02-21 16:50:49 +01:00
|
|
|
: VertexProgramDecompiler(prog)
|
|
|
|
|
, m_shader(shader)
|
|
|
|
|
, vk_prog(&dst)
|
2020-02-21 13:20:10 +01:00
|
|
|
, rsx_vertex_program(prog)
|
2016-02-21 16:50:49 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Task();
|
|
|
|
|
const std::vector<vk::glsl::program_input>& get_inputs() { return inputs; }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class VKVertexProgram
|
2020-02-21 13:20:10 +01:00
|
|
|
{
|
2016-02-21 16:50:49 +01:00
|
|
|
public:
|
|
|
|
|
VKVertexProgram();
|
|
|
|
|
~VKVertexProgram();
|
|
|
|
|
|
|
|
|
|
ParamArray parr;
|
|
|
|
|
VkShaderModule handle = nullptr;
|
2016-03-07 15:55:02 +01:00
|
|
|
u32 id;
|
2018-06-12 17:46:59 +02:00
|
|
|
vk::glsl::shader shader;
|
2016-02-21 16:50:49 +01:00
|
|
|
std::vector<vk::glsl::program_input> uniforms;
|
2022-03-23 20:53:18 +01:00
|
|
|
std::vector<u16> constant_ids;
|
|
|
|
|
bool has_indexed_constants;
|
2016-02-21 16:50:49 +01:00
|
|
|
|
|
|
|
|
void Decompile(const RSXVertexProgram& prog);
|
|
|
|
|
void Compile();
|
|
|
|
|
void SetInputs(std::vector<vk::glsl::program_input>& inputs);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void Delete();
|
|
|
|
|
};
|