Permalink
Browse files

Merge 9553d8e into d07ea31

  • Loading branch information...
2 parents d07ea31 + 9553d8e commit 60bd2fb1c906c28a4570ef9288b50ac3cebd06e7 @O1L O1L committed on GitHub Jan 23, 2017
@@ -151,7 +151,7 @@ void VertexProgramDecompiler::SetDST(bool is_sca, std::string value)
std::string dest;
- if (d0.cond_update_enable_0 && d0.cond_update_enable_1)
+ if (d0.cond_update_enable_0 || d0.cond_update_enable_1)
{
dest = m_parr.AddParam(PF_PARAM_NONE, getFloatTypeName(4), "cc" + std::to_string(d0.cond_reg_sel_1), getFloatTypeName(4) + "(0., 0., 0., 0.)") + mask;
}
@@ -83,6 +83,7 @@ namespace
{
switch (op)
{
+ case rsx::stencil_op::invert: return GL_INVERT;
case rsx::stencil_op::keep: return GL_KEEP;
case rsx::stencil_op::zero: return GL_ZERO;
case rsx::stencil_op::replace: return GL_REPLACE;
@@ -41,55 +41,6 @@ void GLVertexDecompilerThread::insertHeader(std::stringstream &OS)
OS << "};" << std::endl;
}
-std::vector<std::pair<std::string, std::string>> get_user_clip_planes(const RSXVertexProgram& prog)
-{
- std::vector<std::pair<std::string, std::string>> uc_planes;
-
- if (prog.output_mask & (1 << 5))
- {
- if (prog.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_UC0)
- {
- uc_planes.push_back({ "uniform int uc_m0 = 0;\n",
- "\tgl_ClipDistance[0] = uc_m0 * dst_reg5.y;\n" });
- }
-
- if (prog.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_UC1)
- {
- uc_planes.push_back({ "uniform int uc_m1 = 0;\n",
- "\tgl_ClipDistance[1] = uc_m1 * dst_reg5.z;\n" });
- }
-
- if (prog.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_UC2)
- {
- uc_planes.push_back({ "uniform int uc_m2 = 0;\n",
- "\tgl_ClipDistance[2] = uc_m2 * dst_reg5.w;\n" });
- }
- }
-
- if (prog.output_mask & (1 << 6))
- {
- if (prog.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_UC3)
- {
- uc_planes.push_back({ "uniform int uc_m3 = 0;\n",
- "\tgl_ClipDistance[3] = uc_m3 * dst_reg6.y;\n" });
- }
-
- if (prog.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_UC4)
- {
- uc_planes.push_back({ "uniform int uc_m4 = 0;\n",
- "\tgl_ClipDistance[4] = uc_m4 * dst_reg6.z;\n" });
- }
-
- if (prog.output_mask & CELL_GCM_ATTRIB_OUTPUT_MASK_UC5)
- {
- uc_planes.push_back({ "uniform int uc_m5 = 0;\n",
- "\tgl_ClipDistance[5] = uc_m5 * dst_reg6.w;\n" });
- }
- }
-
- return uc_planes;
-}
-
void GLVertexDecompilerThread::insertInputs(std::stringstream & OS, const std::vector<ParamType>& inputs)
{
std::vector<std::tuple<size_t, std::string>> input_data;
@@ -134,9 +85,9 @@ void GLVertexDecompilerThread::insertInputs(std::stringstream & OS, const std::v
}
}
- for (const auto& uc : get_user_clip_planes(rsx_vertex_program))
+ for (int i = 0; i <= 5; i++)
{
- OS << uc.first;
+ OS << "uniform int uc_m" + std::to_string(i) + "= 0;\n";
}
}
@@ -176,14 +127,13 @@ static const reg_info reg_table[] =
{ "front_diff_color", true, "dst_reg3", "", false },
{ "front_spec_color", true, "dst_reg4", "", false },
{ "fog_c", true, "dst_reg5", ".xxxx", true },
- //{ "gl_ClipDistance[0]", false, "dst_reg5", ".y", false },
- //{ "gl_ClipDistance[1]", false, "dst_reg5", ".z", false },
- //{ "gl_ClipDistance[2]", false, "dst_reg5", ".w", false },
+ { "gl_ClipDistance[0]", false, "dst_reg5", ".y * uc_m0", false },
+ { "gl_ClipDistance[1]", false, "dst_reg5", ".z * uc_m1", false },
+ { "gl_ClipDistance[2]", false, "dst_reg5", ".w * uc_m2", false },
{ "gl_PointSize", false, "dst_reg6", ".x", false },
- //Disable user clip planes until they are properly handled
- //{ "gl_ClipDistance[3]", false, "dst_reg6", ".y", false },
- //{ "gl_ClipDistance[4]", false, "dst_reg6", ".z", false },
- //{ "gl_ClipDistance[5]", false, "dst_reg6", ".w", false },
+ { "gl_ClipDistance[3]", false, "dst_reg6", ".y * uc_m3", false },
+ { "gl_ClipDistance[4]", false, "dst_reg6", ".z * uc_m4", false },
+ { "gl_ClipDistance[5]", false, "dst_reg6", ".w * uc_m5", false },
{ "tc0", true, "dst_reg7", "", false },
{ "tc1", true, "dst_reg8", "", false },
{ "tc2", true, "dst_reg9", "", false },
@@ -403,11 +353,6 @@ void GLVertexDecompilerThread::insertMainEnd(std::stringstream & OS)
}
}
- for (const auto& uc : get_user_clip_planes(rsx_vertex_program))
- {
- OS << uc.second;
- }
-
if (insert_back_diffuse && insert_front_diffuse)
if (m_parr.HasParam(PF_PARAM_NONE, "vec4", "dst_reg1"))
OS << " front_diff_color = dst_reg1;\n";
@@ -77,14 +77,37 @@ rsx::comparison_function rsx::to_comparison_function(u16 in)
{
switch (in)
{
- case CELL_GCM_NEVER: return rsx::comparison_function::never;
- case CELL_GCM_LESS: return rsx::comparison_function::less;
- case CELL_GCM_EQUAL: return rsx::comparison_function::equal;
- case CELL_GCM_LEQUAL: return rsx::comparison_function::less_or_equal;
- case CELL_GCM_GREATER: return rsx::comparison_function::greater;
- case CELL_GCM_NOTEQUAL: return rsx::comparison_function::not_equal;
- case CELL_GCM_GEQUAL: return rsx::comparison_function::greater_or_equal;
- case CELL_GCM_ALWAYS: return rsx::comparison_function::always;
+ case CELL_GCM_TEXTURE_ZFUNC_NEVER & CELL_GCM_SCULL_SFUNC_NEVER:
+ case CELL_GCM_NEVER:
+ return rsx::comparison_function::never;
+
+ case CELL_GCM_TEXTURE_ZFUNC_LESS & CELL_GCM_SCULL_SFUNC_LESS:
+ case CELL_GCM_LESS:
+ return rsx::comparison_function::less;
+
+ case CELL_GCM_TEXTURE_ZFUNC_EQUAL & CELL_GCM_SCULL_SFUNC_EQUAL:
+ case CELL_GCM_EQUAL:
+ return rsx::comparison_function::equal;
+
+ case CELL_GCM_TEXTURE_ZFUNC_LEQUAL & CELL_GCM_SCULL_SFUNC_LEQUAL:
+ case CELL_GCM_LEQUAL:
+ return rsx::comparison_function::less_or_equal;
+
+ case CELL_GCM_TEXTURE_ZFUNC_GREATER & CELL_GCM_SCULL_SFUNC_GREATER:
+ case CELL_GCM_GREATER:
+ return rsx::comparison_function::greater;
+
+ case CELL_GCM_TEXTURE_ZFUNC_NOTEQUAL & CELL_GCM_SCULL_SFUNC_NOTEQUAL:
+ case CELL_GCM_NOTEQUAL:
+ return rsx::comparison_function::not_equal;
+
+ case CELL_GCM_TEXTURE_ZFUNC_GEQUAL & CELL_GCM_SCULL_SFUNC_GEQUAL:
+ case CELL_GCM_GEQUAL:
+ return rsx::comparison_function::greater_or_equal;
+
+ case CELL_GCM_TEXTURE_ZFUNC_ALWAYS & CELL_GCM_SCULL_SFUNC_ALWAYS:
+ case CELL_GCM_ALWAYS:
+ return rsx::comparison_function::always;
}
fmt::throw_exception("Unknown comparison function 0x%x" HERE, in);
}
@@ -679,6 +702,7 @@ rsx::surface_color_format rsx::to_surface_color_format(u8 in)
enum
{
+ CELL_GCM_INVERT = 0x150A,
CELL_GCM_KEEP = 0x1E00,
CELL_GCM_REPLACE = 0x1E01,
CELL_GCM_INCR = 0x1E02,
@@ -691,6 +715,7 @@ rsx::stencil_op rsx::to_stencil_op(u16 in)
{
switch (in)
{
+ case CELL_GCM_INVERT: return rsx::stencil_op::invert;
case CELL_GCM_KEEP: return rsx::stencil_op::keep;
case CELL_GCM_REPLACE: return rsx::stencil_op::replace;
case CELL_GCM_INCR: return rsx::stencil_op::incr;
@@ -782,7 +807,6 @@ enum
CELL_GCM_OR = 0x1507,
CELL_GCM_NOR = 0x1508,
CELL_GCM_EQUIV = 0x1509,
- CELL_GCM_INVERT = 0x150A,
CELL_GCM_OR_REVERSE = 0x150B,
CELL_GCM_COPY_INVERTED = 0x150C,
CELL_GCM_OR_INVERTED = 0x150D,

0 comments on commit 60bd2fb

Please sign in to comment.