From aa2746e800fecbe350c26690ffcd665e4d37a459 Mon Sep 17 00:00:00 2001 From: justin Date: Thu, 9 Mar 2023 22:07:39 +0000 Subject: [PATCH] To openglraw --- src/Shader/AuxAddition.hs | 1 - src/Shader/Bind.hs | 16 +++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Shader/AuxAddition.hs b/src/Shader/AuxAddition.hs index d4c8a2b85..167326c6c 100644 --- a/src/Shader/AuxAddition.hs +++ b/src/Shader/AuxAddition.hs @@ -15,7 +15,6 @@ import Data.List.Extra import Codec.Picture import qualified Data.Vector.Storable as VS import Control.Lens ---import Graphics.Rendering.OpenGL hiding (Point,translate,scale,imageHeight) import Graphics.GL.Core45 import GLHelp diff --git a/src/Shader/Bind.hs b/src/Shader/Bind.hs index 1efe39bef..e34f75df8 100644 --- a/src/Shader/Bind.hs +++ b/src/Shader/Bind.hs @@ -7,7 +7,6 @@ module Shader.Bind import Shader.Data import Shader.Parameters -import Graphics.Rendering.OpenGL hiding (Line,translate,scale,imageHeight,Polygon,Color,T) import Foreign hiding (rotate) import qualified Data.Vector.Unboxed.Mutable as UMV import qualified Data.Vector.Mutable as MV @@ -18,11 +17,8 @@ import Graphics.GL.Core45 bindArrayBuffers :: Int -> VBO -> IO () {-# INLINABLE bindArrayBuffers #-} -bindArrayBuffers numVs theVBO = do - glBindBuffer GL_ARRAY_BUFFER (_vboName theVBO) - bufferSubData - ArrayBuffer - WriteToBuffer +bindArrayBuffers numVs theVBO = glNamedBufferSubData + (_vboName theVBO) 0 (fromIntegral $ floatSize * numVs * sum (_vboAttribSizes theVBO)) (_vboPtr theVBO) @@ -40,13 +36,15 @@ bindShaderLayers shads counts = MV.imapM_ f shads where g stride theVBO lay = do numVs <- UMV.unsafeRead counts $ lay * 6 + i - bufferSubData - ArrayBuffer - WriteToBuffer + glNamedBufferSubDataH + (_vboName theVBO) (fromIntegral $ floatSize * stride * numSubElements * lay) (fromIntegral $ floatSize * numVs * stride) (_vboPtr theVBO `plusPtr` (floatSize * stride * numSubElements * lay)) +glNamedBufferSubDataH :: GLuint -> GLintptr -> GLsizeiptr -> Ptr a -> IO () +glNamedBufferSubDataH = glNamedBufferSubData + bindShader :: MV.MVector (PrimState IO) FullShader -> UMV.MVector (PrimState IO) Int -> IO () bindShader shads counts = MV.imapM_ f shads where