rsx: Implement variable point size

This commit is contained in:
kd-11 2017-12-09 23:08:36 +03:00
parent 0d0821e914
commit b1a1c0251f
6 changed files with 36 additions and 0 deletions

View file

@ -1000,6 +1000,7 @@ void GLGSRender::load_program(u32 vertex_base, u32 vertex_count)
fill_user_clip_data(buf + 64);
*(reinterpret_cast<u32*>(buf + 128)) = rsx::method_registers.transform_branch_bits();
*(reinterpret_cast<u32*>(buf + 132)) = vertex_base;
*(reinterpret_cast<f32*>(buf + 136)) = rsx::method_registers.point_size();
fill_vertex_layout_state(m_vertex_layout, vertex_count, reinterpret_cast<s32*>(buf + 144));
if (m_transform_constants_dirty)

View file

@ -38,6 +38,7 @@ void GLVertexDecompilerThread::insertHeader(std::stringstream &OS)
OS << " vec4 user_clip_factor[2];\n";
OS << " uint transform_branch_bits;\n";
OS << " uint vertex_base_index;\n";
OS << " float point_size;\n";
OS << " ivec4 input_attributes[16];\n";
OS << "};\n\n";
}
@ -294,6 +295,7 @@ void GLVertexDecompilerThread::insertMainEnd(std::stringstream & OS)
if (m_parr.HasParam(PF_PARAM_NONE, "vec4", "dst_reg2"))
OS << " front_spec_color = dst_reg2;\n";
OS << " gl_PointSize = point_size;\n";
OS << " gl_Position = gl_Position * scale_offset_mat;\n";
//Since our clip_space is symetrical [-1, 1] we map it to linear space using the eqn:

View file

@ -2289,6 +2289,7 @@ void VKGSRender::load_program(u32 vertex_count, u32 vertex_base)
fill_user_clip_data(buf + 64);
*(reinterpret_cast<u32*>(buf + 128)) = rsx::method_registers.transform_branch_bits();
*(reinterpret_cast<u32*>(buf + 132)) = vertex_base;
*(reinterpret_cast<f32*>(buf + 136)) = rsx::method_registers.point_size();
fill_vertex_layout_state(m_vertex_layout, vertex_count, reinterpret_cast<s32*>(buf + 144));
//Vertex constants

View file

@ -36,6 +36,7 @@ void VKVertexDecompilerThread::insertHeader(std::stringstream &OS)
OS << " vec4 user_clip_factor[2];\n";
OS << " uint transform_branch_bits;\n";
OS << " uint vertex_base_index;\n";
OS << " float point_size;\n";
OS << " ivec4 input_attributes[16];\n";
OS << "};\n";
@ -309,6 +310,7 @@ void VKVertexDecompilerThread::insertMainEnd(std::stringstream & OS)
if (m_parr.HasParam(PF_PARAM_NONE, "vec4", "dst_reg2"))
OS << " front_spec_color = dst_reg2;\n";
OS << " gl_PointSize = point_size;\n";
OS << " gl_Position = gl_Position * scale_offset_mat;\n";
OS << "}\n";
}

View file

@ -3379,6 +3379,31 @@ struct registers_decoder<NV4097_SET_LINE_WIDTH>
}
};
template<>
struct registers_decoder<NV4097_SET_POINT_SIZE>
{
struct decoded_type
{
private:
union
{
u32 raw_data;
} m_data;
public:
decoded_type(u32 raw_value) { m_data.raw_data = raw_value; }
f32 point_size() const
{
return (f32&)m_data.raw_data;
}
};
static std::string dump(decoded_type &&decoded_values)
{
return "Point size: " + std::to_string(decoded_values.point_size());
}
};
template<>
struct registers_decoder<NV4097_SET_SURFACE_FORMAT>
{

View file

@ -677,6 +677,11 @@ namespace rsx
return decode<NV4097_SET_LINE_WIDTH>().line_width();
}
f32 point_size() const
{
return decode<NV4097_SET_POINT_SIZE>().point_size();
}
u8 alpha_ref() const
{
return decode<NV4097_SET_ALPHA_REF>().alpha_ref();