diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-07-15 12:03:42 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-07-15 12:16:14 +0300 |
commit | 98f688ac42fa6a59b618de39a2f0b85f1f675160 (patch) | |
tree | 77bc5fb16b4d2f25fc658cad46ab43b67369b14a /source/blender/gpu/intern/gpu_shader_create_info.hh | |
parent | 862170c0b1ed1fb4f967aead1979568c86b141e8 (diff) |
GPU: Fix shader builder on hardware that does not have all features
Diffstat (limited to 'source/blender/gpu/intern/gpu_shader_create_info.hh')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader_create_info.hh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index 4927ef75a75..8e05412d0ee 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -872,6 +872,31 @@ struct ShaderCreateInfo { return stream; } + bool has_resource_type(Resource::BindType bind_type) const + { + for (auto &res : batch_resources_) { + if (res.bind_type == bind_type) { + return true; + } + } + for (auto &res : pass_resources_) { + if (res.bind_type == bind_type) { + return true; + } + } + return false; + } + + bool has_resource_image() const + { + return has_resource_type(Resource::BindType::IMAGE); + } + + bool has_resource_storage() const + { + return has_resource_type(Resource::BindType::STORAGE_BUFFER); + } + /** \} */ #undef TEST_EQUAL |