Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpu/intern/gpu_extensions.cc')
-rw-r--r--source/blender/gpu/intern/gpu_extensions.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/gpu/intern/gpu_extensions.cc b/source/blender/gpu/intern/gpu_extensions.cc
index a9ab25cbb41..8074e4b64f0 100644
--- a/source/blender/gpu/intern/gpu_extensions.cc
+++ b/source/blender/gpu/intern/gpu_extensions.cc
@@ -31,6 +31,8 @@
#include "BKE_global.h"
#include "MEM_guardedalloc.h"
+#include "DNA_userdef_types.h"
+
#include "GPU_extensions.h"
#include "GPU_framebuffer.h"
#include "GPU_glew.h"
@@ -95,7 +97,7 @@ static struct GPUGlobal {
bool broken_amd_driver;
/* Some crappy Intel drivers don't work well with shaders created in different
* rendering contexts. */
- bool context_local_shaders_workaround;
+ bool use_main_context_workaround;
/* Intel drivers exhibit artifacts when using #glCopyImageSubData & workbench anti-aliasing.
* (see T76273) */
bool texture_copy_workaround;
@@ -104,8 +106,7 @@ static struct GPUGlobal {
static void gpu_detect_mip_render_workaround(void)
{
int cube_size = 2;
- float *source_pix = (float *)MEM_callocN(sizeof(float) * 4 * 6 * cube_size * cube_size,
- __func__);
+ float *source_pix = (float *)MEM_callocN(sizeof(float[4][6]) * cube_size * cube_size, __func__);
float clear_color[4] = {1.0f, 0.5f, 0.0f, 0.0f};
GPUTexture *tex = GPU_texture_create_cube(cube_size, GPU_RGBA16F, source_pix, NULL);
@@ -223,9 +224,9 @@ bool GPU_unused_fb_slot_workaround(void)
return GG.unused_fb_slot_workaround;
}
-bool GPU_context_local_shaders_workaround(void)
+bool GPU_use_main_context_workaround(void)
{
- return GG.context_local_shaders_workaround;
+ return GG.use_main_context_workaround;
}
bool GPU_texture_copy_workaround(void)
@@ -239,6 +240,13 @@ bool GPU_crappy_amd_driver(void)
return GG.broken_amd_driver;
}
+int GPU_texture_size_with_limit(int res)
+{
+ int size = GPU_max_texture_size();
+ int reslimit = (U.glreslimit != 0) ? min_ii(U.glreslimit, size) : size;
+ return min_ii(reslimit, res);
+}
+
void gpu_extensions_init(void)
{
/* during 2.8 development each platform has its own OpenGL minimum requirements
@@ -382,12 +390,12 @@ void gpu_extensions_init(void)
/* Maybe not all of these drivers have problems with `GLEW_ARB_base_instance`.
* But it's hard to test each case. */
GG.glew_arb_base_instance_is_supported = false;
- GG.context_local_shaders_workaround = true;
+ GG.use_main_context_workaround = true;
}
if (strstr(version, "Build 20.19.15.4285")) {
/* Somehow fixes armature display issues (see T69743). */
- GG.context_local_shaders_workaround = true;
+ GG.use_main_context_workaround = true;
}
}
else if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE) &&