diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-06-04 13:12:58 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-06-04 13:12:58 +0300 |
commit | 28b597b6df46b6d2581d7948578922bb3566d242 (patch) | |
tree | 5b79613f8387d44ce66dc415b629b55906cabf93 /source/blender/draw/engines/eevee/eevee_private.h | |
parent | 8d1e6d7833177023a6af0d040dabf4d5690b87db (diff) |
Eevee: Material code refactor.
Separate material handling inside another file.
Make use of enums to identify shader variations.
Group all 64*64 LUTs into one array texture.
Only update world probe if world changes.
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_private.h')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_private.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index 39adf1bdfe7..3e4547e76ac 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -31,6 +31,7 @@ struct Object; extern struct DrawEngineType draw_engine_eevee_type; /* Minimum UBO is 16384 bytes */ +#define MAX_PROBE 128 /* TODO : find size by dividing UBO max size by probe data size */ #define MAX_LIGHT 128 /* TODO : find size by dividing UBO max size by light data size */ #define MAX_SHADOW_CUBE 42 /* TODO : Make this depends on GL_MAX_ARRAY_TEXTURE_LAYERS */ #define MAX_SHADOW_MAP 64 @@ -64,6 +65,7 @@ typedef struct EEVEE_PassList { struct DRWPass *depth_pass; struct DRWPass *depth_pass_cull; struct DRWPass *default_pass; + struct DRWPass *default_flat_pass; struct DRWPass *material_pass; struct DRWPass *background_pass; } EEVEE_PassList; @@ -162,8 +164,15 @@ enum { LIGHT_UPDATE_SHADOW_CUBE = (1 << 0), }; +/* ************ PROBE UBO ************* */ +typedef struct EEVEE_Probe { + float position[3], dist; +} EEVEE_Probe; + /* ************ PROBE DATA ************* */ typedef struct EEVEE_ProbesInfo { + int num_cube, cache_num_cube; + int update_flag; /* For rendering probes */ float probemat[6][4][4]; int layer; @@ -178,8 +187,18 @@ typedef struct EEVEE_ProbesInfo { int shnbr; float shcoefs[9][3]; /* Temp */ struct GPUTexture *backgroundtex; + /* List of probes in the scene. */ + /* XXX This is fragile, can get out of sync quickly. */ + struct Object *probes_ref[MAX_PROBE]; + /* UBO Storage : data used by UBO */ + struct EEVEE_Probe probe_data[MAX_PROBE]; } EEVEE_ProbesInfo; +/* EEVEE_ProbesInfo->update_flag */ +enum { + PROBE_UPDATE_CUBE = (1 << 0), +}; + /* ************ EFFECTS DATA ************* */ typedef struct EEVEE_EffectsInfo { int enabled_effects; @@ -255,6 +274,8 @@ typedef struct EEVEE_SceneLayerData { struct GPUTexture *probe_depth_rt; struct GPUTexture *probe_pool; struct GPUTexture *probe_sh; + + struct ListBase probe_queue; /* List of probes to update */ } EEVEE_SceneLayerData; /* ************ OBJECT DATA ************ */ @@ -289,6 +310,17 @@ EEVEE_SceneLayerData *EEVEE_scene_layer_data_get(void); EEVEE_ObjectEngineData *EEVEE_object_data_get(Object *ob); EEVEE_LampEngineData *EEVEE_lamp_data_get(Object *ob); + +/* eevee_materials.c */ +void EEVEE_materials_init(void); +void EEVEE_materials_cache_init(EEVEE_Data *vedata); +void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_SceneLayerData *sldata, Object *ob, struct Batch *geom); +struct GPUMaterial *EEVEE_material_world_probe_get(struct Scene *scene, struct World *wo); +struct GPUMaterial *EEVEE_material_world_background_get(struct Scene *scene, struct World *wo); +struct GPUMaterial *EEVEE_material_mesh_probe_get(struct Scene *scene, Material *ma); +struct GPUMaterial *EEVEE_material_mesh_get(struct Scene *scene, Material *ma); +void EEVEE_materials_free(void); + /* eevee_lights.c */ void EEVEE_lights_init(EEVEE_SceneLayerData *sldata); void EEVEE_lights_cache_init(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl); @@ -304,8 +336,7 @@ void EEVEE_probes_init(EEVEE_SceneLayerData *sldata); void EEVEE_probes_cache_init(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl); void EEVEE_probes_cache_add(EEVEE_SceneLayerData *sldata, Object *ob); void EEVEE_probes_cache_finish(EEVEE_SceneLayerData *sldata); -void EEVEE_probes_update(EEVEE_SceneLayerData *sldata); -void EEVEE_refresh_probe(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl); +void EEVEE_probes_refresh(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl); void EEVEE_probes_free(void); /* eevee_effects.c */ |