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