Move towards pixel upscaling filter

This commit is contained in:
2025-11-25 11:04:06 +00:00
parent f5a972d9e2
commit c0cfadbdd3
13 changed files with 107 additions and 49 deletions
+49 -6
View File
@@ -21,17 +21,29 @@ import Unsafe.Coerce
sizeFBOs :: Config -> RenderData -> IO RenderData
sizeFBOs cfig rdata =
uncurryV (resizeRBO (_rboBaseBloom rdata)) (getWindowSize _gr_world_res cfig)
>> updateFBOTO3
-- >> updateFBOTO3
-- (getWindowSize _gr_world_res cfig)
-- GL_NEAREST
-- GL_NEAREST
-- GL_RGB16F -- RGBAF not sure if the alpha is necessary here
-- GL_RGB16F -- could possibly recover using depth in a clever way
-- -- but probably not, because the projection matrix is
-- -- not always on-center
-- GL_RGBA8_SNORM
-- rdata
-- fboBase
>> fboBase (resizeFBOTO3'
(getWindowSize _gr_world_res cfig)
GL_NEAREST
GL_NEAREST
GL_RGBA16F -- not sure if the alpha is necessary here
GL_NEAREST
GL_NEAREST
GL_RGB16F -- RGBAF not sure if the alpha is necessary here
GL_RGB16F -- could possibly recover using depth in a clever way
-- but probably not, because the projection matrix is
-- not always on-center
GL_RGB8_SNORM
GL_RGBA8_SNORM)
rdata
fboBase
>>= flip
(
updateFBOTO3
@@ -181,8 +193,39 @@ resizeFBOTO3 (fbo, (told1, told2, told3)) xsize ysize minfilt magfilt form1 form
to1 <- initializeTexture2D fbo GL_COLOR_ATTACHMENT0 xsize ysize minfilt magfilt form1
to2 <- initializeTexture2D fbo GL_COLOR_ATTACHMENT1 xsize ysize minfilt magfilt form2
to3 <- initializeTexture2D fbo GL_COLOR_ATTACHMENT2 xsize ysize minfilt magfilt form3
withArray [GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $ \ptr ->
glNamedFramebufferDrawBuffers (_unFBO fbo) 3 ptr
withArray [GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $
glNamedFramebufferDrawBuffers (_unFBO fbo) 3
checkFBO fbo
return (fbo, (TO to1, TO to2, TO to3))
resizeFBOTO3' ::
V2 Int ->
-- | minification filter
GLenum ->
-- | magnification filter
GLenum ->
-- | minification filter
GLenum ->
-- | magnification filter
GLenum ->
-- | internal color format1
GLenum ->
-- | internal color format2
GLenum ->
-- | internal color format3
GLenum ->
(FBO, (TO, TO, TO)) ->
IO (FBO, (TO, TO, TO))
resizeFBOTO3' (V2 xsize ysize) min1 mag1 minfilt magfilt form1 form2 form3 (fbo, (told1, told2, told3)) = do
glBindFramebuffer GL_FRAMEBUFFER (_unFBO fbo)
mglDelete glDeleteTextures $ _unTO told1
mglDelete glDeleteTextures $ _unTO told2
mglDelete glDeleteTextures $ _unTO told3
to1 <- initializeTexture2D fbo GL_COLOR_ATTACHMENT0 xsize ysize min1 mag1 form1
to2 <- initializeTexture2D fbo GL_COLOR_ATTACHMENT1 xsize ysize minfilt magfilt form2
to3 <- initializeTexture2D fbo GL_COLOR_ATTACHMENT2 xsize ysize minfilt magfilt form3
withArray [GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $
glNamedFramebufferDrawBuffers (_unFBO fbo) 3
checkFBO fbo
return (fbo, (TO to1, TO to2, TO to3))