mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-07-10 01:44:41 -06:00
Use std::string_view in rsx code
This commit is contained in:
parent
f8c88c3a7a
commit
f95a225d63
@ -21,7 +21,7 @@ std::string GLFragmentDecompilerThread::getFunction(FUNCTION f)
|
|||||||
return glsl::getFunctionImpl(f);
|
return glsl::getFunctionImpl(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GLFragmentDecompilerThread::compareFunction(COMPARE f, const std::string &Op0, const std::string &Op1)
|
std::string GLFragmentDecompilerThread::compareFunction(COMPARE f, std::string_view Op0, std::string_view Op1)
|
||||||
{
|
{
|
||||||
return glsl::compareFunctionImpl(f, Op0, Op1);
|
return glsl::compareFunctionImpl(f, Op0, Op1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,8 +34,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
std::string getFloatTypeName(usz elementCount) override;
|
std::string getFloatTypeName(usz elementCount) override;
|
||||||
std::string getHalfTypeName(usz elementCount) override;
|
std::string getHalfTypeName(usz elementCount) override;
|
||||||
std::string getFunction(FUNCTION) override;
|
std::string getFunction(FUNCTION f) override;
|
||||||
std::string compareFunction(COMPARE, const std::string&, const std::string&) override;
|
std::string compareFunction(COMPARE f, std::string_view Op0, std::string_view Op1) override;
|
||||||
|
|
||||||
void insertHeader(std::stringstream &OS) override;
|
void insertHeader(std::stringstream &OS) override;
|
||||||
void insertInputs(std::stringstream &OS) override;
|
void insertInputs(std::stringstream &OS) override;
|
||||||
|
|||||||
@ -21,12 +21,12 @@ std::string GLVertexDecompilerThread::getFunction(FUNCTION f)
|
|||||||
return glsl::getFunctionImpl(f);
|
return glsl::getFunctionImpl(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GLVertexDecompilerThread::compareFunction(COMPARE f, const std::string &Op0, const std::string &Op1, bool scalar)
|
std::string GLVertexDecompilerThread::compareFunction(COMPARE f, std::string_view Op0, std::string_view Op1, bool scalar)
|
||||||
{
|
{
|
||||||
return glsl::compareFunctionImpl(f, Op0, Op1, scalar);
|
return glsl::compareFunctionImpl(f, Op0, Op1, scalar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLVertexDecompilerThread::insertHeader(std::stringstream &OS)
|
void GLVertexDecompilerThread::insertHeader(std::stringstream& OS)
|
||||||
{
|
{
|
||||||
OS <<
|
OS <<
|
||||||
"#version 430\n"
|
"#version 430\n"
|
||||||
@ -162,7 +162,7 @@ void GLVertexDecompilerThread::insertOutputs(std::stringstream& OS, const std::v
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLVertexDecompilerThread::insertMainStart(std::stringstream & OS)
|
void GLVertexDecompilerThread::insertMainStart(std::stringstream& OS)
|
||||||
{
|
{
|
||||||
const auto& dev_caps = gl::get_driver_caps();
|
const auto& dev_caps = gl::get_driver_caps();
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ void GLVertexDecompilerThread::insertMainStart(std::stringstream & OS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLVertexDecompilerThread::insertMainEnd(std::stringstream & OS)
|
void GLVertexDecompilerThread::insertMainEnd(std::stringstream& OS)
|
||||||
{
|
{
|
||||||
OS << "}\n\n";
|
OS << "}\n\n";
|
||||||
|
|
||||||
|
|||||||
@ -26,20 +26,20 @@ struct GLVertexDecompilerThread : public VertexProgramDecompiler
|
|||||||
protected:
|
protected:
|
||||||
std::string getFloatTypeName(usz elementCount) override;
|
std::string getFloatTypeName(usz elementCount) override;
|
||||||
std::string getIntTypeName(usz elementCount) override;
|
std::string getIntTypeName(usz elementCount) override;
|
||||||
std::string getFunction(FUNCTION) override;
|
std::string getFunction(FUNCTION f) override;
|
||||||
std::string compareFunction(COMPARE, const std::string&, const std::string&, bool scalar) override;
|
std::string compareFunction(COMPARE f, std::string_view Op0, std::string_view Op1, bool scalar) override;
|
||||||
|
|
||||||
void insertHeader(std::stringstream &OS) override;
|
void insertHeader(std::stringstream& OS) override;
|
||||||
void insertInputs(std::stringstream &OS, const std::vector<ParamType> &inputs) override;
|
void insertInputs(std::stringstream& OS, const std::vector<ParamType>& inputs) override;
|
||||||
void insertConstants(std::stringstream &OS, const std::vector<ParamType> &constants) override;
|
void insertConstants(std::stringstream& OS, const std::vector<ParamType>& constants) override;
|
||||||
void insertOutputs(std::stringstream &OS, const std::vector<ParamType> &outputs) override;
|
void insertOutputs(std::stringstream& OS, const std::vector<ParamType>& outputs) override;
|
||||||
void insertMainStart(std::stringstream &OS) override;
|
void insertMainStart(std::stringstream& OS) override;
|
||||||
void insertMainEnd(std::stringstream &OS) override;
|
void insertMainEnd(std::stringstream& OS) override;
|
||||||
|
|
||||||
const RSXVertexProgram &rsx_vertex_program;
|
const RSXVertexProgram &rsx_vertex_program;
|
||||||
std::unordered_map<std::string, int> input_locations;
|
std::unordered_map<std::string, int> input_locations;
|
||||||
public:
|
public:
|
||||||
GLVertexDecompilerThread(const RSXVertexProgram &prog, std::string& shader, ParamArray&)
|
GLVertexDecompilerThread(const RSXVertexProgram& prog, std::string& shader, ParamArray&)
|
||||||
: VertexProgramDecompiler(prog)
|
: VertexProgramDecompiler(prog)
|
||||||
, m_shader(shader)
|
, m_shader(shader)
|
||||||
, rsx_vertex_program(prog)
|
, rsx_vertex_program(prog)
|
||||||
|
|||||||
@ -111,33 +111,33 @@ protected:
|
|||||||
/** returns string calling function where arguments are passed via
|
/** returns string calling function where arguments are passed via
|
||||||
* $0 $1 $2 substring.
|
* $0 $1 $2 substring.
|
||||||
*/
|
*/
|
||||||
virtual std::string getFunction(FUNCTION) = 0;
|
virtual std::string getFunction(FUNCTION f) = 0;
|
||||||
|
|
||||||
/** returns string calling comparison function on 2 args passed as strings.
|
/** returns string calling comparison function on 2 args passed as strings.
|
||||||
*/
|
*/
|
||||||
virtual std::string compareFunction(COMPARE, const std::string &, const std::string &) = 0;
|
virtual std::string compareFunction(COMPARE f, std::string_view Op0, std::string_view Op1) = 0;
|
||||||
|
|
||||||
/** Insert header of shader file (eg #version, "system constants"...)
|
/** Insert header of shader file (eg #version, "system constants"...)
|
||||||
*/
|
*/
|
||||||
virtual void insertHeader(std::stringstream &OS) = 0;
|
virtual void insertHeader(std::stringstream& OS) = 0;
|
||||||
/** Insert global declaration of fragments inputs.
|
/** Insert global declaration of fragments inputs.
|
||||||
*/
|
*/
|
||||||
virtual void insertInputs(std::stringstream &OS) = 0;
|
virtual void insertInputs(std::stringstream& OS) = 0;
|
||||||
/** insert global declaration of fragments outputs.
|
/** insert global declaration of fragments outputs.
|
||||||
*/
|
*/
|
||||||
virtual void insertOutputs(std::stringstream &OS) = 0;
|
virtual void insertOutputs(std::stringstream& OS) = 0;
|
||||||
/** insert declaration of shader constants.
|
/** insert declaration of shader constants.
|
||||||
*/
|
*/
|
||||||
virtual void insertConstants(std::stringstream &OS) = 0;
|
virtual void insertConstants(std::stringstream& OS) = 0;
|
||||||
/** insert helper function definitions.
|
/** insert helper function definitions.
|
||||||
*/
|
*/
|
||||||
virtual void insertGlobalFunctions(std::stringstream &OS) = 0;
|
virtual void insertGlobalFunctions(std::stringstream& OS) = 0;
|
||||||
/** insert beginning of main (signature, temporary declaration...)
|
/** insert beginning of main (signature, temporary declaration...)
|
||||||
*/
|
*/
|
||||||
virtual void insertMainStart(std::stringstream &OS) = 0;
|
virtual void insertMainStart(std::stringstream& OS) = 0;
|
||||||
/** insert end of main function (return value, output copy...)
|
/** insert end of main function (return value, output copy...)
|
||||||
*/
|
*/
|
||||||
virtual void insertMainEnd(std::stringstream &OS) = 0;
|
virtual void insertMainEnd(std::stringstream& OS) = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum : u16
|
enum : u16
|
||||||
@ -201,7 +201,7 @@ public:
|
|||||||
device_props;
|
device_props;
|
||||||
|
|
||||||
ParamArray m_parr;
|
ParamArray m_parr;
|
||||||
FragmentProgramDecompiler(const RSXFragmentProgram &prog, u32& size);
|
FragmentProgramDecompiler(const RSXFragmentProgram& prog, u32& size);
|
||||||
FragmentProgramDecompiler(const FragmentProgramDecompiler&) = delete;
|
FragmentProgramDecompiler(const FragmentProgramDecompiler&) = delete;
|
||||||
FragmentProgramDecompiler(FragmentProgramDecompiler&&) = delete;
|
FragmentProgramDecompiler(FragmentProgramDecompiler&&) = delete;
|
||||||
std::string Decompile();
|
std::string Decompile();
|
||||||
|
|||||||
@ -73,7 +73,7 @@ namespace glsl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string compareFunctionImpl(COMPARE f, const std::string &Op0, const std::string &Op1, bool scalar)
|
std::string compareFunctionImpl(COMPARE f, std::string_view Op0, std::string_view Op1, bool scalar)
|
||||||
{
|
{
|
||||||
if (scalar)
|
if (scalar)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -71,7 +71,7 @@ namespace glsl
|
|||||||
|
|
||||||
std::string getFloatTypeNameImpl(usz elementCount);
|
std::string getFloatTypeNameImpl(usz elementCount);
|
||||||
std::string getHalfTypeNameImpl(usz elementCount);
|
std::string getHalfTypeNameImpl(usz elementCount);
|
||||||
std::string compareFunctionImpl(COMPARE f, const std::string &Op0, const std::string &Op1, bool scalar = false);
|
std::string compareFunctionImpl(COMPARE f, std::string_view Op0, std::string_view Op1, bool scalar = false);
|
||||||
void insert_vertex_input_fetch(std::stringstream& OS, glsl_rules rules, bool glsl4_compliant=true);
|
void insert_vertex_input_fetch(std::stringstream& OS, glsl_rules rules, bool glsl4_compliant=true);
|
||||||
void insert_rop_init(std::ostream& OS);
|
void insert_rop_init(std::ostream& OS);
|
||||||
void insert_rop(std::ostream& OS, const shader_properties& props);
|
void insert_rop(std::ostream& OS, const shader_properties& props);
|
||||||
|
|||||||
@ -130,7 +130,7 @@ struct ParamType
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasItem(const std::string& name) const
|
bool HasItem(std::string_view name) const
|
||||||
{
|
{
|
||||||
return std::any_of(items.cbegin(), items.cend(), [&name](const auto& item)
|
return std::any_of(items.cbegin(), items.cend(), [&name](const auto& item)
|
||||||
{
|
{
|
||||||
@ -138,7 +138,7 @@ struct ParamType
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReplaceOrInsert(const std::string& name, const ParamItem& item)
|
bool ReplaceOrInsert(std::string_view name, const ParamItem& item)
|
||||||
{
|
{
|
||||||
if (HasItem(name))
|
if (HasItem(name))
|
||||||
{
|
{
|
||||||
@ -168,7 +168,7 @@ struct ParamArray
|
|||||||
{
|
{
|
||||||
std::vector<ParamType> params[PF_PARAM_COUNT];
|
std::vector<ParamType> params[PF_PARAM_COUNT];
|
||||||
|
|
||||||
ParamType* SearchParam(const ParamFlag &flag, const std::string& type)
|
ParamType* SearchParam(const ParamFlag& flag, std::string_view type)
|
||||||
{
|
{
|
||||||
for (auto& param : params[flag])
|
for (auto& param : params[flag])
|
||||||
{
|
{
|
||||||
@ -179,7 +179,7 @@ struct ParamArray
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasParamTypeless(const ParamFlag flag, const std::string& name) const
|
bool HasParamTypeless(const ParamFlag flag, std::string_view name) const
|
||||||
{
|
{
|
||||||
const auto& p = params[flag];
|
const auto& p = params[flag];
|
||||||
return std::any_of(p.cbegin(), p.cend(), [&name](const auto& param)
|
return std::any_of(p.cbegin(), p.cend(), [&name](const auto& param)
|
||||||
@ -188,7 +188,7 @@ struct ParamArray
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasParam(const ParamFlag flag, const std::string& type, const std::string& name)
|
bool HasParam(const ParamFlag flag, std::string_view type, std::string_view name)
|
||||||
{
|
{
|
||||||
const ParamType* t = SearchParam(flag, type);
|
const ParamType* t = SearchParam(flag, type);
|
||||||
return t && t->HasItem(name);
|
return t && t->HasItem(name);
|
||||||
|
|||||||
@ -99,35 +99,35 @@ protected:
|
|||||||
/** returns string calling function where arguments are passed via
|
/** returns string calling function where arguments are passed via
|
||||||
* $0 $1 $2 substring.
|
* $0 $1 $2 substring.
|
||||||
*/
|
*/
|
||||||
virtual std::string getFunction(FUNCTION) = 0;
|
virtual std::string getFunction(FUNCTION f) = 0;
|
||||||
|
|
||||||
/** returns string calling comparison function on 2 args passed as strings.
|
/** returns string calling comparison function on 2 args passed as strings.
|
||||||
*/
|
*/
|
||||||
virtual std::string compareFunction(COMPARE, const std::string &, const std::string &, bool scalar = false) = 0;
|
virtual std::string compareFunction(COMPARE f, std::string_view Op0, std::string_view Op1, bool scalar = false) = 0;
|
||||||
|
|
||||||
/** Insert header of shader file (eg #version, "system constants"...)
|
/** Insert header of shader file (eg #version, "system constants"...)
|
||||||
*/
|
*/
|
||||||
virtual void insertHeader(std::stringstream &OS) = 0;
|
virtual void insertHeader(std::stringstream& OS) = 0;
|
||||||
|
|
||||||
/** Insert vertex declaration.
|
/** Insert vertex declaration.
|
||||||
*/
|
*/
|
||||||
virtual void insertInputs(std::stringstream &OS, const std::vector<ParamType> &inputs) = 0;
|
virtual void insertInputs(std::stringstream& OS, const std::vector<ParamType>& inputs) = 0;
|
||||||
|
|
||||||
/** insert global declaration of vertex shader outputs.
|
/** insert global declaration of vertex shader outputs.
|
||||||
*/
|
*/
|
||||||
virtual void insertConstants(std::stringstream &OS, const std::vector<ParamType> &constants) = 0;
|
virtual void insertConstants(std::stringstream& OS, const std::vector<ParamType>& constants) = 0;
|
||||||
|
|
||||||
/** insert declaration of shader constants.
|
/** insert declaration of shader constants.
|
||||||
*/
|
*/
|
||||||
virtual void insertOutputs(std::stringstream &OS, const std::vector<ParamType> &outputs) = 0;
|
virtual void insertOutputs(std::stringstream& OS, const std::vector<ParamType>& outputs) = 0;
|
||||||
|
|
||||||
/** insert beginning of main (signature, temporary declaration...)
|
/** insert beginning of main (signature, temporary declaration...)
|
||||||
*/
|
*/
|
||||||
virtual void insertMainStart(std::stringstream &OS) = 0;
|
virtual void insertMainStart(std::stringstream& OS) = 0;
|
||||||
|
|
||||||
/** insert end of main function (return value, output copy...)
|
/** insert end of main function (return value, output copy...)
|
||||||
*/
|
*/
|
||||||
virtual void insertMainEnd(std::stringstream &OS) = 0;
|
virtual void insertMainEnd(std::stringstream& OS) = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
struct
|
struct
|
||||||
|
|||||||
@ -21,7 +21,7 @@ std::string VKFragmentDecompilerThread::getFunction(FUNCTION f)
|
|||||||
return glsl::getFunctionImpl(f);
|
return glsl::getFunctionImpl(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string VKFragmentDecompilerThread::compareFunction(COMPARE f, const std::string &Op0, const std::string &Op1)
|
std::string VKFragmentDecompilerThread::compareFunction(COMPARE f, std::string_view Op0, std::string_view Op1)
|
||||||
{
|
{
|
||||||
return glsl::compareFunctionImpl(f, Op0, Op1);
|
return glsl::compareFunctionImpl(f, Op0, Op1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,8 +37,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
std::string getFloatTypeName(usz elementCount) override;
|
std::string getFloatTypeName(usz elementCount) override;
|
||||||
std::string getHalfTypeName(usz elementCount) override;
|
std::string getHalfTypeName(usz elementCount) override;
|
||||||
std::string getFunction(FUNCTION) override;
|
std::string getFunction(FUNCTION f) override;
|
||||||
std::string compareFunction(COMPARE, const std::string&, const std::string&) override;
|
std::string compareFunction(COMPARE f, std::string_view Op0, std::string_view Op1) override;
|
||||||
|
|
||||||
void insertHeader(std::stringstream &OS) override;
|
void insertHeader(std::stringstream &OS) override;
|
||||||
void insertInputs(std::stringstream &OS) override;
|
void insertInputs(std::stringstream &OS) override;
|
||||||
|
|||||||
@ -282,7 +282,7 @@ namespace vk
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool program::has_uniform(program_input_type type, const std::string& uniform_name)
|
bool program::has_uniform(program_input_type type, std::string_view uniform_name)
|
||||||
{
|
{
|
||||||
for (auto& set : m_sets)
|
for (auto& set : m_sets)
|
||||||
{
|
{
|
||||||
@ -296,7 +296,7 @@ namespace vk
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<u32, u32> program::get_uniform_location(::glsl::program_domain domain, program_input_type type, const std::string& uniform_name)
|
std::pair<u32, u32> program::get_uniform_location(::glsl::program_domain domain, program_input_type type, std::string_view uniform_name)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < ::size32(m_sets); ++i)
|
for (unsigned i = 0; i < ::size32(m_sets); ++i)
|
||||||
{
|
{
|
||||||
@ -632,7 +632,7 @@ namespace vk
|
|||||||
|
|
||||||
std::unordered_map<u32, VkDescriptorType> descriptor_type_map;
|
std::unordered_map<u32, VkDescriptorType> descriptor_type_map;
|
||||||
|
|
||||||
auto descriptor_count = [](const std::string& name) -> u32
|
auto descriptor_count = [](std::string_view name) -> u32
|
||||||
{
|
{
|
||||||
const auto start = name.find_last_of("[");
|
const auto start = name.find_last_of("[");
|
||||||
if (start == std::string::npos)
|
if (start == std::string::npos)
|
||||||
@ -643,8 +643,8 @@ namespace vk
|
|||||||
const auto end = name.find_last_of("]");
|
const auto end = name.find_last_of("]");
|
||||||
ensure(end != std::string::npos && start < end, "Invalid variable name");
|
ensure(end != std::string::npos && start < end, "Invalid variable name");
|
||||||
|
|
||||||
const std::string array_size = name.substr(start + 1, end - start - 1);
|
const std::string_view array_size = name.substr(start + 1, end - start - 1);
|
||||||
if (const auto count = std::atoi(array_size.c_str());
|
if (const auto count = std::atoi(array_size.data());
|
||||||
count > 0)
|
count > 0)
|
||||||
{
|
{
|
||||||
return count;
|
return count;
|
||||||
|
|||||||
@ -221,13 +221,12 @@ namespace vk
|
|||||||
program& link(bool separate_stages);
|
program& link(bool separate_stages);
|
||||||
program& bind(const vk::command_buffer& cmd, VkPipelineBindPoint bind_point);
|
program& bind(const vk::command_buffer& cmd, VkPipelineBindPoint bind_point);
|
||||||
|
|
||||||
bool has_uniform(program_input_type type, const std::string &uniform_name);
|
bool has_uniform(program_input_type type, std::string_view uniform_name);
|
||||||
std::pair<u32, u32> get_uniform_location(::glsl::program_domain domain, program_input_type type, const std::string& uniform_name);
|
std::pair<u32, u32> get_uniform_location(::glsl::program_domain domain, program_input_type type, std::string_view uniform_name);
|
||||||
|
|
||||||
void bind_uniform(const VkDescriptorImageInfoEx& image_descriptor, u32 set_id, u32 binding_point);
|
void bind_uniform(const VkDescriptorImageInfoEx& image_descriptor, u32 set_id, u32 binding_point);
|
||||||
void bind_uniform(const VkDescriptorBufferInfoEx& buffer_descriptor, u32 set_id, u32 binding_point);
|
void bind_uniform(const VkDescriptorBufferInfoEx& buffer_descriptor, u32 set_id, u32 binding_point);
|
||||||
void bind_uniform(const VkDescriptorBufferViewEx& buffer_view, u32 set_id, u32 binding_point);
|
void bind_uniform(const VkDescriptorBufferViewEx& buffer_view, u32 set_id, u32 binding_point);
|
||||||
void bind_uniform(const VkDescriptorBufferViewEx& buffer_view, ::glsl::program_domain domain, program_input_type type, const std::string &binding_name);
|
|
||||||
|
|
||||||
void bind_uniform_array(const std::span<const VkDescriptorImageInfoEx>& image_descriptors,u32 set_id, u32 binding_point);
|
void bind_uniform_array(const std::span<const VkDescriptorImageInfoEx>& image_descriptors,u32 set_id, u32 binding_point);
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ std::string VKVertexDecompilerThread::getFunction(FUNCTION f)
|
|||||||
return glsl::getFunctionImpl(f);
|
return glsl::getFunctionImpl(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string VKVertexDecompilerThread::compareFunction(COMPARE f, const std::string &Op0, const std::string &Op1, bool scalar)
|
std::string VKVertexDecompilerThread::compareFunction(COMPARE f, std::string_view Op0, std::string_view Op1, bool scalar)
|
||||||
{
|
{
|
||||||
return glsl::compareFunctionImpl(f, Op0, Op1, scalar);
|
return glsl::compareFunctionImpl(f, Op0, Op1, scalar);
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ void VKVertexDecompilerThread::prepareBindingTable()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VKVertexDecompilerThread::insertHeader(std::stringstream &OS)
|
void VKVertexDecompilerThread::insertHeader(std::stringstream& OS)
|
||||||
{
|
{
|
||||||
prepareBindingTable();
|
prepareBindingTable();
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ void VKVertexDecompilerThread::insertInputs(std::stringstream& OS, const std::ve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VKVertexDecompilerThread::insertConstants(std::stringstream & OS, const std::vector<ParamType> & constants)
|
void VKVertexDecompilerThread::insertConstants(std::stringstream& OS, const std::vector<ParamType>& constants)
|
||||||
{
|
{
|
||||||
vk::glsl::program_input in
|
vk::glsl::program_input in
|
||||||
{
|
{
|
||||||
@ -330,7 +330,7 @@ void VKVertexDecompilerThread::insertFSExport(std::stringstream& OS)
|
|||||||
"}\n\n";
|
"}\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void VKVertexDecompilerThread::insertMainStart(std::stringstream & OS)
|
void VKVertexDecompilerThread::insertMainStart(std::stringstream& OS)
|
||||||
{
|
{
|
||||||
glsl::shader_properties properties2{};
|
glsl::shader_properties properties2{};
|
||||||
properties2.domain = glsl::glsl_vertex_program;
|
properties2.domain = glsl::glsl_vertex_program;
|
||||||
@ -388,9 +388,9 @@ void VKVertexDecompilerThread::insertMainStart(std::stringstream & OS)
|
|||||||
OS << "{\n";
|
OS << "{\n";
|
||||||
|
|
||||||
//Declare temporary registers, ignoring those mapped to outputs
|
//Declare temporary registers, ignoring those mapped to outputs
|
||||||
for (const ParamType &PT : m_parr.params[PF_PARAM_NONE])
|
for (const ParamType& PT : m_parr.params[PF_PARAM_NONE])
|
||||||
{
|
{
|
||||||
for (const ParamItem &PI : PT.items)
|
for (const ParamItem& PI : PT.items)
|
||||||
{
|
{
|
||||||
if (PI.name.starts_with("dst_reg"))
|
if (PI.name.starts_with("dst_reg"))
|
||||||
continue;
|
continue;
|
||||||
@ -403,9 +403,9 @@ void VKVertexDecompilerThread::insertMainStart(std::stringstream & OS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const ParamType &PT : m_parr.params[PF_PARAM_IN])
|
for (const ParamType& PT : m_parr.params[PF_PARAM_IN])
|
||||||
{
|
{
|
||||||
for (const ParamItem &PI : PT.items)
|
for (const ParamItem& PI : PT.items)
|
||||||
{
|
{
|
||||||
OS << " vec4 " << PI.name << "= read_location(" << std::to_string(PI.location) << ");\n";
|
OS << " vec4 " << PI.name << "= read_location(" << std::to_string(PI.location) << ");\n";
|
||||||
}
|
}
|
||||||
@ -414,7 +414,7 @@ void VKVertexDecompilerThread::insertMainStart(std::stringstream & OS)
|
|||||||
OS << "\nuint xform_constants_offset = get_draw_params().xform_constants_offset;\n\n";
|
OS << "\nuint xform_constants_offset = get_draw_params().xform_constants_offset;\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void VKVertexDecompilerThread::insertMainEnd(std::stringstream & OS)
|
void VKVertexDecompilerThread::insertMainEnd(std::stringstream& OS)
|
||||||
{
|
{
|
||||||
OS << "}\n\n";
|
OS << "}\n\n";
|
||||||
|
|
||||||
|
|||||||
@ -25,21 +25,21 @@ struct VKVertexDecompilerThread : public VertexProgramDecompiler
|
|||||||
protected:
|
protected:
|
||||||
std::string getFloatTypeName(usz elementCount) override;
|
std::string getFloatTypeName(usz elementCount) override;
|
||||||
std::string getIntTypeName(usz elementCount) override;
|
std::string getIntTypeName(usz elementCount) override;
|
||||||
std::string getFunction(FUNCTION) override;
|
std::string getFunction(FUNCTION f) override;
|
||||||
std::string compareFunction(COMPARE, const std::string&, const std::string&, bool scalar) override;
|
std::string compareFunction(COMPARE f, std::string_view Op0, std::string_view Op1, bool scalar) override;
|
||||||
|
|
||||||
void insertHeader(std::stringstream &OS) override;
|
void insertHeader(std::stringstream& OS) override;
|
||||||
void insertInputs(std::stringstream &OS, const std::vector<ParamType> &inputs) override;
|
void insertInputs(std::stringstream& OS, const std::vector<ParamType>& inputs) override;
|
||||||
void insertConstants(std::stringstream &OS, const std::vector<ParamType> &constants) override;
|
void insertConstants(std::stringstream& OS, const std::vector<ParamType>& constants) override;
|
||||||
void insertOutputs(std::stringstream &OS, const std::vector<ParamType> &outputs) override;
|
void insertOutputs(std::stringstream& OS, const std::vector<ParamType>& outputs) override;
|
||||||
void insertMainStart(std::stringstream &OS) override;
|
void insertMainStart(std::stringstream& OS) override;
|
||||||
void insertMainEnd(std::stringstream &OS) override;
|
void insertMainEnd(std::stringstream& OS) override;
|
||||||
|
|
||||||
void prepareBindingTable();
|
void prepareBindingTable();
|
||||||
|
|
||||||
const RSXVertexProgram &rsx_vertex_program;
|
const RSXVertexProgram &rsx_vertex_program;
|
||||||
public:
|
public:
|
||||||
VKVertexDecompilerThread(const RSXVertexProgram &prog, std::string& shader, ParamArray&, class VKVertexProgram &dst)
|
VKVertexDecompilerThread(const RSXVertexProgram& prog, std::string& shader, ParamArray&, class VKVertexProgram& dst)
|
||||||
: VertexProgramDecompiler(prog)
|
: VertexProgramDecompiler(prog)
|
||||||
, m_shader(shader)
|
, m_shader(shader)
|
||||||
, vk_prog(&dst)
|
, vk_prog(&dst)
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace rsx::assembler
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
static FlowGraph CFG_from_source(const std::string& asm_)
|
static FlowGraph CFG_from_source(std::string_view asm_)
|
||||||
{
|
{
|
||||||
auto ir = FPIR::from_source(asm_);
|
auto ir = FPIR::from_source(asm_);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user