mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-12-06 07:12:28 +01:00
rsx: Fix bugs in fragment program constants stream maagement
- Fix misplaced semicolon in GL fragment program compiler - Add a simple lookup to avoid silly reverse-indexing issues in FP::AddConst
This commit is contained in:
parent
e860cc9fad
commit
cd3e4fc8f1
|
|
@ -186,9 +186,9 @@ void GLFragmentDecompilerThread::insertConstants(std::stringstream & OS)
|
|||
" sampler_info texture_parameters[16];\n"
|
||||
"};\n\n"
|
||||
|
||||
"layout(std140, binding = " << GL_RASTERIZER_STATE_BIND_SLOT << ") uniform RasterizerHeap\n";
|
||||
"{\n";
|
||||
" uvec4 stipple_pattern[8];\n";
|
||||
"layout(std140, binding = " << GL_RASTERIZER_STATE_BIND_SLOT << ") uniform RasterizerHeap\n"
|
||||
"{\n"
|
||||
" uvec4 stipple_pattern[8];\n"
|
||||
"};\n\n";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
#pragma optimize("", off)
|
||||
#include "FragmentProgramDecompiler.h"
|
||||
#include "ProgramStateCache.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
|
@ -233,22 +236,18 @@ std::string FragmentProgramDecompiler::AddCond()
|
|||
std::string FragmentProgramDecompiler::AddConst()
|
||||
{
|
||||
const u32 constant_id = m_size + (4 * sizeof(u32));
|
||||
int index = -1, ctr = 0;
|
||||
u32 index = umax;
|
||||
|
||||
// Have we seen this constant before?
|
||||
for (auto it = properties.constant_offsets.rbegin(); it != properties.constant_offsets.rend(); ++it, ++ctr)
|
||||
if (auto found = m_constant_offsets.find(constant_id);
|
||||
found != m_constant_offsets.end())
|
||||
{
|
||||
if (*it == constant_id)
|
||||
{
|
||||
index = ctr;
|
||||
break;
|
||||
index = found->second;
|
||||
}
|
||||
}
|
||||
|
||||
if (index == -1)
|
||||
else
|
||||
{
|
||||
index = static_cast<int>(properties.constant_offsets.size());
|
||||
index =::size32(properties.constant_offsets);
|
||||
properties.constant_offsets.push_back(constant_id);
|
||||
m_constant_offsets[constant_id] = index;
|
||||
}
|
||||
|
||||
// Skip next instruction, its just a literal
|
||||
|
|
@ -1305,6 +1304,7 @@ std::string FragmentProgramDecompiler::Decompile()
|
|||
m_loop_count = 0;
|
||||
m_code_level = 1;
|
||||
m_is_valid_ucode = true;
|
||||
m_constant_offsets.clear();
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "RSXFragmentProgram.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
|
||||
/**
|
||||
* This class is used to translate RSX Fragment program to GLSL/HLSL code
|
||||
|
|
@ -43,13 +44,13 @@ class FragmentProgramDecompiler
|
|||
u32 m_const_index = 0;
|
||||
u32 m_offset;
|
||||
u32 m_location = 0;
|
||||
bool m_is_valid_ucode = true;
|
||||
|
||||
u32 m_loop_count;
|
||||
int m_code_level;
|
||||
std::vector<u32> m_end_offsets;
|
||||
std::vector<u32> m_else_offsets;
|
||||
|
||||
bool m_is_valid_ucode = true;
|
||||
std::unordered_map<u32, u32> m_constant_offsets;
|
||||
|
||||
std::array<rsx::MixedPrecisionRegister, 64> temp_registers;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue