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 (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
uniform vec3 lightPos;
vec4 shift (vec4 p)
{ 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 Foreign
import Foreign.C.String
import qualified Data.ByteString as BS
import qualified Data.ByteString.Unsafe as BU
import Control.Monad
@@ -345,10 +346,10 @@ makeShaderProgram' str srcs = do
mapM_ glDeleteShader shaders
return theprog
glCheckError :: (Storable t1, Storable a1, Show a1) =>
glCheckError :: (Storable t1) =>
[Char]
-> (t2 -> GLenum -> Ptr t1 -> IO ())
-> (t2 -> t1 -> Ptr a3 -> Ptr a1 -> IO ())
-> (t2 -> t1 -> Ptr a3 -> CString -> IO ())
-> t2
-> GLenum
-> IO ()
@@ -363,7 +364,7 @@ glCheckError str f g x statustype =
len <- peek ptr -- we may have to use this length more intelligently
alloca $ \charPtr -> do
g x len nullPtr charPtr
char <- peek charPtr
char <- peekCString charPtr
error $ str ++ show char
else return ()