mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 06:21:26 +12:00
rsx: Handle vertex shaders with no constant references
- If no vc[] refs exist, do not upload anything!
This commit is contained in:
parent
d057ffe80f
commit
de0e660d28
4 changed files with 24 additions and 25 deletions
|
@ -800,14 +800,17 @@ void GLGSRender::load_program_env()
|
||||||
if (update_transform_constants)
|
if (update_transform_constants)
|
||||||
{
|
{
|
||||||
// Vertex constants
|
// Vertex constants
|
||||||
const std::vector<u16>& constant_ids = m_vertex_prog ? m_vertex_prog->constant_ids : std::vector<u16>{};
|
const usz transform_constants_size = (!m_vertex_prog || m_vertex_prog->has_indexed_constants) ? 8192 : m_vertex_prog->constant_ids.size() * 16;
|
||||||
const usz transform_constants_size = constant_ids.empty() ? 8192 : constant_ids.size() * 16;
|
if (transform_constants_size)
|
||||||
|
{
|
||||||
|
auto mapping = m_transform_constants_buffer->alloc_from_heap(transform_constants_size, m_uniform_buffer_offset_align);
|
||||||
|
auto buf = static_cast<u8*>(mapping.first);
|
||||||
|
|
||||||
auto mapping = m_transform_constants_buffer->alloc_from_heap(transform_constants_size, m_uniform_buffer_offset_align);
|
const std::vector<u16>& constant_ids = (transform_constants_size == 8192) ? std::vector<u16>{} : m_vertex_prog->constant_ids;
|
||||||
auto buf = static_cast<u8*>(mapping.first);
|
fill_vertex_program_constants_data(buf, m_vertex_prog ? m_vertex_prog->constant_ids : std::vector<u16>{});
|
||||||
fill_vertex_program_constants_data(buf, m_vertex_prog ? m_vertex_prog->constant_ids : std::vector<u16>{});
|
|
||||||
|
|
||||||
m_transform_constants_buffer->bind_range(GL_VERTEX_CONSTANT_BUFFERS_BIND_SLOT, mapping.second, transform_constants_size);
|
m_transform_constants_buffer->bind_range(GL_VERTEX_CONSTANT_BUFFERS_BIND_SLOT, mapping.second, transform_constants_size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_fragment_constants && !update_instruction_buffers)
|
if (update_fragment_constants && !update_instruction_buffers)
|
||||||
|
|
|
@ -276,11 +276,8 @@ void GLVertexProgram::Decompile(const RSXVertexProgram& prog)
|
||||||
GLVertexDecompilerThread decompiler(prog, source, parr);
|
GLVertexDecompilerThread decompiler(prog, source, parr);
|
||||||
decompiler.Task();
|
decompiler.Task();
|
||||||
|
|
||||||
if (has_indexed_constants = decompiler.properties.has_indexed_constants;
|
has_indexed_constants = decompiler.properties.has_indexed_constants;
|
||||||
!has_indexed_constants)
|
constant_ids = std::vector<u16>(decompiler.m_constant_ids.begin(), decompiler.m_constant_ids.end());
|
||||||
{
|
|
||||||
constant_ids = std::vector<u16>(decompiler.m_constant_ids.begin(), decompiler.m_constant_ids.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
shader.create(::glsl::program_domain::glsl_vertex_program, source);
|
shader.create(::glsl::program_domain::glsl_vertex_program, source);
|
||||||
id = shader.id();
|
id = shader.id();
|
||||||
|
|
|
@ -1952,18 +1952,20 @@ void VKGSRender::load_program_env()
|
||||||
|
|
||||||
if (update_transform_constants)
|
if (update_transform_constants)
|
||||||
{
|
{
|
||||||
check_heap_status(VK_HEAP_CHECK_TRANSFORM_CONSTANTS_STORAGE);
|
|
||||||
|
|
||||||
// Transform constants
|
// Transform constants
|
||||||
const std::vector<u16>& constant_ids = m_vertex_prog ? m_vertex_prog->constant_ids : std::vector<u16>{};
|
const usz transform_constants_size = (!m_vertex_prog || m_vertex_prog->has_indexed_constants) ? 8192 : m_vertex_prog->constant_ids.size() * 16;
|
||||||
const usz transform_constants_size = constant_ids.empty() ? 8192 : utils::align(constant_ids.size() * 16, m_device->gpu().get_limits().minUniformBufferOffsetAlignment);
|
if (transform_constants_size)
|
||||||
|
{
|
||||||
|
check_heap_status(VK_HEAP_CHECK_TRANSFORM_CONSTANTS_STORAGE);
|
||||||
|
|
||||||
auto mem = m_transform_constants_ring_info.alloc<1>(transform_constants_size);
|
auto mem = m_transform_constants_ring_info.alloc<1>(transform_constants_size);
|
||||||
auto buf = m_transform_constants_ring_info.map(mem, transform_constants_size);
|
auto buf = m_transform_constants_ring_info.map(mem, transform_constants_size);
|
||||||
|
|
||||||
fill_vertex_program_constants_data(buf, constant_ids);
|
const std::vector<u16>& constant_ids = (transform_constants_size == 8192) ? std::vector<u16>{} : m_vertex_prog->constant_ids;
|
||||||
m_transform_constants_ring_info.unmap();
|
fill_vertex_program_constants_data(buf, constant_ids);
|
||||||
m_vertex_constants_buffer_info = { m_transform_constants_ring_info.heap->value, mem, transform_constants_size };
|
m_transform_constants_ring_info.unmap();
|
||||||
|
m_vertex_constants_buffer_info = { m_transform_constants_ring_info.heap->value, mem, transform_constants_size };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_fragment_constants && !update_instruction_buffers)
|
if (update_fragment_constants && !update_instruction_buffers)
|
||||||
|
|
|
@ -350,11 +350,8 @@ void VKVertexProgram::Decompile(const RSXVertexProgram& prog)
|
||||||
VKVertexDecompilerThread decompiler(prog, source, parr, *this);
|
VKVertexDecompilerThread decompiler(prog, source, parr, *this);
|
||||||
decompiler.Task();
|
decompiler.Task();
|
||||||
|
|
||||||
if (has_indexed_constants = decompiler.properties.has_indexed_constants;
|
has_indexed_constants = decompiler.properties.has_indexed_constants;
|
||||||
!has_indexed_constants)
|
constant_ids = std::vector<u16>(decompiler.m_constant_ids.begin(), decompiler.m_constant_ids.end());
|
||||||
{
|
|
||||||
constant_ids = std::vector<u16>(decompiler.m_constant_ids.begin(), decompiler.m_constant_ids.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
shader.create(::glsl::program_domain::glsl_vertex_program, source);
|
shader.create(::glsl::program_domain::glsl_vertex_program, source);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue