diff --git a/internal/opengl/context_desktop.go b/internal/opengl/context_desktop.go index 2693bc19d..8f3e8dc6d 100644 --- a/internal/opengl/context_desktop.go +++ b/internal/opengl/context_desktop.go @@ -316,7 +316,7 @@ func (c *Context) NewShader(shaderType ShaderType, source string) (Shader, error if err := c.runOnContextThread(func() error { s := gl.CreateShader(uint32(shaderType)) if s == 0 { - return errors.New("opengl: glCreateShader failed") + return fmt.Errorf("opengl: glCreateShader failed: shader type: %d", shaderType) } cSources, free := gl.Strs(source + "\x00") gl.ShaderSource(uint32(s), 1, cSources, nil) diff --git a/internal/opengl/context_js.go b/internal/opengl/context_js.go index cd00d8ad3..63a8b86bb 100644 --- a/internal/opengl/context_js.go +++ b/internal/opengl/context_js.go @@ -268,7 +268,7 @@ func (c *Context) NewShader(shaderType ShaderType, source string) (Shader, error gl := c.gl s := gl.CreateShader(int(shaderType)) if s == nil { - return Shader{nil}, errors.New("opengl: glCreateShader failed") + return Shader{nil}, fmt.Errorf("opengl: glCreateShader failed: shader type: %d", shaderType) } gl.ShaderSource(s, source) @@ -276,7 +276,7 @@ func (c *Context) NewShader(shaderType ShaderType, source string) (Shader, error if !gl.GetShaderParameterb(s, gl.COMPILE_STATUS) { log := gl.GetShaderInfoLog(s) - return Shader{nil}, errors.New(fmt.Sprintf("opengl: shader compile failed: %s", log)) + return Shader{nil}, fmt.Errorf("opengl: shader compile failed: %s", log) } return Shader{s}, nil } diff --git a/internal/opengl/context_mobile.go b/internal/opengl/context_mobile.go index 1af924ac1..cd73d98c2 100644 --- a/internal/opengl/context_mobile.go +++ b/internal/opengl/context_mobile.go @@ -244,7 +244,7 @@ func (c *Context) NewShader(shaderType ShaderType, source string) (Shader, error gl := c.gl s := gl.CreateShader(mgl.Enum(shaderType)) if s.Value == 0 { - return Shader{}, errors.New("opengl: glCreateShader failed") + return Shader{}, fmt.Errorf("opengl: glCreateShader failed: shader type: %d", shaderType) } gl.ShaderSource(s, source) gl.CompileShader(s)