aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2014-12-27 14:14:50 +0800
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-02-04 17:58:02 -0700
commit6fb3caecc605008d2dbd3eb729ef34dedfeb094f (patch)
tree7062e19b4621ca81ab7a612cec987f60566c489b
parent9be0fb9abe725774aa0c25d5b0289e0834f7f943 (diff)
downloadusermoji-6fb3caecc605008d2dbd3eb729ef34dedfeb094f.tar.xz
include: fix typedefs
Use what was in the upstream header. The switch of XGL_SIZE to size_t generates quite some warnings and is fixed.
-rw-r--r--demos/xglinfo.c16
-rwxr-xr-xglave-generate.py6
-rw-r--r--icd/common/icd-format.c2
-rw-r--r--icd/common/icd-format.h2
-rw-r--r--include/xgl.h9
-rwxr-xr-xxgl-helper.py8
-rwxr-xr-xxgl-layer-generate.py6
7 files changed, 31 insertions, 18 deletions
diff --git a/demos/xglinfo.c b/demos/xglinfo.c
index 4bbd635c..84ae453f 100644
--- a/demos/xglinfo.c
+++ b/demos/xglinfo.c
@@ -431,10 +431,10 @@ static void app_dev_dump_heap_props(const struct app_dev *dev, XGL_UINT id)
const XGL_MEMORY_HEAP_PROPERTIES *props = &dev->heap_props[id];
printf("XGL_MEMORY_HEAP_PROPERTIES[%u]\n", id);
- printf("\tstructSize = %u\n", props->structSize);
+ printf("\tstructSize = %zu\n", props->structSize);
printf("\theapMemoryType = %s\n", xgl_heap_type_string(props->heapMemoryType));
- printf("\theapSize = %u\n", props->heapSize);
- printf("\tpagesSize = %u\n", props->pageSize);
+ printf("\theapSize = %zu\n", props->heapSize);
+ printf("\tpagesSize = %zu\n", props->pageSize);
printf("\tflags =%s%s%s%s%s%s\n",
(props->flags & XGL_MEMORY_HEAP_CPU_VISIBLE_BIT) ? " visible" : "",
@@ -511,7 +511,7 @@ static void app_gpu_dump_props(const struct app_gpu *gpu)
const XGL_PHYSICAL_GPU_PROPERTIES *props = &gpu->props;
printf("XGL_PHYSICAL_GPU_PROPERTIES\n");
- printf("\tstructSize = %u\n", props->structSize);
+ printf("\tstructSize = %zu\n", props->structSize);
printf("\tapiVersion = %u\n", props->apiVersion);
printf("\tdriverVersion = %u\n", props->driverVersion);
printf("\tvendorId = 0x%04x\n", props->vendorId);
@@ -519,8 +519,8 @@ static void app_gpu_dump_props(const struct app_gpu *gpu)
printf("\tgpuType = %s\n", xgl_gpu_type_string(props->gpuType));
printf("\tgpuName = %s\n", props->gpuName);
printf("\tmaxMemRefsPerSubmission = %u\n", props->maxMemRefsPerSubmission);
- printf("\tvirtualMemPageSize = %u\n", props->virtualMemPageSize);
- printf("\tmaxInlineMemoryUpdateSize = %u\n", props->maxInlineMemoryUpdateSize);
+ printf("\tvirtualMemPageSize = %zu\n", props->virtualMemPageSize);
+ printf("\tmaxInlineMemoryUpdateSize = %zu\n", props->maxInlineMemoryUpdateSize);
printf("\tmaxBoundDescriptorSets = %u\n", props->maxBoundDescriptorSets);
printf("\tmaxThreadGroupSize = %u\n", props->maxThreadGroupSize);
printf("\ttimestampFrequency = %lu\n", props->timestampFrequency);
@@ -558,7 +558,7 @@ static void app_gpu_dump_queue_props(const struct app_gpu *gpu, XGL_UINT id)
const XGL_PHYSICAL_GPU_QUEUE_PROPERTIES *props = &gpu->queue_props[id];
printf("XGL_PHYSICAL_GPU_QUEUE_PROPERTIES[%d]\n", id);
- printf("\tstructSize = %u\n", props->structSize);
+ printf("\tstructSize = %zu\n", props->structSize);
printf("\tqueueFlags = %c%c%c%c\n",
(props->queueFlags & XGL_QUEUE_GRAPHICS_BIT) ? 'G' : '.',
(props->queueFlags & XGL_QUEUE_COMPUTE_BIT) ? 'C' : '.',
@@ -574,7 +574,7 @@ static void app_gpu_dump_memory_props(const struct app_gpu *gpu)
const XGL_PHYSICAL_GPU_MEMORY_PROPERTIES *props = &gpu->memory_props;
printf("XGL_PHYSICAL_GPU_MEMORY_PROPERTIES\n");
- printf("\tstructSize = %u\n", props->structSize);
+ printf("\tstructSize = %zu\n", props->structSize);
printf("\tsupportsMigration = %u\n", props->supportsMigration);
printf("\tsupportsVirtualMemoryRemapping = %u\n", props->supportsVirtualMemoryRemapping);
printf("\tsupportsPinning = %u\n", props->supportsPinning);
diff --git a/glave-generate.py b/glave-generate.py
index 0de7021e..df418509 100755
--- a/glave-generate.py
+++ b/glave-generate.py
@@ -105,13 +105,17 @@ class Subcommand(object):
if '*' in xgl_type:
return ("%lu", "*%s" % name)
return ("%lu", name)
+ if "SIZE" in xgl_type:
+ if '*' in xgl_type:
+ return ("%zu", "*%s" % name)
+ return ("%zu", name)
if "FLOAT" in xgl_type:
if '[' in xgl_type: # handle array, current hard-coded to 4 (TODO: Make this dynamic)
return ("[%f, %f, %f, %f]", "%s[0], %s[1], %s[2], %s[3]" % (name, name, name, name))
return ("%f", name)
if "BOOL" in xgl_type or 'xcb_randr_crtc_t' in xgl_type:
return ("%u", name)
- if True in [t in xgl_type for t in ["INT", "SIZE", "FLAGS", "MASK", "xcb_window_t"]]:
+ if True in [t in xgl_type for t in ["INT", "FLAGS", "MASK", "xcb_window_t"]]:
if '[' in xgl_type: # handle array, current hard-coded to 4 (TODO: Make this dynamic)
return ("[%i, %i, %i, %i]", "%s[0], %s[1], %s[2], %s[3]" % (name, name, name, name))
if '*' in xgl_type:
diff --git a/icd/common/icd-format.c b/icd/common/icd-format.c
index 8aecb3eb..c56d70fc 100644
--- a/icd/common/icd-format.c
+++ b/icd/common/icd-format.c
@@ -66,7 +66,7 @@ static const struct icd_format_info {
[XGL_CH_FMT_BC7] = { 16, 4 },
};
-unsigned int icd_format_get_size(XGL_FORMAT format)
+size_t icd_format_get_size(XGL_FORMAT format)
{
return icd_format_table[format.channelFormat].size;
}
diff --git a/icd/common/icd-format.h b/icd/common/icd-format.h
index 1bfc8af8..963eb61a 100644
--- a/icd/common/icd-format.h
+++ b/icd/common/icd-format.h
@@ -97,7 +97,7 @@ static inline int icd_format_get_block_width(XGL_FORMAT format)
return (icd_format_is_compressed(format)) ? 4 : 1;
}
-XGL_SIZE icd_format_get_size(XGL_FORMAT format);
+size_t icd_format_get_size(XGL_FORMAT format);
XGL_UINT icd_format_get_channel_count(XGL_FORMAT format);
diff --git a/include/xgl.h b/include/xgl.h
index f28aa22c..5ccafd04 100644
--- a/include/xgl.h
+++ b/include/xgl.h
@@ -48,6 +48,7 @@
#ifndef __XGL_H__
#define __XGL_H__
+#include <stddef.h>
#include <stdint.h>
#define XGL_MAKE_VERSION(major, minor, patch) \
@@ -68,16 +69,16 @@ extern "C"
/*
* Datatypes
*/
-typedef unsigned char XGL_BOOL;
+typedef uint32_t XGL_BOOL;
typedef void XGL_VOID;
-typedef signed char XGL_CHAR; /* 1-byte signed */
+typedef char XGL_CHAR; /* 1-byte signed */
typedef int32_t XGL_INT; /* 4-byte signed */
typedef int32_t XGL_INT32; /* 4-byte signed */
typedef uint32_t XGL_UINT; /* 4-byte unsigned */
typedef uint32_t XGL_UINT32; /* 4-byte unsigned */
typedef uint64_t XGL_UINT64; /* 8-byte unsigned */
-typedef uint32_t XGL_SIZE; /* 4-byte unsigned */
-typedef uint32_t XGL_GPU_SIZE; /* 4-byte unsigned */
+typedef size_t XGL_SIZE; /* 4-byte unsigned */
+typedef uint64_t XGL_GPU_SIZE; /* 4-byte unsigned */
typedef uint32_t XGL_FLAGS; /* 4-byte unsigned */
typedef uint32_t XGL_SAMPLE_MASK; /* 4-byte unsigned */
typedef uint8_t XGL_UINT8; /* 1-byte unsigned */
diff --git a/xgl-helper.py b/xgl-helper.py
index cd0292a9..e99d7bc5 100755
--- a/xgl-helper.py
+++ b/xgl-helper.py
@@ -459,7 +459,9 @@ class StructWrapperGen:
print_type = "lu"
elif 'UINT8' in struct_member['type']:
print_type = "hu"
- elif True in [ui_str in struct_member['type'] for ui_str in ['UINT', '_SIZE', '_FLAGS', '_SAMPLE_MASK']]:
+ elif '_SIZE' in struct_member['type']:
+ print_type = "zu"
+ elif True in [ui_str in struct_member['type'] for ui_str in ['UINT', '_FLAGS', '_SAMPLE_MASK']]:
print_type = "u"
elif 'INT' in struct_member['type']:
print_type = "i"
@@ -892,7 +894,9 @@ class GraphVizGen:
print_type = "lu"
elif 'UINT8' in struct_member['type']:
print_type = "hu"
- elif True in [ui_str in struct_member['type'] for ui_str in ['UINT', '_SIZE', '_FLAGS', '_SAMPLE_MASK']]:
+ elif '_SIZE' in struct_member['type']:
+ print_type = "zu"
+ elif True in [ui_str in struct_member['type'] for ui_str in ['UINT', '_FLAGS', '_SAMPLE_MASK']]:
print_type = "u"
elif 'INT' in struct_member['type']:
print_type = "i"
diff --git a/xgl-layer-generate.py b/xgl-layer-generate.py
index 6214c34a..7fe0e131 100755
--- a/xgl-layer-generate.py
+++ b/xgl-layer-generate.py
@@ -105,13 +105,17 @@ class Subcommand(object):
if '*' in xgl_type:
return ("%lu", "*%s" % name)
return ("%lu", name)
+ if "SIZE" in xgl_type:
+ if '*' in xgl_type:
+ return ("%zu", "*%s" % name)
+ return ("%zu", name)
if "FLOAT" in xgl_type:
if '[' in xgl_type: # handle array, current hard-coded to 4 (TODO: Make this dynamic)
return ("[%f, %f, %f, %f]", "%s[0], %s[1], %s[2], %s[3]" % (name, name, name, name))
return ("%f", name)
if "BOOL" in xgl_type or 'xcb_randr_crtc_t' in xgl_type:
return ("%u", name)
- if True in [t in xgl_type for t in ["INT", "SIZE", "FLAGS", "MASK", "xcb_window_t"]]:
+ if True in [t in xgl_type for t in ["INT", "FLAGS", "MASK", "xcb_window_t"]]:
if '[' in xgl_type: # handle array, current hard-coded to 4 (TODO: Make this dynamic)
return ("[%i, %i, %i, %i]", "%s[0], %s[1], %s[2], %s[3]" % (name, name, name, name))
if '*' in xgl_type: