mirror of https://github.com/RPCS3/rpcs3.git
d3d12: Fix linkage between VS and PS
This commit is contained in:
parent
ee3e5cfe1f
commit
a276391e87
|
@ -24,6 +24,7 @@ D3D12GSRender::D3D12GSRender()
|
||||||
m_constantsBufferSize = 0;
|
m_constantsBufferSize = 0;
|
||||||
m_constantsBufferIndex = 0;
|
m_constantsBufferIndex = 0;
|
||||||
m_currentScaleOffsetBufferIndex = 0;
|
m_currentScaleOffsetBufferIndex = 0;
|
||||||
|
constantsFragmentSize = 0;
|
||||||
// Enable d3d debug layer
|
// Enable d3d debug layer
|
||||||
Microsoft::WRL::ComPtr<ID3D12Debug> debugInterface;
|
Microsoft::WRL::ComPtr<ID3D12Debug> debugInterface;
|
||||||
D3D12GetDebugInterface(IID_PPV_ARGS(&debugInterface));
|
D3D12GetDebugInterface(IID_PPV_ARGS(&debugInterface));
|
||||||
|
@ -432,16 +433,15 @@ void D3D12GSRender::FillPixelShaderConstantsBuffer()
|
||||||
for (const RSXTransformConstant& c : m_fragment_constants)
|
for (const RSXTransformConstant& c : m_fragment_constants)
|
||||||
{
|
{
|
||||||
u32 id = c.id - m_cur_fragment_prog->offset;
|
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);
|
m_constantsFragmentBuffer->Unmap(0, nullptr);
|
||||||
|
|
||||||
D3D12_CONSTANT_BUFFER_VIEW_DESC constantBufferViewDesc = {};
|
D3D12_CONSTANT_BUFFER_VIEW_DESC constantBufferViewDesc = {};
|
||||||
constantBufferViewDesc.BufferLocation = m_constantsFragmentBuffer->GetGPUVirtualAddress();
|
constantBufferViewDesc.BufferLocation = m_constantsFragmentBuffer->GetGPUVirtualAddress();
|
||||||
constantBufferViewDesc.SizeInBytes = (UINT) index * 4 * sizeof(float);
|
constantBufferViewDesc.SizeInBytes = (UINT)256;
|
||||||
D3D12_CPU_DESCRIPTOR_HANDLE Handle = m_constantsBufferDescriptorsHeap->GetCPUDescriptorHandleForHeapStart();
|
D3D12_CPU_DESCRIPTOR_HANDLE Handle = m_constantsBufferDescriptorsHeap->GetCPUDescriptorHandleForHeapStart();
|
||||||
Handle.ptr += m_constantsBufferIndex * m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
|
Handle.ptr += m_constantsBufferIndex * m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
|
||||||
m_device->CreateConstantBufferView(&constantBufferViewDesc, Handle);
|
m_device->CreateConstantBufferView(&constantBufferViewDesc, Handle);
|
||||||
|
@ -1030,5 +1030,6 @@ void D3D12GSRender::Flip()
|
||||||
m_constantsBufferSize = 0;
|
m_constantsBufferSize = 0;
|
||||||
m_constantsBufferIndex = 0;
|
m_constantsBufferIndex = 0;
|
||||||
m_currentScaleOffsetBufferIndex = 0;
|
m_currentScaleOffsetBufferIndex = 0;
|
||||||
|
constantsFragmentSize = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -55,6 +55,7 @@ private:
|
||||||
|
|
||||||
ID3D12Resource *m_indexBuffer, *m_vertexBuffer[m_vertex_count];
|
ID3D12Resource *m_indexBuffer, *m_vertexBuffer[m_vertex_count];
|
||||||
ID3D12Resource *m_constantsVertexBuffer, *m_constantsFragmentBuffer;
|
ID3D12Resource *m_constantsVertexBuffer, *m_constantsFragmentBuffer;
|
||||||
|
size_t constantsFragmentSize;
|
||||||
ID3D12DescriptorHeap *m_constantsBufferDescriptorsHeap;
|
ID3D12DescriptorHeap *m_constantsBufferDescriptorsHeap;
|
||||||
size_t m_constantsBufferSize, m_constantsBufferIndex;
|
size_t m_constantsBufferSize, m_constantsBufferIndex;
|
||||||
|
|
||||||
|
|
|
@ -383,18 +383,24 @@ void FragmentDecompiler::insertHeader(std::stringstream & OS)
|
||||||
|
|
||||||
void FragmentDecompiler::insertIntputs(std::stringstream & OS)
|
void FragmentDecompiler::insertIntputs(std::stringstream & OS)
|
||||||
{
|
{
|
||||||
OS << "struct PSInput" << std::endl;
|
OS << "struct PixelInput" << std::endl;
|
||||||
OS << "{" << std::endl;
|
OS << "{" << std::endl;
|
||||||
OS << " float4 dst_reg0 : SV_POSITION;" << std::endl;
|
OS << " float4 Position : SV_POSITION;" << std::endl;
|
||||||
size_t index = 0;
|
OS << " float4 diff_color : COLOR0;" << std::endl;
|
||||||
for (ParamType PT : m_parr.params[PARAM_IN])
|
OS << " float4 spec_color : COLOR1;" << std::endl;
|
||||||
{
|
OS << " float4 dst_reg3 : COLOR2;" << std::endl;
|
||||||
for (ParamItem PI : PT.items)
|
OS << " float4 dst_reg4 : COLOR3;" << std::endl;
|
||||||
{
|
OS << " float fogc : FOG;" << std::endl;
|
||||||
OS << " " << PT.type << " " << PI.name << " : TEXCOORD" << index << ";" << std::endl;
|
OS << " float4 dummy : COLOR4;" << std::endl;
|
||||||
index++;
|
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;
|
OS << "};" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +418,7 @@ void FragmentDecompiler::insertConstants(std::stringstream & OS)
|
||||||
|
|
||||||
void FragmentDecompiler::insertMainStart(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 << "{" << std::endl;
|
||||||
OS << " float4 r0;" << std::endl;
|
OS << " float4 r0;" << std::endl;
|
||||||
for (ParamType PT : m_parr.params[PARAM_IN])
|
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 << "struct PixelInput" << std::endl;
|
||||||
OS << "{" << std::endl;
|
OS << "{" << std::endl;
|
||||||
OS << " float4 dst_reg0 : SV_POSITION;" << std::endl;
|
OS << " float4 dst_reg0 : SV_POSITION;" << std::endl;
|
||||||
size_t outputIndex = 0;
|
OS << " float4 dst_reg1 : COLOR0;" << std::endl;
|
||||||
for (const ParamType PT : outputs)
|
OS << " float4 dst_reg2 : COLOR1;" << std::endl;
|
||||||
{
|
OS << " float4 dst_reg3 : COLOR2;" << std::endl;
|
||||||
for (const ParamItem &PI : PT.items)
|
OS << " float4 dst_reg4 : COLOR3;" << std::endl;
|
||||||
{
|
OS << " float dst_reg5 : FOG;" << std::endl;
|
||||||
if (PI.name == "dst_reg0") continue;
|
OS << " float4 dst_reg6 : COLOR4;" << std::endl;
|
||||||
OS << " " << PT.type << " " << PI.name << ": TEXCOORD" << outputIndex++ << ";" << 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;
|
OS << "};" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue