mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 12:05:23 +00:00
d3d12: Fix linkage between VS and PS
This commit is contained in:
parent
ee3e5cfe1f
commit
a276391e87
4 changed files with 40 additions and 26 deletions
|
@ -24,6 +24,7 @@ D3D12GSRender::D3D12GSRender()
|
|||
m_constantsBufferSize = 0;
|
||||
m_constantsBufferIndex = 0;
|
||||
m_currentScaleOffsetBufferIndex = 0;
|
||||
constantsFragmentSize = 0;
|
||||
// Enable d3d debug layer
|
||||
Microsoft::WRL::ComPtr<ID3D12Debug> debugInterface;
|
||||
D3D12GetDebugInterface(IID_PPV_ARGS(&debugInterface));
|
||||
|
@ -432,16 +433,15 @@ void D3D12GSRender::FillPixelShaderConstantsBuffer()
|
|||
for (const RSXTransformConstant& c : m_fragment_constants)
|
||||
{
|
||||
u32 id = c.id - m_cur_fragment_prog->offset;
|
||||
|
||||
float vector[] = { c.x, c.y, c.z, c.w };
|
||||
memcpy(constantsBufferMap, vector, 4 * sizeof(float));
|
||||
index++;
|
||||
}
|
||||
float vector[] = { 0.,1.,0.,0. };
|
||||
// memcpy((char*)constantsBufferMap, vector, 4 * sizeof(float));
|
||||
index++;
|
||||
m_constantsFragmentBuffer->Unmap(0, nullptr);
|
||||
|
||||
D3D12_CONSTANT_BUFFER_VIEW_DESC constantBufferViewDesc = {};
|
||||
constantBufferViewDesc.BufferLocation = m_constantsFragmentBuffer->GetGPUVirtualAddress();
|
||||
constantBufferViewDesc.SizeInBytes = (UINT) index * 4 * sizeof(float);
|
||||
constantBufferViewDesc.SizeInBytes = (UINT)256;
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE Handle = m_constantsBufferDescriptorsHeap->GetCPUDescriptorHandleForHeapStart();
|
||||
Handle.ptr += m_constantsBufferIndex * m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
|
||||
m_device->CreateConstantBufferView(&constantBufferViewDesc, Handle);
|
||||
|
@ -1030,5 +1030,6 @@ void D3D12GSRender::Flip()
|
|||
m_constantsBufferSize = 0;
|
||||
m_constantsBufferIndex = 0;
|
||||
m_currentScaleOffsetBufferIndex = 0;
|
||||
constantsFragmentSize = 0;
|
||||
}
|
||||
#endif
|
|
@ -55,6 +55,7 @@ private:
|
|||
|
||||
ID3D12Resource *m_indexBuffer, *m_vertexBuffer[m_vertex_count];
|
||||
ID3D12Resource *m_constantsVertexBuffer, *m_constantsFragmentBuffer;
|
||||
size_t constantsFragmentSize;
|
||||
ID3D12DescriptorHeap *m_constantsBufferDescriptorsHeap;
|
||||
size_t m_constantsBufferSize, m_constantsBufferIndex;
|
||||
|
||||
|
|
|
@ -383,18 +383,24 @@ void FragmentDecompiler::insertHeader(std::stringstream & OS)
|
|||
|
||||
void FragmentDecompiler::insertIntputs(std::stringstream & OS)
|
||||
{
|
||||
OS << "struct PSInput" << std::endl;
|
||||
OS << "struct PixelInput" << std::endl;
|
||||
OS << "{" << std::endl;
|
||||
OS << " float4 dst_reg0 : SV_POSITION;" << std::endl;
|
||||
size_t index = 0;
|
||||
for (ParamType PT : m_parr.params[PARAM_IN])
|
||||
{
|
||||
for (ParamItem PI : PT.items)
|
||||
{
|
||||
OS << " " << PT.type << " " << PI.name << " : TEXCOORD" << index << ";" << std::endl;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
OS << " float4 Position : SV_POSITION;" << std::endl;
|
||||
OS << " float4 diff_color : COLOR0;" << std::endl;
|
||||
OS << " float4 spec_color : COLOR1;" << std::endl;
|
||||
OS << " float4 dst_reg3 : COLOR2;" << std::endl;
|
||||
OS << " float4 dst_reg4 : COLOR3;" << std::endl;
|
||||
OS << " float fogc : FOG;" << std::endl;
|
||||
OS << " float4 dummy : COLOR4;" << std::endl;
|
||||
OS << " float4 tc0 : TEXCOORD0;" << std::endl;
|
||||
OS << " float4 tc1 : TEXCOORD1;" << std::endl;
|
||||
OS << " float4 tc2 : TEXCOORD2;" << std::endl;
|
||||
OS << " float4 tc3 : TEXCOORD3;" << std::endl;
|
||||
OS << " float4 tc4 : TEXCOORD4;" << std::endl;
|
||||
OS << " float4 tc5 : TEXCOORD5;" << std::endl;
|
||||
OS << " float4 tc6 : TEXCOORD6;" << std::endl;
|
||||
OS << " float4 tc7 : TEXCOORD7;" << std::endl;
|
||||
OS << " float4 tc8 : TEXCOORD8;" << std::endl;
|
||||
OS << "};" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -412,7 +418,7 @@ void FragmentDecompiler::insertConstants(std::stringstream & OS)
|
|||
|
||||
void FragmentDecompiler::insertMainStart(std::stringstream & OS)
|
||||
{
|
||||
OS << "float4 main(PSInput In) : SV_TARGET" << std::endl;
|
||||
OS << "float4 main(PixelInput In) : SV_TARGET" << std::endl;
|
||||
OS << "{" << std::endl;
|
||||
OS << " float4 r0;" << std::endl;
|
||||
for (ParamType PT : m_parr.params[PARAM_IN])
|
||||
|
|
|
@ -479,15 +479,21 @@ void VertexDecompiler::insertOutputs(std::stringstream & OS, const std::vector<P
|
|||
OS << "struct PixelInput" << std::endl;
|
||||
OS << "{" << std::endl;
|
||||
OS << " float4 dst_reg0 : SV_POSITION;" << std::endl;
|
||||
size_t outputIndex = 0;
|
||||
for (const ParamType PT : outputs)
|
||||
{
|
||||
for (const ParamItem &PI : PT.items)
|
||||
{
|
||||
if (PI.name == "dst_reg0") continue;
|
||||
OS << " " << PT.type << " " << PI.name << ": TEXCOORD" << outputIndex++ << ";" << std::endl;
|
||||
}
|
||||
}
|
||||
OS << " float4 dst_reg1 : COLOR0;" << std::endl;
|
||||
OS << " float4 dst_reg2 : COLOR1;" << std::endl;
|
||||
OS << " float4 dst_reg3 : COLOR2;" << std::endl;
|
||||
OS << " float4 dst_reg4 : COLOR3;" << std::endl;
|
||||
OS << " float dst_reg5 : FOG;" << std::endl;
|
||||
OS << " float4 dst_reg6 : COLOR4;" << std::endl;
|
||||
OS << " float4 dst_reg7 : TEXCOORD0;" << std::endl;
|
||||
OS << " float4 dst_reg8 : TEXCOORD1;" << std::endl;
|
||||
OS << " float4 dst_reg9 : TEXCOORD2;" << std::endl;
|
||||
OS << " float4 dst_reg10 : TEXCOORD3;" << std::endl;
|
||||
OS << " float4 dst_reg11 : TEXCOORD4;" << std::endl;
|
||||
OS << " float4 dst_reg12 : TEXCOORD5;" << std::endl;
|
||||
OS << " float4 dst_reg13 : TEXCOORD6;" << std::endl;
|
||||
OS << " float4 dst_reg14 : TEXCOORD7;" << std::endl;
|
||||
OS << " float4 dst_reg15 : TEXCOORD8;" << std::endl;
|
||||
OS << "};" << std::endl;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue