Define the rest of the khrplatform.h types, and prevent its inclusion.

One of the problems with krhplatform.h (besides it being a terrible
idea in the first place) is that it's not present on many systems at
all, including apple, win32, and linux before late 2009.

So, unless we introduce the first ./configure dependency to the core
library build, we really do need to define these standard types to
their standard values.  But if we allow khrplatform.h inclusion as
well, we'll get long-vs-int redefinition warnings on 32-bit.  So, we
have to completely replicate the header, which is a thing we've done
for everything else except for eglplatform.h.

A testcase will be used to make sure that our types don't drift from
the system khrplatform.h types, if it even exists.

Fixes #17
macos/v1.5.9
Eric Anholt 11 years ago
parent 79600fa6d2
commit c996534080
  1. 16
      src/gen_dispatch.py

@ -486,8 +486,12 @@ class Generator(object):
if self.target == "egl":
self.outln('#include "EGL/eglplatform.h"')
else:
# Add some ridiculous inttypes.h redefinitions that are from
# khrplatform.h and not included in the XML.
# Add some ridiculous inttypes.h redefinitions that are
# from khrplatform.h and not included in the XML. We
# don't directly include khrplatform.h because it's not
# present on many systems, and coming up with #ifdefs to
# decide when it's not present would be hard.
self.outln('#define __khrplatform_h_ 1')
self.outln('typedef int8_t khronos_int8_t;')
self.outln('typedef int16_t khronos_int16_t;')
self.outln('typedef int32_t khronos_int32_t;')
@ -499,8 +503,16 @@ class Generator(object):
self.outln('typedef float khronos_float_t;')
self.outln('typedef intptr_t khronos_intptr_t;')
self.outln('typedef ptrdiff_t khronos_ssize_t;')
self.outln('typedef unsigned long khronos_usize_t;')
self.outln('typedef uint64_t khronos_utime_nanoseconds_t;')
self.outln('typedef int64_t khronos_stime_nanoseconds_t;')
self.outln('#define KHRONOS_MAX_ENUM 0x7FFFFFFF')
self.outln('typedef enum {')
self.outln(' KHRONOS_FALSE = 0,')
self.outln(' KHRONOS_TRUE = 1,')
self.outln(' KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM')
self.outln('} khronos_boolean_enum_t;')
self.outln('typedef uintptr_t khronos_uintptr_t;')
if self.target == "glx":
self.outln('#include <X11/Xlib.h>')

Loading…
Cancel
Save