GPU: Fix shader builder on hardware that does not have all features
This commit is contained in:
@@ -333,8 +333,11 @@ bool gpu_shader_create_info_compile_all()
|
||||
int skipped = 0;
|
||||
int total = 0;
|
||||
for (ShaderCreateInfo *info : g_create_infos->values()) {
|
||||
info->finalize();
|
||||
if (info->do_static_compilation_) {
|
||||
if (GPU_compute_shader_support() == false && info->compute_source_ != nullptr) {
|
||||
if ((GPU_compute_shader_support() == false && info->compute_source_ != nullptr) ||
|
||||
(GPU_shader_image_load_store_support() == false && info->has_resource_image()) ||
|
||||
(GPU_shader_storage_buffer_objects_support() == false && info->has_resource_storage())) {
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user