Remove VAOs

This commit is contained in:
2025-11-20 22:33:23 +00:00
parent 86794d1da9
commit f63b47d6c4
7 changed files with 11 additions and 22 deletions
+1 -3
View File
@@ -4,6 +4,4 @@ layout (binding=50) uniform sampler2DArray thetexture;
in vec4 vColor;
in vec3 vTexCoord;
void main()
{
fColor = texture(thetexture, vec3 (vTexCoord.xyz)) * vColor;
}
{ fColor = texture(thetexture, vec3 (vTexCoord.xyz)) * vColor; }
+1 -1
View File
@@ -26,7 +26,7 @@ data RenderData = RenderData
, _shapeShader :: GLuint
, _shapeEBO :: UintBO
, _silhouetteEBO :: UintBO
, _pictureShaders :: MV.MVector (PrimState IO) (Shader,VBO)
, _pictureShaders :: MV.MVector (PrimState IO) (GLuint,VBO)
, _fbo2 :: (FBO, TO)
, _fboHalf1 :: (FBO, TO)
, _fboHalf2 :: (FBO, TO)
+1 -1
View File
@@ -221,7 +221,7 @@ pingPongBetween (fb1, to1) (fb2, to2) fs = do
renderLayer ::
Layer ->
MV.MVector (PrimState IO) (Shader, VBO) ->
MV.MVector (PrimState IO) (GLuint, VBO) ->
UMV.MVector (PrimState IO) Int ->
IO ()
renderLayer layer shads counts = do
+2 -7
View File
@@ -1,28 +1,23 @@
module Shader (drawShaderLay) where
import Control.Lens
import Control.Monad.Primitive
import qualified Data.Vector.Unboxed.Mutable as UMV
import Graphics.GL.Core45
import Shader.Data
import Shader.Parameters
drawShaderLay :: Int -> UMV.MVector (PrimState IO) Int -> Int -> (Shader, VBO) -> IO ()
drawShaderLay :: Int -> UMV.MVector (PrimState IO) Int -> Int -> (GLuint, VBO) -> IO ()
{-# INLINE drawShaderLay #-}
drawShaderLay l countsVector shadIn fs = do
i <- UMV.read countsVector shadIn
glUseProgram (_shaderUINT $ fst fs)
glBindVertexArray $ fs ^. _1 . shaderVAO . unVAO
glUseProgram (fst fs)
glUniform1i 0 . fromIntegral $ (l * numSubElements)
glDrawArrays
GL_TRIANGLES
(fromIntegral $ l * numSubElements)
--(drawCountMod shadIn i)
(drawCountMod shadIn i)
--(fromIntegral i)
drawCountMod :: Int -> Int -> GLsizei
drawCountMod i n
-- | i == 3 = fromIntegral $ 2 * n -- modifies ellipse draw count
| i == 3 = fromIntegral $ 2 * n -- modifies ellipse draw count
| otherwise = fromIntegral n
+1 -1
View File
@@ -30,7 +30,7 @@ bufferEBO x i =
glNamedBufferSubData (x ^. uiboName) 0 (fromIntegral $ gluintSize * i) (x ^. uiboPtr)
bufferShaderLayers
:: MV.MVector (PrimState IO) (Shader, VBO) -> UMV.MVector (PrimState IO) Int -> IO ()
:: MV.MVector (PrimState IO) (GLuint, VBO) -> UMV.MVector (PrimState IO) Int -> IO ()
bufferShaderLayers shads counts = MV.imapM_ f shads
where
f i shad = do
+3 -7
View File
@@ -28,16 +28,12 @@ makeShaderVBO ::
[GLenum] ->
-- | The input vertex sizes
[VertexAttribute] ->
IO (Shader, VBO)
IO (GLuint, VBO)
makeShaderVBO s shaderlist sizes = do
prog <- makeSourcedShader s shaderlist
(vao, vbo) <- setupVBOVAO sizes
vbo <- setupVBO (vasTightStride sizes)
return
( Shader
{ _shaderUINT = prog
, _shaderVAO = vao
-- , _shaderPrimitive = pm
}
( prog
, vbo
)
+2 -2
View File
@@ -468,14 +468,14 @@ normalTo8 = over each f . normalize
f x = floor $ x * 127
pokeLayVerxs ::
MV.MVector (PrimState IO) (Shader, VBO) ->
MV.MVector (PrimState IO) (GLuint, VBO) ->
UMV.MVector (PrimState IO) Int ->
Picture ->
IO ()
pokeLayVerxs vbos counts = VFSM.mapM_ (pokeLayVerx vbos counts) . VFSM.fromList
pokeLayVerx
:: MV.MVector (PrimState IO) (Shader, VBO)
:: MV.MVector (PrimState IO) (GLuint, VBO)
-> UMV.MVector (PrimState IO) Int
-> Verx
-> IO ()