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

This commit is contained in:
Rémi Verschelde 2022-03-17 19:55:40 +01:00 committed by GitHub
commit e142c10fc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 13 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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));

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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;