mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-12-06 07:12:28 +01:00
rsx: Fix shader interpreter compilation
This commit is contained in:
parent
1a5ec26392
commit
c4426b0f07
|
|
@ -145,6 +145,9 @@ namespace gl
|
|||
comp.insertConstants(builder, { uniforms });
|
||||
comp.insertInputs(builder, {});
|
||||
|
||||
builder <<
|
||||
"#define is_user_clip_enabled(idx) (user_clip_enabled[idx >> 2][idx & 3] > 0)\n\n";
|
||||
|
||||
// Insert vp stream input
|
||||
builder << "\n"
|
||||
"layout(std140, binding = " << GL_INTERPRETER_VERTEX_BLOCK << ") readonly restrict buffer VertexInstructionBlock\n"
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void GLVertexDecompilerThread::insertHeader(std::stringstream &OS)
|
|||
"{\n"
|
||||
" mat4 scale_offset_mat;\n"
|
||||
" ivec4 user_clip_enabled[2];\n"
|
||||
" vec4 user_clip_factor[2];\n"
|
||||
" vec4 user_clip_factors[2];\n"
|
||||
" uint transform_branch_bits;\n"
|
||||
" float point_size;\n"
|
||||
" float z_near;\n"
|
||||
|
|
@ -46,7 +46,9 @@ void GLVertexDecompilerThread::insertHeader(std::stringstream &OS)
|
|||
" uint vertex_base_index;\n"
|
||||
" uint vertex_index_offset;\n"
|
||||
" uvec4 input_attributes_blob[16 / 2];\n"
|
||||
"};\n\n";
|
||||
"};\n\n"
|
||||
|
||||
"#define user_clip_factor(idx) user_clip_factors[idx >> 2][idx & 3]\n\n";
|
||||
}
|
||||
|
||||
void GLVertexDecompilerThread::insertInputs(std::stringstream& OS, const std::vector<ParamType>& /*inputs*/)
|
||||
|
|
|
|||
|
|
@ -576,12 +576,12 @@ void main()
|
|||
gl_PointSize = point_size;
|
||||
}
|
||||
|
||||
write_clip_distance(0, 6, user_clip_enabled[0].x > 0, dest[5].y * user_clip_factor[0].x);
|
||||
write_clip_distance(1, 7, user_clip_enabled[0].y > 0, dest[5].z * user_clip_factor[0].y);
|
||||
write_clip_distance(2, 8, user_clip_enabled[0].z > 0, dest[5].w * user_clip_factor[0].z);
|
||||
write_clip_distance(3, 9, user_clip_enabled[0].w > 0, dest[6].y * user_clip_factor[0].w);
|
||||
write_clip_distance(4, 10, user_clip_enabled[1].x > 0, dest[6].z * user_clip_factor[1].x);
|
||||
write_clip_distance(5, 11, user_clip_enabled[1].y > 0, dest[6].w * user_clip_factor[1].y);
|
||||
write_clip_distance(0, 6, is_user_clip_enabled(0), dest[5].y * user_clip_factor(0));
|
||||
write_clip_distance(1, 7, is_user_clip_enabled(1), dest[5].z * user_clip_factor(1));
|
||||
write_clip_distance(2, 8, is_user_clip_enabled(2), dest[5].w * user_clip_factor(2));
|
||||
write_clip_distance(3, 9, is_user_clip_enabled(3), dest[6].y * user_clip_factor(3));
|
||||
write_clip_distance(4, 10, is_user_clip_enabled(4), dest[6].z * user_clip_factor(4));
|
||||
write_clip_distance(5, 11, is_user_clip_enabled(5), dest[6].w * user_clip_factor(5));
|
||||
|
||||
write_output(15, 12);
|
||||
write_output(6, 13);
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ namespace vk
|
|||
::glsl::shader_properties properties{};
|
||||
properties.domain = ::glsl::program_domain::glsl_vertex_program;
|
||||
properties.require_lit_emulation = true;
|
||||
properties.require_clip_functions = true;
|
||||
|
||||
RSXVertexProgram null_prog;
|
||||
std::string shader_str;
|
||||
|
|
@ -88,6 +89,13 @@ namespace vk
|
|||
comp.insertConstants(builder, { uniforms });
|
||||
comp.insertInputs(builder, {});
|
||||
|
||||
builder <<
|
||||
"#define scale_offset_mat get_vertex_context().scale_offset_mat\n"
|
||||
"#define transform_branch_bits get_vertex_context().transform_branch_bits\n"
|
||||
"#define point_size get_vertex_context().point_size\n"
|
||||
"#define z_near get_vertex_context().z_near\n"
|
||||
"#define z_far get_vertex_context().z_far\n\n";
|
||||
|
||||
// Insert vp stream input
|
||||
builder << "\n"
|
||||
"layout(std140, set=0, binding=" << m_vertex_instruction_start << ") readonly restrict buffer VertexInstructionBlock\n"
|
||||
|
|
@ -169,6 +177,13 @@ namespace vk
|
|||
::glsl::insert_subheader_block(builder);
|
||||
comp.insertConstants(builder);
|
||||
|
||||
builder <<
|
||||
"#define fog_param0 fs_contexts[fs_context_offset].fog_param0\n"
|
||||
"#define fog_param1 fs_contexts[fs_context_offset].fog_param1\n"
|
||||
"#define fog_mode fs_contexts[fs_context_offset].fog_mode\n"
|
||||
"#define wpos_scale fs_contexts[fs_context_offset].wpos_scale\n"
|
||||
"#define wpos_bias fs_contexts[fs_context_offset].wpos_bias\n\n";
|
||||
|
||||
if (compiler_options & program_common::interpreter::COMPILER_OPT_ENABLE_ALPHA_TEST_GE)
|
||||
{
|
||||
builder << "#define ALPHA_TEST_GEQUAL\n";
|
||||
|
|
@ -244,7 +259,8 @@ namespace vk
|
|||
"#define SAMPLER1D(index) sampler1D_array[index]\n"
|
||||
"#define SAMPLER2D(index) sampler2D_array[index]\n"
|
||||
"#define SAMPLER3D(index) sampler3D_array[index]\n"
|
||||
"#define SAMPLERCUBE(index) samplerCube_array[index]\n\n";
|
||||
"#define SAMPLERCUBE(index) samplerCube_array[index]\n"
|
||||
"#define texture_base_index fs_texture_base_index\n\n";
|
||||
}
|
||||
|
||||
builder <<
|
||||
|
|
|
|||
Loading…
Reference in a new issue