Fix error display when compiling/linking shaders

This commit is contained in:
2023-03-07 15:46:35 +00:00
parent 3e3fd049a9
commit b68703c275
2 changed files with 4 additions and 4 deletions
-1
View File
@@ -3,7 +3,6 @@ layout (points) in;
layout (triangle_strip, max_vertices = 8) out; layout (triangle_strip, max_vertices = 8) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
uniform vec3 lightPos; uniform vec3 lightPos;
vec4 shift (vec4 p) vec4 shift (vec4 p)
{ return vec4 (p.xy + (200 * (p.xy-lightPos.xy)), 0 , 1); { return vec4 (p.xy + (200 * (p.xy-lightPos.xy)), 0 , 1);
} }
+4 -3
View File
@@ -19,6 +19,7 @@ import Shader.Data
import Shader.Parameters import Shader.Parameters
import Foreign import Foreign
import Foreign.C.String
import qualified Data.ByteString as BS import qualified Data.ByteString as BS
import qualified Data.ByteString.Unsafe as BU import qualified Data.ByteString.Unsafe as BU
import Control.Monad import Control.Monad
@@ -345,10 +346,10 @@ makeShaderProgram' str srcs = do
mapM_ glDeleteShader shaders mapM_ glDeleteShader shaders
return theprog return theprog
glCheckError :: (Storable t1, Storable a1, Show a1) => glCheckError :: (Storable t1) =>
[Char] [Char]
-> (t2 -> GLenum -> Ptr t1 -> IO ()) -> (t2 -> GLenum -> Ptr t1 -> IO ())
-> (t2 -> t1 -> Ptr a3 -> Ptr a1 -> IO ()) -> (t2 -> t1 -> Ptr a3 -> CString -> IO ())
-> t2 -> t2
-> GLenum -> GLenum
-> IO () -> IO ()
@@ -363,7 +364,7 @@ glCheckError str f g x statustype =
len <- peek ptr -- we may have to use this length more intelligently len <- peek ptr -- we may have to use this length more intelligently
alloca $ \charPtr -> do alloca $ \charPtr -> do
g x len nullPtr charPtr g x len nullPtr charPtr
char <- peek charPtr char <- peekCString charPtr
error $ str ++ show char error $ str ++ show char
else return () else return ()