mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-14 10:21:21 +00:00
rsx: Don't crash when invalid buffer is allocated for a shader
This commit is contained in:
parent
061be74cdb
commit
88e13d8326
@ -293,10 +293,10 @@ public:
|
||||
bool compile_async,
|
||||
bool allow_notification,
|
||||
Args&& ...args
|
||||
)
|
||||
)
|
||||
{
|
||||
const auto &vp_search = search_vertex_program(vertexShader);
|
||||
const auto &fp_search = search_fragment_program(fragmentShader);
|
||||
const auto& vp_search = search_vertex_program(vertexShader);
|
||||
const auto& fp_search = search_fragment_program(fragmentShader);
|
||||
|
||||
const bool already_existing_fragment_program = std::get<1>(fp_search);
|
||||
const bool already_existing_vertex_program = std::get<1>(vp_search);
|
||||
@ -385,7 +385,13 @@ public:
|
||||
|
||||
void fill_fragment_constants_buffer(std::span<f32> dst_buffer, const fragment_program_type& fragment_program, const RSXFragmentProgram& rsx_prog, bool sanitize = false) const
|
||||
{
|
||||
ensure((dst_buffer.size_bytes() >= ::narrow<int>(fragment_program.FragmentConstantOffsetCache.size()) * 16u));
|
||||
if (dst_buffer.size_bytes() < (fragment_program.FragmentConstantOffsetCache.size() * 16))
|
||||
{
|
||||
// This can happen if CELL alters the shader after it has been loaded by RSX.
|
||||
rsx_log.error("Insufficient constants buffer size passed to fragment program! Corrupt shader?");
|
||||
return;
|
||||
}
|
||||
|
||||
rsx::write_fragment_constants_to_buffer(dst_buffer, rsx_prog, fragment_program.FragmentConstantOffsetCache, sanitize);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user