Remove compute shaders

This commit is contained in:
2023-04-23 12:39:35 +01:00
parent 20eef80568
commit 4bb9841be8
6 changed files with 3 additions and 77 deletions
+1 -2
View File
@@ -11,8 +11,7 @@ import Graphics.GL.Core45
import Shader.Data
data RenderData = RenderData
{ _computeShadowShader :: GLuint
, _lightingWallShadShader :: Shader
{ _lightingWallShadShader :: Shader
, _lightingLineShadowShader :: Shader
, _lightingCapShader :: Shader
, _lightingTextureShader :: Shader
+1 -1
View File
@@ -185,7 +185,7 @@ graphicsMenuOptions =
[ makeEnumOption graphics_world_resolution "World resolution" (uvIOEffects .~ updatePreload)
, makeEnumOption graphics_downsize_resolution "Downsize resolution"
(uvIOEffects .~ updatePreload)
, makeEnumOption graphics_distortion_resolution "Overlay resolution"
, makeEnumOption graphics_distortion_resolution "Distortion resolution"
(uvIOEffects .~ updatePreload)
, makeEnumOption graphics_shadow_rendering "SHADOW RENDERING" id
, makeEnumOption graphics_shadow_size "SHADOW DETAIL" id
+1 -5
View File
@@ -182,15 +182,11 @@ preloadRender = do
, eslist
]
-- setup compute shader
computeshadowshader <- makeSourcedShader "compute/shadow" [GL_COMPUTE_SHADER]
initializeGLState
putStrLn "Return preload"
return $
RenderData
{ _computeShadowShader = computeshadowshader
, _pictureShaders = shadV
{ _pictureShaders = shadV
, _shapeShader = shapeshader -- & shaderVAO' .~ shPosColVAO
, _shapeEBO = shEBO
, _silhouetteEBO = shedgeebo
-22
View File
@@ -44,7 +44,6 @@ createLightMap cfig = case shadrendertype of
InstancingShads -> instanceLightMap cfig
NoShadows -> const . const . const renderLightingNoShadows
NoLighting -> const . const . const . const . const . const renderFlatLighting
ComputeShader -> renderComputeShadows
_ -> renderShadows shadrendertype
where
shadrendertype = cfig ^. graphics_shadow_rendering
@@ -104,27 +103,6 @@ renderLightingNoShadows positiontexture normaltexture lightPoints pdata = do
glDisable GL_CULL_FACE
glDisable GL_STENCIL_TEST
renderComputeShadows ::
GLsizei ->
Int ->
Int ->
TO ->
TO ->
[(Point3, Float, Point3)] ->
RenderData ->
IO ()
renderComputeShadows _ _ _ toPos tanormals lightPoints rd = do
withArray (lightsToArray lightPoints) $ \ptr ->
glNamedBufferSubData (rd ^. lightsUBO) 0 620 ptr
glBindTextureUnit 0 (toPos ^. unTO)
glBindTextureUnit 1 (tanormals ^. unTO)
glBindImageTexture 5 (rd ^. fboLighting . _2 . unTO) 0 GL_FALSE 0 GL_WRITE_ONLY GL_RGBA8
glUseProgram (rd ^. computeShadowShader)
glDispatchCompute 800 835 1
-- the following should be later, just before the texture is accessed
--glMemoryBarrier GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
glMemoryBarrier GL_TEXTURE_FETCH_BARRIER_BIT
return ()
renderFlatLighting :: RenderData -> IO ()
renderFlatLighting pdata = do