[Bf-blender-cvs] [98021bd7d10] greasepencil-object: Move multisample textures to texture list
Antonio Vazquez
noreply at git.blender.org
Sun Jun 10 20:57:04 CEST 2018
Commit: 98021bd7d10ee3735b5212804d3f33fa2e9dea49
Author: Antonio Vazquez
Date: Sun Jun 10 20:56:56 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB98021bd7d10ee3735b5212804d3f33fa2e9dea49
Move multisample textures to texture list
If the texture is in e_data is shared for all viewports and fails.
===================================================================
M source/blender/draw/engines/gpencil/gpencil_engine.c
M source/blender/draw/engines/gpencil/gpencil_engine.h
M source/tools
===================================================================
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index b6e9ae1acb1..af5b60aed20 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -76,21 +76,23 @@ void DRW_gpencil_multisample_ensure(GPENCIL_Data *vedata, int rect_w, int rect_h
{
GPENCIL_FramebufferList *fbl = vedata->fbl;
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
+ DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
+
short samples = stl->storage->multisamples;
if (samples > 0) {
if (!fbl->multisample_fb) {
fbl->multisample_fb = GPU_framebuffer_create();
if (fbl->multisample_fb) {
- if (e_data.multisample_color == NULL) {
- e_data.multisample_color = GPU_texture_create_2D_multisample(rect_w, rect_h, GPU_RGBA8, NULL, samples, NULL);
+ if (dtxl->multisample_color == NULL) {
+ dtxl->multisample_color = GPU_texture_create_2D_multisample(rect_w, rect_h, GPU_RGBA8, NULL, samples, NULL);
}
- if (e_data.multisample_depth == NULL) {
- e_data.multisample_depth = GPU_texture_create_2D_multisample(rect_w, rect_h, GPU_DEPTH24_STENCIL8, NULL, samples, NULL);
+ if (dtxl->multisample_depth == NULL) {
+ dtxl->multisample_depth = GPU_texture_create_2D_multisample(rect_w, rect_h, GPU_DEPTH24_STENCIL8, NULL, samples, NULL);
}
GPU_framebuffer_ensure_config(&fbl->multisample_fb, {
- GPU_ATTACHMENT_TEXTURE(e_data.multisample_depth),
- GPU_ATTACHMENT_TEXTURE(e_data.multisample_color)
+ GPU_ATTACHMENT_TEXTURE(dtxl->multisample_depth),
+ GPU_ATTACHMENT_TEXTURE(dtxl->multisample_color)
});
if (!GPU_framebuffer_check_valid(fbl->multisample_fb, NULL)) {
GPU_framebuffer_free(fbl->multisample_fb);
@@ -239,8 +241,6 @@ static void GPENCIL_engine_free(void)
DRW_SHADER_FREE_SAFE(e_data.gpencil_paper_sh);
DRW_TEXTURE_FREE_SAFE(e_data.gpencil_blank_texture);
- DRW_TEXTURE_FREE_SAFE(e_data.multisample_color);
- DRW_TEXTURE_FREE_SAFE(e_data.multisample_depth);
}
void GPENCIL_cache_init(void *vedata)
@@ -560,9 +560,7 @@ void GPENCIL_draw_scene(void *ved)
GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
GPENCIL_FramebufferList *fbl = ((GPENCIL_Data *)vedata)->fbl;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
-#if 0
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
-#endif
int init_grp, end_grp;
tGPencilObjectCache *cache;
@@ -591,7 +589,7 @@ void GPENCIL_draw_scene(void *ved)
DRW_draw_pass(psl->painting_pass);
DRW_draw_pass(psl->drawing_pass);
- MULTISAMPLE_GP_SYNC_DISABLE(stl->storage->multisamples, fbl, dfbl->default_fb, e_data);
+ MULTISAMPLE_GP_SYNC_DISABLE(stl->storage->multisamples, fbl, dfbl->default_fb, dtxl);
/* free memory */
gpencil_free_obj_list(stl);
@@ -634,7 +632,7 @@ void GPENCIL_draw_scene(void *ved)
stl->shgroups[init_grp].shgrps_fill != NULL ? stl->shgroups[init_grp].shgrps_fill : stl->shgroups[init_grp].shgrps_stroke,
stl->shgroups[end_grp].shgrps_stroke);
- MULTISAMPLE_GP_SYNC_DISABLE(stl->storage->multisamples, fbl, fbl->temp_fb_a, e_data);
+ MULTISAMPLE_GP_SYNC_DISABLE(stl->storage->multisamples, fbl, fbl->temp_fb_a, dtxl);
}
/* Current buffer drawing */
if ((!is_render) && (gpd->sbuffer_size > 0)) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 3b4a0fcf1a0..aa21fca370a 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -143,6 +143,11 @@ typedef struct GPENCIL_FramebufferList {
typedef struct GPENCIL_TextureList {
struct GPUTexture *texture;
+
+ /* multisample textures */
+ struct GPUTexture *multisample_color;
+ struct GPUTexture *multisample_depth;
+
} GPENCIL_TextureList;
typedef struct GPENCIL_Data {
@@ -202,10 +207,6 @@ typedef struct GPENCIL_e_data {
struct GPUTexture *painting_depth_tx;
struct GPUTexture *painting_color_tx;
- /* multisample textures */
- struct GPUTexture *multisample_color;
- struct GPUTexture *multisample_depth;
-
struct GPUTexture *gpencil_blank_texture;
/* runtime pointers texture */
@@ -291,11 +292,11 @@ void GPENCIL_render_to_image(void *vedata, struct RenderEngine *engine, struct R
} \
}
-#define MULTISAMPLE_GP_SYNC_DISABLE(lvl, fbl, fb, e_data) { \
+#define MULTISAMPLE_GP_SYNC_DISABLE(lvl, fbl, fb, dtxl) { \
if ((lvl > 0) && (fbl->multisample_fb != NULL)) { \
DRW_stats_query_start("GP Multisample Resolve"); \
GPU_framebuffer_bind(fb); \
- DRW_multisamples_resolve(e_data.multisample_depth, e_data.multisample_color); \
+ DRW_multisamples_resolve(dtxl->multisample_depth, dtxl->multisample_color); \
DRW_stats_query_end(); \
} \
}
diff --git a/source/tools b/source/tools
index 9d7d338cb25..b11375e8906 160000
--- a/source/tools
+++ b/source/tools
@@ -1 +1 @@
-Subproject commit 9d7d338cb25a071f9646cf9ba16f17004c963f77
+Subproject commit b11375e89061303401376f7aeae42ac2fd64692a
More information about the Bf-blender-cvs
mailing list