Commit Graph

112 Commits

Author SHA1 Message Date
6de0da70de GPU not able to allocate texture
In the case of the report a GL_PROXY_TEXTURE_2D_ARRAY of 2509x2509x1 failed to be allocated.
This is a work around as the GL_PROXY_TEXTURE_* is not reliable.

Reviewed By: brecht, fclem

Maniphest Tasks: T63223

Differential Revision: https://developer.blender.org/D4651
2019-04-05 14:40:54 +02:00
6470056a0d Cleanup: empty expression statement warning 2019-04-02 17:54:04 +11:00
16694ed408 Cleanup: redundant use of string formatting functions 2019-03-24 16:09:46 +11:00
e061cb4437 GPU: Create and use new GPU_texture_read_rect utility. 2019-03-22 13:08:02 -03:00
4fa904e91c Cleanup: use lowercase for dimensions in function names
Most API's already use this convention.
2019-03-20 18:25:27 +11:00
e7fd6c8f30 Cleanup: comment blocks 2019-03-19 15:17:46 +11:00
7d792976e1 doxygen: update doxygen & add balembic group 2019-02-18 11:23:40 +11:00
65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
68cab3aff6 Cleanup: replace attrib w/ attr
Also rename GPUVertexAttribs to GPUVertAttrLayers,
avoids confusion with GPUVertAttr which isn't closely related.
2019-01-29 08:32:25 +11:00
1e4aab36c2 Cleanup: remove redundant BKE/BLI/BIF headers 2019-01-26 21:20:25 +11:00
aae2bf7735 T60745: GPU texture alloc failed when opening Preference Windows
Was generating INVALID_FRAMEBUFFER here instead of failled texture alloc.

Add safety asserts in gpu_texture.c and clamp minimum size to 1 inside
GPU_offscreen_create.
2019-01-25 15:02:30 +01:00
2e4f1b592f Cleanup: use eGPU prefix for GPU enum types 2019-01-23 14:16:03 +11:00
ba1f178c1c Fix T56185, T59351: bypass GL_PROXY_TEXTURE.. test on AMD GPU + windows
This replaces the test of consistency and capacity made with `GL_PROXY_TEXTURE_..` on AMD GPUs with one that checks only if the texture fits the limits of size and layer.

Differential Revision: https://developer.blender.org/D4081
2018-12-14 21:33:31 -02:00
b7933cc601 GPUTexture: Add debug print for cubemap textures 2018-12-11 22:30:41 +01:00
70d38a996e GPUTexture: Fix memory statistics not working for Multisamples textures
and also output the vram footprint of the texture at the creation.

Also output the full texture memory usage if alloc fails.
2018-12-11 22:10:16 +01:00
0ba02c6e9e GPUTexture: Add debug output to check what texture was created 2018-12-11 21:15:50 +01:00
24fd03d0c2 Workbench: Reduce VRAM usage depending on mode
We exploit the fact that we are using the metallic workflow for material
and pass the metallic parameter instead of the specular color.

Pack the front facing bit in the color buffer only for matcap display.

Change buffer formats to use less bytes as possible.

Also don't request buffers that we won't use.

Saved 40MB on 2K screen on StudioLight + Shadows + Specular Lighting.

Includes several cleanups.
2018-12-03 17:19:11 +01:00
e1023014f4 GPUTexture: Add support for GL_R16 texture format 2018-11-30 02:02:36 +01:00
70d73ff500 Eevee: SSS: Fix issue with mac and stencil buffer blitting
Adding a workaround in this case: we blit the depth buffer instead of the
stencil buffer and use the copy as the texture. This is slower but at
least it should work.
2018-10-26 10:54:21 +02:00
d5fe6e4785 GPU: Add workarounds for buggy glBlitFramebuffer function on macOS + Radeon
When calling glBlitFramebuffer on most (if not all) mac that have a GPU
from the Radeon Pro series, the data is not properly copied and only a
subset of the pixels are correctly copied.

This only happens when blitting the depth buffer if the depth buffer is
GL_DEPTH24_STENCIL8.

Changing the depth buffer format to GPU_DEPTH32F_STENCIL8 fixes the issue
but only works if blitting the depth componnent. The stencil componnent
still provoke issues when being copied.
2018-10-26 10:54:21 +02:00
48b56481ea GPUTexture: Add supports for GL_DEPTH32F_STENCIL8 texture format 2018-10-26 10:54:21 +02:00
2d084d4ec4 GPU: Fix Issue with recursive downsample and Intel HDXXX
This is caused by a driver bug that prevent us from rendering to (or even
binding) a texture mip level that is below GL_TEXTURE_MAX_LEVEL of the
target texture. This is fine in most drivers (and legal AFAIK) but not on
thoses Intels HDXXX + Windows.

As a fix we just put GL_TEXTURE_MAX_LEVEL lower (which is illegal because
it is undefined behaviour), but in practice it works ok and does not
trigger any warnings or errors.

This commit fixes most of the problems encountered on these GPUs (T56668).
2018-10-22 13:00:40 +02:00
9b692ecabd GPUTexture: Add support for GPU_RGBA8UI 2018-10-12 16:38:55 +02:00
342e73f90f Spelling fixes in comments and descriptions (2.8 changes), patch by luzpaz.
Differential Revision: https://developer.blender.org/D3719
2018-09-24 18:48:29 +02:00
b3a9069170 GPUTexture: Fix problem with glGenerateMipmap
Fix T56789: There was issue with certain driver with glGenerateMipmap and
GPU_DEPTH_COMPONENT24.
In this case we just create a complete texture with mipmaps manually
without downsampling / initializing the data.
2018-09-15 00:11:25 +02:00
7eecc94074 Cleanup: use uint/uchar types in GPU 2018-09-12 12:19:46 +10:00
2a907bea9c Fix assert when toggling Xray mode after going to Solid and lookedev/eevee 2018-09-10 18:05:11 +02:00
bf6a22ed6f GPUMaterial: Group all colorband texture together
This lower the use of texture samplers slots and let users use more real
textures in their shaders.

This patch also make the ramp texture 16 bit floating point. Meaning you
can now use value greater than one in your color ramps.

With the limit of 128 colorband per shader (a color band being either a
color ramp, a wavelength node or a curve node (and maybe wavelength node in
the future)).

Only drawback with the current implementation is that it does not remove
colorband from pruned GPUNodes but it shouldn't really matter in practice.

This should fix T56010
2018-08-10 16:16:35 +02:00
bdbc6fafc0 GPUTexture: Fix wrong texture size check 2018-07-27 17:51:26 +02:00
0d20207771 Fix GPU build error after recent commit. 2018-07-27 14:17:37 +02:00
141e94f87f Fix T55888: Eevee: crash when shadow cube size is > 512px
Note that this was only reported to happen on AMD GPU + windows.
2018-07-27 13:56:07 +02:00
5037dd8abd GPU: Add GC to FBOs and UBOs and centralize all GCs
GPUFrameBuffers were being free when no context was attached or in the
wrong gl context. This make sure this does not happen again.

You can now safely free any gl resource from any thread (well as long as
it's not used anymore!).
2018-07-19 16:13:15 +02:00
428743a9b0 Cleanup: style for GPU module 2018-07-18 23:10:31 +10:00
8cd7828792 GWN: Port to GPU module: Replace GWN prefix by GPU 2018-07-18 11:49:15 +02:00
dfd192ce41 GPUTexture: Refactor of texture creation & new feature
- Texture creation now requires explicit data type.
- GPU_texture_add_mipmap enable explicit mipmap upload.
- GPU_texture_get_mipmap_size can be used to get the size of a mipmap level
  of an existing GPUTexture
- GPU_texture_read let you read back data from a gpu texture.
2018-07-10 15:31:34 +02:00
804205babe Cleanup: rename 'ct' to 'len' for gawain 2018-07-08 13:05:41 +02:00
6f2c9ea3e1 bf_gpu: Add GPU_state module.
This has wrappers for the most common gl* functions in the codebase, and is in preparation for D3502

Reviewers: brecht, fclem

Differential Revision: https://developer.blender.org/D3501
2018-06-26 15:17:31 -06:00
29c1069244 Cleanup: code style 2018-06-25 12:06:51 +02:00
c517778a8b Cleanup: style 2018-06-22 08:18:02 +02:00
61bed8768d Cleanup: suppress assert in recent GPU refactor 2018-06-22 08:11:17 +02:00
84ae0fe3a5 GLRefactor: Refactor bf_blenfont to use GPUTexture instead of raw GL calls and types.
In an effort to centralize all opengl calls in the codebase, this patch replaces
the raw opengl calls in bf_blenfont with GPUTexture so it's no longer depended
on opengl headers.

reviewer: Brecht

Differential Revision: https://developer.blender.org/D3483
2018-06-21 18:36:05 -06:00
1dc93f90a0 Cleanup: remove image->bindcode, always wrap in GPUTexture.
This simplifies code, and will hopefully make UDIM usage of GPUTexture
a little easier.
2018-06-11 23:24:04 +02:00
1d111cd046 Revert "Cleanup: remove image->bindcode, always wrap in GPUTexture."
This reverts commit 8242a5bc85. This isn't
quite ready to use yet.
2018-06-11 22:35:09 +02:00
8242a5bc85 Cleanup: remove image->bindcode, always wrap in GPUTexture. 2018-06-11 22:30:59 +02:00
Dalai Felinto
856a79e1fb Rename: GPU_texture_orphans 2018-06-08 16:20:34 +02:00
0911acb5cf Merge branch 'master' into blender2.8 2018-06-04 09:11:45 +02:00
6654e109df Cleanup: strip trailing space in GPU module 2018-06-04 09:09:12 +02:00
06dd89b0ca GPUTexture: Fix memleak in orphaned texture management. 2018-06-03 16:45:03 +02:00
6c6c4da718 GPU: Fix texture being freed in threads without ogl context bound.
This is a dirty fix. A bit more cleaner approach would be to check if a
context is bound and delay the deletion only in this case.
Also we may want to do this orphan deletion at some other places than
wm_window_swap_buffers.
2018-06-02 21:16:40 +02:00
494470ba23 GPUTexture: Expose GPU_texture_create_buffer and add GL_R32I support. 2018-05-31 19:09:20 +02:00