diff options
| author | Tobin Ehlis <tobin@lunarg.com> | 2015-02-11 14:24:02 -0700 |
|---|---|---|
| committer | Tobin Ehlis <tobin@lunarg.com> | 2015-02-11 16:36:56 -0700 |
| commit | 4f4a34bb1ee88b4d64880670409193d2e372b425 (patch) | |
| tree | d5c3a4839f99bc91fcc72ac9ddb417466ccea3c4 | |
| parent | 22ce937d76deb6b2f0a6ec1275f2878e07f8a248 (diff) | |
| download | usermoji-4f4a34bb1ee88b4d64880670409193d2e372b425.tar.xz | |
layers: Fixes for Windows build
| -rw-r--r-- | layers/draw_state.c | 32 | ||||
| -rw-r--r-- | loader/loader_platform.h | 3 | ||||
| -rwxr-xr-x | xgl_helper.py | 12 |
3 files changed, 27 insertions, 20 deletions
diff --git a/layers/draw_state.c b/layers/draw_state.c index a10d949d..383211ab 100644 --- a/layers/draw_state.c +++ b/layers/draw_state.c @@ -421,36 +421,36 @@ static XGL_DESCRIPTOR_SET g_lastBoundDS = NULL; // Return Region node ptr for specified region or else NULL static REGION_NODE* getRegionNode(XGL_DESCRIPTOR_REGION region) { - pthread_mutex_lock(&globalLock); + loader_platform_thread_lock_mutex(&globalLock); REGION_NODE* pTrav = g_pRegionHead; while (pTrav) { if (pTrav->region == region) { - pthread_mutex_unlock(&globalLock); + loader_platform_thread_unlock_mutex(&globalLock); return pTrav; } pTrav = pTrav->pNext; } - pthread_mutex_unlock(&globalLock); + loader_platform_thread_unlock_mutex(&globalLock); return NULL; } // Return Set node ptr for specified set or else NULL static SET_NODE* getSetNode(XGL_DESCRIPTOR_SET set) { - pthread_mutex_lock(&globalLock); + loader_platform_thread_lock_mutex(&globalLock); REGION_NODE* pTrav = g_pRegionHead; while (pTrav) { SET_NODE* pSet = pTrav->pSets; while (pSet) { if (pSet->set == set) { - pthread_mutex_unlock(&globalLock); + loader_platform_thread_unlock_mutex(&globalLock); return pSet; } pSet = pSet->pNext; } pTrav = pTrav->pNext; } - pthread_mutex_unlock(&globalLock); + loader_platform_thread_unlock_mutex(&globalLock); return NULL; } @@ -469,16 +469,16 @@ static bool32_t dsUpdateActive(XGL_DESCRIPTOR_SET ds) } static LAYOUT_NODE* getLayoutNode(XGL_DESCRIPTOR_SET_LAYOUT layout) { - pthread_mutex_lock(&globalLock); + loader_platform_thread_lock_mutex(&globalLock); LAYOUT_NODE* pTrav = g_pLayoutHead; while (pTrav) { if (pTrav->layout == layout) { - pthread_mutex_unlock(&globalLock); + loader_platform_thread_unlock_mutex(&globalLock); return pTrav; } pTrav = pTrav->pNext; } - pthread_mutex_unlock(&globalLock); + loader_platform_thread_unlock_mutex(&globalLock); return NULL; } @@ -934,7 +934,7 @@ static void synchAndPrintDSConfig() } } -static void initDrawState() +static void initDrawState(void) { const char *strOpt; // initialize DrawState options @@ -1262,13 +1262,13 @@ XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateBuffer(XGL_DEVICE device, const XGL_ { XGL_RESULT result = nextTable.CreateBuffer(device, pCreateInfo, pBuffer); if (XGL_SUCCESS == result) { - pthread_mutex_lock(&globalLock); + loader_platform_thread_lock_mutex(&globalLock); BUFFER_NODE *pNewNode = (BUFFER_NODE*)malloc(sizeof(BUFFER_NODE)); pNewNode->buffer = *pBuffer; memcpy(&pNewNode->createInfo, pCreateInfo, sizeof(XGL_BUFFER_CREATE_INFO)); pNewNode->pNext = g_pBufferHead; g_pBufferHead = pNewNode; - pthread_mutex_unlock(&globalLock); + loader_platform_thread_unlock_mutex(&globalLock); } return result; } @@ -1307,13 +1307,13 @@ XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateImageView(XGL_DEVICE device, const X { XGL_RESULT result = nextTable.CreateImageView(device, pCreateInfo, pView); if (XGL_SUCCESS == result) { - pthread_mutex_lock(&globalLock); + loader_platform_thread_lock_mutex(&globalLock); IMAGE_NODE *pNewNode = (IMAGE_NODE*)malloc(sizeof(IMAGE_NODE)); pNewNode->image = *pView; memcpy(&pNewNode->createInfo, pCreateInfo, sizeof(XGL_IMAGE_VIEW_CREATE_INFO)); pNewNode->pNext = g_pImageHead; g_pImageHead = pNewNode; - pthread_mutex_unlock(&globalLock); + loader_platform_thread_unlock_mutex(&globalLock); } return result; } @@ -1502,7 +1502,7 @@ XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDescriptorRegion(XGL_DEVICE device, char str[1024]; sprintf(str, "Created Descriptor Region %p", (void*)*pDescriptorRegion); layerCbMsg(XGL_DBG_MSG_UNKNOWN, XGL_VALIDATION_LEVEL_0, pDescriptorRegion, 0, DRAWSTATE_NONE, "DS", str); - pthread_mutex_lock(&globalLock); + loader_platform_thread_lock_mutex(&globalLock); REGION_NODE* pNewNode = (REGION_NODE*)malloc(sizeof(REGION_NODE)); if (NULL == pNewNode) { char str[1024]; @@ -1524,7 +1524,7 @@ XGL_LAYER_EXPORT XGL_RESULT XGLAPI xglCreateDescriptorRegion(XGL_DEVICE device, pNewNode->maxSets = maxSets; pNewNode->region = *pDescriptorRegion; } - pthread_mutex_unlock(&globalLock); + loader_platform_thread_unlock_mutex(&globalLock); } else { // Need to do anything if region create fails? diff --git a/loader/loader_platform.h b/loader/loader_platform.h index e567700b..98c2d39b 100644 --- a/loader/loader_platform.h +++ b/loader/loader_platform.h @@ -64,6 +64,8 @@ // C99: #define STATIC_INLINE static inline +#define PRINTF_SIZE_T_SPECIFIER "%zu" + // Dynamic Loading: typedef void * loader_platform_dl_handle; static inline loader_platform_dl_handle loader_platform_open_library(const char* libPath) @@ -171,6 +173,7 @@ using namespace std; // "CMakeLists.txt" file). #define snprintf _snprintf #define STATIC_INLINE static +#define PRINTF_SIZE_T_SPECIFIER "%Iu" // Microsoft also doesn't have basename(). Paths are different on Windows, and // so this is just a temporary solution in order to get us compiling, so that we // can test some scenarios, and develop the correct solution for Windows. diff --git a/xgl_helper.py b/xgl_helper.py index c8d294a1..630a6c4b 100755 --- a/xgl_helper.py +++ b/xgl_helper.py @@ -476,6 +476,7 @@ class StructWrapperGen: member_post = "" array_index = "" member_print_post = "" + print_delimiter = "%" if struct_member['array'] and 'CHAR' in struct_member['type']: # just print char array as string print_type = "s" print_array = False @@ -501,7 +502,8 @@ class StructWrapperGen: elif 'uint8' in struct_member['type']: print_type = "hu" elif '_size' in struct_member['type']: - print_type = "zu" + print_type = '" PRINTF_SIZE_T_SPECIFIER "' + print_delimiter = "" elif True in [ui_str.lower() in struct_member['type'].lower() for ui_str in ['uint', '_FLAGS', '_SAMPLE_MASK']]: print_type = "u" elif 'int' in struct_member['type']: @@ -515,7 +517,7 @@ class StructWrapperGen: member_print_post = "[%u]" array_index = " i," member_post = "[i]" - print_out = "%%s%s%s = %%%s%s" % (member_name, member_print_post, print_type, postfix) # section of print that goes inside of quotes + print_out = "%%s%s%s = %s%s%s" % (member_name, member_print_post, print_delimiter, print_type, postfix) # section of print that goes inside of quotes print_arg = ", %s,%s %s(%s%s%s)%s" % (pre_var_name, array_index, cast_type, struct_var_name, struct_op, member_name, member_post) # section of print passed to portion in quotes if self.no_addr and "p" == print_type: print_out = "%%s%s%s = addr\\n" % (member_name, member_print_post) # section of print that goes inside of quotes @@ -1111,6 +1113,7 @@ class GraphVizGen: member_post = "" array_index = "" member_print_post = "" + print_delimiter = "%" if struct_member['array'] and 'CHAR' in struct_member['type']: # just print char array as string print_type = "s" print_array = False @@ -1136,7 +1139,8 @@ class GraphVizGen: elif 'uint8' in struct_member['type']: print_type = "hu" elif '_SIZE' in struct_member['type']: - print_type = "zu" + print_type = '" PRINTF_SIZE_T_SPECIFIER "' + print_delimiter = "" 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']: @@ -1150,7 +1154,7 @@ class GraphVizGen: member_print_post = "[%u]" array_index = " i," member_post = "[i]" - print_out = "<TR><TD>%%s%s%s</TD><TD%s>%%%s%s</TD></TR>" % (member_name, member_print_post, port_label, print_type, postfix) # section of print that goes inside of quotes + print_out = "<TR><TD>%%s%s%s</TD><TD%s>%s%s%s</TD></TR>" % (member_name, member_print_post, port_label, print_delimiter, print_type, postfix) # section of print that goes inside of quotes print_arg = ", %s,%s %s(%s%s%s)%s" % (pre_var_name, array_index, cast_type, struct_var_name, struct_op, member_name, member_post) # section of print passed to portion in quotes return (print_out, print_arg) |
