mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-13 13:24:01 +00:00
Vulkan: Add detection for non-causal filter chains.
This commit is contained in:
parent
b1bd0f7b7f
commit
200b88c3ca
@ -315,6 +315,11 @@ class Pass
|
||||
return reflection;
|
||||
}
|
||||
|
||||
void set_pass_number(unsigned pass)
|
||||
{
|
||||
pass_number = pass;
|
||||
}
|
||||
|
||||
void end_frame();
|
||||
|
||||
private:
|
||||
@ -385,6 +390,7 @@ class Pass
|
||||
|
||||
uint64_t frame_count = 0;
|
||||
unsigned frame_count_period = 0;
|
||||
unsigned pass_number = 0;
|
||||
|
||||
string pass_name;
|
||||
};
|
||||
@ -514,6 +520,7 @@ void vulkan_filter_chain::set_num_passes(unsigned num_passes)
|
||||
passes.emplace_back(new Pass(device, memory_properties,
|
||||
cache, deferred_calls.size(), i + 1 == num_passes));
|
||||
passes.back()->set_common_resources(common);
|
||||
passes.back()->set_pass_number(i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1377,6 +1384,7 @@ bool Pass::build()
|
||||
}
|
||||
|
||||
reflection = slang_reflection{};
|
||||
reflection.pass_number = pass_number;
|
||||
reflection.texture_semantic_map = &common->texture_semantic_map;
|
||||
reflection.texture_semantic_uniform_map = &common->texture_semantic_uniform_map;
|
||||
reflection.semantic_map = &common->semantic_map;
|
||||
|
@ -255,6 +255,13 @@ static bool add_active_buffer_ranges(const Compiler &compiler, const Resource &r
|
||||
auto tex_sem = slang_uniform_name_to_texture_semantic(*reflection->texture_semantic_uniform_map,
|
||||
name, &tex_sem_index);
|
||||
|
||||
if (tex_sem == SLANG_TEXTURE_SEMANTIC_PASS_OUTPUT && tex_sem_index >= reflection->pass_number)
|
||||
{
|
||||
RARCH_ERR("[slang]: Non causal filter chain detected. Shader is trying to use output from pass #%u, but this shader is pass #%u.\n",
|
||||
tex_sem_index, reflection->pass_number);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sem != SLANG_INVALID_SEMANTIC)
|
||||
{
|
||||
if (!validate_type_for_semantic(type, sem))
|
||||
@ -280,6 +287,8 @@ static bool add_active_buffer_ranges(const Compiler &compiler, const Resource &r
|
||||
else
|
||||
{
|
||||
// TODO: Handle invalid semantics as user defined.
|
||||
RARCH_ERR("[slang]: Unknown semantic found.\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -109,6 +109,7 @@ struct slang_reflection
|
||||
const std::unordered_map<std::string, slang_texture_semantic_map> *texture_semantic_map = nullptr;
|
||||
const std::unordered_map<std::string, slang_texture_semantic_map> *texture_semantic_uniform_map = nullptr;
|
||||
const std::unordered_map<std::string, slang_semantic> *semantic_map = nullptr;
|
||||
unsigned pass_number = 0;
|
||||
};
|
||||
|
||||
bool slang_reflect_spirv(const std::vector<uint32_t> &vertex,
|
||||
|
Loading…
x
Reference in New Issue
Block a user