mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 07:21:25 +12:00
Rsx: fix unknown cull faces
This commit is contained in:
parent
38a72cc6ee
commit
acf1286b49
5 changed files with 30 additions and 39 deletions
|
@ -232,7 +232,7 @@ namespace rsx
|
||||||
case cull_face::front: return "front";
|
case cull_face::front: return "front";
|
||||||
case cull_face::front_and_back: return "front and back";
|
case cull_face::front_and_back: return "front and back";
|
||||||
}
|
}
|
||||||
fmt::throw_exception("Unexpected enum found" HERE);
|
return "Unknown cull face value";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string to_string(surface_target target)
|
std::string to_string(surface_target target)
|
||||||
|
@ -827,17 +827,6 @@ rsx::front_face rsx::to_front_face(u16 in)
|
||||||
fmt::throw_exception("Unknown front face 0x%x" HERE, in);
|
fmt::throw_exception("Unknown front face 0x%x" HERE, in);
|
||||||
}
|
}
|
||||||
|
|
||||||
rsx::cull_face rsx::to_cull_face(u16 in)
|
|
||||||
{
|
|
||||||
switch (in)
|
|
||||||
{
|
|
||||||
case CELL_GCM_FRONT_AND_BACK: return rsx::cull_face::front_and_back;
|
|
||||||
case CELL_GCM_FRONT: return rsx::cull_face::front;
|
|
||||||
case CELL_GCM_BACK: return rsx::cull_face::back;
|
|
||||||
}
|
|
||||||
fmt::throw_exception("Unknown cull face 0x%x" HERE, in);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CELL_GCM_TRANSFER_ORIGIN_CENTER = 1,
|
CELL_GCM_TRANSFER_ORIGIN_CENTER = 1,
|
||||||
|
|
|
@ -271,15 +271,13 @@ namespace rsx
|
||||||
|
|
||||||
front_face to_front_face(u16 in);
|
front_face to_front_face(u16 in);
|
||||||
|
|
||||||
enum class cull_face : u8
|
enum class cull_face : u32
|
||||||
{
|
{
|
||||||
front,
|
front = 0x0404, // CELL_GCM_FRONT
|
||||||
back,
|
back = 0x0405, // CELL_GCM_BACK
|
||||||
front_and_back,
|
front_and_back = 0x0408, // CELL_GCM_FRONT_AND_BACK
|
||||||
};
|
};
|
||||||
|
|
||||||
cull_face to_cull_face(u16 in);
|
|
||||||
|
|
||||||
enum class user_clip_plane_op : u8
|
enum class user_clip_plane_op : u8
|
||||||
{
|
{
|
||||||
disable,
|
disable,
|
||||||
|
|
|
@ -2927,14 +2927,13 @@ struct registers_decoder<NV4097_SET_CULL_FACE>
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
u32 raw_value;
|
u32 raw_value;
|
||||||
bitfield_decoder_t<0, 32> cull_face_mode;
|
|
||||||
} m_data;
|
} m_data;
|
||||||
public:
|
public:
|
||||||
decoded_type(u32 raw_value) { m_data.raw_value = raw_value; }
|
decoded_type(u32 raw_value) { m_data.raw_value = raw_value; }
|
||||||
|
|
||||||
cull_face cull_face_mode() const
|
cull_face cull_face_mode() const
|
||||||
{
|
{
|
||||||
return to_cull_face(m_data.cull_face_mode);
|
return static_cast<cull_face>(m_data.raw_value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,20 @@ namespace rsx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_cull_face(thread* rsx, u32 reg, u32 arg)
|
||||||
|
{
|
||||||
|
switch(arg)
|
||||||
|
{
|
||||||
|
case CELL_GCM_FRONT_AND_BACK: return;
|
||||||
|
case CELL_GCM_FRONT: return;
|
||||||
|
case CELL_GCM_BACK: return;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignore value if unknown
|
||||||
|
method_registers.registers[reg] = method_registers.register_previous_value;
|
||||||
|
}
|
||||||
|
|
||||||
void texture_read_semaphore_release(thread* rsx, u32 _reg, u32 arg)
|
void texture_read_semaphore_release(thread* rsx, u32 _reg, u32 arg)
|
||||||
{
|
{
|
||||||
// Pipeline barrier seems to be equivalent to a SHADER_READ stage barrier
|
// Pipeline barrier seems to be equivalent to a SHADER_READ stage barrier
|
||||||
|
@ -381,17 +395,17 @@ namespace rsx
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void set_transform_program_start(thread* rsx, u32, u32)
|
void set_transform_program_start(thread* rsx, u32 reg, u32)
|
||||||
{
|
{
|
||||||
if (method_registers.register_change_flag)
|
if (method_registers.registers[reg] != method_registers.register_previous_value)
|
||||||
{
|
{
|
||||||
rsx->m_graphics_state |= rsx::pipeline_state::vertex_program_dirty;
|
rsx->m_graphics_state |= rsx::pipeline_state::vertex_program_dirty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_vertex_attribute_output_mask(thread* rsx, u32, u32)
|
void set_vertex_attribute_output_mask(thread* rsx, u32 reg, u32)
|
||||||
{
|
{
|
||||||
if (method_registers.register_change_flag)
|
if (method_registers.registers[reg] != method_registers.register_previous_value)
|
||||||
{
|
{
|
||||||
rsx->m_graphics_state |= rsx::pipeline_state::vertex_program_dirty | rsx::pipeline_state::fragment_program_dirty;
|
rsx->m_graphics_state |= rsx::pipeline_state::vertex_program_dirty | rsx::pipeline_state::fragment_program_dirty;
|
||||||
}
|
}
|
||||||
|
@ -1325,16 +1339,8 @@ namespace rsx
|
||||||
|
|
||||||
void rsx_state::decode(u32 reg, u32 value)
|
void rsx_state::decode(u32 reg, u32 value)
|
||||||
{
|
{
|
||||||
auto& old_value = registers[reg];
|
// Store new value and save previous
|
||||||
if (old_value != value)
|
register_previous_value = std::exchange(registers[reg], value);
|
||||||
{
|
|
||||||
register_change_flag = true;
|
|
||||||
old_value = value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
register_change_flag = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rsx_state::test(u32 reg, u32 value) const
|
bool rsx_state::test(u32 reg, u32 value) const
|
||||||
|
@ -1747,6 +1753,7 @@ namespace rsx
|
||||||
bind<NV406E_SEMAPHORE_RELEASE, nv406e::semaphore_release>();
|
bind<NV406E_SEMAPHORE_RELEASE, nv406e::semaphore_release>();
|
||||||
|
|
||||||
// NV4097
|
// NV4097
|
||||||
|
bind<NV4097_SET_CULL_FACE, nv4097::set_cull_face>();
|
||||||
bind<NV4097_TEXTURE_READ_SEMAPHORE_RELEASE, nv4097::texture_read_semaphore_release>();
|
bind<NV4097_TEXTURE_READ_SEMAPHORE_RELEASE, nv4097::texture_read_semaphore_release>();
|
||||||
bind<NV4097_BACK_END_WRITE_SEMAPHORE_RELEASE, nv4097::back_end_write_semaphore_release>();
|
bind<NV4097_BACK_END_WRITE_SEMAPHORE_RELEASE, nv4097::back_end_write_semaphore_release>();
|
||||||
bind<NV4097_SET_BEGIN_END, nv4097::set_begin_end>();
|
bind<NV4097_SET_BEGIN_END, nv4097::set_begin_end>();
|
||||||
|
|
|
@ -127,8 +127,9 @@ namespace rsx
|
||||||
|
|
||||||
struct rsx_state
|
struct rsx_state
|
||||||
{
|
{
|
||||||
protected:
|
public:
|
||||||
std::array<u32, 0x10000 / 4> registers;
|
std::array<u32, 0x10000 / 4> registers{};
|
||||||
|
u32 register_previous_value;
|
||||||
|
|
||||||
template<u32 opcode>
|
template<u32 opcode>
|
||||||
using decoded_type = typename registers_decoder<opcode>::decoded_type;
|
using decoded_type = typename registers_decoder<opcode>::decoded_type;
|
||||||
|
@ -140,7 +141,6 @@ namespace rsx
|
||||||
return decoded_type<opcode>(register_value);
|
return decoded_type<opcode>(register_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
rsx_state &operator=(const rsx_state& in)
|
rsx_state &operator=(const rsx_state& in)
|
||||||
{
|
{
|
||||||
registers = in.registers;
|
registers = in.registers;
|
||||||
|
@ -159,8 +159,6 @@ namespace rsx
|
||||||
|
|
||||||
draw_clause current_draw_clause;
|
draw_clause current_draw_clause;
|
||||||
|
|
||||||
bool register_change_flag;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RSX can sources vertex attributes from 2 places:
|
* RSX can sources vertex attributes from 2 places:
|
||||||
* 1. Immediate values passed by NV4097_SET_VERTEX_DATA*_M + ARRAY_ID write.
|
* 1. Immediate values passed by NV4097_SET_VERTEX_DATA*_M + ARRAY_ID write.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue