diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp index b547e917df..f19f2d9a2b 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp @@ -24,6 +24,7 @@ D3D12GSRender::D3D12GSRender() m_constantsBufferSize = 0; m_constantsBufferIndex = 0; m_currentScaleOffsetBufferIndex = 0; + constantsFragmentSize = 0; // Enable d3d debug layer Microsoft::WRL::ComPtr 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 \ No newline at end of file diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.h b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.h index db01de64b6..4835fdf031 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.h +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.h @@ -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; diff --git a/rpcs3/Emu/RSX/D3D12/FragmentProgramDecompiler.cpp b/rpcs3/Emu/RSX/D3D12/FragmentProgramDecompiler.cpp index 6652b7ec63..e75c5c6864 100644 --- a/rpcs3/Emu/RSX/D3D12/FragmentProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/D3D12/FragmentProgramDecompiler.cpp @@ -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]) diff --git a/rpcs3/Emu/RSX/D3D12/VertexProgramDecompiler.cpp b/rpcs3/Emu/RSX/D3D12/VertexProgramDecompiler.cpp index 982f3f3aed..65e1e8b866 100644 --- a/rpcs3/Emu/RSX/D3D12/VertexProgramDecompiler.cpp +++ b/rpcs3/Emu/RSX/D3D12/VertexProgramDecompiler.cpp @@ -479,15 +479,21 @@ void VertexDecompiler::insertOutputs(std::stringstream & OS, const std::vector