diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-11-02 16:58:49 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-11-02 17:45:13 +0300 |
commit | 721a19d2b8a7784c48c753d57dfbf984524a54de (patch) | |
tree | 0be919eabfa00b65ad70a5bdea11d9676e31c9cb /source/blender/gpu/intern/gpu_extensions.c | |
parent | 00ef0a4d8efc783e93d2e524d3a9d59a0230704f (diff) |
GPU: Add safety check for max line width
On some platform does not support line width > 1.0 and can even throw and
error. Better check an at least display something rather than no lines at
all.
Diffstat (limited to 'source/blender/gpu/intern/gpu_extensions.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index 36e69f96b78..2237a6ea49c 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -80,6 +80,7 @@ static struct GPUGlobal { GPUDeviceType device; GPUOSType os; GPUDriverType driver; + float line_width_range[2]; /* workaround for different calculation of dfdy factors on GPUs. Some GPUs/drivers * calculate dfdy in shader differently when drawing to an offscreen buffer. First * number is factor on screen and second is off-screen */ @@ -190,6 +191,11 @@ int GPU_max_ubo_size(void) return GG.maxubosize; } +float GPU_max_line_width(void) +{ + return GG.line_width_range[1]; +} + void GPU_get_dfdy_factors(float fac[2]) { copy_v2_v2(fac, GG.dfdyfactors); @@ -230,6 +236,8 @@ void gpu_extensions_init(void) glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, &GG.maxubobinds); glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &GG.maxubosize); + glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, GG.line_width_range); + #ifndef NDEBUG GLint ret; glBindFramebuffer(GL_FRAMEBUFFER, 0); |