Move to new paraLLEl-RDP.

This commit is contained in:
Hans-Kristian Arntzen committed 2020-05-11 23:46:51 +02:00
1 parent b7e5a5dfa7
commit d2e22703d4
80 files changed
+232 -48896

No files matched your search

View File
Whitespace-only changes.
+54 -9
View File
@@ -461,22 +461,67 @@ endif
ifeq ($(HAVE_PARALLEL),1)
CFLAGS += -DHAVE_PARALLEL
CXXFLAGS += -DHAVE_PARALLEL
### Tiny Tigers's LLE renderer ###
SOURCES_CXX += \
$(VIDEODIR_PARALLEL)/parallel.cpp \
$(VIDEODIR_PARALLEL)/vi.cpp \
$(VIDEODIR_PARALLEL)/rdp.cpp \
$(VIDEODIR_PARALLEL)/rdp/vulkan.cpp \
$(VIDEODIR_PARALLEL)/rdp/vulkan_util.cpp \
$(VIDEODIR_PARALLEL)/rdp/frontend.cpp \
$(VIDEODIR_PARALLEL)/rdp/tmem.cpp \
$(VIDEODIR_PARALLEL)/rdp/rdp.cpp \
$(VIDEODIR_PARALLEL)/rdp/vulkan_symbol_wrapper.cpp
$(VIDEODIR_PARALLEL)/rdp.cpp
SOURCES_CXX += \
$(wildcard $(VIDEODIR_PARALLEL)/parallel-rdp/parallel-rdp/*.cpp)
SOURCES_CXX += \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/buffer.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/buffer_pool.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/command_buffer.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/command_pool.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/context.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/cookie.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/descriptor_set.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/device.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/event_manager.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/fence.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/fence_manager.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/image.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/memory_allocator.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/pipeline_event.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/query_pool.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/render_pass.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/sampler.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/semaphore.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/semaphore_manager.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/shader.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/texture_format.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan/thread_id.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/util/aligned_alloc.cpp
SOURCES_CXX += \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/third_party/spirv-cross/spirv_cross.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/third_party/spirv-cross/spirv_cfg.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/third_party/spirv-cross/spirv_parser.cpp \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/third_party/spirv-cross/spirv_cross_parsed_ir.cpp
SOURCES_C += \
$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/third_party/volk/volk.c
INCFLAGS += \
-I$(VIDEODIR_PARALLEL)/parallel-rdp/parallel-rdp \
-I$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/third_party/volk \
-I$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/third_party/spirv-cross \
-I$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/vulkan \
-I$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/third-party/khronos/vulkan-headers/include \
-I$(VIDEODIR_PARALLEL)/parallel-rdp/Granite/util
CXXFLAGS += -DGRANITE_VULKAN_MT
ifneq ($(findstring Haiku,$(shell uname -s)),)
LDFLAGS += -lroot
else
LDFLAGS += -pthread
ifneq ($(platform),win)
LDFLAGS += -ldl
else
CFLAGS += -DVK_USE_PLATFORM_WIN32_KHR
CXXFLAGS += -DVK_USE_PLATFORM_WIN32_KHR
endif
endif
endif
-124
View File
@@ -1,124 +0,0 @@
//
// File: vk_icd.h
//
/*
* Copyright (c) 2015-2016 The Khronos Group Inc.
* Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef VKICD_H
#define VKICD_H
#include "vulkan.h"
/*
* Loader-ICD version negotiation API
*/
#define CURRENT_LOADER_ICD_INTERFACE_VERSION 2
#define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0
typedef VkResult (VKAPI_PTR *PFN_vkNegotiateLoaderICDInterfaceVersion)(uint32_t *pVersion);
/*
* The ICD must reserve space for a pointer for the loader's dispatch
* table, at the start of <each object>.
* The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro.
*/
#define ICD_LOADER_MAGIC 0x01CDC0DE
typedef union _VK_LOADER_DATA {
uintptr_t loaderMagic;
void *loaderData;
} VK_LOADER_DATA;
static inline void set_loader_magic_value(void *pNewObject) {
VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject;
loader_info->loaderMagic = ICD_LOADER_MAGIC;
}
static inline bool valid_loader_magic_value(void *pNewObject) {
const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject;
return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC;
}
/*
* Windows and Linux ICDs will treat VkSurfaceKHR as a pointer to a struct that
* contains the platform-specific connection and surface information.
*/
typedef enum _VkIcdWsiPlatform {
VK_ICD_WSI_PLATFORM_MIR,
VK_ICD_WSI_PLATFORM_WAYLAND,
VK_ICD_WSI_PLATFORM_WIN32,
VK_ICD_WSI_PLATFORM_XCB,
VK_ICD_WSI_PLATFORM_XLIB,
VK_ICD_WSI_PLATFORM_DISPLAY
} VkIcdWsiPlatform;
typedef struct _VkIcdSurfaceBase {
VkIcdWsiPlatform platform;
} VkIcdSurfaceBase;
#ifdef VK_USE_PLATFORM_MIR_KHR
typedef struct _VkIcdSurfaceMir {
VkIcdSurfaceBase base;
MirConnection *connection;
MirSurface *mirSurface;
} VkIcdSurfaceMir;
#endif // VK_USE_PLATFORM_MIR_KHR
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
typedef struct _VkIcdSurfaceWayland {
VkIcdSurfaceBase base;
struct wl_display *display;
struct wl_surface *surface;
} VkIcdSurfaceWayland;
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#ifdef VK_USE_PLATFORM_WIN32_KHR
typedef struct _VkIcdSurfaceWin32 {
VkIcdSurfaceBase base;
HINSTANCE hinstance;
HWND hwnd;
} VkIcdSurfaceWin32;
#endif // VK_USE_PLATFORM_WIN32_KHR
#ifdef VK_USE_PLATFORM_XCB_KHR
typedef struct _VkIcdSurfaceXcb {
VkIcdSurfaceBase base;
xcb_connection_t *connection;
xcb_window_t window;
} VkIcdSurfaceXcb;
#endif // VK_USE_PLATFORM_XCB_KHR
#ifdef VK_USE_PLATFORM_XLIB_KHR
typedef struct _VkIcdSurfaceXlib {
VkIcdSurfaceBase base;
Display *dpy;
Window window;
} VkIcdSurfaceXlib;
#endif // VK_USE_PLATFORM_XLIB_KHR
typedef struct _VkIcdSurfaceDisplay {
VkIcdSurfaceBase base;
VkDisplayModeKHR displayMode;
uint32_t planeIndex;
uint32_t planeStackIndex;
VkSurfaceTransformFlagBitsKHR transform;
float globalAlpha;
VkDisplayPlaneAlphaFlagBitsKHR alphaMode;
VkExtent2D imageExtent;
} VkIcdSurfaceDisplay;
#endif // VKICD_H
-314
View File
@@ -1,314 +0,0 @@
//
// File: vk_layer.h
//
/*
* Copyright (c) 2015-2016 The Khronos Group Inc.
* Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/* Need to define dispatch table
* Core struct can then have ptr to dispatch table at the top
* Along with object ptrs for current and next OBJ
*/
#pragma once
#include "vulkan.h"
#if defined(__GNUC__) && __GNUC__ >= 4
#define VK_LAYER_EXPORT __attribute__((visibility("default")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
#define VK_LAYER_EXPORT __attribute__((visibility("default")))
#else
#define VK_LAYER_EXPORT
#endif
typedef struct VkLayerDispatchTable_ {
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
PFN_vkDestroyDevice DestroyDevice;
PFN_vkGetDeviceQueue GetDeviceQueue;
PFN_vkQueueSubmit QueueSubmit;
PFN_vkQueueWaitIdle QueueWaitIdle;
PFN_vkDeviceWaitIdle DeviceWaitIdle;
PFN_vkAllocateMemory AllocateMemory;
PFN_vkFreeMemory FreeMemory;
PFN_vkMapMemory MapMemory;
PFN_vkUnmapMemory UnmapMemory;
PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment;
PFN_vkGetImageSparseMemoryRequirements GetImageSparseMemoryRequirements;
PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements;
PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements;
PFN_vkBindImageMemory BindImageMemory;
PFN_vkBindBufferMemory BindBufferMemory;
PFN_vkQueueBindSparse QueueBindSparse;
PFN_vkCreateFence CreateFence;
PFN_vkDestroyFence DestroyFence;
PFN_vkGetFenceStatus GetFenceStatus;
PFN_vkResetFences ResetFences;
PFN_vkWaitForFences WaitForFences;
PFN_vkCreateSemaphore CreateSemaphore;
PFN_vkDestroySemaphore DestroySemaphore;
PFN_vkCreateEvent CreateEvent;
PFN_vkDestroyEvent DestroyEvent;
PFN_vkGetEventStatus GetEventStatus;
PFN_vkSetEvent SetEvent;
PFN_vkResetEvent ResetEvent;
PFN_vkCreateQueryPool CreateQueryPool;
PFN_vkDestroyQueryPool DestroyQueryPool;
PFN_vkGetQueryPoolResults GetQueryPoolResults;
PFN_vkCreateBuffer CreateBuffer;
PFN_vkDestroyBuffer DestroyBuffer;
PFN_vkCreateBufferView CreateBufferView;
PFN_vkDestroyBufferView DestroyBufferView;
PFN_vkCreateImage CreateImage;
PFN_vkDestroyImage DestroyImage;
PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout;
PFN_vkCreateImageView CreateImageView;
PFN_vkDestroyImageView DestroyImageView;
PFN_vkCreateShaderModule CreateShaderModule;
PFN_vkDestroyShaderModule DestroyShaderModule;
PFN_vkCreatePipelineCache CreatePipelineCache;
PFN_vkDestroyPipelineCache DestroyPipelineCache;
PFN_vkGetPipelineCacheData GetPipelineCacheData;
PFN_vkMergePipelineCaches MergePipelineCaches;
PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
PFN_vkCreateComputePipelines CreateComputePipelines;
PFN_vkDestroyPipeline DestroyPipeline;
PFN_vkCreatePipelineLayout CreatePipelineLayout;
PFN_vkDestroyPipelineLayout DestroyPipelineLayout;
PFN_vkCreateSampler CreateSampler;
PFN_vkDestroySampler DestroySampler;
PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout;
PFN_vkCreateDescriptorPool CreateDescriptorPool;
PFN_vkDestroyDescriptorPool DestroyDescriptorPool;
PFN_vkResetDescriptorPool ResetDescriptorPool;
PFN_vkAllocateDescriptorSets AllocateDescriptorSets;
PFN_vkFreeDescriptorSets FreeDescriptorSets;
PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
PFN_vkCreateFramebuffer CreateFramebuffer;
PFN_vkDestroyFramebuffer DestroyFramebuffer;
PFN_vkCreateRenderPass CreateRenderPass;
PFN_vkDestroyRenderPass DestroyRenderPass;
PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity;
PFN_vkCreateCommandPool CreateCommandPool;
PFN_vkDestroyCommandPool DestroyCommandPool;
PFN_vkResetCommandPool ResetCommandPool;
PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
PFN_vkFreeCommandBuffers FreeCommandBuffers;
PFN_vkBeginCommandBuffer BeginCommandBuffer;
PFN_vkEndCommandBuffer EndCommandBuffer;
PFN_vkResetCommandBuffer ResetCommandBuffer;
PFN_vkCmdBindPipeline CmdBindPipeline;
PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
PFN_vkCmdSetViewport CmdSetViewport;
PFN_vkCmdSetScissor CmdSetScissor;
PFN_vkCmdSetLineWidth CmdSetLineWidth;
PFN_vkCmdSetDepthBias CmdSetDepthBias;
PFN_vkCmdSetBlendConstants CmdSetBlendConstants;
PFN_vkCmdSetDepthBounds CmdSetDepthBounds;
PFN_vkCmdSetStencilCompareMask CmdSetStencilCompareMask;
PFN_vkCmdSetStencilWriteMask CmdSetStencilWriteMask;
PFN_vkCmdSetStencilReference CmdSetStencilReference;
PFN_vkCmdDraw CmdDraw;
PFN_vkCmdDrawIndexed CmdDrawIndexed;
PFN_vkCmdDrawIndirect CmdDrawIndirect;
PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
PFN_vkCmdDispatch CmdDispatch;
PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
PFN_vkCmdCopyBuffer CmdCopyBuffer;
PFN_vkCmdCopyImage CmdCopyImage;
PFN_vkCmdBlitImage CmdBlitImage;
PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
PFN_vkCmdFillBuffer CmdFillBuffer;
PFN_vkCmdClearColorImage CmdClearColorImage;
PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage;
PFN_vkCmdClearAttachments CmdClearAttachments;
PFN_vkCmdResolveImage CmdResolveImage;
PFN_vkCmdSetEvent CmdSetEvent;
PFN_vkCmdResetEvent CmdResetEvent;
PFN_vkCmdWaitEvents CmdWaitEvents;
PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
PFN_vkCmdBeginQuery CmdBeginQuery;
PFN_vkCmdEndQuery CmdEndQuery;
PFN_vkCmdResetQueryPool CmdResetQueryPool;
PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
PFN_vkCmdPushConstants CmdPushConstants;
PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
PFN_vkCmdNextSubpass CmdNextSubpass;
PFN_vkCmdEndRenderPass CmdEndRenderPass;
PFN_vkCmdExecuteCommands CmdExecuteCommands;
PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
PFN_vkDestroySwapchainKHR DestroySwapchainKHR;
PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
PFN_vkQueuePresentKHR QueuePresentKHR;
} VkLayerDispatchTable;
typedef struct VkLayerInstanceDispatchTable_ {
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
PFN_vkDestroyInstance DestroyInstance;
PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
PFN_vkGetPhysicalDeviceImageFormatProperties
GetPhysicalDeviceImageFormatProperties;
PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
PFN_vkGetPhysicalDeviceSparseImageFormatProperties
GetPhysicalDeviceSparseImageFormatProperties;
PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
PFN_vkGetPhysicalDeviceQueueFamilyProperties
GetPhysicalDeviceQueueFamilyProperties;
PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
GetPhysicalDeviceSurfaceCapabilitiesKHR;
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR
GetPhysicalDeviceSurfacePresentModesKHR;
PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
#ifdef VK_USE_PLATFORM_MIR_KHR
PFN_vkCreateMirSurfaceKHR CreateMirSurfaceKHR;
PFN_vkGetPhysicalDeviceMirPresentationSupportKHR
GetPhysicalDeviceMirPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR;
PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
GetPhysicalDeviceWaylandPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR;
PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR
GetPhysicalDeviceWin32PresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR
PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR;
PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR
GetPhysicalDeviceXcbPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_XLIB_KHR
PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR;
PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR
GetPhysicalDeviceXlibPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_ANDROID_KHR
PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR;
#endif
PFN_vkGetPhysicalDeviceDisplayPropertiesKHR
GetPhysicalDeviceDisplayPropertiesKHR;
PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR
GetPhysicalDeviceDisplayPlanePropertiesKHR;
PFN_vkGetDisplayPlaneSupportedDisplaysKHR
GetDisplayPlaneSupportedDisplaysKHR;
PFN_vkGetDisplayModePropertiesKHR
GetDisplayModePropertiesKHR;
PFN_vkCreateDisplayModeKHR
CreateDisplayModeKHR;
PFN_vkGetDisplayPlaneCapabilitiesKHR
GetDisplayPlaneCapabilitiesKHR;
PFN_vkCreateDisplayPlaneSurfaceKHR
CreateDisplayPlaneSurfaceKHR;
} VkLayerInstanceDispatchTable;
// LL node for tree of dbg callback functions
typedef struct VkLayerDbgFunctionNode_ {
VkDebugReportCallbackEXT msgCallback;
PFN_vkDebugReportCallbackEXT pfnMsgCallback;
VkFlags msgFlags;
void *pUserData;
struct VkLayerDbgFunctionNode_ *pNext;
} VkLayerDbgFunctionNode;
typedef enum VkLayerDbgAction_ {
VK_DBG_LAYER_ACTION_IGNORE = 0x0,
VK_DBG_LAYER_ACTION_CALLBACK = 0x1,
VK_DBG_LAYER_ACTION_LOG_MSG = 0x2,
VK_DBG_LAYER_ACTION_BREAK = 0x4,
VK_DBG_LAYER_ACTION_DEBUG_OUTPUT = 0x8,
} VkLayerDbgAction;
// ------------------------------------------------------------------------------------------------
// CreateInstance and CreateDevice support structures
/* Sub type of structure for instance and device loader ext of CreateInfo.
* When sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
* or sType == VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
* then VkLayerFunction indicates struct type pointed to by pNext
*/
typedef enum VkLayerFunction_ {
VK_LAYER_LINK_INFO = 0,
VK_LOADER_DATA_CALLBACK = 1
} VkLayerFunction;
typedef struct VkLayerInstanceLink_ {
struct VkLayerInstanceLink_ *pNext;
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
} VkLayerInstanceLink;
/*
* When creating the device chain the loader needs to pass
* down information about it's device structure needed at
* the end of the chain. Passing the data via the
* VkLayerDeviceInfo avoids issues with finding the
* exact instance being used.
*/
typedef struct VkLayerDeviceInfo_ {
void *device_info;
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
} VkLayerDeviceInfo;
typedef VkResult (VKAPI_PTR *PFN_vkSetInstanceLoaderData)(VkInstance instance,
void *object);
typedef VkResult (VKAPI_PTR *PFN_vkSetDeviceLoaderData)(VkDevice device,
void *object);
typedef struct {
VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
const void *pNext;
VkLayerFunction function;
union {
VkLayerInstanceLink *pLayerInfo;
PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData;
} u;
} VkLayerInstanceCreateInfo;
typedef struct VkLayerDeviceLink_ {
struct VkLayerDeviceLink_ *pNext;
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
PFN_vkGetDeviceProcAddr pfnNextGetDeviceProcAddr;
} VkLayerDeviceLink;
typedef struct {
VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
const void *pNext;
VkLayerFunction function;
union {
VkLayerDeviceLink *pLayerInfo;
PFN_vkSetDeviceLoaderData pfnSetDeviceLoaderData;
} u;
} VkLayerDeviceCreateInfo;
@@ -1,120 +0,0 @@
//
// File: vk_platform.h
//
/*
** Copyright (c) 2014-2015 The Khronos Group Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
#ifndef VK_PLATFORM_H_
#define VK_PLATFORM_H_
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
/*
***************************************************************************************************
* Platform-specific directives and type declarations
***************************************************************************************************
*/
/* Platform-specific calling convention macros.
*
* Platforms should define these so that Vulkan clients call Vulkan commands
* with the same calling conventions that the Vulkan implementation expects.
*
* VKAPI_ATTR - Placed before the return type in function declarations.
* Useful for C++11 and GCC/Clang-style function attribute syntax.
* VKAPI_CALL - Placed after the return type in function declarations.
* Useful for MSVC-style calling convention syntax.
* VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
*
* Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
* Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
*/
#if defined(_WIN32)
// On Windows, Vulkan commands use the stdcall convention
#define VKAPI_ATTR
#define VKAPI_CALL __stdcall
#define VKAPI_PTR VKAPI_CALL
#elif defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__)
// Android does not support Vulkan in native code using the "armeabi" ABI.
#error "Vulkan requires the 'armeabi-v7a' or 'armeabi-v7a-hard' ABI on 32-bit ARM CPUs"
#elif defined(__ANDROID__) && defined(__ARM_ARCH_7A__)
// On Android/ARMv7a, Vulkan functions use the armeabi-v7a-hard calling
// convention, even if the application's native code is compiled with the
// armeabi-v7a calling convention.
#define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
#define VKAPI_CALL
#define VKAPI_PTR VKAPI_ATTR
#else
// On other platforms, use the default calling convention
#define VKAPI_ATTR
#define VKAPI_CALL
#define VKAPI_PTR
#endif
#include <stddef.h>
#if !defined(VK_NO_STDINT_H)
#if defined(_MSC_VER) && (_MSC_VER < 1600)
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
#endif // !defined(VK_NO_STDINT_H)
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
// Platform-specific headers required by platform window system extensions.
// These are enabled prior to #including "vulkan.h". The same enable then
// controls inclusion of the extension interfaces in vulkan.h.
#ifdef VK_USE_PLATFORM_ANDROID_KHR
#include <android/native_window.h>
#endif
#ifdef VK_USE_PLATFORM_MIR_KHR
#include <mir_toolkit/client_types.h>
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
#include <wayland-client.h>
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
#include <windows.h>
#endif
#ifdef VK_USE_PLATFORM_XLIB_KHR
#include <X11/Xlib.h>
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR
#include <xcb/xcb.h>
#endif
#endif
@@ -1,46 +0,0 @@
//
// File: vk_sdk_platform.h
//
/*
* Copyright (c) 2015-2016 The Khronos Group Inc.
* Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef VK_SDK_PLATFORM_H
#define VK_SDK_PLATFORM_H
#if defined(_WIN32)
#define NOMINMAX
#ifndef __cplusplus
#undef inline
#define inline __inline
#endif // __cplusplus
#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/)
// C99:
// Microsoft didn't implement C99 in Visual Studio; but started adding it with
// VS2013. However, VS2013 still didn't have snprintf(). The following is a
// work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the
// "CMakeLists.txt" file).
// NOTE: This is fixed in Visual Studio 2015.
#define snprintf _snprintf
#endif
#define strdup _strdup
#endif // _WIN32
#endif // VK_SDK_PLATFORM_H
File diff suppressed because it is too large. Load diff
@@ -1,62 +0,0 @@
/*
* Copyright © 2015 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef __VULKAN_INTEL_H__
#define __VULKAN_INTEL_H__
#include "vulkan.h"
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
#define VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL 1024
typedef struct VkDmaBufImageCreateInfo_
{
VkStructureType sType; // Must be VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL
const void* pNext; // Pointer to next structure.
int fd;
VkFormat format;
VkExtent3D extent; // Depth must be 1
uint32_t strideInBytes;
} VkDmaBufImageCreateInfo;
typedef VkResult (VKAPI_PTR *PFN_vkCreateDmaBufImageINTEL)(VkDevice device, const VkDmaBufImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMem, VkImage* pImage);
#ifdef VK_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDmaBufImageINTEL(
VkDevice _device,
const VkDmaBufImageCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDeviceMemory* pMem,
VkImage* pImage);
#endif
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // __VULKAN_INTEL_H__
-4
View File
@@ -994,7 +994,6 @@ extern void angrylion_set_vi(unsigned value);
extern void angrylion_set_filtering(unsigned value);
extern void angrylion_set_dithering(unsigned value);
extern void angrylion_set_threads(unsigned value);
extern void parallel_set_dithering(unsigned value);
extern void angrylion_set_overscan(unsigned value);
extern void angrylion_set_vi_dedither(unsigned value);
extern void angrylion_set_vi_blur(unsigned value);
@@ -1064,9 +1063,6 @@ static void gfx_set_dithering(void)
#endif
break;
case GFX_PARALLEL:
#ifdef HAVE_PARALLEL
parallel_set_dithering(retro_dithering);
#endif
break;
case GFX_GLN64:
#if defined(HAVE_GLN64) || defined(HAVE_GLIDEN64)
+1 -1
View File
@@ -99,7 +99,7 @@ int g_DDMemHasBeenBSwapped = 0; /* store byte-swapped flag so we don't sw
int g_EmulatorRunning = 0; /* need separate boolean to tell if emulator is running, since --nogui doesn't use a thread */
/* XXX: only global because of new dynarec linkage_x86.asm and plugin.c */
ALIGN(16, uint32_t g_rdram[RDRAM_MAX_SIZE/4]);
ALIGN(4 * 1024, uint32_t g_rdram[RDRAM_MAX_SIZE/4]);
struct device g_dev;
struct r4300_core g_r4300;
-4
View File
@@ -1,4 +0,0 @@
Written by Tiny Tiger.
Code is heavily inspired by the Angrylion LLE plugin.
This plugin aims to be very similar to Angrylion LLE, but it is completely rewritten to run in parallel on GPUs.
-7
View File
@@ -1,7 +0,0 @@
#!/bin/bash
for file in *.{cpp,hpp}
do
echo "Formatting file: $file ..."
clang-format -style=file -i $file
done
+15 -43
View File
@@ -1,3 +1,4 @@
#include "rdp.hpp"
#include "Gfx #1.3.h"
#include "m64p_config.h"
#include "m64p_types.h"
@@ -5,14 +6,7 @@
#include <string.h>
#include <boolean.h>
#include "rdp.hpp"
extern "C" {
#ifdef HAVE_RDP_DUMP
#include "rdp_dump.h"
#endif
extern int retro_return(bool just_flipping);
void parallelChangeWindow(void)
@@ -31,7 +25,7 @@ void parallelGetDllInfo(PLUGIN_INFO *PluginInfo)
{
PluginInfo->Version = 0x0001;
PluginInfo->Type = 2;
strcpy(PluginInfo->Name, "Tiny Tiger's RDP");
strcpy(PluginInfo->Name, "paraLLEl-RDP");
PluginInfo->NormalMemory = true;
PluginInfo->MemoryBswaped = true;
}
@@ -42,12 +36,6 @@ void parallelSetRenderingCallback(void (*callback)(int))
int parallelInitiateGFX(GFX_INFO Gfx_Info)
{
#ifdef HAVE_RDP_DUMP
const char *env = getenv("RDP_DUMP");
if (env)
rdp_dump_init(env, 8 * 1024 * 1024);
#endif
return true;
}
@@ -66,31 +54,16 @@ void parallelProcessRDPList(void)
void parallelRomClosed(void)
{
#ifdef HAVE_RDP_DUMP
rdp_dump_end();
#endif
}
int parallelRomOpen(void)
{
unsigned i;
char name[21] = "DEFAULT";
for (i = 0; i < 20; i++)
name[i] = gfx_info.HEADER[(32+i)^3];
name[20] = 0;
while (name[strlen(name)-1] == ' ')
name[strlen(name)-1] = 0;
RDP::set_scissor_variables(name);
return 1;
}
void parallelUpdateScreen(void)
{
VI::complete_frame();
RDP::complete_frame();
retro_return(true);
}
@@ -120,7 +93,7 @@ void parallelFBGetFrameBufferInfo(void *pinfo)
}
m64p_error parallelPluginGetVersion(m64p_plugin_type *PluginType, int *PluginVersion, int *APIVersion,
const char **PluginNamePtr, int *Capabilities)
const char **PluginNamePtr, int *Capabilities)
{
/* set version info */
if (PluginType != NULL)
@@ -133,7 +106,7 @@ m64p_error parallelPluginGetVersion(m64p_plugin_type *PluginType, int *PluginVer
*APIVersion = 0x020100;
if (PluginNamePtr != NULL)
*PluginNamePtr = "Tiny Tiger Vulkan LLE RDP Plugin";
*PluginNamePtr = "paraLLEl-RDP";
if (Capabilities != NULL)
*Capabilities = 0;
@@ -143,39 +116,38 @@ m64p_error parallelPluginGetVersion(m64p_plugin_type *PluginType, int *PluginVer
bool parallel_init(const struct retro_hw_render_interface_vulkan *vulkan)
{
RDP::vulkan = vulkan;
return RDP::init();
RDP::vulkan = vulkan;
return RDP::init();
}
void parallel_deinit()
{
RDP::deinit();
RDP::vulkan = nullptr;
RDP::deinit();
RDP::vulkan = nullptr;
}
unsigned parallel_frame_width()
{
return VI::width;
return RDP::width;
}
unsigned parallel_frame_height()
{
return VI::height;
return RDP::height;
}
bool parallel_frame_is_valid()
{
return VI::valid;
return true;
}
void parallel_begin_frame()
{
RDP::begin_frame();
RDP::begin_frame();
}
void parallel_set_dithering(unsigned type)
void parallel_set_synchronous_rdp(bool enable)
{
RDP::set_dithering(type);
RDP::synchronous = enable;
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef PARALLEL_H__
#define PARALLEL_H__
#include <vulkan/vulkan.h>
#include <volk.h>
#include <libretro.h>
#include <libretro_vulkan.h>
+153 -103
View File
@@ -7,34 +7,31 @@
using namespace Vulkan;
using namespace std;
extern "C" {
#include "rdp_dump.h"
}
extern retro_log_printf_t log_cb;
extern retro_environment_t environ_cb;
namespace RDP
{
const struct retro_hw_render_interface_vulkan *vulkan;
static char rom_name[21] = "DEFAULT";
static int cmd_cur;
static int cmd_ptr;
static uint32_t cmd_data[0x00040000 >> 2];
static bool rdp_sync;
static bool pending_scissor_height;
static uint64_t pending_timeline_value, timeline_value;
unique_ptr<Frontend> frontend;
unique_ptr<Renderer> renderer;
unique_ptr<CommandProcessor> frontend;
unique_ptr<Device> device;
unique_ptr<VulkanContext> context;
unique_ptr<Context> context;
static vector<retro_vulkan_image> retro_images;
static vector<ImageHandle> retro_image_handles;
unsigned width, height;
bool synchronous;
static const unsigned cmd_len_lut[64] = {
1, 1, 1, 1, 1, 1, 1, 1, 4, 6, 12, 14, 12, 14, 20, 22,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
};
@@ -95,14 +92,14 @@ void process_commands()
return;
}
frontend->command(command, &cmd_data[2 * cmd_cur]);
if (command >= 8)
frontend->enqueue_command(cmd_length * 2, &cmd_data[2 * cmd_cur]);
// sync_full
if (command == 0x29)
if (RDP::Op(command) == RDP::Op::SyncFull)
{
#ifdef ENABLE_LOGS
fprintf(stderr, "Signalling RDP IRQ\n");
#endif
// For synchronous RDP:
if (synchronous)
frontend->wait_for_timeline(frontend->signal_timeline());
*gfx_info.MI_INTR_REG |= DP_INTERRUPT;
gfx_info.CheckInterrupts();
}
@@ -115,94 +112,144 @@ void process_commands()
*GET_GFX_INFO(DPC_START_REG) = *GET_GFX_INFO(DPC_CURRENT_REG) = *GET_GFX_INFO(DPC_END_REG);
}
void set_dithering(unsigned type)
{
if (::RDP::renderer)
::RDP::renderer->set_dithering(type);
}
void begin_frame()
{
unsigned index = vulkan->get_sync_index(vulkan->handle);
vulkan->wait_sync_index(vulkan->handle);
// If number of sync indices changes, stall, and reinit per-frame
// data structures.
unsigned mask = vulkan->get_sync_index_mask(vulkan->handle);
unsigned frames = 0;
unsigned num_frames = 0;
for (unsigned i = 0; i < 32; i++)
if ((1u << i) & mask)
frames = i + 1;
if (mask & (1u << i))
num_frames = i + 1;
if (frames != device->get_num_frames())
if (num_frames != retro_images.size())
{
device->set_num_frames(frames);
device->begin_index(index);
renderer->begin_index(index);
::VI::set_num_frames(frames);
retro_images.resize(num_frames);
retro_image_handles.resize(num_frames);
}
device->begin_index(index);
renderer->begin_index(index);
vulkan->wait_sync_index(vulkan->handle);
frontend->begin_frame_context();
//frontend->wait_for_timeline(pending_timeline_value);
//pending_timeline_value = timeline_value;
}
bool init()
{
assert(vulkan);
if (!context)
{
Vulkan::VulkanContext::init_loader(vulkan->get_instance_proc_addr);
context = unique_ptr<VulkanContext>(
new VulkanContext(vulkan->instance, vulkan->gpu, vulkan->device, vulkan->queue, vulkan->queue_index));
}
if (!context || !vulkan)
return false;
unsigned mask = vulkan->get_sync_index_mask(vulkan->handle);
unsigned frames = 0;
unsigned num_frames = 0;
unsigned num_sync_frames = 0;
for (unsigned i = 0; i < 32; i++)
if ((1u << i) & mask)
frames = i + 1;
{
if (mask & (1u << i))
{
num_frames = i + 1;
num_sync_frames++;
}
}
device = unique_ptr<Device>(new Device(*context, frames));
renderer = unique_ptr<Renderer>(new Renderer(*device));
renderer->set_synchronous(rdp_sync);
frontend = unique_ptr<Frontend>(new Frontend);
frontend->set_renderer(renderer.get(), device.get());
renderer->set_rdram(DRAM, 8 * 1024 * 1024);
::VI::set_num_frames(frames);
retro_images.resize(num_frames);
retro_image_handles.resize(num_frames);
if (pending_scissor_height)
{
::RDP::renderer->set_scissor_variables(rom_name);
pending_scissor_height = false;
}
device.reset(new Device);
device->set_context(*context);
device->init_frame_contexts(num_sync_frames);
device->set_queue_lock(
[]() { vulkan->lock_queue(vulkan->handle); },
[]() { vulkan->unlock_queue(vulkan->handle); });
frontend.reset(new CommandProcessor(*device, gfx_info.RDRAM, 8 * 1024 * 1024, 4 * 1024 * 1024, 0));
timeline_value = 0;
pending_timeline_value = 0;
width = 0;
height = 0;
return true;
}
void deinit()
{
::VI::deinit();
retro_image_handles.clear();
retro_images.clear();
frontend.reset();
renderer.reset();
device.reset();
context.reset();
}
void set_scissor_variables(const char *name)
void complete_frame()
{
if (::RDP::renderer)
::RDP::renderer->set_scissor_variables(name);
else
{
unsigned i;
pending_scissor_height = true;
if (!frontend)
return;
for (i = 0; i < 20; i++)
rom_name[i] = name[i];
rom_name[20] = 0;
}
timeline_value = frontend->signal_timeline();
frontend->set_vi_register(VIRegister::Control, *GET_GFX_INFO(VI_STATUS_REG));
frontend->set_vi_register(VIRegister::Origin, *GET_GFX_INFO(VI_ORIGIN_REG));
frontend->set_vi_register(VIRegister::Width, *GET_GFX_INFO(VI_WIDTH_REG));
frontend->set_vi_register(VIRegister::Intr, *GET_GFX_INFO(VI_INTR_REG));
frontend->set_vi_register(VIRegister::VCurrentLine, *GET_GFX_INFO(VI_V_CURRENT_LINE_REG));
frontend->set_vi_register(VIRegister::Timing, *GET_GFX_INFO(VI_V_BURST_REG));
frontend->set_vi_register(VIRegister::VSync, *GET_GFX_INFO(VI_V_SYNC_REG));
frontend->set_vi_register(VIRegister::HSync, *GET_GFX_INFO(VI_H_SYNC_REG));
frontend->set_vi_register(VIRegister::Leap, *GET_GFX_INFO(VI_LEAP_REG));
frontend->set_vi_register(VIRegister::HStart, *GET_GFX_INFO(VI_H_START_REG));
frontend->set_vi_register(VIRegister::VStart, *GET_GFX_INFO(VI_V_START_REG));
frontend->set_vi_register(VIRegister::VBurst, *GET_GFX_INFO(VI_V_BURST_REG));
frontend->set_vi_register(VIRegister::XScale, *GET_GFX_INFO(VI_X_SCALE_REG));
frontend->set_vi_register(VIRegister::YScale, *GET_GFX_INFO(VI_Y_SCALE_REG));
auto image = frontend->scanout();
unsigned index = vulkan->get_sync_index(vulkan->handle);
if (!image)
{
auto info = Vulkan::ImageCreateInfo::immutable_2d_image(1, 1, VK_FORMAT_R8G8B8A8_UNORM);
info.usage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
VK_IMAGE_USAGE_TRANSFER_DST_BIT;
info.misc = IMAGE_MISC_MUTABLE_SRGB_BIT;
info.initial_layout = VK_IMAGE_LAYOUT_UNDEFINED;
image = device->create_image(info);
auto cmd = device->request_command_buffer();
cmd->image_barrier(*image,
VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0,
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT);
cmd->clear_image(*image, {});
cmd->image_barrier(*image,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT,
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT);
device->submit(cmd);
}
assert(index < retro_images.size());
retro_images[index].image_view = image->get_view().get_view();
retro_images[index].image_layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
retro_images[index].create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
retro_images[index].create_info.image = image->get_image();
retro_images[index].create_info.viewType = VK_IMAGE_VIEW_TYPE_2D;
retro_images[index].create_info.format = VK_FORMAT_R8G8B8A8_UNORM;
retro_images[index].create_info.subresourceRange.baseMipLevel = 0;
retro_images[index].create_info.subresourceRange.baseArrayLayer = 0;
retro_images[index].create_info.subresourceRange.levelCount = 1;
retro_images[index].create_info.subresourceRange.layerCount = 1;
retro_images[index].create_info.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
retro_images[index].create_info.components.r = VK_COMPONENT_SWIZZLE_R;
retro_images[index].create_info.components.g = VK_COMPONENT_SWIZZLE_G;
retro_images[index].create_info.components.b = VK_COMPONENT_SWIZZLE_B;
retro_images[index].create_info.components.a = VK_COMPONENT_SWIZZLE_A;
vulkan->set_image(vulkan->handle, &retro_images[index], 0, nullptr, VK_QUEUE_FAMILY_IGNORED);
width = image->get_width();
height = image->get_height();
retro_image_handles[index] = image;
device->flush_frame();
}
}
bool parallel_create_device(struct retro_vulkan_context *frontend_context, VkInstance instance, VkPhysicalDevice gpu,
@@ -211,39 +258,42 @@ bool parallel_create_device(struct retro_vulkan_context *frontend_context, VkIns
const char **required_device_layers, unsigned num_required_device_layers,
const VkPhysicalDeviceFeatures *required_features)
{
Vulkan::VulkanContext::init_loader(get_instance_proc_addr);
if (!Vulkan::Context::init_loader(get_instance_proc_addr))
return false;
try
{
::RDP::context = unique_ptr<VulkanContext>(
new VulkanContext(instance, gpu, surface, required_device_extensions, num_required_device_extensions,
required_device_layers, num_required_device_layers, required_features));
frontend_context->gpu = ::RDP::context->get_gpu();
frontend_context->device = ::RDP::context->get_device();
frontend_context->queue = ::RDP::context->get_alt_queue();
frontend_context->queue_family_index = ::RDP::context->get_alt_queue_family();
frontend_context->presentation_queue = ::RDP::context->get_alt_queue();
frontend_context->presentation_queue_family_index = ::RDP::context->get_alt_queue_family();
// Frontend owns the device.
::RDP::context->release_device();
return true;
}
catch (const std::exception &e)
::RDP::context.reset(new Vulkan::Context);
if (!::RDP::context->init_device_from_instance(
instance, gpu, surface, required_device_extensions, num_required_device_extensions,
required_device_layers, num_required_device_layers, required_features, Vulkan::CONTEXT_CREATION_DISABLE_BINDLESS_BIT))
{
::RDP::context.reset();
return false;
}
frontend_context->gpu = ::RDP::context->get_gpu();
frontend_context->device = ::RDP::context->get_device();
frontend_context->queue = ::RDP::context->get_graphics_queue();
frontend_context->queue_family_index = ::RDP::context->get_graphics_queue_family();
frontend_context->presentation_queue = ::RDP::context->get_graphics_queue();
frontend_context->presentation_queue_family_index = ::RDP::context->get_graphics_queue_family();
// Frontend owns the device.
::RDP::context->release_device();
return true;
}
static const VkApplicationInfo parallel_app_info = {
VK_STRUCTURE_TYPE_APPLICATION_INFO,
nullptr,
"paraLLEl-RDP",
0,
"Granite",
0,
VK_API_VERSION_1_1,
};
const VkApplicationInfo *parallel_get_application_info(void)
{
return &Vulkan::VulkanContext::get_application_info();
return &parallel_app_info;
}
void parallel_set_synchronous_rdp(bool enable)
{
if (::RDP::renderer)
::RDP::renderer->set_synchronous(enable);
::RDP::rdp_sync = enable;
}
+8 -15
View File
@@ -1,42 +1,35 @@
#ifndef PARALLEL_RDP_HPP
#define PARALLEL_RDP_HPP
#include "vulkan_headers.hpp"
#include <libretro.h>
#include <libretro_vulkan.h>
#include <memory>
#include <vector>
#include "rdp/frontend.hpp"
#include "rdp/rdp.hpp"
#include "rdp/vulkan.hpp"
#include "rdp/vulkan_util.hpp"
#include "rdp_device.hpp"
#include "context.hpp"
#include "device.hpp"
namespace RDP
{
bool init();
void deinit();
void begin_frame();
void set_dithering(unsigned type);
void process_commands();
void set_scissor_variables(const char *name);
extern const struct retro_hw_render_interface_vulkan *vulkan;
extern std::unique_ptr<Frontend> frontend;
extern std::unique_ptr<Renderer> renderer;
extern std::unique_ptr<Vulkan::Context> context;
extern std::unique_ptr<Vulkan::Device> device;
extern std::unique_ptr<Vulkan::VulkanContext> context;
extern unsigned parallel_dithering;
}
extern std::unique_ptr<CommandProcessor> frontend;
namespace VI
{
extern unsigned width;
extern unsigned height;
extern bool valid;
extern bool synchronous;
void complete_frame();
void set_num_frames(unsigned count);
void deinit();
}
@@ -1,164 +0,0 @@
# The style used for all options not specifically set in the configuration.
BasedOnStyle: LLVM
# The extra indent or outdent of access modifiers, e.g. public:.
AccessModifierOffset: -4
# If true, aligns escaped newlines as far left as possible. Otherwise puts them into the right-most column.
AlignEscapedNewlinesLeft: true
# If true, aligns trailing comments.
AlignTrailingComments: false
# Allow putting all parameters of a function declaration onto the next line even if BinPackParameters is false.
AllowAllParametersOfDeclarationOnNextLine: false
# Allows contracting simple braced statements to a single line.
AllowShortBlocksOnASingleLine: false
# If true, short case labels will be contracted to a single line.
AllowShortCaseLabelsOnASingleLine: false
# Dependent on the value, int f() { return 0; } can be put on a single line. Possible values: None, Inline, All.
AllowShortFunctionsOnASingleLine: None
# If true, if (a) return; can be put on a single line.
AllowShortIfStatementsOnASingleLine: false
# If true, while (true) continue; can be put on a single line.
AllowShortLoopsOnASingleLine: false
# If true, always break after function definition return types.
AlwaysBreakAfterDefinitionReturnType: false
# If true, always break before multiline string literals.
AlwaysBreakBeforeMultilineStrings: false
# If true, always break after the template<...> of a template declaration.
AlwaysBreakTemplateDeclarations: true
# If false, a function call's arguments will either be all on the same line or will have one line each.
BinPackArguments: true
# If false, a function declaration's or function definition's parameters will either all be on the same line
# or will have one line each.
BinPackParameters: true
# The way to wrap binary operators. Possible values: None, NonAssignment, All.
BreakBeforeBinaryOperators: None
# The brace breaking style to use. Possible values: Attach, Linux, Stroustrup, Allman, GNU.
BreakBeforeBraces: Allman
# If true, ternary operators will be placed after line breaks.
BreakBeforeTernaryOperators: false
# Always break constructor initializers before commas and align the commas with the colon.
BreakConstructorInitializersBeforeComma: true
# The column limit. A column limit of 0 means that there is no column limit.
ColumnLimit: 120
# A regular expression that describes comments with special meaning, which should not be split into lines or otherwise changed.
CommentPragmas: '^ *'
# If the constructor initializers don't fit on a line, put each initializer on its own line.
ConstructorInitializerAllOnOneLineOrOnePerLine: false
# The number of characters to use for indentation of constructor initializer lists.
ConstructorInitializerIndentWidth: 4
# Indent width for line continuations.
ContinuationIndentWidth: 4
# If true, format braced lists as best suited for C++11 braced lists.
Cpp11BracedListStyle: false
# Disables formatting at all.
DisableFormat: false
# A vector of macros that should be interpreted as foreach loops instead of as function calls.
#ForEachMacros: ''
# Indent case labels one level from the switch statement.
# When false, use the same indentation level as for the switch statement.
# Switch statement body is always indented one level more than case labels.
IndentCaseLabels: false
# The number of columns to use for indentation.
IndentWidth: 4
# Indent if a function definition or declaration is wrapped after the type.
IndentWrappedFunctionNames: false
# If true, empty lines at the start of blocks are kept.
KeepEmptyLinesAtTheStartOfBlocks: true
# Language, this format style is targeted at. Possible values: None, Cpp, Java, JavaScript, Proto.
Language: Cpp
# The maximum number of consecutive empty lines to keep.
MaxEmptyLinesToKeep: 1
# The indentation used for namespaces. Possible values: None, Inner, All.
NamespaceIndentation: None
# The penalty for breaking a function call after "call(".
PenaltyBreakBeforeFirstCallParameter: 19
# The penalty for each line break introduced inside a comment.
PenaltyBreakComment: 300
# The penalty for breaking before the first <<.
PenaltyBreakFirstLessLess: 120
# The penalty for each line break introduced inside a string literal.
PenaltyBreakString: 1000
# The penalty for each character outside of the column limit.
PenaltyExcessCharacter: 1000000
# Penalty for putting the return type of a function onto its own line.
PenaltyReturnTypeOnItsOwnLine: 1000000000
# Pointer and reference alignment style. Possible values: Left, Right, Middle.
PointerAlignment: Right
# If true, a space may be inserted after C style casts.
SpaceAfterCStyleCast: false
# If false, spaces will be removed before assignment operators.
SpaceBeforeAssignmentOperators: true
# Defines in which cases to put a space before opening parentheses. Possible values: Never, ControlStatements, Always.
SpaceBeforeParens: ControlStatements
# If true, spaces may be inserted into '()'.
SpaceInEmptyParentheses: false
# The number of spaces before trailing line comments (// - comments).
SpacesBeforeTrailingComments: 1
# If true, spaces will be inserted after '<' and before '>' in template argument lists.
SpacesInAngles: false
# If true, spaces may be inserted into C style casts.
SpacesInCStyleCastParentheses: false
# If true, spaces are inserted inside container literals (e.g. ObjC and Javascript array and dict literals).
SpacesInContainerLiterals: false
# If true, spaces will be inserted after '(' and before ')'.
SpacesInParentheses: false
# If true, spaces will be inserted after '[' and befor']'.
SpacesInSquareBrackets: false
# Format compatible with this standard, e.g. use A<A<int> > instead of A<A<int>> for LS_Cpp03. Possible values: Cpp03, Cpp11, Auto.
Standard: Cpp11
# The number of columns used for tab stops.
TabWidth: 4
# The way to use tab characters in the resulting file. Possible values: Never, ForIndentation, Always.
UseTab: ForIndentation
-57
View File
@@ -1,57 +0,0 @@
TARGET := rdp-test
SOURCES := $(wildcard *.cpp)
OBJECTS := $(SOURCES:.cpp=.o)
DEPS := $(OBJECTS:.o=.d)
#CXX := clang++
ifneq ($(findstring Haiku,$(shell uname -s)),)
CXXFLAGS += -std=c++11 -lroot
LDFLAGS += -L. -ldl -lroot
else
CXXFLAGS += -std=c++11 -pthread
LDFLAGS += -L. -ldl -pthread
endif
CXXFLAGS += -Wall -Wextra \
-Wno-shift-negative-value \
-Wno-missing-field-initializers -Wno-unused-function \
-fno-strict-overflow -g -I. -I../../libretro-common/include \
-DPARALLEL_HAVE_DYLIB
DEBUG = 0
ifeq ($(DEBUG), 1)
CXXFLAGS += -O0
CXXFLAGS += -DVULKAN_DEBUG
else
CXXFLAGS += -O2
endif
ifeq ($(SANITIZE), 1)
CXXFLAGS += -fsanitize=address
LDFLAGS += -fsanitize=address
endif
build-glsl:
$(MAKE) -C glsl
all: build-glsl build
build:
$(MAKE) rdp-test -C.
$(TARGET): $(OBJECTS)
$(CXX) -o $@ $(OBJECTS) $(LDFLAGS)
-include $(DEPS)
%.o: %.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS) -MMD
clean:
rm -f $(OBJECTS) $(TARGET) $(DEPS)
$(MAKE) -C glsl clean
.PHONY: all clean
-157
View File
@@ -1,157 +0,0 @@
#ifndef RDP_COMMON_HPP
#define RDP_COMMON_HPP
#include "vulkan_util.hpp"
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <time.h>
/* Little endian only. */
#define U16_FLIP 2
#define U8_FLIP 3
/* This should probably depend on whether or not we have expansion slot installed, but AFAIK
* mupen doesn't expose this information, so just always assume 8 MiB. */
#define RDRAM_SIZE 0x800000
#define RDRAM_MASK_8 (RDRAM_SIZE - 1)
#define RDRAM_MASK_16 (RDRAM_SIZE - 2)
#define RDRAM_MASK_32 (RDRAM_SIZE - 4)
#define WRAP_ADDR(addr) ((addr)&RDRAM_MASK_8)
#define READ_DRAM_U32(base, addr) (*reinterpret_cast<const uint32_t *>(base + ((addr)&RDRAM_MASK_32)))
#define READ_DRAM_U32_NOWRAP(base, addr) (*reinterpret_cast<const uint32_t *>(base + (addr)))
#define READ_DRAM_U16(base, addr) (*reinterpret_cast<const uint16_t *>(base + (((addr) ^ U16_FLIP) & RDRAM_MASK_16)))
#define READ_DRAM_U16_NOWRAP(base, addr) (*reinterpret_cast<const uint16_t *>(base + ((addr) ^ U16_FLIP)))
#define READ_DRAM_U8(base, addr) (*reinterpret_cast<const uint8_t *>(base + (((addr) ^ U8_FLIP) & RDRAM_MASK_8)))
#define READ_DRAM_U8_NOWRAP(base, addr) (*reinterpret_cast<const uint8_t *>(base + ((addr) ^ U8_FLIP)))
#define WRITE_DRAM_U32(base, addr, v) ((*reinterpret_cast<uint32_t *>(base + ((addr)&RDRAM_MASK_8))) = v)
#define WRITE_DRAM_U32_NOWRAP(base, addr, v) ((*reinterpret_cast<uint32_t *>(base + (addr))) = v)
#define WRITE_DRAM_U16(base, addr, v) ((*reinterpret_cast<uint16_t *>(base + (((addr) ^ U16_FLIP) & RDRAM_MASK_16))) = v)
#define WRITE_DRAM_U16_NOWRAP(base, addr, v) ((*reinterpret_cast<uint16_t *>(base + ((addr) ^ U16_FLIP))) = v)
#define WRITE_DRAM_U8(base, addr, v) ((*reinterpret_cast<uint8_t *>(base + (((addr) ^ U8_FLIP) & RDRAM_MASK_8))) = v)
#define WRITE_DRAM_U8_NOWRAP(base, addr, v) ((*reinterpret_cast<uint8_t *>(base + (((addr) ^ U8_FLIP)))) = v)
static inline uint64_t hash64(const void *data_, size_t size)
{
/* FNV-1. */
size_t i;
const uint8_t *data = static_cast<const uint8_t *>(data_);
uint64_t h = 0xcbf29ce484222325ull;
for (i = 0; i < size; i++)
h = (h * 0x100000001b3ull) ^ data[i];
return h;
}
static inline uint32_t next_pow2(uint32_t v)
{
v--;
v |= v >> 16;
v |= v >> 8;
v |= v >> 4;
v |= v >> 2;
v |= v >> 1;
return v + 1;
}
#if defined(_MSC_VER)
#define CLOCK_MONOTONIC 0
#if _MSC_VER < 1910
struct timespec { long tv_sec; long tv_nsec; }; //header part
#else
#define NOMINMAX
#endif
#include <Windows.h>
int clock_gettime(int, struct timespec *spec) //C-file part
{ __int64 wintime; GetSystemTimeAsFileTime((FILETIME*)&wintime);
wintime -=116444736000000000i64; //1jan1601 to 1jan1970
spec->tv_sec =wintime / 10000000i64; //seconds
spec->tv_nsec =wintime % 10000000i64 *100; //nano-seconds
return 0;
}
#endif
static inline double gettime()
{
timespec tv;
clock_gettime(CLOCK_MONOTONIC, &tv);
return tv.tv_sec + 1e-9 * tv.tv_nsec;
}
namespace RDP
{
enum CycleType
{
CYCLE_TYPE_1 = 0,
CYCLE_TYPE_2 = 1,
CYCLE_TYPE_COPY = 2,
CYCLE_TYPE_FILL = 3
};
enum FramebufferState
{
/* The color or depth image is up-to-date in RDRAM, the GPU does not need to see our RDRAM buffer yet. */
FRAMEBUFFER_CPU = 0,
/* The color or depth image has registered an access to RDRAM, we need to copy RDRAM over to GPU here. */
FRAMEBUFFER_STALE_GPU = 1,
/* The color or depth image has been written to on GPU and needs to be synced back to RDRAM. */
FRAMEBUFFER_GPU = 2
};
struct Framebuffer
{
uint32_t addr = 0;
uint32_t depth_addr = 0;
unsigned width = 0;
unsigned format = 0;
unsigned pixel_size = 0;
unsigned allocated_width = 0;
unsigned allocated_height = 0;
FramebufferState color_state = FRAMEBUFFER_CPU;
FramebufferState depth_state = FRAMEBUFFER_CPU;
inline uint32_t bytes_to_pixels(uint32_t bytes) const
{
assert(pixel_size > 0);
return bytes >> (pixel_size - 1);
}
inline uint32_t color_size() const
{
if (color_state != FRAMEBUFFER_CPU)
{
uint32_t size = allocated_width * allocated_height;
assert(pixel_size > 0);
return size << (pixel_size - 1);
}
return 0;
}
inline uint32_t depth_size() const
{
if (depth_state != FRAMEBUFFER_CPU)
{
uint32_t size = allocated_width * allocated_height;
return size << 1;
}
return 0;
}
};
struct AsyncFramebuffer
{
Framebuffer framebuffer;
Vulkan::Buffer color_buffer;
Vulkan::Buffer depth_buffer;
Vulkan::Fence fence;
unsigned sync_index;
};
}
#endif
@@ -1,7 +0,0 @@
#!/bin/bash
for file in *.{cpp,hpp}
do
echo "Formatting file: $file ..."
clang-format -style=file -i $file
done
-764
View File
@@ -1,764 +0,0 @@
#include "frontend.hpp"
#include <assert.h>
#include <string.h>
using namespace std;
namespace RDP
{
static int32_t minimum(int32_t x0, int32_t x1, int32_t x2, int32_t x3, int32_t x4, int32_t x5)
{
x0 = min(x0, x1);
x2 = min(x2, x3);
x4 = min(x4, x5);
x0 = min(x0, x2);
return min(x0, x4);
}
static int32_t maximum(int32_t x0, int32_t x1, int32_t x2, int32_t x3, int32_t x4, int32_t x5)
{
x0 = max(x0, x1);
x2 = max(x2, x3);
x4 = max(x4, x5);
x0 = max(x0, x2);
return max(x0, x4);
}
void Frontend::invalid(const uint32_t *)
{
#ifndef ANDROID
abort();
#endif
}
void Frontend::noop(const uint32_t *)
{
}
void Frontend::tri_fill_tex_coeffs(Attribute *attr, const uint32_t *args)
{
attr->stwz[0] = ((args[0] << 0) & 0xffff0000u) | ((args[4] >> 16) & 0xffffu);
attr->stwz[1] = ((args[0] << 16) & 0xffff0000u) | ((args[4] >> 0) & 0xffffu);
attr->stwz[2] = ((args[1] << 0) & 0xffff0000u) | ((args[5] >> 16) & 0xffffu);
attr->d_stwz_dx[0] = ((args[2] << 0) & 0xffff0000u) | ((args[6] >> 16) & 0xffffu);
attr->d_stwz_dx[1] = ((args[2] << 16) & 0xffff0000u) | ((args[6] >> 0) & 0xffffu);
attr->d_stwz_dx[2] = ((args[3] << 0) & 0xffff0000u) | ((args[7] >> 16) & 0xffffu);
attr->d_stwz_de[0] = ((args[8] << 0) & 0xffff0000u) | ((args[12] >> 16) & 0xffffu);
attr->d_stwz_de[1] = ((args[8] << 16) & 0xffff0000u) | ((args[12] >> 0) & 0xffffu);
attr->d_stwz_de[2] = ((args[9] << 0) & 0xffff0000u) | ((args[13] >> 16) & 0xffffu);
attr->d_stwz_dy[0] = ((args[10] << 0) & 0xffff0000u) | ((args[14] >> 16) & 0xffffu);
attr->d_stwz_dy[1] = ((args[10] << 16) & 0xffff0000u) | ((args[14] >> 0) & 0xffffu);
attr->d_stwz_dy[2] = ((args[11] << 0) & 0xffff0000u) | ((args[15] >> 16) & 0xffffu);
}
void Frontend::tri_fill_z_coeffs(Attribute *attr, const uint32_t *args)
{
attr->stwz[3] = args[0];
attr->d_stwz_dx[3] = args[1];
attr->d_stwz_de[3] = args[2];
attr->d_stwz_dy[3] = args[3];
}
void Frontend::tri_fill_shade_coeffs(Attribute *attr, const uint32_t *args)
{
attr->rgba[0] = ((args[0] << 0) & 0xffff0000u) | ((args[4] >> 16) & 0xffffu);
attr->rgba[1] = ((args[0] << 16) & 0xffff0000u) | ((args[4] >> 0) & 0xffffu);
attr->rgba[2] = ((args[1] << 0) & 0xffff0000u) | ((args[5] >> 16) & 0xffffu);
attr->rgba[3] = ((args[1] << 16) & 0xffff0000u) | ((args[5] >> 0) & 0xffffu);
attr->d_rgba_dx[0] = ((args[2] << 0) & 0xffff0000u) | ((args[6] >> 16) & 0xffffu);
attr->d_rgba_dx[1] = ((args[2] << 16) & 0xffff0000u) | ((args[6] >> 0) & 0xffffu);
attr->d_rgba_dx[2] = ((args[3] << 0) & 0xffff0000u) | ((args[7] >> 16) & 0xffffu);
attr->d_rgba_dx[3] = ((args[3] << 16) & 0xffff0000u) | ((args[7] >> 0) & 0xffffu);
attr->d_rgba_de[0] = ((args[8] << 0) & 0xffff0000u) | ((args[12] >> 16) & 0xffffu);
attr->d_rgba_de[1] = ((args[8] << 16) & 0xffff0000u) | ((args[12] >> 0) & 0xffffu);
attr->d_rgba_de[2] = ((args[9] << 0) & 0xffff0000u) | ((args[13] >> 16) & 0xffffu);
attr->d_rgba_de[3] = ((args[9] << 16) & 0xffff0000u) | ((args[13] >> 0) & 0xffffu);
attr->d_rgba_dy[0] = ((args[10] << 0) & 0xffff0000u) | ((args[14] >> 16) & 0xffffu);
attr->d_rgba_dy[1] = ((args[10] << 16) & 0xffff0000u) | ((args[14] >> 0) & 0xffffu);
attr->d_rgba_dy[2] = ((args[11] << 0) & 0xffff0000u) | ((args[15] >> 16) & 0xffffu);
attr->d_rgba_dy[3] = ((args[11] << 16) & 0xffff0000u) | ((args[15] >> 0) & 0xffffu);
}
void Frontend::tri_fill_coeffs(Primitive *prim, const uint32_t *args, int32_t *xmin, int32_t *xmax)
{
uint32_t right_major = (args[0] >> (55 - 32)) & 1;
/* 11.2 fixed point */
int32_t yl = SEXT((args[0] >> 0) & 0xffff, 14);
int32_t ym = SEXT((args[1] >> 16) & 0xffff, 14);
int32_t yh = SEXT((args[1] >> 0) & 0xffff, 14);
/* 14.16 fixed point */
int32_t xl = SEXT(args[2], 30) & ~1;
int32_t xh = SEXT(args[4], 30) & ~1;
int32_t xm = SEXT(args[6], 30) & ~1;
/* 16.16 fixed point. */
int32_t DxLDy = (int32_t(args[3]) >> 2) & ~1;
int32_t DxHDy = (int32_t(args[5]) >> 2) & ~1;
int32_t DxMDy = (int32_t(args[7]) >> 2) & ~1;
// Compute screen space bounding box for primitive.
// Find all possible X edges.
//
// Should take into account scissor box as well perhaps to get tighter X box,
// but if we have scissor, the extra scissor clip in draw_primitive might do a good job ...
//
// FIXME: Can we have overflow here?
//
// Major slope
int32_t x0 = xh;
int32_t x1 = xh + (yl - (yh & ~3)) * DxHDy;
// Upper minor slope.
int32_t x2 = xm;
int32_t x3 = xm + (ym - (yh & ~3)) * DxMDy;
// Lower minor slope.
int32_t x4 = xl;
int32_t x5 = xl + (yl - ym) * DxLDy;
*xmin = minimum(x0, x1, x2, x3, x4, x5) >> 16;
*xmax = maximum(x0, x1, x2, x3, x4, x5) >> 16;
prim->xl = xl;
prim->xm = xm;
prim->xh = xh;
prim->yl = yl;
prim->ym = ym;
prim->yh = yh;
prim->DxLDy = DxLDy;
prim->DxHDy = DxHDy;
prim->DxMDy = DxMDy;
prim->flags = right_major ? RDP_FLAG_FLIP : 0;
}
void Frontend::tri_fill_flags_common(Primitive *prim)
{
prim->flags |= other_modes.cycle_type << RDP_FLAG_CYCLE_TYPE_SHIFT;
prim->flags |= other_modes.cvg_dest << RDP_FLAG_CVG_MODE_SHIFT;
prim->flags |= other_modes.force_blend ? RDP_FLAG_FORCE_BLEND : 0;
prim->flags |= other_modes.antialias_en ? RDP_FLAG_AA_ENABLE : 0;
prim->flags |= other_modes.alpha_compare_en ? RDP_FLAG_ALPHATEST : 0;
prim->flags |= other_modes.dither_alpha_en ? RDP_FLAG_ALPHA_NOISE : 0;
prim->flags |= other_modes.color_on_cvg ? RDP_FLAG_COLOR_ON_CVG : 0;
prim->flags |= other_modes.cvg_times_alpha ? RDP_FLAG_CVG_TIMES_ALPHA : 0;
prim->flags |= other_modes.alpha_cvg_select ? RDP_FLAG_ALPHA_CVG_SELECT : 0;
prim->flags |= other_modes.z_update_en ? RDP_FLAG_Z_UPDATE : 0;
prim->flags |= other_modes.z_compare_en ? RDP_FLAG_Z_COMPARE : 0;
prim->flags |= other_modes.z_mode << RDP_FLAG_Z_MODE_SHIFT;
if (other_modes.sample_type)
{
prim->flags |= other_modes.bi_lerp0 ? RDP_FLAG_BILERP0 : 0;
prim->flags |= other_modes.bi_lerp1 ? RDP_FLAG_BILERP1 : 0;
}
if (other_modes.persp_tex_en && (other_modes.cycle_type == CYCLE_TYPE_1 || other_modes.cycle_type == CYCLE_TYPE_2))
prim->flags |= RDP_FLAG_PERSPECTIVE;
}
void Frontend::tri_fill_tile(Primitive *prim, uint32_t *tile_mask, uint32_t mips, uint32_t tile)
{
// This should depend on whether or not we'll need the second tile in the combiner.
if (!other_modes.tex_lod_en)
{
if (other_modes.cycle_type == CYCLE_TYPE_2)
{
mips = renderer->combiner_reads_secondary_tile(0) || renderer->combiner_reads_secondary_tile(1) ? 2 : 1;
//renderer->log_combiner();
}
else if (other_modes.cycle_type == CYCLE_TYPE_1)
{
mips = 1;
//mips = renderer->combiner_reads_secondary_tile(1) ? 2 : 1;
//renderer->log_combiner();
}
}
else
{
prim->flags |= RDP_FLAG_SAMPLE_TEX_LOD;
// Detail mip-chains have an extra LOD level.
if (other_modes.detail_tex_en)
mips = min(mips + 1u, 8u);
}
if (other_modes.cycle_type == CYCLE_TYPE_2)
{
bool pipelined = renderer->combiner_reads_pipelined_tile();
//if (pipelined)
// fprintf(stderr, "PIPELINED!\n");
prim->flags |= pipelined ? RDP_FLAG_SAMPLE_TEX_PIPELINED : 0;
}
//fprintf(stderr, "Cycle mode: %u, Mips: %u\n", other_modes.cycle_type, mips);
*tile_mask = 0;
for (unsigned i = 0; i < mips; i++)
*tile_mask |= 1 << ((tile + i) & 7);
prim->flags |= RDP_FLAG_SAMPLE_TEX;
prim->flags |= tile << RDP_FLAG_TILE_SHIFT;
prim->flags |= (mips - 1) << RDP_FLAG_LEVELS_SHIFT;
}
void Frontend::tri_fill_novarying_tile(Primitive *prim, Attribute *attr, uint32_t *tile_mask)
{
/* It is possible for some bizarro reason to read a texture
* even though we don't have varyings for it.
*
* In this case, we end up passing down 0
* for s, t and w. To work around this,
* we just enable sampling. */
tri_fill_tile(prim, tile_mask, 1, 0);
/* Make sure attributes are cleared to zero. */
if (attr)
{
unsigned i;
for (i = 0; i < 3; i++)
{
attr->stwz[i] = 0;
attr->d_stwz_dx[i] = 0;
attr->d_stwz_dy[i] = 0;
attr->d_stwz_de[i] = 0;
}
}
}
void Frontend::tri_fill_flags(Primitive *prim, const uint32_t *args, uint32_t *tile_mask, bool zbuffer, bool shade)
{
if (tile_mask)
{
uint32_t mips = (args[0] & 0x00380000) >> (51 - 32);
uint32_t tile = (args[0] & 0x00070000) >> (48 - 32);
mips++;
tri_fill_tile(prim, tile_mask, mips, tile);
}
tri_fill_flags_common(prim);
prim->flags |= zbuffer && !other_modes.z_source_sel ? RDP_FLAG_INTERPOLATE_Z : 0;
prim->flags |= shade ? RDP_FLAG_SHADE : 0;
}
void Frontend::tri_noshade(const uint32_t *args)
{
int xmin, xmax;
Primitive prim;
uint32_t tile_mask = 0;
tri_fill_coeffs(&prim, args, &xmin, &xmax);
tri_fill_flags(&prim, args, nullptr, false, false);
if (renderer->combiner_reads_tile(static_cast<CycleType>(other_modes.cycle_type)))
tri_fill_novarying_tile(&prim, nullptr, &tile_mask);
renderer->draw_primitive(prim, nullptr, tile_mask, xmin, xmax, prim.yh >> 2, prim.yl >> 2);
}
void Frontend::tri_noshade_z(const uint32_t *args)
{
int xmin, xmax;
Primitive prim;
Attribute attr;
uint32_t tile_mask = 0;
tri_fill_coeffs(&prim, args, &xmin, &xmax);
tri_fill_z_coeffs(&attr, args + 8);
tri_fill_flags(&prim, args, nullptr, true, false);
if (renderer->combiner_reads_tile(static_cast<CycleType>(other_modes.cycle_type)))
tri_fill_novarying_tile(&prim, &attr, &tile_mask);
renderer->draw_primitive(prim, &attr, tile_mask, xmin, xmax, prim.yh >> 2, prim.yl >> 2);
}
void Frontend::tri_tex(const uint32_t *args)
{
int xmin, xmax;
Primitive prim;
Attribute attr;
uint32_t tile_mask = 0;
tri_fill_coeffs(&prim, args, &xmin, &xmax);
tri_fill_tex_coeffs(&attr, args + 8);
tri_fill_flags(&prim, args, &tile_mask, false, false);
renderer->draw_primitive(prim, &attr, tile_mask, xmin, xmax, prim.yh >> 2, prim.yl >> 2);
}
void Frontend::tri_tex_z(const uint32_t *args)
{
int xmin, xmax;
uint32_t tile_mask;
Primitive prim;
Attribute attr;
tri_fill_coeffs(&prim, args, &xmin, &xmax);
tri_fill_tex_coeffs(&attr, args + 8);
tri_fill_z_coeffs(&attr, args + 24);
tri_fill_flags(&prim, args, &tile_mask, true, false);
renderer->draw_primitive(prim, &attr, tile_mask, xmin, xmax, prim.yh >> 2, prim.yl >> 2);
}
void Frontend::tri_shade(const uint32_t *args)
{
int xmin, xmax;
Primitive prim;
Attribute attr;
uint32_t tile_mask = 0;
tri_fill_coeffs(&prim, args, &xmin, &xmax);
tri_fill_shade_coeffs(&attr, args + 8);
tri_fill_flags(&prim, args, nullptr, false, true);
if (renderer->combiner_reads_tile(static_cast<CycleType>(other_modes.cycle_type)))
tri_fill_novarying_tile(&prim, &attr, &tile_mask);
renderer->draw_primitive(prim, &attr, tile_mask, xmin, xmax, prim.yh >> 2, prim.yl >> 2);
}
void Frontend::tri_shade_z(const uint32_t *args)
{
int xmin, xmax;
Primitive prim;
Attribute attr;
uint32_t tile_mask = 0;
tri_fill_coeffs(&prim, args, &xmin, &xmax);
tri_fill_shade_coeffs(&attr, args + 8);
tri_fill_z_coeffs(&attr, args + 24);
tri_fill_flags(&prim, args, nullptr, true, true);
if (renderer->combiner_reads_tile(static_cast<CycleType>(other_modes.cycle_type)))
tri_fill_novarying_tile(&prim, &attr, &tile_mask);
renderer->draw_primitive(prim, &attr, tile_mask, xmin, xmax, prim.yh >> 2, prim.yl >> 2);
}
void Frontend::tri_shade_tex(const uint32_t *args)
{
int xmin, xmax;
uint32_t tile_mask;
Primitive prim;
Attribute attr;
tri_fill_coeffs(&prim, args, &xmin, &xmax);
tri_fill_shade_coeffs(&attr, args + 8);
tri_fill_tex_coeffs(&attr, args + 24);
tri_fill_flags(&prim, args, &tile_mask, false, true);
renderer->draw_primitive(prim, &attr, tile_mask, xmin, xmax, prim.yh >> 2, prim.yl >> 2);
}
void Frontend::tri_shade_tex_z(const uint32_t *args)
{
int xmin, xmax;
uint32_t tile_mask;
Primitive prim;
Attribute attr;
tri_fill_coeffs(&prim, args, &xmin, &xmax);
tri_fill_shade_coeffs(&attr, args + 8);
tri_fill_tex_coeffs(&attr, args + 24);
tri_fill_z_coeffs(&attr, args + 40);
tri_fill_flags(&prim, args, &tile_mask, true, true);
renderer->draw_primitive(prim, &attr, tile_mask, xmin, xmax, prim.yh >> 2, prim.yl >> 2);
}
void Frontend::tex_rect_common(const uint32_t *args, bool flipped)
{
Primitive prim;
Attribute attr;
int32_t s, t, dsdx, dtdy;
uint32_t tile_mask = 0;
int xl = (args[0] & 0xfff000u) >> (44 - 32);
int yl = (args[0] & 0x000fffu) >> (32 - 32);
unsigned tile = (args[1] & 0x07000000) >> 24;
int xh = (args[1] & 0xfff000u) >> (12 - 0);
int yh = (args[1] & 0x000fffu) >> (0 - 0);
int xmin = xh >> 2;
int xmax = xl >> 2;
/* Convert qpel to 16.16 fixed point format. */
xl <<= 14;
xh <<= 14;
yl |= (other_modes.cycle_type & 2) ? 3 : 0; // FILL or COPY.
prim.xl = xl;
prim.xm = xl;
prim.xh = xh;
prim.yl = yl;
prim.ym = yl;
prim.yh = yh;
// Rect, so keep these as 0.
prim.DxLDy = 0;
prim.DxHDy = 0;
prim.DxMDy = 0;
prim.flags = RDP_FLAG_FLIP;
memset(&attr, 0, sizeof(attr));
s = SEXT((args[2] & 0xffff0000u) >> 16, 16);
t = SEXT((args[2] & 0x0000ffffu) >> 0, 16);
dsdx = SEXT((args[3] & 0xffff0000u) >> 16, 16);
dtdy = SEXT((args[3] & 0x0000ffffu) >> 0, 16);
if (flipped)
{
attr.stwz[0] = s << 16;
attr.stwz[1] = t << 16;
attr.d_stwz_dx[1] = dtdy << 11;
attr.d_stwz_de[0] = dsdx << 11;
attr.d_stwz_dy[0] = dsdx << 11;
}
else
{
attr.stwz[0] = s << 16;
attr.stwz[1] = t << 16;
attr.d_stwz_dx[0] = dsdx << 11;
attr.d_stwz_de[1] = dtdy << 11;
attr.d_stwz_dy[1] = dtdy << 11;
}
tri_fill_flags(&prim, args, nullptr, false, false);
tri_fill_tile(&prim, &tile_mask, 1, tile);
if (other_modes.cycle_type == CYCLE_TYPE_COPY)
{
/* No texture filtering allowed in copy mode. */
prim.flags &= ~RDP_FLAG_BILERP0;
prim.flags &= ~RDP_FLAG_BILERP1;
// Copy mode jumps 4 pixels at a time, so instead of implementing that, just shift dSdx by 2 instead.
// Technically, very awkward use of texture rectangle can break this, but we'll deal with it if needed.
attr.d_stwz_dx[0] >>= 2;
}
renderer->draw_primitive(prim, &attr, tile_mask, xmin, xmax, yh >> 2, yl >> 2);
}
void Frontend::tex_rect(const uint32_t *args)
{
tex_rect_common(args, false);
}
void Frontend::tex_rect_flip(const uint32_t *args)
{
tex_rect_common(args, true);
}
void Frontend::set_key_gb(const uint32_t *args)
{
renderer->set_key_gb(args[0], args[1]);
}
void Frontend::set_key_r(const uint32_t *args)
{
renderer->set_key_r(args[0], args[1]);
}
void Frontend::sync_load(const uint32_t *)
{
}
void Frontend::sync_pipe(const uint32_t *)
{
}
void Frontend::sync_tile(const uint32_t *)
{
}
void Frontend::sync_full(const uint32_t *)
{
renderer->complete_frame();
}
void Frontend::fill_rect(const uint32_t *args)
{
Primitive prim;
int xl = (args[0] & 0xfff000u) >> (44 - 32);
int yl = (args[0] & 0x000fffu) >> (32 - 32);
int xh = (args[1] & 0xfff000u) >> (12 - 0);
int yh = (args[1] & 0x000fffu) >> (0 - 0);
int xmin = xh >> 2;
int xmax = xl >> 2;
// Convert qpel to 16.16 fixed point format.
xl <<= 14;
xh <<= 14;
yl |= (other_modes.cycle_type & 2) ? 3 : 0; // FILL or COPY.
prim.xl = xl;
prim.xm = xl;
prim.xh = xh;
prim.yl = yl;
prim.ym = yl;
prim.yh = yh;
// Rect, so keep these as 0.
prim.DxLDy = 0;
prim.DxHDy = 0;
prim.DxMDy = 0;
prim.flags = RDP_FLAG_FLIP;
tri_fill_flags(&prim, args, nullptr, false, false);
renderer->draw_primitive(prim, nullptr, 0, xmin, xmax, yh >> 2, yl >> 2);
}
void Frontend::set_other_modes(const uint32_t *args)
{
other_modes.cycle_type = (args[0] & 0x00300000) >> (52 - 32);
other_modes.persp_tex_en = !!(args[0] & 0x00080000);
other_modes.detail_tex_en = !!(args[0] & 0x00040000);
other_modes.sharpen_tex_en = !!(args[0] & 0x00020000);
other_modes.tex_lod_en = !!(args[0] & 0x00010000);
other_modes.en_tlut = !!(args[0] & 0x00008000);
other_modes.tlut_type = !!(args[0] & 0x00004000);
other_modes.sample_type = !!(args[0] & 0x00002000);
other_modes.mid_texel = !!(args[0] & 0x00001000);
other_modes.bi_lerp0 = !!(args[0] & 0x00000800);
other_modes.bi_lerp1 = !!(args[0] & 0x00000400);
other_modes.convert_one = !!(args[0] & 0x00000200);
other_modes.key_en = !!(args[0] & 0x00000100);
other_modes.rgb_dither_sel = (args[0] & 0x000000C0) >> (36 - 32);
other_modes.alpha_dither_sel = (args[0] & 0x00000030) >> (36 - 32);
other_modes.force_blend = !!(args[1] & 0x00004000);
other_modes.alpha_cvg_select = !!(args[1] & 0x00002000);
other_modes.cvg_times_alpha = !!(args[1] & 0x00001000);
other_modes.z_mode = (args[1] & 0x00000c00) >> (10 - 0);
other_modes.cvg_dest = (args[1] & 0x00000300) >> (8 - 0);
other_modes.color_on_cvg = !!(args[1] & 0x00000080);
other_modes.image_read_en = !!(args[1] & 0x00000040);
other_modes.z_update_en = !!(args[1] & 0x00000020);
other_modes.z_compare_en = !!(args[1] & 0x00000010);
other_modes.antialias_en = !!(args[1] & 0x00000008);
other_modes.z_source_sel = !!(args[1] & 0x00000004);
other_modes.dither_alpha_en = !!(args[1] & 0x00000002);
other_modes.alpha_compare_en = !!(args[1] & 0x00000001);
renderer->set_lod_modes(other_modes.detail_tex_en, other_modes.sharpen_tex_en);
uint32_t blendword = (args[1] >> 16) & 0xffff;
/* memory_color in cycle 0 makes no sense. */
if (other_modes.cycle_type == CYCLE_TYPE_2)
assert(((blendword >> 14) & 3) != 1);
renderer->get_tmem().set_enable_tlut(other_modes.en_tlut);
renderer->get_tmem().set_tlut_type(other_modes.tlut_type);
renderer->set_blend_word(blendword, other_modes.alpha_dither_sel);
}
void Frontend::set_combine(const uint32_t *args)
{
renderer->set_combine(args[0], args[1]);
}
void Frontend::set_convert(const uint32_t *args)
{
renderer->set_convert(args[0], args[1]);
}
void Frontend::set_scissor(const uint32_t *args)
{
int xh = (args[0] & 0x00fff000) >> (44 - 32);
int yh = (args[0] & 0x00000fff) >> (32 - 32);
// TODO: Interlacing
int xl = (args[1] & 0x00fff000) >> (12 - 0);
int yl = (args[1] & 0x00000fff) >> (0 - 0);
renderer->set_scissor(xh, yh, xl, yl);
}
void Frontend::set_prim_depth(const uint32_t *args)
{
renderer->set_primitive_z(args[1]);
}
void Frontend::set_fill_color(const uint32_t *args)
{
renderer->set_fill_color(args[1]);
}
void Frontend::set_blend_color(const uint32_t *args)
{
renderer->set_blend_color(args[1]);
}
void Frontend::set_prim_color(const uint32_t *args)
{
renderer->set_prim_color(args[0], args[1]);
}
void Frontend::set_env_color(const uint32_t *args)
{
renderer->set_env_color(args[1]);
}
void Frontend::set_fog_color(const uint32_t *args)
{
renderer->set_fog_color(args[1]);
}
void Frontend::load_tile(const uint32_t *args)
{
renderer->check_tmem_feedback();
renderer->get_tmem().load_tile(args[0], args[1]);
}
void Frontend::set_tile_size(const uint32_t *args)
{
renderer->get_tmem().set_tile_size(args[0], args[1]);
}
void Frontend::load_block(const uint32_t *args)
{
renderer->check_tmem_feedback();
renderer->get_tmem().load_block(args[0], args[1]);
}
void Frontend::load_tlut(const uint32_t *args)
{
renderer->check_tmem_feedback();
renderer->get_tmem().load_tlut(args[0], args[1]);
}
void Frontend::set_tile(const uint32_t *args)
{
renderer->get_tmem().set_tile(args[0], args[1]);
}
void Frontend::set_texture_image(const uint32_t *args)
{
unsigned format = (args[0] & 0x00e00000) >> (53 - 32);
unsigned pixel_size = (args[0] & 0x00180000) >> (51 - 32);
unsigned width = (args[0] & 0x000003ff) >> (32 - 32);
unsigned addr = (args[1] & 0x03ffffff) >> (0 - 0);
width++;
renderer->get_tmem().set_texture_image(addr, format, pixel_size, width);
}
void Frontend::set_mask_image(const uint32_t *args)
{
unsigned addr = args[1] & 0x00ffffff;
renderer->set_depth_image(addr);
}
void Frontend::set_color_image(const uint32_t *args)
{
unsigned format = (args[0] & 0x00e00000) >> (53 - 32);
unsigned pixel_size = (args[0] & 0x00180000) >> (51 - 32);
unsigned width = (args[0] & 0x000003ff) >> (32 - 32);
unsigned addr = (args[1] & 0x03ffffff) >> (0 - 0);
width++;
renderer->set_color_image(addr, format, pixel_size, width);
}
const Frontend::rdp_func_t Frontend::rdp_commands[64] = {
&Frontend::noop,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::tri_noshade,
&Frontend::tri_noshade_z,
&Frontend::tri_tex,
&Frontend::tri_tex_z,
&Frontend::tri_shade,
&Frontend::tri_shade_z,
&Frontend::tri_shade_tex,
&Frontend::tri_shade_tex_z,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::invalid,
&Frontend::tex_rect,
&Frontend::tex_rect_flip,
&Frontend::sync_load,
&Frontend::sync_pipe,
&Frontend::sync_tile,
&Frontend::sync_full,
&Frontend::set_key_gb,
&Frontend::set_key_r,
&Frontend::set_convert,
&Frontend::set_scissor,
&Frontend::set_prim_depth,
&Frontend::set_other_modes,
&Frontend::load_tlut,
&Frontend::invalid,
&Frontend::set_tile_size,
&Frontend::load_block,
&Frontend::load_tile,
&Frontend::set_tile,
&Frontend::fill_rect,
&Frontend::set_fill_color,
&Frontend::set_fog_color,
&Frontend::set_blend_color,
&Frontend::set_prim_color,
&Frontend::set_env_color,
&Frontend::set_combine,
&Frontend::set_texture_image,
&Frontend::set_mask_image,
&Frontend::set_color_image,
};
void Frontend::command(uint32_t cmd, const uint32_t *args)
{
assert(renderer);
assert(cmd < 64);
if (trace && ((cmd >= 8 && cmd < 16) || cmd == 0x24 || cmd == 0x25 || cmd == 0x36))
draw_count++;
if (rdp_commands[cmd])
(this->*rdp_commands[cmd])(args);
else
fprintf(stderr, "Unimplemented OP: 0x%x.\n", cmd);
}
}
-126
View File
@@ -1,126 +0,0 @@
#ifndef RDP_FRONTEND_HPP
#define RDP_FRONTEND_HPP
#include "rdp.hpp"
#include "vulkan.hpp"
#include <stddef.h>
#include <stdint.h>
namespace RDP
{
struct OtherModes
{
unsigned cycle_type;
unsigned z_mode;
unsigned cvg_dest;
unsigned tlut_type;
unsigned convert_one;
unsigned rgb_dither_sel;
unsigned alpha_dither_sel;
bool force_blend;
bool image_read_en;
bool antialias_en;
bool z_source_sel;
bool z_update_en;
bool z_compare_en;
bool persp_tex_en;
bool bi_lerp0;
bool bi_lerp1;
bool key_en;
bool mid_texel;
bool alpha_compare_en;
bool dither_alpha_en;
bool color_on_cvg;
bool cvg_times_alpha;
bool alpha_cvg_select;
bool en_tlut;
bool sample_type;
bool tex_lod_en;
bool sharpen_tex_en;
bool detail_tex_en;
};
class Frontend
{
public:
void set_renderer(Renderer *renderer, Vulkan::Device *device)
{
this->renderer = renderer;
this->device = device;
device->begin_index(0);
}
void command(uint32_t cmd, const uint32_t *args);
void reset_draw_count()
{
draw_count = 0;
}
unsigned get_draw_count() const
{
return draw_count;
}
bool trace = false;
private:
typedef void (Frontend::*rdp_func_t)(const uint32_t *args);
static const rdp_func_t rdp_commands[64];
Renderer *renderer = nullptr;
Vulkan::Device *device = nullptr;
OtherModes other_modes = {};
unsigned draw_count = 0;
void tri_fill_tex_coeffs(Attribute *attr, const uint32_t *args);
void tri_fill_z_coeffs(Attribute *attr, const uint32_t *args);
void tri_fill_shade_coeffs(Attribute *attr, const uint32_t *args);
void tri_fill_coeffs(Primitive *prim, const uint32_t *args, int32_t *xmin, int32_t *xmax);
void tri_fill_flags_common(Primitive *prim);
void tri_fill_tile(Primitive *prim, uint32_t *tile_mask, uint32_t mips, uint32_t tile);
void tri_fill_novarying_tile(Primitive *prim, Attribute *attr, uint32_t *tile_mask);
void tri_fill_flags(Primitive *prim, const uint32_t *args, uint32_t *tile_mask, bool zbuffer, bool shade);
void tri_noshade(const uint32_t *args);
void tri_noshade_z(const uint32_t *args);
void tri_tex(const uint32_t *args);
void tri_tex_z(const uint32_t *args);
void tri_shade(const uint32_t *args);
void tri_shade_z(const uint32_t *args);
void tri_shade_tex(const uint32_t *args);
void tri_shade_tex_z(const uint32_t *args);
void tex_rect_common(const uint32_t *args, bool flipped);
void tex_rect(const uint32_t *args);
void tex_rect_flip(const uint32_t *args);
void fill_rect(const uint32_t *args);
void set_other_modes(const uint32_t *args);
void set_combine(const uint32_t *args);
void set_key_r(const uint32_t *args);
void set_key_gb(const uint32_t *args);
void set_convert(const uint32_t *args);
void set_scissor(const uint32_t *args);
void set_prim_depth(const uint32_t *args);
void set_fill_color(const uint32_t *args);
void set_blend_color(const uint32_t *args);
void set_prim_color(const uint32_t *args);
void set_env_color(const uint32_t *args);
void set_fog_color(const uint32_t *args);
void load_tile(const uint32_t *args);
void load_block(const uint32_t *args);
void load_tlut(const uint32_t *args);
void set_tile(const uint32_t *args);
void set_texture_image(const uint32_t *args);
void set_color_image(const uint32_t *args);
void set_mask_image(const uint32_t *args);
void set_tile_size(const uint32_t *args);
void sync_full(const uint32_t *);
void sync_load(const uint32_t *);
void sync_pipe(const uint32_t *);
void sync_tile(const uint32_t *);
void noop(const uint32_t *);
void invalid(const uint32_t *);
};
}
#endif
@@ -1,80 +0,0 @@
OUTPUT := \
rdp.8.noz.spv \
rdp.16.noz.spv \
rdp.32.noz.spv \
rdp.8.z.spv \
rdp.16.z.spv \
rdp.32.z.spv \
rdp.color.depth.alias.16.spv \
blit.8.spv \
blit.16.spv \
blit.32.spv \
tmem.rgba32.spv \
tmem.rgba16.spv \
tmem.i8.spv \
tmem.ia8.spv \
tmem.ia16.spv \
varying.spv \
texture.spv \
combiner.spv
OUTPUT_INC := $(OUTPUT:.spv=.inc)
DEPS := $(OUTPUT:.spv=.inc.d)
GLSLFLAGS := -MD -mfmt=c
all: $(OUTPUT_INC)
-include $(DEPS)
rdp.8.z.inc: rdp.comp
glslc -o $@ $< -DZ_BUFFER=1 -DCOLOR_BPP=8 -DCOLOR_DEPTH_ALIAS=0 $(GLSLFLAGS)
rdp.16.z.inc: rdp.comp
glslc -o $@ $< -DZ_BUFFER=1 -DCOLOR_BPP=16 -DCOLOR_DEPTH_ALIAS=0 $(GLSLFLAGS)
rdp.32.z.inc: rdp.comp
glslc -o $@ $< -DZ_BUFFER=1 -DCOLOR_BPP=32 -DCOLOR_DEPTH_ALIAS=0 $(GLSLFLAGS)
rdp.8.noz.inc: rdp.comp
glslc -o $@ $< -DZ_BUFFER=0 -DCOLOR_BPP=8 -DCOLOR_DEPTH_ALIAS=0 $(GLSLFLAGS)
rdp.16.noz.inc: rdp.comp
glslc -o $@ $< -DZ_BUFFER=0 -DCOLOR_BPP=16 -DCOLOR_DEPTH_ALIAS=0 $(GLSLFLAGS)
rdp.32.noz.inc: rdp.comp
glslc -o $@ $< -DZ_BUFFER=0 -DCOLOR_BPP=32 -DCOLOR_DEPTH_ALIAS=0 $(GLSLFLAGS)
rdp.color.depth.alias.16.inc: rdp.comp
glslc -o $@ $< -DZ_BUFFER=1 -DCOLOR_BPP=16 -DCOLOR_DEPTH_ALIAS=1 $(GLSLFLAGS)
blit.8.inc: blit.comp
glslc -o $@ $< -DCOLOR_BPP=8 $(GLSLFLAGS)
blit.16.inc: blit.comp
glslc -o $@ $< -DCOLOR_BPP=16 $(GLSLFLAGS)
blit.32.inc: blit.comp
glslc -o $@ $< -DCOLOR_BPP=32 $(GLSLFLAGS)
tmem.rgba32.inc: tmem.comp
glslc -o $@ $< -DTRANSFER=0 $(GLSLFLAGS)
tmem.rgba16.inc: tmem.comp
glslc -o $@ $< -DTRANSFER=1 $(GLSLFLAGS)
tmem.i8.inc: tmem.comp
glslc -o $@ $< -DTRANSFER=2 $(GLSLFLAGS)
tmem.ia8.inc: tmem.comp
glslc -o $@ $< -DTRANSFER=3 $(GLSLFLAGS)
tmem.ia16.inc: tmem.comp
glslc -o $@ $< -DTRANSFER=4 $(GLSLFLAGS)
%.inc: %.comp
glslc -o $@ $< $(GLSLFLAGS)
clean:
rm -f $(OUTPUT_INC) $(OUTPUT) $(DEPS)
.PHONY: clean
@@ -1,133 +0,0 @@
#ifndef BLENDER_H_
#define BLENDER_H_
#include "noise.h"
ivec3 rgb_dither(ivec3 color, int dith, int dither_sel)
{
ivec3 newcol = mix((color & 0xf8) + 8, ivec3(255), greaterThan(color, ivec3(247)));
ivec3 comp = dither_sel != 2 ? ivec3(dith) : ivec3(dith, (dith + ivec2(3, 5)) & 7);
ivec3 replacesign = (comp - (color & 7)) >> 31;
ivec3 ditherdiff = newcol - color;
return color + (ditherdiff & replacesign);
}
int mux4(ivec4 muxinput, int selector)
{
if (selector == 0) return muxinput.x;
else if (selector == 1) return muxinput.y;
else if (selector == 2) return muxinput.z;
else return muxinput.w;
}
ivec3 mux4(ivec3 c0, ivec3 c1, ivec3 c2, ivec3 c3, int selector)
{
if (selector == 0) return c0;
else if (selector == 1) return c1;
else if (selector == 2) return c2;
else return c3;
}
ivec3 pre_blender(uint flags,
uint blendword, uint blend_color, uint fog_color,
int shaded_alpha, ivec4 color)
{
// Angrylion Pipelines the update to memory_color, so in the first
// blend cycle, we cannot observe the memory color anyways.
// It seems that it has memory sticking around for this, but we cannot implement that sanely
// with compute. To fix this, just use pixel color alpha to guesstimate the right values.
//
int blend_m1a = int(blendword >> 14u) & 3;
int blend_m2a = int(blendword >> 6u) & 3;
int blend_m1b = int(blendword >> 10u) & 3;
int blend_m2b = int(blendword >> 2u) & 3;
int a0 = mux4(ivec4(color.a, int(fog_color & 0xffu), shaded_alpha, 0), blend_m1b);
int a1 = mux4(ivec4(~a0 & 0xff, color.a, 0xff, 0), blend_m2b);
int blend1a = a0 >> 3;
int blend2a = a1 >> 3;
int mulb = blend2a + 1;
ivec3 pre_blended =
mux4(color.rgb, color.rgb, ivec3(unpack_rgba8(blend_color).rgb), ivec3(unpack_rgba8(fog_color).rgb), blend_m1a) * blend1a +
mux4(color.rgb, color.rgb, ivec3(unpack_rgba8(blend_color).rgb), ivec3(unpack_rgba8(fog_color).rgb), blend_m2a) * mulb;
return (pre_blended >> 5) & 0xff;
}
bool blender(uint flags,
inout uvec4 pixel, uvec2 cvg, uint blendword, uint blend_color, uint fog_color, int shaded_alpha, ivec4 color,
bool overflow, bool farther, out bool blend_en, uint cycle_shift)
{
if (PRIMITIVE_ALPHATEST(flags) && (color.a < (PRIMITIVE_ALPHA_NOISE(flags) ? noise8(0) : int(blend_color & 0xffu))))
return false;
// In AA mode, at least one sample must be non zero, in non-AA, top-left sample must be non-zero.
// If we're in cycle one, the blender will no-op and Z writes are discarded, so we can just exit early.
if ((PRIMITIVE_AA_ENABLE(flags) ? cvg.x : (cvg.y & 0x80u)) == 0u)
return false;
blend_en = PRIMITIVE_FORCE_BLEND(flags) || (!overflow && farther && PRIMITIVE_AA_ENABLE(flags));
// If we're doing color on coverage, only blend if coverage overflows.
bool noblend = PRIMITIVE_COLOR_ON_CVG(flags) && !overflow;
ivec3 result;
int blend_m1a = int(blendword >> (14u - cycle_shift)) & 3;
int blend_m2a = int(blendword >> ( 6u - cycle_shift)) & 3;
// If we skip blend, select first blend input.
if (noblend || !blend_en)
{
result = mux4(color.rgb, ivec3(pixel.rgb), ivec3(unpack_rgba8(blend_color).rgb), ivec3(unpack_rgba8(fog_color).rgb),
noblend ? blend_m2a : blend_m1a);
}
else
{
int blend_m1b = int(blendword >> (10u - cycle_shift)) & 3;
int blend_m2b = int(blendword >> ( 2u - cycle_shift)) & 3;
int a0 = mux4(ivec4(color.a, int(fog_color & 0xffu), shaded_alpha, 0), blend_m1b);
int a1 = mux4(ivec4(~a0 & 0xff, int(pixel.a << 5u) | 0x1f, 0xff, 0), blend_m2b);
int blend1a = a0 >> 3;
int blend2a = a1 >> 3;
int mulb = blend2a + 1;
// Special path for coverage blends.
// OR-ing in 3 already done by a1 mux.
// TODO: Deal with blshifta/blshiftb.
// This mask is not needed unless we care about the blend shifts.
if (blend_m2b == 1)
blend1a &= 0x3c;
// Blend
ivec3 blended =
mux4(color.rgb, ivec3(pixel.rgb), ivec3(unpack_rgba8(blend_color).rgb), ivec3(unpack_rgba8(fog_color).rgb), blend_m1a) * blend1a +
mux4(color.rgb, ivec3(pixel.rgb), ivec3(unpack_rgba8(blend_color).rgb), ivec3(unpack_rgba8(fog_color).rgb), blend_m2a) * mulb;
if (PRIMITIVE_FORCE_BLEND(flags))
result = (blended >> 5u) & 0xff;
else
{
// This uses the bldiv_hwaccurate_table which seems a bit overkill for our uses, so just blend in FP for now.
// At least try to get the input sum and blended right :)
int sum = (blend1a & ~3) + (blend2a & ~3) + 4;
result = clamp(ivec3(round(4.0 * vec3(blended >> 2) / float(sum))), ivec3(0), ivec3(0xff));
}
}
int dither_sel = int(RGB_DITHER_SEL(blendword));
if (dither_sel != 3)
{
int cdith;
if (dither_sel == 2)
cdith = noise8(1) & 0x7;
else
cdith = int(textureLod(uDitherLUT, vec3((vec2(gl_GlobalInvocationID.xy) + 0.5) * 0.25, float(FULL_DITHER_SEL(blendword))), 0.0).x);
result = rgb_dither(result, cdith, dither_sel);
}
// Writeback
pixel.rgb = uvec3(clamp(result, ivec3(0), ivec3(0xff)));
return true;
}
#endif
@@ -1,136 +0,0 @@
{0x07230203,0x00010000,0x00080001,0x00000056,
0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,
0x00000000,0x0003000e,0x00000000,0x00000001,
0x0006000f,0x00000005,0x00000004,0x6e69616d,
0x00000000,0x0000000d,0x00060010,0x00000004,
0x00000011,0x00000008,0x00000008,0x00000001,
0x00030003,0x00000001,0x00000136,0x000a0004,
0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,
0x5f656c79,0x656e696c,0x7269645f,0x69746365,
0x00006576,0x00080004,0x475f4c47,0x4c474f4f,
0x6e695f45,0x64756c63,0x69645f65,0x74636572,
0x00657669,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00040005,0x00000009,0x6e656469,
0x00000074,0x00080005,0x0000000d,0x475f6c67,
0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,
0x00000044,0x00060005,0x00000013,0x68737550,
0x736e6f43,0x746e6174,0x00000000,0x00070006,
0x00000013,0x00000000,0x6d617246,0x66756265,
0x53726566,0x00657a69,0x00050005,0x00000015,
0x736e6f63,0x746e6174,0x00000073,0x00030005,
0x00000021,0x00000063,0x00040005,0x00000023,
0x4f425353,0x00000000,0x00050006,0x00000023,
0x00000000,0x65786970,0x0000736c,0x00030005,
0x00000025,0x00000000,0x00040005,0x00000037,
0x6f6c6f63,0x00000072,0x00040005,0x0000004b,
0x74754f75,0x00747570,0x00040047,0x0000000d,
0x0000000b,0x0000001c,0x00050048,0x00000013,
0x00000000,0x00000023,0x00000000,0x00030047,
0x00000013,0x00000002,0x00040047,0x00000022,
0x00000006,0x00000004,0x00040048,0x00000023,
0x00000000,0x00000018,0x00050048,0x00000023,
0x00000000,0x00000023,0x00000000,0x00030047,
0x00000023,0x00000003,0x00040047,0x00000025,
0x00000022,0x00000000,0x00040047,0x00000025,
0x00000021,0x00000000,0x00030047,0x0000004b,
0x00000000,0x00040047,0x0000004b,0x00000022,
0x00000000,0x00040047,0x0000004b,0x00000021,
0x00000001,0x00030047,0x0000004b,0x00000019,
0x00030047,0x0000004c,0x00000000,0x00040047,
0x00000055,0x0000000b,0x00000019,0x00020013,
0x00000002,0x00030021,0x00000003,0x00000002,
0x00040015,0x00000006,0x00000020,0x00000001,
0x00040017,0x00000007,0x00000006,0x00000002,
0x00040020,0x00000008,0x00000007,0x00000007,
0x00040015,0x0000000a,0x00000020,0x00000000,
0x00040017,0x0000000b,0x0000000a,0x00000003,
0x00040020,0x0000000c,0x00000001,0x0000000b,
0x0004003b,0x0000000c,0x0000000d,0x00000001,
0x00040017,0x0000000e,0x0000000a,0x00000002,
0x0003001e,0x00000013,0x00000007,0x00040020,
0x00000014,0x00000009,0x00000013,0x0004003b,
0x00000014,0x00000015,0x00000009,0x0004002b,
0x00000006,0x00000016,0x00000000,0x00040020,
0x00000017,0x00000009,0x00000007,0x00020014,
0x0000001a,0x00040017,0x0000001b,0x0000001a,
0x00000002,0x00040020,0x00000020,0x00000007,
0x0000000a,0x0003001d,0x00000022,0x0000000a,
0x0003001e,0x00000023,0x00000022,0x00040020,
0x00000024,0x00000002,0x00000023,0x0004003b,
0x00000024,0x00000025,0x00000002,0x0004002b,
0x0000000a,0x00000026,0x00000000,0x00040020,
0x00000027,0x00000009,0x00000006,0x0004002b,
0x0000000a,0x0000002a,0x00000001,0x00040020,
0x0000002b,0x00000007,0x00000006,0x00040020,
0x00000032,0x00000002,0x0000000a,0x00040017,
0x00000035,0x0000000a,0x00000004,0x00040020,
0x00000036,0x00000007,0x00000035,0x0004002b,
0x0000000a,0x00000039,0x0000000a,0x0004002b,
0x0000000a,0x0000003b,0x000000f8,0x0004002b,
0x0000000a,0x0000003e,0x00000005,0x0004002b,
0x0000000a,0x00000045,0x00000007,0x00030016,
0x00000048,0x00000020,0x00090019,0x00000049,
0x00000048,0x00000001,0x00000000,0x00000000,
0x00000000,0x00000002,0x00000004,0x00040020,
0x0000004a,0x00000000,0x00000049,0x0004003b,
0x0000004a,0x0000004b,0x00000000,0x00040017,
0x0000004f,0x00000048,0x00000004,0x0004002b,
0x00000048,0x00000051,0x437f0000,0x0004002b,
0x0000000a,0x00000054,0x00000008,0x0006002c,
0x0000000b,0x00000055,0x00000054,0x00000054,
0x0000002a,0x00050036,0x00000002,0x00000004,
0x00000000,0x00000003,0x000200f8,0x00000005,
0x0004003b,0x00000008,0x00000009,0x00000007,
0x0004003b,0x00000020,0x00000021,0x00000007,
0x0004003b,0x00000036,0x00000037,0x00000007,
0x0004003d,0x0000000b,0x0000000f,0x0000000d,
0x0007004f,0x0000000e,0x00000010,0x0000000f,
0x0000000f,0x00000000,0x00000001,0x0004007c,
0x00000007,0x00000011,0x00000010,0x0003003e,
0x00000009,0x00000011,0x0004003d,0x00000007,
0x00000012,0x00000009,0x00050041,0x00000017,
0x00000018,0x00000015,0x00000016,0x0004003d,
0x00000007,0x00000019,0x00000018,0x000500b1,
0x0000001b,0x0000001c,0x00000012,0x00000019,
0x0004009b,0x0000001a,0x0000001d,0x0000001c,
0x000300f7,0x0000001f,0x00000000,0x000400fa,
0x0000001d,0x0000001e,0x0000001f,0x000200f8,
0x0000001e,0x00060041,0x00000027,0x00000028,
0x00000015,0x00000016,0x00000026,0x0004003d,
0x00000006,0x00000029,0x00000028,0x00050041,
0x0000002b,0x0000002c,0x00000009,0x0000002a,
0x0004003d,0x00000006,0x0000002d,0x0000002c,
0x00050084,0x00000006,0x0000002e,0x00000029,
0x0000002d,0x00050041,0x0000002b,0x0000002f,
0x00000009,0x00000026,0x0004003d,0x00000006,
0x00000030,0x0000002f,0x00050080,0x00000006,
0x00000031,0x0000002e,0x00000030,0x00060041,
0x00000032,0x00000033,0x00000025,0x00000016,
0x00000031,0x0004003d,0x0000000a,0x00000034,
0x00000033,0x0003003e,0x00000021,0x00000034,
0x0004003d,0x0000000a,0x00000038,0x00000021,
0x000500c2,0x0000000a,0x0000003a,0x00000038,
0x00000039,0x000500c7,0x0000000a,0x0000003c,
0x0000003a,0x0000003b,0x0004003d,0x0000000a,
0x0000003d,0x00000021,0x000500c2,0x0000000a,
0x0000003f,0x0000003d,0x0000003e,0x000500c7,
0x0000000a,0x00000040,0x0000003f,0x0000003b,
0x0004003d,0x0000000a,0x00000041,0x00000021,
0x000500c2,0x0000000a,0x00000042,0x00000041,
0x00000026,0x000500c7,0x0000000a,0x00000043,
0x00000042,0x0000003b,0x0004003d,0x0000000a,
0x00000044,0x00000021,0x000500c7,0x0000000a,
0x00000046,0x00000044,0x00000045,0x00070050,
0x00000035,0x00000047,0x0000003c,0x00000040,
0x00000043,0x00000046,0x0003003e,0x00000037,
0x00000047,0x0004003d,0x00000049,0x0000004c,
0x0000004b,0x0004003d,0x00000007,0x0000004d,
0x00000009,0x0004003d,0x00000035,0x0000004e,
0x00000037,0x00040070,0x0000004f,0x00000050,
0x0000004e,0x00070050,0x0000004f,0x00000052,
0x00000051,0x00000051,0x00000051,0x00000051,
0x00050088,0x0000004f,0x00000053,0x00000050,
0x00000052,0x00040063,0x0000004c,0x0000004d,
0x00000053,0x000200f9,0x0000001f,0x000200f8,
0x0000001f,0x000100fd,0x00010038}
@@ -1,131 +0,0 @@
{0x07230203,0x00010000,0x00080001,0x00000051,
0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,
0x00000000,0x0003000e,0x00000000,0x00000001,
0x0006000f,0x00000005,0x00000004,0x6e69616d,
0x00000000,0x0000000d,0x00060010,0x00000004,
0x00000011,0x00000008,0x00000008,0x00000001,
0x00030003,0x00000001,0x00000136,0x000a0004,
0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,
0x5f656c79,0x656e696c,0x7269645f,0x69746365,
0x00006576,0x00080004,0x475f4c47,0x4c474f4f,
0x6e695f45,0x64756c63,0x69645f65,0x74636572,
0x00657669,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00040005,0x00000009,0x6e656469,
0x00000074,0x00080005,0x0000000d,0x475f6c67,
0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,
0x00000044,0x00060005,0x00000013,0x68737550,
0x736e6f43,0x746e6174,0x00000000,0x00070006,
0x00000013,0x00000000,0x6d617246,0x66756265,
0x53726566,0x00657a69,0x00050005,0x00000015,
0x736e6f63,0x746e6174,0x00000073,0x00030005,
0x00000021,0x00000063,0x00040005,0x00000023,
0x4f425353,0x00000000,0x00050006,0x00000023,
0x00000000,0x65786970,0x0000736c,0x00030005,
0x00000025,0x00000000,0x00040005,0x00000037,
0x6f6c6f63,0x00000072,0x00040005,0x00000047,
0x74754f75,0x00747570,0x00040047,0x0000000d,
0x0000000b,0x0000001c,0x00050048,0x00000013,
0x00000000,0x00000023,0x00000000,0x00030047,
0x00000013,0x00000002,0x00040047,0x00000022,
0x00000006,0x00000004,0x00040048,0x00000023,
0x00000000,0x00000018,0x00050048,0x00000023,
0x00000000,0x00000023,0x00000000,0x00030047,
0x00000023,0x00000003,0x00040047,0x00000025,
0x00000022,0x00000000,0x00040047,0x00000025,
0x00000021,0x00000000,0x00030047,0x00000047,
0x00000000,0x00040047,0x00000047,0x00000022,
0x00000000,0x00040047,0x00000047,0x00000021,
0x00000001,0x00030047,0x00000047,0x00000019,
0x00030047,0x00000048,0x00000000,0x00040047,
0x00000050,0x0000000b,0x00000019,0x00020013,
0x00000002,0x00030021,0x00000003,0x00000002,
0x00040015,0x00000006,0x00000020,0x00000001,
0x00040017,0x00000007,0x00000006,0x00000002,
0x00040020,0x00000008,0x00000007,0x00000007,
0x00040015,0x0000000a,0x00000020,0x00000000,
0x00040017,0x0000000b,0x0000000a,0x00000003,
0x00040020,0x0000000c,0x00000001,0x0000000b,
0x0004003b,0x0000000c,0x0000000d,0x00000001,
0x00040017,0x0000000e,0x0000000a,0x00000002,
0x0003001e,0x00000013,0x00000007,0x00040020,
0x00000014,0x00000009,0x00000013,0x0004003b,
0x00000014,0x00000015,0x00000009,0x0004002b,
0x00000006,0x00000016,0x00000000,0x00040020,
0x00000017,0x00000009,0x00000007,0x00020014,
0x0000001a,0x00040017,0x0000001b,0x0000001a,
0x00000002,0x00040020,0x00000020,0x00000007,
0x0000000a,0x0003001d,0x00000022,0x0000000a,
0x0003001e,0x00000023,0x00000022,0x00040020,
0x00000024,0x00000002,0x00000023,0x0004003b,
0x00000024,0x00000025,0x00000002,0x0004002b,
0x0000000a,0x00000026,0x00000000,0x00040020,
0x00000027,0x00000009,0x00000006,0x0004002b,
0x0000000a,0x0000002a,0x00000001,0x00040020,
0x0000002b,0x00000007,0x00000006,0x00040020,
0x00000032,0x00000002,0x0000000a,0x00040017,
0x00000035,0x0000000a,0x00000004,0x00040020,
0x00000036,0x00000007,0x00000035,0x0004002b,
0x0000000a,0x0000003a,0x00000018,0x0004002b,
0x0000000a,0x0000003b,0x00000010,0x0004002b,
0x0000000a,0x0000003c,0x00000008,0x0004002b,
0x0000000a,0x0000003d,0x00000005,0x0007002c,
0x00000035,0x0000003e,0x0000003a,0x0000003b,
0x0000003c,0x0000003d,0x0004002b,0x0000000a,
0x00000040,0x000000ff,0x0004002b,0x0000000a,
0x00000041,0x00000007,0x0007002c,0x00000035,
0x00000042,0x00000040,0x00000040,0x00000040,
0x00000041,0x00030016,0x00000044,0x00000020,
0x00090019,0x00000045,0x00000044,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000002,
0x00000004,0x00040020,0x00000046,0x00000000,
0x00000045,0x0004003b,0x00000046,0x00000047,
0x00000000,0x00040017,0x0000004b,0x00000044,
0x00000004,0x0004002b,0x00000044,0x0000004d,
0x437f0000,0x0006002c,0x0000000b,0x00000050,
0x0000003c,0x0000003c,0x0000002a,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,
0x000200f8,0x00000005,0x0004003b,0x00000008,
0x00000009,0x00000007,0x0004003b,0x00000020,
0x00000021,0x00000007,0x0004003b,0x00000036,
0x00000037,0x00000007,0x0004003d,0x0000000b,
0x0000000f,0x0000000d,0x0007004f,0x0000000e,
0x00000010,0x0000000f,0x0000000f,0x00000000,
0x00000001,0x0004007c,0x00000007,0x00000011,
0x00000010,0x0003003e,0x00000009,0x00000011,
0x0004003d,0x00000007,0x00000012,0x00000009,
0x00050041,0x00000017,0x00000018,0x00000015,
0x00000016,0x0004003d,0x00000007,0x00000019,
0x00000018,0x000500b1,0x0000001b,0x0000001c,
0x00000012,0x00000019,0x0004009b,0x0000001a,
0x0000001d,0x0000001c,0x000300f7,0x0000001f,
0x00000000,0x000400fa,0x0000001d,0x0000001e,
0x0000001f,0x000200f8,0x0000001e,0x00060041,
0x00000027,0x00000028,0x00000015,0x00000016,
0x00000026,0x0004003d,0x00000006,0x00000029,
0x00000028,0x00050041,0x0000002b,0x0000002c,
0x00000009,0x0000002a,0x0004003d,0x00000006,
0x0000002d,0x0000002c,0x00050084,0x00000006,
0x0000002e,0x00000029,0x0000002d,0x00050041,
0x0000002b,0x0000002f,0x00000009,0x00000026,
0x0004003d,0x00000006,0x00000030,0x0000002f,
0x00050080,0x00000006,0x00000031,0x0000002e,
0x00000030,0x00060041,0x00000032,0x00000033,
0x00000025,0x00000016,0x00000031,0x0004003d,
0x0000000a,0x00000034,0x00000033,0x0003003e,
0x00000021,0x00000034,0x0004003d,0x0000000a,
0x00000038,0x00000021,0x00070050,0x00000035,
0x00000039,0x00000038,0x00000038,0x00000038,
0x00000038,0x000500c2,0x00000035,0x0000003f,
0x00000039,0x0000003e,0x000500c7,0x00000035,
0x00000043,0x0000003f,0x00000042,0x0003003e,
0x00000037,0x00000043,0x0004003d,0x00000045,
0x00000048,0x00000047,0x0004003d,0x00000007,
0x00000049,0x00000009,0x0004003d,0x00000035,
0x0000004a,0x00000037,0x00040070,0x0000004b,
0x0000004c,0x0000004a,0x00070050,0x0000004b,
0x0000004e,0x0000004d,0x0000004d,0x0000004d,
0x0000004d,0x00050088,0x0000004b,0x0000004f,
0x0000004c,0x0000004e,0x00040063,0x00000048,
0x00000049,0x0000004f,0x000200f9,0x0000001f,
0x000200f8,0x0000001f,0x000100fd,0x00010038}
@@ -1,133 +0,0 @@
{0x07230203,0x00010000,0x00080001,0x00000053,
0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,
0x00000000,0x0003000e,0x00000000,0x00000001,
0x0006000f,0x00000005,0x00000004,0x6e69616d,
0x00000000,0x0000000d,0x00060010,0x00000004,
0x00000011,0x00000008,0x00000008,0x00000001,
0x00030003,0x00000001,0x00000136,0x000a0004,
0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,
0x5f656c79,0x656e696c,0x7269645f,0x69746365,
0x00006576,0x00080004,0x475f4c47,0x4c474f4f,
0x6e695f45,0x64756c63,0x69645f65,0x74636572,
0x00657669,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00040005,0x00000009,0x6e656469,
0x00000074,0x00080005,0x0000000d,0x475f6c67,
0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,
0x00000044,0x00060005,0x00000013,0x68737550,
0x736e6f43,0x746e6174,0x00000000,0x00070006,
0x00000013,0x00000000,0x6d617246,0x66756265,
0x53726566,0x00657a69,0x00050005,0x00000015,
0x736e6f63,0x746e6174,0x00000073,0x00030005,
0x00000021,0x00000063,0x00040005,0x00000023,
0x4f425353,0x00000000,0x00050006,0x00000023,
0x00000000,0x65786970,0x0000736c,0x00030005,
0x00000025,0x00000000,0x00040005,0x00000037,
0x6f6c6f63,0x00000072,0x00040005,0x00000048,
0x74754f75,0x00747570,0x00040047,0x0000000d,
0x0000000b,0x0000001c,0x00050048,0x00000013,
0x00000000,0x00000023,0x00000000,0x00030047,
0x00000013,0x00000002,0x00040047,0x00000022,
0x00000006,0x00000004,0x00040048,0x00000023,
0x00000000,0x00000018,0x00050048,0x00000023,
0x00000000,0x00000023,0x00000000,0x00030047,
0x00000023,0x00000003,0x00040047,0x00000025,
0x00000022,0x00000000,0x00040047,0x00000025,
0x00000021,0x00000000,0x00030047,0x00000048,
0x00000000,0x00040047,0x00000048,0x00000022,
0x00000000,0x00040047,0x00000048,0x00000021,
0x00000001,0x00030047,0x00000048,0x00000019,
0x00030047,0x00000049,0x00000000,0x00040047,
0x00000052,0x0000000b,0x00000019,0x00020013,
0x00000002,0x00030021,0x00000003,0x00000002,
0x00040015,0x00000006,0x00000020,0x00000001,
0x00040017,0x00000007,0x00000006,0x00000002,
0x00040020,0x00000008,0x00000007,0x00000007,
0x00040015,0x0000000a,0x00000020,0x00000000,
0x00040017,0x0000000b,0x0000000a,0x00000003,
0x00040020,0x0000000c,0x00000001,0x0000000b,
0x0004003b,0x0000000c,0x0000000d,0x00000001,
0x00040017,0x0000000e,0x0000000a,0x00000002,
0x0003001e,0x00000013,0x00000007,0x00040020,
0x00000014,0x00000009,0x00000013,0x0004003b,
0x00000014,0x00000015,0x00000009,0x0004002b,
0x00000006,0x00000016,0x00000000,0x00040020,
0x00000017,0x00000009,0x00000007,0x00020014,
0x0000001a,0x00040017,0x0000001b,0x0000001a,
0x00000002,0x00040020,0x00000020,0x00000007,
0x0000000a,0x0003001d,0x00000022,0x0000000a,
0x0003001e,0x00000023,0x00000022,0x00040020,
0x00000024,0x00000002,0x00000023,0x0004003b,
0x00000024,0x00000025,0x00000002,0x0004002b,
0x0000000a,0x00000026,0x00000000,0x00040020,
0x00000027,0x00000009,0x00000006,0x0004002b,
0x0000000a,0x0000002a,0x00000001,0x00040020,
0x0000002b,0x00000007,0x00000006,0x00040020,
0x00000032,0x00000002,0x0000000a,0x00040017,
0x00000035,0x0000000a,0x00000004,0x00040020,
0x00000036,0x00000007,0x00000035,0x0004002b,
0x0000000a,0x00000039,0x00000003,0x0004002b,
0x0000000a,0x0000003b,0x000000ff,0x0004002b,
0x0000000a,0x0000003f,0x00000007,0x00030016,
0x00000045,0x00000020,0x00090019,0x00000046,
0x00000045,0x00000001,0x00000000,0x00000000,
0x00000000,0x00000002,0x00000004,0x00040020,
0x00000047,0x00000000,0x00000046,0x0004003b,
0x00000047,0x00000048,0x00000000,0x00040017,
0x0000004c,0x00000045,0x00000004,0x0004002b,
0x00000045,0x0000004e,0x437f0000,0x0004002b,
0x0000000a,0x00000051,0x00000008,0x0006002c,
0x0000000b,0x00000052,0x00000051,0x00000051,
0x0000002a,0x00050036,0x00000002,0x00000004,
0x00000000,0x00000003,0x000200f8,0x00000005,
0x0004003b,0x00000008,0x00000009,0x00000007,
0x0004003b,0x00000020,0x00000021,0x00000007,
0x0004003b,0x00000036,0x00000037,0x00000007,
0x0004003d,0x0000000b,0x0000000f,0x0000000d,
0x0007004f,0x0000000e,0x00000010,0x0000000f,
0x0000000f,0x00000000,0x00000001,0x0004007c,
0x00000007,0x00000011,0x00000010,0x0003003e,
0x00000009,0x00000011,0x0004003d,0x00000007,
0x00000012,0x00000009,0x00050041,0x00000017,
0x00000018,0x00000015,0x00000016,0x0004003d,
0x00000007,0x00000019,0x00000018,0x000500b1,
0x0000001b,0x0000001c,0x00000012,0x00000019,
0x0004009b,0x0000001a,0x0000001d,0x0000001c,
0x000300f7,0x0000001f,0x00000000,0x000400fa,
0x0000001d,0x0000001e,0x0000001f,0x000200f8,
0x0000001e,0x00060041,0x00000027,0x00000028,
0x00000015,0x00000016,0x00000026,0x0004003d,
0x00000006,0x00000029,0x00000028,0x00050041,
0x0000002b,0x0000002c,0x00000009,0x0000002a,
0x0004003d,0x00000006,0x0000002d,0x0000002c,
0x00050084,0x00000006,0x0000002e,0x00000029,
0x0000002d,0x00050041,0x0000002b,0x0000002f,
0x00000009,0x00000026,0x0004003d,0x00000006,
0x00000030,0x0000002f,0x00050080,0x00000006,
0x00000031,0x0000002e,0x00000030,0x00060041,
0x00000032,0x00000033,0x00000025,0x00000016,
0x00000031,0x0004003d,0x0000000a,0x00000034,
0x00000033,0x0003003e,0x00000021,0x00000034,
0x0004003d,0x0000000a,0x00000038,0x00000021,
0x000500c2,0x0000000a,0x0000003a,0x00000038,
0x00000039,0x000500c7,0x0000000a,0x0000003c,
0x0000003a,0x0000003b,0x00060050,0x0000000b,
0x0000003d,0x0000003c,0x0000003c,0x0000003c,
0x0004003d,0x0000000a,0x0000003e,0x00000021,
0x000500c7,0x0000000a,0x00000040,0x0000003e,
0x0000003f,0x00050051,0x0000000a,0x00000041,
0x0000003d,0x00000000,0x00050051,0x0000000a,
0x00000042,0x0000003d,0x00000001,0x00050051,
0x0000000a,0x00000043,0x0000003d,0x00000002,
0x00070050,0x00000035,0x00000044,0x00000041,
0x00000042,0x00000043,0x00000040,0x0003003e,
0x00000037,0x00000044,0x0004003d,0x00000046,
0x00000049,0x00000048,0x0004003d,0x00000007,
0x0000004a,0x00000009,0x0004003d,0x00000035,
0x0000004b,0x00000037,0x00040070,0x0000004c,
0x0000004d,0x0000004b,0x00070050,0x0000004c,
0x0000004f,0x0000004e,0x0000004e,0x0000004e,
0x0000004e,0x00050088,0x0000004c,0x00000050,
0x0000004d,0x0000004f,0x00040063,0x00000049,
0x0000004a,0x00000050,0x000200f9,0x0000001f,
0x000200f8,0x0000001f,0x000100fd,0x00010038}
@@ -1,42 +0,0 @@
#version 310 es
precision highp int;
precision highp float;
layout(local_size_x = 8, local_size_y = 8) in;
layout(std430, set = 0, binding = 0) readonly buffer SSBO
{
uint pixels[];
};
layout(rgba8, set = 0, binding = 1) uniform writeonly mediump image2D uOutput;
layout(std430, push_constant) uniform PushConstant
{
ivec2 FramebufferSize;
} constants;
void main()
{
ivec2 ident = ivec2(gl_GlobalInvocationID.xy);
if (all(lessThan(ident, constants.FramebufferSize)))
{
uint c = pixels[constants.FramebufferSize.x * ident.y + ident.x];
#if COLOR_BPP == 32
uvec4 color = (uvec4(c) >> uvec4(24u, 16u, 8u, 5u)) & uvec4(0xffu, 0xffu, 0xffu, 0x7u);
imageStore(uOutput, ident, vec4(color) / 255.0);
#elif COLOR_BPP == 16
// Angrylion VI intentionally doesn't pad out to the last 3 bits, so I assume there's a reason.
uvec4 color = uvec4(
(c >> 10u) & 0xf8u,
(c >> 5u) & 0xf8u,
(c >> 0u) & 0xf8u,
(c & 7u));
imageStore(uOutput, ident, vec4(color) / 255.0);
#elif COLOR_BPP == 8
uvec4 color = uvec4(uvec3((c >> 3u) & 0xffu), c & 7u);
imageStore(uOutput, ident, vec4(color) / 255.0);
#endif
}
}
@@ -1,72 +0,0 @@
#ifndef BUFFERS_H_
#define BUFFERS_H_
#define MAX_COMBINERS 64
#define MAX_PRIMITIVES 1024u
#define MAX_PRIMITIVES_LOG2 12u
// A large 2D array texture holding all arrays.
layout(set = 0, binding = 0) uniform mediump usampler2DArray uDitherLUT;
layout(set = 0, binding = 1) uniform mediump usampler2D uCentroidLUT;
layout(set = 0, binding = 2, std140) uniform ZLUT
{
ivec2 encode[128];
ivec2 decode[8];
} depth_lut;
layout(std430, set = 1, binding = 0) readonly buffer PrimitiveData
{
RDPPrimitive data[];
} primitive_data;
layout(std430, set = 1, binding = 1) readonly buffer TileListsHeader
{
uint heads[];
} tile_list_header;
layout(std430, set = 1, binding = 2) readonly buffer TileList
{
uvec2 nodes[];
} tile_list;
layout(std430, set = 1, binding = 3) buffer Framebuffer
{
uint data[];
} framebuffer;
layout(std430, set = 1, binding = 4) buffer FramebufferDepth
{
uint data[];
} framebuffer_depth;
layout(std140, set = 1, binding = 5) uniform CombinerData
{
Combiner combiners[MAX_COMBINERS];
} combiner_data;
layout(std430, set = 1, binding = 6) readonly buffer TileDescriptors
{
TileDescriptor descriptors[];
} tile_descriptors;
layout(set = 1, binding = 7) uniform mediump usampler2DArray uTilemap;
layout(std430, set = 1, binding = 8) readonly buffer WorkList
{
WorkDescriptor desc[];
} work;
layout(std430, set = 1, binding = 9) buffer TileMemory
{
Tile tiles[];
} tile_buffer;
layout(push_constant, std430) uniform PushConstant
{
uvec2 FramebufferSize;
vec2 InvSizeTilemap;
uint TilesX;
int seed;
} constants;
#endif
@@ -1,30 +0,0 @@
#ifndef CLIP_H_
#define CLIP_H_
void clip_x(ivec2 clip, ivec4 xs, out ivec4 xsc, out bool curunder, out bool curover)
{
// Quantize X bounds down to 1/8th pixel resolution.
// Apply scissor and clipping in X.
// Very finicky math follows, see Angrylion.
ivec4 stickybit = ivec4(bvec4(xs & 0x3fff));
xsc = ((xs >> 13) & ~1) | stickybit;
// Clip against left side.
bvec4 under = lessThan(xsc, clip.xxxx);
xsc = mix(((xs >> 13) & 0x3ffe) | stickybit, clip.xxxx, under);
// Clip against right side.
xsc = xsc & 0x3fff;
bvec4 over = greaterThanEqual(xsc, clip.yyyy);
xsc = mix(xsc, clip.yyyy, over);
curunder = all(under);
curover = all(over);
}
ivec2 unpack_scissor(uint word)
{
return ivec2((uvec2(word) >> uvec2(0u, 16u)) & uvec2(0xffff));
}
#endif
@@ -1,114 +0,0 @@
#version 310 es
#ifndef TILE_SIZE_X
#define TILE_SIZE_X 8u
#endif
#ifndef TILE_SIZE_Y
#define TILE_SIZE_Y 8u
#endif
layout(local_size_x = TILE_SIZE_X, local_size_y = TILE_SIZE_Y) in;
#include "structs.h"
#include "flags.h"
#include "buffers.h"
#include "util.h"
#include "combiner.h"
#include "blender.h"
void main()
{
uvec2 local = gl_LocalInvocationID.xy;
uint tile_buffer_index = gl_WorkGroupID.x;
uint prim_id = LOD_INFO_PRIMITIVE(work.desc[tile_buffer_index].lod_info_primitive);
uint flags = primitive_data.data[prim_id].flags;
uint cycle_type = PRIMITIVE_CYCLE_TYPE(flags);
uint coverage_bits = COVERAGE(tile_buffer_index, local);
if ((coverage_bits & 0xffu) == 0u)
return;
if (cycle_type != CYCLE_TYPE_1 && cycle_type != CYCLE_TYPE_2)
return;
// Run combiner.
ivec4 sub_a, sub_b, mul, add;
uint combiner_instance = primitive_data.data[prim_id].span_stride_combiner & 0xffffu;
ivec4 combined = ivec4(0);
ivec4 sampled0 = ivec4(unpack_rgba8(SAMPLED0(tile_buffer_index, local)));
ivec4 sampled1 = ivec4(unpack_rgba8(SAMPLED1(tile_buffer_index, local)));
ivec4 sampled2 = ivec4(unpack_rgba8(SAMPLED2(tile_buffer_index, local)));
ivec4 shade = ivec4(unpack_rgba8(RGBA(tile_buffer_index, local)));
// 9-bit signed, will be sign-extended in combiner.
int lodfrac = int(coverage_bits >> 10u) & 0x1ff;
// First combiner stage.
// Only run in 2-cycle mode.
if (cycle_type == CYCLE_TYPE_2)
{
combiner_mux(sub_a, sub_b, mul, add, combiner_instance, 0u, sampled0, sampled1, shade, lodfrac, ivec4(0));
combined = combiner(sub_a, sub_b, mul, add);
// Next pipeline stage.
sampled0 = sampled1;
sampled1 = sampled2;
}
else
sampled1 = sampled2;
// Second combiner stage that can read previous combiner stage.
// TODO: Would be interesting to optimize cases where one combiner stage is "no-op" so we can use cycle 1 mode.
combiner_mux(sub_a, sub_b, mul, add, combiner_instance, 1u, sampled0, sampled1, shade, lodfrac, combined);
combined = combiner(sub_a, sub_b, mul, add);
#if 0
ivec4 mux = combiner_data.combiners[combiner_instance].color[1u];
if (all(equal(mux, ivec4(15, 15, 31, 4))))
combined = ivec4(0xff, 0, 0, 0x00);
#endif
// Get AA coverage.
uint coverage = uint(bitCount(coverage_bits & 0xffu));
// Deal with alpha-to-coverage and coverage-to-alpha.
combined.a = combined.a == 0xff ? 0x100 : combined.a;
uint alpha_times_coverage = (uint(combined.a) * coverage + 4u) >> 3u;
if (PRIMITIVE_ALPHA_TO_CVG(flags))
coverage = (alpha_times_coverage >> 5u) & 0xfu;
if (PRIMITIVE_CVG_TO_ALPHA(flags))
combined.a = int(PRIMITIVE_ALPHA_TO_CVG(flags) ? alpha_times_coverage : (coverage << 5u));
// Dither alpha
int adith = dither_alpha(primitive_data.data[prim_id].fill_color_blend);
combined.a += adith;
// Clamp alpha
combined.a = clamp(combined.a, 0, 0xff);
shade.a = clamp(shade.a + adith, 0, 0xff);
// Apply pre-blend step here.
if (cycle_type == CYCLE_TYPE_2)
{
combined.rgb = pre_blender(flags,
primitive_data.data[prim_id].fill_color_blend,
primitive_data.data[prim_id].blend_color,
work.desc[tile_buffer_index].fog_color,
shade.a, combined);
}
// We probably can't pack to 8 bits.
COMBINED(tile_buffer_index, local) = pack_rgba8(uvec4(clamp(combined, ivec4(0), ivec4(0xff))));
// Add post-alpha coverage.
COVERAGE(tile_buffer_index, local) = coverage_bits | (coverage << 24u);
if (adith != 0)
{
// Update shade alpha, but only if we need to.
RGBA(tile_buffer_index, local) = pack_rgba8(uvec4(shade));
}
}
@@ -1,104 +0,0 @@
#ifndef COMBINER_H_
#define COMBINER_H_
#include "util.h"
#include "noise.h"
ivec4 combiner(ivec4 sub_a, ivec4 sub_b, ivec4 mul, ivec4 add)
{
// Maps to special_9bit_exttable in Angrylion, no idea why this is used though :P
sub_a = special_9bit_ext(sub_a);
sub_b = special_9bit_ext(sub_b);
add = special_9bit_ext(add);
// Sign-extend 9-bit.
mul = (mul << 23) >> 23;
return special_9bit_clamp(((((sub_a - sub_b) * mul) + (add << 8) + 0x80) & 0x1ffff) >> ivec4(8));
}
// Should probably split this out to a mux which doesn't support Cycle 2 stuff ...
void combiner_mux(out ivec4 sub_a, out ivec4 sub_b, out ivec4 mul, out ivec4 add,
uint instance, uint c, ivec4 sampled0, ivec4 sampled1, ivec4 shade, int lodfrac, ivec4 combined)
{
// Preload static combiner inputs, and only mux in dynamic inputs.
sub_a = combiner_data.combiners[instance].cycle[c].sub_a;
sub_b = combiner_data.combiners[instance].cycle[c].sub_b;
mul = combiner_data.combiners[instance].cycle[c].mul;
add = combiner_data.combiners[instance].cycle[c].add;
// This is batshit insane :>
// Finding good ways to optimize this will be a challenge ...
// Only enabling possible paths in the whole pass to reduce the code bloat might be one approach.
// Others would be wild multipassing schemes or perhaps indirect compute to dispatch work ...
// Color
ivec4 mux = combiner_data.combiners[instance].color[c];
// SUB-A mux
if (mux.x == 0) sub_a.rgb = combined.rgb;
else if (mux.x == 1) sub_a.rgb = sampled0.rgb;
else if (mux.x == 2) sub_a.rgb = sampled1.rgb;
else if (mux.x == 4) sub_a.rgb = shade.rgb;
else if (mux.x == 7) sub_a.rgb = ivec3(sext_9bit(((noise8(1) & 7) << 6) | 0x20));
// SUB-B mux
if (mux.y == 0) sub_b.rgb = combined.rgb;
else if (mux.y == 1) sub_b.rgb = sampled0.rgb;
else if (mux.y == 2) sub_b.rgb = sampled1.rgb;
else if (mux.y == 4) sub_b.rgb = shade.rgb;
// MUL mux
if (mux.z == 0) mul.rgb = combined.rgb;
else if (mux.z == 1) mul.rgb = sampled0.rgb;
else if (mux.z == 2) mul.rgb = sampled1.rgb;
else if (mux.z == 4) mul.rgb = shade.rgb;
else if (mux.z == 7) mul.rgb = combined.aaa;
else if (mux.z == 8) mul.rgb = sampled0.aaa;
else if (mux.z == 9) mul.rgb = sampled1.aaa;
else if (mux.z == 11) mul.rgb = shade.aaa;
else if (mux.z == 13) mul.rgb = ivec3(lodfrac);
// ADD mux
if (mux.w == 0) add.rgb = combined.rgb;
else if (mux.w == 1) add.rgb = sampled0.rgb;
else if (mux.w == 2) add.rgb = sampled1.rgb;
else if (mux.w == 4) add.rgb = shade.rgb;
// Alpha
mux = combiner_data.combiners[instance].alpha[c];
if (mux.x == 0) sub_a.a = combined.a;
else if (mux.x == 1) sub_a.a = sampled0.a;
else if (mux.x == 2) sub_a.a = sampled1.a;
else if (mux.x == 4) sub_a.a = shade.a;
if (mux.y == 0) sub_b.a = combined.a;
else if (mux.y == 1) sub_b.a = sampled0.a;
else if (mux.y == 2) sub_b.a = sampled1.a;
else if (mux.y == 4) sub_b.a = shade.a;
if (mux.z == 0) mul.a = lodfrac;
if (mux.z == 1) mul.a = sampled0.a;
else if (mux.z == 2) mul.a = sampled1.a;
else if (mux.z == 4) mul.a = shade.a;
if (mux.w == 0) add.a = combined.a;
else if (mux.w == 1) add.a = sampled0.a;
else if (mux.w == 2) add.a = sampled1.a;
else if (mux.w == 4) add.a = shade.a;
}
int dither_alpha(uint blendword)
{
// Alpha dither depends on the color dither, so we need to look up based on the entire dither word.
if (ALPHA_DITHER_SEL(blendword) == 2u)
{
return noise8(2) & 7;
}
else
{
uint full_dither = FULL_DITHER_SEL(blendword);
return int(textureLod(uDitherLUT,
vec3((vec2(gl_GlobalInvocationID.xy) + 0.5) * 0.25,
float(full_dither)), 0.0).y);
}
}
#endif
File diff suppressed because it is too large. Load diff
@@ -1,35 +0,0 @@
#ifndef COVERAGE_H_
#define COVERAGE_H_
// RDP multisampling, the sampling pattern within a pixel is 8 samples within a 4x4 grid.
// o - o -
// - o - o
// o - o -
// - o - o
// where 'o' denotes the sampling points.
// The rasterizer quantizes the X coordinates to 1/8th of a pixel, rounds up to nearest qpel
// and creates a coverage mask from that.
uint compute_coverage(ivec4 lx, ivec4 rx, int x)
{
int eightpel = x * 8;
// We need 16 comparisons to form the sample mask for a pixel. 8 samples for left and right bounds.
// Fortunately, we can vectorize this neatly.
// The distinction between LEQ and LE ensures no overlapping coverage.
bvec4 left0 = lessThanEqual(lx, eightpel + ivec4(0, 2, 0, 2));
bvec4 left1 = lessThanEqual(lx, eightpel + ivec4(4, 6, 4, 6));
bvec4 right0 = lessThan(eightpel + ivec4(0, 2, 0, 2), rx);
bvec4 right1 = lessThan(eightpel + ivec4(4, 6, 4, 6), rx);
// The coverage is packed as follows, doesn't really matter, but makes debugging against Angrylion easier.
// 0x80 - 0x20 -
// - 0x40 - 0x10
// 0x08 - 0x02 -
// - 0x04 - 0x01
return uint(horizontalOr(bitwiseAnd(left0, right0) * ivec4(0x80, 0x40, 0x08, 0x04) +
bitwiseAnd(left1, right1) * ivec4(0x20, 0x10, 0x02, 0x01)));
}
#endif
-115
View File
@@ -1,115 +0,0 @@
#ifndef DEPTH_H_
#define DEPTH_H_
#include "buffers.h"
int dz_compress(int dz)
{
int j = 0;
// This looks similar to a log2 (CLZ), but it's not quite so sadly ...
if ((dz & 0xff00) != 0)
j |= 8;
if ((dz & 0xf0f0) != 0)
j |= 4;
if ((dz & 0xcccc) != 0)
j |= 2;
if ((dz & 0xaaaa) != 0)
j |= 1;
return j;
}
uint z_encode_fp(int mantissa, int exponent)
{
return uint((mantissa & 0x7ff) | (exponent << 11));
}
uint z_encode(int z)
{
int high = (z >> 11) & 0x7f;
ivec2 v = depth_lut.encode[high];
return z_encode_fp(z >> v.x, v.y);
}
int z_decode(uint z)
{
int exp = (int(z) >> 11) & 7;
int mantissa = int(z) & 0x7ff;
ivec2 v = depth_lut.decode[exp];
return ((mantissa << v.x) + v.y) & 0x3ffff;
}
uvec2 unpack_depth(uint word)
{
return uvec2((word >> 4u) & 0x3fffu, word & 0xfu);
}
uint pack_depth(uvec2 pixel_z)
{
return (pixel_z.x << 4u) | (pixel_z.y & 0xfu);
}
bool z_compare(uint flags, int z, int dz, uvec2 pixel_z,
bool overflow, out bool out_farther)
{
if (PRIMITIVE_Z_COMPARE(flags))
{
int dzmem = int(1u << pixel_z.y);
int oz = z_decode(pixel_z.x);
int precision_factor = (z >> 13) & 0xf;
bool force_coplanar = false;
if (precision_factor < 3)
{
if (dzmem != 0x8000)
{
dzmem = max(dzmem << 1, 16 >> precision_factor);
}
else
{
dzmem = 0xffff;
force_coplanar = true;
}
}
// Due to dz_normalize, we wouldn't ever see 0 here.
int newdz = 1 << findMSB(dzmem | dz | 1);
newdz <<= 3;
bool z_compare = false;
bool nearer = force_coplanar || ((z - newdz) <= oz);
bool farther = force_coplanar || ((z + newdz) >= oz);
bool infront = z < oz;
bool zmax = oz == 0x3ffff;
uint zmode = PRIMITIVE_Z_MODE(flags);
if (zmode == ZMODE_OPAQUE)
z_compare = zmax || (overflow ? infront : nearer);
else if (zmode == ZMODE_INTERPENETRATING)
{
if (!infront || !farther || !overflow)
{
z_compare = zmax || (overflow ? infront : nearer);
}
else
{
// Should modify coverage here.
z_compare = true;
}
}
else if (zmode == ZMODE_TRANSPARENT)
z_compare = zmax || infront;
else
z_compare = farther && nearer && !zmax;
out_farther = farther;
return z_compare;
}
else
{
out_farther = true;
return true;
}
}
#endif
@@ -1,60 +0,0 @@
#ifndef FLAGS_H_
#define FLAGS_H_
#define TEST_FLAG(flags, bit) ((int(flags) & (1 << bit)) != 0)
#define PRIMITIVE_IS_FLIP(flags) TEST_FLAG(flags, 0)
#define PRIMITIVE_DO_OFFSET(flags) TEST_FLAG(flags, 1)
#define PRIMITIVE_SAMPLE_TEX(flags) TEST_FLAG(flags, 2)
#define PRIMITIVE_FORCE_BLEND(flags) TEST_FLAG(flags, 3)
#define PRIMITIVE_AA_ENABLE(flags) TEST_FLAG(flags, 4)
#define PRIMITIVE_SHADE(flags) TEST_FLAG(flags, 5)
#define PRIMITIVE_INTERPOLATE_Z(flags) TEST_FLAG(flags, 6)
#define PRIMITIVE_Z_UPDATE(flags) TEST_FLAG(flags, 7)
#define PRIMITIVE_Z_COMPARE(flags) TEST_FLAG(flags, 8)
#define PRIMITIVE_PERSPECTIVE(flags) TEST_FLAG(flags, 9)
#define PRIMITIVE_BILERP0(flags) TEST_FLAG(flags, 10)
#define PRIMITIVE_BILERP1(flags) TEST_FLAG(flags, 11)
#define PRIMITIVE_ALPHATEST(flags) TEST_FLAG(flags, 12)
#define PRIMITIVE_COLOR_ON_CVG(flags) TEST_FLAG(flags, 13)
#define PRIMITIVE_ALPHA_TO_CVG(flags) TEST_FLAG(flags, 14)
#define PRIMITIVE_CVG_TO_ALPHA(flags) TEST_FLAG(flags, 15)
#define PRIMITIVE_ALPHA_NOISE(flags) TEST_FLAG(flags, 16)
#define PRIMITIVE_SAMPLE_TEX_PIPELINED(flags) TEST_FLAG(flags, 17)
#define PRIMITIVE_SAMPLE_TEX_LOD(flags) TEST_FLAG(flags, 18)
#define PRIMITIVE_INTERPOLATE_VARYINGS(flags) ((flags & (4u | 32u | 64u)) != 0u)
#define PRIMITIVE_CVG_MODE(flags) (((flags) >> 20u) & 0x3u)
#define PRIMITIVE_TILE(flags) (((flags) >> 22u) & 0x7u)
#define PRIMITIVE_LEVELS(flags) ((((flags) >> 25u) & 0x7u) + 1u)
#define PRIMITIVE_Z_MODE(flags) (((flags) >> 28u) & 0x3u)
#define PRIMITIVE_CYCLE_TYPE_IS_COPY(flags) ((flags & 0xc0000000u) == 0x80000000u)
#define PRIMITIVE_CYCLE_TYPE(flags) (((flags) >> 30u) & 0xfu)
#define RGB_DITHER_SEL(blendword) (((blendword) >> 18u) & 0x3u)
#define ALPHA_DITHER_SEL(blendword) (((blendword) >> 16u) & 0x3u)
#define FULL_DITHER_SEL(blendword) (((blendword) >> 16u) & 0xfu)
#define CYCLE_TYPE_1 0u
#define CYCLE_TYPE_2 1u
#define CYCLE_TYPE_COPY 2u
#define CYCLE_TYPE_FILL 3u
#define ZMODE_OPAQUE 0u
#define ZMODE_INTERPENETRATING 1u
#define ZMODE_TRANSPARENT 2u
#define ZMODE_DECAL 3u
#define CVG_MODE_CLAMP 0u
#define CVG_MODE_WRAP 1u
#define CVG_MODE_ZAP 2u
#define CVG_MODE_SAVE 3u
#define LOD_INFO_PRIMITIVE_DETAIL(flags) TEST_FLAG(flags, 16)
#define LOD_INFO_PRIMITIVE_SHARPEN(flags) TEST_FLAG(flags, 17)
#define LOD_INFO_PRIMITIVE(flags) ((flags) & 0xffffu)
#define LOD_INFO_PRIMITIVE_MIN_LOD(flags) int((flags) >> 18u)
#endif
@@ -1,15 +0,0 @@
#ifndef NOISE_H_
#define NOISE_H_
#include "buffers.h"
// Just some random crap. Not really important for now.
int noise8(int cookie)
{
vec2 uv = vec2(gl_GlobalInvocationID.xy) + vec2(float(constants.seed) * 1.135415, float(cookie) * 0.2378927);
float i = dot(vec2(1.2379, 1.98295), uv);
float c = fract(43758.5453123 * sin(i));
return int(255.0 * c);
}
#endif
@@ -1,158 +0,0 @@
#ifndef RASTERIZER_H_
#define RASTERIZER_H_
#include "coverage.h"
#include "clip.h"
uvec2 compute_coverage_counts(ivec4 lx, ivec4 rx, int xbase)
{
uvec2 counts = uvec2(0u);
for (int i = 0; i < 4; i++)
counts.x |= compute_coverage(lx, rx, xbase + i) << uint(8 * i);
for (int i = 0; i < 4; i++)
counts.y |= compute_coverage(lx, rx, xbase + 4 + i) << uint(8 * i);
return counts;
}
void compute_span(uint primitive, uint scanline, RDPPrimitive prim)
{
int y = int(gl_WorkGroupID.y * TILE_SIZE_Y + scanline) * RDP_SUBPIXELS;
// Unpack Y scissor.
ivec2 clip = unpack_scissor(prim.scissor_y);
// Scissor test and find Y bounds for where to rasterize.
int ycur = prim.yh & RDP_SUBPIXELS_INVMASK;
int yhlimit = max(prim.yh, clip.x);
int yllimit = min(prim.yl, clip.y);
int ylfar = yllimit | RDP_SUBPIXELS_MASK;
// Reject right away.
if ((y + RDP_SUBPIXELS) <= yhlimit || y >= ylfar)
{
span_buffer[scanline][primitive] = 0u;
return;
}
// Shifts and masks already applied on CPU.
int DxMDy = prim.DxMDy;
int DxHDy = prim.DxHDy;
int DxLDy = prim.DxLDy;
int xm = prim.xm;
int xh = prim.xh;
int xl = prim.xl;
// Compute X bounds, for all 4 Y subpixels.
// Use branchless mux logic to select appropriate version of xlr0.
ivec4 xlr0_above = xm + DxMDy * ((y - ycur) + ivec4(0, 1, 2, 3));
ivec4 xlr0_below = xl + DxLDy * ((y - prim.ym) + ivec4(0, 1, 2, 3));
ivec4 xlr0 = mix(xlr0_below, xlr0_above, lessThan(y + ivec4(0, 1, 2, 3), ivec4(prim.ym)));
ivec4 xlr1 = xh + DxHDy * ((y - ycur) + ivec4(0, 1, 2, 3));
// Clip X.
bvec2 curunder, curover;
ivec4 xlsc, xrsc;
// Unpack X scissor.
clip = unpack_scissor(prim.scissor_x) << 1;
clip_x(clip, xlr0, xlsc, curunder.x, curover.x);
clip_x(clip, xlr1, xrsc, curunder.y, curover.y);
bool flip = PRIMITIVE_IS_FLIP(prim.flags);
// Detect where the two lines cross.
// Get a boolean mask for which subscanlines have crossing scanlines.
// XXX: Shouldn't this be <=?
// XXX: Also, why the weird bitmath here?
bvec4 clipped = flip ?
lessThan((xlr0 & 0xfffc000) ^ 0x08000000, (xlr1 & 0xfffc000) ^ 0x08000000) :
lessThan((xlr1 & 0xfffc000) ^ 0x08000000, (xlr0 & 0xfffc000) ^ 0x08000000);
// Add subpixel Y clip here.
clipped = bitwiseOr(clipped,
lessThan(y + ivec4(0, 1, 2, 3), ivec4(yhlimit)),
greaterThanEqual(y + ivec4(0, 1, 2, 3), ivec4(yllimit)));
// TODO: Missing sckeepodd, scfield here. Interlacing?
// If we can invalidate the scanline for all subpixels in at least one of three ways, we can kill it early.
bool invalid = all(clipped) || all(curunder) || all(curover);
if (invalid)
{
span_buffer[scanline][primitive] = 0u;
return;
}
int xbase = int(gl_WorkGroupID.x * TILE_SIZE_X);
// Find the range where at least one subsample will hit a pixel in this scanline.
// Quantize to whole pixel as well.
int lx, rx;
if (flip)
{
// Intentionally clip out invalid scanlines so we don't get coverage for them and that they don't participate in min/max.
xrsc = mix(xrsc, ivec4(0x7fff), clipped);
xlsc = mix(xlsc, ivec4(0), clipped);
// Don't include invalid subsample scanlines in min/max.
lx = horizontalMin(xrsc >> 3);
rx = horizontalMax(xlsc >> 3);
// Find multisampled coverage.
uvec2 coverage = compute_coverage_counts(xrsc, xlsc, xbase);
coverage_buffer[scanline][primitive] = coverage;
}
else
{
// Intentionally clip out invalid scanlines so we don't get coverage for them and that they don't participate in min/max.
xlsc = mix(xlsc, ivec4(0x7fff), clipped);
xrsc = mix(xrsc, ivec4(0), clipped);
// Don't include invalid subsample scanlines in min/max.
lx = horizontalMin(xlsc >> 3);
rx = horizontalMax(xrsc >> 3);
// Find multisampled coverage.
uvec2 coverage = compute_coverage_counts(xlsc, xrsc, xbase);
coverage_buffer[scanline][primitive] = coverage;
}
int mask0 = mergeMask(
greaterThanEqual(xbase + ivec4(0, 1, 2, 3), ivec4(lx)),
lessThanEqual(xbase + ivec4(0, 1, 2, 3), ivec4(rx)));
int mask1 = mergeMask(
greaterThanEqual(xbase + ivec4(4, 5, 6, 7), ivec4(lx)),
lessThanEqual(xbase + ivec4(4, 5, 6, 7), ivec4(rx)));
uint cov = uint(mask0 + mask1 * 16);
span_buffer[scanline][primitive] = cov;
if (cov == 0u)
return;
// Interpolate varyings in Y.
if (PRIMITIVE_INTERPOLATE_VARYINGS(prim.flags))
{
// Varyings are interpolated along the major axis.
// For some reason, we sample at the 1st or 4th subpixel depending on some flags computed earlier ...
int xlr = PRIMITIVE_DO_OFFSET(prim.flags) ? xlr1.w : xlr1.x;
int unscrx = xlr >> 16;
int xfrac = (xlr >> 8) & 0xff;
ivec4 d_rgba_dxh = ivec4(0);
ivec4 d_stwz_dxh = ivec4(0);
if (!PRIMITIVE_CYCLE_TYPE_IS_COPY(prim.flags))
{
d_rgba_dxh = (prim.attr.d_rgba_dx >> 8) & ~1;
d_stwz_dxh = (prim.attr.d_stwz_dx >> 8) & ~1;
}
ivec4 rgba = prim.attr.rgba + ((y - ycur) >> 2) * prim.attr.d_rgba_de;
ivec4 stwz = prim.attr.stwz + ((y - ycur) >> 2) * prim.attr.d_stwz_de;
span_rgba[scanline][primitive] = ((rgba & ivec4(~0x1ff)) + prim.attr.d_rgba_diff - xfrac * d_rgba_dxh) & ivec4(~0x3ff);
span_stwz[scanline][primitive] = ((stwz & ivec4(~0x1ff)) + prim.attr.d_stwz_diff - xfrac * d_stwz_dxh) & ivec4(~0x3ff);
span_base_x[scanline][primitive] = unscrx;
}
}
#endif
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -1,227 +0,0 @@
#version 310 es
precision highp int;
precision highp float;
#ifndef TILE_SIZE_X
#define TILE_SIZE_X 8u
#endif
#ifndef TILE_SIZE_Y
#define TILE_SIZE_Y 8u
#endif
layout(local_size_x = TILE_SIZE_X, local_size_y = TILE_SIZE_Y) in;
#include "structs.h"
#include "flags.h"
#include "buffers.h"
#include "util.h"
#include "blender.h"
#if Z_BUFFER
#include "depth.h"
#endif
#define rdpprim primitive_data.data[current_prim]
void main()
{
uint tile_id = gl_WorkGroupID.y * constants.TilesX + gl_WorkGroupID.x;
uint head = tile_list_header.heads[tile_id];
if (head == -1u)
return;
uvec2 coord = gl_GlobalInvocationID.xy;
uvec2 local = gl_LocalInvocationID.xy;
uint framebuffer_offset = coord.y * constants.FramebufferSize.x + coord.x;
// Read from framebuffer.
#if COLOR_BPP == 32
uvec4 pixel = unpack_rgba8(framebuffer.data[framebuffer_offset]);
// Coverage is stored in the top 3 bits of alpha.
pixel.a >>= 5u;
#elif COLOR_BPP == 16
uint value = framebuffer.data[framebuffer_offset];
uvec4 pixel = uvec4(
(value >> 10u) & 0xf8u,
(value >> 5u) & 0xf8u,
(value >> 0u) & 0xf8u,
(value & 7u));
#elif COLOR_BPP == 8
// Splat.
uvec4 pixel = uvec4(framebuffer.data[framebuffer_offset] >> 3u);
// Coverage in 8-bpp always seems to be max.
pixel.a = framebuffer.data[framebuffer_offset] & 7u;
#endif
#if Z_BUFFER
#if COLOR_DEPTH_ALIAS
uvec2 pixel_z = unpack_depth(framebuffer.data[framebuffer_offset]);
#else
uvec2 pixel_z = unpack_depth(framebuffer_depth.data[framebuffer_offset]);
#endif
#endif
uvec2 node = uvec2(head);
do
{
node = tile_list.nodes[node.y];
uint current_prim = node.x;
uint tile = current_prim >> MAX_PRIMITIVES_LOG2;
current_prim &= (MAX_PRIMITIVES - 1u);
uint coverage_bits = COVERAGE(tile, local);
if ((coverage_bits & 0x100u) == 0u)
continue;
uint flags = rdpprim.flags;
uint cycle_type = PRIMITIVE_CYCLE_TYPE(flags);
// Early exit.
if ((cycle_type != CYCLE_TYPE_FILL) && ((coverage_bits & 0xffu) == 0u))
continue;
// This will need to be 16-bit eventually ...
int shadea = int(RGBA(tile, local) & 0xffu);
ivec4 combined = ivec4(unpack_rgba8(COMBINED(tile, local)));
uint post_alpha_coverage = coverage_bits >> 24u;
uint newcvg = pixel.a + post_alpha_coverage;
bool overflow = (newcvg & 8u) != 0u;
bool farther = true;
coverage_bits &= 0xffu;
// Compute Z as early as possible since if we fail Z-test, we can exit early.
#if Z_BUFFER
// dz is precomputed on CPU even for pixel Z.
int dz = rdpprim.primitive_z & 0xffff;
// TODO: Move to CPU.
int dzenc = dz_compress(dz);
int z = DEPTH(tile, local);
#endif
// Run different paths depending on what we need to do per primitive.
if (cycle_type == CYCLE_TYPE_FILL)
{
#if COLOR_BPP == 32
pixel = unpack_rgba8(rdpprim.fill_color_blend);
pixel.a >>= 5u;
#elif COLOR_BPP == 16
// Assume that fb_addr is always aligned.
uint addr = constants.FramebufferSize.x * gl_GlobalInvocationID.y + gl_GlobalInvocationID.x;
uint value = (rdpprim.fill_color_blend >> (16u * (~addr & 1u))) & 0xffffu;
pixel.r = (value >> 8u);
pixel.g = (value >> 3u);
pixel.b = (value << 2u);
pixel.rgb &= 0xf8u;
pixel.a = 7u * (value & 1u);
#elif COLOR_BPP == 8
// Assume that fb_addr is always aligned.
uint addr = constants.FramebufferSize.x * gl_GlobalInvocationID.y + gl_GlobalInvocationID.x;
uint value = (rdpprim.fill_color_blend >> (8u * (~addr & 3u))) & 0xffu;
pixel.r = value;
pixel.g = value;
pixel.b = value;
pixel.a = 7u * (value & 1u);
#endif
}
else if (cycle_type == CYCLE_TYPE_COPY)
{
bool coverage = (coverage_bits & 0x80u) != 0u;
// No idea why this would differ based on pixel type, but hey ...
#if COLOR_BPP == 16
bool alpha_fail = PRIMITIVE_ALPHATEST(flags) && combined.a == 0;
#elif COLOR_BPP == 8
int compare = PRIMITIVE_ALPHA_NOISE(flags) ? noise8(0) : int(rdpprim.blend_color & 0xffu);
bool alpha_fail = PRIMITIVE_ALPHATEST(flags) && (combined.a < compare);
#else
// Copy doesn't seem to be supposed to work in 32bpp mode.
bool alpha_fail = !PRIMITIVE_ALPHATEST(flags);
combined = ivec4(0);
#endif
if (coverage && !alpha_fail)
{
// Not sure if this how to deal with coverage in copy pipe, but seems to work for now.
pixel = uvec4(combined.rgb, combined.a >> 5);
}
}
else
{
#if Z_BUFFER
if (z_compare(flags, z, dz, pixel_z, overflow, farther))
#endif
{
bool blend_en;
if (blender(flags,
pixel, uvec2(post_alpha_coverage, coverage_bits),
rdpprim.fill_color_blend, rdpprim.blend_color, work.desc[tile].fog_color,
shadea, combined,
overflow, farther, blend_en,
cycle_type == CYCLE_TYPE_2 ? 2u : 0u))
{
#if Z_BUFFER
if (PRIMITIVE_Z_UPDATE(flags))
{
pixel_z.x = z_encode(z);
pixel_z.y = uint(dzenc);
}
#endif
uint cvg_mode = PRIMITIVE_CVG_MODE(flags);
if (cvg_mode == CVG_MODE_CLAMP)
{
// Bizarro mode be here :D
if (blend_en)
pixel.a = clamp(newcvg, 0u, 7u);
else
pixel.a = (post_alpha_coverage - 1u) & 7u;
}
else if (cvg_mode == CVG_MODE_WRAP)
pixel.a = newcvg & 7u;
else if (cvg_mode == CVG_MODE_ZAP)
pixel.a = 7u;
// Don't update coverage for SAVE.
}
}
}
#if COLOR_BPP == 32
// We already have full precision.
#elif COLOR_BPP == 16
// Chop off lower bits.
pixel.rgb &= ~7u;
#elif COLOR_BPP == 8
// In 8-bpp mode, duplicate R to G and B.
pixel.gb = pixel.rr;
// Coverage in 8-bpp always seems to be max.
pixel.a = 7u;
#endif
#if COLOR_DEPTH_ALIAS
// In this mode, we're writing to color along with read-only depth testing.
// After writing color, make sure to re-decode depth.
pixel_z = unpack_depth((pixel.r << 10u) | (pixel.g << 5u) | (pixel.b << 0u) | (pixel.a));
#endif
} while (node.y != -1u);
// Write back framebuffer.
#if COLOR_BPP == 32
// Coverage bits are written in alpha.
pixel.a <<= 5u;
framebuffer.data[framebuffer_offset] = pack_rgba8(pixel);
#elif COLOR_BPP == 16
framebuffer.data[framebuffer_offset] = (pixel.r << 10u) | (pixel.g << 5u) | (pixel.b << 0u) | (pixel.a);
#elif COLOR_BPP == 8
// In 8bpp mode, write out the red channel.
// We need to pass down coverage bits here as well, but whatever.
framebuffer.data[framebuffer_offset] = ((pixel.r & 0xffu) << 3u) | ((pixel.r & 1u) * 7u);
#endif
#if Z_BUFFER && !COLOR_DEPTH_ALIAS
framebuffer_depth.data[framebuffer_offset] = pack_depth(pixel_z);
#endif
}
@@ -1,101 +0,0 @@
#ifndef STRUCTS_H_
#define STRUCTS_H_
struct WorkDescriptor
{
uvec2 base;
uint lod_info_primitive;
// This really shouldn't be here, but we had 4 bytes to spare and RDPPrimitive is full ...
uint fog_color;
};
struct Tile
{
uint uv[TILE_SIZE_Y][TILE_SIZE_X];
uint uv_next[TILE_SIZE_Y][TILE_SIZE_X];
uint uv_prev_y[TILE_SIZE_Y][TILE_SIZE_X];
int z[TILE_SIZE_Y][TILE_SIZE_X];
uint rgba[TILE_SIZE_Y][TILE_SIZE_X];
uint coverage[TILE_SIZE_Y][TILE_SIZE_X];
};
#define COVERAGE(tile, local) (tile_buffer.tiles[tile].coverage[local.y][local.x])
#define RGBA(tile, local) (tile_buffer.tiles[tile].rgba[local.y][local.x])
#define UV(tile, local) (tile_buffer.tiles[tile].uv[local.y][local.x])
#define UV_NEXT(tile, local) (tile_buffer.tiles[tile].uv_next[local.y][local.x])
#define UV_PREV_Y(tile, local) (tile_buffer.tiles[tile].uv_prev_y[local.y][local.x])
#define DEPTH(tile, local) (tile_buffer.tiles[tile].z[local.y][local.x])
// Reuse memory
#define SAMPLED0(tile, local) UV(tile, local)
#define SAMPLED1(tile, local) UV_NEXT(tile, local)
#define SAMPLED2(tile, local) UV_PREV_Y(tile, local)
#define COMBINED(tile, local) UV(tile, local)
struct RDPAttribute
{
// 1 cacheline
ivec4 rgba;
ivec4 d_rgba_dx;
ivec4 d_rgba_de;
ivec4 d_rgba_dy;
// 1 cacheline
ivec4 stwz;
ivec4 d_stwz_dx;
ivec4 d_stwz_de;
ivec4 d_stwz_dy;
ivec4 d_rgba_diff;
ivec4 d_stwz_diff;
// 32 bytes tile descriptor indices.
uint tile_descriptor[8];
};
// 256 bytes per primitive.
struct RDPPrimitive
{
// 64 bytes, should be aligned to cache line.
int xl, xm, xh, primitive_z;
int yl, ym, yh; uint span_stride_combiner;
int DxLDy, DxMDy, DxHDy; uint blend_color;
uint flags, scissor_x, scissor_y, fill_color_blend;
// Only read if we need to.
// 3x64 bytes.
RDPAttribute attr;
};
struct TileDescriptor
{
uvec4 payload0;
uvec4 payload1;
uvec4 payload2;
uvec4 payload3;
};
#define TILE_MASK(desc) ivec2(desc.payload0.xy)
#define TILE_MIRROR(desc) ivec2(desc.payload0.zw)
#define TILE_CLAMP_MIN(desc) ivec2(desc.payload1.xy)
#define TILE_CLAMP_MAX(desc) ivec2(desc.payload1.zw)
#define TILE_OFFSET(desc) uintBitsToFloat(desc.payload2.xy)
#define TILE_BASE(desc) ivec2(desc.payload2.zw)
#define TILE_SHIFT(desc) ivec2(desc.payload3.xy)
#define TILE_LAYER(desc) uintBitsToFloat(desc.payload3.z)
#define TILE_MID_TEXEL(desc) int(desc.payload3.w)
struct CombinerBaked
{
ivec4 sub_a, sub_b, mul, add;
};
struct Combiner
{
CombinerBaked cycle[2];
ivec4 color[2];
ivec4 alpha[2];
ivec4 padding[4];
};
#endif
@@ -1,141 +0,0 @@
#version 310 es
#ifndef TILE_SIZE_X
#define TILE_SIZE_X 8u
#endif
#ifndef TILE_SIZE_Y
#define TILE_SIZE_Y 8u
#endif
layout(local_size_x = TILE_SIZE_X, local_size_y = TILE_SIZE_Y) in;
#include "structs.h"
#include "flags.h"
#include "buffers.h"
#include "util.h"
#include "textures.h"
int compute_lod(ivec2 uv, ivec2 uv_next, ivec2 uv_prev_y)
{
ivec2 x = abs(uv_next - uv);
ivec2 y = abs(uv_prev_y - uv);
int lodx = max(x.x, x.y);
int lody = max(y.x, y.y);
int max_lod = max(lodx, lody);
int lod = max_lod & 0x7fff;
if ((max_lod & 0x1c000) != 0)
lod |= 0x4000;
return lod;
}
void main()
{
uvec2 local = gl_LocalInvocationID.xy;
uint tile_buffer_index = gl_WorkGroupID.x;
uint lod_info_primitive = work.desc[tile_buffer_index].lod_info_primitive;
uint prim_id = LOD_INFO_PRIMITIVE(lod_info_primitive);
uint flags = primitive_data.data[prim_id].flags;
uint coverage_bits = COVERAGE(tile_buffer_index, local);
if ((coverage_bits & 0xffu) == 0u || !PRIMITIVE_SAMPLE_TEX(flags))
return;
ivec2 uv = unpack_s16(UV(tile_buffer_index, local));
ivec2 uv_next = unpack_s16(UV_NEXT(tile_buffer_index, local));
int primitive_tile = int(PRIMITIVE_TILE(flags));
int l_tile = 0;
int l_tile_1 = 1;
int lodfrac = 0xff;
int mips = int(PRIMITIVE_LEVELS(flags));
if (PRIMITIVE_SAMPLE_TEX_LOD(flags))
{
bool detail = LOD_INFO_PRIMITIVE_DETAIL(lod_info_primitive);
bool sharpen = LOD_INFO_PRIMITIVE_SHARPEN(lod_info_primitive);
int min_lod_base = LOD_INFO_PRIMITIVE_MIN_LOD(lod_info_primitive);
int min_lod = (detail || sharpen) ? min_lod_base : 32;
// Detail mip chains have an extra level. The actual mip-chain starts at 1.
// The first mip-level is a special mip-level.
int real_mips = mips - (detail ? 1 : 0);
ivec2 uv_prev_y = unpack_s16(UV_PREV_Y(tile_buffer_index, local));
int lod = compute_lod(uv, uv_next, uv_prev_y);
// Uncertain what lodclamp is supposed to achieve here, probably related
// to wrapping behavior.
//
// Need to understand this better.
// It is causing glitches in JFG intro because negative UV coordinates trigger this with mipmaps.
// However, tcdiv_ptr masks out the first 17-bits and only adds back bits if w <= 0,
// so it seems extremely unlikely to ever matter in practice ...
#if 0
ivec2 mask = uv | uv_next | uv_prev_y;
ivec2 mask = uv;
ivec2 mask = ivec2(0);
bool lodclamp = ((mask.x | mask.y) & 0x60000) != 0;
if ((lod & 0x4000) != 0 || lodclamp)
lod = 0x7fff;
#else
if ((lod & 0x4000) != 0)
lod = 0x7fff;
#endif
bool magnify = lod < 32;
// min_lod is maximum 31 for detail/sharpen,
// so applying min lod after magnify test is fine.
lod = max(lod, min_lod);
// Compute the LOD fraction.
l_tile = findMSB(max(uint(lod >> 5) & 0xffu, 1u));
bool distant = ((lod & 0x6000) != 0) || (l_tile >= int(real_mips));
if (distant && !detail && !sharpen)
lodfrac = 0xff;
else
lodfrac = ((lod << 3) >> l_tile) & 0xff;
// Negative lerp factor to sharpen.
if (sharpen && magnify)
lodfrac |= 0x100;
// Clamp LOD.
if (distant)
l_tile = int(mips) - 1;
if (detail)
{
// If we're magnifying, pull in mip-levels 0 and 1.
// If distant, pull in the two last mip-levels.
// In the middle, pull in L + 1, L + 2.
l_tile += magnify ? 0 : 1;
l_tile_1 = l_tile + (!distant ? 1 : 0);
}
else
{
bool clamped = distant || (!sharpen && magnify);
l_tile_1 = l_tile + (clamped ? 0 : 1);
}
}
// Encode in lodfrac as combiner needs it.
coverage_bits |= uint(lodfrac & 0x1ff) << 10u;
COVERAGE(tile_buffer_index, local) = coverage_bits;
uint tile = primitive_data.data[prim_id].attr.tile_descriptor[(primitive_tile + l_tile) & 7];
// This will need to be 16-bit eventually ...
SAMPLED0(tile_buffer_index, local) = pack_rgba8(uvec4(sample_tile(tile, uv, int(PRIMITIVE_BILERP0(flags)))));
if (PRIMITIVE_SAMPLE_TEX_PIPELINED(flags))
SAMPLED2(tile_buffer_index, local) = pack_rgba8(uvec4(sample_tile(tile, uv_next, int(PRIMITIVE_BILERP0(flags)))));
if (mips > 1 || PRIMITIVE_SAMPLE_TEX_LOD(flags))
{
uint next_tile = primitive_data.data[prim_id].attr.tile_descriptor[(primitive_tile + l_tile_1) & 7];
SAMPLED1(tile_buffer_index, local) = pack_rgba8(uvec4(sample_tile(next_tile, uv, int(PRIMITIVE_BILERP1(flags)))));
}
}
File diff suppressed because it is too large. Load diff
@@ -1,64 +0,0 @@
#ifndef TEXTURES_H_
#define TEXTURES_H_
vec2 uv_wrap(vec2 offset, ivec2 uv, ivec2 mirror, ivec2 mask)
{
// Mirroring
bvec2 no_mirror = equal(uv & mirror, ivec2(0));
ivec2 st = uv ^ mix(ivec2(-1), ivec2(0), no_mirror);
// Masking
return vec2(st & mask) * constants.InvSizeTilemap + offset;
}
#define desc tile_descriptors.descriptors[tile]
ivec4 sample_tile(uint tile, ivec2 st, int bilerp)
{
// Apply shift
st = mix(st >> TILE_SHIFT(desc), st << (16 - TILE_SHIFT(desc)), greaterThan(TILE_SHIFT(desc), ivec2(10)));
// Shift to tile base
st -= TILE_BASE(desc);
// Clamp. We always end up clamping to center of texel, so we don't have to clamp per texel at least ...
st = clamp(st, TILE_CLAMP_MIN(desc), TILE_CLAMP_MAX(desc));
ivec2 frac = (st & 0x1f) * bilerp;
st >>= 5;
// Mirroring
vec2 uv0 = uv_wrap(TILE_OFFSET(desc), st, TILE_MIRROR(desc), TILE_MASK(desc));
ivec4 t0 = ivec4(textureLod(uTilemap, vec3(uv0, TILE_LAYER(desc)), 0.0));
// Nearest, only need to sample one texel.
if (all(equal(frac, ivec2(0))))
return t0;
// Sample rest of quad foot-print.
vec2 uv1 = uv_wrap(TILE_OFFSET(desc), st + ivec2(1, 0), TILE_MIRROR(desc), TILE_MASK(desc));
vec2 uv2 = uv_wrap(TILE_OFFSET(desc), st + ivec2(0, 1), TILE_MIRROR(desc), TILE_MASK(desc));
vec2 uv3 = uv_wrap(TILE_OFFSET(desc), st + ivec2(1, 1), TILE_MIRROR(desc), TILE_MASK(desc));
ivec4 t1 = ivec4(textureLod(uTilemap, vec3(uv1, TILE_LAYER(desc)), 0.0));
ivec4 t2 = ivec4(textureLod(uTilemap, vec3(uv2, TILE_LAYER(desc)), 0.0));
ivec4 t3 = ivec4(textureLod(uTilemap, vec3(uv3, TILE_LAYER(desc)), 0.0));
// Sample center, average all texels.
if (TILE_MID_TEXEL(desc) != 0 && all(equal(frac, ivec2(0x10))))
return ((t0 + t1 + t2 + t3) + 2) >> 2;
else
{
// Infamous three-sample bilerp :3
bool upper = (frac.x + frac.y) >= 0x20;
if (upper)
{
frac = 0x20 - frac;
return t3 + ((frac.x * (t2 - t3) + frac.y * (t1 - t3) + 0x10) >> 5);
}
else
return t0 + ((frac.x * (t1 - t0) + frac.y * (t2 - t0) + 0x10) >> 5);
}
}
#undef desc
#endif
@@ -1,69 +0,0 @@
#version 310 es
precision highp int;
precision highp float;
layout(local_size_x = 8, local_size_y = 8) in;
layout(std430, set = 0, binding = 0) readonly buffer SSBO
{
uint pixels[];
};
layout(rgba8ui, set = 0, binding = 1) uniform writeonly mediump uimage2DArray uTileAtlas;
layout(std430, push_constant) uniform PushConstant
{
ivec3 atlas_coord;
uvec2 size;
uint offset;
uint range;
uint stride;
} constants;
#define TRANSFER_RGBA32 0
#define TRANSFER_RGBA16 1
#define TRANSFER_I8 2
#define TRANSFER_IA8 3
#define TRANSFER_IA16 4
void main()
{
uvec2 id = gl_GlobalInvocationID.xy;
if (any(greaterThanEqual(id, constants.size)))
return;
uint pixel = constants.stride * id.y + id.x;
// Out-of-bounds debug color.
uvec4 color = uvec4(0xffu, 0x80u, 0x40, 0xffu);
if (pixel < constants.range)
{
uint data = pixels[pixel + constants.offset];
#if TRANSFER == TRANSFER_RGBA32
color = (uvec4(data) >> uvec4(24u, 16u, 8u, 0u)) & uvec4(0xffu, 0xffu, 0xffu, 0x7u << 5u);
#elif TRANSFER == TRANSFER_RGBA16
color = uvec4(
(data >> 10u) & 0xf8u,
(data >> 5u) & 0xf8u,
(data >> 0u) & 0xf8u,
(data & 8u) != 0u ? 0xffu : 0u);
color.rgb |= color.rgb >> 5u;
#elif TRANSFER == TRANSFER_I8
color = uvec4((data >> 3u) & 0xffu);
#elif TRANSFER == TRANSFER_IA8
uint i = (data >> 7u) & 0xfu;
uint a = (data >> 3u) & 0xfu;
i |= i << 4u;
a |= a << 4u;
color = uvec4(i, i, i, a);
#elif TRANSFER == TRANSFER_IA16
uint i = (data >> 10u) & 0xffu;
uint a = (data >> 2u) & 0xffu;
color = uvec4(i, i, i, a);
#else
#error Unknown transfer type
#endif
}
imageStore(uTileAtlas, constants.atlas_coord + ivec3(gl_GlobalInvocationID.xyz), color);
}
@@ -1,156 +0,0 @@
{0x07230203,0x00010000,0x00080001,0x0000005c,
0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,
0x00000000,0x0003000e,0x00000000,0x00000001,
0x0006000f,0x00000005,0x00000004,0x6e69616d,
0x00000000,0x0000000c,0x00060010,0x00000004,
0x00000011,0x00000008,0x00000008,0x00000001,
0x00030003,0x00000001,0x00000136,0x000a0004,
0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,
0x5f656c79,0x656e696c,0x7269645f,0x69746365,
0x00006576,0x00080004,0x475f4c47,0x4c474f4f,
0x6e695f45,0x64756c63,0x69645f65,0x74636572,
0x00657669,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00030005,0x00000009,0x00006469,
0x00080005,0x0000000c,0x475f6c67,0x61626f6c,
0x766e496c,0x7461636f,0x496e6f69,0x00000044,
0x00060005,0x00000012,0x68737550,0x736e6f43,
0x746e6174,0x00000000,0x00060006,0x00000012,
0x00000000,0x616c7461,0x6f635f73,0x0064726f,
0x00050006,0x00000012,0x00000001,0x657a6973,
0x00000000,0x00050006,0x00000012,0x00000002,
0x7366666f,0x00007465,0x00050006,0x00000012,
0x00000003,0x676e6172,0x00000065,0x00050006,
0x00000012,0x00000004,0x69727473,0x00006564,
0x00050005,0x00000014,0x736e6f63,0x746e6174,
0x00000073,0x00040005,0x00000021,0x65786970,
0x0000006c,0x00040005,0x00000030,0x6f6c6f63,
0x00000072,0x00040005,0x0000003c,0x61746164,
0x00000000,0x00040005,0x0000003e,0x4f425353,
0x00000000,0x00050006,0x0000003e,0x00000000,
0x65786970,0x0000736c,0x00030005,0x00000040,
0x00000000,0x00050005,0x00000051,0x6c695475,
0x6c744165,0x00007361,0x00040047,0x0000000c,
0x0000000b,0x0000001c,0x00050048,0x00000012,
0x00000000,0x00000023,0x00000000,0x00050048,
0x00000012,0x00000001,0x00000023,0x00000010,
0x00050048,0x00000012,0x00000002,0x00000023,
0x00000018,0x00050048,0x00000012,0x00000003,
0x00000023,0x0000001c,0x00050048,0x00000012,
0x00000004,0x00000023,0x00000020,0x00030047,
0x00000012,0x00000002,0x00040047,0x0000003d,
0x00000006,0x00000004,0x00040048,0x0000003e,
0x00000000,0x00000018,0x00050048,0x0000003e,
0x00000000,0x00000023,0x00000000,0x00030047,
0x0000003e,0x00000003,0x00040047,0x00000040,
0x00000022,0x00000000,0x00040047,0x00000040,
0x00000021,0x00000000,0x00030047,0x00000051,
0x00000000,0x00040047,0x00000051,0x00000022,
0x00000000,0x00040047,0x00000051,0x00000021,
0x00000001,0x00030047,0x00000051,0x00000019,
0x00030047,0x00000052,0x00000000,0x00040047,
0x0000005b,0x0000000b,0x00000019,0x00020013,
0x00000002,0x00030021,0x00000003,0x00000002,
0x00040015,0x00000006,0x00000020,0x00000000,
0x00040017,0x00000007,0x00000006,0x00000002,
0x00040020,0x00000008,0x00000007,0x00000007,
0x00040017,0x0000000a,0x00000006,0x00000003,
0x00040020,0x0000000b,0x00000001,0x0000000a,
0x0004003b,0x0000000b,0x0000000c,0x00000001,
0x00040015,0x00000010,0x00000020,0x00000001,
0x00040017,0x00000011,0x00000010,0x00000003,
0x0007001e,0x00000012,0x00000011,0x00000007,
0x00000006,0x00000006,0x00000006,0x00040020,
0x00000013,0x00000009,0x00000012,0x0004003b,
0x00000013,0x00000014,0x00000009,0x0004002b,
0x00000010,0x00000015,0x00000001,0x00040020,
0x00000016,0x00000009,0x00000007,0x00020014,
0x00000019,0x00040017,0x0000001a,0x00000019,
0x00000002,0x00040020,0x00000020,0x00000007,
0x00000006,0x0004002b,0x00000010,0x00000022,
0x00000004,0x00040020,0x00000023,0x00000009,
0x00000006,0x0004002b,0x00000006,0x00000026,
0x00000001,0x0004002b,0x00000006,0x0000002a,
0x00000000,0x00040017,0x0000002e,0x00000006,
0x00000004,0x00040020,0x0000002f,0x00000007,
0x0000002e,0x0004002b,0x00000006,0x00000031,
0x000000ff,0x0004002b,0x00000006,0x00000032,
0x00000080,0x0004002b,0x00000006,0x00000033,
0x00000040,0x0007002c,0x0000002e,0x00000034,
0x00000031,0x00000032,0x00000033,0x00000031,
0x0004002b,0x00000010,0x00000036,0x00000003,
0x0003001d,0x0000003d,0x00000006,0x0003001e,
0x0000003e,0x0000003d,0x00040020,0x0000003f,
0x00000002,0x0000003e,0x0004003b,0x0000003f,
0x00000040,0x00000002,0x0004002b,0x00000010,
0x00000041,0x00000000,0x0004002b,0x00000010,
0x00000043,0x00000002,0x00040020,0x00000047,
0x00000002,0x00000006,0x0004002b,0x00000006,
0x0000004b,0x00000003,0x00090019,0x0000004f,
0x00000006,0x00000001,0x00000000,0x00000001,
0x00000000,0x00000002,0x00000020,0x00040020,
0x00000050,0x00000000,0x0000004f,0x0004003b,
0x00000050,0x00000051,0x00000000,0x00040020,
0x00000053,0x00000009,0x00000011,0x0004002b,
0x00000006,0x0000005a,0x00000008,0x0006002c,
0x0000000a,0x0000005b,0x0000005a,0x0000005a,
0x00000026,0x00050036,0x00000002,0x00000004,
0x00000000,0x00000003,0x000200f8,0x00000005,
0x0004003b,0x00000008,0x00000009,0x00000007,
0x0004003b,0x00000020,0x00000021,0x00000007,
0x0004003b,0x0000002f,0x00000030,0x00000007,
0x0004003b,0x00000020,0x0000003c,0x00000007,
0x0004003d,0x0000000a,0x0000000d,0x0000000c,
0x0007004f,0x00000007,0x0000000e,0x0000000d,
0x0000000d,0x00000000,0x00000001,0x0003003e,
0x00000009,0x0000000e,0x0004003d,0x00000007,
0x0000000f,0x00000009,0x00050041,0x00000016,
0x00000017,0x00000014,0x00000015,0x0004003d,
0x00000007,0x00000018,0x00000017,0x000500ae,
0x0000001a,0x0000001b,0x0000000f,0x00000018,
0x0004009a,0x00000019,0x0000001c,0x0000001b,
0x000300f7,0x0000001e,0x00000000,0x000400fa,
0x0000001c,0x0000001d,0x0000001e,0x000200f8,
0x0000001d,0x000100fd,0x000200f8,0x0000001e,
0x00050041,0x00000023,0x00000024,0x00000014,
0x00000022,0x0004003d,0x00000006,0x00000025,
0x00000024,0x00050041,0x00000020,0x00000027,
0x00000009,0x00000026,0x0004003d,0x00000006,
0x00000028,0x00000027,0x00050084,0x00000006,
0x00000029,0x00000025,0x00000028,0x00050041,
0x00000020,0x0000002b,0x00000009,0x0000002a,
0x0004003d,0x00000006,0x0000002c,0x0000002b,
0x00050080,0x00000006,0x0000002d,0x00000029,
0x0000002c,0x0003003e,0x00000021,0x0000002d,
0x0003003e,0x00000030,0x00000034,0x0004003d,
0x00000006,0x00000035,0x00000021,0x00050041,
0x00000023,0x00000037,0x00000014,0x00000036,
0x0004003d,0x00000006,0x00000038,0x00000037,
0x000500b0,0x00000019,0x00000039,0x00000035,
0x00000038,0x000300f7,0x0000003b,0x00000000,
0x000400fa,0x00000039,0x0000003a,0x0000003b,
0x000200f8,0x0000003a,0x0004003d,0x00000006,
0x00000042,0x00000021,0x00050041,0x00000023,
0x00000044,0x00000014,0x00000043,0x0004003d,
0x00000006,0x00000045,0x00000044,0x00050080,
0x00000006,0x00000046,0x00000042,0x00000045,
0x00060041,0x00000047,0x00000048,0x00000040,
0x00000041,0x00000046,0x0004003d,0x00000006,
0x00000049,0x00000048,0x0003003e,0x0000003c,
0x00000049,0x0004003d,0x00000006,0x0000004a,
0x0000003c,0x000500c2,0x00000006,0x0000004c,
0x0000004a,0x0000004b,0x000500c7,0x00000006,
0x0000004d,0x0000004c,0x00000031,0x00070050,
0x0000002e,0x0000004e,0x0000004d,0x0000004d,
0x0000004d,0x0000004d,0x0003003e,0x00000030,
0x0000004e,0x000200f9,0x0000003b,0x000200f8,
0x0000003b,0x0004003d,0x0000004f,0x00000052,
0x00000051,0x00050041,0x00000053,0x00000054,
0x00000014,0x00000041,0x0004003d,0x00000011,
0x00000055,0x00000054,0x0004003d,0x0000000a,
0x00000056,0x0000000c,0x0004007c,0x00000011,
0x00000057,0x00000056,0x00050080,0x00000011,
0x00000058,0x00000055,0x00000057,0x0004003d,
0x0000002e,0x00000059,0x00000030,0x00040063,
0x00000052,0x00000058,0x00000059,0x000100fd,
0x00010038}
@@ -1,169 +0,0 @@
{0x07230203,0x00010000,0x00080001,0x00000066,
0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,
0x00000000,0x0003000e,0x00000000,0x00000001,
0x0006000f,0x00000005,0x00000004,0x6e69616d,
0x00000000,0x0000000c,0x00060010,0x00000004,
0x00000011,0x00000008,0x00000008,0x00000001,
0x00030003,0x00000001,0x00000136,0x000a0004,
0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,
0x5f656c79,0x656e696c,0x7269645f,0x69746365,
0x00006576,0x00080004,0x475f4c47,0x4c474f4f,
0x6e695f45,0x64756c63,0x69645f65,0x74636572,
0x00657669,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00030005,0x00000009,0x00006469,
0x00080005,0x0000000c,0x475f6c67,0x61626f6c,
0x766e496c,0x7461636f,0x496e6f69,0x00000044,
0x00060005,0x00000012,0x68737550,0x736e6f43,
0x746e6174,0x00000000,0x00060006,0x00000012,
0x00000000,0x616c7461,0x6f635f73,0x0064726f,
0x00050006,0x00000012,0x00000001,0x657a6973,
0x00000000,0x00050006,0x00000012,0x00000002,
0x7366666f,0x00007465,0x00050006,0x00000012,
0x00000003,0x676e6172,0x00000065,0x00050006,
0x00000012,0x00000004,0x69727473,0x00006564,
0x00050005,0x00000014,0x736e6f63,0x746e6174,
0x00000073,0x00040005,0x00000021,0x65786970,
0x0000006c,0x00040005,0x00000030,0x6f6c6f63,
0x00000072,0x00040005,0x0000003c,0x61746164,
0x00000000,0x00040005,0x0000003e,0x4f425353,
0x00000000,0x00050006,0x0000003e,0x00000000,
0x65786970,0x0000736c,0x00030005,0x00000040,
0x00000000,0x00030005,0x0000004a,0x00000069,
0x00030005,0x0000004f,0x00000061,0x00050005,
0x0000005b,0x6c695475,0x6c744165,0x00007361,
0x00040047,0x0000000c,0x0000000b,0x0000001c,
0x00050048,0x00000012,0x00000000,0x00000023,
0x00000000,0x00050048,0x00000012,0x00000001,
0x00000023,0x00000010,0x00050048,0x00000012,
0x00000002,0x00000023,0x00000018,0x00050048,
0x00000012,0x00000003,0x00000023,0x0000001c,
0x00050048,0x00000012,0x00000004,0x00000023,
0x00000020,0x00030047,0x00000012,0x00000002,
0x00040047,0x0000003d,0x00000006,0x00000004,
0x00040048,0x0000003e,0x00000000,0x00000018,
0x00050048,0x0000003e,0x00000000,0x00000023,
0x00000000,0x00030047,0x0000003e,0x00000003,
0x00040047,0x00000040,0x00000022,0x00000000,
0x00040047,0x00000040,0x00000021,0x00000000,
0x00030047,0x0000005b,0x00000000,0x00040047,
0x0000005b,0x00000022,0x00000000,0x00040047,
0x0000005b,0x00000021,0x00000001,0x00030047,
0x0000005b,0x00000019,0x00030047,0x0000005c,
0x00000000,0x00040047,0x00000065,0x0000000b,
0x00000019,0x00020013,0x00000002,0x00030021,
0x00000003,0x00000002,0x00040015,0x00000006,
0x00000020,0x00000000,0x00040017,0x00000007,
0x00000006,0x00000002,0x00040020,0x00000008,
0x00000007,0x00000007,0x00040017,0x0000000a,
0x00000006,0x00000003,0x00040020,0x0000000b,
0x00000001,0x0000000a,0x0004003b,0x0000000b,
0x0000000c,0x00000001,0x00040015,0x00000010,
0x00000020,0x00000001,0x00040017,0x00000011,
0x00000010,0x00000003,0x0007001e,0x00000012,
0x00000011,0x00000007,0x00000006,0x00000006,
0x00000006,0x00040020,0x00000013,0x00000009,
0x00000012,0x0004003b,0x00000013,0x00000014,
0x00000009,0x0004002b,0x00000010,0x00000015,
0x00000001,0x00040020,0x00000016,0x00000009,
0x00000007,0x00020014,0x00000019,0x00040017,
0x0000001a,0x00000019,0x00000002,0x00040020,
0x00000020,0x00000007,0x00000006,0x0004002b,
0x00000010,0x00000022,0x00000004,0x00040020,
0x00000023,0x00000009,0x00000006,0x0004002b,
0x00000006,0x00000026,0x00000001,0x0004002b,
0x00000006,0x0000002a,0x00000000,0x00040017,
0x0000002e,0x00000006,0x00000004,0x00040020,
0x0000002f,0x00000007,0x0000002e,0x0004002b,
0x00000006,0x00000031,0x000000ff,0x0004002b,
0x00000006,0x00000032,0x00000080,0x0004002b,
0x00000006,0x00000033,0x00000040,0x0007002c,
0x0000002e,0x00000034,0x00000031,0x00000032,
0x00000033,0x00000031,0x0004002b,0x00000010,
0x00000036,0x00000003,0x0003001d,0x0000003d,
0x00000006,0x0003001e,0x0000003e,0x0000003d,
0x00040020,0x0000003f,0x00000002,0x0000003e,
0x0004003b,0x0000003f,0x00000040,0x00000002,
0x0004002b,0x00000010,0x00000041,0x00000000,
0x0004002b,0x00000010,0x00000043,0x00000002,
0x00040020,0x00000047,0x00000002,0x00000006,
0x0004002b,0x00000006,0x0000004c,0x0000000a,
0x0004002b,0x00000006,0x00000051,0x00000002,
0x00090019,0x00000059,0x00000006,0x00000001,
0x00000000,0x00000001,0x00000000,0x00000002,
0x00000020,0x00040020,0x0000005a,0x00000000,
0x00000059,0x0004003b,0x0000005a,0x0000005b,
0x00000000,0x00040020,0x0000005d,0x00000009,
0x00000011,0x0004002b,0x00000006,0x00000064,
0x00000008,0x0006002c,0x0000000a,0x00000065,
0x00000064,0x00000064,0x00000026,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,
0x000200f8,0x00000005,0x0004003b,0x00000008,
0x00000009,0x00000007,0x0004003b,0x00000020,
0x00000021,0x00000007,0x0004003b,0x0000002f,
0x00000030,0x00000007,0x0004003b,0x00000020,
0x0000003c,0x00000007,0x0004003b,0x00000020,
0x0000004a,0x00000007,0x0004003b,0x00000020,
0x0000004f,0x00000007,0x0004003d,0x0000000a,
0x0000000d,0x0000000c,0x0007004f,0x00000007,
0x0000000e,0x0000000d,0x0000000d,0x00000000,
0x00000001,0x0003003e,0x00000009,0x0000000e,
0x0004003d,0x00000007,0x0000000f,0x00000009,
0x00050041,0x00000016,0x00000017,0x00000014,
0x00000015,0x0004003d,0x00000007,0x00000018,
0x00000017,0x000500ae,0x0000001a,0x0000001b,
0x0000000f,0x00000018,0x0004009a,0x00000019,
0x0000001c,0x0000001b,0x000300f7,0x0000001e,
0x00000000,0x000400fa,0x0000001c,0x0000001d,
0x0000001e,0x000200f8,0x0000001d,0x000100fd,
0x000200f8,0x0000001e,0x00050041,0x00000023,
0x00000024,0x00000014,0x00000022,0x0004003d,
0x00000006,0x00000025,0x00000024,0x00050041,
0x00000020,0x00000027,0x00000009,0x00000026,
0x0004003d,0x00000006,0x00000028,0x00000027,
0x00050084,0x00000006,0x00000029,0x00000025,
0x00000028,0x00050041,0x00000020,0x0000002b,
0x00000009,0x0000002a,0x0004003d,0x00000006,
0x0000002c,0x0000002b,0x00050080,0x00000006,
0x0000002d,0x00000029,0x0000002c,0x0003003e,
0x00000021,0x0000002d,0x0003003e,0x00000030,
0x00000034,0x0004003d,0x00000006,0x00000035,
0x00000021,0x00050041,0x00000023,0x00000037,
0x00000014,0x00000036,0x0004003d,0x00000006,
0x00000038,0x00000037,0x000500b0,0x00000019,
0x00000039,0x00000035,0x00000038,0x000300f7,
0x0000003b,0x00000000,0x000400fa,0x00000039,
0x0000003a,0x0000003b,0x000200f8,0x0000003a,
0x0004003d,0x00000006,0x00000042,0x00000021,
0x00050041,0x00000023,0x00000044,0x00000014,
0x00000043,0x0004003d,0x00000006,0x00000045,
0x00000044,0x00050080,0x00000006,0x00000046,
0x00000042,0x00000045,0x00060041,0x00000047,
0x00000048,0x00000040,0x00000041,0x00000046,
0x0004003d,0x00000006,0x00000049,0x00000048,
0x0003003e,0x0000003c,0x00000049,0x0004003d,
0x00000006,0x0000004b,0x0000003c,0x000500c2,
0x00000006,0x0000004d,0x0000004b,0x0000004c,
0x000500c7,0x00000006,0x0000004e,0x0000004d,
0x00000031,0x0003003e,0x0000004a,0x0000004e,
0x0004003d,0x00000006,0x00000050,0x0000003c,
0x000500c2,0x00000006,0x00000052,0x00000050,
0x00000051,0x000500c7,0x00000006,0x00000053,
0x00000052,0x00000031,0x0003003e,0x0000004f,
0x00000053,0x0004003d,0x00000006,0x00000054,
0x0000004a,0x0004003d,0x00000006,0x00000055,
0x0000004a,0x0004003d,0x00000006,0x00000056,
0x0000004a,0x0004003d,0x00000006,0x00000057,
0x0000004f,0x00070050,0x0000002e,0x00000058,
0x00000054,0x00000055,0x00000056,0x00000057,
0x0003003e,0x00000030,0x00000058,0x000200f9,
0x0000003b,0x000200f8,0x0000003b,0x0004003d,
0x00000059,0x0000005c,0x0000005b,0x00050041,
0x0000005d,0x0000005e,0x00000014,0x00000041,
0x0004003d,0x00000011,0x0000005f,0x0000005e,
0x0004003d,0x0000000a,0x00000060,0x0000000c,
0x0004007c,0x00000011,0x00000061,0x00000060,
0x00050080,0x00000011,0x00000062,0x0000005f,
0x00000061,0x0004003d,0x0000002e,0x00000063,
0x00000030,0x00040063,0x0000005c,0x00000062,
0x00000063,0x000100fd,0x00010038}
@@ -1,182 +0,0 @@
{0x07230203,0x00010000,0x00080001,0x00000070,
0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,
0x00000000,0x0003000e,0x00000000,0x00000001,
0x0006000f,0x00000005,0x00000004,0x6e69616d,
0x00000000,0x0000000c,0x00060010,0x00000004,
0x00000011,0x00000008,0x00000008,0x00000001,
0x00030003,0x00000001,0x00000136,0x000a0004,
0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,
0x5f656c79,0x656e696c,0x7269645f,0x69746365,
0x00006576,0x00080004,0x475f4c47,0x4c474f4f,
0x6e695f45,0x64756c63,0x69645f65,0x74636572,
0x00657669,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00030005,0x00000009,0x00006469,
0x00080005,0x0000000c,0x475f6c67,0x61626f6c,
0x766e496c,0x7461636f,0x496e6f69,0x00000044,
0x00060005,0x00000012,0x68737550,0x736e6f43,
0x746e6174,0x00000000,0x00060006,0x00000012,
0x00000000,0x616c7461,0x6f635f73,0x0064726f,
0x00050006,0x00000012,0x00000001,0x657a6973,
0x00000000,0x00050006,0x00000012,0x00000002,
0x7366666f,0x00007465,0x00050006,0x00000012,
0x00000003,0x676e6172,0x00000065,0x00050006,
0x00000012,0x00000004,0x69727473,0x00006564,
0x00050005,0x00000014,0x736e6f63,0x746e6174,
0x00000073,0x00040005,0x00000021,0x65786970,
0x0000006c,0x00040005,0x00000030,0x6f6c6f63,
0x00000072,0x00040005,0x0000003c,0x61746164,
0x00000000,0x00040005,0x0000003e,0x4f425353,
0x00000000,0x00050006,0x0000003e,0x00000000,
0x65786970,0x0000736c,0x00030005,0x00000040,
0x00000000,0x00030005,0x0000004a,0x00000069,
0x00030005,0x00000050,0x00000061,0x00050005,
0x00000065,0x6c695475,0x6c744165,0x00007361,
0x00040047,0x0000000c,0x0000000b,0x0000001c,
0x00050048,0x00000012,0x00000000,0x00000023,
0x00000000,0x00050048,0x00000012,0x00000001,
0x00000023,0x00000010,0x00050048,0x00000012,
0x00000002,0x00000023,0x00000018,0x00050048,
0x00000012,0x00000003,0x00000023,0x0000001c,
0x00050048,0x00000012,0x00000004,0x00000023,
0x00000020,0x00030047,0x00000012,0x00000002,
0x00040047,0x0000003d,0x00000006,0x00000004,
0x00040048,0x0000003e,0x00000000,0x00000018,
0x00050048,0x0000003e,0x00000000,0x00000023,
0x00000000,0x00030047,0x0000003e,0x00000003,
0x00040047,0x00000040,0x00000022,0x00000000,
0x00040047,0x00000040,0x00000021,0x00000000,
0x00030047,0x00000065,0x00000000,0x00040047,
0x00000065,0x00000022,0x00000000,0x00040047,
0x00000065,0x00000021,0x00000001,0x00030047,
0x00000065,0x00000019,0x00030047,0x00000066,
0x00000000,0x00040047,0x0000006f,0x0000000b,
0x00000019,0x00020013,0x00000002,0x00030021,
0x00000003,0x00000002,0x00040015,0x00000006,
0x00000020,0x00000000,0x00040017,0x00000007,
0x00000006,0x00000002,0x00040020,0x00000008,
0x00000007,0x00000007,0x00040017,0x0000000a,
0x00000006,0x00000003,0x00040020,0x0000000b,
0x00000001,0x0000000a,0x0004003b,0x0000000b,
0x0000000c,0x00000001,0x00040015,0x00000010,
0x00000020,0x00000001,0x00040017,0x00000011,
0x00000010,0x00000003,0x0007001e,0x00000012,
0x00000011,0x00000007,0x00000006,0x00000006,
0x00000006,0x00040020,0x00000013,0x00000009,
0x00000012,0x0004003b,0x00000013,0x00000014,
0x00000009,0x0004002b,0x00000010,0x00000015,
0x00000001,0x00040020,0x00000016,0x00000009,
0x00000007,0x00020014,0x00000019,0x00040017,
0x0000001a,0x00000019,0x00000002,0x00040020,
0x00000020,0x00000007,0x00000006,0x0004002b,
0x00000010,0x00000022,0x00000004,0x00040020,
0x00000023,0x00000009,0x00000006,0x0004002b,
0x00000006,0x00000026,0x00000001,0x0004002b,
0x00000006,0x0000002a,0x00000000,0x00040017,
0x0000002e,0x00000006,0x00000004,0x00040020,
0x0000002f,0x00000007,0x0000002e,0x0004002b,
0x00000006,0x00000031,0x000000ff,0x0004002b,
0x00000006,0x00000032,0x00000080,0x0004002b,
0x00000006,0x00000033,0x00000040,0x0007002c,
0x0000002e,0x00000034,0x00000031,0x00000032,
0x00000033,0x00000031,0x0004002b,0x00000010,
0x00000036,0x00000003,0x0003001d,0x0000003d,
0x00000006,0x0003001e,0x0000003e,0x0000003d,
0x00040020,0x0000003f,0x00000002,0x0000003e,
0x0004003b,0x0000003f,0x00000040,0x00000002,
0x0004002b,0x00000010,0x00000041,0x00000000,
0x0004002b,0x00000010,0x00000043,0x00000002,
0x00040020,0x00000047,0x00000002,0x00000006,
0x0004002b,0x00000006,0x0000004c,0x00000007,
0x0004002b,0x00000006,0x0000004e,0x0000000f,
0x0004002b,0x00000006,0x00000052,0x00000003,
0x0004002b,0x00000006,0x00000056,0x00000004,
0x00090019,0x00000063,0x00000006,0x00000001,
0x00000000,0x00000001,0x00000000,0x00000002,
0x00000020,0x00040020,0x00000064,0x00000000,
0x00000063,0x0004003b,0x00000064,0x00000065,
0x00000000,0x00040020,0x00000067,0x00000009,
0x00000011,0x0004002b,0x00000006,0x0000006e,
0x00000008,0x0006002c,0x0000000a,0x0000006f,
0x0000006e,0x0000006e,0x00000026,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,
0x000200f8,0x00000005,0x0004003b,0x00000008,
0x00000009,0x00000007,0x0004003b,0x00000020,
0x00000021,0x00000007,0x0004003b,0x0000002f,
0x00000030,0x00000007,0x0004003b,0x00000020,
0x0000003c,0x00000007,0x0004003b,0x00000020,
0x0000004a,0x00000007,0x0004003b,0x00000020,
0x00000050,0x00000007,0x0004003d,0x0000000a,
0x0000000d,0x0000000c,0x0007004f,0x00000007,
0x0000000e,0x0000000d,0x0000000d,0x00000000,
0x00000001,0x0003003e,0x00000009,0x0000000e,
0x0004003d,0x00000007,0x0000000f,0x00000009,
0x00050041,0x00000016,0x00000017,0x00000014,
0x00000015,0x0004003d,0x00000007,0x00000018,
0x00000017,0x000500ae,0x0000001a,0x0000001b,
0x0000000f,0x00000018,0x0004009a,0x00000019,
0x0000001c,0x0000001b,0x000300f7,0x0000001e,
0x00000000,0x000400fa,0x0000001c,0x0000001d,
0x0000001e,0x000200f8,0x0000001d,0x000100fd,
0x000200f8,0x0000001e,0x00050041,0x00000023,
0x00000024,0x00000014,0x00000022,0x0004003d,
0x00000006,0x00000025,0x00000024,0x00050041,
0x00000020,0x00000027,0x00000009,0x00000026,
0x0004003d,0x00000006,0x00000028,0x00000027,
0x00050084,0x00000006,0x00000029,0x00000025,
0x00000028,0x00050041,0x00000020,0x0000002b,
0x00000009,0x0000002a,0x0004003d,0x00000006,
0x0000002c,0x0000002b,0x00050080,0x00000006,
0x0000002d,0x00000029,0x0000002c,0x0003003e,
0x00000021,0x0000002d,0x0003003e,0x00000030,
0x00000034,0x0004003d,0x00000006,0x00000035,
0x00000021,0x00050041,0x00000023,0x00000037,
0x00000014,0x00000036,0x0004003d,0x00000006,
0x00000038,0x00000037,0x000500b0,0x00000019,
0x00000039,0x00000035,0x00000038,0x000300f7,
0x0000003b,0x00000000,0x000400fa,0x00000039,
0x0000003a,0x0000003b,0x000200f8,0x0000003a,
0x0004003d,0x00000006,0x00000042,0x00000021,
0x00050041,0x00000023,0x00000044,0x00000014,
0x00000043,0x0004003d,0x00000006,0x00000045,
0x00000044,0x00050080,0x00000006,0x00000046,
0x00000042,0x00000045,0x00060041,0x00000047,
0x00000048,0x00000040,0x00000041,0x00000046,
0x0004003d,0x00000006,0x00000049,0x00000048,
0x0003003e,0x0000003c,0x00000049,0x0004003d,
0x00000006,0x0000004b,0x0000003c,0x000500c2,
0x00000006,0x0000004d,0x0000004b,0x0000004c,
0x000500c7,0x00000006,0x0000004f,0x0000004d,
0x0000004e,0x0003003e,0x0000004a,0x0000004f,
0x0004003d,0x00000006,0x00000051,0x0000003c,
0x000500c2,0x00000006,0x00000053,0x00000051,
0x00000052,0x000500c7,0x00000006,0x00000054,
0x00000053,0x0000004e,0x0003003e,0x00000050,
0x00000054,0x0004003d,0x00000006,0x00000055,
0x0000004a,0x000500c4,0x00000006,0x00000057,
0x00000055,0x00000056,0x0004003d,0x00000006,
0x00000058,0x0000004a,0x000500c5,0x00000006,
0x00000059,0x00000058,0x00000057,0x0003003e,
0x0000004a,0x00000059,0x0004003d,0x00000006,
0x0000005a,0x00000050,0x000500c4,0x00000006,
0x0000005b,0x0000005a,0x00000056,0x0004003d,
0x00000006,0x0000005c,0x00000050,0x000500c5,
0x00000006,0x0000005d,0x0000005c,0x0000005b,
0x0003003e,0x00000050,0x0000005d,0x0004003d,
0x00000006,0x0000005e,0x0000004a,0x0004003d,
0x00000006,0x0000005f,0x0000004a,0x0004003d,
0x00000006,0x00000060,0x0000004a,0x0004003d,
0x00000006,0x00000061,0x00000050,0x00070050,
0x0000002e,0x00000062,0x0000005e,0x0000005f,
0x00000060,0x00000061,0x0003003e,0x00000030,
0x00000062,0x000200f9,0x0000003b,0x000200f8,
0x0000003b,0x0004003d,0x00000063,0x00000066,
0x00000065,0x00050041,0x00000067,0x00000068,
0x00000014,0x00000041,0x0004003d,0x00000011,
0x00000069,0x00000068,0x0004003d,0x0000000a,
0x0000006a,0x0000000c,0x0004007c,0x00000011,
0x0000006b,0x0000006a,0x00050080,0x00000011,
0x0000006c,0x00000069,0x0000006b,0x0004003d,
0x0000002e,0x0000006d,0x00000030,0x00040063,
0x00000066,0x0000006c,0x0000006d,0x000100fd,
0x00010038}
@@ -1,190 +0,0 @@
{0x07230203,0x00010000,0x00080001,0x00000075,
0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,
0x00000000,0x0003000e,0x00000000,0x00000001,
0x0006000f,0x00000005,0x00000004,0x6e69616d,
0x00000000,0x0000000c,0x00060010,0x00000004,
0x00000011,0x00000008,0x00000008,0x00000001,
0x00030003,0x00000001,0x00000136,0x000a0004,
0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,
0x5f656c79,0x656e696c,0x7269645f,0x69746365,
0x00006576,0x00080004,0x475f4c47,0x4c474f4f,
0x6e695f45,0x64756c63,0x69645f65,0x74636572,
0x00657669,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00030005,0x00000009,0x00006469,
0x00080005,0x0000000c,0x475f6c67,0x61626f6c,
0x766e496c,0x7461636f,0x496e6f69,0x00000044,
0x00060005,0x00000012,0x68737550,0x736e6f43,
0x746e6174,0x00000000,0x00060006,0x00000012,
0x00000000,0x616c7461,0x6f635f73,0x0064726f,
0x00050006,0x00000012,0x00000001,0x657a6973,
0x00000000,0x00050006,0x00000012,0x00000002,
0x7366666f,0x00007465,0x00050006,0x00000012,
0x00000003,0x676e6172,0x00000065,0x00050006,
0x00000012,0x00000004,0x69727473,0x00006564,
0x00050005,0x00000014,0x736e6f63,0x746e6174,
0x00000073,0x00040005,0x00000021,0x65786970,
0x0000006c,0x00040005,0x00000030,0x6f6c6f63,
0x00000072,0x00040005,0x0000003c,0x61746164,
0x00000000,0x00040005,0x0000003e,0x4f425353,
0x00000000,0x00050006,0x0000003e,0x00000000,
0x65786970,0x0000736c,0x00030005,0x00000040,
0x00000000,0x00050005,0x0000006b,0x6c695475,
0x6c744165,0x00007361,0x00040047,0x0000000c,
0x0000000b,0x0000001c,0x00050048,0x00000012,
0x00000000,0x00000023,0x00000000,0x00050048,
0x00000012,0x00000001,0x00000023,0x00000010,
0x00050048,0x00000012,0x00000002,0x00000023,
0x00000018,0x00050048,0x00000012,0x00000003,
0x00000023,0x0000001c,0x00050048,0x00000012,
0x00000004,0x00000023,0x00000020,0x00030047,
0x00000012,0x00000002,0x00040047,0x0000003d,
0x00000006,0x00000004,0x00040048,0x0000003e,
0x00000000,0x00000018,0x00050048,0x0000003e,
0x00000000,0x00000023,0x00000000,0x00030047,
0x0000003e,0x00000003,0x00040047,0x00000040,
0x00000022,0x00000000,0x00040047,0x00000040,
0x00000021,0x00000000,0x00030047,0x0000006b,
0x00000000,0x00040047,0x0000006b,0x00000022,
0x00000000,0x00040047,0x0000006b,0x00000021,
0x00000001,0x00030047,0x0000006b,0x00000019,
0x00030047,0x0000006c,0x00000000,0x00040047,
0x00000074,0x0000000b,0x00000019,0x00020013,
0x00000002,0x00030021,0x00000003,0x00000002,
0x00040015,0x00000006,0x00000020,0x00000000,
0x00040017,0x00000007,0x00000006,0x00000002,
0x00040020,0x00000008,0x00000007,0x00000007,
0x00040017,0x0000000a,0x00000006,0x00000003,
0x00040020,0x0000000b,0x00000001,0x0000000a,
0x0004003b,0x0000000b,0x0000000c,0x00000001,
0x00040015,0x00000010,0x00000020,0x00000001,
0x00040017,0x00000011,0x00000010,0x00000003,
0x0007001e,0x00000012,0x00000011,0x00000007,
0x00000006,0x00000006,0x00000006,0x00040020,
0x00000013,0x00000009,0x00000012,0x0004003b,
0x00000013,0x00000014,0x00000009,0x0004002b,
0x00000010,0x00000015,0x00000001,0x00040020,
0x00000016,0x00000009,0x00000007,0x00020014,
0x00000019,0x00040017,0x0000001a,0x00000019,
0x00000002,0x00040020,0x00000020,0x00000007,
0x00000006,0x0004002b,0x00000010,0x00000022,
0x00000004,0x00040020,0x00000023,0x00000009,
0x00000006,0x0004002b,0x00000006,0x00000026,
0x00000001,0x0004002b,0x00000006,0x0000002a,
0x00000000,0x00040017,0x0000002e,0x00000006,
0x00000004,0x00040020,0x0000002f,0x00000007,
0x0000002e,0x0004002b,0x00000006,0x00000031,
0x000000ff,0x0004002b,0x00000006,0x00000032,
0x00000080,0x0004002b,0x00000006,0x00000033,
0x00000040,0x0007002c,0x0000002e,0x00000034,
0x00000031,0x00000032,0x00000033,0x00000031,
0x0004002b,0x00000010,0x00000036,0x00000003,
0x0003001d,0x0000003d,0x00000006,0x0003001e,
0x0000003e,0x0000003d,0x00040020,0x0000003f,
0x00000002,0x0000003e,0x0004003b,0x0000003f,
0x00000040,0x00000002,0x0004002b,0x00000010,
0x00000041,0x00000000,0x0004002b,0x00000010,
0x00000043,0x00000002,0x00040020,0x00000047,
0x00000002,0x00000006,0x0004002b,0x00000006,
0x0000004b,0x0000000a,0x0004002b,0x00000006,
0x0000004d,0x000000f8,0x0004002b,0x00000006,
0x00000050,0x00000005,0x0004002b,0x00000006,
0x00000058,0x00000008,0x00090019,0x00000069,
0x00000006,0x00000001,0x00000000,0x00000001,
0x00000000,0x00000002,0x00000020,0x00040020,
0x0000006a,0x00000000,0x00000069,0x0004003b,
0x0000006a,0x0000006b,0x00000000,0x00040020,
0x0000006d,0x00000009,0x00000011,0x0006002c,
0x0000000a,0x00000074,0x00000058,0x00000058,
0x00000026,0x00050036,0x00000002,0x00000004,
0x00000000,0x00000003,0x000200f8,0x00000005,
0x0004003b,0x00000008,0x00000009,0x00000007,
0x0004003b,0x00000020,0x00000021,0x00000007,
0x0004003b,0x0000002f,0x00000030,0x00000007,
0x0004003b,0x00000020,0x0000003c,0x00000007,
0x0004003b,0x00000020,0x00000056,0x00000007,
0x0004003d,0x0000000a,0x0000000d,0x0000000c,
0x0007004f,0x00000007,0x0000000e,0x0000000d,
0x0000000d,0x00000000,0x00000001,0x0003003e,
0x00000009,0x0000000e,0x0004003d,0x00000007,
0x0000000f,0x00000009,0x00050041,0x00000016,
0x00000017,0x00000014,0x00000015,0x0004003d,
0x00000007,0x00000018,0x00000017,0x000500ae,
0x0000001a,0x0000001b,0x0000000f,0x00000018,
0x0004009a,0x00000019,0x0000001c,0x0000001b,
0x000300f7,0x0000001e,0x00000000,0x000400fa,
0x0000001c,0x0000001d,0x0000001e,0x000200f8,
0x0000001d,0x000100fd,0x000200f8,0x0000001e,
0x00050041,0x00000023,0x00000024,0x00000014,
0x00000022,0x0004003d,0x00000006,0x00000025,
0x00000024,0x00050041,0x00000020,0x00000027,
0x00000009,0x00000026,0x0004003d,0x00000006,
0x00000028,0x00000027,0x00050084,0x00000006,
0x00000029,0x00000025,0x00000028,0x00050041,
0x00000020,0x0000002b,0x00000009,0x0000002a,
0x0004003d,0x00000006,0x0000002c,0x0000002b,
0x00050080,0x00000006,0x0000002d,0x00000029,
0x0000002c,0x0003003e,0x00000021,0x0000002d,
0x0003003e,0x00000030,0x00000034,0x0004003d,
0x00000006,0x00000035,0x00000021,0x00050041,
0x00000023,0x00000037,0x00000014,0x00000036,
0x0004003d,0x00000006,0x00000038,0x00000037,
0x000500b0,0x00000019,0x00000039,0x00000035,
0x00000038,0x000300f7,0x0000003b,0x00000000,
0x000400fa,0x00000039,0x0000003a,0x0000003b,
0x000200f8,0x0000003a,0x0004003d,0x00000006,
0x00000042,0x00000021,0x00050041,0x00000023,
0x00000044,0x00000014,0x00000043,0x0004003d,
0x00000006,0x00000045,0x00000044,0x00050080,
0x00000006,0x00000046,0x00000042,0x00000045,
0x00060041,0x00000047,0x00000048,0x00000040,
0x00000041,0x00000046,0x0004003d,0x00000006,
0x00000049,0x00000048,0x0003003e,0x0000003c,
0x00000049,0x0004003d,0x00000006,0x0000004a,
0x0000003c,0x000500c2,0x00000006,0x0000004c,
0x0000004a,0x0000004b,0x000500c7,0x00000006,
0x0000004e,0x0000004c,0x0000004d,0x0004003d,
0x00000006,0x0000004f,0x0000003c,0x000500c2,
0x00000006,0x00000051,0x0000004f,0x00000050,
0x000500c7,0x00000006,0x00000052,0x00000051,
0x0000004d,0x0004003d,0x00000006,0x00000053,
0x0000003c,0x000500c2,0x00000006,0x00000054,
0x00000053,0x0000002a,0x000500c7,0x00000006,
0x00000055,0x00000054,0x0000004d,0x0004003d,
0x00000006,0x00000057,0x0000003c,0x000500c7,
0x00000006,0x00000059,0x00000057,0x00000058,
0x000500ab,0x00000019,0x0000005a,0x00000059,
0x0000002a,0x000300f7,0x0000005c,0x00000000,
0x000400fa,0x0000005a,0x0000005b,0x0000005d,
0x000200f8,0x0000005b,0x0003003e,0x00000056,
0x00000031,0x000200f9,0x0000005c,0x000200f8,
0x0000005d,0x0003003e,0x00000056,0x0000002a,
0x000200f9,0x0000005c,0x000200f8,0x0000005c,
0x0004003d,0x00000006,0x0000005e,0x00000056,
0x00070050,0x0000002e,0x0000005f,0x0000004e,
0x00000052,0x00000055,0x0000005e,0x0003003e,
0x00000030,0x0000005f,0x0004003d,0x0000002e,
0x00000060,0x00000030,0x0008004f,0x0000000a,
0x00000061,0x00000060,0x00000060,0x00000000,
0x00000001,0x00000002,0x00060050,0x0000000a,
0x00000062,0x00000050,0x00000050,0x00000050,
0x000500c2,0x0000000a,0x00000063,0x00000061,
0x00000062,0x0004003d,0x0000002e,0x00000064,
0x00000030,0x0008004f,0x0000000a,0x00000065,
0x00000064,0x00000064,0x00000000,0x00000001,
0x00000002,0x000500c5,0x0000000a,0x00000066,
0x00000065,0x00000063,0x0004003d,0x0000002e,
0x00000067,0x00000030,0x0009004f,0x0000002e,
0x00000068,0x00000067,0x00000066,0x00000004,
0x00000005,0x00000006,0x00000003,0x0003003e,
0x00000030,0x00000068,0x000200f9,0x0000003b,
0x000200f8,0x0000003b,0x0004003d,0x00000069,
0x0000006c,0x0000006b,0x00050041,0x0000006d,
0x0000006e,0x00000014,0x00000041,0x0004003d,
0x00000011,0x0000006f,0x0000006e,0x0004003d,
0x0000000a,0x00000070,0x0000000c,0x0004007c,
0x00000011,0x00000071,0x00000070,0x00050080,
0x00000011,0x00000072,0x0000006f,0x00000071,
0x0004003d,0x0000002e,0x00000073,0x00000030,
0x00040063,0x0000006c,0x00000072,0x00000073,
0x000100fd,0x00010038}
@@ -1,161 +0,0 @@
{0x07230203,0x00010000,0x00080001,0x00000060,
0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,
0x00000000,0x0003000e,0x00000000,0x00000001,
0x0006000f,0x00000005,0x00000004,0x6e69616d,
0x00000000,0x0000000c,0x00060010,0x00000004,
0x00000011,0x00000008,0x00000008,0x00000001,
0x00030003,0x00000001,0x00000136,0x000a0004,
0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,
0x5f656c79,0x656e696c,0x7269645f,0x69746365,
0x00006576,0x00080004,0x475f4c47,0x4c474f4f,
0x6e695f45,0x64756c63,0x69645f65,0x74636572,
0x00657669,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00030005,0x00000009,0x00006469,
0x00080005,0x0000000c,0x475f6c67,0x61626f6c,
0x766e496c,0x7461636f,0x496e6f69,0x00000044,
0x00060005,0x00000012,0x68737550,0x736e6f43,
0x746e6174,0x00000000,0x00060006,0x00000012,
0x00000000,0x616c7461,0x6f635f73,0x0064726f,
0x00050006,0x00000012,0x00000001,0x657a6973,
0x00000000,0x00050006,0x00000012,0x00000002,
0x7366666f,0x00007465,0x00050006,0x00000012,
0x00000003,0x676e6172,0x00000065,0x00050006,
0x00000012,0x00000004,0x69727473,0x00006564,
0x00050005,0x00000014,0x736e6f63,0x746e6174,
0x00000073,0x00040005,0x00000021,0x65786970,
0x0000006c,0x00040005,0x00000030,0x6f6c6f63,
0x00000072,0x00040005,0x0000003c,0x61746164,
0x00000000,0x00040005,0x0000003e,0x4f425353,
0x00000000,0x00050006,0x0000003e,0x00000000,
0x65786970,0x0000736c,0x00030005,0x00000040,
0x00000000,0x00050005,0x00000056,0x6c695475,
0x6c744165,0x00007361,0x00040047,0x0000000c,
0x0000000b,0x0000001c,0x00050048,0x00000012,
0x00000000,0x00000023,0x00000000,0x00050048,
0x00000012,0x00000001,0x00000023,0x00000010,
0x00050048,0x00000012,0x00000002,0x00000023,
0x00000018,0x00050048,0x00000012,0x00000003,
0x00000023,0x0000001c,0x00050048,0x00000012,
0x00000004,0x00000023,0x00000020,0x00030047,
0x00000012,0x00000002,0x00040047,0x0000003d,
0x00000006,0x00000004,0x00040048,0x0000003e,
0x00000000,0x00000018,0x00050048,0x0000003e,
0x00000000,0x00000023,0x00000000,0x00030047,
0x0000003e,0x00000003,0x00040047,0x00000040,
0x00000022,0x00000000,0x00040047,0x00000040,
0x00000021,0x00000000,0x00030047,0x00000056,
0x00000000,0x00040047,0x00000056,0x00000022,
0x00000000,0x00040047,0x00000056,0x00000021,
0x00000001,0x00030047,0x00000056,0x00000019,
0x00030047,0x00000057,0x00000000,0x00040047,
0x0000005f,0x0000000b,0x00000019,0x00020013,
0x00000002,0x00030021,0x00000003,0x00000002,
0x00040015,0x00000006,0x00000020,0x00000000,
0x00040017,0x00000007,0x00000006,0x00000002,
0x00040020,0x00000008,0x00000007,0x00000007,
0x00040017,0x0000000a,0x00000006,0x00000003,
0x00040020,0x0000000b,0x00000001,0x0000000a,
0x0004003b,0x0000000b,0x0000000c,0x00000001,
0x00040015,0x00000010,0x00000020,0x00000001,
0x00040017,0x00000011,0x00000010,0x00000003,
0x0007001e,0x00000012,0x00000011,0x00000007,
0x00000006,0x00000006,0x00000006,0x00040020,
0x00000013,0x00000009,0x00000012,0x0004003b,
0x00000013,0x00000014,0x00000009,0x0004002b,
0x00000010,0x00000015,0x00000001,0x00040020,
0x00000016,0x00000009,0x00000007,0x00020014,
0x00000019,0x00040017,0x0000001a,0x00000019,
0x00000002,0x00040020,0x00000020,0x00000007,
0x00000006,0x0004002b,0x00000010,0x00000022,
0x00000004,0x00040020,0x00000023,0x00000009,
0x00000006,0x0004002b,0x00000006,0x00000026,
0x00000001,0x0004002b,0x00000006,0x0000002a,
0x00000000,0x00040017,0x0000002e,0x00000006,
0x00000004,0x00040020,0x0000002f,0x00000007,
0x0000002e,0x0004002b,0x00000006,0x00000031,
0x000000ff,0x0004002b,0x00000006,0x00000032,
0x00000080,0x0004002b,0x00000006,0x00000033,
0x00000040,0x0007002c,0x0000002e,0x00000034,
0x00000031,0x00000032,0x00000033,0x00000031,
0x0004002b,0x00000010,0x00000036,0x00000003,
0x0003001d,0x0000003d,0x00000006,0x0003001e,
0x0000003e,0x0000003d,0x00040020,0x0000003f,
0x00000002,0x0000003e,0x0004003b,0x0000003f,
0x00000040,0x00000002,0x0004002b,0x00000010,
0x00000041,0x00000000,0x0004002b,0x00000010,
0x00000043,0x00000002,0x00040020,0x00000047,
0x00000002,0x00000006,0x0004002b,0x00000006,
0x0000004c,0x00000018,0x0004002b,0x00000006,
0x0000004d,0x00000010,0x0004002b,0x00000006,
0x0000004e,0x00000008,0x0007002c,0x0000002e,
0x0000004f,0x0000004c,0x0000004d,0x0000004e,
0x0000002a,0x0004002b,0x00000006,0x00000051,
0x000000e0,0x0007002c,0x0000002e,0x00000052,
0x00000031,0x00000031,0x00000031,0x00000051,
0x00090019,0x00000054,0x00000006,0x00000001,
0x00000000,0x00000001,0x00000000,0x00000002,
0x00000020,0x00040020,0x00000055,0x00000000,
0x00000054,0x0004003b,0x00000055,0x00000056,
0x00000000,0x00040020,0x00000058,0x00000009,
0x00000011,0x0006002c,0x0000000a,0x0000005f,
0x0000004e,0x0000004e,0x00000026,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,
0x000200f8,0x00000005,0x0004003b,0x00000008,
0x00000009,0x00000007,0x0004003b,0x00000020,
0x00000021,0x00000007,0x0004003b,0x0000002f,
0x00000030,0x00000007,0x0004003b,0x00000020,
0x0000003c,0x00000007,0x0004003d,0x0000000a,
0x0000000d,0x0000000c,0x0007004f,0x00000007,
0x0000000e,0x0000000d,0x0000000d,0x00000000,
0x00000001,0x0003003e,0x00000009,0x0000000e,
0x0004003d,0x00000007,0x0000000f,0x00000009,
0x00050041,0x00000016,0x00000017,0x00000014,
0x00000015,0x0004003d,0x00000007,0x00000018,
0x00000017,0x000500ae,0x0000001a,0x0000001b,
0x0000000f,0x00000018,0x0004009a,0x00000019,
0x0000001c,0x0000001b,0x000300f7,0x0000001e,
0x00000000,0x000400fa,0x0000001c,0x0000001d,
0x0000001e,0x000200f8,0x0000001d,0x000100fd,
0x000200f8,0x0000001e,0x00050041,0x00000023,
0x00000024,0x00000014,0x00000022,0x0004003d,
0x00000006,0x00000025,0x00000024,0x00050041,
0x00000020,0x00000027,0x00000009,0x00000026,
0x0004003d,0x00000006,0x00000028,0x00000027,
0x00050084,0x00000006,0x00000029,0x00000025,
0x00000028,0x00050041,0x00000020,0x0000002b,
0x00000009,0x0000002a,0x0004003d,0x00000006,
0x0000002c,0x0000002b,0x00050080,0x00000006,
0x0000002d,0x00000029,0x0000002c,0x0003003e,
0x00000021,0x0000002d,0x0003003e,0x00000030,
0x00000034,0x0004003d,0x00000006,0x00000035,
0x00000021,0x00050041,0x00000023,0x00000037,
0x00000014,0x00000036,0x0004003d,0x00000006,
0x00000038,0x00000037,0x000500b0,0x00000019,
0x00000039,0x00000035,0x00000038,0x000300f7,
0x0000003b,0x00000000,0x000400fa,0x00000039,
0x0000003a,0x0000003b,0x000200f8,0x0000003a,
0x0004003d,0x00000006,0x00000042,0x00000021,
0x00050041,0x00000023,0x00000044,0x00000014,
0x00000043,0x0004003d,0x00000006,0x00000045,
0x00000044,0x00050080,0x00000006,0x00000046,
0x00000042,0x00000045,0x00060041,0x00000047,
0x00000048,0x00000040,0x00000041,0x00000046,
0x0004003d,0x00000006,0x00000049,0x00000048,
0x0003003e,0x0000003c,0x00000049,0x0004003d,
0x00000006,0x0000004a,0x0000003c,0x00070050,
0x0000002e,0x0000004b,0x0000004a,0x0000004a,
0x0000004a,0x0000004a,0x000500c2,0x0000002e,
0x00000050,0x0000004b,0x0000004f,0x000500c7,
0x0000002e,0x00000053,0x00000050,0x00000052,
0x0003003e,0x00000030,0x00000053,0x000200f9,
0x0000003b,0x000200f8,0x0000003b,0x0004003d,
0x00000054,0x00000057,0x00000056,0x00050041,
0x00000058,0x00000059,0x00000014,0x00000041,
0x0004003d,0x00000011,0x0000005a,0x00000059,
0x0004003d,0x0000000a,0x0000005b,0x0000000c,
0x0004007c,0x00000011,0x0000005c,0x0000005b,
0x00050080,0x00000011,0x0000005d,0x0000005a,
0x0000005c,0x0004003d,0x0000002e,0x0000005e,
0x00000030,0x00040063,0x00000057,0x0000005d,
0x0000005e,0x000100fd,0x00010038}
@@ -1,88 +0,0 @@
#ifndef UTIL_H_
#define UTIL_H_
#define RDP_SUBPIXELS 4
#define RDP_SUBPIXELS_LOG2 2
#define RDP_SUBPIXELS_MASK ((1 << RDP_SUBPIXELS_LOG2) - 1)
#define RDP_SUBPIXELS_INVMASK (~(RDP_SUBPIXELS_MASK))
bvec4 bitwiseOr(bvec4 a, bvec4 b)
{
return bvec4(ivec4(a) | ivec4(b));
}
bvec4 bitwiseOr(bvec4 a, bvec4 b, bvec4 c)
{
return bvec4(ivec4(a) | ivec4(b) | ivec4(c));
}
ivec4 bitwiseAnd(bvec4 a, bvec4 b)
{
return ivec4(a) & ivec4(b);
}
int horizontalMin(ivec4 v)
{
ivec2 w = min(v.xy, v.zw);
return min(w.x, w.y);
}
int horizontalMax(ivec4 v)
{
ivec2 w = max(v.xy, v.zw);
return max(w.x, w.y);
}
int horizontalOr(ivec4 v)
{
ivec2 tmp = v.xy | v.zw;
return tmp.x | tmp.y;
}
int mergeMask(bvec4 a, bvec4 b)
{
ivec4 masked = ivec4(a) & ivec4(b);
ivec2 halved = (masked.xy * ivec2(1, 2)) + (masked.zw * ivec2(4, 8));
return halved.x + halved.y;
}
uint pack_rgba8(uvec4 pixel)
{
pixel = clamp(pixel, uvec4(0u), uvec4(255u));
return (pixel.r << 24u) | (pixel.g << 16u) | (pixel.b << 8u) | (pixel.a << 0u);
}
uvec4 unpack_rgba8(uint fbval)
{
return (uvec4(fbval) >> uvec4(24u, 16u, 8u, 0u)) & uvec4(0xffu);
}
uint pack_s16(ivec2 uv)
{
return uint((uv.x & 0xffff) | (uv.y << 16));
}
ivec2 unpack_s16(uint x)
{
// *sigh* ...
return ivec2((int(x) << 16) >> 16, int(x) >> 16);
}
ivec4 special_9bit_ext(ivec4 x)
{
// No idea what the idea of this is, but that's what Angrylion seems to be doing ...
// Maps [0, 0x180) to [0 - 0x180) and [0x180 - 0x1ff] to [-128, -1].
return ((x + 0x80) & 0x1ff) - 0x80;
}
int sext_9bit(int x)
{
return (x << 23) >> 23;
}
ivec4 special_9bit_clamp(ivec4 x)
{
return clamp(special_9bit_ext(x), ivec4(0), ivec4(255));
}
#endif
@@ -1,258 +0,0 @@
#version 310 es
#ifndef TILE_SIZE_X
#define TILE_SIZE_X 8u
#endif
#ifndef TILE_SIZE_Y
#define TILE_SIZE_Y 8u
#endif
layout(local_size_x = TILE_SIZE_X, local_size_y = TILE_SIZE_Y) in;
#include "structs.h"
#include "flags.h"
#include "buffers.h"
#include "util.h"
#include "clip.h"
#include "coverage.h"
#define prim primitive_data.data[prim_id]
void main()
{
uvec2 local = gl_LocalInvocationID.xy;
uint tile = gl_WorkGroupID.x;
uvec2 coord = work.desc[tile].base * uvec2(TILE_SIZE_X, TILE_SIZE_Y) + local;
uint prim_id = LOD_INFO_PRIMITIVE(work.desc[tile].lod_info_primitive);
uint flags = prim.flags;
int y = int(coord.y) * 4;
ivec2 clip = unpack_scissor(prim.scissor_y);
// Scissor test and find Y bounds for where to rasterize.
int ycur = prim.yh & RDP_SUBPIXELS_INVMASK;
int yhlimit = max(prim.yh, clip.x);
int yllimit = min(prim.yl, clip.y);
int ylfar = yllimit | RDP_SUBPIXELS_MASK;
// Reject right away.
if ((y + RDP_SUBPIXELS) <= yhlimit || y >= ylfar)
{
COVERAGE(tile, local) = 0u;
return;
}
// Shifts and masks already applied on CPU.
int DxMDy = prim.DxMDy;
int DxHDy = prim.DxHDy;
int DxLDy = prim.DxLDy;
int xm = prim.xm;
int xh = prim.xh;
int xl = prim.xl;
// Compute X bounds, for all 4 Y subpixels.
// Use branchless mux logic to select appropriate version of xlr0.
ivec4 xlr0_above = xm + DxMDy * ((y - ycur) + ivec4(0, 1, 2, 3));
ivec4 xlr0_below = xl + DxLDy * ((y - prim.ym) + ivec4(0, 1, 2, 3));
ivec4 xlr0 = mix(xlr0_below, xlr0_above, lessThan(y + ivec4(0, 1, 2, 3), ivec4(prim.ym)));
ivec4 xlr1 = xh + DxHDy * ((y - ycur) + ivec4(0, 1, 2, 3));
// Clip X.
bvec2 curunder, curover;
ivec4 xlsc, xrsc;
// Unpack X scissor.
clip = unpack_scissor(prim.scissor_x) << 1;
clip_x(clip, xlr0, xlsc, curunder.x, curover.x);
clip_x(clip, xlr1, xrsc, curunder.y, curover.y);
bool flip = PRIMITIVE_IS_FLIP(flags);
// Detect where the two lines cross.
// Get a boolean mask for which subscanlines have crossing scanlines.
// XXX: Shouldn't this be <=?
// XXX: Also, why the weird bitmath here?
bvec4 clipped = flip ?
lessThan((xlr0 & 0xfffc000) ^ 0x08000000, (xlr1 & 0xfffc000) ^ 0x08000000) :
lessThan((xlr1 & 0xfffc000) ^ 0x08000000, (xlr0 & 0xfffc000) ^ 0x08000000);
// Add subpixel Y clip here.
clipped = bitwiseOr(clipped,
lessThan(y + ivec4(0, 1, 2, 3), ivec4(yhlimit)),
greaterThanEqual(y + ivec4(0, 1, 2, 3), ivec4(yllimit)));
// TODO: Missing sckeepodd, scfield here. Interlacing?
// If we can invalidate the scanline for all subpixels in at least one of three ways, we can kill it early.
bool invalid = all(clipped) || all(curunder) || all(curover);
if (invalid)
{
COVERAGE(tile, local) = 0u;
return;
}
if (!flip)
{
ivec4 tmp = xlsc;
xlsc = xrsc;
xrsc = tmp;
}
// Intentionally clip out invalid scanlines so we don't get coverage for them and that they don't participate in min/max.
xrsc = mix(xrsc, ivec4(0x7fff), clipped);
xlsc = mix(xlsc, ivec4(0), clipped);
// Don't include invalid subsample scanlines in min/max.
int lx = horizontalMin(xrsc >> 3);
int rx = horizontalMax(xlsc >> 3);
// Find multisampled coverage.
// For copy pipe, we compute coverage for 64-bits of data at a time, so splat
// coverage information across those pixels.
// Angrylion reads 64-bits of data at a time starting at span start.
int xbase = int(coord.x);
// FIXME: Do we snap from left or right?
// Probably won't really matter in practice.
int copy_xbase = ((xbase - lx) & int(prim.span_stride_combiner >> 16u)) + lx;
uint coverage = compute_coverage(xrsc, xlsc, copy_xbase);
// Extra coverage for fill mode, conservative.
if (copy_xbase >= lx && copy_xbase <= rx)
coverage |= 0x100u;
COVERAGE(tile, local) = coverage;
// Coverage in 1/2 cycle mode will always be 0.
if ((coverage & 0xffu) == 0u)
return;
// MK64 reads shade color even though it doesn't have any varyings.
// I assume it's supposed to be just black in this case.
if (!PRIMITIVE_INTERPOLATE_VARYINGS(flags))
{
RGBA(tile, local) = 0u;
DEPTH(tile, local) = 0;
return;
}
// Varyings are interpolated along the major axis.
// For some reason, we sample at the 1st or 4th subpixel depending on some flags computed earlier ...
int xlr = PRIMITIVE_DO_OFFSET(flags) ? xlr1.w : xlr1.x;
int xfrac = (xlr >> 8) & 0xff;
ivec4 d_rgba_dxh;
ivec4 d_stwz_dxh;
if (!PRIMITIVE_CYCLE_TYPE_IS_COPY(flags))
{
d_rgba_dxh = (prim.attr.d_rgba_dx >> 8) & ~1;
d_stwz_dxh = (prim.attr.d_stwz_dx >> 8) & ~1;
}
else
{
d_rgba_dxh = ivec4(0);
d_stwz_dxh = ivec4(0);
}
int xoff = xbase - (xlr >> 16);
// The N64 clips interpolation inside the coverage region.
#if 0
ivec2 centroid_offsets = ivec2(texelFetch(uCentroidLUT, ivec2(int(coverage & 0xffu), 0), 0).xy);
#else
// Workaround broken nVidia driver.
ivec2 centroid_offsets = ivec2(textureLod(uCentroidLUT, vec2((float(coverage & 0xffu) + 0.5) / 256.0, 0.5), 0.0).xy);
#endif
// RGBA
// Lerp Edge
ivec4 rgba = prim.attr.rgba + ((y - ycur) >> 2) * prim.attr.d_rgba_de;
// Lerp Subpixel X
rgba = ((rgba & ivec4(~0x1ff)) + prim.attr.d_rgba_diff - xfrac * d_rgba_dxh) & ivec4(~0x3ff);
// Lerp X
ivec4 d_rgba_dx = prim.attr.d_rgba_dx;
ivec4 d_rgba_dy = prim.attr.d_rgba_dy;
rgba += xoff * d_rgba_dx;
// Centroid offset
ivec4 centroid_offset =
centroid_offsets.x * (d_rgba_dx >> 14) +
centroid_offsets.y * (d_rgba_dy >> 14);
rgba = (((rgba >> 12) & ~3) + centroid_offset) >> 4;
// Clamp and write out
rgba = special_9bit_clamp(rgba & 0x1ff);
RGBA(tile, local) = pack_rgba8(uvec4(rgba));
////
// STWZ
// Lerp Edge
ivec4 stwz = prim.attr.stwz + ((y - ycur) >> 2) * prim.attr.d_stwz_de;
// Lerp Subpixel X
stwz = ((stwz & ivec4(~0x1ff)) + prim.attr.d_stwz_diff - xfrac * d_stwz_dxh) & ivec4(~0x3ff);
// Lerp X
ivec4 d_stwz_dx = prim.attr.d_stwz_dx & ivec4(~0x1f);
stwz += xoff * d_stwz_dx;
int z = stwz.w;
if (PRIMITIVE_SAMPLE_TEX_PIPELINED(flags) || PRIMITIVE_SAMPLE_TEX_LOD(flags))
{
// Poke at next pixel since combiner will read it later in the pipeline ...
// We will also need this UV for implementing LOD later.
ivec3 next = (stwz.xyz + (PRIMITIVE_IS_FLIP(flags) ? 1 : -1) * d_stwz_dx.xyz) >> 16;
ivec2 uv;
// Far from bitexact, but having bitexact division for UV coords seems like a waste of effort for now.
if (PRIMITIVE_PERSPECTIVE(flags))
uv = next.z == 0 ? ivec2(0xffff) : ivec2(32768.0 * vec2(next.xy) / float(next.z));
else
uv = next.xy;
UV_NEXT(tile, local) = pack_s16(uv);
}
if (PRIMITIVE_SAMPLE_TEX_LOD(flags))
{
ivec3 next = (stwz.xyz + prim.attr.d_stwz_dy.xyz) >> 16;
ivec2 uv;
if (PRIMITIVE_PERSPECTIVE(flags))
uv = next.z == 0 ? ivec2(0xffff) : ivec2(32768.0 * vec2(next.xy) / float(next.z));
else
uv = next.xy;
UV_PREV_Y(tile, local) = pack_s16(uv);
}
// Do perspective interpolation here so we can reduce bandwidth.
// Also makes it much easier to implement LOD in texture stage later.
{
stwz.xyz >>= 16;
ivec2 uv;
// Far from bitexact, but having bitexact division for UV coords seems like a waste of effort for now.
if (PRIMITIVE_PERSPECTIVE(flags))
uv = stwz.z == 0 ? ivec2(0xffff) : ivec2(32768.0 * vec2(stwz.xy) / float(stwz.z));
else
uv = stwz.xy;
UV(tile, local) = pack_s16(uv);
}
// Override Z if using primitive Z
if (!PRIMITIVE_INTERPOLATE_Z(flags))
z = prim.primitive_z & 0xffff0000;
z = (stwz.w >> 10) & 0x3fffff;
if (PRIMITIVE_INTERPOLATE_Z(flags))
{
// Centroid offset
int centroid_offset = centroid_offsets.x * (d_stwz_dx.w >> 10) +
centroid_offsets.y * (prim.attr.d_stwz_dy.w >> 10);
z = ((z << 2) + centroid_offset) >> 5;
}
else
z >>= 3;
// Should be a correct branchless version of the awkward zanded in Angrylion.
// This pattern seems very similar to the special_9bit clamp, hrm ...
z = clamp(((z + 0x20000) & 0x7ffff) - 0x20000, 0, 0x3ffff);
DEPTH(tile, local) = z;
////
}
File diff suppressed because it is too large. Load diff
-469
View File
@@ -1,469 +0,0 @@
#include <algorithm>
#include <unordered_map>
#include <vector>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "common.hpp"
#include "frontend.hpp"
#include "rdp.hpp"
#include "rdp_dump.hpp"
#include "vulkan.hpp"
#include "vulkan_util.hpp"
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb/stb_image.h"
#include "stb/stb_image_write.h"
using namespace std;
static RDP::Frontend frontend;
static vector<uint8_t> RDRAM;
struct CLIParser;
struct CLICallbacks
{
void add(const char *cli, const function<void(CLIParser &)> &func)
{
callbacks[cli] = func;
}
unordered_map<string, function<void(CLIParser &)>> callbacks;
function<void()> error_handler;
function<void(const char *)> default_handler;
};
struct CLIParser
{
CLIParser(CLICallbacks cbs, int argc, char *argv[])
: cbs(move(cbs))
, argc(argc)
, argv(argv)
{
}
bool parse()
{
try
{
while (argc && !ended_state)
{
const char *next = *argv++;
argc--;
if (*next != '-' && cbs.default_handler)
{
cbs.default_handler(next);
}
else
{
auto itr = cbs.callbacks.find(next);
if (itr == ::end(cbs.callbacks))
{
throw logic_error("Invalid argument.\n");
}
itr->second(*this);
}
}
return true;
}
catch (...)
{
if (cbs.error_handler)
{
cbs.error_handler();
}
return false;
}
}
void end()
{
ended_state = true;
}
uint32_t next_uint()
{
if (!argc)
{
throw logic_error("Tried to parse uint, but nothing left in arguments.\n");
}
uint32_t val = stoul(*argv);
if (val > numeric_limits<uint32_t>::max())
{
throw out_of_range("next_uint() out of range.\n");
}
argc--;
argv++;
return val;
}
double next_double()
{
if (!argc)
{
throw logic_error("Tried to parse double, but nothing left in arguments.\n");
}
double val = stod(*argv);
argc--;
argv++;
return val;
}
const char *next_string()
{
if (!argc)
{
throw logic_error("Tried to parse string, but nothing left in arguments.\n");
}
const char *ret = *argv;
argc--;
argv++;
return ret;
}
CLICallbacks cbs;
int argc;
char **argv;
bool ended_state = false;
};
static const char *DP_command_names[64] = {
"NOOP", "reserved", "reserved", "reserved", "reserved", "reserved", "reserved",
"reserved", "TRIFILL", "TRIFILLZBUFF", "TRITXTR", "TRITXTRZBUFF", "TRISHADE", "TRISHADEZBUFF",
"TRISHADETXTR", "TRISHADETXTRZBUFF", "reserved", "reserved", "reserved", "reserved", "reserved",
"reserved", "reserved", "reserved", "reserved", "reserved", "reserved", "reserved",
"reserved", "reserved", "reserved", "reserved", "reserved", "reserved", "reserved",
"reserved", "TEXRECT", "TEXRECTFLIP", "LOADSYNC", "PIPESYNC", "TILESYNC", "FULLSYNC",
"SETKEYGB", "SETKEYR", "SETCONVERT", "SETSCISSOR", "SETPRIMDEPTH", "SETRDPOTHER", "LOADTLUT",
"reserved", "SETTILESIZE", "LOADBLOCK", "LOADTILE", "SETTILE", "FILLRECT", "SETFILLCOLOR",
"SETFOGCOLOR", "SETBLENDCOLOR", "SETPRIMCOLOR", "SETENVCOLOR", "SETCOMBINE", "SETTIMG", "SETMIMG",
"SETCIMG",
};
#define log(...) \
do \
{ \
if (args.verbose) \
fprintf(stderr, __VA_ARGS__); \
} while (0)
struct Image
{
vector<uint8_t> buffer;
unsigned width = 0;
unsigned height = 0;
};
static void read_framebuffer(RDP::Renderer *renderer, Image *image)
{
auto &fb = renderer->get_current_framebuffer();
auto *buffer = RDRAM.data();
image->buffer.resize(fb.allocated_width * fb.allocated_height * 4);
auto ptr = image->buffer.data();
image->width = fb.allocated_width;
image->height = fb.allocated_height;
unsigned pixels = image->width * image->height;
if (fb.pixel_size == RDP::PIXEL_SIZE_32BPP)
{
for (unsigned i = 0; i < pixels; i++)
{
uint32_t pix = READ_DRAM_U32(buffer, fb.addr + 4 * i);
*ptr++ = (pix >> 24) & 0xff;
*ptr++ = (pix >> 16) & 0xff;
*ptr++ = (pix >> 8) & 0xff;
*ptr++ = 0xff;
}
}
else if (fb.pixel_size == RDP::PIXEL_SIZE_16BPP)
{
for (unsigned i = 0; i < pixels; i++)
{
uint16_t pix = READ_DRAM_U16(buffer, fb.addr + 2 * i);
uint8_t r = (pix >> 11) & 0x1f;
uint8_t g = (pix >> 6) & 0x1f;
uint8_t b = (pix >> 1) & 0x1f;
*ptr++ = (r << 3) | (r >> 2);
*ptr++ = (g << 3) | (g >> 2);
*ptr++ = (b << 3) | (b >> 2);
*ptr++ = 0xff;
}
}
else if (fb.pixel_size == RDP::PIXEL_SIZE_8BPP)
{
for (unsigned i = 0; i < pixels; i++)
{
uint8_t pix = READ_DRAM_U8(buffer, fb.addr + 1 * i);
*ptr++ = pix;
*ptr++ = pix;
*ptr++ = pix;
*ptr++ = 0xff;
}
}
}
static bool read_png(const char *path, Image *image)
{
int width, height, comp;
auto *data = stbi_load(path, &width, &height, &comp, 4);
if (!data)
return false;
image->width = width;
image->height = height;
image->buffer.clear();
image->buffer.insert(end(image->buffer), data, data + width * height * 4);
return true;
}
static void dump_framebuffer(RDP::Renderer *renderer, const char *path)
{
Image image;
read_framebuffer(renderer, &image);
if (!stbi_write_png(path, image.width, image.height, 4, image.buffer.data(), image.width * 4))
fprintf(stderr, "Failed to write image file: %s\n", path);
}
static void compare_framebuffer(RDP::Renderer *renderer, const char *path)
{
Image ref_image;
Image image;
if (!read_png(path, &ref_image))
{
fprintf(stderr, "Failed to load file: %s\n", path);
exit(1);
}
read_framebuffer(renderer, &image);
if (image.width != ref_image.width || image.height != ref_image.height)
{
fprintf(stderr, "Dimension mismatch, Reference = %u x %u, Source = %u x %u.\n", ref_image.width,
ref_image.height, image.width, image.height);
exit(1);
}
const uint8_t *ref = ref_image.buffer.data();
const uint8_t *src = image.buffer.data();
unsigned wrong = 0;
unsigned correct = 0;
for (unsigned y = 0; y < image.height; y++)
{
for (unsigned x = 0; x < image.width; x++)
{
// Ignore alpha.
if (memcmp(ref, src, 3))
{
fprintf(stderr, "Difference at pixel (%03u, %03u).\n"
" Reference = (%02x, %02x, %02x)\n"
" Source = (%02x, %02x, %02x)\n",
x, y, ref[0], ref[1], ref[2], src[0], src[1], src[2]);
wrong++;
}
else
correct++;
ref += 4;
src += 4;
}
}
fprintf(stderr, "Correct pixels: %u, Wrong pixels: %u\n", correct, wrong);
}
struct CLIArguments
{
const char *dump = nullptr;
const char *output = nullptr;
const char *compare = nullptr;
bool verbose = false;
bool video = false;
unsigned trace_frame = 0;
bool trace = false;
};
static void print_help()
{
fprintf(stderr, "rdp-test [dump] [--output out png] [--compare compare against other png] [--verbose]\n");
}
static int rdp_dump_main(RDP::Renderer *renderer, Vulkan::Device *device, int argc, char *argv[])
{
CLIArguments args;
CLICallbacks cbs;
cbs.add("--help", [](CLIParser &parser) {
print_help();
parser.end();
});
cbs.add("--output", [&args](CLIParser &parser) { args.output = parser.next_string(); });
cbs.add("--video", [&args](CLIParser &) { args.video = true; });
cbs.add("--compare", [&args](CLIParser &parser) { args.compare = parser.next_string(); });
cbs.add("--verbose", [&args](CLIParser &) { args.verbose = true; });
cbs.add("--trace", [&args](CLIParser &parser) {
args.trace = true;
args.trace_frame = parser.next_uint();
});
cbs.error_handler = [] { print_help(); };
cbs.default_handler = [&args](const char *value) { args.dump = value; };
CLIParser parser{ move(cbs), argc - 1, argv + 1 };
if (!parser.parse())
return 1;
else if (parser.ended_state)
return 0;
if (!args.dump)
{
fprintf(stderr, "Didn't specify input file.\n");
print_help();
return 1;
}
RDP::Dump dump;
if (!RDP::load_dump(args.dump, &dump))
return 1;
log("=== RDP DUMP ===\n");
log("DRAM: %u\n", dump.dram_size);
log("Command Lists: %u\n", unsigned(dump.lists.size()));
RDRAM.resize(dump.dram_size);
renderer->set_rdram(RDRAM.data(), RDRAM.size());
if (args.trace || args.video)
renderer->set_synchronous(true);
unsigned begin_index = 0;
double start_time = gettime();
unsigned i = 0;
for (auto &list : dump.lists)
{
log(" List #%u:\n", i);
log(" DRAM updates: %u\n", unsigned(list.dram_updates.size()));
log("\n");
log(" Commands:\n");
for (auto &update : list.dram_updates)
memcpy(RDRAM.data() + update.offset, update.payload.data(), update.payload.size());
unsigned draw_call_count = 0;
bool trace = args.trace && i == args.trace_frame;
frontend.reset_draw_count();
// Mostly useful for breakpoints ...
frontend.trace = trace;
for (auto &cmd : list.commands)
{
log("%17s:", DP_command_names[cmd.command]);
for (auto &arg : cmd.arguments)
log(" 0x%x", arg);
frontend.command(cmd.command, cmd.arguments.data());
// Trace every draw call.
if (trace && frontend.get_draw_count() != draw_call_count)
{
renderer->sync_full();
device->begin_index(begin_index);
renderer->begin_index(begin_index);
char tmp[128];
sprintf(tmp, "_%07u_%07u_color_0x%x_depth_0x%x_size_%u.png", i, frontend.get_draw_count(),
renderer->get_current_framebuffer().addr, renderer->get_current_framebuffer().depth_addr,
renderer->get_current_framebuffer().pixel_size);
assert(args.output);
string path = args.output;
path += tmp;
fprintf(stderr, "Tracing to: %s\n", path.c_str());
dump_framebuffer(renderer, path.c_str());
draw_call_count = frontend.get_draw_count();
}
log("\n");
}
log("\n\n");
begin_index = (begin_index + 1) % 3;
if (args.video)
{
renderer->sync_full();
device->begin_index(begin_index);
renderer->begin_index(begin_index);
char tmp[128];
sprintf(tmp, "_%07u_color_0x%x_depth_0x%x_size_%u.png", i, renderer->get_current_framebuffer().addr,
renderer->get_current_framebuffer().depth_addr, renderer->get_current_framebuffer().pixel_size);
string path = args.output;
path += tmp;
fprintf(stderr, "Dumping to: %s\n", path.c_str());
dump_framebuffer(renderer, path.c_str());
}
else
{
renderer->complete_frame();
device->begin_index(begin_index);
renderer->begin_index(begin_index);
}
renderer->get_vi_outputs().clear();
i++;
}
renderer->sync_full();
double end_time = gettime();
fprintf(stderr, "Rendered %u lists in %.2f seconds (ms / frame: %.3f ms).\n", unsigned(dump.lists.size()),
end_time - start_time, 1000.0 * (end_time - start_time) / double(dump.lists.size()));
if (args.output && !args.video)
{
dump_framebuffer(renderer, args.output);
}
if (args.compare)
{
renderer->sync_full();
compare_framebuffer(renderer, args.compare);
}
fprintf(stderr, "Number of frames: %u\n", i);
return 0;
}
int main(int argc, char *argv[])
{
if (!Vulkan::VulkanContext::init_loader())
return 1;
auto vulkan_ctx = unique_ptr<Vulkan::VulkanContext>(new Vulkan::VulkanContext);
Vulkan::Device vulkan_dev(*vulkan_ctx, 3);
RDP::Renderer renderer(vulkan_dev);
frontend.set_renderer(&renderer, &vulkan_dev);
rdp_dump_main(&renderer, &vulkan_dev, argc, argv);
}
File diff suppressed because it is too large. Load diff
-584
View File
@@ -1,584 +0,0 @@
#ifndef RDP_HPP
#define RDP_HPP
#include "common.hpp"
#include "tmem.hpp"
#include "vulkan_util.hpp"
#include <stdint.h>
#include <unordered_map>
#include <cstring>
#include <cstdio>
#include <vector>
#define RDP_MAX_PRIMITIVES 1024
#define RDP_MAX_PRIMITIVES_LOG2 12
#define RDP_MAX_COMBINERS 64
#define TILE_SIZE_X 8
#define TILE_SIZE_Y 8
#define RDP_FLAG_FLIP (1 << 0)
#define RDP_FLAG_DO_OFFSET (1 << 1)
#define RDP_FLAG_SAMPLE_TEX (1 << 2)
#define RDP_FLAG_FORCE_BLEND (1 << 3)
#define RDP_FLAG_AA_ENABLE (1 << 4)
#define RDP_FLAG_SHADE (1 << 5)
#define RDP_FLAG_INTERPOLATE_Z (1 << 6)
#define RDP_FLAG_Z_UPDATE (1 << 7)
#define RDP_FLAG_Z_COMPARE (1 << 8)
#define RDP_FLAG_PERSPECTIVE (1 << 9)
#define RDP_FLAG_BILERP0 (1 << 10)
#define RDP_FLAG_BILERP1 (1 << 11)
#define RDP_FLAG_ALPHATEST (1 << 12)
#define RDP_FLAG_COLOR_ON_CVG (1 << 13)
#define RDP_FLAG_CVG_TIMES_ALPHA (1 << 14)
#define RDP_FLAG_ALPHA_CVG_SELECT (1 << 15)
#define RDP_FLAG_ALPHA_NOISE (1 << 16)
#define RDP_FLAG_SAMPLE_TEX_PIPELINED (1 << 17)
#define RDP_FLAG_SAMPLE_TEX_LOD (1 << 18)
#define RDP_FLAG_CVG_MODE_SHIFT 20
#define RDP_FLAG_TILE_SHIFT 22
#define RDP_FLAG_LEVELS_SHIFT 25
#define RDP_FLAG_CYCLE_TYPE_SHIFT 30
#define RDP_FLAG_Z_MODE_SHIFT 28
#define BLENDMODE_FLAG_DITHER_SEL 16
#define LOD_INFO_PRIMITIVE_DETAIL (1 << 16)
#define LOD_INFO_PRIMITIVE_SHARPEN (1 << 17)
#define LOD_INFO_PRIMITIVE_MIN_LOD_SHIFT 18
#define LOD_INFO_PRIMITIVE_MIN_LOD_MASK (31 << 18)
#define SEXT(x, bits) (int32_t((x) << (32 - (bits))) >> (32 - (bits)))
namespace RDP
{
struct Primitive
{
int32_t xl, xm, xh;
int32_t yl, ym, yh;
int32_t DxLDy, DxMDy, DxHDy;
uint32_t flags;
};
struct Attribute
{
int32_t rgba[4];
int32_t d_rgba_dx[4];
int32_t d_rgba_de[4];
int32_t d_rgba_dy[4];
int32_t stwz[4];
int32_t d_stwz_dx[4];
int32_t d_stwz_de[4];
int32_t d_stwz_dy[4];
};
class Renderer
{
public:
Renderer(Vulkan::Device &device);
void set_scissor(int xh, int yh, int xl, int yl);
void set_fill_color(uint32_t color)
{
state.fill_color = color;
}
void set_blend_word(uint32_t word, uint32_t dither_sel)
{
state.blend_word = word | (dither_sel << BLENDMODE_FLAG_DITHER_SEL);
}
void set_key_r(uint32_t w1, uint32_t w2);
void set_key_gb(uint32_t w1, uint32_t w2);
void set_dithering(unsigned type);
void set_combine(uint32_t w1, uint32_t w2);
void set_prim_color(uint32_t w1, uint32_t w2);
void set_env_color(uint32_t w2);
void set_fog_color(uint32_t w2);
void set_convert(uint32_t w1, uint32_t w2);
void set_primitive_z(uint32_t w2);
void set_lod_modes(bool detail, bool sharpen);
bool combiner_reads_secondary_tile(unsigned cycle) const;
bool combiner_reads_pipelined_tile() const;
bool combiner_reads_tile(CycleType type) const;
void log_combiner() const;
void set_blend_color(uint32_t color)
{
state.blend_color = color;
}
// Either sync_full or async_full must be called in a frame before ending it to
// ensure that all pending command buffer have been submitted.
// sync_full is typically called when CPU needs to invalidate GPU memory.
// Ensures that RDRAM sees a coherent view of memory written by the GPU.
// Must be called if emulator accesses RDRAM which is covered by color buffer or depth buffer.
void sync_full();
// Flush out all outstanding work, but don't sync back to CPU yet.
void complete_frame();
// Draw RDP primitive with bounding box.
void draw_primitive(const Primitive &tri, const Attribute *attr, uint32_t tile_mask, int min_x, int max_x,
int min_y, int max_y);
// Optimization for clear colors.
// If our framebuffers are on CPU (start of frame), it's kinda pointless to sync to GPU and back.
void fill_rect_cpu(int min_x, int max_x, int min_y, int max_y);
void set_color_image(uint32_t addr, unsigned format, unsigned pixel_size, unsigned width);
void set_depth_image(uint32_t addr);
void set_rdram(uint8_t *dram, size_t size)
{
rdram.base = dram;
rdram.size = size;
tmem.set_rdram(dram, size);
}
void set_scissor_variables(const char *name)
{
fprintf(stderr, "ROM name: %s\n", name);
width_greater_than = 320;
width_greater_than_max_height = 480;
/*
* We need to detect the following games by
* CRC because the names are non-ASCII:
*
* Wrestlemania 2000 (Japan)
*/
if (
!strcmp(name, "GOLDENEYE") ||
!strcmp(name, "ALL STAR TENNIS '99") ||
!strcmp(name, "All-Star Baseball 99") ||
!strcmp(name, "All-Star Baseball '0") ||
!strcmp(name, "All-Star Baseball 20") ||
!strcmp(name, "Armorines Project S.") ||
!strcmp(name, "Banjo-Kazooie") ||
!strcmp(name, "BANJO KAZOOIE 2") ||
!strcmp(name, "BANJO TOOIE") ||
!strcmp(name, "BATTLEZONE") ||
!strcmp(name, "Command&Conquer") ||
!strcmp(name, "CONKER BFD") ||
!strcmp(name, "CBFD ECTS") ||
!strcmp(name, "CyberTiger") ||
!strcmp(name, "Donald Duck Goin' Qu") ||
!strcmp(name, "Donald Duck Quack At") ||
!strcmp(name, "DUKE NUKEM ZERO HOUR") ||
!strcmp(name, "ECW Hardcore Revolut") ||
!strcmp(name, "EXCITEBIKE64") ||
!strcmp(name, "F1RacingChampionship") ||
!strcmp(name, "FIFA: RTWC 98") ||
!strcmp(name, "RoadToWorldCup98") ||
!strcmp(name, "FIFA 99") ||
!strcmp(name, "Fox Sports Hoops 99") ||
!strcmp(name, "GAUNTLET LEGENDS") ||
!strcmp(name, "Indiana Jones") ||
!strcmp(name, "Jeremy McGrath Super") ||
!strcmp(name, "KEN GRIFFEY SLUGFEST") ||
!strcmp(name, "Knockout Kings 2000") ||
!strcmp(name, "NBA COURTSIDE") ||
!strcmp(name, "LEGORacers") ||
!strcmp(name, "Madden NFL 2000") ||
!strcmp(name, "Madden NFL 2001") ||
!strcmp(name, "Madden NFL 2002") ||
!strcmp(name, "MLB FEATURING K G JR") ||
!strcmp(name, "MarioTennis") ||
!strcmp(name, "MarioTennis64") ||
!strcmp(name, "Monaco GP Racing 2") ||
!strcmp(name, "MORTAL KOMBAT 4") ||
!strcmp(name, "NBA Courtside 2") ||
!strcmp(name, "NBA JAM 2000") ||
!strcmp(name, "NBA JAM 99") ||
!strcmp(name, "NBA LIVE 2000") ||
!strcmp(name, "NBA Live 99") ||
!strcmp(name, "NBA SHOWTIME") ||
!strcmp(name, "NEWTETRIS") ||
!strcmp(name, "NFL BLITZ") ||
!strcmp(name, "NFL BLITZ SPECIAL ED") ||
!strcmp(name, "blitz2k") ||
!strcmp(name, "NFL BLITZ 2001") ||
!strcmp(name, "NFL Quarterback Club") ||
!strcmp(name, "NFL QBC 2000") ||
!strcmp(name, "NHL 99") ||
!strcmp(name, "NHL_BREAKAWAY_98") ||
!strcmp(name, "NHL Breakaway '99") ||
!strcmp(name, "NIGHTMARE CREATURES") ||
!strcmp(name, "NUCLEARSTRIKE64") ||
!strcmp(name, "Perfect Dark") ||
!strcmp(name, "Premier Manager 64") ||
!strcmp(name, "Racing Simulation 2") ||
!strcmp(name, "RAMPAGE") ||
!strcmp(name, "RAMPAGE2") ||
!strcmp(name, "RAT ATTACK") ||
!strcmp(name, "Rayman 2") ||
!strcmp(name, "RUGRATSTREASUREHUNT") ||
!strcmp(name, "ROADSTERS TROPHY") ||
!strcmp(name, "Rush 2049") ||
!strcmp(name, "SCOOBY-DOO") ||
!strcmp(name, "South Park") ||
!strcmp(name, "Rogue Squadron") ||
!strcmp(name, "rogue squadron") ||
!strcmp(name, "Battle for Naboo") ||
!strcmp(name, "STAR WARS EP1 RACER") ||
!strcmp(name, "SUPERROBOTSPIRITS") ||
!strcmp(name, "Supercross") ||
!strcmp(name, "TARZAN") ||
!strcmp(name, "Taz Express") ||
!strcmp(name, "TG RALLY 2") ||
!strcmp(name, "Tigger's Honey Hunt") ||
!strcmp(name, "TRIPLE PLAY 2000") ||
!strcmp(name, "Turok: Rage Wars") ||
!strcmp(name, "Turok 2: Seeds of Ev") ||
!strcmp(name, "Turok 3: Shadow of O") ||
!strcmp(name, "VIOLENCEKILLER") ||
!strcmp(name, "WCW BACKSTAGE") ||
!strcmp(name, "WCW MAYHEM") ||
!strcmp(name, "WCWvs.NWO:World Tour") ||
!strcmp(name, "WCW / nWo REVENGE") ||
!strcmp(name, "World Cup 98") ||
!strcmp(name, "WWF: Attitude") ||
!strcmp(name, "WWF No Mercy") ||
!strcmp(name, "WWF War Zone") ||
!strcmp(name, "WRESTLEMANIA 2000") ||
!strcmp(name, "PLACEHOLDER")
)
{
width_greater_than = 280;
width_greater_than_max_height = 200;
}
#if 0
/* We need to come up with some proper heuristics
* for Resident Evil 2 - see NOTE below -
* Without the expansion pak, the resolution ran at 320x240p,
* same as the PS1. However, with the expansion, the resolution
* adjusted based on CPU load and outputted a maximum
* resolution of 512x384.
* */
else if
(
!strcmp(name, "BioHazard II") ||
!strcmp(name, "Resident Evil II")
)
{
width_greater_than = 280;
width_greater_than_max_height = 384;
}
#endif
#if 0
/* These games require separate tweaking still
*
* Bottom of the 9th (Bottom of the 9th)
* Resident Evil 2/Biohazard (BioHazard II) (Resident Evil II) -
* Army Men: Sarge's Heroes 2 (ARMYMEN SARGE 2)
* Brunswick Circuit Pro Bowling (BRUNSWICKBOWLING)
* Lode Runner 3D
* Mario no Photopie
* NBA In The Zone 2000
* NFL Quarterback Club (mostly correct but not yet perfect)
* NFL Quarterback Club 2000 (mostly correct but not yet perfect)
* Perfect Dark (mostly correct but weapon selection screen can make
* screen shift around)
* Top Gear Rally (might need better heuristics )
* PD Ultraman Battle Collection 64 ("Ultraman Battle JAPA") (flickers)
* Supercross 2000 (screen can shift and pan around badly on title screen)
* Vigilante 8
*/
#endif
}
void set_synchronous(bool enable)
{
// Make sure we don't end up with a situation where we inadvertently write old data to RDRAM.
if (enable && !synchronous)
async_transfers.clear();
synchronous = enable;
}
struct VIOutput
{
Framebuffer framebuffer;
Vulkan::ImageHandle image;
};
const Framebuffer &get_current_framebuffer() const
{
return framebuffer;
}
std::vector<VIOutput> &get_vi_outputs()
{
return vi_outputs;
}
void check_tmem_feedback();
TMEM &get_tmem()
{
return tmem;
}
void begin_index(unsigned index);
private:
Vulkan::Device &device;
std::vector<AsyncFramebuffer> async_transfers;
std::vector<VIOutput> vi_outputs;
void sync_framebuffer_to_cpu(AsyncFramebuffer &async);
unsigned current_sync_index = 0;
unsigned rdp_dithering;
unsigned width_greater_than = 320;
unsigned width_greater_than_max_height = 480;
struct
{
Vulkan::CommandBuffer cmd = {};
Vulkan::DescriptorSet lut_set;
Vulkan::DescriptorSet buffer_set;
Vulkan::ImageHandle dither_lut;
Vulkan::ImageHandle centroid_lut;
Vulkan::Buffer z_lut;
Vulkan::Buffer framebuffer = {};
Vulkan::Buffer framebuffer_depth = {};
struct
{
unsigned width, height, layers;
} tile_map;
} vulkan;
void begin_command_buffer();
void begin_framebuffer();
void begin_framebuffer_depth();
Vulkan::Fence submit(const Vulkan::Semaphore *semaphore = nullptr);
struct BufferWorkDescriptor
{
uint32_t base[2];
uint32_t primitive;
uint32_t padding;
};
static_assert(sizeof(BufferWorkDescriptor) == 16, "Work Descriptor must be 16 bytes.");
// SoA for improved cache behavior.
struct BufferTile
{
uint32_t uv[TILE_SIZE_X * TILE_SIZE_Y];
uint32_t uv_next[TILE_SIZE_X * TILE_SIZE_Y];
uint32_t uv_prev_y[TILE_SIZE_X * TILE_SIZE_Y];
int32_t z[TILE_SIZE_X * TILE_SIZE_Y];
uint32_t rgba[TILE_SIZE_X * TILE_SIZE_Y];
uint32_t coverage[TILE_SIZE_X * TILE_SIZE_Y];
};
static const unsigned FlushBufferTileCount = Vulkan::MaxBlockSize / (2 * sizeof(BufferTile));
struct BufferPrimitiveAttribute
{
int32_t rgba[4];
int32_t d_rgba_dx[4];
int32_t d_rgba_de[4];
int32_t d_rgba_dy[4];
int32_t stwz[4];
int32_t d_stwz_dx[4];
int32_t d_stwz_de[4];
int32_t d_stwz_dy[4];
int32_t d_rgba_diff[4];
int32_t d_stwz_diff[4];
uint32_t tile_descriptors[8];
};
struct BufferPrimitive
{
int32_t xl, xm, xh;
uint32_t primitive_z;
int32_t yl, ym, yh;
uint32_t span_stride_combiner;
int32_t DxLDy, DxMDy, DxHDy;
uint32_t blend_color;
uint32_t flags, scissor_x, scissor_y, fill_color_blend;
// scissor filled in by Renderer.
// fill_color filled in by Renderer.
BufferPrimitiveAttribute attr;
};
static_assert(sizeof(BufferPrimitive) == 256, "Primitive struct is not 256 bytes.");
struct Combiner
{
uint32_t sub_a, sub_b, mul, add;
};
struct CombinerBaked
{
int32_t sub_a[4];
int32_t sub_b[4];
int32_t mul[4];
int32_t add[4];
};
// Figure out better way to pack this.
struct BufferCombiner
{
CombinerBaked cycle[2];
Combiner color[2];
Combiner alpha[2];
int32_t padding[16];
};
static_assert(sizeof(BufferCombiner) == 256, "BufferCombiner is not 256 bytes.");
struct TileInfo
{
uint32_t head = -1u;
uint32_t tail = -1u;
};
struct TileNode
{
TileNode(uint32_t primitive, uint32_t next)
: primitive(primitive)
, next(next)
{
}
TileNode() = default;
uint32_t primitive = -1u;
uint32_t next = -1u;
};
static_assert(sizeof(TileNode) == 8, "TileListHeader struct is not 8 bytes.");
std::vector<BufferPrimitive> primitive_data;
std::vector<BufferCombiner> combiner_data;
std::vector<TileInfo> tile_lists;
std::vector<TileNode> tile_nodes;
std::vector<BufferWorkDescriptor> work_data;
uint32_t tile_count = 0;
std::vector<uint8_t> tile_data;
struct Tile
{
TileDescriptor desc;
size_t offset;
unsigned width, height;
unsigned off_x, off_y, off_z;
TMEM::TransferInfo hw_fbe_info;
bool hw_fbe;
};
std::vector<Tile> tile_descriptors;
bool tile_hw_fbe = false;
void allocate_tiles();
void update_tiles(uint32_t tile_mask);
void append_tile_list(TileInfo &tile_info, unsigned prim, unsigned tile);
unsigned tiles_x = 0, tiles_y = 0;
void flush_tile_lists();
struct
{
int xh, yh, xl, yl;
} scissor;
struct
{
uint32_t fill_color = 0;
uint32_t blend_word = 0;
uint32_t blend_color = 0;
uint32_t fog_color = 0;
uint32_t prim_color = 0;
uint32_t env_color = 0;
uint32_t prim_lod_frac = 0;
int32_t k0_tf = 0;
int32_t k1_tf = 0;
int32_t k2_tf = 0;
int32_t k3_tf = 0;
uint32_t k4 = 0;
uint32_t k5 = 0;
uint32_t key_scale_r = 0;
uint32_t key_scale_g = 0;
uint32_t key_scale_b = 0;
uint32_t key_center_r = 0;
uint32_t key_center_g = 0;
uint32_t key_center_b = 0;
uint32_t primitive_z = 0;
BufferCombiner combiners = {};
bool combiners_dirty = true;
bool combiner_reads_secondary_tile[2] = {};
bool combiner_reads_tile[2] = {};
bool combiner_reads_pipelined_tile = false;
std::unordered_map<size_t, unsigned> combiner_map;
unsigned last_combiner = 0;
uint32_t lod_flags = 0;
} state;
struct RDRAM
{
RDRAM()
{
shadow_base.resize(RDRAM_SIZE);
hidden_bits.resize(RDRAM_SIZE);
}
uint8_t *base = nullptr;
size_t size = 0;
std::vector<uint8_t> shadow_base;
std::vector<uint8_t> hidden_bits;
} rdram;
Framebuffer framebuffer;
void set_framebuffer_size(unsigned width, unsigned height);
void sync_gpu_to_dram(bool blocking);
void sync_gpu_to_vi(Vulkan::CommandBuffer &cmd);
void sync_color_dram_to_gpu();
void sync_depth_dram_to_gpu();
TMEM tmem;
uint32_t tile_instances[TMEM_TILES] = {};
void reset_buffers();
uint64_t update_static_combiner();
void init_dither_lut();
void init_centroid_lut();
void init_z_lut();
void clip_scissor(int &xmin, int &xmax, int &ymin, int &ymax);
// Just a counter to seed the RNG with.
int32_t rng_frame_count = 0;
bool coarse_conservative_raster(int x, int y, int min_x, int max_x, int min_y, int max_y,
const Primitive &prim) const;
uint64_t raster_tile_count = 0;
uint64_t reject_tile_count = 0;
bool synchronous = false;
uint8_t *framebuffer_data()
{
return synchronous ? rdram.base : rdram.shadow_base.data();
}
};
}
#endif
-118
View File
@@ -1,118 +0,0 @@
#include "rdp_dump.hpp"
#include <memory>
#include <stdio.h>
#include <string.h>
using namespace std;
struct FILEDeleter
{
void operator()(FILE *fp)
{
if (fp)
fclose(fp);
}
};
namespace RDP
{
static bool read_u32(uint32_t *v, FILE *file)
{
return fread(v, sizeof(uint32_t), 1, file) == 1;
}
bool load_dump(const char *path, Dump *dump)
{
dump->lists.clear();
unique_ptr<FILE, FILEDeleter> file{ fopen(path, "rb") };
if (!file)
return false;
char header[8];
if (fread(header, sizeof(header), 1, file.get()) != 1)
return false;
if (memcmp(header, "RDPDUMP1", sizeof(header)))
return false;
uint32_t dram_size;
if (!read_u32(&dram_size, file.get()))
return false;
dump->dram_size = dram_size;
std::vector<DRAMUpdate> pending_dram;
CommandList *list = nullptr;
bool eof = false;
while (!eof)
{
uint32_t cmd;
if (!read_u32(&cmd, file.get()))
return false;
switch (static_cast<DumpCommand>(cmd))
{
case RDP_DUMP_CMD_EOF:
eof = true;
break;
case RDP_DUMP_CMD_UPDATE_DRAM:
{
DRAMUpdate update;
if (!read_u32(&update.offset, file.get()))
return false;
uint32_t block_size;
if (!read_u32(&block_size, file.get()))
return false;
update.payload.resize(block_size);
if (fread(update.payload.data(), 1, block_size, file.get()) != block_size)
return false;
pending_dram.push_back(move(update));
break;
}
case RDP_DUMP_CMD_BEGIN_COMMAND_LIST:
if (list)
return false;
dump->lists.emplace_back();
list = &dump->lists.back();
swap(list->dram_updates, pending_dram);
break;
case RDP_DUMP_CMD_END_COMMAND_LIST:
if (!list)
return false;
list = nullptr;
break;
case RDP_DUMP_CMD_RDP_COMMAND:
{
uint32_t command, words;
if (!read_u32(&command, file.get()))
return false;
if (!read_u32(&words, file.get()))
return false;
Command cmd;
cmd.command = command;
cmd.arguments.resize(words);
if (fread(cmd.arguments.data(), sizeof(uint32_t), words, file.get()) != words)
return false;
list->commands.push_back(move(cmd));
break;
}
default:
return false;
}
}
return true;
}
}
@@ -1,46 +0,0 @@
#ifndef RDP_DUMP_HPP
#define RDP_DUMP_HPP
#include <stdint.h>
#include <vector>
namespace RDP
{
enum DumpCommand
{
RDP_DUMP_CMD_INVALID = 0,
RDP_DUMP_CMD_UPDATE_DRAM = 1,
RDP_DUMP_CMD_BEGIN_COMMAND_LIST = 2,
RDP_DUMP_CMD_END_COMMAND_LIST = 3,
RDP_DUMP_CMD_RDP_COMMAND = 4,
RDP_DUMP_CMD_EOF = 5,
};
struct DRAMUpdate
{
uint32_t offset;
std::vector<uint8_t> payload;
};
struct Command
{
uint32_t command;
std::vector<uint32_t> arguments;
};
struct CommandList
{
std::vector<DRAMUpdate> dram_updates;
std::vector<Command> commands;
};
struct Dump
{
std::vector<CommandList> lists;
uint32_t dram_size;
};
bool load_dump(const char *path, Dump *dump);
}
#endif
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

File diff suppressed because it is too large. Load diff
-239
View File
@@ -1,239 +0,0 @@
#ifndef TMEM_HPP
#define TMEM_HPP
#include "common.hpp"
#include <stddef.h>
#include <stdint.h>
namespace RDP
{
#define TMEM_BANKS 4
#define TMEM_WORDS 512
#define TMEM_TILES 8
enum Format
{
FORMAT_RGBA = 0,
FORMAT_YUV = 1,
FORMAT_CI = 2,
FORMAT_IA = 3,
FORMAT_I = 4
};
enum PixelSize
{
PIXEL_SIZE_4BPP = 0,
PIXEL_SIZE_8BPP = 1,
PIXEL_SIZE_16BPP = 2,
PIXEL_SIZE_32BPP = 3
};
struct TileDescriptor
{
uint32_t mask_mirror_and[4];
int32_t clamped[4];
float offset[2];
int32_t base[2];
int32_t shift[2];
float layer;
int mid_texel;
};
static_assert(sizeof(TileDescriptor) == 64, "TileDescriptor is not 64 bytes.");
struct Tile
{
unsigned format;
unsigned pixel_size;
unsigned line;
unsigned tmem;
unsigned palette;
int32_t sl, tl, sh, th;
unsigned size[2];
// Raw RDP values.
unsigned mask[2];
uint32_t shift[2];
bool mirror_en[2];
bool clamp_en[2];
// Pre-compute values that are convenient for shader to work with.
int32_t clamp[4];
uint32_t mirror_and[2];
uint32_t mask_and[2];
};
class TMEM
{
public:
TMEM();
void set_enable_tlut(bool state);
void set_tlut_type(bool type);
void set_tile(uint32_t w0, uint32_t w1);
void load_tile(uint32_t w0, uint32_t w1);
void load_block(uint32_t w0, uint32_t w1);
void load_tlut(uint32_t w0, uint32_t w1);
void set_tile_size(uint32_t w0, uint32_t w1);
uint32_t get_dirty_tiles() const
{
return dirty_tiles;
}
void invalidate()
{
dirty_tiles = (1 << TMEM_TILES) - 1;
}
void clear_dirty_tiles(uint32_t mask)
{
dirty_tiles &= ~mask;
}
void get_effective_size(unsigned index, unsigned *width, unsigned *height) const
{
*width = tiles[index].size[0];
*height = tiles[index].size[1];
}
void build_tile_descriptor(unsigned index, TileDescriptor *desc) const;
void decode_tile(unsigned index, uint8_t *buffer, size_t stride);
bool tmem_is_framebuffer() const
{
return fbe.tmem_is_framebuffer;
}
enum Transfer
{
TRANSFER_INVALID = 0,
TRANSFER_I8 = 1,
TRANSFER_IA8 = 2,
TRANSFER_RGBA16 = 3,
TRANSFER_RGBA32 = 4,
TRANSFER_IA16 = 5
};
struct TransferInfo
{
Transfer transfer;
Vulkan::Buffer buffer;
uint32_t offset_pixels;
uint32_t stride_pixels;
uint32_t range_pixels;
};
bool get_framebuffer_transfer(unsigned index, TransferInfo *info) const;
void set_texture_image(uint32_t offset, unsigned format, unsigned pixel_size, unsigned width);
uint32_t get_texture_image_offset() const
{
return texture.offset;
}
void set_rdram(uint8_t *base, size_t size)
{
rdram.base = base;
rdram.size = size;
}
void set_async_framebuffers(const std::vector<AsyncFramebuffer> *framebuffers)
{
async_framebuffers = framebuffers;
}
const Tile &get_tile(unsigned i) const
{
return tiles[i];
}
private:
uint16_t tmem[TMEM_WORDS][TMEM_BANKS];
Tile tiles[TMEM_TILES];
uint32_t dirty_tiles = (1 << TMEM_TILES) - 1;
const std::vector<AsyncFramebuffer> *async_framebuffers = nullptr;
bool enable_tlut = false;
bool tlut_type = false;
void update_tile_info(Tile &tile);
struct
{
uint32_t offset = 0;
unsigned format = 0;
unsigned pixel_size = 0;
unsigned width = 0;
} texture;
struct
{
// TMEM is currently assumed to alias with a framebuffer.
// Used for HWFBE effects.
bool tmem_is_framebuffer = false;
// The offset into the buffer which was loaded into TMEM.
uint32_t offset_pixels = 0;
// The TMEM addr that the framebuffer was loaded into.
uint32_t tmem_base = 0;
Framebuffer hardware_framebuffer;
Vulkan::Buffer color_buffer;
} fbe;
struct
{
uint8_t *base = nullptr;
size_t size = 0;
} rdram;
void read_rgba32(uint8_t *buffer, unsigned word, unsigned x, unsigned y, unsigned line, unsigned palette);
void read_rgba16(uint8_t *buffer, unsigned word, unsigned x, unsigned y, unsigned line, unsigned palette);
void read_ia16(uint8_t *buffer, unsigned word, unsigned x, unsigned y, unsigned line, unsigned palette);
void read_ia8(uint8_t *buffer, unsigned word, unsigned x, unsigned y, unsigned line, unsigned palette);
void read_ia4(uint8_t *buffer, unsigned word, unsigned x, unsigned y, unsigned line, unsigned palette);
void read_i16(uint8_t *buffer, unsigned word, unsigned x, unsigned y, unsigned line, unsigned palette);
void read_i8(uint8_t *buffer, unsigned word, unsigned x, unsigned y, unsigned line, unsigned palette);
void read_i4(uint8_t *buffer, unsigned word, unsigned x, unsigned y, unsigned line, unsigned palette);
void read_ci16(uint8_t *buffer, unsigned word, unsigned x, unsigned y, unsigned line, unsigned palette);
void read_ci8(uint8_t *buffer, unsigned word, unsigned x, unsigned y, unsigned line, unsigned palette);
void read_ci4(uint8_t *buffer, unsigned word, unsigned x, unsigned y, unsigned line, unsigned palette);
bool load_tile_framebuffer(const Tile &tile, uint32_t sl, uint32_t tl);
};
class TileAtlasAllocator
{
public:
void reset();
void add_size(unsigned width, unsigned height);
void begin_allocator();
void allocate(unsigned *x, unsigned *y, unsigned *layer, unsigned width, unsigned height);
void end_allocator();
void get_atlas_size(unsigned *width, unsigned *height, unsigned *layers)
{
*width = max_width;
*height = max_height;
*layers = num_layers;
}
private:
unsigned max_width = 0;
unsigned max_height = 0;
unsigned current_x = 0;
unsigned current_y = 0;
unsigned max_height_in_stripe = 0;
unsigned current_layer = 0;
unsigned num_layers = 0;
};
}
#endif
-342
View File
@@ -1,342 +0,0 @@
#include "vulkan.hpp"
#include "vulkan_symbol_wrapper.h"
#include <vector>
#ifdef PARALLEL_HAVE_DYLIB
#include <dlfcn.h>
#endif
#include <stdexcept>
using namespace std;
namespace Vulkan
{
VulkanContext::VulkanContext()
: owned_instance(true)
, owned_device(true)
{
if (!create_instance())
{
destroy();
throw runtime_error("Failed to create Vulkan instance.");
}
VkPhysicalDeviceFeatures features = {};
if (!create_device(VK_NULL_HANDLE, VK_NULL_HANDLE, nullptr, 0, nullptr, 0, &features))
{
destroy();
throw runtime_error("Failed to create Vulkan device.");
}
}
bool VulkanContext::init_loader(PFN_vkGetInstanceProcAddr addr)
{
#ifdef PARALLEL_HAVE_DYLIB
static void *dylib;
if (dylib)
return true;
if (!addr)
{
dylib = dlopen("libvulkan.so", RTLD_NOW);
if (!dylib)
return false;
addr = reinterpret_cast<PFN_vkGetInstanceProcAddr>(dlsym(dylib, "vkGetInstanceProcAddr"));
if (!addr)
return false;
}
#endif
vulkan_symbol_wrapper_init(addr);
return vulkan_symbol_wrapper_load_global_symbols();
}
VulkanContext::VulkanContext(VkInstance instance, VkPhysicalDevice gpu, VkDevice device, VkQueue queue,
uint32_t queue_family)
: device(device)
, instance(instance)
, gpu(gpu)
, queue(queue)
, queue_family(queue_family)
, alt_queue(queue)
, alt_queue_family(queue_family)
, owned_instance(false)
, owned_device(false)
{
vulkan_symbol_wrapper_load_core_instance_symbols(instance);
vulkan_symbol_wrapper_load_core_device_symbols(device);
vkGetPhysicalDeviceProperties(gpu, &gpu_props);
vkGetPhysicalDeviceMemoryProperties(gpu, &mem_props);
}
VulkanContext::VulkanContext(VkInstance instance, VkPhysicalDevice gpu, VkSurfaceKHR surface,
const char **required_device_extensions, unsigned num_required_device_extensions,
const char **required_device_layers, unsigned num_required_device_layers,
const VkPhysicalDeviceFeatures *required_features)
: instance(instance)
, owned_instance(false)
, owned_device(true)
{
vulkan_symbol_wrapper_load_core_instance_symbols(instance);
if (!create_device(gpu, surface, required_device_extensions, num_required_device_extensions, required_device_layers,
num_required_device_layers, required_features))
{
destroy();
throw runtime_error("Failed to create Vulkan device.");
}
}
void VulkanContext::destroy()
{
if (device != VK_NULL_HANDLE)
vkDeviceWaitIdle(device);
#ifdef VULKAN_DEBUG
if (debug_callback)
vkDestroyDebugReportCallbackEXT(instance, debug_callback, nullptr);
#endif
if (owned_device && device != VK_NULL_HANDLE)
vkDestroyDevice(device, nullptr);
if (owned_instance && instance != VK_NULL_HANDLE)
vkDestroyInstance(instance, nullptr);
}
VulkanContext::~VulkanContext()
{
destroy();
}
const VkApplicationInfo &VulkanContext::get_application_info()
{
static const VkApplicationInfo info = {
VK_STRUCTURE_TYPE_APPLICATION_INFO, nullptr, "paraLLEl RDP", 0, "paraLLEl RDP", 0, VK_MAKE_VERSION(1, 0, 18),
};
return info;
}
#ifdef VULKAN_DEBUG
static VKAPI_ATTR VkBool32 VKAPI_CALL vulkan_debug_cb(VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objectType, uint64_t object,
size_t location, int32_t messageCode, const char *pLayerPrefix,
const char *pMessage, void *pUserData)
{
(void)objectType;
(void)object;
(void)location;
(void)messageCode;
(void)pUserData;
if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT)
{
fprintf(stderr, "[Vulkan]: Error: %s: %s\n", pLayerPrefix, pMessage);
}
else if (flags & VK_DEBUG_REPORT_WARNING_BIT_EXT)
{
fprintf(stderr, "[Vulkan]: Warning: %s: %s\n", pLayerPrefix, pMessage);
}
else if (flags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT)
{
fprintf(stderr, "[Vulkan]: Performance warning: %s: %s\n", pLayerPrefix, pMessage);
}
else
{
fprintf(stderr, "[Vulkan]: Information: %s: %s\n", pLayerPrefix, pMessage);
}
return VK_FALSE;
}
#endif
bool VulkanContext::create_instance()
{
VkInstanceCreateInfo info = { VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO };
info.pApplicationInfo = &get_application_info();
#ifdef VULKAN_DEBUG
static const char *instance_extensions[] = { "VK_EXT_debug_report" };
static const char *instance_layers[] = { "VK_LAYER_LUNARG_standard_validation" };
info.enabledExtensionCount = 1;
info.ppEnabledExtensionNames = instance_extensions;
info.enabledLayerCount = 1;
info.ppEnabledLayerNames = instance_layers;
#endif
if (vkCreateInstance(&info, nullptr, &instance) != VK_SUCCESS)
return false;
vulkan_symbol_wrapper_load_core_instance_symbols(instance);
#ifdef VULKAN_DEBUG
VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_EXTENSION_SYMBOL(instance, vkCreateDebugReportCallbackEXT);
VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_EXTENSION_SYMBOL(instance, vkDebugReportMessageEXT);
VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_EXTENSION_SYMBOL(instance, vkDestroyDebugReportCallbackEXT);
{
VkDebugReportCallbackCreateInfoEXT info = { VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT };
info.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT |
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
info.pfnCallback = vulkan_debug_cb;
vkCreateDebugReportCallbackEXT(instance, &info, NULL, &debug_callback);
}
#endif
return true;
}
bool VulkanContext::create_device(VkPhysicalDevice gpu, VkSurfaceKHR surface, const char **required_device_extensions,
unsigned num_required_device_extensions, const char **required_device_layers,
unsigned num_required_device_layers,
const VkPhysicalDeviceFeatures *required_features)
{
if (gpu == VK_NULL_HANDLE)
{
uint32_t gpu_count = 0;
V(vkEnumeratePhysicalDevices(instance, &gpu_count, nullptr));
vector<VkPhysicalDevice> gpus(gpu_count);
V(vkEnumeratePhysicalDevices(instance, &gpu_count, gpus.data()));
gpu = gpus.front();
}
this->gpu = gpu;
vkGetPhysicalDeviceProperties(gpu, &gpu_props);
vkGetPhysicalDeviceMemoryProperties(gpu, &mem_props);
uint32_t queue_count;
vkGetPhysicalDeviceQueueFamilyProperties(gpu, &queue_count, nullptr);
vector<VkQueueFamilyProperties> queue_props(queue_count);
vkGetPhysicalDeviceQueueFamilyProperties(gpu, &queue_count, queue_props.data());
if (surface != VK_NULL_HANDLE)
{
VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_EXTENSION_SYMBOL(instance, vkGetPhysicalDeviceSurfaceSupportKHR);
}
// First, find a graphics capable queue.
// This will be our alt_queue if we need a different queue family to do async compute.
bool found_queue = false;
for (unsigned i = 0; i < queue_count; i++)
{
VkBool32 supported = surface == VK_NULL_HANDLE;
if (surface != VK_NULL_HANDLE)
vkGetPhysicalDeviceSurfaceSupportKHR(gpu, i, surface, &supported);
VkQueueFlags required = VK_QUEUE_COMPUTE_BIT | VK_QUEUE_GRAPHICS_BIT;
if (supported && ((queue_props[i].queueFlags & required) == required))
{
found_queue = true;
queue_family = i;
break;
}
}
if (!found_queue)
return false;
bool same_queue_async = false;
bool async_compute = false;
if (queue_props[queue_family].queueCount >= 2)
same_queue_async = true;
if (same_queue_async)
{
alt_queue_family = queue_family;
async_compute = true;
}
else
{
found_queue = false;
for (unsigned i = 0; i < queue_count; i++)
{
if (i == queue_family)
continue;
VkQueueFlags required = VK_QUEUE_COMPUTE_BIT;
if ((queue_props[i].queueFlags & required) == required)
{
alt_queue_family = i;
async_compute = true;
found_queue = true;
break;
}
}
}
static const float prios[] = { 0.5f, 0.5f };
VkDeviceQueueCreateInfo queue_info[2] = {
{ VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO }, { VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO },
};
VkDeviceCreateInfo device_info = { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO };
device_info.pQueueCreateInfos = queue_info;
if (async_compute && same_queue_async)
{
device_info.queueCreateInfoCount = 1;
queue_info[0].queueFamilyIndex = queue_family;
queue_info[0].queueCount = 2;
queue_info[0].pQueuePriorities = prios;
}
else if (async_compute && !same_queue_async)
{
// alt_queue is actually the "external" graphics queue.
swap(alt_queue_family, queue_family);
device_info.queueCreateInfoCount = 2;
queue_info[0].queueFamilyIndex = alt_queue_family;
queue_info[0].queueCount = 1;
queue_info[0].pQueuePriorities = &prios[0];
queue_info[1].queueFamilyIndex = queue_family;
queue_info[1].queueCount = 1;
queue_info[1].pQueuePriorities = &prios[1];
}
else
{
static const float one = 1.0f;
queue_info[0].queueFamilyIndex = queue_family;
queue_info[0].queueCount = 1;
queue_info[0].pQueuePriorities = &one;
device_info.queueCreateInfoCount = 1;
}
// Should query for these, but no big deal for now.
device_info.ppEnabledExtensionNames = required_device_extensions;
device_info.enabledExtensionCount = num_required_device_extensions;
device_info.ppEnabledLayerNames = required_device_layers;
device_info.enabledLayerCount = num_required_device_layers;
device_info.pEnabledFeatures = required_features;
#ifdef VULKAN_DEBUG
static const char *device_layers[] = { "VK_LAYER_LUNARG_standard_validation" };
device_info.enabledLayerCount = 1;
device_info.ppEnabledLayerNames = device_layers;
#endif
if (vkCreateDevice(gpu, &device_info, nullptr, &device) != VK_SUCCESS)
return false;
vulkan_symbol_wrapper_load_core_device_symbols(device);
if (async_compute && same_queue_async)
{
vkGetDeviceQueue(device, queue_family, 0, &alt_queue);
vkGetDeviceQueue(device, queue_family, 1, &queue);
}
else if (async_compute && !same_queue_async)
{
vkGetDeviceQueue(device, alt_queue_family, 0, &alt_queue);
vkGetDeviceQueue(device, queue_family, 0, &queue);
}
else
{
vkGetDeviceQueue(device, queue_family, 0, &queue);
alt_queue = queue;
alt_queue_family = queue_family;
}
return true;
}
}
-123
View File
@@ -1,123 +0,0 @@
#ifndef VULKAN_HPP
#define VULKAN_HPP
#include "vulkan_symbol_wrapper.h"
#include <memory>
#include <stdexcept>
#define STRINGIFY(x) #x
#define V(x) \
do \
{ \
VkResult err = x; \
if (err != VK_SUCCESS && err != VK_INCOMPLETE) \
throw std::runtime_error("Vulkan call failed at " __FILE__ ":" STRINGIFY(__LINE__) ".\n"); \
} while (0)
namespace Vulkan
{
class VulkanContext
{
public:
VulkanContext();
VulkanContext(VkInstance instance, VkPhysicalDevice gpu, VkDevice device, VkQueue queue, uint32_t queue_family);
VulkanContext(VkInstance instance, VkPhysicalDevice gpu, VkSurfaceKHR surface,
const char **required_device_extensions, unsigned num_required_device_extensions,
const char **required_device_layers, unsigned num_required_device_layers,
const VkPhysicalDeviceFeatures *required_features);
VulkanContext(const VulkanContext &) = delete;
void operator=(const VulkanContext &) = delete;
static bool init_loader(PFN_vkGetInstanceProcAddr get_instance_proc_addr = nullptr);
~VulkanContext();
VkInstance get_instance() const
{
return instance;
}
VkPhysicalDevice get_gpu() const
{
return gpu;
}
VkDevice get_device() const
{
return device;
}
VkQueue get_queue() const
{
return queue;
}
VkQueue get_alt_queue() const
{
return alt_queue;
}
const VkPhysicalDeviceProperties &get_gpu_props() const
{
return gpu_props;
}
const VkPhysicalDeviceMemoryProperties &get_mem_props() const
{
return mem_props;
}
uint32_t get_queue_family() const
{
return queue_family;
}
uint32_t get_alt_queue_family() const
{
return alt_queue_family;
}
void release_instance()
{
owned_instance = false;
}
void release_device()
{
owned_device = false;
}
static const VkApplicationInfo &get_application_info();
private:
VkDevice device = VK_NULL_HANDLE;
VkInstance instance = VK_NULL_HANDLE;
VkPhysicalDevice gpu = VK_NULL_HANDLE;
VkPhysicalDeviceProperties gpu_props;
VkPhysicalDeviceMemoryProperties mem_props;
VkQueue queue = VK_NULL_HANDLE;
uint32_t queue_family = VK_QUEUE_FAMILY_IGNORED;
VkQueue alt_queue = VK_NULL_HANDLE;
uint32_t alt_queue_family = VK_QUEUE_FAMILY_IGNORED;
bool create_instance();
bool create_device(VkPhysicalDevice gpu, VkSurfaceKHR surface, const char **required_device_extensions,
unsigned num_required_device_extensions, const char **required_device_layers,
unsigned num_required_device_layers, const VkPhysicalDeviceFeatures *required_features);
bool owned_instance = false;
bool owned_device = false;
#ifdef VULKAN_DEBUG
VkDebugReportCallbackEXT debug_callback = VK_NULL_HANDLE;
#endif
void destroy();
};
}
#endif
@@ -1,797 +0,0 @@
/* This header is autogenerated by vulkan_loader_generator.py */
#include "vulkan_symbol_wrapper.h"
#include <cstdio>
PFN_vkCreateInstance vulkan_symbol_wrapper_vkCreateInstance;
PFN_vkEnumerateInstanceExtensionProperties vulkan_symbol_wrapper_vkEnumerateInstanceExtensionProperties;
PFN_vkEnumerateInstanceLayerProperties vulkan_symbol_wrapper_vkEnumerateInstanceLayerProperties;
PFN_vkDestroyInstance vulkan_symbol_wrapper_vkDestroyInstance;
PFN_vkEnumeratePhysicalDevices vulkan_symbol_wrapper_vkEnumeratePhysicalDevices;
PFN_vkGetPhysicalDeviceFeatures vulkan_symbol_wrapper_vkGetPhysicalDeviceFeatures;
PFN_vkGetPhysicalDeviceFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceFormatProperties;
PFN_vkGetPhysicalDeviceImageFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceImageFormatProperties;
PFN_vkGetPhysicalDeviceProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceProperties;
PFN_vkGetPhysicalDeviceQueueFamilyProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceQueueFamilyProperties;
PFN_vkGetPhysicalDeviceMemoryProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceMemoryProperties;
PFN_vkGetDeviceProcAddr vulkan_symbol_wrapper_vkGetDeviceProcAddr;
PFN_vkCreateDevice vulkan_symbol_wrapper_vkCreateDevice;
PFN_vkDestroyDevice vulkan_symbol_wrapper_vkDestroyDevice;
PFN_vkEnumerateDeviceExtensionProperties vulkan_symbol_wrapper_vkEnumerateDeviceExtensionProperties;
PFN_vkEnumerateDeviceLayerProperties vulkan_symbol_wrapper_vkEnumerateDeviceLayerProperties;
PFN_vkGetDeviceQueue vulkan_symbol_wrapper_vkGetDeviceQueue;
PFN_vkQueueSubmit vulkan_symbol_wrapper_vkQueueSubmit;
PFN_vkQueueWaitIdle vulkan_symbol_wrapper_vkQueueWaitIdle;
PFN_vkDeviceWaitIdle vulkan_symbol_wrapper_vkDeviceWaitIdle;
PFN_vkAllocateMemory vulkan_symbol_wrapper_vkAllocateMemory;
PFN_vkFreeMemory vulkan_symbol_wrapper_vkFreeMemory;
PFN_vkMapMemory vulkan_symbol_wrapper_vkMapMemory;
PFN_vkUnmapMemory vulkan_symbol_wrapper_vkUnmapMemory;
PFN_vkFlushMappedMemoryRanges vulkan_symbol_wrapper_vkFlushMappedMemoryRanges;
PFN_vkInvalidateMappedMemoryRanges vulkan_symbol_wrapper_vkInvalidateMappedMemoryRanges;
PFN_vkGetDeviceMemoryCommitment vulkan_symbol_wrapper_vkGetDeviceMemoryCommitment;
PFN_vkBindBufferMemory vulkan_symbol_wrapper_vkBindBufferMemory;
PFN_vkBindImageMemory vulkan_symbol_wrapper_vkBindImageMemory;
PFN_vkGetBufferMemoryRequirements vulkan_symbol_wrapper_vkGetBufferMemoryRequirements;
PFN_vkGetImageMemoryRequirements vulkan_symbol_wrapper_vkGetImageMemoryRequirements;
PFN_vkGetImageSparseMemoryRequirements vulkan_symbol_wrapper_vkGetImageSparseMemoryRequirements;
PFN_vkGetPhysicalDeviceSparseImageFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceSparseImageFormatProperties;
PFN_vkQueueBindSparse vulkan_symbol_wrapper_vkQueueBindSparse;
PFN_vkCreateFence vulkan_symbol_wrapper_vkCreateFence;
PFN_vkDestroyFence vulkan_symbol_wrapper_vkDestroyFence;
PFN_vkResetFences vulkan_symbol_wrapper_vkResetFences;
PFN_vkGetFenceStatus vulkan_symbol_wrapper_vkGetFenceStatus;
PFN_vkWaitForFences vulkan_symbol_wrapper_vkWaitForFences;
PFN_vkCreateSemaphore vulkan_symbol_wrapper_vkCreateSemaphore;
PFN_vkDestroySemaphore vulkan_symbol_wrapper_vkDestroySemaphore;
PFN_vkCreateEvent vulkan_symbol_wrapper_vkCreateEvent;
PFN_vkDestroyEvent vulkan_symbol_wrapper_vkDestroyEvent;
PFN_vkGetEventStatus vulkan_symbol_wrapper_vkGetEventStatus;
PFN_vkSetEvent vulkan_symbol_wrapper_vkSetEvent;
PFN_vkResetEvent vulkan_symbol_wrapper_vkResetEvent;
PFN_vkCreateQueryPool vulkan_symbol_wrapper_vkCreateQueryPool;
PFN_vkDestroyQueryPool vulkan_symbol_wrapper_vkDestroyQueryPool;
PFN_vkGetQueryPoolResults vulkan_symbol_wrapper_vkGetQueryPoolResults;
PFN_vkCreateBuffer vulkan_symbol_wrapper_vkCreateBuffer;
PFN_vkDestroyBuffer vulkan_symbol_wrapper_vkDestroyBuffer;
PFN_vkCreateBufferView vulkan_symbol_wrapper_vkCreateBufferView;
PFN_vkDestroyBufferView vulkan_symbol_wrapper_vkDestroyBufferView;
PFN_vkCreateImage vulkan_symbol_wrapper_vkCreateImage;
PFN_vkDestroyImage vulkan_symbol_wrapper_vkDestroyImage;
PFN_vkGetImageSubresourceLayout vulkan_symbol_wrapper_vkGetImageSubresourceLayout;
PFN_vkCreateImageView vulkan_symbol_wrapper_vkCreateImageView;
PFN_vkDestroyImageView vulkan_symbol_wrapper_vkDestroyImageView;
PFN_vkCreateShaderModule vulkan_symbol_wrapper_vkCreateShaderModule;
PFN_vkDestroyShaderModule vulkan_symbol_wrapper_vkDestroyShaderModule;
PFN_vkCreatePipelineCache vulkan_symbol_wrapper_vkCreatePipelineCache;
PFN_vkDestroyPipelineCache vulkan_symbol_wrapper_vkDestroyPipelineCache;
PFN_vkGetPipelineCacheData vulkan_symbol_wrapper_vkGetPipelineCacheData;
PFN_vkMergePipelineCaches vulkan_symbol_wrapper_vkMergePipelineCaches;
PFN_vkCreateGraphicsPipelines vulkan_symbol_wrapper_vkCreateGraphicsPipelines;
PFN_vkCreateComputePipelines vulkan_symbol_wrapper_vkCreateComputePipelines;
PFN_vkDestroyPipeline vulkan_symbol_wrapper_vkDestroyPipeline;
PFN_vkCreatePipelineLayout vulkan_symbol_wrapper_vkCreatePipelineLayout;
PFN_vkDestroyPipelineLayout vulkan_symbol_wrapper_vkDestroyPipelineLayout;
PFN_vkCreateSampler vulkan_symbol_wrapper_vkCreateSampler;
PFN_vkDestroySampler vulkan_symbol_wrapper_vkDestroySampler;
PFN_vkCreateDescriptorSetLayout vulkan_symbol_wrapper_vkCreateDescriptorSetLayout;
PFN_vkDestroyDescriptorSetLayout vulkan_symbol_wrapper_vkDestroyDescriptorSetLayout;
PFN_vkCreateDescriptorPool vulkan_symbol_wrapper_vkCreateDescriptorPool;
PFN_vkDestroyDescriptorPool vulkan_symbol_wrapper_vkDestroyDescriptorPool;
PFN_vkResetDescriptorPool vulkan_symbol_wrapper_vkResetDescriptorPool;
PFN_vkAllocateDescriptorSets vulkan_symbol_wrapper_vkAllocateDescriptorSets;
PFN_vkFreeDescriptorSets vulkan_symbol_wrapper_vkFreeDescriptorSets;
PFN_vkUpdateDescriptorSets vulkan_symbol_wrapper_vkUpdateDescriptorSets;
PFN_vkCreateFramebuffer vulkan_symbol_wrapper_vkCreateFramebuffer;
PFN_vkDestroyFramebuffer vulkan_symbol_wrapper_vkDestroyFramebuffer;
PFN_vkCreateRenderPass vulkan_symbol_wrapper_vkCreateRenderPass;
PFN_vkDestroyRenderPass vulkan_symbol_wrapper_vkDestroyRenderPass;
PFN_vkGetRenderAreaGranularity vulkan_symbol_wrapper_vkGetRenderAreaGranularity;
PFN_vkCreateCommandPool vulkan_symbol_wrapper_vkCreateCommandPool;
PFN_vkDestroyCommandPool vulkan_symbol_wrapper_vkDestroyCommandPool;
PFN_vkResetCommandPool vulkan_symbol_wrapper_vkResetCommandPool;
PFN_vkAllocateCommandBuffers vulkan_symbol_wrapper_vkAllocateCommandBuffers;
PFN_vkFreeCommandBuffers vulkan_symbol_wrapper_vkFreeCommandBuffers;
PFN_vkBeginCommandBuffer vulkan_symbol_wrapper_vkBeginCommandBuffer;
PFN_vkEndCommandBuffer vulkan_symbol_wrapper_vkEndCommandBuffer;
PFN_vkResetCommandBuffer vulkan_symbol_wrapper_vkResetCommandBuffer;
PFN_vkCmdBindPipeline vulkan_symbol_wrapper_vkCmdBindPipeline;
PFN_vkCmdSetViewport vulkan_symbol_wrapper_vkCmdSetViewport;
PFN_vkCmdSetScissor vulkan_symbol_wrapper_vkCmdSetScissor;
PFN_vkCmdSetLineWidth vulkan_symbol_wrapper_vkCmdSetLineWidth;
PFN_vkCmdSetDepthBias vulkan_symbol_wrapper_vkCmdSetDepthBias;
PFN_vkCmdSetBlendConstants vulkan_symbol_wrapper_vkCmdSetBlendConstants;
PFN_vkCmdSetDepthBounds vulkan_symbol_wrapper_vkCmdSetDepthBounds;
PFN_vkCmdSetStencilCompareMask vulkan_symbol_wrapper_vkCmdSetStencilCompareMask;
PFN_vkCmdSetStencilWriteMask vulkan_symbol_wrapper_vkCmdSetStencilWriteMask;
PFN_vkCmdSetStencilReference vulkan_symbol_wrapper_vkCmdSetStencilReference;
PFN_vkCmdBindDescriptorSets vulkan_symbol_wrapper_vkCmdBindDescriptorSets;
PFN_vkCmdBindIndexBuffer vulkan_symbol_wrapper_vkCmdBindIndexBuffer;
PFN_vkCmdBindVertexBuffers vulkan_symbol_wrapper_vkCmdBindVertexBuffers;
PFN_vkCmdDraw vulkan_symbol_wrapper_vkCmdDraw;
PFN_vkCmdDrawIndexed vulkan_symbol_wrapper_vkCmdDrawIndexed;
PFN_vkCmdDrawIndirect vulkan_symbol_wrapper_vkCmdDrawIndirect;
PFN_vkCmdDrawIndexedIndirect vulkan_symbol_wrapper_vkCmdDrawIndexedIndirect;
PFN_vkCmdDispatch vulkan_symbol_wrapper_vkCmdDispatch;
PFN_vkCmdDispatchIndirect vulkan_symbol_wrapper_vkCmdDispatchIndirect;
PFN_vkCmdCopyBuffer vulkan_symbol_wrapper_vkCmdCopyBuffer;
PFN_vkCmdCopyImage vulkan_symbol_wrapper_vkCmdCopyImage;
PFN_vkCmdBlitImage vulkan_symbol_wrapper_vkCmdBlitImage;
PFN_vkCmdCopyBufferToImage vulkan_symbol_wrapper_vkCmdCopyBufferToImage;
PFN_vkCmdCopyImageToBuffer vulkan_symbol_wrapper_vkCmdCopyImageToBuffer;
PFN_vkCmdUpdateBuffer vulkan_symbol_wrapper_vkCmdUpdateBuffer;
PFN_vkCmdFillBuffer vulkan_symbol_wrapper_vkCmdFillBuffer;
PFN_vkCmdClearColorImage vulkan_symbol_wrapper_vkCmdClearColorImage;
PFN_vkCmdClearDepthStencilImage vulkan_symbol_wrapper_vkCmdClearDepthStencilImage;
PFN_vkCmdClearAttachments vulkan_symbol_wrapper_vkCmdClearAttachments;
PFN_vkCmdResolveImage vulkan_symbol_wrapper_vkCmdResolveImage;
PFN_vkCmdSetEvent vulkan_symbol_wrapper_vkCmdSetEvent;
PFN_vkCmdResetEvent vulkan_symbol_wrapper_vkCmdResetEvent;
PFN_vkCmdWaitEvents vulkan_symbol_wrapper_vkCmdWaitEvents;
PFN_vkCmdPipelineBarrier vulkan_symbol_wrapper_vkCmdPipelineBarrier;
PFN_vkCmdBeginQuery vulkan_symbol_wrapper_vkCmdBeginQuery;
PFN_vkCmdEndQuery vulkan_symbol_wrapper_vkCmdEndQuery;
PFN_vkCmdResetQueryPool vulkan_symbol_wrapper_vkCmdResetQueryPool;
PFN_vkCmdWriteTimestamp vulkan_symbol_wrapper_vkCmdWriteTimestamp;
PFN_vkCmdCopyQueryPoolResults vulkan_symbol_wrapper_vkCmdCopyQueryPoolResults;
PFN_vkCmdPushConstants vulkan_symbol_wrapper_vkCmdPushConstants;
PFN_vkCmdBeginRenderPass vulkan_symbol_wrapper_vkCmdBeginRenderPass;
PFN_vkCmdNextSubpass vulkan_symbol_wrapper_vkCmdNextSubpass;
PFN_vkCmdEndRenderPass vulkan_symbol_wrapper_vkCmdEndRenderPass;
PFN_vkCmdExecuteCommands vulkan_symbol_wrapper_vkCmdExecuteCommands;
PFN_vkDestroySurfaceKHR vulkan_symbol_wrapper_vkDestroySurfaceKHR;
PFN_vkGetPhysicalDeviceSurfaceSupportKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceSupportKHR;
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceFormatsKHR;
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfacePresentModesKHR;
PFN_vkCreateSwapchainKHR vulkan_symbol_wrapper_vkCreateSwapchainKHR;
PFN_vkDestroySwapchainKHR vulkan_symbol_wrapper_vkDestroySwapchainKHR;
PFN_vkGetSwapchainImagesKHR vulkan_symbol_wrapper_vkGetSwapchainImagesKHR;
PFN_vkAcquireNextImageKHR vulkan_symbol_wrapper_vkAcquireNextImageKHR;
PFN_vkQueuePresentKHR vulkan_symbol_wrapper_vkQueuePresentKHR;
PFN_vkGetPhysicalDeviceDisplayPropertiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceDisplayPropertiesKHR;
PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceDisplayPlanePropertiesKHR;
PFN_vkGetDisplayPlaneSupportedDisplaysKHR vulkan_symbol_wrapper_vkGetDisplayPlaneSupportedDisplaysKHR;
PFN_vkGetDisplayModePropertiesKHR vulkan_symbol_wrapper_vkGetDisplayModePropertiesKHR;
PFN_vkCreateDisplayModeKHR vulkan_symbol_wrapper_vkCreateDisplayModeKHR;
PFN_vkGetDisplayPlaneCapabilitiesKHR vulkan_symbol_wrapper_vkGetDisplayPlaneCapabilitiesKHR;
PFN_vkCreateDisplayPlaneSurfaceKHR vulkan_symbol_wrapper_vkCreateDisplayPlaneSurfaceKHR;
PFN_vkCreateSharedSwapchainsKHR vulkan_symbol_wrapper_vkCreateSharedSwapchainsKHR;
PFN_vkCreateDebugReportCallbackEXT vulkan_symbol_wrapper_vkCreateDebugReportCallbackEXT;
PFN_vkDestroyDebugReportCallbackEXT vulkan_symbol_wrapper_vkDestroyDebugReportCallbackEXT;
PFN_vkDebugReportMessageEXT vulkan_symbol_wrapper_vkDebugReportMessageEXT;
#ifdef VULKAN_DEBUG
PFN_vkDebugMarkerSetObjectTagEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectTagEXT;
PFN_vkDebugMarkerSetObjectNameEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectNameEXT;
PFN_vkCmdDebugMarkerBeginEXT vulkan_symbol_wrapper_vkCmdDebugMarkerBeginEXT;
PFN_vkCmdDebugMarkerEndEXT vulkan_symbol_wrapper_vkCmdDebugMarkerEndEXT;
PFN_vkCmdDebugMarkerInsertEXT vulkan_symbol_wrapper_vkCmdDebugMarkerInsertEXT;
#endif
static PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
void vulkan_symbol_wrapper_init(PFN_vkGetInstanceProcAddr get_instance_proc_addr)
{
GetInstanceProcAddr = get_instance_proc_addr;
}
PFN_vkGetInstanceProcAddr vulkan_symbol_wrapper_instance_proc_addr(void)
{
return GetInstanceProcAddr;
}
VkBool32 vulkan_symbol_wrapper_load_instance_symbol(VkInstance instance, const char *name, PFN_vkVoidFunction *ppSymbol)
{
*ppSymbol = GetInstanceProcAddr(instance, name);
return *ppSymbol != NULL;
}
VkBool32 vulkan_symbol_wrapper_load_device_symbol(VkDevice device, const char *name, PFN_vkVoidFunction *ppSymbol)
{
*ppSymbol = vkGetDeviceProcAddr(device, name);
return *ppSymbol != NULL;
}
VkBool32 vulkan_symbol_wrapper_load_global_symbols(void)
{
printf("Load_global_symbols\n");
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(NULL, "vkCreateInstance", vkCreateInstance))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(NULL, "vkEnumerateInstanceExtensionProperties",
vkEnumerateInstanceExtensionProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(NULL, "vkEnumerateInstanceLayerProperties",
vkEnumerateInstanceLayerProperties))
return VK_FALSE;
printf("Load_global_symbols END\n");
return VK_TRUE;
}
VkBool32 vulkan_symbol_wrapper_load_core_symbols(VkInstance instance)
{
printf("Load_core_symbols\n");
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyInstance", vkDestroyInstance))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkEnumeratePhysicalDevices", vkEnumeratePhysicalDevices))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceFeatures",
vkGetPhysicalDeviceFeatures))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceFormatProperties",
vkGetPhysicalDeviceFormatProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceImageFormatProperties",
vkGetPhysicalDeviceImageFormatProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceProperties",
vkGetPhysicalDeviceProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceQueueFamilyProperties",
vkGetPhysicalDeviceQueueFamilyProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceMemoryProperties",
vkGetPhysicalDeviceMemoryProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetDeviceProcAddr", vkGetDeviceProcAddr))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateDevice", vkCreateDevice))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyDevice", vkDestroyDevice))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkEnumerateDeviceExtensionProperties",
vkEnumerateDeviceExtensionProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkEnumerateDeviceLayerProperties",
vkEnumerateDeviceLayerProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetDeviceQueue", vkGetDeviceQueue))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkQueueSubmit", vkQueueSubmit))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkQueueWaitIdle", vkQueueWaitIdle))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDeviceWaitIdle", vkDeviceWaitIdle))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkAllocateMemory", vkAllocateMemory))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkFreeMemory", vkFreeMemory))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkMapMemory", vkMapMemory))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkUnmapMemory", vkUnmapMemory))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkFlushMappedMemoryRanges", vkFlushMappedMemoryRanges))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkInvalidateMappedMemoryRanges",
vkInvalidateMappedMemoryRanges))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetDeviceMemoryCommitment",
vkGetDeviceMemoryCommitment))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkBindBufferMemory", vkBindBufferMemory))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkBindImageMemory", vkBindImageMemory))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetBufferMemoryRequirements",
vkGetBufferMemoryRequirements))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetImageMemoryRequirements",
vkGetImageMemoryRequirements))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetImageSparseMemoryRequirements",
vkGetImageSparseMemoryRequirements))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceSparseImageFormatProperties",
vkGetPhysicalDeviceSparseImageFormatProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkQueueBindSparse", vkQueueBindSparse))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateFence", vkCreateFence))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyFence", vkDestroyFence))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkResetFences", vkResetFences))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetFenceStatus", vkGetFenceStatus))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkWaitForFences", vkWaitForFences))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateSemaphore", vkCreateSemaphore))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroySemaphore", vkDestroySemaphore))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateEvent", vkCreateEvent))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyEvent", vkDestroyEvent))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetEventStatus", vkGetEventStatus))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkSetEvent", vkSetEvent))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkResetEvent", vkResetEvent))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateQueryPool", vkCreateQueryPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyQueryPool", vkDestroyQueryPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetQueryPoolResults", vkGetQueryPoolResults))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateBuffer", vkCreateBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyBuffer", vkDestroyBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateBufferView", vkCreateBufferView))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyBufferView", vkDestroyBufferView))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateImage", vkCreateImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyImage", vkDestroyImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetImageSubresourceLayout",
vkGetImageSubresourceLayout))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateImageView", vkCreateImageView))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyImageView", vkDestroyImageView))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateShaderModule", vkCreateShaderModule))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyShaderModule", vkDestroyShaderModule))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreatePipelineCache", vkCreatePipelineCache))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyPipelineCache", vkDestroyPipelineCache))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPipelineCacheData", vkGetPipelineCacheData))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkMergePipelineCaches", vkMergePipelineCaches))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateGraphicsPipelines", vkCreateGraphicsPipelines))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateComputePipelines", vkCreateComputePipelines))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyPipeline", vkDestroyPipeline))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreatePipelineLayout", vkCreatePipelineLayout))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyPipelineLayout", vkDestroyPipelineLayout))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateSampler", vkCreateSampler))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroySampler", vkDestroySampler))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateDescriptorSetLayout",
vkCreateDescriptorSetLayout))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyDescriptorSetLayout",
vkDestroyDescriptorSetLayout))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateDescriptorPool", vkCreateDescriptorPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyDescriptorPool", vkDestroyDescriptorPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkResetDescriptorPool", vkResetDescriptorPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkAllocateDescriptorSets", vkAllocateDescriptorSets))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkFreeDescriptorSets", vkFreeDescriptorSets))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkUpdateDescriptorSets", vkUpdateDescriptorSets))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateFramebuffer", vkCreateFramebuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyFramebuffer", vkDestroyFramebuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateRenderPass", vkCreateRenderPass))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyRenderPass", vkDestroyRenderPass))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetRenderAreaGranularity", vkGetRenderAreaGranularity))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateCommandPool", vkCreateCommandPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyCommandPool", vkDestroyCommandPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkResetCommandPool", vkResetCommandPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkAllocateCommandBuffers", vkAllocateCommandBuffers))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkFreeCommandBuffers", vkFreeCommandBuffers))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkBeginCommandBuffer", vkBeginCommandBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkEndCommandBuffer", vkEndCommandBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkResetCommandBuffer", vkResetCommandBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdBindPipeline", vkCmdBindPipeline))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdSetViewport", vkCmdSetViewport))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdSetScissor", vkCmdSetScissor))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdSetLineWidth", vkCmdSetLineWidth))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdSetDepthBias", vkCmdSetDepthBias))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdSetBlendConstants", vkCmdSetBlendConstants))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdSetDepthBounds", vkCmdSetDepthBounds))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdSetStencilCompareMask", vkCmdSetStencilCompareMask))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdSetStencilWriteMask", vkCmdSetStencilWriteMask))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdSetStencilReference", vkCmdSetStencilReference))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdBindDescriptorSets", vkCmdBindDescriptorSets))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdBindIndexBuffer", vkCmdBindIndexBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdBindVertexBuffers", vkCmdBindVertexBuffers))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdDraw", vkCmdDraw))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdDrawIndexed", vkCmdDrawIndexed))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdDrawIndirect", vkCmdDrawIndirect))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdDrawIndexedIndirect", vkCmdDrawIndexedIndirect))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdDispatch", vkCmdDispatch))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdDispatchIndirect", vkCmdDispatchIndirect))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdCopyBuffer", vkCmdCopyBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdCopyImage", vkCmdCopyImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdBlitImage", vkCmdBlitImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdCopyBufferToImage", vkCmdCopyBufferToImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdCopyImageToBuffer", vkCmdCopyImageToBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdUpdateBuffer", vkCmdUpdateBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdFillBuffer", vkCmdFillBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdClearColorImage", vkCmdClearColorImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdClearDepthStencilImage",
vkCmdClearDepthStencilImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdClearAttachments", vkCmdClearAttachments))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdResolveImage", vkCmdResolveImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdSetEvent", vkCmdSetEvent))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdResetEvent", vkCmdResetEvent))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdWaitEvents", vkCmdWaitEvents))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdPipelineBarrier", vkCmdPipelineBarrier))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdBeginQuery", vkCmdBeginQuery))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdEndQuery", vkCmdEndQuery))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdResetQueryPool", vkCmdResetQueryPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdWriteTimestamp", vkCmdWriteTimestamp))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdCopyQueryPoolResults", vkCmdCopyQueryPoolResults))
{
#if 0
return VK_FALSE;
#endif
}
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdPushConstants", vkCmdPushConstants))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdBeginRenderPass", vkCmdBeginRenderPass))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdNextSubpass", vkCmdNextSubpass))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdEndRenderPass", vkCmdEndRenderPass))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCmdExecuteCommands", vkCmdExecuteCommands))
return VK_FALSE;
printf("Load_core_symbols END\n");
return VK_TRUE;
}
VkBool32 vulkan_symbol_wrapper_load_core_instance_symbols(VkInstance instance)
{
printf("Load_core_instance_symbols\n");
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkDestroyInstance", vkDestroyInstance))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkEnumeratePhysicalDevices", vkEnumeratePhysicalDevices))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceFeatures",
vkGetPhysicalDeviceFeatures))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceFormatProperties",
vkGetPhysicalDeviceFormatProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceImageFormatProperties",
vkGetPhysicalDeviceImageFormatProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceProperties",
vkGetPhysicalDeviceProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceQueueFamilyProperties",
vkGetPhysicalDeviceQueueFamilyProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceMemoryProperties",
vkGetPhysicalDeviceMemoryProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetDeviceProcAddr", vkGetDeviceProcAddr))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkCreateDevice", vkCreateDevice))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkEnumerateDeviceExtensionProperties",
vkEnumerateDeviceExtensionProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkEnumerateDeviceLayerProperties",
vkEnumerateDeviceLayerProperties))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, "vkGetPhysicalDeviceSparseImageFormatProperties",
vkGetPhysicalDeviceSparseImageFormatProperties))
return VK_FALSE;
printf("Load_core_instance_symbols END\n");
return VK_TRUE;
}
VkBool32 vulkan_symbol_wrapper_load_core_device_symbols(VkDevice device)
{
printf("Load_core_device_symbols\n");
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyDevice", vkDestroyDevice))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkGetDeviceQueue", vkGetDeviceQueue))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkQueueSubmit", vkQueueSubmit))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkQueueWaitIdle", vkQueueWaitIdle))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDeviceWaitIdle", vkDeviceWaitIdle))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkAllocateMemory", vkAllocateMemory))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkFreeMemory", vkFreeMemory))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkMapMemory", vkMapMemory))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkUnmapMemory", vkUnmapMemory))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkFlushMappedMemoryRanges", vkFlushMappedMemoryRanges))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkInvalidateMappedMemoryRanges",
vkInvalidateMappedMemoryRanges))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkGetDeviceMemoryCommitment", vkGetDeviceMemoryCommitment))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkBindBufferMemory", vkBindBufferMemory))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkBindImageMemory", vkBindImageMemory))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkGetBufferMemoryRequirements",
vkGetBufferMemoryRequirements))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkGetImageMemoryRequirements", vkGetImageMemoryRequirements))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkGetImageSparseMemoryRequirements",
vkGetImageSparseMemoryRequirements))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkQueueBindSparse", vkQueueBindSparse))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateFence", vkCreateFence))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyFence", vkDestroyFence))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkResetFences", vkResetFences))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkGetFenceStatus", vkGetFenceStatus))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkWaitForFences", vkWaitForFences))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateSemaphore", vkCreateSemaphore))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroySemaphore", vkDestroySemaphore))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateEvent", vkCreateEvent))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyEvent", vkDestroyEvent))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkGetEventStatus", vkGetEventStatus))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkSetEvent", vkSetEvent))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkResetEvent", vkResetEvent))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateQueryPool", vkCreateQueryPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyQueryPool", vkDestroyQueryPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkGetQueryPoolResults", vkGetQueryPoolResults))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateBuffer", vkCreateBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyBuffer", vkDestroyBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateBufferView", vkCreateBufferView))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyBufferView", vkDestroyBufferView))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateImage", vkCreateImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyImage", vkDestroyImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkGetImageSubresourceLayout", vkGetImageSubresourceLayout))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateImageView", vkCreateImageView))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyImageView", vkDestroyImageView))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateShaderModule", vkCreateShaderModule))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyShaderModule", vkDestroyShaderModule))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreatePipelineCache", vkCreatePipelineCache))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyPipelineCache", vkDestroyPipelineCache))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkGetPipelineCacheData", vkGetPipelineCacheData))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkMergePipelineCaches", vkMergePipelineCaches))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateGraphicsPipelines", vkCreateGraphicsPipelines))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateComputePipelines", vkCreateComputePipelines))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyPipeline", vkDestroyPipeline))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreatePipelineLayout", vkCreatePipelineLayout))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyPipelineLayout", vkDestroyPipelineLayout))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateSampler", vkCreateSampler))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroySampler", vkDestroySampler))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateDescriptorSetLayout", vkCreateDescriptorSetLayout))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyDescriptorSetLayout", vkDestroyDescriptorSetLayout))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateDescriptorPool", vkCreateDescriptorPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyDescriptorPool", vkDestroyDescriptorPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkResetDescriptorPool", vkResetDescriptorPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkAllocateDescriptorSets", vkAllocateDescriptorSets))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkFreeDescriptorSets", vkFreeDescriptorSets))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkUpdateDescriptorSets", vkUpdateDescriptorSets))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateFramebuffer", vkCreateFramebuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyFramebuffer", vkDestroyFramebuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateRenderPass", vkCreateRenderPass))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyRenderPass", vkDestroyRenderPass))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkGetRenderAreaGranularity", vkGetRenderAreaGranularity))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCreateCommandPool", vkCreateCommandPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkDestroyCommandPool", vkDestroyCommandPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkResetCommandPool", vkResetCommandPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkAllocateCommandBuffers", vkAllocateCommandBuffers))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkFreeCommandBuffers", vkFreeCommandBuffers))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkBeginCommandBuffer", vkBeginCommandBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkEndCommandBuffer", vkEndCommandBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkResetCommandBuffer", vkResetCommandBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdBindPipeline", vkCmdBindPipeline))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdSetViewport", vkCmdSetViewport))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdSetScissor", vkCmdSetScissor))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdSetLineWidth", vkCmdSetLineWidth))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdSetDepthBias", vkCmdSetDepthBias))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdSetBlendConstants", vkCmdSetBlendConstants))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdSetDepthBounds", vkCmdSetDepthBounds))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdSetStencilCompareMask", vkCmdSetStencilCompareMask))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdSetStencilWriteMask", vkCmdSetStencilWriteMask))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdSetStencilReference", vkCmdSetStencilReference))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdBindDescriptorSets", vkCmdBindDescriptorSets))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdBindIndexBuffer", vkCmdBindIndexBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdBindVertexBuffers", vkCmdBindVertexBuffers))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdDraw", vkCmdDraw))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdDrawIndexed", vkCmdDrawIndexed))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdDrawIndirect", vkCmdDrawIndirect))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdDrawIndexedIndirect", vkCmdDrawIndexedIndirect))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdDispatch", vkCmdDispatch))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdDispatchIndirect", vkCmdDispatchIndirect))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdCopyBuffer", vkCmdCopyBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdCopyImage", vkCmdCopyImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdBlitImage", vkCmdBlitImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdCopyBufferToImage", vkCmdCopyBufferToImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdCopyImageToBuffer", vkCmdCopyImageToBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdUpdateBuffer", vkCmdUpdateBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdFillBuffer", vkCmdFillBuffer))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdClearColorImage", vkCmdClearColorImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdClearDepthStencilImage", vkCmdClearDepthStencilImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdClearAttachments", vkCmdClearAttachments))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdResolveImage", vkCmdResolveImage))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdSetEvent", vkCmdSetEvent))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdResetEvent", vkCmdResetEvent))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdWaitEvents", vkCmdWaitEvents))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdPipelineBarrier", vkCmdPipelineBarrier))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdBeginQuery", vkCmdBeginQuery))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdEndQuery", vkCmdEndQuery))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdResetQueryPool", vkCmdResetQueryPool))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdWriteTimestamp", vkCmdWriteTimestamp))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdCopyQueryPoolResults", vkCmdCopyQueryPoolResults))
{
// return VK_FALSE;
}
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdPushConstants", vkCmdPushConstants))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdBeginRenderPass", vkCmdBeginRenderPass))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdNextSubpass", vkCmdNextSubpass))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdEndRenderPass", vkCmdEndRenderPass))
return VK_FALSE;
if (!VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, "vkCmdExecuteCommands", vkCmdExecuteCommands))
return VK_FALSE;
printf("Load_core_device_symbols END\n");
return VK_TRUE;
}
@@ -1,358 +0,0 @@
/* This header is autogenerated by vulkan_loader_generator.py */
#ifndef VULKAN_SYMBOL_WRAPPER_H
#define VULKAN_SYMBOL_WRAPPER_H
#define VK_NO_PROTOTYPES
#include <vulkan/vulkan.h>
#ifdef __cplusplus
extern "C" {
#endif
extern PFN_vkCreateInstance vulkan_symbol_wrapper_vkCreateInstance;
#define vkCreateInstance vulkan_symbol_wrapper_vkCreateInstance
extern PFN_vkEnumerateInstanceExtensionProperties vulkan_symbol_wrapper_vkEnumerateInstanceExtensionProperties;
#define vkEnumerateInstanceExtensionProperties vulkan_symbol_wrapper_vkEnumerateInstanceExtensionProperties
extern PFN_vkEnumerateInstanceLayerProperties vulkan_symbol_wrapper_vkEnumerateInstanceLayerProperties;
#define vkEnumerateInstanceLayerProperties vulkan_symbol_wrapper_vkEnumerateInstanceLayerProperties
extern PFN_vkDestroyInstance vulkan_symbol_wrapper_vkDestroyInstance;
#define vkDestroyInstance vulkan_symbol_wrapper_vkDestroyInstance
extern PFN_vkEnumeratePhysicalDevices vulkan_symbol_wrapper_vkEnumeratePhysicalDevices;
#define vkEnumeratePhysicalDevices vulkan_symbol_wrapper_vkEnumeratePhysicalDevices
extern PFN_vkGetPhysicalDeviceFeatures vulkan_symbol_wrapper_vkGetPhysicalDeviceFeatures;
#define vkGetPhysicalDeviceFeatures vulkan_symbol_wrapper_vkGetPhysicalDeviceFeatures
extern PFN_vkGetPhysicalDeviceFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceFormatProperties;
#define vkGetPhysicalDeviceFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceFormatProperties
extern PFN_vkGetPhysicalDeviceImageFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceImageFormatProperties;
#define vkGetPhysicalDeviceImageFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceImageFormatProperties
extern PFN_vkGetPhysicalDeviceProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceProperties;
#define vkGetPhysicalDeviceProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceProperties
extern PFN_vkGetPhysicalDeviceQueueFamilyProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceQueueFamilyProperties;
#define vkGetPhysicalDeviceQueueFamilyProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceQueueFamilyProperties
extern PFN_vkGetPhysicalDeviceMemoryProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceMemoryProperties;
#define vkGetPhysicalDeviceMemoryProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceMemoryProperties
extern PFN_vkGetDeviceProcAddr vulkan_symbol_wrapper_vkGetDeviceProcAddr;
#define vkGetDeviceProcAddr vulkan_symbol_wrapper_vkGetDeviceProcAddr
extern PFN_vkCreateDevice vulkan_symbol_wrapper_vkCreateDevice;
#define vkCreateDevice vulkan_symbol_wrapper_vkCreateDevice
extern PFN_vkDestroyDevice vulkan_symbol_wrapper_vkDestroyDevice;
#define vkDestroyDevice vulkan_symbol_wrapper_vkDestroyDevice
extern PFN_vkEnumerateDeviceExtensionProperties vulkan_symbol_wrapper_vkEnumerateDeviceExtensionProperties;
#define vkEnumerateDeviceExtensionProperties vulkan_symbol_wrapper_vkEnumerateDeviceExtensionProperties
extern PFN_vkEnumerateDeviceLayerProperties vulkan_symbol_wrapper_vkEnumerateDeviceLayerProperties;
#define vkEnumerateDeviceLayerProperties vulkan_symbol_wrapper_vkEnumerateDeviceLayerProperties
extern PFN_vkGetDeviceQueue vulkan_symbol_wrapper_vkGetDeviceQueue;
#define vkGetDeviceQueue vulkan_symbol_wrapper_vkGetDeviceQueue
extern PFN_vkQueueSubmit vulkan_symbol_wrapper_vkQueueSubmit;
#define vkQueueSubmit vulkan_symbol_wrapper_vkQueueSubmit
extern PFN_vkQueueWaitIdle vulkan_symbol_wrapper_vkQueueWaitIdle;
#define vkQueueWaitIdle vulkan_symbol_wrapper_vkQueueWaitIdle
extern PFN_vkDeviceWaitIdle vulkan_symbol_wrapper_vkDeviceWaitIdle;
#define vkDeviceWaitIdle vulkan_symbol_wrapper_vkDeviceWaitIdle
extern PFN_vkAllocateMemory vulkan_symbol_wrapper_vkAllocateMemory;
#define vkAllocateMemory vulkan_symbol_wrapper_vkAllocateMemory
extern PFN_vkFreeMemory vulkan_symbol_wrapper_vkFreeMemory;
#define vkFreeMemory vulkan_symbol_wrapper_vkFreeMemory
extern PFN_vkMapMemory vulkan_symbol_wrapper_vkMapMemory;
#define vkMapMemory vulkan_symbol_wrapper_vkMapMemory
extern PFN_vkUnmapMemory vulkan_symbol_wrapper_vkUnmapMemory;
#define vkUnmapMemory vulkan_symbol_wrapper_vkUnmapMemory
extern PFN_vkFlushMappedMemoryRanges vulkan_symbol_wrapper_vkFlushMappedMemoryRanges;
#define vkFlushMappedMemoryRanges vulkan_symbol_wrapper_vkFlushMappedMemoryRanges
extern PFN_vkInvalidateMappedMemoryRanges vulkan_symbol_wrapper_vkInvalidateMappedMemoryRanges;
#define vkInvalidateMappedMemoryRanges vulkan_symbol_wrapper_vkInvalidateMappedMemoryRanges
extern PFN_vkGetDeviceMemoryCommitment vulkan_symbol_wrapper_vkGetDeviceMemoryCommitment;
#define vkGetDeviceMemoryCommitment vulkan_symbol_wrapper_vkGetDeviceMemoryCommitment
extern PFN_vkBindBufferMemory vulkan_symbol_wrapper_vkBindBufferMemory;
#define vkBindBufferMemory vulkan_symbol_wrapper_vkBindBufferMemory
extern PFN_vkBindImageMemory vulkan_symbol_wrapper_vkBindImageMemory;
#define vkBindImageMemory vulkan_symbol_wrapper_vkBindImageMemory
extern PFN_vkGetBufferMemoryRequirements vulkan_symbol_wrapper_vkGetBufferMemoryRequirements;
#define vkGetBufferMemoryRequirements vulkan_symbol_wrapper_vkGetBufferMemoryRequirements
extern PFN_vkGetImageMemoryRequirements vulkan_symbol_wrapper_vkGetImageMemoryRequirements;
#define vkGetImageMemoryRequirements vulkan_symbol_wrapper_vkGetImageMemoryRequirements
extern PFN_vkGetImageSparseMemoryRequirements vulkan_symbol_wrapper_vkGetImageSparseMemoryRequirements;
#define vkGetImageSparseMemoryRequirements vulkan_symbol_wrapper_vkGetImageSparseMemoryRequirements
extern PFN_vkGetPhysicalDeviceSparseImageFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceSparseImageFormatProperties;
#define vkGetPhysicalDeviceSparseImageFormatProperties vulkan_symbol_wrapper_vkGetPhysicalDeviceSparseImageFormatProperties
extern PFN_vkQueueBindSparse vulkan_symbol_wrapper_vkQueueBindSparse;
#define vkQueueBindSparse vulkan_symbol_wrapper_vkQueueBindSparse
extern PFN_vkCreateFence vulkan_symbol_wrapper_vkCreateFence;
#define vkCreateFence vulkan_symbol_wrapper_vkCreateFence
extern PFN_vkDestroyFence vulkan_symbol_wrapper_vkDestroyFence;
#define vkDestroyFence vulkan_symbol_wrapper_vkDestroyFence
extern PFN_vkResetFences vulkan_symbol_wrapper_vkResetFences;
#define vkResetFences vulkan_symbol_wrapper_vkResetFences
extern PFN_vkGetFenceStatus vulkan_symbol_wrapper_vkGetFenceStatus;
#define vkGetFenceStatus vulkan_symbol_wrapper_vkGetFenceStatus
extern PFN_vkWaitForFences vulkan_symbol_wrapper_vkWaitForFences;
#define vkWaitForFences vulkan_symbol_wrapper_vkWaitForFences
extern PFN_vkCreateSemaphore vulkan_symbol_wrapper_vkCreateSemaphore;
#define vkCreateSemaphore vulkan_symbol_wrapper_vkCreateSemaphore
extern PFN_vkDestroySemaphore vulkan_symbol_wrapper_vkDestroySemaphore;
#define vkDestroySemaphore vulkan_symbol_wrapper_vkDestroySemaphore
extern PFN_vkCreateEvent vulkan_symbol_wrapper_vkCreateEvent;
#define vkCreateEvent vulkan_symbol_wrapper_vkCreateEvent
extern PFN_vkDestroyEvent vulkan_symbol_wrapper_vkDestroyEvent;
#define vkDestroyEvent vulkan_symbol_wrapper_vkDestroyEvent
extern PFN_vkGetEventStatus vulkan_symbol_wrapper_vkGetEventStatus;
#define vkGetEventStatus vulkan_symbol_wrapper_vkGetEventStatus
extern PFN_vkSetEvent vulkan_symbol_wrapper_vkSetEvent;
#define vkSetEvent vulkan_symbol_wrapper_vkSetEvent
extern PFN_vkResetEvent vulkan_symbol_wrapper_vkResetEvent;
#define vkResetEvent vulkan_symbol_wrapper_vkResetEvent
extern PFN_vkCreateQueryPool vulkan_symbol_wrapper_vkCreateQueryPool;
#define vkCreateQueryPool vulkan_symbol_wrapper_vkCreateQueryPool
extern PFN_vkDestroyQueryPool vulkan_symbol_wrapper_vkDestroyQueryPool;
#define vkDestroyQueryPool vulkan_symbol_wrapper_vkDestroyQueryPool
extern PFN_vkGetQueryPoolResults vulkan_symbol_wrapper_vkGetQueryPoolResults;
#define vkGetQueryPoolResults vulkan_symbol_wrapper_vkGetQueryPoolResults
extern PFN_vkCreateBuffer vulkan_symbol_wrapper_vkCreateBuffer;
#define vkCreateBuffer vulkan_symbol_wrapper_vkCreateBuffer
extern PFN_vkDestroyBuffer vulkan_symbol_wrapper_vkDestroyBuffer;
#define vkDestroyBuffer vulkan_symbol_wrapper_vkDestroyBuffer
extern PFN_vkCreateBufferView vulkan_symbol_wrapper_vkCreateBufferView;
#define vkCreateBufferView vulkan_symbol_wrapper_vkCreateBufferView
extern PFN_vkDestroyBufferView vulkan_symbol_wrapper_vkDestroyBufferView;
#define vkDestroyBufferView vulkan_symbol_wrapper_vkDestroyBufferView
extern PFN_vkCreateImage vulkan_symbol_wrapper_vkCreateImage;
#define vkCreateImage vulkan_symbol_wrapper_vkCreateImage
extern PFN_vkDestroyImage vulkan_symbol_wrapper_vkDestroyImage;
#define vkDestroyImage vulkan_symbol_wrapper_vkDestroyImage
extern PFN_vkGetImageSubresourceLayout vulkan_symbol_wrapper_vkGetImageSubresourceLayout;
#define vkGetImageSubresourceLayout vulkan_symbol_wrapper_vkGetImageSubresourceLayout
extern PFN_vkCreateImageView vulkan_symbol_wrapper_vkCreateImageView;
#define vkCreateImageView vulkan_symbol_wrapper_vkCreateImageView
extern PFN_vkDestroyImageView vulkan_symbol_wrapper_vkDestroyImageView;
#define vkDestroyImageView vulkan_symbol_wrapper_vkDestroyImageView
extern PFN_vkCreateShaderModule vulkan_symbol_wrapper_vkCreateShaderModule;
#define vkCreateShaderModule vulkan_symbol_wrapper_vkCreateShaderModule
extern PFN_vkDestroyShaderModule vulkan_symbol_wrapper_vkDestroyShaderModule;
#define vkDestroyShaderModule vulkan_symbol_wrapper_vkDestroyShaderModule
extern PFN_vkCreatePipelineCache vulkan_symbol_wrapper_vkCreatePipelineCache;
#define vkCreatePipelineCache vulkan_symbol_wrapper_vkCreatePipelineCache
extern PFN_vkDestroyPipelineCache vulkan_symbol_wrapper_vkDestroyPipelineCache;
#define vkDestroyPipelineCache vulkan_symbol_wrapper_vkDestroyPipelineCache
extern PFN_vkGetPipelineCacheData vulkan_symbol_wrapper_vkGetPipelineCacheData;
#define vkGetPipelineCacheData vulkan_symbol_wrapper_vkGetPipelineCacheData
extern PFN_vkMergePipelineCaches vulkan_symbol_wrapper_vkMergePipelineCaches;
#define vkMergePipelineCaches vulkan_symbol_wrapper_vkMergePipelineCaches
extern PFN_vkCreateGraphicsPipelines vulkan_symbol_wrapper_vkCreateGraphicsPipelines;
#define vkCreateGraphicsPipelines vulkan_symbol_wrapper_vkCreateGraphicsPipelines
extern PFN_vkCreateComputePipelines vulkan_symbol_wrapper_vkCreateComputePipelines;
#define vkCreateComputePipelines vulkan_symbol_wrapper_vkCreateComputePipelines
extern PFN_vkDestroyPipeline vulkan_symbol_wrapper_vkDestroyPipeline;
#define vkDestroyPipeline vulkan_symbol_wrapper_vkDestroyPipeline
extern PFN_vkCreatePipelineLayout vulkan_symbol_wrapper_vkCreatePipelineLayout;
#define vkCreatePipelineLayout vulkan_symbol_wrapper_vkCreatePipelineLayout
extern PFN_vkDestroyPipelineLayout vulkan_symbol_wrapper_vkDestroyPipelineLayout;
#define vkDestroyPipelineLayout vulkan_symbol_wrapper_vkDestroyPipelineLayout
extern PFN_vkCreateSampler vulkan_symbol_wrapper_vkCreateSampler;
#define vkCreateSampler vulkan_symbol_wrapper_vkCreateSampler
extern PFN_vkDestroySampler vulkan_symbol_wrapper_vkDestroySampler;
#define vkDestroySampler vulkan_symbol_wrapper_vkDestroySampler
extern PFN_vkCreateDescriptorSetLayout vulkan_symbol_wrapper_vkCreateDescriptorSetLayout;
#define vkCreateDescriptorSetLayout vulkan_symbol_wrapper_vkCreateDescriptorSetLayout
extern PFN_vkDestroyDescriptorSetLayout vulkan_symbol_wrapper_vkDestroyDescriptorSetLayout;
#define vkDestroyDescriptorSetLayout vulkan_symbol_wrapper_vkDestroyDescriptorSetLayout
extern PFN_vkCreateDescriptorPool vulkan_symbol_wrapper_vkCreateDescriptorPool;
#define vkCreateDescriptorPool vulkan_symbol_wrapper_vkCreateDescriptorPool
extern PFN_vkDestroyDescriptorPool vulkan_symbol_wrapper_vkDestroyDescriptorPool;
#define vkDestroyDescriptorPool vulkan_symbol_wrapper_vkDestroyDescriptorPool
extern PFN_vkResetDescriptorPool vulkan_symbol_wrapper_vkResetDescriptorPool;
#define vkResetDescriptorPool vulkan_symbol_wrapper_vkResetDescriptorPool
extern PFN_vkAllocateDescriptorSets vulkan_symbol_wrapper_vkAllocateDescriptorSets;
#define vkAllocateDescriptorSets vulkan_symbol_wrapper_vkAllocateDescriptorSets
extern PFN_vkFreeDescriptorSets vulkan_symbol_wrapper_vkFreeDescriptorSets;
#define vkFreeDescriptorSets vulkan_symbol_wrapper_vkFreeDescriptorSets
extern PFN_vkUpdateDescriptorSets vulkan_symbol_wrapper_vkUpdateDescriptorSets;
#define vkUpdateDescriptorSets vulkan_symbol_wrapper_vkUpdateDescriptorSets
extern PFN_vkCreateFramebuffer vulkan_symbol_wrapper_vkCreateFramebuffer;
#define vkCreateFramebuffer vulkan_symbol_wrapper_vkCreateFramebuffer
extern PFN_vkDestroyFramebuffer vulkan_symbol_wrapper_vkDestroyFramebuffer;
#define vkDestroyFramebuffer vulkan_symbol_wrapper_vkDestroyFramebuffer
extern PFN_vkCreateRenderPass vulkan_symbol_wrapper_vkCreateRenderPass;
#define vkCreateRenderPass vulkan_symbol_wrapper_vkCreateRenderPass
extern PFN_vkDestroyRenderPass vulkan_symbol_wrapper_vkDestroyRenderPass;
#define vkDestroyRenderPass vulkan_symbol_wrapper_vkDestroyRenderPass
extern PFN_vkGetRenderAreaGranularity vulkan_symbol_wrapper_vkGetRenderAreaGranularity;
#define vkGetRenderAreaGranularity vulkan_symbol_wrapper_vkGetRenderAreaGranularity
extern PFN_vkCreateCommandPool vulkan_symbol_wrapper_vkCreateCommandPool;
#define vkCreateCommandPool vulkan_symbol_wrapper_vkCreateCommandPool
extern PFN_vkDestroyCommandPool vulkan_symbol_wrapper_vkDestroyCommandPool;
#define vkDestroyCommandPool vulkan_symbol_wrapper_vkDestroyCommandPool
extern PFN_vkResetCommandPool vulkan_symbol_wrapper_vkResetCommandPool;
#define vkResetCommandPool vulkan_symbol_wrapper_vkResetCommandPool
extern PFN_vkAllocateCommandBuffers vulkan_symbol_wrapper_vkAllocateCommandBuffers;
#define vkAllocateCommandBuffers vulkan_symbol_wrapper_vkAllocateCommandBuffers
extern PFN_vkFreeCommandBuffers vulkan_symbol_wrapper_vkFreeCommandBuffers;
#define vkFreeCommandBuffers vulkan_symbol_wrapper_vkFreeCommandBuffers
extern PFN_vkBeginCommandBuffer vulkan_symbol_wrapper_vkBeginCommandBuffer;
#define vkBeginCommandBuffer vulkan_symbol_wrapper_vkBeginCommandBuffer
extern PFN_vkEndCommandBuffer vulkan_symbol_wrapper_vkEndCommandBuffer;
#define vkEndCommandBuffer vulkan_symbol_wrapper_vkEndCommandBuffer
extern PFN_vkResetCommandBuffer vulkan_symbol_wrapper_vkResetCommandBuffer;
#define vkResetCommandBuffer vulkan_symbol_wrapper_vkResetCommandBuffer
extern PFN_vkCmdBindPipeline vulkan_symbol_wrapper_vkCmdBindPipeline;
#define vkCmdBindPipeline vulkan_symbol_wrapper_vkCmdBindPipeline
extern PFN_vkCmdSetViewport vulkan_symbol_wrapper_vkCmdSetViewport;
#define vkCmdSetViewport vulkan_symbol_wrapper_vkCmdSetViewport
extern PFN_vkCmdSetScissor vulkan_symbol_wrapper_vkCmdSetScissor;
#define vkCmdSetScissor vulkan_symbol_wrapper_vkCmdSetScissor
extern PFN_vkCmdSetLineWidth vulkan_symbol_wrapper_vkCmdSetLineWidth;
#define vkCmdSetLineWidth vulkan_symbol_wrapper_vkCmdSetLineWidth
extern PFN_vkCmdSetDepthBias vulkan_symbol_wrapper_vkCmdSetDepthBias;
#define vkCmdSetDepthBias vulkan_symbol_wrapper_vkCmdSetDepthBias
extern PFN_vkCmdSetBlendConstants vulkan_symbol_wrapper_vkCmdSetBlendConstants;
#define vkCmdSetBlendConstants vulkan_symbol_wrapper_vkCmdSetBlendConstants
extern PFN_vkCmdSetDepthBounds vulkan_symbol_wrapper_vkCmdSetDepthBounds;
#define vkCmdSetDepthBounds vulkan_symbol_wrapper_vkCmdSetDepthBounds
extern PFN_vkCmdSetStencilCompareMask vulkan_symbol_wrapper_vkCmdSetStencilCompareMask;
#define vkCmdSetStencilCompareMask vulkan_symbol_wrapper_vkCmdSetStencilCompareMask
extern PFN_vkCmdSetStencilWriteMask vulkan_symbol_wrapper_vkCmdSetStencilWriteMask;
#define vkCmdSetStencilWriteMask vulkan_symbol_wrapper_vkCmdSetStencilWriteMask
extern PFN_vkCmdSetStencilReference vulkan_symbol_wrapper_vkCmdSetStencilReference;
#define vkCmdSetStencilReference vulkan_symbol_wrapper_vkCmdSetStencilReference
extern PFN_vkCmdBindDescriptorSets vulkan_symbol_wrapper_vkCmdBindDescriptorSets;
#define vkCmdBindDescriptorSets vulkan_symbol_wrapper_vkCmdBindDescriptorSets
extern PFN_vkCmdBindIndexBuffer vulkan_symbol_wrapper_vkCmdBindIndexBuffer;
#define vkCmdBindIndexBuffer vulkan_symbol_wrapper_vkCmdBindIndexBuffer
extern PFN_vkCmdBindVertexBuffers vulkan_symbol_wrapper_vkCmdBindVertexBuffers;
#define vkCmdBindVertexBuffers vulkan_symbol_wrapper_vkCmdBindVertexBuffers
extern PFN_vkCmdDraw vulkan_symbol_wrapper_vkCmdDraw;
#define vkCmdDraw vulkan_symbol_wrapper_vkCmdDraw
extern PFN_vkCmdDrawIndexed vulkan_symbol_wrapper_vkCmdDrawIndexed;
#define vkCmdDrawIndexed vulkan_symbol_wrapper_vkCmdDrawIndexed
extern PFN_vkCmdDrawIndirect vulkan_symbol_wrapper_vkCmdDrawIndirect;
#define vkCmdDrawIndirect vulkan_symbol_wrapper_vkCmdDrawIndirect
extern PFN_vkCmdDrawIndexedIndirect vulkan_symbol_wrapper_vkCmdDrawIndexedIndirect;
#define vkCmdDrawIndexedIndirect vulkan_symbol_wrapper_vkCmdDrawIndexedIndirect
extern PFN_vkCmdDispatch vulkan_symbol_wrapper_vkCmdDispatch;
#define vkCmdDispatch vulkan_symbol_wrapper_vkCmdDispatch
extern PFN_vkCmdDispatchIndirect vulkan_symbol_wrapper_vkCmdDispatchIndirect;
#define vkCmdDispatchIndirect vulkan_symbol_wrapper_vkCmdDispatchIndirect
extern PFN_vkCmdCopyBuffer vulkan_symbol_wrapper_vkCmdCopyBuffer;
#define vkCmdCopyBuffer vulkan_symbol_wrapper_vkCmdCopyBuffer
extern PFN_vkCmdCopyImage vulkan_symbol_wrapper_vkCmdCopyImage;
#define vkCmdCopyImage vulkan_symbol_wrapper_vkCmdCopyImage
extern PFN_vkCmdBlitImage vulkan_symbol_wrapper_vkCmdBlitImage;
#define vkCmdBlitImage vulkan_symbol_wrapper_vkCmdBlitImage
extern PFN_vkCmdCopyBufferToImage vulkan_symbol_wrapper_vkCmdCopyBufferToImage;
#define vkCmdCopyBufferToImage vulkan_symbol_wrapper_vkCmdCopyBufferToImage
extern PFN_vkCmdCopyImageToBuffer vulkan_symbol_wrapper_vkCmdCopyImageToBuffer;
#define vkCmdCopyImageToBuffer vulkan_symbol_wrapper_vkCmdCopyImageToBuffer
extern PFN_vkCmdUpdateBuffer vulkan_symbol_wrapper_vkCmdUpdateBuffer;
#define vkCmdUpdateBuffer vulkan_symbol_wrapper_vkCmdUpdateBuffer
extern PFN_vkCmdFillBuffer vulkan_symbol_wrapper_vkCmdFillBuffer;
#define vkCmdFillBuffer vulkan_symbol_wrapper_vkCmdFillBuffer
extern PFN_vkCmdClearColorImage vulkan_symbol_wrapper_vkCmdClearColorImage;
#define vkCmdClearColorImage vulkan_symbol_wrapper_vkCmdClearColorImage
extern PFN_vkCmdClearDepthStencilImage vulkan_symbol_wrapper_vkCmdClearDepthStencilImage;
#define vkCmdClearDepthStencilImage vulkan_symbol_wrapper_vkCmdClearDepthStencilImage
extern PFN_vkCmdClearAttachments vulkan_symbol_wrapper_vkCmdClearAttachments;
#define vkCmdClearAttachments vulkan_symbol_wrapper_vkCmdClearAttachments
extern PFN_vkCmdResolveImage vulkan_symbol_wrapper_vkCmdResolveImage;
#define vkCmdResolveImage vulkan_symbol_wrapper_vkCmdResolveImage
extern PFN_vkCmdSetEvent vulkan_symbol_wrapper_vkCmdSetEvent;
#define vkCmdSetEvent vulkan_symbol_wrapper_vkCmdSetEvent
extern PFN_vkCmdResetEvent vulkan_symbol_wrapper_vkCmdResetEvent;
#define vkCmdResetEvent vulkan_symbol_wrapper_vkCmdResetEvent
extern PFN_vkCmdWaitEvents vulkan_symbol_wrapper_vkCmdWaitEvents;
#define vkCmdWaitEvents vulkan_symbol_wrapper_vkCmdWaitEvents
extern PFN_vkCmdPipelineBarrier vulkan_symbol_wrapper_vkCmdPipelineBarrier;
#define vkCmdPipelineBarrier vulkan_symbol_wrapper_vkCmdPipelineBarrier
extern PFN_vkCmdBeginQuery vulkan_symbol_wrapper_vkCmdBeginQuery;
#define vkCmdBeginQuery vulkan_symbol_wrapper_vkCmdBeginQuery
extern PFN_vkCmdEndQuery vulkan_symbol_wrapper_vkCmdEndQuery;
#define vkCmdEndQuery vulkan_symbol_wrapper_vkCmdEndQuery
extern PFN_vkCmdResetQueryPool vulkan_symbol_wrapper_vkCmdResetQueryPool;
#define vkCmdResetQueryPool vulkan_symbol_wrapper_vkCmdResetQueryPool
extern PFN_vkCmdWriteTimestamp vulkan_symbol_wrapper_vkCmdWriteTimestamp;
#define vkCmdWriteTimestamp vulkan_symbol_wrapper_vkCmdWriteTimestamp
extern PFN_vkCmdCopyQueryPoolResults vulkan_symbol_wrapper_vkCmdCopyQueryPoolResults;
#define vkCmdCopyQueryPoolResults vulkan_symbol_wrapper_vkCmdCopyQueryPoolResults
extern PFN_vkCmdPushConstants vulkan_symbol_wrapper_vkCmdPushConstants;
#define vkCmdPushConstants vulkan_symbol_wrapper_vkCmdPushConstants
extern PFN_vkCmdBeginRenderPass vulkan_symbol_wrapper_vkCmdBeginRenderPass;
#define vkCmdBeginRenderPass vulkan_symbol_wrapper_vkCmdBeginRenderPass
extern PFN_vkCmdNextSubpass vulkan_symbol_wrapper_vkCmdNextSubpass;
#define vkCmdNextSubpass vulkan_symbol_wrapper_vkCmdNextSubpass
extern PFN_vkCmdEndRenderPass vulkan_symbol_wrapper_vkCmdEndRenderPass;
#define vkCmdEndRenderPass vulkan_symbol_wrapper_vkCmdEndRenderPass
extern PFN_vkCmdExecuteCommands vulkan_symbol_wrapper_vkCmdExecuteCommands;
#define vkCmdExecuteCommands vulkan_symbol_wrapper_vkCmdExecuteCommands
extern PFN_vkDestroySurfaceKHR vulkan_symbol_wrapper_vkDestroySurfaceKHR;
#define vkDestroySurfaceKHR vulkan_symbol_wrapper_vkDestroySurfaceKHR
extern PFN_vkGetPhysicalDeviceSurfaceSupportKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceSupportKHR;
#define vkGetPhysicalDeviceSurfaceSupportKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceSupportKHR
extern PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
#define vkGetPhysicalDeviceSurfaceCapabilitiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
extern PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceFormatsKHR;
#define vkGetPhysicalDeviceSurfaceFormatsKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfaceFormatsKHR
extern PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfacePresentModesKHR;
#define vkGetPhysicalDeviceSurfacePresentModesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceSurfacePresentModesKHR
extern PFN_vkCreateSwapchainKHR vulkan_symbol_wrapper_vkCreateSwapchainKHR;
#define vkCreateSwapchainKHR vulkan_symbol_wrapper_vkCreateSwapchainKHR
extern PFN_vkDestroySwapchainKHR vulkan_symbol_wrapper_vkDestroySwapchainKHR;
#define vkDestroySwapchainKHR vulkan_symbol_wrapper_vkDestroySwapchainKHR
extern PFN_vkGetSwapchainImagesKHR vulkan_symbol_wrapper_vkGetSwapchainImagesKHR;
#define vkGetSwapchainImagesKHR vulkan_symbol_wrapper_vkGetSwapchainImagesKHR
extern PFN_vkAcquireNextImageKHR vulkan_symbol_wrapper_vkAcquireNextImageKHR;
#define vkAcquireNextImageKHR vulkan_symbol_wrapper_vkAcquireNextImageKHR
extern PFN_vkQueuePresentKHR vulkan_symbol_wrapper_vkQueuePresentKHR;
#define vkQueuePresentKHR vulkan_symbol_wrapper_vkQueuePresentKHR
extern PFN_vkGetPhysicalDeviceDisplayPropertiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceDisplayPropertiesKHR;
#define vkGetPhysicalDeviceDisplayPropertiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceDisplayPropertiesKHR
extern PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceDisplayPlanePropertiesKHR;
#define vkGetPhysicalDeviceDisplayPlanePropertiesKHR vulkan_symbol_wrapper_vkGetPhysicalDeviceDisplayPlanePropertiesKHR
extern PFN_vkGetDisplayPlaneSupportedDisplaysKHR vulkan_symbol_wrapper_vkGetDisplayPlaneSupportedDisplaysKHR;
#define vkGetDisplayPlaneSupportedDisplaysKHR vulkan_symbol_wrapper_vkGetDisplayPlaneSupportedDisplaysKHR
extern PFN_vkGetDisplayModePropertiesKHR vulkan_symbol_wrapper_vkGetDisplayModePropertiesKHR;
#define vkGetDisplayModePropertiesKHR vulkan_symbol_wrapper_vkGetDisplayModePropertiesKHR
extern PFN_vkCreateDisplayModeKHR vulkan_symbol_wrapper_vkCreateDisplayModeKHR;
#define vkCreateDisplayModeKHR vulkan_symbol_wrapper_vkCreateDisplayModeKHR
extern PFN_vkGetDisplayPlaneCapabilitiesKHR vulkan_symbol_wrapper_vkGetDisplayPlaneCapabilitiesKHR;
#define vkGetDisplayPlaneCapabilitiesKHR vulkan_symbol_wrapper_vkGetDisplayPlaneCapabilitiesKHR
extern PFN_vkCreateDisplayPlaneSurfaceKHR vulkan_symbol_wrapper_vkCreateDisplayPlaneSurfaceKHR;
#define vkCreateDisplayPlaneSurfaceKHR vulkan_symbol_wrapper_vkCreateDisplayPlaneSurfaceKHR
extern PFN_vkCreateSharedSwapchainsKHR vulkan_symbol_wrapper_vkCreateSharedSwapchainsKHR;
#define vkCreateSharedSwapchainsKHR vulkan_symbol_wrapper_vkCreateSharedSwapchainsKHR
#ifdef VULKAN_DEBUG
extern PFN_vkCreateDebugReportCallbackEXT vulkan_symbol_wrapper_vkCreateDebugReportCallbackEXT;
#define vkCreateDebugReportCallbackEXT vulkan_symbol_wrapper_vkCreateDebugReportCallbackEXT
extern PFN_vkDestroyDebugReportCallbackEXT vulkan_symbol_wrapper_vkDestroyDebugReportCallbackEXT;
#define vkDestroyDebugReportCallbackEXT vulkan_symbol_wrapper_vkDestroyDebugReportCallbackEXT
extern PFN_vkDebugReportMessageEXT vulkan_symbol_wrapper_vkDebugReportMessageEXT;
#define vkDebugReportMessageEXT vulkan_symbol_wrapper_vkDebugReportMessageEXT
extern PFN_vkDebugMarkerSetObjectTagEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectTagEXT;
#define vkDebugMarkerSetObjectTagEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectTagEXT
extern PFN_vkDebugMarkerSetObjectNameEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectNameEXT;
#define vkDebugMarkerSetObjectNameEXT vulkan_symbol_wrapper_vkDebugMarkerSetObjectNameEXT
extern PFN_vkCmdDebugMarkerBeginEXT vulkan_symbol_wrapper_vkCmdDebugMarkerBeginEXT;
#define vkCmdDebugMarkerBeginEXT vulkan_symbol_wrapper_vkCmdDebugMarkerBeginEXT
extern PFN_vkCmdDebugMarkerEndEXT vulkan_symbol_wrapper_vkCmdDebugMarkerEndEXT;
#define vkCmdDebugMarkerEndEXT vulkan_symbol_wrapper_vkCmdDebugMarkerEndEXT
extern PFN_vkCmdDebugMarkerInsertEXT vulkan_symbol_wrapper_vkCmdDebugMarkerInsertEXT;
#define vkCmdDebugMarkerInsertEXT vulkan_symbol_wrapper_vkCmdDebugMarkerInsertEXT
#endif
void vulkan_symbol_wrapper_init(PFN_vkGetInstanceProcAddr get_instance_proc_addr);
PFN_vkGetInstanceProcAddr vulkan_symbol_wrapper_instance_proc_addr(void);
VkBool32 vulkan_symbol_wrapper_load_global_symbols(void);
VkBool32 vulkan_symbol_wrapper_load_core_instance_symbols(VkInstance instance);
VkBool32 vulkan_symbol_wrapper_load_core_symbols(VkInstance instance);
VkBool32 vulkan_symbol_wrapper_load_core_device_symbols(VkDevice device);
VkBool32 vulkan_symbol_wrapper_load_instance_symbol(VkInstance instance, const char *name, PFN_vkVoidFunction *ppSymbol);
VkBool32 vulkan_symbol_wrapper_load_device_symbol(VkDevice device, const char *name, PFN_vkVoidFunction *ppSymbol);
#define VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_SYMBOL(instance, name, pfn) vulkan_symbol_wrapper_load_instance_symbol(instance, name, (PFN_vkVoidFunction*) &(pfn))
#define VULKAN_SYMBOL_WRAPPER_LOAD_INSTANCE_EXTENSION_SYMBOL(instance, name) vulkan_symbol_wrapper_load_instance_symbol(instance, #name, (PFN_vkVoidFunction*) & name)
#define VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_SYMBOL(device, name, pfn) vulkan_symbol_wrapper_load_device_symbol(device, name, (PFN_vkVoidFunction*) &(pfn))
#define VULKAN_SYMBOL_WRAPPER_LOAD_DEVICE_EXTENSION_SYMBOL(device, name) vulkan_symbol_wrapper_load_device_symbol(device, #name, (PFN_vkVoidFunction*) & name)
#ifdef __cplusplus
}
#endif
#endif
File diff suppressed because it is too large. Load diff
@@ -1,480 +0,0 @@
#ifndef VULKAN_UTIL_HPP
#define VULKAN_UTIL_HPP
#include "vulkan.hpp"
#include <functional>
#include <stack>
#include <stddef.h>
#include <vector>
namespace Vulkan
{
class Device;
struct Image;
static const unsigned MaxBlockSize = 32 * 1024 * 1024;
namespace RDP
{
enum class DescriptorSetType
{
LUT = 0,
Buffers = 1,
Count
};
enum class PipelineType
{
NoZ_8bit = 0,
NoZ_16bit = 1,
NoZ_32bit = 2,
Z_8bit = 3,
Z_16bit = 4,
Z_32bit = 5,
ColorDepthAlias_16bit = 6,
Varying = 7,
Texture = 8,
Combiner = 9,
Count
};
enum class BufferLayout
{
PrimitiveData = 0,
TileListHeader = 1,
TileList = 2,
Color = 3,
Depth = 4,
Combiners = 5,
TileDescriptor = 6,
TileAtlas = 7,
WorkDescriptor = 8,
TileBuffer = 9,
Count
};
static const unsigned PipelineCount = static_cast<unsigned>(PipelineType::Count);
static const unsigned DescriptorSetCount = static_cast<unsigned>(DescriptorSetType::Count);
static const unsigned BufferLayoutCount = static_cast<unsigned>(BufferLayout::Count);
}
namespace Blit
{
enum class DescriptorSetType
{
Buffers = 0,
Count
};
enum class PipelineType
{
Blit_8bit = 0,
Blit_16bit = 1,
Blit_32bit = 2,
TMEM_RGBA32 = 3,
TMEM_RGBA16 = 4,
TMEM_I8 = 5,
TMEM_IA8 = 6,
TMEM_IA16 = 7,
Count
};
enum class BufferLayout
{
Color = 0,
Image = 1,
Count
};
static const unsigned PipelineCount = static_cast<unsigned>(PipelineType::Count);
static const unsigned DescriptorSetCount = static_cast<unsigned>(DescriptorSetType::Count);
static const unsigned BufferLayoutCount = static_cast<unsigned>(BufferLayout::Count);
}
namespace Internal
{
static const unsigned SetsPerPool = 16;
struct FenceAllocator
{
std::vector<VkFence> fences;
unsigned count = 0;
};
struct SemaphoreAllocator
{
std::vector<VkSemaphore> semaphores;
unsigned count = 0;
};
struct DescriptorPool
{
VkDescriptorPool pool;
unsigned count;
unsigned size;
};
struct DescriptorSetAllocator
{
std::vector<DescriptorPool> pools;
std::vector<VkDescriptorPoolSize> sizes;
unsigned count = 0;
};
struct CommandPool
{
VkCommandPool pool = VK_NULL_HANDLE;
std::vector<VkCommandBuffer> buffers;
unsigned count = 0;
};
struct PerFrame
{
FenceAllocator fence_allocator;
SemaphoreAllocator semaphore_allocator;
CommandPool command_pool;
CommandPool alt_command_pool;
DescriptorSetAllocator descriptor_set_rdp_allocator[RDP::DescriptorSetCount];
DescriptorSetAllocator descriptor_set_blit_allocator[Blit::DescriptorSetCount];
std::vector<std::function<void()>> defers;
uint64_t frame_count = 0;
};
struct Block
{
VkDevice device;
VkBuffer buffer;
VkDeviceMemory memory;
size_t offset;
size_t size;
void *mapped;
bool coherent;
bool device_local;
~Block()
{
vkDeviceWaitIdle(device);
vkDestroyBuffer(device, buffer, nullptr);
if (mapped)
vkUnmapMemory(device, memory);
vkFreeMemory(device, memory, nullptr);
}
};
struct ImageDeleter
{
void operator()(Image *image);
};
enum class BufferLocation
{
Device,
CachedHost,
CachedHostShared,
DeviceShared
};
struct AllocatedBlock
{
size_t offset;
size_t size;
std::shared_ptr<Block> block;
};
struct BufferAllocator
{
BufferAllocator(const VulkanContext &context, BufferLocation location)
: context(context)
, location(location)
{
}
const VulkanContext &context;
BufferLocation location;
std::stack<std::unique_ptr<Block>> vacant;
std::shared_ptr<Block> current;
};
struct Memory
{
VkDevice device;
VkDeviceMemory memory;
size_t offset;
size_t size;
~Memory()
{
//fprintf(stderr, "Destroy memory %p\n", this);
vkDeviceWaitIdle(device);
vkFreeMemory(device, memory, nullptr);
}
};
struct AllocatedMemory
{
~AllocatedMemory()
{
//fprintf(stderr, "Destroy allocated memory %p\n", this);
}
size_t offset;
size_t size;
std::shared_ptr<Memory> memory;
};
struct MemoryAllocator
{
MemoryAllocator(const VulkanContext &context)
: context(context)
{
}
const VulkanContext &context;
std::stack<std::unique_ptr<Memory>> vacant;
std::shared_ptr<Memory> current;
};
}
enum class BufferType
{
Dynamic = 0, // Both on GPU and CPU. If GPU is integrated, just one.
Staging = 1, // For CPU -> GPU texture
Device = 2, // GPU only
DynamicShared = 3 // Same as dynamic, but device memory can be used by queue and alt_queue.
};
struct Fence
{
Fence(VkFence fence, uint64_t set_on_frame, unsigned frame_index)
: fence(fence)
, set_on_frame(set_on_frame)
, frame_index(frame_index)
{
}
Fence() = default;
VkFence fence = VK_NULL_HANDLE;
uint64_t set_on_frame = 0;
unsigned frame_index = 0;
};
struct Semaphore
{
Semaphore() = default;
Semaphore(VkSemaphore sem)
: semaphore(sem)
{
}
VkSemaphore semaphore = VK_NULL_HANDLE;
};
struct Buffer
{
void *map();
void unmap();
Internal::AllocatedBlock staging, device;
BufferType type = BufferType::Dynamic;
size_t atom_alignment = 1;
};
struct Image
{
Image(Device &device, VkImage image, VkImageView view, Internal::AllocatedMemory &&block, unsigned layers)
: device(device)
, image(image)
, view(view)
, block(std::move(block))
, layers(layers)
{
}
~Image()
{
//fprintf(stderr, "Destroy image %p\n", this);
}
Device &device;
VkImage image;
VkImageView view;
Internal::AllocatedMemory block;
unsigned layers;
VkSampler sampler = VK_NULL_HANDLE;
VkImageLayout layout = VK_IMAGE_LAYOUT_UNDEFINED;
};
using ImageHandle = std::unique_ptr<Image, Internal::ImageDeleter>;
struct Pipeline
{
VkPipeline pipeline;
VkPipelineLayout layout;
};
struct DescriptorSet
{
DescriptorSet(VkDevice device, VkDescriptorSet set)
: device(device)
, set(set)
{
}
DescriptorSet() = default;
void set_storage_buffer(unsigned binding, Buffer &buffer, size_t offset, size_t range);
void set_uniform_buffer(unsigned binding, Buffer &buffer, size_t offset, size_t range);
void set_storage_buffer(unsigned binding, Buffer &buffer);
void set_uniform_buffer(unsigned binding, Buffer &buffer);
void set_image(unsigned binding, Image &image);
void set_storage_image(unsigned binding, Image &image);
VkDevice device = VK_NULL_HANDLE;
VkDescriptorSet set = VK_NULL_HANDLE;
};
struct CommandBuffer
{
CommandBuffer(VkCommandBuffer cmd, VkPipelineLayout layout)
: cmd(cmd)
, layout(layout)
{
}
CommandBuffer() = default;
void sync_buffer_to_gpu(Buffer &buffer);
void sync_buffer_to_cpu(Buffer &buffer);
void copy_to_image(Image &image, Buffer &buffer, size_t buffer_offset, unsigned x, unsigned y, unsigned layer,
unsigned width, unsigned height, unsigned row_length);
void copy_buffer(Buffer &dst, Buffer &src);
void bind_pipeline(const Pipeline &pipeline);
void bind_descriptor_set(unsigned index, const DescriptorSet &set);
void dispatch(unsigned x, unsigned y, unsigned z);
void begin_stream();
void end_stream();
void begin_readback();
void end_readback();
void push_constants(const void *data, size_t size);
void prepare_image(Image &image);
void complete_image(Image &image);
void prepare_storage_image(Image &image);
void prepare_mixed_image(Image &image);
void complete_storage_image(Image &image);
void complete_mixed_image(Image &image);
void flush_barrier();
VkCommandBuffer cmd = VK_NULL_HANDLE;
VkPipelineLayout layout = VK_NULL_HANDLE;
};
class Device
{
public:
friend struct Internal::ImageDeleter;
Device(const VulkanContext &context, unsigned frames);
~Device();
void set_num_frames(unsigned num_frames);
unsigned get_num_frames() const
{
return per_frame.size();
}
void begin_index(unsigned index);
CommandBuffer request_command_buffer();
CommandBuffer request_alt_command_buffer();
Semaphore request_semaphore();
Fence submit(const CommandBuffer &cmd, const Semaphore *wait_semaphore = nullptr,
const Semaphore *signal_semaphore = nullptr);
Fence submit_alt_queue(const CommandBuffer &cmd, const Semaphore *wait_semaphore = nullptr,
const Semaphore *signal_semaphore = nullptr);
void wait(const Fence &fence);
Buffer request_buffer(BufferType type, size_t size);
Buffer request_dynamic_buffer(CommandBuffer &cmd, DescriptorSet &set, RDP::BufferLayout binding, size_t size);
size_t get_buffer_alignment() const;
DescriptorSet request_rdp_descriptor_set(RDP::DescriptorSetType type);
DescriptorSet request_blit_descriptor_set(Blit::DescriptorSetType type);
Pipeline get_rdp_pipeline(RDP::PipelineType type) const
{
return { rdp.pipelines[static_cast<uint32_t>(type)], rdp.layout };
}
Pipeline get_blit_pipeline(Blit::PipelineType type) const
{
return { blit.pipelines[static_cast<uint32_t>(type)], blit.layout };
}
ImageHandle create_image_2d(VkFormat format, unsigned width, unsigned height);
ImageHandle create_image_2d_array(VkFormat format, unsigned width, unsigned height, unsigned layers);
private:
const VulkanContext &context;
Internal::BufferAllocator cached_allocator;
Internal::BufferAllocator device_allocator;
Internal::BufferAllocator cached_shared_allocator;
Internal::BufferAllocator shared_allocator;
Internal::MemoryAllocator memory_allocator;
void init_per_frame(unsigned num_frames);
void deinit_per_frame();
DescriptorSet request_descriptor_set(Internal::DescriptorSetAllocator &alloc, VkDescriptorSetLayout layout);
struct
{
VkPipeline pipelines[RDP::PipelineCount];
VkDescriptorSetLayout set_layouts[RDP::DescriptorSetCount];
std::vector<VkDescriptorPoolSize> descriptor_pool_sizes[RDP::DescriptorSetCount];
VkPipelineLayout layout;
VkSampler sampler;
} rdp;
struct
{
VkPipeline pipelines[Blit::PipelineCount];
VkDescriptorSetLayout set_layouts[Blit::DescriptorSetCount];
std::vector<VkDescriptorPoolSize> descriptor_pool_sizes[Blit::DescriptorSetCount];
VkPipelineLayout layout;
} blit;
VkPipelineCache pipeline_cache;
void init_rdp_pipelines();
void init_blit_pipelines();
std::vector<Internal::PerFrame> per_frame;
unsigned current_index = 0;
Internal::AllocatedBlock allocate_block(Internal::BufferAllocator &alloc, size_t size);
Internal::AllocatedMemory allocate_memory(Internal::MemoryAllocator &alloc, const VkMemoryRequirements &req);
bool find_memory_type(uint32_t *index, uint32_t device_req, uint32_t host_req);
ImageHandle create_image(VkFormat format, unsigned width, unsigned height, unsigned layers, bool array,
Internal::MemoryAllocator &mem_alloc);
void delete_image(Image *image);
CommandBuffer request_command_buffer(Internal::CommandPool &pool);
Fence submit(VkQueue queue, const CommandBuffer &cmd, const Semaphore *wait_semaphore = nullptr,
const Semaphore *signal_semaphore = nullptr);
};
}
#endif
-169
View File
@@ -1,169 +0,0 @@
#include <string.h>
#include "Gfx #1.3.h"
#include <libretro.h>
#include <libretro_vulkan.h>
#include "rdp.hpp"
#include "z64.h"
#include <utility>
extern retro_log_printf_t log_cb;
extern retro_environment_t environ_cb;
using namespace RDP;
using namespace Vulkan;
using namespace std;
namespace VI
{
unsigned width;
unsigned height;
bool valid;
static bool dupe_possible;
static vector<retro_vulkan_image> retro_images;
retro_vulkan_image blank_retro_image;
ImageHandle blank_image;
void deinit()
{
retro_images.clear();
blank_image.reset();
}
void set_num_frames(unsigned count)
{
retro_images.resize(count);
dupe_possible = false;
// Create a default image.
blank_image = device->create_image_2d(VK_FORMAT_R8G8B8A8_UNORM, 320, 240);
auto cmd = device->request_command_buffer();
cmd.begin_stream();
auto staging = device->request_buffer(BufferType::Staging, 320 * 240 * sizeof(uint32_t));
memset(staging.map(), 0, 320 * 240 * sizeof(uint32_t));
staging.unmap();
cmd.end_stream();
cmd.prepare_image(*blank_image);
cmd.copy_to_image(*blank_image, staging, 0, 0, 0, 0, 320, 240, 0);
cmd.complete_image(*blank_image);
auto fence = device->submit(cmd);
device->wait(fence);
vulkan->set_image(vulkan->handle, &blank_retro_image, 0, nullptr, VK_QUEUE_FAMILY_IGNORED);
width = 320;
height = 240;
valid = true;
blank_retro_image.image_view = blank_image->view;
blank_retro_image.image_layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
blank_retro_image.create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
blank_retro_image.create_info.image = blank_image->image;
blank_retro_image.create_info.viewType = VK_IMAGE_VIEW_TYPE_2D;
blank_retro_image.create_info.format = VK_FORMAT_R8G8B8A8_UNORM;
blank_retro_image.create_info.subresourceRange.baseMipLevel = 0;
blank_retro_image.create_info.subresourceRange.baseArrayLayer = 0;
blank_retro_image.create_info.subresourceRange.levelCount = 1;
blank_retro_image.create_info.subresourceRange.layerCount = 1;
blank_retro_image.create_info.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
blank_retro_image.create_info.components.r = VK_COMPONENT_SWIZZLE_R;
blank_retro_image.create_info.components.g = VK_COMPONENT_SWIZZLE_G;
blank_retro_image.create_info.components.b = VK_COMPONENT_SWIZZLE_B;
blank_retro_image.create_info.components.a = VK_COMPONENT_SWIZZLE_A;
}
void complete_frame(void)
{
if (!renderer)
return;
renderer->complete_frame();
// Random VI checking. We have to do a better job in the future.
uint32_t fb = *GET_GFX_INFO(VI_ORIGIN_REG) & 0x00ffffff;
const int v_sync = *GET_GFX_INFO(VI_V_SYNC_REG) & 0x000003ff;
const int ispal = (v_sync > 550);
#if 0
const int x_add = *GET_GFX_INFO(VI_X_SCALE_REG);
const int y_add = *GET_GFX_INFO(VI_Y_SCALE_REG);
const int x1 = (*GET_GFX_INFO(VI_H_START_REG) >> 16) & 0x03ff;
const int y1 = (*GET_GFX_INFO(VI_V_START_REG) >> 16) & 0x03ff;
const int x2 = (*GET_GFX_INFO(VI_H_START_REG) >> 0) & 0x03ff;
const int y2 = (*GET_GFX_INFO(VI_V_START_REG) >> 0) & 0x03ff;
const int delta_x = x2 - x1;
const int delta_y = y2 - y1;
const int vi_width = *GET_GFX_INFO(VI_WIDTH_REG) & 0x00000fff;
const int vitype = *GET_GFX_INFO(VI_STATUS_REG) & 0x00000003;
#endif
int vactivelines = v_sync - (ispal ? 47 : 37);
if (vactivelines < 0)
{
log_cb(RETRO_LOG_WARN, "Inactive frame.\n");
vulkan->set_image(vulkan->handle, &blank_retro_image, 0, nullptr, VK_QUEUE_FAMILY_IGNORED);
return;
}
//fprintf(stderr, "VI: %u, %u x %u, XSCALE: %u, YSCALE: %u, VSYNC: %u, VI_WIDTH: %u\n", fb, delta_x, delta_y, x_add, y_add, v_sync, vi_width);
unsigned index = vulkan->get_sync_index(vulkan->handle);
auto &outputs = renderer->get_vi_outputs();
Renderer::VIOutput *best = nullptr;
// Find the last VI output which points to a buffer which is inside.
if (!outputs.empty())
{
auto itr = begin(outputs);
for (; itr != end(outputs); ++itr)
{
uint32_t wrap = WRAP_ADDR(fb - itr->framebuffer.addr);
uint32_t size = itr->framebuffer.color_size();
bool within = wrap < size;
if (within)
best = &*itr;
}
}
if (best)
{
auto &last = *best;
retro_images[index].image_view = last.image->view;
retro_images[index].image_layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
retro_images[index].create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
retro_images[index].create_info.image = last.image->image;
retro_images[index].create_info.viewType = VK_IMAGE_VIEW_TYPE_2D;
retro_images[index].create_info.format = VK_FORMAT_R8G8B8A8_UNORM;
retro_images[index].create_info.subresourceRange.baseMipLevel = 0;
retro_images[index].create_info.subresourceRange.baseArrayLayer = 0;
retro_images[index].create_info.subresourceRange.levelCount = 1;
retro_images[index].create_info.subresourceRange.layerCount = 1;
retro_images[index].create_info.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
retro_images[index].create_info.components.r = VK_COMPONENT_SWIZZLE_R;
retro_images[index].create_info.components.g = VK_COMPONENT_SWIZZLE_G;
retro_images[index].create_info.components.b = VK_COMPONENT_SWIZZLE_B;
retro_images[index].create_info.components.a = VK_COMPONENT_SWIZZLE_A;
vulkan->set_image(vulkan->handle, &retro_images[index], 0, nullptr, VK_QUEUE_FAMILY_IGNORED);
width = last.framebuffer.allocated_width;
height = last.framebuffer.allocated_height;
valid = true;
dupe_possible = true;
}
else if (dupe_possible)
{
// Here we should upload from CPU possibly to emulate games which are software rendered.
valid = false;
}
else
{
vulkan->set_image(vulkan->handle, &blank_retro_image, 0, nullptr, VK_QUEUE_FAMILY_IGNORED);
width = 320;
height = 240;
valid = true;
}
}
}