2012-11-15 00:39:56 +01:00
|
|
|
#pragma once
|
2015-05-19 19:43:22 +02:00
|
|
|
#include "../Common/VertexProgramDecompiler.h"
|
2014-08-04 01:33:57 +02:00
|
|
|
#include "Emu/RSX/RSXVertexProgram.h"
|
2012-11-15 00:39:56 +01:00
|
|
|
|
2016-10-18 09:57:28 +02:00
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
GL_VP_FORCE_ATTRIB_SCALING = 1, //Scale vertex read result
|
|
|
|
|
GL_VP_ATTRIB_S16_INT = (1 << 1), //Attrib is a signed 16-bit integer
|
|
|
|
|
GL_VP_ATTRIB_S32_INT = (1 << 2), //Attrib is a signed 32-bit integer
|
|
|
|
|
|
|
|
|
|
GL_VP_SINT_MASK = (GL_VP_ATTRIB_S16_INT|GL_VP_ATTRIB_S32_INT)
|
|
|
|
|
};
|
|
|
|
|
|
2015-07-01 00:25:52 +02:00
|
|
|
struct GLVertexDecompilerThread : public VertexProgramDecompiler
|
2012-11-15 00:39:56 +01:00
|
|
|
{
|
2015-05-19 19:43:22 +02:00
|
|
|
std::string &m_shader;
|
|
|
|
|
protected:
|
2019-06-08 09:49:47 +02:00
|
|
|
std::string getFloatTypeName(size_t elementCount) override;
|
2015-10-05 19:30:06 +02:00
|
|
|
std::string getIntTypeName(size_t 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-01-28 18:01:10 +01:00
|
|
|
|
|
|
|
|
const RSXVertexProgram &rsx_vertex_program;
|
2017-07-31 13:38:28 +02:00
|
|
|
std::unordered_map<std::string, int> input_locations;
|
2015-05-19 19:43:22 +02:00
|
|
|
public:
|
2017-06-18 16:53:02 +02:00
|
|
|
GLVertexDecompilerThread(const RSXVertexProgram &prog, std::string& shader, ParamArray&)
|
2016-01-10 20:09:56 +01:00
|
|
|
: VertexProgramDecompiler(prog)
|
2015-07-01 00:25:52 +02:00
|
|
|
, m_shader(shader)
|
2016-01-28 18:01:10 +01:00
|
|
|
, rsx_vertex_program(prog)
|
2012-11-15 00:39:56 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-01 00:25:52 +02:00
|
|
|
void Task();
|
2012-11-15 00:39:56 +01:00
|
|
|
};
|
|
|
|
|
|
2014-06-01 08:41:57 +02:00
|
|
|
class GLVertexProgram
|
2013-11-09 22:29:49 +01:00
|
|
|
{
|
2014-06-01 08:41:57 +02:00
|
|
|
public:
|
2013-11-09 22:29:49 +01:00
|
|
|
GLVertexProgram();
|
|
|
|
|
~GLVertexProgram();
|
2012-11-15 00:39:56 +01:00
|
|
|
|
2015-05-19 19:43:22 +02:00
|
|
|
ParamArray parr;
|
2015-07-01 00:25:52 +02:00
|
|
|
u32 id = 0;
|
2014-04-01 02:33:55 +02:00
|
|
|
std::string shader;
|
2017-07-31 13:38:28 +02:00
|
|
|
bool interleaved;
|
2012-11-15 00:39:56 +01:00
|
|
|
|
2016-01-10 20:09:56 +01:00
|
|
|
void Decompile(const RSXVertexProgram& prog);
|
2012-11-15 00:39:56 +01:00
|
|
|
void Compile();
|
2014-06-01 08:41:57 +02:00
|
|
|
|
|
|
|
|
private:
|
2012-11-15 00:39:56 +01:00
|
|
|
void Delete();
|
|
|
|
|
};
|