Combine init_gi and init_sdfgi into a single init

This commit is contained in:
Bastiaan Olij 2021-03-11 14:35:05 +11:00
parent 52ab369d5f
commit 73b5eb2673
3 changed files with 9 additions and 16 deletions

View File

@ -1100,8 +1100,6 @@ void RendererSceneGIRD::SDFGI::update_cascades() {
}
void RendererSceneGIRD::SDFGI::debug_draw(const CameraMatrix &p_projection, const Transform &p_transform, int p_width, int p_height, RID p_render_target, RID p_texture) {
// !BAS! Need to find a nicer way then adding width/height/renderbuffer/texture as parameters
if (!debug_uniform_set.is_valid() || !RD::get_singleton()->uniform_set_is_valid(debug_uniform_set)) {
Vector<RD::Uniform> uniforms;
{
@ -2806,9 +2804,11 @@ RendererSceneGIRD::RendererSceneGIRD() {
RendererSceneGIRD::~RendererSceneGIRD() {
}
void RendererSceneGIRD::init_gi(RendererStorageRD *p_storage) {
void RendererSceneGIRD::init(RendererStorageRD *p_storage, RendererSceneSkyRD *p_sky) {
storage = p_storage;
/* GI */
{
//kinda complicated to compute the amount of slots, we try to use as many as we can
@ -2861,9 +2861,9 @@ void RendererSceneGIRD::init_gi(RendererStorageRD *p_storage) {
giprobe_debug_shader_version_pipelines[i].setup(giprobe_debug_shader_version_shaders[i], RD::RENDER_PRIMITIVE_TRIANGLES, rs, RD::PipelineMultisampleState(), ds, RD::PipelineColorBlendState::create_disabled(), 0);
}
}
}
void RendererSceneGIRD::init_sdfgi(RendererSceneSkyRD *p_sky) {
/* SDGFI */
{
Vector<String> preprocess_modes;
preprocess_modes.push_back("\n#define MODE_SCROLL\n");

View File

@ -53,8 +53,6 @@ class RendererSceneRenderRD;
class RendererSceneGIRD {
private:
// !BAS! need to see which things become internal..
RendererStorageRD *storage;
/* GIPROBE INSTANCE */
@ -652,9 +650,7 @@ public:
RendererSceneGIRD();
~RendererSceneGIRD();
// !BAS! Can we merge these two inits? Possibly, need to check
void init_gi(RendererStorageRD *p_storage);
void init_sdfgi(RendererSceneSkyRD *p_sky);
void init(RendererStorageRD *p_storage, RendererSceneSkyRD *p_sky);
void free();
SDFGI *create_sdfgi(RendererSceneEnvironmentRD *p_env, const Vector3 &p_world_position, uint32_t p_requested_history_size);

View File

@ -4097,17 +4097,14 @@ RendererSceneRenderRD::RendererSceneRenderRD(RendererStorageRD *p_storage) {
low_end = true;
}
if (!low_end) {
gi.init_gi(storage);
}
/* SKY SHADER */
sky.init(storage);
/* GI */
if (!low_end) {
//SDFGI
gi.init_sdfgi(&sky);
gi.init(storage, &sky);
}
{ //decals