Przeglądaj źródła

Merge pull request #58993 from notSanil/device-limit-exceeded-fix

Rémi Verschelde 3 lat temu
rodzic
commit
e142c10fc5

+ 1 - 1
drivers/vulkan/rendering_device_vulkan.cpp

@@ -9295,7 +9295,7 @@ String RenderingDeviceVulkan::get_captured_timestamp_name(uint32_t p_index) cons
 	return frames[frame].timestamp_result_names[p_index];
 }
 
-int RenderingDeviceVulkan::limit_get(Limit p_limit) {
+uint64_t RenderingDeviceVulkan::limit_get(Limit p_limit) {
 	switch (p_limit) {
 		case LIMIT_MAX_BOUND_UNIFORM_SETS:
 			return limits.maxBoundDescriptorSets;

+ 1 - 1
drivers/vulkan/rendering_device_vulkan.h

@@ -1203,7 +1203,7 @@ public:
 	/**** Limits ****/
 	/****************/
 
-	virtual int limit_get(Limit p_limit);
+	virtual uint64_t limit_get(Limit p_limit);
 
 	virtual void prepare_screen_for_drawing();
 	void initialize(VulkanContext *p_context, bool p_local_device = false);

+ 1 - 1
servers/rendering/renderer_rd/renderer_canvas_render_rd.cpp

@@ -2259,7 +2259,7 @@ RendererCanvasRenderRD::RendererCanvasRenderRD(RendererStorageRD *p_storage) {
 
 		String global_defines;
 
-		uint32_t uniform_max_size = RD::get_singleton()->limit_get(RD::LIMIT_MAX_UNIFORM_BUFFER_SIZE);
+		uint64_t uniform_max_size = RD::get_singleton()->limit_get(RD::LIMIT_MAX_UNIFORM_BUFFER_SIZE);
 		if (uniform_max_size < 65536) {
 			//Yes, you guessed right, ARM again
 			state.max_lights_per_render = 64;

+ 1 - 1
servers/rendering/renderer_rd/renderer_compositor_rd.cpp

@@ -291,7 +291,7 @@ RendererCompositorRD::RendererCompositorRD() {
 	canvas = memnew(RendererCanvasRenderRD(storage));
 
 	back_end = (bool)(int)GLOBAL_GET("rendering/vulkan/rendering/back_end");
-	uint32_t textures_per_stage = RD::get_singleton()->limit_get(RD::LIMIT_MAX_TEXTURES_PER_SHADER_STAGE);
+	uint64_t textures_per_stage = RD::get_singleton()->limit_get(RD::LIMIT_MAX_TEXTURES_PER_SHADER_STAGE);
 
 	if (back_end || textures_per_stage < 48) {
 		scene = memnew(RendererSceneRenderImplementation::RenderForwardMobile(storage));

+ 5 - 5
servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp

@@ -2456,7 +2456,7 @@ void RendererSceneGIRD::VoxelGIInstance::update(bool p_update_light_instances, c
 				passes = 1; //only re-blitting is necessary
 			}
 			int wg_size = 64;
-			int wg_limit_x = RD::get_singleton()->limit_get(RD::LIMIT_MAX_COMPUTE_WORKGROUP_COUNT_X);
+			uint64_t wg_limit_x = RD::get_singleton()->limit_get(RD::LIMIT_MAX_COMPUTE_WORKGROUP_COUNT_X);
 
 			for (int pass = 0; pass < passes; pass++) {
 				if (p_update_light_instances) {
@@ -2479,9 +2479,9 @@ void RendererSceneGIRD::VoxelGIInstance::update(bool p_update_light_instances, c
 						push_constant.cell_offset = mipmaps[i].cell_offset;
 						push_constant.cell_count = mipmaps[i].cell_count;
 
-						int wg_todo = (mipmaps[i].cell_count - 1) / wg_size + 1;
+						int64_t wg_todo = (mipmaps[i].cell_count - 1) / wg_size + 1;
 						while (wg_todo) {
-							int wg_count = MIN(wg_todo, wg_limit_x);
+							int64_t wg_count = MIN(wg_todo, wg_limit_x);
 							RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(VoxelGIPushConstant));
 							RD::get_singleton()->compute_list_dispatch(compute_list, wg_count, 1, 1);
 							wg_todo -= wg_count;
@@ -2500,9 +2500,9 @@ void RendererSceneGIRD::VoxelGIInstance::update(bool p_update_light_instances, c
 					push_constant.cell_offset = mipmaps[i].cell_offset;
 					push_constant.cell_count = mipmaps[i].cell_count;
 
-					int wg_todo = (mipmaps[i].cell_count - 1) / wg_size + 1;
+					int64_t wg_todo = (mipmaps[i].cell_count - 1) / wg_size + 1;
 					while (wg_todo) {
-						int wg_count = MIN(wg_todo, wg_limit_x);
+						int64_t wg_count = MIN(wg_todo, wg_limit_x);
 						RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(VoxelGIPushConstant));
 						RD::get_singleton()->compute_list_dispatch(compute_list, wg_count, 1, 1);
 						wg_todo -= wg_count;

+ 1 - 1
servers/rendering/renderer_rd/renderer_storage_rd.cpp

@@ -8490,7 +8490,7 @@ RendererStorageRD::RendererStorageRD() {
 
 	using_lightmap_array = true; // high end
 	if (using_lightmap_array) {
-		uint32_t textures_per_stage = RD::get_singleton()->limit_get(RD::LIMIT_MAX_TEXTURES_PER_SHADER_STAGE);
+		uint64_t textures_per_stage = RD::get_singleton()->limit_get(RD::LIMIT_MAX_TEXTURES_PER_SHADER_STAGE);
 
 		if (textures_per_stage <= 256) {
 			lightmap_textures.resize(32);

+ 1 - 1
servers/rendering/rendering_device.h

@@ -1222,7 +1222,7 @@ public:
 		LIMIT_MAX_COMPUTE_WORKGROUP_SIZE_Z,
 	};
 
-	virtual int limit_get(Limit p_limit) = 0;
+	virtual uint64_t limit_get(Limit p_limit) = 0;
 
 	//methods below not exposed, used by RenderingDeviceRD
 	virtual void prepare_screen_for_drawing() = 0;

+ 2 - 2
servers/rendering/shader_language.cpp

@@ -7483,8 +7483,8 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
 	int uniforms = 0;
 	int instance_index = 0;
 #ifdef DEBUG_ENABLED
-	int uniform_buffer_size = 0;
-	int max_uniform_buffer_size = 0;
+	uint64_t uniform_buffer_size = 0;
+	uint64_t max_uniform_buffer_size = 0;
 	int uniform_buffer_exceeded_line = -1;
 
 	bool check_device_limit_warnings = false;