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:
authorClément Foucault <foucault.clem@gmail.com>2018-12-03 02:36:54 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-12-03 19:19:11 +0300
commit24fd03d0c2fc5f49bc3813afce7ac5d67fc762bd (patch)
tree4af65d73762c28ce003d425cb288d66bec226a3d /source/blender/gpu
parent17a4323ef59570975b254da9936fde16969b1df0 (diff)
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.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_texture.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index d5b33b88350..0944e5e4e44 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -178,8 +178,8 @@ static void gpu_validate_data_format(GPUTextureFormat tex_format, GPUDataFormat
}
else {
/* Integer formats */
- if (ELEM(tex_format, GPU_RG16I, GPU_R16I, GPU_RG16UI, GPU_R16UI, GPU_R32UI)) {
- if (ELEM(tex_format, GPU_R16UI, GPU_RG16UI, GPU_R32UI)) {
+ if (ELEM(tex_format, GPU_RG16I, GPU_R16I, GPU_RG16UI, GPU_R16UI, GPU_R8UI, GPU_R32UI)) {
+ if (ELEM(tex_format, GPU_R8UI, GPU_R16UI, GPU_RG16UI, GPU_R32UI)) {
BLI_assert(data_format == GPU_DATA_UNSIGNED_INT);
}
else {
@@ -218,8 +218,8 @@ static GPUDataFormat gpu_get_data_format_from_tex_format(GPUTextureFormat tex_fo
}
else {
/* Integer formats */
- if (ELEM(tex_format, GPU_RG16I, GPU_R16I, GPU_RG16UI, GPU_R16UI, GPU_R32UI)) {
- if (ELEM(tex_format, GPU_R16UI, GPU_RG16UI, GPU_R32UI)) {
+ if (ELEM(tex_format, GPU_RG16I, GPU_R16I, GPU_RG16UI, GPU_R8UI, GPU_R16UI, GPU_R32UI)) {
+ if (ELEM(tex_format, GPU_R8UI, GPU_R16UI, GPU_RG16UI, GPU_R32UI)) {
return GPU_DATA_UNSIGNED_INT;
}
else {
@@ -260,7 +260,7 @@ static GLenum gpu_get_gl_dataformat(GPUTextureFormat data_type, GPUTextureFormat
}
else {
/* Integer formats */
- if (ELEM(data_type, GPU_RG16I, GPU_R16I, GPU_RG16UI, GPU_R16UI, GPU_R32UI)) {
+ if (ELEM(data_type, GPU_R8UI, GPU_RG16I, GPU_R16I, GPU_RG16UI, GPU_R16UI, GPU_R32UI)) {
*format_flag |= GPU_FORMAT_INTEGER;
switch (gpu_get_component_count(data_type)) {
@@ -327,6 +327,7 @@ static uint gpu_get_bytesize(GPUTextureFormat data_type)
case GPU_R16:
return 2;
case GPU_R8:
+ case GPU_R8UI:
return 1;
default:
BLI_assert(!"Texture format incorrect or unsupported\n");
@@ -360,6 +361,7 @@ static GLenum gpu_get_gl_internalformat(GPUTextureFormat format)
case GPU_RG16UI: return GL_RG16UI;
case GPU_R16: return GL_R16;
case GPU_R8: return GL_R8;
+ case GPU_R8UI: return GL_R8UI;
/* Special formats texture & renderbuffer */
case GPU_R11F_G11F_B10F: return GL_R11F_G11F_B10F;
case GPU_DEPTH24_STENCIL8: return GL_DEPTH24_STENCIL8;