return VK_SUCCESS;
}
-VK_LAYER_EXPORT VkResult VKAPI vkGetExtensionSupport(VkPhysicalGpu gpu, const char* pExtName)
-{
- VkResult result;
-
- /* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */
- if (!strncmp(pExtName, "vkLayerExtension1", strlen("vkLayerExtension1")))
- {
- result = VK_SUCCESS;
- } else if (!strncmp(pExtName, "Basic", strlen("Basic")))
- {
- result = VK_SUCCESS;
- } else if (!tableMap.empty() && (tableMap.find(gpu) != tableMap.end()))
- {
- printf("At start of wrapped vkGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu);
- VkLayerDispatchTable* pTable = tableMap[gpu];
- result = pTable->GetExtensionSupport(gpu, pExtName);
- printf("Completed wrapped vkGetExtensionSupport() call w/ gpu: %p\n", (void*)gpu);
- } else
- {
- result = VK_ERROR_INVALID_EXTENSION;
- }
- return result;
-}
-
VK_LAYER_EXPORT VkResult VKAPI vkCreateDevice(VkPhysicalGpu gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice)
{
VkLayerDispatchTable* pTable = tableMap[gpu];
return (void *) vkGetProcAddr;
else if (!strncmp("vkCreateDevice", pName, sizeof ("vkCreateDevice")))
return (void *) vkCreateDevice;
- else if (!strncmp("vkGetExtensionSupport", pName, sizeof ("vkGetExtensionSupport")))
- return (void *) vkGetExtensionSupport;
else if (!strncmp("vkEnumerateLayers", pName, sizeof ("vkEnumerateLayers")))
return (void *) vkEnumerateLayers;
else if (!strncmp("vkGetFormatInfo", pName, sizeof ("vkGetFormatInfo")))
return VK_SUCCESS;
}
-VK_LAYER_EXPORT VkResult VKAPI vkGetExtensionSupport(VkPhysicalGpu gpu, const char* pExtName)
-{
- VkResult result;
-
- /* This entrypoint is NOT going to init its own dispatch table since loader calls here early */
- if (!strcmp(pExtName, "DrawState") || !strcmp(pExtName, "drawStateDumpDotFile") ||
- !strcmp(pExtName, "drawStateDumpCommandBufferDotFile") || !strcmp(pExtName, "drawStateDumpPngFile"))
- {
- result = VK_SUCCESS;
- } else if (nextTable.GetExtensionSupport != NULL)
- {
- result = nextTable.GetExtensionSupport(gpu, pExtName);
- } else {
- result = VK_ERROR_INVALID_EXTENSION;
- }
- return result;
-}
-
VK_LAYER_EXPORT VkResult VKAPI vkEnumerateLayers(VkPhysicalGpu gpu, size_t maxLayerCount, size_t maxStringSize, size_t* pOutLayerCount, char* const* pOutLayers, void* pReserved)
{
if (gpu != NULL)
return (void*) vkCreateDevice;
if (!strcmp(funcName, "vkDestroyDevice"))
return (void*) vkDestroyDevice;
- if (!strcmp(funcName, "vkGetExtensionSupport"))
- return (void*) vkGetExtensionSupport;
if (!strcmp(funcName, "vkEnumerateLayers"))
return (void*) vkEnumerateLayers;
if (!strcmp(funcName, "vkQueueSubmit"))
return result;
}
-VK_LAYER_EXPORT VkResult VKAPI vkGetExtensionSupport(VkPhysicalGpu gpu, const char* pExtName)
-{
- VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
- loader_platform_thread_lock_mutex(&objLock);
- ll_increment_use_count((void*)gpu, VK_OBJECT_TYPE_PHYSICAL_GPU);
- loader_platform_thread_unlock_mutex(&objLock);
- pCurObj = gpuw;
- loader_platform_thread_once(&tabOnce, initGlaveSnapshot);
- VkResult result = nextTable.GetExtensionSupport((VkPhysicalGpu)gpuw->nextObject, pExtName);
- return result;
-}
-
VK_LAYER_EXPORT VkResult VKAPI vkEnumerateLayers(VkPhysicalGpu gpu, size_t maxLayerCount, size_t maxStringSize, size_t* pOutLayerCount, char* const* pOutLayers, void* pReserved)
{
if (gpu != NULL) {
return VK_SUCCESS;
}
-VK_LAYER_EXPORT VkResult VKAPI vkGetExtensionSupport(VkPhysicalGpu gpu, const char* pExtName)
-{
- VkResult result;
- /* This entrypoint is NOT going to init its own dispatch table since loader calls here early */
- if (!strcmp(pExtName, "MemTracker"))
- {
- result = VK_SUCCESS;
- } else if (nextTable.GetExtensionSupport != NULL)
- {
- result = nextTable.GetExtensionSupport(gpu, pExtName);
- } else
- {
- result = VK_ERROR_INVALID_EXTENSION;
- }
- return result;
-}
-
VK_LAYER_EXPORT VkResult VKAPI vkEnumerateLayers(VkPhysicalGpu gpu, size_t maxLayerCount,
size_t maxStringSize, size_t* pOutLayerCount, char* const* pOutLayers, void* pReserved)
{
return (void*) vkCreateDevice;
if (!strcmp(funcName, "vkDestroyDevice"))
return (void*) vkDestroyDevice;
- if (!strcmp(funcName, "vkGetExtensionSupport"))
- return (void*) vkGetExtensionSupport;
if (!strcmp(funcName, "vkEnumerateLayers"))
return (void*) vkEnumerateLayers;
if (!strcmp(funcName, "vkQueueSubmit"))
return result;
}
-VK_LAYER_EXPORT VkResult VKAPI multi1GetExtensionSupport(VkPhysicalGpu gpu, const char* pExtName)
-{
- VkResult result;
-
- if (!tableMap1.empty() && (tableMap1.find(gpu) != tableMap1.end()))
- {
- VkLayerDispatchTable* pTable = tableMap1[gpu];
- result = pTable->GetExtensionSupport(gpu, pExtName);
- } else
- {
- result = VK_ERROR_INVALID_EXTENSION;
- }
- return result;
-}
-
VK_LAYER_EXPORT void * VKAPI multi1GetProcAddr(VkPhysicalGpu gpu, const char* pName)
{
VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
return (void *) multi1CreateGraphicsPipeline;
else if (!strncmp("vkStorePipeline", pName, sizeof ("vkStorePipeline")))
return (void *) multi1StorePipeline;
- else if (!strncmp("vkGetExtensionSupport", pName, sizeof ("vkGetExtensionSupport")))
- return (void *) multi1GetExtensionSupport;
else {
if (gpuw->pGPA == NULL)
return NULL;
return result;
}
-VK_LAYER_EXPORT VkResult VKAPI multi2GetExtensionSupport(VkPhysicalGpu gpu, const char* pExtName)
-{
- VkResult result;
-
- if (!tableMap2.empty() && (tableMap2.find(gpu) != tableMap2.end()))
- {
- VkLayerDispatchTable* pTable = tableMap2[gpu];
- result = pTable->GetExtensionSupport(gpu, pExtName);
- } else
- {
- result = VK_ERROR_INVALID_EXTENSION;
- }
- return result;
-}
-
VK_LAYER_EXPORT void * VKAPI multi2GetProcAddr(VkPhysicalGpu gpu, const char* pName)
{
VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;
return (void *) multi2CreateCommandBuffer;
else if (!strncmp("vkBeginCommandBuffer", pName, sizeof ("vkBeginCommandBuffer")))
return (void *) multi2BeginCommandBuffer;
- else if (!strncmp("vkGetExtensionSupport", pName, sizeof ("vkGetExtensionSupport")))
- return (void *) multi2GetExtensionSupport;
else {
if (gpuw->pGPA == NULL)
return NULL;
return VK_SUCCESS;
}
-VK_LAYER_EXPORT VkResult VKAPI vkGetExtensionSupport(VkPhysicalGpu gpu, const char* pExtName)
-{
- VkResult result;
-
- /* This entrypoint is NOT going to init it's own dispatch table since loader calls here early */
- if (!strncmp(pExtName, "multi1", strlen("multi1")))
- {
- result = VK_SUCCESS;
- } else if (!strncmp(pExtName, "multi2", strlen("multi2")))
- {
- result = VK_SUCCESS;
- } else if (!tableMap1.empty() && (tableMap1.find(gpu) != tableMap1.end()))
- {
- VkLayerDispatchTable* pTable = tableMap1[gpu];
- result = pTable->GetExtensionSupport(gpu, pExtName);
- } else if (!tableMap2.empty() && (tableMap2.find(gpu) != tableMap2.end()))
- {
- VkLayerDispatchTable* pTable = tableMap2[gpu];
- result = pTable->GetExtensionSupport(gpu, pExtName);
- } else
- {
- result = VK_ERROR_INVALID_EXTENSION;
- }
- return result;
-}
-
VK_LAYER_EXPORT void * VKAPI vkGetProcAddr(VkPhysicalGpu gpu, const char* pName)
{
// to find each layers GPA routine Loader will search via "<layerName>GetProcAddr"
return VK_SUCCESS;
}
-VK_LAYER_EXPORT VkResult VKAPI vkGetExtensionSupport(VkPhysicalGpu gpu, const char* pExtName)
-{
- pCurObj = (VkBaseLayerObject *) gpu;
- loader_platform_thread_once(&tabOnce, initParamChecker);
-
- VkResult result = nextTable.GetExtensionSupport(gpu, pExtName);
- return result;
-}
-
VK_LAYER_EXPORT VkResult VKAPI vkEnumerateLayers(VkPhysicalGpu gpu, size_t maxLayerCount, size_t maxStringSize, size_t* pOutLayerCount, char* const* pOutLayers, void* pReserved)
{
char str[1024];
ggei_body.append('}')
return "\n".join(ggei_body)
- def _gen_layer_get_extension_support(self, layer="Generic"):
- ges_body = []
- ges_body.append('VK_LAYER_EXPORT VkResult VKAPI xglGetExtensionSupport(VkPhysicalGpu gpu, const char* pExtName)')
- ges_body.append('{')
- ges_body.append(' VkResult result;')
- ges_body.append(' VkBaseLayerObject* gpuw = (VkBaseLayerObject *) gpu;')
- ges_body.append('')
- ges_body.append(' /* This entrypoint is NOT going to init its own dispatch table since loader calls here early */')
- ges_body.append(' if (!strncmp(pExtName, "%s", strlen("%s")))' % (layer, layer))
- ges_body.append(' {')
- ges_body.append(' result = VK_SUCCESS;')
- ges_body.append(' } else if (nextTable.GetExtensionSupport != NULL)')
- ges_body.append(' {')
- ges_body.append(' result = nextTable.GetExtensionSupport((VkPhysicalGpu)gpuw->nextObject, pExtName);')
- ges_body.append(' } else')
- ges_body.append(' {')
- ges_body.append(' result = VK_ERROR_INVALID_EXTENSION;')
- ges_body.append(' }')
- ges_body.append(' return result;')
- ges_body.append('}')
- return "\n".join(ges_body)
-
def _generate_dispatch_entrypoints(self, qual=""):
if qual:
qual += " "
intercept = self._gen_layer_dbg_callback_register()
elif 'DbgUnregisterMsgCallback' == proto.name:
intercept = self._gen_layer_dbg_callback_unregister()
- elif 'GetExtensionSupport' == proto.name:
- funcs.append(self._gen_layer_get_extension_support(self.layer_name))
elif 'GetGlobalExtensionInfo' == proto.name:
funcs.append(self._gen_layer_get_global_extension_info(self.layer_name))
if intercept is not None:
return '#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include "loader_platform.h"\n#include "vkLayer.h"\n//The following is #included again to catch certain OS-specific functions being used:\n#include "loader_platform.h"\n\n#include "layers_config.h"\n#include "layers_msg.h"\n\nstatic VkLayerDispatchTable nextTable;\nstatic VkBaseLayerObject *pCurObj;\n\nstatic LOADER_PLATFORM_THREAD_ONCE_DECLARATION(tabOnce);'
def generate_intercept(self, proto, qual):
- if proto.name in [ 'DbgRegisterMsgCallback', 'DbgUnregisterMsgCallback' , 'GetExtensionSupport', 'GetGlobalExtensionInfo']:
+ if proto.name in [ 'DbgRegisterMsgCallback', 'DbgUnregisterMsgCallback' , 'GetGlobalExtensionInfo']:
# use default version
return None
decl = proto.c_func(prefix="vk", attr="VKAPI")
' return VK_SUCCESS;\n'
' }\n'
'}' % (qual, decl, self.layer_name, ret_val, proto.c_call(),f_open, log_func, f_close, stmt, self.layer_name))
- elif 'GetExtensionSupport' == proto.name:
- funcs.append('%s%s\n'
- '{\n'
- ' VkResult result;\n'
- ' /* This entrypoint is NOT going to init its own dispatch table since loader calls here early */\n'
- ' if (!strncmp(pExtName, "%s", strlen("%s")))\n'
- ' {\n'
- ' result = VK_SUCCESS;\n'
- ' } else if (nextTable.GetExtensionSupport != NULL)\n'
- ' {\n'
- ' result = nextTable.%s;\n'
- ' %s %s %s\n'
- ' } else\n'
- ' {\n'
- ' result = VK_ERROR_INVALID_EXTENSION;\n'
- ' }\n'
- '%s'
- '}' % (qual, decl, self.layer_name, self.layer_name, proto.c_call(), f_open, log_func, f_close, stmt))
-# elif 'vkphysicalgpu' == proto.params[0].ty.lower():
-# c_call = proto.c_call().replace("(" + proto.params[0].name, "((VkPhysicalGpu)gpuw->nextObject", 1)
-# funcs.append('%s%s\n'
-# '{\n'
-# ' using namespace StreamControl;\n'
-# ' VkBaseLayerObject* gpuw = (VkBaseLayerObject *) %s;\n'
-# ' pCurObj = gpuw;\n'
-# ' loader_platform_thread_once(&tabOnce, init%s);\n'
-# ' %snextTable.%s;\n'
-# ' %s%s%s\n'
-# '%s'
-# '}' % (qual, decl, proto.params[0].name, self.layer_name, ret_val, c_call, f_open, log_func, f_close, stmt))
else:
funcs.append('%s%s\n'
'{\n'
' return VK_SUCCESS;\n'
' }\n'
'}' % (qual, decl, using_line, self.layer_name, ret_val, proto.c_call(), create_line, destroy_line, stmt, self.layer_name))
- elif 'GetExtensionSupport' == proto.name:
- funcs.append('%s%s\n'
- '{\n'
- ' VkResult result;\n'
- ' /* This entrypoint is NOT going to init its own dispatch table since loader calls this early */\n'
- ' if (!strncmp(pExtName, "%s", strlen("%s")) ||\n'
- ' !strncmp(pExtName, "objTrackGetObjectCount", strlen("objTrackGetObjectCount")) ||\n'
- ' !strncmp(pExtName, "objTrackGetObjects", strlen("objTrackGetObjects")))\n'
- ' {\n'
- ' result = VK_SUCCESS;\n'
- ' } else if (nextTable.GetExtensionSupport != NULL)\n'
- ' {\n'
- ' %s'
- ' result = nextTable.%s;\n'
- ' } else\n'
- ' {\n'
- ' result = VK_ERROR_INVALID_EXTENSION;\n'
- ' }\n'
- '%s'
- '}' % (qual, decl, self.layer_name, self.layer_name, using_line, proto.c_call(), stmt))
elif 'GetGpuInfo' in proto.name:
gpu_state = ' if (infoType == VK_INFO_TYPE_PHYSICAL_GPU_QUEUE_PROPERTIES) {\n'
gpu_state += ' if (pData != NULL) {\n'
Param("size_t*", "pDataSize"),
Param("void*", "pData")]),
- Proto("VkResult", "GetExtensionSupport",
- [Param("VkPhysicalGpu", "gpu"),
- Param("const char*", "pExtName")]),
-
Proto("VkResult", "EnumerateLayers",
[Param("VkPhysicalGpu", "gpu"),
Param("size_t", "maxLayerCount"),