diff --git a/.gitignore b/.gitignore index eba8521..cdbfd6e 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,6 @@ wgl # Vim *.swp *.swo + +# GoLand +.idea/ diff --git a/README.md b/README.md index 23b486c..50d5b23 100644 --- a/README.md +++ b/README.md @@ -7,21 +7,31 @@ Features: - Go functions that mirror the C specification using Go types. - Support for multiple OpenGL APIs (GL/GLES/EGL/WGL/GLX/EGL), versions, and profiles. - Support for extensions (including debug callbacks). +- Support for overloads to provide Go functions with different parameter signatures. -See the [open issues](https://github.com/go-gl/glow/issues) for caveats about the current state of the implementation. +See the [open issues](https://github.com/neclepsio/glow/issues) for caveats about the current state of the implementation. Generated Packages ------------------ -Generated OpenGL binding packages are available in the [go-gl/gl](https://github.com/go-gl/gl) repository. +Generated OpenGL binding packages are available in the [go-gl/gl](https://github.com/neclepsio/gl) repository. + +Overloads +--------- + +See subdirectory `xml/overload` for examples. The motivation here is to provide Go functions with different parameter signatures of existing OpenGL functions. + +For example, `glVertexAttribPointer(..., void *)` cannot be used with `gl.VertexAttribPointer(..., unsafe.Pointer)` when using arbitrary offset values. The `checkptr` safeguard will abort the program when doing so. +Overloads allow the creation of an additional `gl.VertexAttribPointerWithOffset(..., uintptr)`, which calls the original OpenGL function with appropriate casts. + Custom Packages --------------- If the prebuilt, go-gettable packages are not suitable for your needs you can build your own. For example, - go get github.com/go-gl/glow - cd $GOPATH/src/github.com/go-gl/glow + go get github.com/neclepsio/glow + cd $GOPATH/src/github.com/neclepsio/glow go build ./glow download ./glow generate -api=gl -version=3.3 -profile=core -remext=GL_ARB_cl_event diff --git a/functions.go b/functions.go index 85b5839..441f085 100644 --- a/functions.go +++ b/functions.go @@ -11,15 +11,38 @@ type Function struct { GoName string // Go name of the function with the API prefix stripped Parameters []Parameter Return Type + Overloads []Overload +} + +// An Overload describes an alternative signature for the same function. +type Overload struct { + GoName string // Go name of the original function + OverloadName string // Go name of the overload + Parameters []Parameter + Return Type +} + +func (o Overload) function() Function { + return Function{ + GoName: o.GoName, + Parameters: o.Parameters, + Return: o.Return, + } +} + +// IsImplementedForSyscall reports whether the function is implemented for syscall or not. +func (o Overload) IsImplementedForSyscall() bool { + return o.function().IsImplementedForSyscall() +} + +// Syscall returns a syscall expression for Windows. +func (o Overload) Syscall() string { + return o.function().Syscall() } // IsImplementedForSyscall reports whether the function is implemented for syscall or not. func (f Function) IsImplementedForSyscall() bool { - // TODO: Use syscall.Syscall18 when Go 1.12 is the minimum supported version. - if len(f.Parameters) > 15 { - return false - } - return true + return len(f.Parameters) <= 18 } // Syscall returns a syscall expression for Windows. diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..d6dca10 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/neclepsio/glow + +go 1.12 + +require golang.org/x/tools v0.0.0-20190402200628-202502a5a924 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..b3a5800 --- /dev/null +++ b/go.sum @@ -0,0 +1,6 @@ +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190402200628-202502a5a924 h1:XgD7l1aFq63td2d4omZwFUpt50/DxIpXW3yrk+V4EOc= +golang.org/x/tools v0.0.0-20190402200628-202502a5a924/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= diff --git a/main.go b/main.go index 6036ebf..8b8aea3 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ import ( func generate(name string, args []string) { flags := flag.NewFlagSet(name, flag.ExitOnError) - dir := importPathToDir("github.com/go-gl/glow") + dir := importPathToDir("github.com/neclepsio/glow") var ( xmlDir = flags.String("xml", filepath.Join(dir, "xml"), "XML directory") tmplDir = flags.String("tmpl", filepath.Join(dir, "tmpl"), "Template directory") @@ -114,6 +114,7 @@ func performRestriction(pkg *Package, jsonPath string) { func parseSpecifications(xmlDir string) []*Specification { specDir := filepath.Join(xmlDir, "spec") + overloadDir := filepath.Join(xmlDir, "overload") specFiles, err := ioutil.ReadDir(specDir) if err != nil { log.Fatalln("error reading spec file entries:", err) @@ -124,7 +125,16 @@ func parseSpecifications(xmlDir string) []*Specification { if !strings.HasSuffix(specFile.Name(), "xml") { continue } - spec, err := NewSpecification(filepath.Join(specDir, specFile.Name())) + + registry, err := readSpecFile(filepath.Join(specDir, specFile.Name())) + if err != nil { + log.Fatalln("error reading XML spec file: ", specFile.Name(), err) + } + overloads, err := readOverloadFile(filepath.Join(overloadDir, specFile.Name())) + if err != nil { + log.Fatalln("error reading XML overload file: ", specFile.Name(), err) + } + spec, err := NewSpecification(*registry, overloads) if err != nil { log.Fatalln("error parsing specification:", specFile.Name(), err) } diff --git a/overload.go b/overload.go new file mode 100644 index 0000000..24420f6 --- /dev/null +++ b/overload.go @@ -0,0 +1,52 @@ +package main + +import ( + "encoding/xml" + "os" +) + +type xmlOverloads struct { + Overloads []xmlOverload `xml:"overload"` +} + +type xmlOverload struct { + Name string `xml:"name,attr"` + OverloadName string `xml:"overloadName,attr"` + + ParameterChanges []xmlParameterChange `xml:"parameterChanges>change"` +} + +type xmlParameterChange struct { + // Index is the zero-based index of the parameter list. + Index int `xml:"index,attr"` + // Name describes a change of the parameter name. + Name *xmlNameChange `xml:"name"` + // Type describes a change of the parameter type. + Type *xmlTypeChange `xml:"type"` +} + +type xmlNameChange struct { + Value string `xml:"value,attr"` +} + +type xmlTypeChange struct { + Signature string `xml:"signature,attr"` +} + +func readOverloadFile(file string) (xmlOverloads, error) { + var overloads xmlOverloads + + _, err := os.Stat(file) + if err != nil { + return overloads, nil + } + + f, err := os.Open(file) + if err != nil { + return overloads, err + } + defer f.Close() + + err = xml.NewDecoder(f).Decode(&overloads) + return overloads, err +} diff --git a/package.go b/package.go index 6dbb410..a955f3b 100644 --- a/package.go +++ b/package.go @@ -36,7 +36,7 @@ type PackageFunction struct { func (f *PackageFunction) Comment() string { var lines []string if f.Doc != "" { - lines = append(lines, "// " + f.Doc) + lines = append(lines, "// "+f.Doc) } // Adds explanations about C types that are unsafe.Pointer in Go world. @@ -182,5 +182,9 @@ func importPathToDir(importPath string) string { if err != nil { log.Fatalln(err) } + if len(pkgs[0].GoFiles) == 0 { + exe, _ := os.Executable() + return filepath.Dir(exe) + } return filepath.Dir(pkgs[0].GoFiles[0]) } diff --git a/spec.go b/spec.go index 4c48d02..eb58d9b 100644 --- a/spec.go +++ b/spec.go @@ -180,6 +180,53 @@ func parseFunctions(commands []xmlCommand) (specFunctions, error) { return functions, nil } +func parseOverloads(functions specFunctions, overloads xmlOverloads) (specFunctions, error) { + for _, overloadInfo := range overloads.Overloads { + function := functions.getByName(overloadInfo.Name) + if function == nil { + return nil, fmt.Errorf("function <%s> not found to overload", overloadInfo.Name) + } + err := overloadFunction(function, overloadInfo) + if err != nil { + return nil, err + } + } + return functions, nil +} + +func overloadFunction(function *Function, info xmlOverload) error { + overload := Overload{ + GoName: function.GoName, + OverloadName: info.OverloadName, + Parameters: make([]Parameter, len(function.Parameters)), + Return: function.Return, + } + copy(overload.Parameters, function.Parameters) + for _, change := range info.ParameterChanges { + if (change.Index < 0) || (change.Index >= len(function.Parameters)) { + return fmt.Errorf("overload for <%s> has invalid parameter index", info.Name) + } + param := &overload.Parameters[change.Index] + + if change.Type != nil { + _, ctype, err := parseSignature(xmlSignature(change.Type.Signature)) + if err != nil { + return fmt.Errorf("failed to parse signature of overload for <%s>: %v", info.Name, err) + } + // store original type definition as a cast, as this most likely will be needed. + param.Type.Cast = param.Type.CDefinition + param.Type.PointerLevel = ctype.PointerLevel + param.Type.Name = ctype.Name + param.Type.CDefinition = ctype.CDefinition + } + if change.Name != nil { + param.Name = change.Name.Value + } + } + function.Overloads = append(function.Overloads, overload) + return nil +} + func parseSignature(signature xmlSignature) (name string, ctype Type, err error) { readingName := false readingType := false @@ -402,6 +449,15 @@ func (functions specFunctions) get(name, api string) *Function { return functions[specRef{name, ""}] } +func (functions specFunctions) getByName(name string) *Function { + for key, function := range functions { + if key.name == name { + return function + } + } + return nil +} + func (enums specEnums) get(name, api string) *Enum { enum, ok := enums[specRef{name, api}] if ok { @@ -459,14 +515,14 @@ func (addRem *specAddRemSet) shouldInclude(pkgSpec *PackageSpec) bool { return true } -// NewSpecification creates a new specification based on an XML file. -func NewSpecification(file string) (*Specification, error) { - registry, err := readSpecFile(file) +// NewSpecification creates a new specification based on an XML registry. +func NewSpecification(registry xmlRegistry, overloads xmlOverloads) (*Specification, error) { + functions, err := parseFunctions(registry.Commands) if err != nil { return nil, err } - functions, err := parseFunctions(registry.Commands) + functions, err = parseOverloads(functions, overloads) if err != nil { return nil, err } diff --git a/spec_test.go b/spec_test.go new file mode 100644 index 0000000..1f366d7 --- /dev/null +++ b/spec_test.go @@ -0,0 +1,80 @@ +package main + +import "testing" + +func TestParseSignature(t *testing.T) { + tt := []struct { + input string + expectedName string + expectedType Type + }{ + { + input: "const void *pointer", + expectedName: "pointer", + expectedType: Type{ + Name: "void", + PointerLevel: 1, + CDefinition: "const void *", + }, + }, + { + input: "GLsizei stride", + expectedName: "stride", + expectedType: Type{ + Name: "GLsizei", + PointerLevel: 0, + CDefinition: "GLsizei ", + }, + }, + { + input: "const GLuint *value", + expectedName: "value", + expectedType: Type{ + Name: "GLuint", + PointerLevel: 1, + CDefinition: "const GLuint *", + }, + }, + { + input: "GLuint baseAndCount[2]", + expectedName: "baseAndCount", + expectedType: Type{ + Name: "GLuint", + PointerLevel: 1, + CDefinition: "GLuint *", + }, + }, + { + input: "uintptr_t **", + expectedName: "", + expectedType: Type{ + Name: "uintptr_t", + PointerLevel: 2, + CDefinition: "uintptr_t **", + }, + }, + } + + for _, tc := range tt { + tc := tc + t.Run(tc.input, func(t *testing.T) { + name, ctype, err := parseSignature(xmlSignature(tc.input)) + failed := false + if err != nil { + t.Logf("parseSignature returned error: %v", err) + failed = true + } + if name != tc.expectedName { + t.Logf("name [%s] does not match expected [%s]", name, tc.expectedName) + failed = true + } + if ctype != tc.expectedType { + t.Logf("type [%v] does not match expected [%v]", ctype, tc.expectedType) + failed = true + } + if failed { + t.Fail() + } + }) + } +} diff --git a/test.bat b/test.bat new file mode 100644 index 0000000..2391c23 --- /dev/null +++ b/test.bat @@ -0,0 +1,9 @@ +@echo off +go build +glow generate -out=../gl/v3.3-core/gl/ -api=gl -version=3.3 -profile=core -xml=../glow/xml/ + +echo Building... +pushd . +cd ../gl/v3.3-core/gl +go build +popd diff --git a/tmpl/conversions.tmpl b/tmpl/conversions.tmpl index e0b4d11..2375300 100644 --- a/tmpl/conversions.tmpl +++ b/tmpl/conversions.tmpl @@ -1,6 +1,6 @@ //glow:keepspace -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/neclepsio/glow). DO NOT EDIT. package {{.Name}} diff --git a/tmpl/conversions_notwindows.tmpl b/tmpl/conversions_notwindows.tmpl index 4762ec2..b0681c6 100644 --- a/tmpl/conversions_notwindows.tmpl +++ b/tmpl/conversions_notwindows.tmpl @@ -1,7 +1,7 @@ //glow:keepspace // +build !windows -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/neclepsio/glow). DO NOT EDIT. package {{.Name}} diff --git a/tmpl/conversions_windows.tmpl b/tmpl/conversions_windows.tmpl index d661c8d..138215e 100644 --- a/tmpl/conversions_windows.tmpl +++ b/tmpl/conversions_windows.tmpl @@ -1,7 +1,7 @@ //glow:keepspace // +build windows -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/neclepsio/glow). DO NOT EDIT. package {{.Name}} diff --git a/tmpl/debug_notwindows.tmpl b/tmpl/debug_notwindows.tmpl index df75f14..4505fa6 100644 --- a/tmpl/debug_notwindows.tmpl +++ b/tmpl/debug_notwindows.tmpl @@ -1,7 +1,7 @@ //glow:keepspace // +build !windows -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/neclepsio/glow). DO NOT EDIT. package {{.Name}} //glow:rmspace diff --git a/tmpl/debug_windows.tmpl b/tmpl/debug_windows.tmpl index 8ec4998..d8f8ea9 100644 --- a/tmpl/debug_windows.tmpl +++ b/tmpl/debug_windows.tmpl @@ -1,10 +1,12 @@ //glow:keepspace -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/neclepsio/glow). DO NOT EDIT. package {{.Name}} -//glow:rmspace -import "unsafe" +import ( + "syscall" + "unsafe" +) type DebugProc func( source uint32, @@ -14,3 +16,13 @@ type DebugProc func( length int32, message string, userParam unsafe.Pointer) + +func newDebugProcCallback(callback DebugProc) uintptr { + // I can't find why, but on AMD64 I must use 64-bit types, else I get data corruption. + // I don't know if this is true for 32-bit. Using uintptrs is an untested guess. + f := func(source uintptr, gltype uintptr, id uintptr, severity uintptr, length uintptr, message unsafe.Pointer, userParam unsafe.Pointer) uintptr { + callback(uint32(source), uint32(gltype), uint32(id), uint32(severity), int32(length), GoStr((*uint8)(message)), userParam) + return 0 + } + return syscall.NewCallbackCDecl(f) +} diff --git a/tmpl/package.tmpl b/tmpl/package.tmpl index 3968139..68c658f 100644 --- a/tmpl/package.tmpl +++ b/tmpl/package.tmpl @@ -1,5 +1,5 @@ //glow:keepspace -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/neclepsio/glow). DO NOT EDIT. // Copyright (c) 2010 Khronos Group. // This material may be distributed subject to the terms and conditions @@ -13,7 +13,7 @@ // Package {{.Name}} implements Go bindings to OpenGL. // // This package was automatically generated using Glow: -// https://github.com/go-gl/glow +// https://github.com/neclepsio/glow // package {{.Name}} //glow:rmspace diff --git a/tmpl/package_notwindows.tmpl b/tmpl/package_notwindows.tmpl index abee722..0e57604 100644 --- a/tmpl/package_notwindows.tmpl +++ b/tmpl/package_notwindows.tmpl @@ -1,13 +1,13 @@ //glow:keepspace // +build !windows -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/neclepsio/glow). DO NOT EDIT. package {{.Name}} //glow:rmspace {{define "paramsCDecl"}}{{range $i, $p := .}}{{if ne $i 0}}, {{end}}{{$p.Type.CType}} {{$p.CName}}{{end}}{{end}} -{{define "paramsCCall"}}{{range $i, $p := .}}{{if ne $i 0}}, {{end}}{{if $p.Type.IsDebugProc}}glowCDebugCallback{{else}}{{$p.CName}}{{end}}{{end}}{{end}} +{{define "paramsCCall"}}{{range $i, $p := .}}{{if ne $i 0}}, {{end}}{{if $p.Type.IsDebugProc}}glowCDebugCallback{{else}}{{if ge (len $p.Type.Cast) 1}}({{$p.Type.Cast}})({{end}}{{$p.CName}}{{if ge (len $p.Type.Cast) 1}}){{end}}{{end}}{{end}}{{end}} {{define "paramsGoDecl"}}{{range $i, $p := .}}{{if ne $i 0}}, {{end}}{{$p.GoName}} {{$p.Type.GoType}}{{end}}{{end}} {{define "paramsGoCall"}}{{range $i, $p := .}}{{if ne $i 0}}, {{end}}{{$p.Type.ConvertGoToC $p.GoName}}{{end}}{{end}} @@ -46,6 +46,11 @@ package {{.Name}} // static {{.Return.CType}} glow{{.GoName}}(GP{{toUpper .GoName}} fnptr{{if ge (len .Parameters) 1}}, {{end}}{{template "paramsCDecl" .Parameters}}) { // {{if not .Return.IsVoid}}return {{end}}(*fnptr)({{template "paramsCCall" .Parameters}}); // } +// {{range .Overloads}} +// static {{.Return.CType}} glow{{.OverloadName}}(GP{{toUpper .GoName}} fnptr{{if ge (len .Parameters) 1}}, {{end}}{{template "paramsCDecl" .Parameters}}) { +// {{if not .Return.IsVoid}}return {{end}}(*fnptr)({{template "paramsCCall" .Parameters}}); +// } +// {{end}} // {{end}} // import "C" @@ -69,6 +74,7 @@ func boolToInt(b bool) int { } {{define "bridgeCall"}}C.glow{{.GoName}}(gp{{.GoName}}{{if ge (len .Parameters) 1}}, {{end}}{{template "paramsGoCall" .Parameters}}){{end}} +{{define "overloadCall"}}C.glow{{.OverloadName}}(gp{{.GoName}}{{if ge (len .Parameters) 1}}, {{end}}{{template "paramsGoCall" .Parameters}}){{end}} {{range .Functions}} {{.Comment}} func {{.GoName}}({{template "paramsGoDecl" .Parameters}}){{if not .Return.IsVoid}} {{.Return.GoType}}{{end}} { @@ -81,8 +87,20 @@ func {{.GoName}}({{template "paramsGoDecl" .Parameters}}){{if not .Return.IsVoid return {{.Return.ConvertCToGo "ret"}} {{end}} } -{{end}} +{{range .Overloads}} +func {{.OverloadName}}({{template "paramsGoDecl" .Parameters}}){{if not .Return.IsVoid}} {{.Return.GoType}}{{end}} { + {{range .Parameters}} + {{if .Type.IsDebugProc}}userDebugCallback = {{.GoName}}{{end}} + {{end}} + {{if .Return.IsVoid}}{{template "overloadCall" .}} + {{else}} + ret := {{template "overloadCall" .}} + return {{.Return.ConvertCToGo "ret"}} + {{end}} +} +{{end}} +{{end}} // InitWithProcAddrFunc intializes the package using the specified OpenGL // function pointer loading function. For more cases Init should be used diff --git a/tmpl/package_windows.tmpl b/tmpl/package_windows.tmpl index 363436a..403a80d 100644 --- a/tmpl/package_windows.tmpl +++ b/tmpl/package_windows.tmpl @@ -1,5 +1,5 @@ //glow:keepspace -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/neclepsio/glow). DO NOT EDIT. package {{.Name}} //glow:rmspace @@ -38,6 +38,18 @@ func {{.GoName}}({{template "paramsGoDecl" .Parameters}}){{if not .Return.IsVoid return {{.Return.ConvertUintptrToGo "ret"}} {{end}} } +{{range .Overloads}} + +func {{.OverloadName}}({{template "paramsGoDecl" .Parameters}}){{if not .Return.IsVoid}} {{.Return.GoType}}{{end}} { + {{if not .IsImplementedForSyscall}}panic("\"{{.GoName}}\" is not implemented") + {{else if .Return.IsVoid}}{{.Syscall}} + {{else}} + ret, _, _ := {{.Syscall}} + return {{.Return.ConvertUintptrToGo "ret"}} + {{end}} +} +{{end}} + {{end}} // InitWithProcAddrFunc intializes the package using the specified OpenGL diff --git a/tmpl/procaddr_notwindows.tmpl b/tmpl/procaddr_notwindows.tmpl index 2d9f700..1e17d35 100644 --- a/tmpl/procaddr_notwindows.tmpl +++ b/tmpl/procaddr_notwindows.tmpl @@ -1,7 +1,7 @@ //glow:keepspace // +build !windows -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/neclepsio/glow). DO NOT EDIT. // This file implements GlowGetProcAddress for every supported platform. The // correct version is chosen automatically based on build tags: diff --git a/tmpl/procaddr_windows.tmpl b/tmpl/procaddr_windows.tmpl index 2f31628..f568481 100644 --- a/tmpl/procaddr_windows.tmpl +++ b/tmpl/procaddr_windows.tmpl @@ -1,5 +1,5 @@ //glow:keepspace -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/neclepsio/glow). DO NOT EDIT. package {{.Name}} //glow:rmspace diff --git a/type.go b/type.go index ec8fc99..87e8d0f 100644 --- a/type.go +++ b/type.go @@ -10,6 +10,7 @@ type Type struct { Name string // Name of the type without modifiers PointerLevel int // Number of levels of declared indirection to the type CDefinition string // Raw C definition + Cast string // Raw C cast in case conversion is necessary } // A Typedef describes a C typedef statement. @@ -112,6 +113,8 @@ func (t Type) GoType() string { case "GLDEBUGPROC", "GLDEBUGPROCARB", "GLDEBUGPROCKHR": // Special case mapping to the type defined in debug.tmpl return "DebugProc" + case "uintptr_t": + return t.pointers() + "uintptr" } return "unsafe.Pointer" } @@ -150,7 +153,7 @@ func (t Type) ConvertGoToUintptr(name string) string { return fmt.Sprintf("uintptr(math.Float64bits(%s))", name) } case "GLDEBUGPROC", "GLDEBUGPROCARB", "GLDEBUGPROCKHR": - return fmt.Sprintf("syscall.NewCallbackCDecl(%s)", name) + return fmt.Sprintf("newDebugProcCallback(%s)", name) } if t.PointerLevel >= 1 && t.GoType() != "unsafe.Pointer" { return fmt.Sprintf("uintptr(unsafe.Pointer(%s))", name) diff --git a/type_test.go b/type_test.go new file mode 100644 index 0000000..e22a64a --- /dev/null +++ b/type_test.go @@ -0,0 +1,30 @@ +package main + +import "testing" + +func TestGoType(t *testing.T) { + tt := []struct { + in Type + expected string + }{ + { + in: Type{ + Name: "uintptr_t", + PointerLevel: 1, + CDefinition: "uintptr_t*", + Cast: "void *", + }, + expected: "*uintptr", + }, + } + + for _, tc := range tt { + tc := tc + t.Run(tc.in.String(), func(t *testing.T) { + goType := tc.in.GoType() + if goType != tc.expected { + t.Errorf("expected <%s>, got <%s>", tc.expected, goType) + } + }) + } +} diff --git a/xml/doc/glBindBufferRange.xml b/xml/doc/glBindBufferRange.xml index f2e2e9e..94a9653 100644 --- a/xml/doc/glBindBufferRange.xml +++ b/xml/doc/glBindBufferRange.xml @@ -21,11 +21,11 @@ void glBindBufferRange - GLenumtarget - GLuintindex - GLuintbuffer - GLintptroffset - GLsizeiptrsize + GLenum target + GLuint index + GLuint buffer + GLintptr offset + GLsizeiptr size diff --git a/xml/doc/glBindBuffersBase.xml b/xml/doc/glBindBuffersBase.xml index 9e729a2..9a6a7c6 100644 --- a/xml/doc/glBindBuffersBase.xml +++ b/xml/doc/glBindBuffersBase.xml @@ -42,7 +42,7 @@ - index + first Specify the index of the first binding point within the array specified by target. @@ -71,7 +71,7 @@ glBindBuffersBase binds a set of count buffer objects whose names are given in the array buffers to the count consecutive binding - points starting from index index of the array of targets specified + points starting from index first of the array of targets specified by target. If buffers is NULL then glBindBuffersBase unbinds any buffers that are currently bound to the referenced binding points. Assuming no errors are generated, it is equivalent to the following diff --git a/xml/doc/glBindBuffersRange.xml b/xml/doc/glBindBuffersRange.xml index 500ff16..b9ccbcd 100644 --- a/xml/doc/glBindBuffersRange.xml +++ b/xml/doc/glBindBuffersRange.xml @@ -44,7 +44,7 @@ - index + first Specify the index of the first binding point within the array specified by target. @@ -91,7 +91,7 @@ glBindBuffersRange binds a set of count ranges from buffer objects whose names are given in the array buffers to the count consecutive binding - points starting from index index of the array of targets specified + points starting from index first of the array of targets specified by target. offsets specifies the address of an array containing count starting offsets within the buffers, and sizes specifies the address of an array of count sizes of the ranges. If buffers is NULL then diff --git a/xml/doc/glBindFragDataLocation.xml b/xml/doc/glBindFragDataLocation.xml index f2ddc99..5755ee8 100644 --- a/xml/doc/glBindFragDataLocation.xml +++ b/xml/doc/glBindFragDataLocation.xml @@ -108,7 +108,7 @@ Associated Gets glGetFragDataLocation with a valid program object - and the the name of a user-defined varying out variable + and the name of a user-defined varying out variable Version Support diff --git a/xml/doc/glBindFragDataLocationIndexed.xml b/xml/doc/glBindFragDataLocationIndexed.xml index b0e4dee..3d4f280 100644 --- a/xml/doc/glBindFragDataLocationIndexed.xml +++ b/xml/doc/glBindFragDataLocationIndexed.xml @@ -129,11 +129,11 @@ Associated Gets glGetFragDataLocation with a valid program object - and the the name of a user-defined varying out variable + and the name of a user-defined varying out variable glGetFragDataIndex with a valid program object - and the the name of a user-defined varying out variable + and the name of a user-defined varying out variable Version Support diff --git a/xml/doc/glBindTransformFeedback.xml b/xml/doc/glBindTransformFeedback.xml index 27fa6c9..cccf0ca 100644 --- a/xml/doc/glBindTransformFeedback.xml +++ b/xml/doc/glBindTransformFeedback.xml @@ -52,7 +52,7 @@ glBindTransformFeedback binds the transform feedback object with name id to the current GL state. id must be a name previously returned from a call to glGenTransformFeedbacks. If id has not - previously been bound, a new transform feedback object with name id and initialized with with the + previously been bound, a new transform feedback object with name id and initialized with the default transform state vector is created. diff --git a/xml/doc/glBindVertexBuffer.xml b/xml/doc/glBindVertexBuffer.xml index b69eab5..32116ab 100644 --- a/xml/doc/glBindVertexBuffer.xml +++ b/xml/doc/glBindVertexBuffer.xml @@ -38,7 +38,7 @@ GLintptr offset - GLintptr stride + GLsizei stride diff --git a/xml/doc/glBlendFuncSeparate.xml b/xml/doc/glBlendFuncSeparate.xml index f28c6fd..b49c897 100644 --- a/xml/doc/glBlendFuncSeparate.xml +++ b/xml/doc/glBlendFuncSeparate.xml @@ -513,7 +513,7 @@ GL_ONE_MINUS_DST_COLOR - + @@ -981,7 +981,7 @@ - GL_ONE_MINUS_SRC_COLOR + GL_ONE_MINUS_SRC1_COLOR @@ -1088,7 +1088,7 @@ - GL_ONE_MINUS_SRC_ALPHA + GL_ONE_MINUS_SRC1_ALPHA @@ -1489,7 +1489,7 @@ Copyright Copyright 1991-2006 Silicon Graphics, Inc. - Copyright 2010-2014 Khronos Group. + Copyright 2010-2018 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/. diff --git a/xml/doc/glBlitFramebuffer.xml b/xml/doc/glBlitFramebuffer.xml index 50a086e..96afa14 100644 --- a/xml/doc/glBlitFramebuffer.xml +++ b/xml/doc/glBlitFramebuffer.xml @@ -128,7 +128,7 @@ For glBlitNamedFramebuffer, readFramebuffer and drawFramebuffer are the names of the read - read and draw framebuffer objects respectively. If + and draw framebuffer objects respectively. If readFramebuffer or drawFramebuffer is zero, then the default read or draw framebuffer respectively is used. diff --git a/xml/doc/glBufferData.xml b/xml/doc/glBufferData.xml index 4ce9caf..2873716 100644 --- a/xml/doc/glBufferData.xml +++ b/xml/doc/glBufferData.xml @@ -51,7 +51,7 @@ GLuint buffer - GLsizei size + GLsizeiptr size const void *data diff --git a/xml/doc/glBufferStorage.xml b/xml/doc/glBufferStorage.xml index 99f733a..e704a76 100644 --- a/xml/doc/glBufferStorage.xml +++ b/xml/doc/glBufferStorage.xml @@ -47,7 +47,7 @@ GLuint buffer - GLsizei size + GLsizeiptr size const void *data diff --git a/xml/doc/glBufferSubData.xml b/xml/doc/glBufferSubData.xml index 3de59d0..99a3de5 100644 --- a/xml/doc/glBufferSubData.xml +++ b/xml/doc/glBufferSubData.xml @@ -35,7 +35,7 @@ void glNamedBufferSubData GLuint buffer GLintptr offset - GLsizei size + GLsizeiptr size const void *data diff --git a/xml/doc/glClearBufferData.xml b/xml/doc/glClearBufferData.xml index 37be5ff..b36c590 100644 --- a/xml/doc/glClearBufferData.xml +++ b/xml/doc/glClearBufferData.xml @@ -44,7 +44,7 @@ Specifies the target to which the buffer object is bound for glClearBufferData, which must - must be one of the buffer binding targets in the + be one of the buffer binding targets in the following table: diff --git a/xml/doc/glClearBufferSubData.xml b/xml/doc/glClearBufferSubData.xml index bafde8d..4babf4e 100644 --- a/xml/doc/glClearBufferSubData.xml +++ b/xml/doc/glClearBufferSubData.xml @@ -33,7 +33,7 @@ GLuint buffer GLenum internalformat GLintptr offset - GLsizei size + GLsizeiptr size GLenum format GLenum type const void *data diff --git a/xml/doc/glCopyBufferSubData.xml b/xml/doc/glCopyBufferSubData.xml index ccb0dc8..4caf50b 100644 --- a/xml/doc/glCopyBufferSubData.xml +++ b/xml/doc/glCopyBufferSubData.xml @@ -32,7 +32,7 @@ GLuint writeBuffer GLintptr readOffset GLintptr writeOffset - GLsizei size + GLsizeiptr size diff --git a/xml/doc/glCopyTexSubImage3D.xml b/xml/doc/glCopyTexSubImage3D.xml index 62b0ca7..0193a2c 100644 --- a/xml/doc/glCopyTexSubImage3D.xml +++ b/xml/doc/glCopyTexSubImage3D.xml @@ -54,8 +54,9 @@ Specifies the target to which the texture object is bound for glCopyTexSubImage3D function. Must be - GL_TEXTURE_3D or - GL_TEXTURE_2D_ARRAY. + GL_TEXTURE_3D, + GL_TEXTURE_2D_ARRAY or + GL_TEXTURE_CUBE_MAP_ARRAY. diff --git a/xml/doc/glCreateFramebuffers.xml b/xml/doc/glCreateFramebuffers.xml index 3855409..f1390a9 100644 --- a/xml/doc/glCreateFramebuffers.xml +++ b/xml/doc/glCreateFramebuffers.xml @@ -20,7 +20,7 @@ void glCreateFramebuffers GLsizei n - GLuint *ids + GLuint *framebuffers diff --git a/xml/doc/glDepthRangef.xml b/xml/doc/glDepthRangef.xml index 721bf76..163b6ef 100644 --- a/xml/doc/glDepthRangef.xml +++ b/xml/doc/glDepthRangef.xml @@ -9,7 +9,7 @@ Silicon Graphics, Inc. - 2010-2015 + 2010-2018 Khronos Group @@ -65,8 +65,9 @@ corresponding to the near and far clipping planes. glDepthRangef specifies a linear mapping of the normalized depth coordinates in this range to window depth coordinates. - If a fixed-point depth representation is used, the parameters n and f - are clamped to the range [0 to 1] when computing window z. + If a fixed-point depth representation is used, the parameters + n and f are + clamped to the range [0, 1] when specified. The setting of (0,1) maps the near plane to 0 and diff --git a/xml/doc/glDispatchComputeIndirect.xml b/xml/doc/glDispatchComputeIndirect.xml index 00ab5e6..6e8d1fd 100644 --- a/xml/doc/glDispatchComputeIndirect.xml +++ b/xml/doc/glDispatchComputeIndirect.xml @@ -64,7 +64,7 @@ A call to glDispatchComputeIndirect is equivalent, assuming no errors are generated, to: cmd = (const DispatchIndirectCommand *)indirect; - glDispatchComputeIndirect(cmd->num_groups_x, cmd->num_groups_y, cmd->num_groups_z); + glDispatchCompute(cmd->num_groups_x, cmd->num_groups_y, cmd->num_groups_z); Unlike glDispatchCompute, diff --git a/xml/doc/glDrawArraysInstanced.xml b/xml/doc/glDrawArraysInstanced.xml index 852585a..21bf7cf 100644 --- a/xml/doc/glDrawArraysInstanced.xml +++ b/xml/doc/glDrawArraysInstanced.xml @@ -24,7 +24,7 @@ GLenum mode GLint first GLsizei count - GLsizei primcount + GLsizei instancecount @@ -60,7 +60,7 @@ - primcount + instancecount Specifies the number of instances of the specified range of indices to be rendered. @@ -72,7 +72,7 @@ Description glDrawArraysInstanced behaves identically to glDrawArrays - except that primcount instances of the range of elements are executed and the value of the internal counter + except that instancecount instances of the range of elements are executed and the value of the internal counter instanceID advances for each iteration. instanceID is an internal 32-bit integer counter that may be read by a vertex shader as gl_InstanceID. @@ -81,7 +81,7 @@ if ( mode or count is invalid ) generate appropriate error else { - for (int i = 0; i < primcount ; i++) { + for (int i = 0; i < instancecount ; i++) { instanceID = i; glDrawArrays(mode, first, count); } @@ -99,7 +99,7 @@ is incompatible with the input primitive type of the geometry shader in the currently installed program object. - GL_INVALID_VALUE is generated if count or primcount are negative. + GL_INVALID_VALUE is generated if count or instancecount is negative. GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to an diff --git a/xml/doc/glDrawArraysInstancedBaseInstance.xml b/xml/doc/glDrawArraysInstancedBaseInstance.xml index 7367af7..88450c6 100644 --- a/xml/doc/glDrawArraysInstancedBaseInstance.xml +++ b/xml/doc/glDrawArraysInstancedBaseInstance.xml @@ -24,7 +24,7 @@ GLenum mode GLint first GLsizei count - GLsizei primcount + GLsizei instancecount GLuint baseinstance @@ -61,7 +61,7 @@ - primcount + instancecount Specifies the number of instances of the specified range of indices to be rendered. @@ -81,7 +81,7 @@ Description glDrawArraysInstancedBaseInstance behaves identically to glDrawArrays - except that primcount instances of the range of elements are executed and the value of the internal counter + except that instancecount instances of the range of elements are executed and the value of the internal counter instanceID advances for each iteration. instanceID is an internal 32-bit integer counter that may be read by a vertex shader as gl_InstanceID. @@ -90,7 +90,7 @@ if ( mode or count is invalid ) generate appropriate error else { - for (int i = 0; i < primcount ; i++) { + for (int i = 0; i < instancecount ; i++) { instanceID = i; glDrawArrays(mode, first, count); } @@ -134,7 +134,7 @@ is incompatible with the input primitive type of the geometry shader in the currently installed program object. - GL_INVALID_VALUE is generated if count or primcount are negative. + GL_INVALID_VALUE is generated if count or instancecount is negative. GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to an diff --git a/xml/doc/glDrawElementsInstanced.xml b/xml/doc/glDrawElementsInstanced.xml index 5d99372..fade4c9 100644 --- a/xml/doc/glDrawElementsInstanced.xml +++ b/xml/doc/glDrawElementsInstanced.xml @@ -25,7 +25,7 @@ GLsizei count GLenum type const void * indices - GLsizei primcount + GLsizei instancecount @@ -78,7 +78,7 @@ - primcount + instancecount Specifies the number of instances of the specified range of indices to be rendered. @@ -90,7 +90,7 @@ Description glDrawElementsInstanced behaves identically to glDrawElements - except that primcount instances of the set of elements are executed and the value of the internal counter + except that instancecount instances of the set of elements are executed and the value of the internal counter instanceID advances for each iteration. instanceID is an internal 32-bit integer counter that may be read by a vertex shader as gl_InstanceID. @@ -99,7 +99,7 @@ if (mode, count, or type is invalid ) generate appropriate error else { - for (int i = 0; i < primcount ; i++) { + for (int i = 0; i < instancecount ; i++) { instanceID = i; glDrawElements(mode, count, type, indices); } @@ -126,7 +126,7 @@ GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, or GL_TRIANGLES. - GL_INVALID_VALUE is generated if count or primcount are negative. + GL_INVALID_VALUE is generated if count or instancecount is negative. GL_INVALID_OPERATION is generated if a geometry shader is active and mode diff --git a/xml/doc/glDrawElementsInstancedBaseInstance.xml b/xml/doc/glDrawElementsInstancedBaseInstance.xml index 713c906..917d78b 100644 --- a/xml/doc/glDrawElementsInstancedBaseInstance.xml +++ b/xml/doc/glDrawElementsInstancedBaseInstance.xml @@ -25,8 +25,8 @@ GLsizei count GLenum type const void * indices - GLsizei primcount - GLuitn baseinstance + GLsizei instancecount + GLuint baseinstance @@ -79,7 +79,7 @@ - primcount + instancecount Specifies the number of instances of the specified range of indices to be rendered. @@ -99,7 +99,7 @@ Description glDrawElementsInstancedBaseInstance behaves identically to glDrawElements - except that primcount instances of the set of elements are executed and the value of the internal counter + except that instancecount instances of the set of elements are executed and the value of the internal counter instanceID advances for each iteration. instanceID is an internal 32-bit integer counter that may be read by a vertex shader as gl_InstanceID. @@ -108,7 +108,7 @@ if (mode, count, or type is invalid ) generate appropriate error else { - for (int i = 0; i < primcount ; i++) { + for (int i = 0; i < instancecount ; i++) { instanceID = i; glDrawElements(mode, count, type, indices); } @@ -161,7 +161,7 @@ GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, or GL_TRIANGLES. - GL_INVALID_VALUE is generated if count or primcount are negative. + GL_INVALID_VALUE is generated if count or instancecount is negative. GL_INVALID_OPERATION is generated if a geometry shader is active and mode diff --git a/xml/doc/glDrawElementsInstancedBaseVertex.xml b/xml/doc/glDrawElementsInstancedBaseVertex.xml index e02c818..0eb3bf6 100644 --- a/xml/doc/glDrawElementsInstancedBaseVertex.xml +++ b/xml/doc/glDrawElementsInstancedBaseVertex.xml @@ -25,7 +25,7 @@ GLsizei count GLenum type GLvoid *indices - GLsizei primcount + GLsizei instancecount GLint basevertex @@ -71,7 +71,7 @@ - primcount + instancecount Specifies the number of instances of the indexed geometry that should be drawn. @@ -109,7 +109,7 @@ GL_INVALID_ENUM is generated if mode is not an accepted value. - GL_INVALID_VALUE is generated if count or primcount is negative. + GL_INVALID_VALUE is generated if count or instancecount is negative. GL_INVALID_OPERATION is generated if a geometry shader is active and mode diff --git a/xml/doc/glDrawElementsInstancedBaseVertexBaseInstance.xml b/xml/doc/glDrawElementsInstancedBaseVertexBaseInstance.xml index 56e2004..635d2f1 100644 --- a/xml/doc/glDrawElementsInstancedBaseVertexBaseInstance.xml +++ b/xml/doc/glDrawElementsInstancedBaseVertexBaseInstance.xml @@ -25,7 +25,7 @@ GLsizei count GLenum type GLvoid *indices - GLsizei primcount + GLsizei instancecount GLint basevertex GLuint baseinstance @@ -72,7 +72,7 @@ - primcount + instancecount Specifies the number of instances of the indexed geometry that should be drawn. @@ -144,7 +144,7 @@ GL_INVALID_ENUM is generated if mode is not an accepted value. - GL_INVALID_VALUE is generated if count or primcount is negative. + GL_INVALID_VALUE is generated if count or instancecount is negative. GL_INVALID_OPERATION is generated if a geometry shader is active and mode diff --git a/xml/doc/glDrawTransformFeedbackInstanced.xml b/xml/doc/glDrawTransformFeedbackInstanced.xml index c8db5ec..485d3a6 100644 --- a/xml/doc/glDrawTransformFeedbackInstanced.xml +++ b/xml/doc/glDrawTransformFeedbackInstanced.xml @@ -23,7 +23,7 @@ void glDrawTransformFeedbackInstanced GLenum mode GLuint id - GLsizei primcount + GLsizei instancecount @@ -60,7 +60,7 @@ - primcount + instancecount Specifies the number of instances of the geometry to render. @@ -75,7 +75,7 @@ a count retrieved from the transform feedback stream specified by stream of the transform feedback object specified by id. Calling glDrawTransformFeedbackInstanced is equivalent to calling glDrawArraysInstanced with mode - and primcount as specified, first set to zero, and count set to the number of vertices captured + and instancecount as specified, first set to zero, and count set to the number of vertices captured on vertex stream zero the last time transform feedback was active on the transform feedback object named by id. diff --git a/xml/doc/glDrawTransformFeedbackStreamInstanced.xml b/xml/doc/glDrawTransformFeedbackStreamInstanced.xml index d92f5c6..4811616 100644 --- a/xml/doc/glDrawTransformFeedbackStreamInstanced.xml +++ b/xml/doc/glDrawTransformFeedbackStreamInstanced.xml @@ -24,7 +24,7 @@ GLenum mode GLuint id GLuint stream - GLsizei primcount + GLsizei instancecount @@ -69,7 +69,7 @@ - primcount + instancecount Specifies the number of instances of the geometry to render. @@ -84,7 +84,7 @@ a count retrieved from the transform feedback stream specified by stream of the transform feedback object specified by id. Calling glDrawTransformFeedbackStreamInstanced is equivalent to calling glDrawArraysInstanced with mode - and primcount as specified, first set to zero, and count set to the number of vertices captured + and instancecount as specified, first set to zero, and count set to the number of vertices captured on vertex stream stream the last time transform feedback was active on the transform feedback object named by id. diff --git a/xml/doc/glFlushMappedBufferRange.xml b/xml/doc/glFlushMappedBufferRange.xml index 79f5f7a..9d6865f 100644 --- a/xml/doc/glFlushMappedBufferRange.xml +++ b/xml/doc/glFlushMappedBufferRange.xml @@ -28,7 +28,7 @@ void glFlushMappedNamedBufferRange GLuint buffer GLintptr offset - GLsizei length + GLsizeiptr length diff --git a/xml/doc/glGenerateMipmap.xml b/xml/doc/glGenerateMipmap.xml index 1d6a3e4..529e85b 100644 --- a/xml/doc/glGenerateMipmap.xml +++ b/xml/doc/glGenerateMipmap.xml @@ -62,8 +62,8 @@ glGenerateMipmap and glGenerateTextureMipmap generates mipmaps for the specified texture object. For - glGenerateMipmap, the texture object is - that bound to to target. For + glGenerateMipmap, the texture object + that is bound to target. For glGenerateTextureMipmap, texture is the name of the texture object. diff --git a/xml/doc/glGetActiveAtomicCounterBufferiv.xml b/xml/doc/glGetActiveAtomicCounterBufferiv.xml index 720ee05..b28ad16 100644 --- a/xml/doc/glGetActiveAtomicCounterBufferiv.xml +++ b/xml/doc/glGetActiveAtomicCounterBufferiv.xml @@ -21,7 +21,7 @@ void glGetActiveAtomicCounterBufferiv - Gluint program + GLuint program GLuint bufferIndex GLenum pname GLint *params diff --git a/xml/doc/glGetActiveSubroutineName.xml b/xml/doc/glGetActiveSubroutineName.xml index 3652906..602212e 100644 --- a/xml/doc/glGetActiveSubroutineName.xml +++ b/xml/doc/glGetActiveSubroutineName.xml @@ -24,7 +24,7 @@ GLuint program GLenum shadertype GLuint index - GLsizei bufsize + GLsizei bufSize GLsizei *length GLchar *name @@ -57,7 +57,7 @@ - bufsize + bufSize Specifies the size of the buffer whose address is given in name. @@ -92,9 +92,9 @@ The name of the selected subroutine is returned as a null-terminated string in name. The actual number of characters written into name, not including the null-terminator, is - is returned in length. If length is NULL, + returned in length. If length is NULL, no length is returned. The maximum number of characters that may be written into name, - including the null-terminator, is given in bufsize. + including the null-terminator, is given in bufSize. Errors diff --git a/xml/doc/glGetActiveSubroutineUniform.xml b/xml/doc/glGetActiveSubroutineUniform.xml index 00c8add..a33ee9a 100644 --- a/xml/doc/glGetActiveSubroutineUniform.xml +++ b/xml/doc/glGetActiveSubroutineUniform.xml @@ -82,7 +82,7 @@ glGetActiveSubroutineUniform queries a parameter of an active shader subroutine uniform. program contains the name of the program containing the uniform. shadertype - specifies the stage which which the uniform location, given by index, is valid. index + specifies the stage which the uniform location, given by index, is valid. index must be between zero and the value of GL_ACTIVE_SUBROUTINE_UNIFORMS minus one for the shader stage. diff --git a/xml/doc/glGetActiveSubroutineUniformName.xml b/xml/doc/glGetActiveSubroutineUniformName.xml index 02ae68f..b326a88 100644 --- a/xml/doc/glGetActiveSubroutineUniformName.xml +++ b/xml/doc/glGetActiveSubroutineUniformName.xml @@ -24,7 +24,7 @@ GLuint program GLenum shadertype GLuint index - GLsizei bufsize + GLsizei bufSize GLsizei *length GLchar *name @@ -60,7 +60,7 @@ - bufsize + bufSize Specifies the size of the buffer whose address is given in name. @@ -89,7 +89,7 @@ glGetActiveSubroutineUniformName retrieves the name of an active shader subroutine uniform. program contains the name of the program containing the uniform. shadertype - specifies the stage for which which the uniform location, given by index, is valid. index + specifies the stage for which the uniform location, given by index, is valid. index must be between zero and the value of GL_ACTIVE_SUBROUTINE_UNIFORMS minus one for the shader stage. @@ -97,7 +97,7 @@ The uniform name is returned as a null-terminated string in name. The actual number of characters written into name, excluding the null terminator is returned in length. If length is NULL, no length is returned. The maximum number of characters - that may be written into name, including the null terminator, is specified by bufsize. + that may be written into name, including the null terminator, is specified by bufSize. The length of the longest subroutine uniform name in program and shadertype is given by the value of GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH, which can be queried with glGetProgramStage. diff --git a/xml/doc/glGetActiveUniformsiv.xml b/xml/doc/glGetActiveUniformsiv.xml index 04c85ff..eb07745 100644 --- a/xml/doc/glGetActiveUniformsiv.xml +++ b/xml/doc/glGetActiveUniformsiv.xml @@ -718,7 +718,7 @@ If pname is GL_UNIFORM_BLOCK_INDEX, then an array identifying the - the uniform block index of each of the uniforms specified by the corresponding array of uniformIndices + uniform block index of each of the uniforms specified by the corresponding array of uniformIndices is returned. The uniform block index of a uniform associated with the default uniform block is -1. diff --git a/xml/doc/glGetBufferSubData.xml b/xml/doc/glGetBufferSubData.xml index 8c51b31..3a461a2 100644 --- a/xml/doc/glGetBufferSubData.xml +++ b/xml/doc/glGetBufferSubData.xml @@ -33,7 +33,7 @@ void glGetNamedBufferSubData GLuint buffer GLintptr offset - GLsizei size + GLsizeiptr size void *data diff --git a/xml/doc/glGetDebugMessageLog.xml b/xml/doc/glGetDebugMessageLog.xml index c90e258..4d80932 100644 --- a/xml/doc/glGetDebugMessageLog.xml +++ b/xml/doc/glGetDebugMessageLog.xml @@ -24,7 +24,7 @@ GLuint count GLsizei bufSize GLenum *sources - Glenum *types + GLenum *types GLuint *ids GLenum *severities GLsizei *lengths diff --git a/xml/doc/glGetInternalformat.xml b/xml/doc/glGetInternalformat.xml index d45e267..8297f26 100644 --- a/xml/doc/glGetInternalformat.xml +++ b/xml/doc/glGetInternalformat.xml @@ -99,7 +99,7 @@ The information retrieved will be written to memory addressed by the pointer specified in params. No - more than bufSize basic machine units will be written to this memory. + more than bufSize integers will be written to this memory. If pname is GL_NUM_SAMPLE_COUNTS, the number of sample counts that would be @@ -148,11 +148,11 @@ - If pname is GL_INTERNALFORMAT_SUPPORTED, params is set to GL_TRUE if internalFormat + If pname is GL_INTERNALFORMAT_SUPPORTED, params is set to GL_TRUE if internalformat is a supported internal format for target and to GL_FALSE otherwise. - If pname is GL_INTERNALFORMAT_PREFERRED, params is set to GL_TRUE if internalFormat + If pname is GL_INTERNALFORMAT_PREFERRED, params is set to GL_TRUE if internalformat is an format for target that is preferred by the implementation and to GL_FALSE otherwise. @@ -160,7 +160,7 @@ GL_INTERNALFORMAT_BLUE_SIZE, GL_INTERNALFORMAT_ALPHA_SIZE, GL_INTERNALFORMAT_DEPTH_SIZE, GL_INTERNALFORMAT_STENCIL_SIZE, or GL_INTERNALFORMAT_SHARED_SIZE then params is set to the actual resolutions that would be used for storing image array components - for the resource for the red, green, blue, alpha, depth, stencil and shared channels respectively. If internalFormat + for the resource for the red, green, blue, alpha, depth, stencil and shared channels respectively. If internalformat is a compressed internal format, then params is set to the component resolution of an uncompressed internal format that produces an image of roughly the same quality as the compressed algorithm. If the internal format is unsupported, or if a particular component is not present in the format, 0 is written to params. @@ -169,13 +169,13 @@ If pname is GL_INTERNALFORMAT_RED_TYPE, GL_INTERNALFORMAT_GREEN_TYPE, GL_INTERNALFORMAT_BLUE_TYPE, GL_INTERNALFORMAT_ALPHA_TYPE, GL_INTERNALFORMAT_DEPTH_TYPE, or GL_INTERNALFORMAT_STENCIL_TYPE then params is set to a token identifying the data type used - to store the respective component. If the internalFormat represents a compressed internal format then + to store the respective component. If the internalformat represents a compressed internal format then the types returned specify how components are interpreted after decompression. If pname is GL_MAX_WIDTH, GL_MAX_HEIGHT, GL_MAX_DEPTH, or GL_MAX_LAYERS then pname is filled with the maximum width, height, depth or layer count - for textures with internal format internalFormat, respectively. If pname is GL_MAX_COMBINED_DIMENSIONS + for textures with internal format internalformat, respectively. If pname is GL_MAX_COMBINED_DIMENSIONS then pname is filled with the maximum combined dimensions of a texture of the specified internal format. @@ -489,7 +489,7 @@ Copyright - Copyright 2011-2014 Khronos Group. + Copyright 2011-2018 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/. diff --git a/xml/doc/glGetObjectLabel.xml b/xml/doc/glGetObjectLabel.xml index 1cea035..72476c2 100644 --- a/xml/doc/glGetObjectLabel.xml +++ b/xml/doc/glGetObjectLabel.xml @@ -23,7 +23,7 @@ void glGetObjectLabel GLenum identifier GLuint name - GLsizei bifSize + GLsizei bufSize GLsizei * length char * label @@ -88,7 +88,7 @@ label is the address of a string that will be used to store the object label. bufSize specifies the number of characters in the array identified by label. - length contains the address of a variable which will receive the the number of characters in the object label. + length contains the address of a variable which will receive the number of characters in the object label. If length is NULL, then it is ignored and no data is written. Likewise, if label is NULL, or if bufSize is zero then no data is written to label. diff --git a/xml/doc/glGetObjectPtrLabel.xml b/xml/doc/glGetObjectPtrLabel.xml index 7aa39e8..bcf4e98 100644 --- a/xml/doc/glGetObjectPtrLabel.xml +++ b/xml/doc/glGetObjectPtrLabel.xml @@ -22,7 +22,7 @@ void glGetObjectPtrLabel void * ptr - GLsizei bifSize + GLsizei bufSize GLsizei * length char * label @@ -72,7 +72,7 @@ label is the address of a string that will be used to store the object label. bufSize specifies the number of characters in the array identified by label. - length contains the address of a variable which will receive the the number of characters in the object label. + length contains the address of a variable which will receive the number of characters in the object label. If length is NULL, then it is ignored and no data is written. Likewise, if label is NULL, or if bufSize is zero then no data is written to label. diff --git a/xml/doc/glGetProgramBinary.xml b/xml/doc/glGetProgramBinary.xml index faa8f7c..6fa98d4 100644 --- a/xml/doc/glGetProgramBinary.xml +++ b/xml/doc/glGetProgramBinary.xml @@ -22,7 +22,7 @@ void glGetProgramBinary GLuint program - GLsizei bufsize + GLsizei bufSize GLsizei *length GLenum *binaryFormat void *binary diff --git a/xml/doc/glGetProgramResource.xml b/xml/doc/glGetProgramResource.xml index 0d9ee6c..d41fc35 100644 --- a/xml/doc/glGetProgramResource.xml +++ b/xml/doc/glGetProgramResource.xml @@ -25,7 +25,7 @@ GLenum programInterface GLuint index GLsizei propCount - const Glenum * props + const GLenum * props GLsizei bufSize GLsizei * length GLint * params diff --git a/xml/doc/glGetQueryObject.xml b/xml/doc/glGetQueryObject.xml index 7d217c9..427a4d4 100644 --- a/xml/doc/glGetQueryObject.xml +++ b/xml/doc/glGetQueryObject.xml @@ -19,6 +19,7 @@ glGetQueryObject + glGetQueryBufferObject return parameters of a query object C Specification @@ -54,6 +55,42 @@ GLuint64 * params + + + void glGetQueryBufferObjectiv + GLuint id + GLuint buffer + GLenum pname + GLintptr offset + + + + + void glGetQueryBufferObjectuiv + GLuint id + GLuint buffer + GLenum pname + GLintptr offset + + + + + void glGetQueryBufferObjecti64v + GLuint id + GLuint buffer + GLenum pname + GLintptr offset + + + + + void glGetQueryBufferObjectui64v + GLuint id + GLuint buffer + GLenum pname + GLintptr offset + + Parameters @@ -65,12 +102,20 @@ + + buffer + + + Specifies the name of a buffer object. + + + pname Specifies the symbolic name of a query object parameter. - Accepted values are GL_QUERY_RESULT or GL_QUERY_RESULT_AVAILABLE. + Accepted values are GL_QUERY_RESULT or GL_QUERY_RESULT_AVAILABLE. @@ -85,12 +130,23 @@ + + offset + + + Specifies the byte offset into buffer's data store + where the queried result will be written. + + + Description - glGetQueryObject returns in params a selected parameter of the query object - specified by id. + These commands return a selected parameter of the query object specified by id. + glGetQueryObject returns in params a selected parameter of the query object specified by id. + glGetQueryBufferObject returns in buffer a selected parameter of the query object specified by id, + by writing it to buffer's data store at the byte offset specified by offset. pname names a specific query object parameter. pname can be as follows: @@ -100,7 +156,7 @@ GL_QUERY_RESULT - params returns the value of the query object's passed samples counter. + params or buffer returns the value of the query object's passed samples counter. The initial value is 0. @@ -110,8 +166,8 @@ If the result of the query is available (that is, a query of GL_QUERY_RESULT_AVAILABLE would - return non-zero), then params returns the value of the query object's passed samples counter, - otherwise, the data referred to by params is not modified. + return non-zero), then params or buffer returns the value of the query object's passed samples counter, + otherwise, the data referred to by params or buffer is not modified. The initial value is 0. @@ -120,7 +176,7 @@ GL_QUERY_RESULT_AVAILABLE - params returns whether the passed samples counter is immediately available. + params or buffer returns whether the passed samples counter is immediately available. If a delay would occur waiting for the query result, GL_FALSE is returned. Otherwise, GL_TRUE is returned, which also indicates that the results of all previous queries are available as well. @@ -132,15 +188,16 @@ Notes If an error is generated, - no change is made to the contents of params. + no change is made to the contents of params or buffer. - glGetQueryObject implicitly flushes the GL pipeline so that any incomplete rendering + glGetQueryObject and glGetQueryBufferObject implicitly flush the GL pipeline so that any incomplete rendering delimited by the occlusion query completes in finite time. If multiple queries are issued using the same query object id before calling - glGetQueryObject, the results of the most recent query will be returned. In this case, + glGetQueryObject or glGetQueryBufferObject, + the results of the most recent query will be returned. In this case, when issuing a new query, the results of the previous query are discarded. @@ -163,15 +220,26 @@ GL_INVALID_OPERATION is generated if id is not the name of a query object. + + GL_INVALID_OPERATION is generated by glGetQueryBufferObject + if buffer is not the name of an already created buffer object. + GL_INVALID_OPERATION is generated if id is the name of a currently active query object. - GL_INVALID_OPERATION is generated if a buffer is currently bound to the + GL_INVALID_OPERATION is generated by glGetQueryObject if a buffer is currently bound to the GL_QUERY_RESULT_BUFFER target and the command would cause data to be written beyond the bounds of that buffer's data store. + + GL_INVALID_OPERATION is generated by glGetQueryBufferObject + if the command would cause data to be written beyond the bounds of buffer's data store. + + + GL_INVALID_VALUE is generated by glGetQueryBufferObject if offset is negative. + Version Support @@ -194,6 +262,22 @@ glGetQueryObjectuiv + + glGetQueryBufferObjecti64v + + + + glGetQueryBufferObjectiv + + + + glGetQueryBufferObjectui64v + + + + glGetQueryBufferObjectuiv + + diff --git a/xml/doc/glGetTexImage.xml b/xml/doc/glGetTexImage.xml index 2b24010..54a3383 100644 --- a/xml/doc/glGetTexImage.xml +++ b/xml/doc/glGetTexImage.xml @@ -78,7 +78,7 @@ GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, and - GL_TEXTURE_CUBE_MAP_ARRAY are acceptable. + GL_TEXTURE_CUBE_MAP_ARRAY are acceptable. diff --git a/xml/doc/glGetTransformFeedbackVarying.xml b/xml/doc/glGetTransformFeedbackVarying.xml index 2ef7830..b1aad25 100644 --- a/xml/doc/glGetTransformFeedbackVarying.xml +++ b/xml/doc/glGetTransformFeedbackVarying.xml @@ -21,9 +21,9 @@ void glGetTransformFeedbackVarying - GLuintprogram - GLuintindex - GLsizeibufSize + GLuint program + GLuint index + GLsizei bufSize GLsizei *length GLsizei *size GLenum *type @@ -78,7 +78,7 @@ type - The address of a variable that will recieve the type of the varying. + The address of a variable that will receive the type of the varying. diff --git a/xml/doc/glIntro.xml b/xml/doc/glIntro.xml index e3281d9..f2307bd 100644 --- a/xml/doc/glIntro.xml +++ b/xml/doc/glIntro.xml @@ -58,7 +58,7 @@ Function names and tokens for OpenGL ES extensions are suffixed with OES - or with a vendor-specfic acronym. OES is used for extensions that have + or with a vendor-specific acronym. OES is used for extensions that have been reviewed by the Khronos Group and might be supported by more than one OpenGL ES vendor. diff --git a/xml/doc/glLinkProgram.xml b/xml/doc/glLinkProgram.xml index bbd3eea..6f1c8c7 100644 --- a/xml/doc/glLinkProgram.xml +++ b/xml/doc/glLinkProgram.xml @@ -100,7 +100,7 @@ A varying variable actually used in the fragment shader is not declared in the same way (or is not - declared at all) in the vertex shader, or geometry shader shader if present. + declared at all) in the vertex shader, or geometry shader if present. A reference to a function or variable name is diff --git a/xml/doc/glMapBufferRange.xml b/xml/doc/glMapBufferRange.xml index 6d0c2b6..86a4aa8 100644 --- a/xml/doc/glMapBufferRange.xml +++ b/xml/doc/glMapBufferRange.xml @@ -29,7 +29,7 @@ void *glMapNamedBufferRange GLuint buffer GLintptr offset - GLsizei length + GLsizeiptr length GLbitfield access diff --git a/xml/doc/glMatrixIndexPointer.xml b/xml/doc/glMatrixIndexPointer.xml index 2d5b5e1..b24546d 100644 --- a/xml/doc/glMatrixIndexPointer.xml +++ b/xml/doc/glMatrixIndexPointer.xml @@ -168,7 +168,7 @@ GL_INVALID_ENUM is generated if - type is is not an accepted value. + type is not an accepted value. diff --git a/xml/doc/glMinSampleShading.xml b/xml/doc/glMinSampleShading.xml index 9f0490e..d374c0f 100644 --- a/xml/doc/glMinSampleShading.xml +++ b/xml/doc/glMinSampleShading.xml @@ -50,7 +50,7 @@ A value of 1.0 indicates that each sample in the framebuffer should be - indpendently shaded. A value of 0.0 effectively allows the GL to ignore + independently shaded. A value of 0.0 effectively allows the GL to ignore sample rate shading. Any value between 0.0 and 1.0 allows the GL to shade only a subset of the total samples within each covered fragment. Which samples are shaded and the algorithm used to select that subset of the fragment's samples is implementation dependent. diff --git a/xml/doc/glMultiDrawArraysIndirect.xml b/xml/doc/glMultiDrawArraysIndirect.xml index 8deb393..3b0c079 100644 --- a/xml/doc/glMultiDrawArraysIndirect.xml +++ b/xml/doc/glMultiDrawArraysIndirect.xml @@ -64,7 +64,7 @@ drawcount - Specifies the the number of elements in the array of draw parameter structures. + Specifies the number of elements in the array of draw parameter structures. diff --git a/xml/doc/glObjectPtrLabel.xml b/xml/doc/glObjectPtrLabel.xml index 819eff7..eaabd41 100644 --- a/xml/doc/glObjectPtrLabel.xml +++ b/xml/doc/glObjectPtrLabel.xml @@ -15,7 +15,7 @@ glObjectPtrLabel - label a a sync object identified by a pointer + label a sync object identified by a pointer C Specification diff --git a/xml/doc/glPixelStore.xml b/xml/doc/glPixelStore.xml index 078dce9..ccc65c1 100644 --- a/xml/doc/glPixelStore.xml +++ b/xml/doc/glPixelStore.xml @@ -1333,7 +1333,7 @@ then if param is 0, the parameter is false; otherwise it is set to true. - If pname is a integer type parameter, + If pname is an integer type parameter, param is rounded to the nearest integer. diff --git a/xml/doc/glPointSizePointerOES.xml b/xml/doc/glPointSizePointerOES.xml index 83ed096..e4d119b 100644 --- a/xml/doc/glPointSizePointerOES.xml +++ b/xml/doc/glPointSizePointerOES.xml @@ -159,7 +159,7 @@ GL_INVALID_ENUM is generated if - type is is not an accepted value. + type is not an accepted value. diff --git a/xml/doc/glPrimitiveBoundingBox.xml b/xml/doc/glPrimitiveBoundingBox.xml index 599ddcc..49ab043 100644 --- a/xml/doc/glPrimitiveBoundingBox.xml +++ b/xml/doc/glPrimitiveBoundingBox.xml @@ -108,7 +108,7 @@ for each vertex. The viewport transform is then applied to each vertex to produce a three-dimensional bounding volume in window coordinates. The window space bounding volume is expanded in the X and Y dimensions to - accomodate the rasterization rules for the primitive type, and to fall on + accommodate the rasterization rules for the primitive type, and to fall on fragment boundaries. diff --git a/xml/doc/glSamplerParameter.xml b/xml/doc/glSamplerParameter.xml index f97f874..902fee6 100644 --- a/xml/doc/glSamplerParameter.xml +++ b/xml/doc/glSamplerParameter.xml @@ -600,8 +600,8 @@ represents the fractional part of s. - GL_MIRROR_CLAMP_TO_EDGE causes the the s - coordinate to be repeated as for GL_MIRRORED_REPEAT for one reptition of the texture, + GL_MIRROR_CLAMP_TO_EDGE causes the s + coordinate to be repeated as for GL_MIRRORED_REPEAT for one repetition of the texture, at which point the coordinate to be clamped as in GL_CLAMP_TO_EDGE. Initially, GL_TEXTURE_WRAP_S is set to GL_REPEAT. diff --git a/xml/doc/glTexBuffer.xml b/xml/doc/glTexBuffer.xml index 8a4454d..021a7db 100644 --- a/xml/doc/glTexBuffer.xml +++ b/xml/doc/glTexBuffer.xml @@ -21,7 +21,7 @@ void glTexBuffer GLenum target - GLenum internalFormat + GLenum internalformat GLuint buffer @@ -54,7 +54,7 @@ - internalFormat + internalformat Specifies the internal format of the data in the store @@ -78,7 +78,7 @@ glTexBuffer and glTextureBuffer attaches the data store of a specified buffer object to a specified texture object, and - specify the storage format for the texture image found found in + specify the storage format for the texture image found in the buffer object. The texture object must be a buffer texture. diff --git a/xml/doc/glTexBufferRange.xml b/xml/doc/glTexBufferRange.xml index e5b5f88..5fb4043 100644 --- a/xml/doc/glTexBufferRange.xml +++ b/xml/doc/glTexBufferRange.xml @@ -21,7 +21,7 @@ void glTexBufferRange GLenum target - GLenum internalFormat + GLenum internalformat GLuint buffer GLintptr offset GLsizeiptr size @@ -58,7 +58,7 @@ - internalFormat + internalformat Specifies the internal format of the data in the store @@ -101,7 +101,7 @@ glTextureBufferRange attach a range of the data store of a specified buffer object to a specified texture object, and specify the storage format for the texture image - found found in the buffer object. The texture object must be a + found in the buffer object. The texture object must be a buffer texture. diff --git a/xml/doc/glTexEnv.xml b/xml/doc/glTexEnv.xml index ac61d73..78632f6 100644 --- a/xml/doc/glTexEnv.xml +++ b/xml/doc/glTexEnv.xml @@ -2491,7 +2491,7 @@ - The RGB and alpha results of the texture function are multipled by the + The RGB and alpha results of the texture function are multiplied by the values of GL_RGB_SCALE and GL_ALPHA_SCALE, respectively, and clamped to the range diff --git a/xml/doc/glTexImage1D.xml b/xml/doc/glTexImage1D.xml index e10d43e..293604e 100644 --- a/xml/doc/glTexImage1D.xml +++ b/xml/doc/glTexImage1D.xml @@ -23,7 +23,7 @@ void glTexImage1D GLenum target GLint level - GLint internalFormat + GLint internalformat GLsizei width GLint border GLenum format @@ -54,7 +54,7 @@ - internalFormat + internalformat Specifies the number of color components in the texture. @@ -118,6 +118,7 @@ GL_SHORT, GL_UNSIGNED_INT, GL_INT, + GL_HALF_FLOAT, GL_FLOAT, GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, @@ -262,41 +263,41 @@ If an application wants to store the texture at a certain resolution or in a certain format, it can request the resolution - and format with internalFormat. The GL will choose an internal - representation that closely approximates that requested by internalFormat, but + and format with internalformat. The GL will choose an internal + representation that closely approximates that requested by internalformat, but it may not match exactly. (The representations specified by GL_RED, GL_RG, GL_RGB and GL_RGBA must match exactly.) - internalFormat may be one of the base internal formats shown in + internalformat may be one of the base internal formats shown in Table 1, below - internalFormat may also be one of the sized internal formats + internalformat may also be one of the sized internal formats shown in Table 2, below - Finally, internalFormat may also be one of the generic or compressed - compressed texture formats shown in Table 3 below + Finally, internalformat may also be one of the generic or compressed + texture formats shown in Table 3 below - If the internalFormat parameter is one of the generic compressed formats, + If the internalformat parameter is one of the generic compressed formats, GL_COMPRESSED_RED, GL_COMPRESSED_RG, GL_COMPRESSED_RGB, or GL_COMPRESSED_RGBA, the GL will replace the internal format with the symbolic constant for a specific internal format and compress the texture before storage. If no corresponding internal format is available, or the GL can not compress that image for any reason, the internal format is instead replaced with a corresponding base internal format. - If the internalFormat parameter is + If the internalformat parameter is GL_SRGB, GL_SRGB8, GL_SRGB_ALPHAor @@ -471,7 +472,7 @@ where max is the returned value of GL_MAX_TEXTURE_SIZE. - GL_INVALID_VALUE is generated if internalFormat is not + GL_INVALID_VALUE is generated if internalformat is not one of the accepted resolution and format symbolic constants. @@ -503,12 +504,12 @@ GL_INVALID_OPERATION is generated if format is - GL_DEPTH_COMPONENT and internalFormat is not + GL_DEPTH_COMPONENT and internalformat is not GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, or GL_DEPTH_COMPONENT32. - GL_INVALID_OPERATION is generated if internalFormat is + GL_INVALID_OPERATION is generated if internalformat is GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, or GL_DEPTH_COMPONENT32, and format is not GL_DEPTH_COMPONENT. @@ -545,6 +546,10 @@ glTexImage1D + + GL_HALF_FLOAT + + diff --git a/xml/doc/glTexImage2D.xml b/xml/doc/glTexImage2D.xml index 912caa9..301b692 100644 --- a/xml/doc/glTexImage2D.xml +++ b/xml/doc/glTexImage2D.xml @@ -23,7 +23,7 @@ void glTexImage2D GLenum target GLint level - GLint internalFormat + GLint internalformat GLsizei width GLsizei height GLint border @@ -66,7 +66,7 @@ - internalFormat + internalformat Specifies the number of color components in the texture. @@ -142,6 +142,7 @@ GL_SHORT, GL_UNSIGNED_INT, GL_INT, + GL_HALF_FLOAT, GL_FLOAT, GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, @@ -292,42 +293,42 @@ If an application wants to store the texture at a certain resolution or in a certain format, it can request the resolution - and format with internalFormat. The GL will choose an internal - representation that closely approximates that requested by internalFormat, but + and format with internalformat. The GL will choose an internal + representation that closely approximates that requested by internalformat, but it may not match exactly. (The representations specified by GL_RED, GL_RG, GL_RGB, and GL_RGBA must match exactly.) - internalFormat may be one of the base internal formats shown in + internalformat may be one of the base internal formats shown in Table 1, below - internalFormat may also be one of the sized internal formats + internalformat may also be one of the sized internal formats shown in Table 2, below - Finally, internalFormat may also be one of the generic or compressed - compressed texture formats shown in Table 3 below + Finally, internalformat may also be one of the generic or compressed + texture formats shown in Table 3 below - If the internalFormat parameter is one of the generic compressed formats, + If the internalformat parameter is one of the generic compressed formats, GL_COMPRESSED_RED, GL_COMPRESSED_RG, GL_COMPRESSED_RGB, or GL_COMPRESSED_RGBA, the GL will replace the internal format with the symbolic constant for a specific internal format and compress the texture before storage. If no corresponding internal format is available, or the GL can not compress that image for any reason, the internal format is instead replaced with a corresponding base internal format. - If the internalFormat parameter is + If the internalformat parameter is GL_SRGB, GL_SRGB8, GL_SRGB_ALPHA, or @@ -529,7 +530,7 @@ where max is the returned value of GL_MAX_TEXTURE_SIZE. - GL_INVALID_VALUE is generated if internalFormat is not one of the + GL_INVALID_VALUE is generated if internalformat is not one of the accepted resolution and format symbolic constants. @@ -565,18 +566,18 @@ GL_INVALID_OPERATION is generated if target is not GL_TEXTURE_2D, GL_PROXY_TEXTURE_2D, GL_TEXTURE_RECTANGLE, or GL_PROXY_TEXTURE_RECTANGLE, - and internalFormat is + and internalformat is GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, or GL_DEPTH_COMPONENT32F. GL_INVALID_OPERATION is generated if format is - GL_DEPTH_COMPONENT and internalFormat is not + GL_DEPTH_COMPONENT and internalformat is not GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, or GL_DEPTH_COMPONENT32F. - GL_INVALID_OPERATION is generated if internalFormat is + GL_INVALID_OPERATION is generated if internalformat is GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, or GL_DEPTH_COMPONENT32F, and format is not GL_DEPTH_COMPONENT. @@ -617,6 +618,10 @@ glTexImage2D + + GL_HALF_FLOAT + + diff --git a/xml/doc/glTexImage3D.xml b/xml/doc/glTexImage3D.xml index 73bda4f..68c400f 100644 --- a/xml/doc/glTexImage3D.xml +++ b/xml/doc/glTexImage3D.xml @@ -23,7 +23,7 @@ void glTexImage3D GLenum target GLint level - GLint internalFormat + GLint internalformat GLsizei width GLsizei height GLsizei depth @@ -66,7 +66,7 @@ - internalFormat + internalformat Specifies the number of color components in the texture. @@ -150,6 +150,7 @@ GL_SHORT, GL_UNSIGNED_INT, GL_INT, + GL_HALF_FLOAT, GL_FLOAT, GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, @@ -289,41 +290,41 @@ If an application wants to store the texture at a certain resolution or in a certain format, it can request the resolution - and format with internalFormat. The GL will choose an internal - representation that closely approximates that requested by internalFormat, but + and format with internalformat. The GL will choose an internal + representation that closely approximates that requested by internalformat, but it may not match exactly. (The representations specified by GL_RED, GL_RG, GL_RGB, and GL_RGBA must match exactly.) - internalFormat may be one of the base internal formats shown in + internalformat may be one of the base internal formats shown in Table 1, below - internalFormat may also be one of the sized internal formats + internalformat may also be one of the sized internal formats shown in Table 2, below - Finally, internalFormat may also be one of the generic or compressed - compressed texture formats shown in Table 3 below + Finally, internalformat may also be one of the generic or compressed + texture formats shown in Table 3 below - If the internalFormat parameter is one of the generic compressed formats, + If the internalformat parameter is one of the generic compressed formats, GL_COMPRESSED_RED, GL_COMPRESSED_RG, GL_COMPRESSED_RGB, or GL_COMPRESSED_RGBA, the GL will replace the internal format with the symbolic constant for a specific internal format and compress the texture before storage. If no corresponding internal format is available, or the GL can not compress that image for any reason, the internal format is instead replaced with a corresponding base internal format. - If the internalFormat parameter is + If the internalformat parameter is GL_SRGB, GL_SRGB8, GL_SRGB_ALPHA, or @@ -498,7 +499,7 @@ where max is the returned value of GL_MAX_TEXTURE_SIZE. - GL_INVALID_VALUE is generated if internalFormat is not one of the + GL_INVALID_VALUE is generated if internalformat is not one of the accepted resolution and format symbolic constants. @@ -528,7 +529,7 @@ and format is neither GL_RGBA nor GL_BGRA. - GL_INVALID_OPERATION is generated if format or internalFormat is + GL_INVALID_OPERATION is generated if format or internalformat is GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, or GL_DEPTH_COMPONENT32. @@ -564,6 +565,10 @@ glTexImage3D + + GL_HALF_FLOAT + + diff --git a/xml/doc/glTexParameter.xml b/xml/doc/glTexParameter.xml index 639d2ff..95c938a 100644 --- a/xml/doc/glTexParameter.xml +++ b/xml/doc/glTexParameter.xml @@ -134,8 +134,7 @@ GLenum pname - const GLfloat - *paramtexture. + const GLfloat *params @@ -145,7 +144,7 @@ GLenum pname - const GLint *param + const GLint *params @@ -735,7 +734,7 @@ is the depth texture value sampled from the currently bound depth texture. result - is assigned to the the red channel. + is assigned to the red channel. @@ -1373,8 +1372,8 @@ represents the fractional part of s. - GL_MIRROR_CLAMP_TO_EDGE causes the the s - coordinate to be repeated as for GL_MIRRORED_REPEAT for one reptition of the texture, + GL_MIRROR_CLAMP_TO_EDGE causes the s + coordinate to be repeated as for GL_MIRRORED_REPEAT for one repetition of the texture, at which point the coordinate to be clamped as in GL_CLAMP_TO_EDGE. Initially, GL_TEXTURE_WRAP_S is set to GL_REPEAT. diff --git a/xml/doc/glTexStorage3D.xml b/xml/doc/glTexStorage3D.xml index ab75752..dae997e 100644 --- a/xml/doc/glTexStorage3D.xml +++ b/xml/doc/glTexStorage3D.xml @@ -114,7 +114,7 @@ Description glTexStorage3D and - glTextureStorage3D specify specify the + glTextureStorage3D specify the storage requirements for all levels of a three-dimensional, two-dimensional array or cube-map array texture simultaneously. Once a texture is specified with this command, the format and dimensions of all levels become immutable unless it is a proxy diff --git a/xml/doc/glTexSubImage3D.xml b/xml/doc/glTexSubImage3D.xml index 9ed241c..de49876 100644 --- a/xml/doc/glTexSubImage3D.xml +++ b/xml/doc/glTexSubImage3D.xml @@ -272,8 +272,9 @@ GL_INVALID_ENUM is generated if target or the effective target of texture is not - GL_TEXTURE_3D or - GL_TEXTURE_2D_ARRAY. + GL_TEXTURE_3D, + GL_TEXTURE_2D_ARRAY or + GL_TEXTURE_CUBE_MAP_ARRAY. GL_INVALID_OPERATION is generated by diff --git a/xml/doc/glTextureView.xml b/xml/doc/glTextureView.xml index 0423b01..f964de2 100644 --- a/xml/doc/glTextureView.xml +++ b/xml/doc/glTextureView.xml @@ -59,7 +59,7 @@ - internalFormat + internalformat Specifies the internal format for the newly created view. diff --git a/xml/doc/glTransformFeedbackVaryings.xml b/xml/doc/glTransformFeedbackVaryings.xml index 1d1a6ad..b69273e 100644 --- a/xml/doc/glTransformFeedbackVaryings.xml +++ b/xml/doc/glTransformFeedbackVaryings.xml @@ -21,10 +21,10 @@ void glTransformFeedbackVaryings - GLuintprogram - GLsizeicount + GLuint program + GLsizei count const char **varyings - GLenumbufferMode + GLenum bufferMode diff --git a/xml/doc/glViewportIndexed.xml b/xml/doc/glViewportIndexed.xml index 320a766..b36660f 100644 --- a/xml/doc/glViewportIndexed.xml +++ b/xml/doc/glViewportIndexed.xml @@ -57,14 +57,14 @@ - width - height + w + h For glViewportIndexedf, specifies the width and height of the viewport. When a GL context is first attached to a window, - width and height are set to the dimensions of that + w and h are set to the dimensions of that window. @@ -229,7 +229,7 @@ the value of GL_MAX_VIEWPORTS. - GL_INVALID_VALUE is generated if either width or height is negative. + GL_INVALID_VALUE is generated if either w or h is negative. Associated Gets diff --git a/xml/doc/glWeightPointer.xml b/xml/doc/glWeightPointer.xml index b2d2a4d..11ec0ef 100644 --- a/xml/doc/glWeightPointer.xml +++ b/xml/doc/glWeightPointer.xml @@ -171,7 +171,7 @@ GL_INVALID_ENUM is generated if - type is is not an accepted value. + type is not an accepted value. diff --git a/xml/doc/glXQueryDrawable.xml b/xml/doc/glXQueryDrawable.xml index d8a8cbd..9576a19 100644 --- a/xml/doc/glXQueryDrawable.xml +++ b/xml/doc/glXQueryDrawable.xml @@ -14,7 +14,7 @@ glXQueryDrawable - returns an attribute assoicated with a GLX drawable + returns an attribute associated with a GLX drawable C Specification @@ -119,7 +119,7 @@ fail to create a GLXPbuffer if the requested size is larger than the implementation maximum or available resources. If True - is returned, a GLXPbuffer of the maximum availble + is returned, a GLXPbuffer of the maximum available size (if less than the requested width and height) is created. diff --git a/xml/overload/gl.xml b/xml/overload/gl.xml new file mode 100644 index 0000000..34c7449 --- /dev/null +++ b/xml/overload/gl.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xml/spec/egl.xml b/xml/spec/egl.xml index e422e96..01b6c25 100644 --- a/xml/spec/egl.xml +++ b/xml/spec/egl.xml @@ -617,7 +617,9 @@ - + + + @@ -772,7 +774,8 @@ - + + @@ -801,7 +804,9 @@ - + + + @@ -887,6 +892,13 @@ + + + + + + + - - + + @@ -929,6 +941,12 @@ EGLint config_size EGLint *num_config + + EGLBoolean eglClientSignalSyncEXT + EGLDisplay dpy + EGLSync sync + const EGLAttrib *attrib_list + EGLint eglClientWaitSync EGLDisplay dpy @@ -1211,6 +1229,14 @@ EGLDisplay eglGetDisplay EGLNativeDisplayType display_id + + char *eglGetDisplayDriverConfig + EGLDisplay dpy + + + const char *eglGetDisplayDriverName + EGLDisplay dpy + EGLint eglGetError @@ -1646,6 +1672,11 @@ EGLStreamKHR stream const EGLAttrib *attrib_list + + EGLBoolean eglStreamFlushNV + EGLDisplay dpy + EGLStreamKHR stream + EGLBoolean eglSurfaceAttrib EGLDisplay dpy @@ -1700,6 +1731,12 @@ EGLDisplay dpy EGLSurface surface + + EGLBoolean eglUnsignalSyncEXT + EGLDisplay dpy + EGLSync sync + const EGLAttrib *attrib_list + EGLBoolean eglWaitClient @@ -2104,6 +2141,7 @@ + @@ -2146,6 +2184,13 @@ + + + + + + + @@ -2168,6 +2213,7 @@ + @@ -2220,6 +2266,11 @@ + + + + + @@ -2371,6 +2422,11 @@ + + + + + @@ -2807,6 +2863,12 @@ + + + + + + @@ -2881,6 +2943,11 @@ + + + + + @@ -2932,6 +2999,11 @@ + + + + + @@ -3033,6 +3105,11 @@ + + + + + diff --git a/xml/spec/gl.xml b/xml/spec/gl.xml index 87312fb..08153cd 100644 --- a/xml/spec/gl.xml +++ b/xml/spec/gl.xml @@ -1,7 +1,7 @@ -Copyright (c) 2013-2017 The Khronos Group Inc. +Copyright (c) 2013-2018 The Khronos Group Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,60 +27,22 @@ can always be found in the Khronos Registry at - #include <stddef.h> #include <KHR/khrplatform.h> - #ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glxext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GL_EXT_timer_query extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include <inttypes.h> -#elif defined(__sun__) || defined(__digital__) -#include <inttypes.h> -#if defined(__STDC__) -#if defined(__arch64__) || defined(_LP64) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include <inttypes.h> -#elif defined(__SCO__) || defined(__USLC__) -#include <stdint.h> -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include <stdint.h> -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -/* Fallback if nothing above works */ -#include <inttypes.h> -#endif -#endif typedef unsigned int GLenum; typedef unsigned char GLboolean; typedef unsigned int GLbitfield; typedef void GLvoid; - typedef signed char GLbyte; - typedef short GLshort; + typedef khronos_int8_t GLbyte; + typedef khronos_uint8_t GLubyte; + typedef khronos_int16_t GLshort; + typedef khronos_uint16_t GLushort; typedef int GLint; - typedef int GLclampx; - typedef unsigned char GLubyte; - typedef unsigned short GLushort; typedef unsigned int GLuint; + typedef khronos_int32_t GLclampx; typedef int GLsizei; - typedef float GLfloat; - typedef float GLclampf; + typedef khronos_float_t GLfloat; + typedef khronos_float_t GLclampf; typedef double GLdouble; typedef double GLclampd; typedef void *GLeglClientBufferEXT; @@ -92,53 +54,24 @@ typedef void *GLhandleARB; #else typedef unsigned int GLhandleARB; #endif - typedef unsigned short GLhalfARB; - typedef unsigned short GLhalf; - typedef GLint GLfixed; - typedef ptrdiff_t GLintptr; - typedef ptrdiff_t GLsizeiptr; - typedef int64_t GLint64; - typedef uint64_t GLuint64; - typedef ptrdiff_t GLintptrARB; - typedef ptrdiff_t GLsizeiptrARB; - typedef int64_t GLint64EXT; - typedef uint64_t GLuint64EXT; + typedef khronos_uint16_t GLhalf; + typedef khronos_uint16_t GLhalfARB; + typedef khronos_int32_t GLfixed; + typedef khronos_intptr_t GLintptr; + typedef khronos_intptr_t GLintptrARB; + typedef khronos_ssize_t GLsizeiptr; + typedef khronos_ssize_t GLsizeiptrARB; + typedef khronos_int64_t GLint64; + typedef khronos_int64_t GLint64EXT; + typedef khronos_uint64_t GLuint64; + typedef khronos_uint64_t GLuint64EXT; typedef struct __GLsync *GLsync; struct _cl_context; struct _cl_event; typedef void ( *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); typedef void ( *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); typedef void ( *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); - - typedef khronos_int32_t GLclampx; - - typedef khronos_int8_t GLbyte; - typedef khronos_uint8_t GLubyte; - typedef khronos_float_t GLfloat; - typedef khronos_float_t GLclampf; - typedef khronos_int32_t GLfixed; - typedef khronos_int64_t GLint64; - typedef khronos_uint64_t GLuint64; - typedef khronos_intptr_t GLintptr; - typedef khronos_ssize_t GLsizeiptr; - - typedef khronos_int8_t GLbyte; - typedef khronos_uint8_t GLubyte; - typedef khronos_float_t GLfloat; - typedef khronos_float_t GLclampf; - typedef khronos_int32_t GLfixed; - typedef khronos_int64_t GLint64; - typedef khronos_uint64_t GLuint64; - typedef khronos_int64_t GLint64EXT; - typedef khronos_uint64_t GLuint64EXT; - typedef khronos_intptr_t GLintptr; - typedef khronos_ssize_t GLsizeiptr; - - - typedef khronos_uint8_t GLubyte; - typedef khronos_float_t GLfloat; - typedef khronos_intptr_t GLintptr; - typedef khronos_ssize_t GLsizeiptr; + typedef void ( *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); typedef unsigned short GLhalfNV; @@ -199,15 +132,16 @@ typedef unsigned int GLhandleARB; + + + - + + - - - @@ -265,6 +199,7 @@ typedef unsigned int GLhandleARB; + @@ -285,23 +220,22 @@ typedef unsigned int GLhandleARB; - + + + + + - - - - - - - - + + + @@ -473,6 +407,7 @@ typedef unsigned int GLhandleARB; + @@ -486,6 +421,9 @@ typedef unsigned int GLhandleARB; + + + @@ -501,6 +439,7 @@ typedef unsigned int GLhandleARB; + @@ -537,6 +476,7 @@ typedef unsigned int GLhandleARB; + @@ -550,11 +490,20 @@ typedef unsigned int GLhandleARB; + + + + + + + + + @@ -566,6 +515,7 @@ typedef unsigned int GLhandleARB; + @@ -778,6 +728,7 @@ typedef unsigned int GLhandleARB; + @@ -789,6 +740,7 @@ typedef unsigned int GLhandleARB; + @@ -798,10 +750,17 @@ typedef unsigned int GLhandleARB; + + + + + + + @@ -827,6 +786,8 @@ typedef unsigned int GLhandleARB; + + @@ -835,6 +796,7 @@ typedef unsigned int GLhandleARB; + @@ -842,6 +804,7 @@ typedef unsigned int GLhandleARB; + @@ -855,16 +818,19 @@ typedef unsigned int GLhandleARB; + + + @@ -887,6 +853,7 @@ typedef unsigned int GLhandleARB; + @@ -895,6 +862,8 @@ typedef unsigned int GLhandleARB; + + @@ -909,6 +878,7 @@ typedef unsigned int GLhandleARB; + @@ -936,6 +906,7 @@ typedef unsigned int GLhandleARB; + @@ -961,9 +932,11 @@ typedef unsigned int GLhandleARB; + + @@ -975,20 +948,98 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1000,14 +1051,20 @@ typedef unsigned int GLhandleARB; + + + + + + @@ -1025,6 +1082,7 @@ typedef unsigned int GLhandleARB; + @@ -1036,6 +1094,8 @@ typedef unsigned int GLhandleARB; + + @@ -1074,23 +1134,35 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + + + @@ -1099,6 +1171,11 @@ typedef unsigned int GLhandleARB; + + + + + @@ -1109,6 +1186,13 @@ typedef unsigned int GLhandleARB; + + + + + + + @@ -1128,9 +1212,18 @@ typedef unsigned int GLhandleARB; + + + + + + + + + @@ -1142,13 +1235,23 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + @@ -1156,13 +1259,20 @@ typedef unsigned int GLhandleARB; + + + + + + + @@ -1435,11 +1545,7 @@ typedef unsigned int GLhandleARB; - - - - - + @@ -1456,9 +1562,6 @@ typedef unsigned int GLhandleARB; - - - @@ -1588,18 +1691,30 @@ typedef unsigned int GLhandleARB; + + + + + + + + + + + + @@ -2126,7 +2241,9 @@ typedef unsigned int GLhandleARB; + + @@ -2386,6 +2503,8 @@ typedef unsigned int GLhandleARB; + + @@ -2467,6 +2586,7 @@ typedef unsigned int GLhandleARB; + @@ -2573,6 +2693,10 @@ typedef unsigned int GLhandleARB; + + + + @@ -2766,6 +2890,7 @@ typedef unsigned int GLhandleARB; + @@ -3419,8 +3544,17 @@ typedef unsigned int GLhandleARB; - - + + + + + + + + + + + @@ -3450,7 +3584,7 @@ typedef unsigned int GLhandleARB; - + @@ -3467,15 +3601,6 @@ typedef unsigned int GLhandleARB; - - - - - - - - - @@ -3540,6 +3665,8 @@ typedef unsigned int GLhandleARB; + + @@ -3675,6 +3802,7 @@ typedef unsigned int GLhandleARB; + @@ -6493,6 +6621,7 @@ typedef unsigned int GLhandleARB; + @@ -7833,6 +7962,7 @@ typedef unsigned int GLhandleARB; + @@ -8653,7 +8783,22 @@ typedef unsigned int GLhandleARB; - + + + + + + + + + + + + + + + + @@ -8902,7 +9047,8 @@ typedef unsigned int GLhandleARB; - + + @@ -9461,7 +9607,13 @@ typedef unsigned int GLhandleARB; - + + + + + + + @@ -9665,7 +9817,7 @@ typedef unsigned int GLhandleARB; - + @@ -9828,7 +9980,7 @@ typedef unsigned int GLhandleARB; - + @@ -9837,7 +9989,36 @@ typedef unsigned int GLhandleARB; - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -9967,11 +10148,21 @@ typedef unsigned int GLhandleARB; - + + + + + + + + + + + - + @@ -9989,9 +10180,39 @@ typedef unsigned int GLhandleARB; - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -10020,7 +10241,28 @@ typedef unsigned int GLhandleARB; - + + + + + + + + + + + + + + + + + + + + + + @@ -10051,7 +10293,8 @@ typedef unsigned int GLhandleARB; - + +