Skip to content

Commit

Permalink
DO NOT MERGE - dump raw moments, use rg32f instead of rg16f
Browse files Browse the repository at this point in the history
  • Loading branch information
stohrendorf committed Mar 24, 2023
1 parent d39f501 commit 5fdb315
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/render/scene/csm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ void CSM::Split::init(int32_t resolution, size_t idx, material::MaterialManager&
.textureNoBlend(gl::api::FramebufferAttachment::DepthAttachment, depthTextureHandle->getTexture())
.build("csm-split-fb/" + std::to_string(idx));

squaredTextureHandle = std::make_shared<gl::TextureHandle<gl::Texture2D<gl::RG16F>>>(
gsl::make_shared<gl::Texture2D<gl::RG16F>>(glm::ivec2{resolution, resolution},
squaredTextureHandle = std::make_shared<gl::TextureHandle<gl::Texture2D<gl::RG32F>>>(
gsl::make_shared<gl::Texture2D<gl::RG32F>>(glm::ivec2{resolution, resolution},
"csm-texture/" + std::to_string(idx) + "/squared"),
gsl::make_unique<gl::Sampler>("csm-texture/" + std::to_string(idx) + "/squared" + gl::SamplerSuffix)
| set(gl::api::TextureMinFilter::Linear) | set(gl::api::TextureMagFilter::Linear)
Expand All @@ -81,7 +81,7 @@ void CSM::Split::init(int32_t resolution, size_t idx, material::MaterialManager&
squareMesh->getRenderState().merge(squareFramebuffer->getRenderState());
squareMesh->getMaterialGroup().set(material::RenderMode::FullOpaque, squareMaterial);

squareBlur = std::make_shared<SeparableBlur<gl::RG16F>>(
squareBlur = std::make_shared<SeparableBlur<gl::RG32F>>(
"squareBlur-" + std::to_string(idx), materialManager, uint8_t{2}, true);
squareBlur->setInput(gsl::not_null{squaredTextureHandle});
}
Expand Down Expand Up @@ -122,21 +122,21 @@ namespace
struct SplitGetter
{
template<size_t... Is>
static std::array<gslu::nn_shared<gl::TextureHandle<gl::Texture2D<gl::RG16F>>>, CSMBuffer::NSplits>
static std::array<gslu::nn_shared<gl::TextureHandle<gl::Texture2D<gl::RG32F>>>, CSMBuffer::NSplits>
getBlurred(const std::array<CSM::Split, CSMBuffer::NSplits>& splits, std::index_sequence<Is...>)
{
return {{gsl::not_null{splits[Is].squaredTextureHandle}...}};
}

static std::array<gslu::nn_shared<gl::TextureHandle<gl::Texture2D<gl::RG16F>>>, CSMBuffer::NSplits>
static std::array<gslu::nn_shared<gl::TextureHandle<gl::Texture2D<gl::RG32F>>>, CSMBuffer::NSplits>
getBlurred(const std::array<CSM::Split, CSMBuffer::NSplits>& splits)
{
return getBlurred(splits, std::make_index_sequence<CSMBuffer::NSplits>());
}
};
} // namespace

std::array<gslu::nn_shared<gl::TextureHandle<gl::Texture2D<gl::RG16F>>>, CSMBuffer::NSplits> CSM::getTextures() const
std::array<gslu::nn_shared<gl::TextureHandle<gl::Texture2D<gl::RG32F>>>, CSMBuffer::NSplits> CSM::getTextures() const
{
return SplitGetter::getBlurred(m_splits);
}
Expand Down
6 changes: 3 additions & 3 deletions src/render/scene/csm.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ class CSM final
std::shared_ptr<gl::TextureHandle<gl::TextureDepth<float>>> depthTextureHandle;
std::shared_ptr<gl::Framebuffer> depthFramebuffer{};

std::shared_ptr<gl::TextureHandle<gl::Texture2D<gl::RG16F>>> squaredTextureHandle;
std::shared_ptr<gl::TextureHandle<gl::Texture2D<gl::RG32F>>> squaredTextureHandle;
std::shared_ptr<gl::Framebuffer> squareFramebuffer{};

std::shared_ptr<material::Material> squareMaterial{};
std::shared_ptr<Mesh> squareMesh{};
std::shared_ptr<SeparableBlur<gl::RG16F>> squareBlur;
std::shared_ptr<SeparableBlur<gl::RG32F>> squareBlur;

void init(int32_t resolution, size_t idx, material::MaterialManager& materialManager);
void renderSquare();
Expand All @@ -63,7 +63,7 @@ class CSM final

explicit CSM(int32_t resolution, material::MaterialManager& materialManager);

[[nodiscard]] std::array<gslu::nn_shared<gl::TextureHandle<gl::Texture2D<gl::RG16F>>>, CSMBuffer::NSplits>
[[nodiscard]] std::array<gslu::nn_shared<gl::TextureHandle<gl::Texture2D<gl::RG32F>>>, CSMBuffer::NSplits>
getTextures() const;
[[nodiscard]] std::array<glm::mat4, CSMBuffer::NSplits> getMatrices(const glm::mat4& modelMatrix) const;

Expand Down

0 comments on commit 5fdb315

Please sign in to comment.