Skip to content

Commit

Permalink
Merge pull request godotengine#100374 from hpvb/fix-rendering-ubsan
Browse files Browse the repository at this point in the history
Fix ubsan reported errors in rendering
  • Loading branch information
akien-mga committed Dec 14, 2024
2 parents 68559c4 + 062d74b commit ffe53cb
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 76 deletions.
2 changes: 1 addition & 1 deletion drivers/d3d12/rendering_context_driver_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Error RenderingContextDriverD3D12::_initialize_devices() {

Device &device = driver_devices[i];
device.name = desc.Description;
device.vendor = Vendor(desc.VendorId);
device.vendor = desc.VendorId;
device.workarounds = Workarounds();

if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/metal/rendering_context_driver_metal.mm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ - (void)setShouldMaximizeConcurrentCompilation:(BOOL)v;
}
#endif
device.type = DEVICE_TYPE_INTEGRATED_GPU;
device.vendor = VENDOR_APPLE;
device.vendor = Vendor::VENDOR_APPLE;
device.workarounds = Workarounds();

MetalDeviceProperties props(metal_device);
Expand Down
4 changes: 2 additions & 2 deletions drivers/vulkan/rendering_context_driver_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ Error RenderingContextDriverVulkan::_initialize_devices() {

Device &driver_device = driver_devices[i];
driver_device.name = String::utf8(props.deviceName);
driver_device.vendor = Vendor(props.vendorID);
driver_device.vendor = props.vendorID;
driver_device.type = DeviceType(props.deviceType);
driver_device.workarounds = Workarounds();

Expand Down Expand Up @@ -880,7 +880,7 @@ void RenderingContextDriverVulkan::_check_driver_workarounds(const VkPhysicalDev
// This bug was fixed in driver version 512.503.0, so we only enabled it on devices older than this.
//
r_device.workarounds.avoid_compute_after_draw =
r_device.vendor == VENDOR_QUALCOMM &&
r_device.vendor == Vendor::VENDOR_QUALCOMM &&
p_device_properties.deviceID >= 0x6000000 && // Adreno 6xx
p_device_properties.driverVersion < VK_MAKE_VERSION(512, 503, 0) &&
r_device.name.find("Turnip") < 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/vulkan/rendering_device_driver_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1898,10 +1898,10 @@ RDD::TextureID RenderingDeviceDriverVulkan::texture_create_shared(TextureID p_or
vkGetPhysicalDeviceFormatProperties(physical_device, RD_TO_VK_FORMAT[p_view.format], &properties);
const VkFormatFeatureFlags &supported_flags = owner_tex_info->vk_create_info.tiling == VK_IMAGE_TILING_LINEAR ? properties.linearTilingFeatures : properties.optimalTilingFeatures;
if ((usage_info->usage & VK_IMAGE_USAGE_STORAGE_BIT) && !(supported_flags & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT)) {
usage_info->usage &= ~VK_IMAGE_USAGE_STORAGE_BIT;
usage_info->usage &= ~uint32_t(VK_IMAGE_USAGE_STORAGE_BIT);
}
if ((usage_info->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) && !(supported_flags & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) {
usage_info->usage &= ~VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
usage_info->usage &= ~uint32_t(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,7 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
}
}

uint32_t opaque_color_pass_flags = using_motion_pass ? (color_pass_flags & ~COLOR_PASS_FLAG_MOTION_VECTORS) : color_pass_flags;
uint32_t opaque_color_pass_flags = using_motion_pass ? (color_pass_flags & ~uint32_t(COLOR_PASS_FLAG_MOTION_VECTORS)) : color_pass_flags;
RID opaque_framebuffer = using_motion_pass ? rb_data->get_color_pass_fb(opaque_color_pass_flags) : color_framebuffer;
RenderListParameters render_list_params(render_list[RENDER_LIST_OPAQUE].elements.ptr(), render_list[RENDER_LIST_OPAQUE].element_info.ptr(), render_list[RENDER_LIST_OPAQUE].elements.size(), reverse_cull, PASS_MODE_COLOR, opaque_color_pass_flags, rb_data.is_null(), p_render_data->directional_light_soft_shadows, rp_uniform_set, get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_WIREFRAME, Vector2(), p_render_data->scene_data->lod_distance_multiplier, p_render_data->scene_data->screen_mesh_lod_threshold, p_render_data->scene_data->view_count, 0, base_specialization);
_render_list_with_draw_list(&render_list_params, opaque_framebuffer, RD::DrawFlags(load_color ? RD::DRAW_DEFAULT_ALL : RD::DRAW_CLEAR_COLOR_ALL) | (depth_pre_pass ? RD::DRAW_DEFAULT_ALL : RD::DRAW_CLEAR_DEPTH), c, 0.0f);
Expand Down Expand Up @@ -2293,10 +2293,10 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
_setup_environment(p_render_data, is_reflection_probe, screen_size, p_default_bg_color, false);

{
uint32_t transparent_color_pass_flags = (color_pass_flags | COLOR_PASS_FLAG_TRANSPARENT) & ~(COLOR_PASS_FLAG_SEPARATE_SPECULAR);
uint32_t transparent_color_pass_flags = (color_pass_flags | uint32_t(COLOR_PASS_FLAG_TRANSPARENT)) & ~uint32_t(COLOR_PASS_FLAG_SEPARATE_SPECULAR);
if (using_motion_pass) {
// Motion vectors on transparent draw calls are not required when using the reactive mask.
transparent_color_pass_flags &= ~(COLOR_PASS_FLAG_MOTION_VECTORS);
transparent_color_pass_flags &= ~uint32_t(COLOR_PASS_FLAG_MOTION_VECTORS);
}

RID alpha_framebuffer = rb_data.is_valid() ? rb_data->get_color_pass_fb(transparent_color_pass_flags) : color_only_framebuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,27 +222,27 @@ RS::ShaderNativeSourceCode SceneShaderForwardClustered::ShaderData::get_native_s
}
}

SceneShaderForwardClustered::ShaderVersion SceneShaderForwardClustered::ShaderData::_get_shader_version(PipelineVersion p_pipeline_version, uint32_t p_color_pass_flags, bool p_ubershader) const {
uint32_t ubershader_base = p_ubershader ? SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL : 0;
uint16_t SceneShaderForwardClustered::ShaderData::_get_shader_version(PipelineVersion p_pipeline_version, uint32_t p_color_pass_flags, bool p_ubershader) const {
uint32_t ubershader_base = p_ubershader ? ShaderVersion::SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL : 0;
switch (p_pipeline_version) {
case PIPELINE_VERSION_DEPTH_PASS:
return ShaderVersion(SHADER_VERSION_DEPTH_PASS + ubershader_base);
return ShaderVersion::SHADER_VERSION_DEPTH_PASS + ubershader_base;
case PIPELINE_VERSION_DEPTH_PASS_DP:
return ShaderVersion(SHADER_VERSION_DEPTH_PASS_DP + ubershader_base);
return ShaderVersion::SHADER_VERSION_DEPTH_PASS_DP + ubershader_base;
case PIPELINE_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS:
return ShaderVersion(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS + ubershader_base);
return ShaderVersion::SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS + ubershader_base;
case PIPELINE_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI:
return ShaderVersion(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI + ubershader_base);
return ShaderVersion::SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI + ubershader_base;
case PIPELINE_VERSION_DEPTH_PASS_MULTIVIEW:
return ShaderVersion(SHADER_VERSION_DEPTH_PASS_MULTIVIEW + ubershader_base);
return ShaderVersion::SHADER_VERSION_DEPTH_PASS_MULTIVIEW + ubershader_base;
case PIPELINE_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_MULTIVIEW:
return ShaderVersion(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_MULTIVIEW + ubershader_base);
return ShaderVersion::SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_MULTIVIEW + ubershader_base;
case PIPELINE_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI_MULTIVIEW:
return ShaderVersion(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI_MULTIVIEW + ubershader_base);
return ShaderVersion::SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI_MULTIVIEW + ubershader_base;
case PIPELINE_VERSION_DEPTH_PASS_WITH_MATERIAL:
return ShaderVersion(SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL + SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL);
return ShaderVersion::SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL + ShaderVersion::SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL;
case PIPELINE_VERSION_DEPTH_PASS_WITH_SDF:
return ShaderVersion(SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL + SHADER_VERSION_DEPTH_PASS_WITH_SDF);
return ShaderVersion::SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL + ShaderVersion::SHADER_VERSION_DEPTH_PASS_WITH_SDF;
case PIPELINE_VERSION_COLOR_PASS: {
int shader_flags = 0;

Expand All @@ -266,11 +266,11 @@ SceneShaderForwardClustered::ShaderVersion SceneShaderForwardClustered::ShaderDa
shader_flags |= SHADER_COLOR_PASS_FLAG_MULTIVIEW;
}

return ShaderVersion(SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL + SHADER_VERSION_COLOR_PASS + shader_flags);
return ShaderVersion::SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL + ShaderVersion::SHADER_VERSION_COLOR_PASS + shader_flags;
} break;
default: {
DEV_ASSERT(false && "Unknown pipeline version.");
return ShaderVersion(0);
return 0;
} break;
}
}
Expand Down Expand Up @@ -404,7 +404,7 @@ RD::PolygonCullMode SceneShaderForwardClustered::ShaderData::get_cull_mode_from_
return cull_mode_rd_table[p_cull_variant][cull_mode];
}

RID SceneShaderForwardClustered::ShaderData::_get_shader_variant(ShaderVersion p_shader_version) const {
RID SceneShaderForwardClustered::ShaderData::_get_shader_variant(uint16_t p_shader_version) const {
if (version.is_valid()) {
MutexLock lock(SceneShaderForwardClustered::singleton_mutex);
ERR_FAIL_NULL_V(SceneShaderForwardClustered::singleton, RID());
Expand All @@ -426,7 +426,7 @@ RID SceneShaderForwardClustered::ShaderData::get_shader_variant(PipelineVersion

uint64_t SceneShaderForwardClustered::ShaderData::get_vertex_input_mask(PipelineVersion p_pipeline_version, uint32_t p_color_pass_flags, bool p_ubershader) {
// Vertex input masks require knowledge of the shader. Since querying the shader can be expensive due to high contention and the necessary mutex, we cache the result instead.
ShaderVersion shader_version = _get_shader_version(p_pipeline_version, p_color_pass_flags, p_ubershader);
uint16_t shader_version = _get_shader_version(p_pipeline_version, p_color_pass_flags, p_ubershader);
uint64_t input_mask = vertex_input_masks[shader_version].load(std::memory_order_relaxed);
if (input_mask == 0) {
RID shader_rid = _get_shader_variant(shader_version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,19 @@ class SceneShaderForwardClustered {
SHADER_GROUP_ADVANCED_MULTIVIEW,
};

enum ShaderVersion {
SHADER_VERSION_DEPTH_PASS,
SHADER_VERSION_DEPTH_PASS_DP,
SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS,
SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI,
SHADER_VERSION_DEPTH_PASS_MULTIVIEW,
SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_MULTIVIEW,
SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI_MULTIVIEW,
SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL,
SHADER_VERSION_DEPTH_PASS_WITH_SDF,
SHADER_VERSION_COLOR_PASS,
SHADER_VERSION_MAX
// Not an enum because these values are constants that are processed as numbers
// to arrive at a unique version for a particular shader.
struct ShaderVersion {
constexpr static uint16_t SHADER_VERSION_DEPTH_PASS = 0;
constexpr static uint16_t SHADER_VERSION_DEPTH_PASS_DP = 1;
constexpr static uint16_t SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS = 2;
constexpr static uint16_t SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI = 3;
constexpr static uint16_t SHADER_VERSION_DEPTH_PASS_MULTIVIEW = 4;
constexpr static uint16_t SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_MULTIVIEW = 5;
constexpr static uint16_t SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_VOXEL_GI_MULTIVIEW = 6;
constexpr static uint16_t SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL = 7;
constexpr static uint16_t SHADER_VERSION_DEPTH_PASS_WITH_SDF = 8;
constexpr static uint16_t SHADER_VERSION_COLOR_PASS = 9;
};

enum ShaderColorPassFlags {
Expand Down Expand Up @@ -205,7 +206,7 @@ class SceneShaderForwardClustered {

RID version;

static const uint32_t VERTEX_INPUT_MASKS_SIZE = SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL + SHADER_VERSION_COLOR_PASS + SHADER_COLOR_PASS_FLAG_COUNT;
static const uint32_t VERTEX_INPUT_MASKS_SIZE = ShaderVersion::SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL + ShaderVersion::SHADER_VERSION_COLOR_PASS + SHADER_COLOR_PASS_FLAG_COUNT;
std::atomic<uint64_t> vertex_input_masks[VERTEX_INPUT_MASKS_SIZE] = {};

Vector<ShaderCompiler::GeneratedCode::Texture> texture_uniforms;
Expand Down Expand Up @@ -281,8 +282,8 @@ class SceneShaderForwardClustered {
virtual bool is_animated() const;
virtual bool casts_shadows() const;
virtual RS::ShaderNativeSourceCode get_native_source_code() const;
ShaderVersion _get_shader_version(PipelineVersion p_pipeline_version, uint32_t p_color_pass_flags, bool p_ubershader) const;
RID _get_shader_variant(ShaderVersion p_shader_version) const;
uint16_t _get_shader_version(PipelineVersion p_pipeline_version, uint32_t p_color_pass_flags, bool p_ubershader) const;
RID _get_shader_variant(uint16_t p_shader_version) const;
void _clear_vertex_input_mask_cache();
RID get_shader_variant(PipelineVersion p_pipeline_version, uint32_t p_color_pass_flags, bool p_ubershader) const;
uint64_t get_vertex_input_mask(PipelineVersion p_pipeline_version, uint32_t p_color_pass_flags, bool p_ubershader);
Expand Down
2 changes: 1 addition & 1 deletion servers/rendering/renderer_rd/renderer_canvas_render_rd.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class RendererCanvasRenderRD : public RendererCanvasRender {
uint32_t hash() const {
uint32_t h = hash_murmur3_one_32(variant);
h = hash_murmur3_one_32(framebuffer_format_id, h);
h = hash_murmur3_one_32(vertex_format_id, h);
h = hash_murmur3_one_64((uint64_t)vertex_format_id, h);
h = hash_murmur3_one_32(render_primitive, h);
h = hash_murmur3_one_32(shader_specialization.packed_0, h);
h = hash_murmur3_one_32(lcd_blend, h);
Expand Down
30 changes: 15 additions & 15 deletions servers/rendering/renderer_scene_cull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ void RendererSceneCull::_instance_unpair(Instance *p_A, Instance *p_B) {

if (geom->lightmap_captures.is_empty() && A->scenario && A->array_index >= 0) {
InstanceData &idata = A->scenario->instance_data[A->array_index];
idata.flags &= ~uint32_t(InstanceData::FLAG_LIGHTMAP_CAPTURE);
idata.flags &= ~InstanceData::FLAG_LIGHTMAP_CAPTURE;
}

lightmap_data->geometries.erase(A);
Expand Down Expand Up @@ -532,7 +532,7 @@ void RendererSceneCull::_instance_update_mesh_instance(Instance *p_instance) con
if (p_instance->mesh_instance.is_valid()) {
idata.flags |= InstanceData::FLAG_USES_MESH_INSTANCE;
} else {
idata.flags &= ~uint32_t(InstanceData::FLAG_USES_MESH_INSTANCE);
idata.flags &= ~InstanceData::FLAG_USES_MESH_INSTANCE;
}
}
}
Expand Down Expand Up @@ -1232,7 +1232,7 @@ void RendererSceneCull::instance_set_ignore_culling(RID p_instance, bool p_enabl
if (instance->ignore_all_culling) {
idata.flags |= InstanceData::FLAG_IGNORE_ALL_CULLING;
} else {
idata.flags &= ~uint32_t(InstanceData::FLAG_IGNORE_ALL_CULLING);
idata.flags &= ~InstanceData::FLAG_IGNORE_ALL_CULLING;
}
}
}
Expand Down Expand Up @@ -1324,7 +1324,7 @@ void RendererSceneCull::instance_geometry_set_flag(RID p_instance, RS::InstanceF
if (instance->baked_light) {
idata.flags |= InstanceData::FLAG_USES_BAKED_LIGHT;
} else {
idata.flags &= ~uint32_t(InstanceData::FLAG_USES_BAKED_LIGHT);
idata.flags &= ~InstanceData::FLAG_USES_BAKED_LIGHT;
}
}

Expand Down Expand Up @@ -1364,7 +1364,7 @@ void RendererSceneCull::instance_geometry_set_flag(RID p_instance, RS::InstanceF
if (instance->redraw_if_visible) {
idata.flags |= InstanceData::FLAG_REDRAW_IF_VISIBLE;
} else {
idata.flags &= ~uint32_t(InstanceData::FLAG_REDRAW_IF_VISIBLE);
idata.flags &= ~InstanceData::FLAG_REDRAW_IF_VISIBLE;
}
}

Expand All @@ -1377,7 +1377,7 @@ void RendererSceneCull::instance_geometry_set_flag(RID p_instance, RS::InstanceF
if (instance->ignore_occlusion_culling) {
idata.flags |= InstanceData::FLAG_IGNORE_OCCLUSION_CULLING;
} else {
idata.flags &= ~uint32_t(InstanceData::FLAG_IGNORE_OCCLUSION_CULLING);
idata.flags &= ~InstanceData::FLAG_IGNORE_OCCLUSION_CULLING;
}
}
} break;
Expand All @@ -1398,13 +1398,13 @@ void RendererSceneCull::instance_geometry_set_cast_shadows_setting(RID p_instanc
if (instance->cast_shadows != RS::SHADOW_CASTING_SETTING_OFF) {
idata.flags |= InstanceData::FLAG_CAST_SHADOWS;
} else {
idata.flags &= ~uint32_t(InstanceData::FLAG_CAST_SHADOWS);
idata.flags &= ~InstanceData::FLAG_CAST_SHADOWS;
}

if (instance->cast_shadows == RS::SHADOW_CASTING_SETTING_SHADOWS_ONLY) {
idata.flags |= InstanceData::FLAG_CAST_SHADOWS_ONLY;
} else {
idata.flags &= ~uint32_t(InstanceData::FLAG_CAST_SHADOWS_ONLY);
idata.flags &= ~InstanceData::FLAG_CAST_SHADOWS_ONLY;
}
}

Expand Down Expand Up @@ -2979,7 +2979,7 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
}
cull_data.cull->lock.unlock();

idata.flags &= ~uint32_t(InstanceData::FLAG_REFLECTION_PROBE_DIRTY);
idata.flags &= ~InstanceData::FLAG_REFLECTION_PROBE_DIRTY;
}

if (RSG::light_storage->reflection_probe_instance_has_reflection(RID::from_uint64(idata.instance_data_rid))) {
Expand Down Expand Up @@ -3068,7 +3068,7 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul

ERR_FAIL_NULL(geom->geometry_instance);
geom->geometry_instance->pair_light_instances(instance_pair_buffer, idx);
idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_LIGHTING_DIRTY);
idata.flags &= ~InstanceData::FLAG_GEOM_LIGHTING_DIRTY;
}

if (idata.flags & InstanceData::FLAG_GEOM_PROJECTOR_SOFTSHADOW_DIRTY) {
Expand All @@ -3078,7 +3078,7 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
cull_data.cull->lock.lock();
geom->geometry_instance->set_softshadow_projector_pairing(geom->softshadow_count > 0, geom->projector_count > 0);
cull_data.cull->lock.unlock();
idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_PROJECTOR_SOFTSHADOW_DIRTY);
idata.flags &= ~InstanceData::FLAG_GEOM_PROJECTOR_SOFTSHADOW_DIRTY;
}

if (geometry_instance_pair_mask & (1 << RS::INSTANCE_REFLECTION_PROBE) && (idata.flags & InstanceData::FLAG_GEOM_REFLECTION_DIRTY)) {
Expand All @@ -3096,7 +3096,7 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul

ERR_FAIL_NULL(geom->geometry_instance);
geom->geometry_instance->pair_reflection_probe_instances(instance_pair_buffer, idx);
idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_REFLECTION_DIRTY);
idata.flags &= ~InstanceData::FLAG_GEOM_REFLECTION_DIRTY;
}

if (geometry_instance_pair_mask & (1 << RS::INSTANCE_DECAL) && (idata.flags & InstanceData::FLAG_GEOM_DECAL_DIRTY)) {
Expand All @@ -3115,7 +3115,7 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
ERR_FAIL_NULL(geom->geometry_instance);
geom->geometry_instance->pair_decal_instances(instance_pair_buffer, idx);

idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_DECAL_DIRTY);
idata.flags &= ~InstanceData::FLAG_GEOM_DECAL_DIRTY;
}

if (idata.flags & InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY) {
Expand All @@ -3133,7 +3133,7 @@ void RendererSceneCull::_scene_cull(CullData &cull_data, InstanceCullResult &cul
ERR_FAIL_NULL(geom->geometry_instance);
geom->geometry_instance->pair_voxel_gi_instances(instance_pair_buffer, idx);

idata.flags &= ~uint32_t(InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY);
idata.flags &= ~InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY;
}

if ((idata.flags & InstanceData::FLAG_LIGHTMAP_CAPTURE) && idata.instance->last_frame_pass != frame_number && !idata.instance->lightmap_target_sh.is_empty() && !idata.instance->lightmap_sh.is_empty()) {
Expand Down Expand Up @@ -3993,7 +3993,7 @@ void RendererSceneCull::render_probes() {
ERR_FAIL_NULL(geom->geometry_instance);
geom->geometry_instance->pair_voxel_gi_instances(instance_pair_buffer, idx);

ins->scenario->instance_data[ins->array_index].flags &= ~uint32_t(InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY);
ins->scenario->instance_data[ins->array_index].flags &= ~InstanceData::FLAG_GEOM_VOXEL_GI_DIRTY;
}

ERR_FAIL_NULL(geom->geometry_instance);
Expand Down
2 changes: 1 addition & 1 deletion servers/rendering/renderer_scene_cull.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class RendererSceneCull : public RenderingMethod {
struct InstanceData {
// Store instance pointer as well as common instance processing information,
// to make processing more cache friendly.
enum Flags {
enum Flags : uint32_t {
FLAG_BASE_TYPE_MASK = 0xFF,
FLAG_CAST_SHADOWS = (1 << 8),
FLAG_CAST_SHADOWS_ONLY = (1 << 9),
Expand Down
Loading

0 comments on commit ffe53cb

Please sign in to comment.