mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-03-11 16:05:23 +01:00
continue working on input less
This commit is contained in:
parent
d9f4b4b600
commit
73a4555c9d
|
|
@ -67,7 +67,7 @@ private:
|
|||
RSXVertexProgram vertex_program;
|
||||
RSXFragmentProgram fragment_program;
|
||||
PipelineStateObjectCache m_pso_cache;
|
||||
std::tuple<ComPtr<ID3D12PipelineState>, std::vector<size_t>, size_t> m_current_pso;
|
||||
std::tuple<ComPtr<ID3D12PipelineState>, size_t, size_t> m_current_pso;
|
||||
|
||||
struct
|
||||
{
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public:
|
|||
ComPtr<ID3DBlob> bytecode;
|
||||
// For debugging
|
||||
std::string content;
|
||||
std::vector<size_t> vertex_shader_inputs;
|
||||
size_t vertex_shader_input_count;
|
||||
std::vector<size_t> FragmentConstantOffsetCache;
|
||||
size_t m_textureCount;
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ struct D3D12Traits
|
|||
{
|
||||
using vertex_program_type = Shader;
|
||||
using fragment_program_type = Shader;
|
||||
using pipeline_storage_type = std::tuple<ComPtr<ID3D12PipelineState>, std::vector<size_t>, size_t>;
|
||||
using pipeline_storage_type = std::tuple<ComPtr<ID3D12PipelineState>, size_t, size_t>;
|
||||
using pipeline_properties = D3D12PipelineProperties;
|
||||
|
||||
static
|
||||
|
|
@ -140,15 +140,15 @@ struct D3D12Traits
|
|||
D3D12VertexProgramDecompiler VS(RSXVP);
|
||||
std::string shaderCode = VS.Decompile();
|
||||
vertexProgramData.Compile(shaderCode, Shader::SHADER_TYPE::SHADER_TYPE_VERTEX);
|
||||
vertexProgramData.vertex_shader_inputs = VS.input_slots;
|
||||
vertexProgramData.vertex_shader_input_count = RSXVP.rsx_vertex_inputs.size();
|
||||
fs::file(fs::get_config_dir() + "VertexProgram" + std::to_string(ID) + ".hlsl", fom::rewrite).write(shaderCode);
|
||||
vertexProgramData.id = (u32)ID;
|
||||
}
|
||||
|
||||
static
|
||||
pipeline_storage_type build_pipeline(
|
||||
const vertex_program_type &vertexProgramData, const fragment_program_type &fragmentProgramData, const pipeline_properties &pipelineProperties,
|
||||
ID3D12Device *device, gsl::span<ComPtr<ID3D12RootSignature>, 17, 16> root_signatures)
|
||||
pipeline_storage_type build_pipeline(
|
||||
const vertex_program_type &vertexProgramData, const fragment_program_type &fragmentProgramData, const pipeline_properties &pipelineProperties,
|
||||
ID3D12Device *device, gsl::span<ComPtr<ID3D12RootSignature>, 17, 16> root_signatures)
|
||||
{
|
||||
std::tuple<ID3D12PipelineState *, std::vector<size_t>, size_t> result = {};
|
||||
D3D12_GRAPHICS_PIPELINE_STATE_DESC graphicPipelineStateDesc = {};
|
||||
|
|
@ -163,7 +163,7 @@ struct D3D12Traits
|
|||
graphicPipelineStateDesc.PS.BytecodeLength = fragmentProgramData.bytecode->GetBufferSize();
|
||||
graphicPipelineStateDesc.PS.pShaderBytecode = fragmentProgramData.bytecode->GetBufferPointer();
|
||||
|
||||
graphicPipelineStateDesc.pRootSignature = root_signatures[fragmentProgramData.m_textureCount][vertexProgramData.vertex_shader_inputs.size() - 1].Get();
|
||||
graphicPipelineStateDesc.pRootSignature = root_signatures[fragmentProgramData.m_textureCount][vertexProgramData.vertex_shader_input_count - 1].Get();
|
||||
|
||||
graphicPipelineStateDesc.BlendState = pipelineProperties.Blend;
|
||||
graphicPipelineStateDesc.DepthStencilState = pipelineProperties.DepthStencil;
|
||||
|
|
@ -186,7 +186,7 @@ struct D3D12Traits
|
|||
|
||||
std::wstring name = L"PSO_" + std::to_wstring(vertexProgramData.id) + L"_" + std::to_wstring(fragmentProgramData.id);
|
||||
pso->SetName(name.c_str());
|
||||
return std::make_tuple(pso, vertexProgramData.vertex_shader_inputs, fragmentProgramData.m_textureCount);
|
||||
return std::make_tuple(pso, vertexProgramData.vertex_shader_input_count, fragmentProgramData.m_textureCount);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ void D3D12VertexProgramDecompiler::insertInputs(std::stringstream & OS, const st
|
|||
for (const ParamItem &PI : PT.items)
|
||||
{
|
||||
input_data.push_back(std::make_tuple(PI.location, PI.name));
|
||||
input_slots.push_back(PI.location);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +168,19 @@ void D3D12VertexProgramDecompiler::insertMainStart(std::stringstream & OS)
|
|||
for (const ParamType PT : m_parr.params[PF_PARAM_IN])
|
||||
{
|
||||
for (const ParamItem &PI : PT.items)
|
||||
OS << " " << PT.type << " " << PI.name << " = " << PI.name << "_buffer.Load(vertex_id);" << std::endl;
|
||||
{
|
||||
for (const auto &real_input : rsx_vertex_program.rsx_vertex_inputs)
|
||||
{
|
||||
if (real_input.location != PI.location)
|
||||
continue;
|
||||
if (!real_input.is_array)
|
||||
{
|
||||
OS << " " << PT.type << " " << PI.name << " = " << PI.name << "_buffer.Load(0);\n";
|
||||
continue;
|
||||
}
|
||||
OS << " " << PT.type << " " << PI.name << " = " << PI.name << "_buffer.Load(vertex_id);\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +200,7 @@ void D3D12VertexProgramDecompiler::insertMainEnd(std::stringstream & OS)
|
|||
}
|
||||
|
||||
D3D12VertexProgramDecompiler::D3D12VertexProgramDecompiler(const RSXVertexProgram &prog) :
|
||||
VertexProgramDecompiler(prog)
|
||||
VertexProgramDecompiler(prog), rsx_vertex_program(prog)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ protected:
|
|||
virtual void insertOutputs(std::stringstream &OS, const std::vector<ParamType> &outputs);
|
||||
virtual void insertMainStart(std::stringstream &OS);
|
||||
virtual void insertMainEnd(std::stringstream &OS);
|
||||
|
||||
const RSXVertexProgram &rsx_vertex_program;
|
||||
public:
|
||||
std::vector<size_t> input_slots;
|
||||
D3D12VertexProgramDecompiler(const RSXVertexProgram &prog);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue