Draw Manager: Use Texture flag in Framebuffer init.
This commit is contained in:
@@ -341,7 +341,7 @@ static void CLAY_engine_init(void *vedata)
|
||||
|
||||
{
|
||||
float *viewport_size = DRW_viewport_size_get();
|
||||
DRWFboTexture tex = {&txl->depth_dup, DRW_BUF_DEPTH_24};
|
||||
DRWFboTexture tex = {&txl->depth_dup, DRW_BUF_DEPTH_24, 0};
|
||||
DRW_framebuffer_init(&fbl->dupli_depth,
|
||||
(int)viewport_size[0], (int)viewport_size[1],
|
||||
&tex, 1);
|
||||
|
@@ -58,7 +58,7 @@ static void EEVEE_engine_init(void *vedata)
|
||||
EEVEE_FramebufferList *fbl = ((EEVEE_Data *)vedata)->fbl;
|
||||
EEVEE_StorageList *stl = ((EEVEE_Data *)vedata)->stl;
|
||||
|
||||
DRWFboTexture tex = {&txl->color, DRW_BUF_RGBA_16};
|
||||
DRWFboTexture tex = {&txl->color, DRW_BUF_RGBA_16, DRW_TEX_FILTER};
|
||||
|
||||
float *viewport_size = DRW_viewport_size_get();
|
||||
DRW_framebuffer_init(&fbl->main,
|
||||
|
@@ -159,6 +159,7 @@ void DRW_uniformbuffer_free(struct GPUUniformBuffer *ubo);
|
||||
typedef struct DRWFboTexture {
|
||||
struct GPUTexture **tex;
|
||||
int format;
|
||||
DRWTextureFlag flag;
|
||||
} DRWFboTexture;
|
||||
|
||||
void DRW_framebuffer_init(struct GPUFrameBuffer **fb, int width, int height, DRWFboTexture textures[MAX_FBO_TEX], int texnbr);
|
||||
|
@@ -1219,8 +1219,11 @@ bool DRW_is_object_renderable(Object *ob)
|
||||
|
||||
/* ****************************************** Framebuffers ******************************************/
|
||||
|
||||
static GPUTextureFormat convert_tex_format(int fbo_format, int *channels)
|
||||
static GPUTextureFormat convert_tex_format(int fbo_format, int *channels, bool *is_depth)
|
||||
{
|
||||
*is_depth = ((fbo_format == DRW_BUF_DEPTH_16) ||
|
||||
(fbo_format == DRW_BUF_DEPTH_24));
|
||||
|
||||
switch (fbo_format) {
|
||||
case DRW_BUF_RGBA_8: *channels = 4; return GPU_RGBA8;
|
||||
case DRW_BUF_RGBA_16: *channels = 4; return GPU_RGBA16F;
|
||||
@@ -1246,18 +1249,13 @@ void DRW_framebuffer_init(struct GPUFrameBuffer **fb, int width, int height, DRW
|
||||
|
||||
if (!*fbotex.tex) {
|
||||
int channels;
|
||||
GPUTextureFormat gpu_format = convert_tex_format(fbotex.format, &channels);
|
||||
bool is_depth;
|
||||
GPUTextureFormat gpu_format = convert_tex_format(fbotex.format, &channels, &is_depth);
|
||||
|
||||
/* TODO refine to opengl formats */
|
||||
if (fbotex.format == DRW_BUF_DEPTH_16 ||
|
||||
fbotex.format == DRW_BUF_DEPTH_24)
|
||||
{
|
||||
*fbotex.tex = GPU_texture_create_depth(width, height, NULL);
|
||||
GPU_texture_compare_mode(*fbotex.tex, false);
|
||||
GPU_texture_filter_mode(*fbotex.tex, false);
|
||||
}
|
||||
else {
|
||||
*fbotex.tex = GPU_texture_create_2D_custom(width, height, channels, gpu_format, NULL, NULL);
|
||||
*fbotex.tex = GPU_texture_create_2D_custom(width, height, channels, gpu_format, NULL, NULL);
|
||||
drw_texture_set_parameters(*fbotex.tex, fbotex.flag);
|
||||
|
||||
if (!is_depth) {
|
||||
++color_attachment;
|
||||
}
|
||||
}
|
||||
|
@@ -123,8 +123,8 @@ static void EDIT_CURVE_engine_init(void *vedata)
|
||||
|
||||
/* Init Framebuffers like this: order is attachment order (for color texs) */
|
||||
/*
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24},
|
||||
* {&txl->color, DRW_BUF_RGBA_8}};
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0},
|
||||
* {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
*/
|
||||
|
||||
/* DRW_framebuffer_init takes care of checking if
|
||||
|
@@ -121,8 +121,8 @@ static void EDIT_LATTICE_engine_init(void *vedata)
|
||||
|
||||
/* Init Framebuffers like this: order is attachment order (for color texs) */
|
||||
/*
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24},
|
||||
* {&txl->color, DRW_BUF_RGBA_8}};
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0},
|
||||
* {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
*/
|
||||
|
||||
/* DRW_framebuffer_init takes care of checking if
|
||||
|
@@ -135,8 +135,8 @@ static void EDIT_MESH_engine_init(void *vedata)
|
||||
|
||||
float *viewport_size = DRW_viewport_size_get();
|
||||
|
||||
DRWFboTexture tex[2] = {{&txl->occlude_wire_depth_tx, DRW_BUF_DEPTH_24},
|
||||
{&txl->occlude_wire_color_tx, DRW_BUF_RGBA_8}};
|
||||
DRWFboTexture tex[2] = {{&txl->occlude_wire_depth_tx, DRW_BUF_DEPTH_24, 0},
|
||||
{&txl->occlude_wire_color_tx, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
DRW_framebuffer_init(&fbl->occlude_wire_fb,
|
||||
(int)viewport_size[0], (int)viewport_size[1],
|
||||
tex, 2);
|
||||
|
@@ -121,8 +121,8 @@ static void EDIT_METABALL_engine_init(void *vedata)
|
||||
|
||||
/* Init Framebuffers like this: order is attachment order (for color texs) */
|
||||
/*
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24},
|
||||
* {&txl->color, DRW_BUF_RGBA_8}};
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0},
|
||||
* {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
*/
|
||||
|
||||
/* DRW_framebuffer_init takes care of checking if
|
||||
|
@@ -121,8 +121,8 @@ static void EDIT_SURFACE_engine_init(void *vedata)
|
||||
|
||||
/* Init Framebuffers like this: order is attachment order (for color texs) */
|
||||
/*
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24},
|
||||
* {&txl->color, DRW_BUF_RGBA_8}};
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0},
|
||||
* {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
*/
|
||||
|
||||
/* DRW_framebuffer_init takes care of checking if
|
||||
|
@@ -121,8 +121,8 @@ static void EDIT_TEXT_engine_init(void *vedata)
|
||||
|
||||
/* Init Framebuffers like this: order is attachment order (for color texs) */
|
||||
/*
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24},
|
||||
* {&txl->color, DRW_BUF_RGBA_8}};
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0},
|
||||
* {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
*/
|
||||
|
||||
/* DRW_framebuffer_init takes care of checking if
|
||||
|
@@ -196,13 +196,13 @@ static void OBJECT_engine_init(void *vedata)
|
||||
|
||||
float *viewport_size = DRW_viewport_size_get();
|
||||
|
||||
DRWFboTexture tex[2] = {{&txl->outlines_depth_tx, DRW_BUF_DEPTH_24},
|
||||
{&txl->outlines_color_tx, DRW_BUF_RGBA_8}};
|
||||
DRWFboTexture tex[2] = {{&txl->outlines_depth_tx, DRW_BUF_DEPTH_24, 0},
|
||||
{&txl->outlines_color_tx, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
DRW_framebuffer_init(&fbl->outlines,
|
||||
(int)viewport_size[0], (int)viewport_size[1],
|
||||
tex, 2);
|
||||
|
||||
DRWFboTexture blur_tex = {&txl->outlines_blur_tx, DRW_BUF_RGBA_8};
|
||||
DRWFboTexture blur_tex = {&txl->outlines_blur_tx, DRW_BUF_RGBA_8, DRW_TEX_FILTER};
|
||||
DRW_framebuffer_init(&fbl->blur,
|
||||
(int)viewport_size[0], (int)viewport_size[1],
|
||||
&blur_tex, 1);
|
||||
|
@@ -121,8 +121,8 @@ static void PAINT_TEXTURE_engine_init(void *vedata)
|
||||
|
||||
/* Init Framebuffers like this: order is attachment order (for color texs) */
|
||||
/*
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24},
|
||||
* {&txl->color, DRW_BUF_RGBA_8}};
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0},
|
||||
* {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
*/
|
||||
|
||||
/* DRW_framebuffer_init takes care of checking if
|
||||
|
@@ -121,8 +121,8 @@ static void PAINT_VERTEX_engine_init(void *vedata)
|
||||
|
||||
/* Init Framebuffers like this: order is attachment order (for color texs) */
|
||||
/*
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24},
|
||||
* {&txl->color, DRW_BUF_RGBA_8}};
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0},
|
||||
* {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
*/
|
||||
|
||||
/* DRW_framebuffer_init takes care of checking if
|
||||
|
@@ -121,8 +121,8 @@ static void PAINT_WEIGHT_engine_init(void *vedata)
|
||||
|
||||
/* Init Framebuffers like this: order is attachment order (for color texs) */
|
||||
/*
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24},
|
||||
* {&txl->color, DRW_BUF_RGBA_8}};
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0},
|
||||
* {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
*/
|
||||
|
||||
/* DRW_framebuffer_init takes care of checking if
|
||||
|
@@ -115,8 +115,8 @@ static void PARTICLE_engine_init(void *vedata)
|
||||
|
||||
/* Init Framebuffers like this: order is attachment order (for color texs) */
|
||||
/*
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24},
|
||||
* {&txl->color, DRW_BUF_RGBA_8}};
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0},
|
||||
* {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
*/
|
||||
|
||||
/* DRW_framebuffer_init takes care of checking if
|
||||
|
@@ -115,8 +115,8 @@ static void POSE_engine_init(void *vedata)
|
||||
|
||||
/* Init Framebuffers like this: order is attachment order (for color texs) */
|
||||
/*
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24},
|
||||
* {&txl->color, DRW_BUF_RGBA_8}};
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0},
|
||||
* {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
*/
|
||||
|
||||
/* DRW_framebuffer_init takes care of checking if
|
||||
|
@@ -115,8 +115,8 @@ static void SCULPT_engine_init(void *vedata)
|
||||
|
||||
/* Init Framebuffers like this: order is attachment order (for color texs) */
|
||||
/*
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24},
|
||||
* {&txl->color, DRW_BUF_RGBA_8}};
|
||||
* DRWFboTexture tex[2] = {{&txl->depth, DRW_BUF_DEPTH_24, 0},
|
||||
* {&txl->color, DRW_BUF_RGBA_8, DRW_TEX_FILTER}};
|
||||
*/
|
||||
|
||||
/* DRW_framebuffer_init takes care of checking if
|
||||
|
Reference in New Issue
Block a user