Error Pps::initInternal(const ConfigSet& config) { ANKI_ASSERT("Initializing PPS"); ANKI_CHECK(loadColorGradingTexture("engine_data/DefaultLut.ankitex")); m_sharpenEnabled = config.getNumber("pps.sharpen"); if(!m_r->getDrawToDefaultFramebuffer()) { m_r->createRenderTarget(m_r->getWidth(), m_r->getHeight(), RT_PIXEL_FORMAT, TextureUsageBit::FRAMEBUFFER_ATTACHMENT_WRITE | TextureUsageBit::SAMPLED_FRAGMENT, SamplingFilter::LINEAR, 1, m_rt); FramebufferInitInfo fbInit; fbInit.m_colorAttachmentCount = 1; fbInit.m_colorAttachments[0].m_texture = m_rt; fbInit.m_colorAttachments[0].m_loadOperation = AttachmentLoadOperation::DONT_CARE; fbInit.m_colorAttachments[0].m_usageInsideRenderPass = TextureUsageBit::FRAMEBUFFER_ATTACHMENT_WRITE; m_fb = getGrManager().newInstance<Framebuffer>(fbInit); } return ErrorCode::NONE; }
Error FinalComposite::initInternal(const ConfigSet& config) { ANKI_ASSERT("Initializing PPS"); ANKI_CHECK(loadColorGradingTexture("engine_data/DefaultLut.ankitex")); m_fbDescr.m_colorAttachmentCount = 1; m_fbDescr.m_colorAttachments[0].m_loadOperation = AttachmentLoadOperation::DONT_CARE; m_fbDescr.bake(); ANKI_CHECK(getResourceManager().loadResource("engine_data/BlueNoiseLdrRgb64x64.ankitex", m_blueNoise)); // Progs ANKI_CHECK(getResourceManager().loadResource("shaders/FinalComposite.glslp", m_prog)); ShaderProgramResourceMutationInitList<3> mutations(m_prog); mutations.add("BLUE_NOISE", 1).add("BLOOM_ENABLED", 1).add("DBG_ENABLED", 0); ShaderProgramResourceConstantValueInitList<3> consts(m_prog); consts.add("LUT_SIZE", U32(LUT_SIZE)) .add("FB_SIZE", UVec2(m_r->getWidth(), m_r->getHeight())) .add("MOTION_BLUR_SAMPLES", U32(config.getNumber("r.final.motionBlurSamples"))); const ShaderProgramResourceVariant* variant; m_prog->getOrCreateVariant(mutations.get(), consts.get(), variant); m_grProgs[0] = variant->getProgram(); mutations[2].m_value = 1; m_prog->getOrCreateVariant(mutations.get(), consts.get(), variant); m_grProgs[1] = variant->getProgram(); return Error::NONE; }