Use immutable storage for fullscreen vbo
This commit is contained in:
+21
-1
@@ -8,6 +8,8 @@ module Shader.Compile (
|
||||
makeShaderSized,
|
||||
makeShaderUsingVAO,
|
||||
setupVAO,
|
||||
setupVAOvbo,
|
||||
setupVAOvbo',
|
||||
setupEBO,
|
||||
setupVertexAttribPointer,
|
||||
) where
|
||||
@@ -195,6 +197,16 @@ shaderTypeExt' _ = undefined
|
||||
setupVAO :: [Int] -> IO (VAO,VBO)
|
||||
setupVAO = setupVAOSized numDrawableElements
|
||||
|
||||
setupVAOvbo' :: [Int] -> Int -> GLuint -> IO VAO
|
||||
setupVAOvbo' sizes strd vbo = do
|
||||
vaoname <- mglCreate glCreateVertexArrays
|
||||
glBindVertexArray vaoname
|
||||
setupVertexAttribs' vbo vaoname sizes strd
|
||||
return $ VAO
|
||||
{ _vaoName = vaoname
|
||||
}
|
||||
|
||||
|
||||
setupVAOvbo :: [Int] -> Int -> VBO -> IO VAO
|
||||
setupVAOvbo sizes strd vbo = do
|
||||
vaoname <- mglCreate glCreateVertexArrays
|
||||
@@ -252,7 +264,15 @@ setupVBOSized ndraw vao sizes = do
|
||||
|
||||
setupVertexAttribs :: VBO -> GLuint -> [Int] -> Int -> IO ()
|
||||
setupVertexAttribs vbo vao sizes strd = do
|
||||
glVertexArrayVertexBuffer vao 0 (vbo ^. vboName) 0 (fromIntegral $ floatSize * strd)
|
||||
glVertexArrayVertexBuffer vao 0 (_vboName vbo) 0 (fromIntegral $ floatSize * strd)
|
||||
forM_ (zip3 [0 ..] sizes offs) $ \(loc, siz, off) -> do
|
||||
setupVertexAttribPointer vao loc siz off
|
||||
where
|
||||
offs = scanl (+) 0 sizes
|
||||
|
||||
setupVertexAttribs' :: GLuint -> GLuint -> [Int] -> Int -> IO ()
|
||||
setupVertexAttribs' vbo vao sizes strd = do
|
||||
glVertexArrayVertexBuffer vao 0 vbo 0 (fromIntegral $ floatSize * strd)
|
||||
forM_ (zip3 [0 ..] sizes offs) $ \(loc, siz, off) -> do
|
||||
setupVertexAttribPointer vao loc siz off
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user