From 29942bf078c92fea681e42ca5029592526f00718 Mon Sep 17 00:00:00 2001 From: "Andrew Gallant (Ocelot)" Date: Fri, 11 May 2012 23:58:52 -0400 Subject: panic when an extension request is issued before an extension has been initialized. but give a nice error message for the happy people. --- nexgb/dri2/dri2.go | 96 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 87 insertions(+), 9 deletions(-) (limited to 'nexgb/dri2') diff --git a/nexgb/dri2/dri2.go b/nexgb/dri2/dri2.go index deffdb6..7a10897 100644 --- a/nexgb/dri2/dri2.go +++ b/nexgb/dri2/dri2.go @@ -2,7 +2,7 @@ package dri2 /* - This file was generated by dri2.xml on May 11 2012 1:58:35am EDT. + This file was generated by dri2.xml on May 11 2012 11:57:19pm EDT. This file is automatically generated. Edit at your peril! */ @@ -40,14 +40,6 @@ func init() { xgb.NewExtErrorFuncs["DRI2"] = make(map[int]xgb.NewErrorFun) } -// Skipping definition for base type 'Char' - -// Skipping definition for base type 'Card32' - -// Skipping definition for base type 'Double' - -// Skipping definition for base type 'Bool' - // Skipping definition for base type 'Float' // Skipping definition for base type 'Card8' @@ -64,6 +56,14 @@ func init() { // Skipping definition for base type 'Card16' +// Skipping definition for base type 'Char' + +// Skipping definition for base type 'Card32' + +// Skipping definition for base type 'Double' + +// Skipping definition for base type 'Bool' + const ( AttachmentBufferFrontLeft = 0 AttachmentBufferBackLeft = 1 @@ -405,6 +405,9 @@ type QueryVersionCookie struct { // QueryVersion sends a checked request. // If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply() func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie) return QueryVersionCookie{cookie} @@ -413,6 +416,9 @@ func QueryVersion(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVe // QueryVersionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func QueryVersionUnchecked(c *xgb.Conn, MajorVersion uint32, MinorVersion uint32) QueryVersionCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(queryVersionRequest(c, MajorVersion, MinorVersion), cookie) return QueryVersionCookie{cookie} @@ -494,6 +500,9 @@ type ConnectCookie struct { // Connect sends a checked request. // If an error occurs, it will be returned with the reply by calling ConnectCookie.Reply() func Connect(c *xgb.Conn, Window xproto.Window, DriverType uint32) ConnectCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'Connect' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(connectRequest(c, Window, DriverType), cookie) return ConnectCookie{cookie} @@ -502,6 +511,9 @@ func Connect(c *xgb.Conn, Window xproto.Window, DriverType uint32) ConnectCookie // ConnectUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func ConnectUnchecked(c *xgb.Conn, Window xproto.Window, DriverType uint32) ConnectCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'Connect' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(connectRequest(c, Window, DriverType), cookie) return ConnectCookie{cookie} @@ -607,6 +619,9 @@ type AuthenticateCookie struct { // Authenticate sends a checked request. // If an error occurs, it will be returned with the reply by calling AuthenticateCookie.Reply() func Authenticate(c *xgb.Conn, Window xproto.Window, Magic uint32) AuthenticateCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'Authenticate' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(authenticateRequest(c, Window, Magic), cookie) return AuthenticateCookie{cookie} @@ -615,6 +630,9 @@ func Authenticate(c *xgb.Conn, Window xproto.Window, Magic uint32) AuthenticateC // AuthenticateUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func AuthenticateUnchecked(c *xgb.Conn, Window xproto.Window, Magic uint32) AuthenticateCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'Authenticate' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(authenticateRequest(c, Window, Magic), cookie) return AuthenticateCookie{cookie} @@ -692,6 +710,9 @@ type CreateDrawableCookie struct { // CreateDrawable sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CreateDrawable(c *xgb.Conn, Drawable xproto.Drawable) CreateDrawableCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'CreateDrawable' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(createDrawableRequest(c, Drawable), cookie) return CreateDrawableCookie{cookie} @@ -700,6 +721,9 @@ func CreateDrawable(c *xgb.Conn, Drawable xproto.Drawable) CreateDrawableCookie // CreateDrawableChecked sends a checked request. // If an error occurs, it can be retrieved using CreateDrawableCookie.Check() func CreateDrawableChecked(c *xgb.Conn, Drawable xproto.Drawable) CreateDrawableCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'CreateDrawable' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(createDrawableRequest(c, Drawable), cookie) return CreateDrawableCookie{cookie} @@ -741,6 +765,9 @@ type DestroyDrawableCookie struct { // DestroyDrawable sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func DestroyDrawable(c *xgb.Conn, Drawable xproto.Drawable) DestroyDrawableCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'DestroyDrawable' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(destroyDrawableRequest(c, Drawable), cookie) return DestroyDrawableCookie{cookie} @@ -749,6 +776,9 @@ func DestroyDrawable(c *xgb.Conn, Drawable xproto.Drawable) DestroyDrawableCooki // DestroyDrawableChecked sends a checked request. // If an error occurs, it can be retrieved using DestroyDrawableCookie.Check() func DestroyDrawableChecked(c *xgb.Conn, Drawable xproto.Drawable) DestroyDrawableCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'DestroyDrawable' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(destroyDrawableRequest(c, Drawable), cookie) return DestroyDrawableCookie{cookie} @@ -790,6 +820,9 @@ type GetBuffersCookie struct { // GetBuffers sends a checked request. // If an error occurs, it will be returned with the reply by calling GetBuffersCookie.Reply() func GetBuffers(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments []uint32) GetBuffersCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'GetBuffers' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getBuffersRequest(c, Drawable, Count, Attachments), cookie) return GetBuffersCookie{cookie} @@ -798,6 +831,9 @@ func GetBuffers(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments // GetBuffersUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetBuffersUnchecked(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments []uint32) GetBuffersCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'GetBuffers' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getBuffersRequest(c, Drawable, Count, Attachments), cookie) return GetBuffersCookie{cookie} @@ -896,6 +932,9 @@ type CopyRegionCookie struct { // CopyRegion sends a checked request. // If an error occurs, it will be returned with the reply by calling CopyRegionCookie.Reply() func CopyRegion(c *xgb.Conn, Drawable xproto.Drawable, Region uint32, Dest uint32, Src uint32) CopyRegionCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'CopyRegion' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(copyRegionRequest(c, Drawable, Region, Dest, Src), cookie) return CopyRegionCookie{cookie} @@ -904,6 +943,9 @@ func CopyRegion(c *xgb.Conn, Drawable xproto.Drawable, Region uint32, Dest uint3 // CopyRegionUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func CopyRegionUnchecked(c *xgb.Conn, Drawable xproto.Drawable, Region uint32, Dest uint32, Src uint32) CopyRegionCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'CopyRegion' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(copyRegionRequest(c, Drawable, Region, Dest, Src), cookie) return CopyRegionCookie{cookie} @@ -983,6 +1025,9 @@ type GetBuffersWithFormatCookie struct { // GetBuffersWithFormat sends a checked request. // If an error occurs, it will be returned with the reply by calling GetBuffersWithFormatCookie.Reply() func GetBuffersWithFormat(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments []AttachFormat) GetBuffersWithFormatCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'GetBuffersWithFormat' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getBuffersWithFormatRequest(c, Drawable, Count, Attachments), cookie) return GetBuffersWithFormatCookie{cookie} @@ -991,6 +1036,9 @@ func GetBuffersWithFormat(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, A // GetBuffersWithFormatUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetBuffersWithFormatUnchecked(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments []AttachFormat) GetBuffersWithFormatCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'GetBuffersWithFormat' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getBuffersWithFormatRequest(c, Drawable, Count, Attachments), cookie) return GetBuffersWithFormatCookie{cookie} @@ -1085,6 +1133,9 @@ type SwapBuffersCookie struct { // SwapBuffers sends a checked request. // If an error occurs, it will be returned with the reply by calling SwapBuffersCookie.Reply() func SwapBuffers(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) SwapBuffersCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'SwapBuffers' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(swapBuffersRequest(c, Drawable, TargetMscHi, TargetMscLo, DivisorHi, DivisorLo, RemainderHi, RemainderLo), cookie) return SwapBuffersCookie{cookie} @@ -1093,6 +1144,9 @@ func SwapBuffers(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, Targ // SwapBuffersUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SwapBuffersUnchecked(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) SwapBuffersCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'SwapBuffers' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(swapBuffersRequest(c, Drawable, TargetMscHi, TargetMscLo, DivisorHi, DivisorLo, RemainderHi, RemainderLo), cookie) return SwapBuffersCookie{cookie} @@ -1189,6 +1243,9 @@ type GetMSCCookie struct { // GetMSC sends a checked request. // If an error occurs, it will be returned with the reply by calling GetMSCCookie.Reply() func GetMSC(c *xgb.Conn, Drawable xproto.Drawable) GetMSCCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'GetMSC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(getMSCRequest(c, Drawable), cookie) return GetMSCCookie{cookie} @@ -1197,6 +1254,9 @@ func GetMSC(c *xgb.Conn, Drawable xproto.Drawable) GetMSCCookie { // GetMSCUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func GetMSCUnchecked(c *xgb.Conn, Drawable xproto.Drawable) GetMSCCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'GetMSC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(getMSCRequest(c, Drawable), cookie) return GetMSCCookie{cookie} @@ -1291,6 +1351,9 @@ type WaitMSCCookie struct { // WaitMSC sends a checked request. // If an error occurs, it will be returned with the reply by calling WaitMSCCookie.Reply() func WaitMSC(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) WaitMSCCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'WaitMSC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(waitMSCRequest(c, Drawable, TargetMscHi, TargetMscLo, DivisorHi, DivisorLo, RemainderHi, RemainderLo), cookie) return WaitMSCCookie{cookie} @@ -1299,6 +1362,9 @@ func WaitMSC(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, TargetMs // WaitMSCUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func WaitMSCUnchecked(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) WaitMSCCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'WaitMSC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(waitMSCRequest(c, Drawable, TargetMscHi, TargetMscLo, DivisorHi, DivisorLo, RemainderHi, RemainderLo), cookie) return WaitMSCCookie{cookie} @@ -1411,6 +1477,9 @@ type WaitSBCCookie struct { // WaitSBC sends a checked request. // If an error occurs, it will be returned with the reply by calling WaitSBCCookie.Reply() func WaitSBC(c *xgb.Conn, Drawable xproto.Drawable, TargetSbcHi uint32, TargetSbcLo uint32) WaitSBCCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'WaitSBC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, true) c.NewRequest(waitSBCRequest(c, Drawable, TargetSbcHi, TargetSbcLo), cookie) return WaitSBCCookie{cookie} @@ -1419,6 +1488,9 @@ func WaitSBC(c *xgb.Conn, Drawable xproto.Drawable, TargetSbcHi uint32, TargetSb // WaitSBCUnchecked sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func WaitSBCUnchecked(c *xgb.Conn, Drawable xproto.Drawable, TargetSbcHi uint32, TargetSbcLo uint32) WaitSBCCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'WaitSBC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, true) c.NewRequest(waitSBCRequest(c, Drawable, TargetSbcHi, TargetSbcLo), cookie) return WaitSBCCookie{cookie} @@ -1519,6 +1591,9 @@ type SwapIntervalCookie struct { // SwapInterval sends an unchecked request. // If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent. func SwapInterval(c *xgb.Conn, Drawable xproto.Drawable, Interval uint32) SwapIntervalCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'SwapInterval' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(false, false) c.NewRequest(swapIntervalRequest(c, Drawable, Interval), cookie) return SwapIntervalCookie{cookie} @@ -1527,6 +1602,9 @@ func SwapInterval(c *xgb.Conn, Drawable xproto.Drawable, Interval uint32) SwapIn // SwapIntervalChecked sends a checked request. // If an error occurs, it can be retrieved using SwapIntervalCookie.Check() func SwapIntervalChecked(c *xgb.Conn, Drawable xproto.Drawable, Interval uint32) SwapIntervalCookie { + if _, ok := c.Extensions["DRI2"]; !ok { + panic("Cannot issue request 'SwapInterval' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.") + } cookie := c.NewCookie(true, false) c.NewRequest(swapIntervalRequest(c, Drawable, Interval), cookie) return SwapIntervalCookie{cookie} -- cgit v1.2.3-70-g09d2