mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
opengl: Update error messages
This commit is contained in:
parent
443c58104b
commit
3e2f2e9f08
@ -316,7 +316,7 @@ func (c *Context) NewShader(shaderType ShaderType, source string) (Shader, error
|
|||||||
if err := c.runOnContextThread(func() error {
|
if err := c.runOnContextThread(func() error {
|
||||||
s := gl.CreateShader(uint32(shaderType))
|
s := gl.CreateShader(uint32(shaderType))
|
||||||
if s == 0 {
|
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")
|
cSources, free := gl.Strs(source + "\x00")
|
||||||
gl.ShaderSource(uint32(s), 1, cSources, nil)
|
gl.ShaderSource(uint32(s), 1, cSources, nil)
|
||||||
|
@ -268,7 +268,7 @@ func (c *Context) NewShader(shaderType ShaderType, source string) (Shader, error
|
|||||||
gl := c.gl
|
gl := c.gl
|
||||||
s := gl.CreateShader(int(shaderType))
|
s := gl.CreateShader(int(shaderType))
|
||||||
if s == nil {
|
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)
|
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) {
|
if !gl.GetShaderParameterb(s, gl.COMPILE_STATUS) {
|
||||||
log := gl.GetShaderInfoLog(s)
|
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
|
return Shader{s}, nil
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ func (c *Context) NewShader(shaderType ShaderType, source string) (Shader, error
|
|||||||
gl := c.gl
|
gl := c.gl
|
||||||
s := gl.CreateShader(mgl.Enum(shaderType))
|
s := gl.CreateShader(mgl.Enum(shaderType))
|
||||||
if s.Value == 0 {
|
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.ShaderSource(s, source)
|
||||||
gl.CompileShader(s)
|
gl.CompileShader(s)
|
||||||
|
Loading…
Reference in New Issue
Block a user