initial Refresh2 conversion
parent
b78d01592b
commit
66341b8550
|
@ -15,3 +15,7 @@ xcuserdata/
|
|||
build/
|
||||
CMakeCache.txt
|
||||
cmake.check_cache
|
||||
moonbuild/
|
||||
moonbuildMac/
|
||||
moonbuildWin64/
|
||||
dist/
|
||||
|
|
|
@ -7,9 +7,9 @@ project(Refresh C)
|
|||
option(BUILD_SHARED_LIBS "Build shared library" ON)
|
||||
|
||||
# Version
|
||||
SET(LIB_MAJOR_VERSION "1")
|
||||
SET(LIB_MINOR_VERSION "15")
|
||||
SET(LIB_REVISION "4")
|
||||
SET(LIB_MAJOR_VERSION "2")
|
||||
SET(LIB_MINOR_VERSION "0")
|
||||
SET(LIB_REVISION "0")
|
||||
SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
|
||||
|
||||
# Build Type
|
||||
|
@ -38,21 +38,38 @@ endif()
|
|||
|
||||
# Defines
|
||||
add_definitions(
|
||||
-DREFRESH_DRIVER_VULKAN
|
||||
-DREFRESH_VULKAN
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
add_definitions(
|
||||
-DREFRESH_D3D11
|
||||
)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
add_definitions(
|
||||
-DREFRESH_METAL
|
||||
)
|
||||
endif()
|
||||
|
||||
# Source lists
|
||||
add_library(Refresh
|
||||
# Public Headers
|
||||
include/Refresh.h
|
||||
include/Refresh_Image.h
|
||||
include/Refresh_image.h
|
||||
# Internal Headers
|
||||
src/Refresh_Driver.h
|
||||
src/Refresh_Driver_Vulkan_vkfuncs.h
|
||||
src/Refresh_driver.h
|
||||
src/Refresh_spirv_c.h
|
||||
src/spirv_cross_c.h
|
||||
src/vulkan/Refresh_vulkan_vkfuncs.h
|
||||
# Source Files
|
||||
src/Refresh.c
|
||||
src/Refresh_Driver_Vulkan.c
|
||||
src/Refresh_Image.c
|
||||
src/Refresh_spirv.c
|
||||
src/d3d11/Refresh_d3d11.c
|
||||
src/d3d11/Refresh_d3d11_d3dcompiler.c
|
||||
src/vulkan/Refresh_vulkan.c
|
||||
src/Refresh_image.c
|
||||
)
|
||||
|
||||
# Build flags
|
||||
|
|
20
README.md
20
README.md
|
@ -1,6 +1,4 @@
|
|||
[![Build Status](https://gitea.drone.moonside.games/api/badges/MoonsideGames/Refresh/status.svg)](https://gitea.drone.moonside.games/MoonsideGames/Refresh)
|
||||
|
||||
This is Refresh, an XNA-inspired 3D graphics library with modern capabilities.
|
||||
This is Refresh, a cross-platform hardware-accelerated graphics library with modern capabilities.
|
||||
|
||||
License
|
||||
-------
|
||||
|
@ -8,16 +6,20 @@ Refresh is licensed under the zlib license. See LICENSE for details.
|
|||
|
||||
About Refresh
|
||||
-------------
|
||||
Refresh is directly inspired by FNA3D and intended to be a replacement for XNA's Graphics namespace.
|
||||
XNA 4.0 is a powerful API, but its shader system is outdated and certain restrictions are awkward to handle in a modern context.
|
||||
In the way that XNA was "one step above" DX9, Refresh intends to be "one step above" Vulkan. It should map nicely to modern graphics APIs.
|
||||
Refresh will initially have a Vulkan runtime implementation. Support for other APIs like DX12 may come later.
|
||||
For shaders, we consume SPIR-V bytecode.
|
||||
The contemporary graphics landscape is daunting. Older and easier-to-learn APIs like OpenGL are being replaced by explicit APIs like Vulkan.
|
||||
These newer APIs have many appealing features, like threading support and bundled state management,
|
||||
but using them in practice requires complex management of memory and synchronization.
|
||||
What's a developer to do?
|
||||
|
||||
Refresh is a middle ground between these two extremes. The API aims for the simplicity of OpenGL combined with the power of Vulkan.
|
||||
Refresh supports all desktop platforms. Vulkan and D3D11 backends are complete, and Metal support is coming soon.
|
||||
Refresh supports portable shaders through SPIRV-Cross, but it also allows you to provide backend-specific shader formats, so you can use any shader toolchain you like.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
Refresh depends on SDL2 for portability.
|
||||
Refresh never explicitly uses the C runtime.
|
||||
SPIRV-Cross is dynamically linked as an optional dependency.
|
||||
|
||||
Building Refresh
|
||||
----------------
|
||||
|
@ -34,4 +36,4 @@ Want to contribute?
|
|||
-------------------
|
||||
Issues can be reported and patches contributed via Github:
|
||||
|
||||
https://github.com/thatcosmonaut/Refresh
|
||||
https://github.com/MoonsideGames/Refresh
|
||||
|
|
2055
include/Refresh.h
2055
include/Refresh.h
File diff suppressed because it is too large
Load Diff
1825
src/Refresh.c
1825
src/Refresh.c
File diff suppressed because it is too large
Load Diff
|
@ -1,604 +0,0 @@
|
|||
/* Refresh - XNA-inspired 3D Graphics Library with modern capabilities
|
||||
*
|
||||
* Copyright (c) 2020 Evan Hemsley
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
* the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software in a
|
||||
* product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* Evan "cosmonaut" Hemsley <evan@moonside.games>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef REFRESH_DRIVER_H
|
||||
#define REFRESH_DRIVER_H
|
||||
|
||||
#include "Refresh.h"
|
||||
|
||||
/* Windows/Visual Studio cruft */
|
||||
#ifdef _WIN32
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
/* Logging */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void Refresh_LogInfo(const char *fmt, ...);
|
||||
void Refresh_LogWarn(const char *fmt, ...);
|
||||
void Refresh_LogError(const char *fmt, ...);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Internal Helper Utilities */
|
||||
|
||||
static inline uint32_t Texture_GetFormatSize(
|
||||
Refresh_TextureFormat format
|
||||
) {
|
||||
switch (format)
|
||||
{
|
||||
case REFRESH_TEXTUREFORMAT_BC1:
|
||||
return 8;
|
||||
case REFRESH_TEXTUREFORMAT_BC2:
|
||||
case REFRESH_TEXTUREFORMAT_BC3:
|
||||
case REFRESH_TEXTUREFORMAT_BC7:
|
||||
return 16;
|
||||
case REFRESH_TEXTUREFORMAT_R8:
|
||||
case REFRESH_TEXTUREFORMAT_R8_UINT:
|
||||
return 1;
|
||||
case REFRESH_TEXTUREFORMAT_R5G6B5:
|
||||
case REFRESH_TEXTUREFORMAT_B4G4R4A4:
|
||||
case REFRESH_TEXTUREFORMAT_A1R5G5B5:
|
||||
case REFRESH_TEXTUREFORMAT_R16_SFLOAT:
|
||||
case REFRESH_TEXTUREFORMAT_R8G8_SNORM:
|
||||
case REFRESH_TEXTUREFORMAT_R8G8_UINT:
|
||||
case REFRESH_TEXTUREFORMAT_R16_UINT:
|
||||
return 2;
|
||||
case REFRESH_TEXTUREFORMAT_R8G8B8A8:
|
||||
case REFRESH_TEXTUREFORMAT_R32_SFLOAT:
|
||||
case REFRESH_TEXTUREFORMAT_R16G16_SFLOAT:
|
||||
case REFRESH_TEXTUREFORMAT_R8G8B8A8_SNORM:
|
||||
case REFRESH_TEXTUREFORMAT_A2R10G10B10:
|
||||
case REFRESH_TEXTUREFORMAT_R8G8B8A8_UINT:
|
||||
case REFRESH_TEXTUREFORMAT_R16G16_UINT:
|
||||
return 4;
|
||||
case REFRESH_TEXTUREFORMAT_R16G16B16A16_SFLOAT:
|
||||
case REFRESH_TEXTUREFORMAT_R16G16B16A16:
|
||||
case REFRESH_TEXTUREFORMAT_R32G32_SFLOAT:
|
||||
case REFRESH_TEXTUREFORMAT_R16G16B16A16_UINT:
|
||||
return 8;
|
||||
case REFRESH_TEXTUREFORMAT_R32G32B32A32_SFLOAT:
|
||||
return 16;
|
||||
default:
|
||||
Refresh_LogError(
|
||||
"Unrecognized SurfaceFormat!"
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t PrimitiveVerts(
|
||||
Refresh_PrimitiveType primitiveType,
|
||||
uint32_t primitiveCount
|
||||
) {
|
||||
switch (primitiveType)
|
||||
{
|
||||
case REFRESH_PRIMITIVETYPE_TRIANGLELIST:
|
||||
return primitiveCount * 3;
|
||||
case REFRESH_PRIMITIVETYPE_TRIANGLESTRIP:
|
||||
return primitiveCount + 2;
|
||||
case REFRESH_PRIMITIVETYPE_LINELIST:
|
||||
return primitiveCount * 2;
|
||||
case REFRESH_PRIMITIVETYPE_LINESTRIP:
|
||||
return primitiveCount + 1;
|
||||
case REFRESH_PRIMITIVETYPE_POINTLIST:
|
||||
return primitiveCount;
|
||||
default:
|
||||
Refresh_LogError(
|
||||
"Unrecognized primitive type!"
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t IndexSize(Refresh_IndexElementSize size)
|
||||
{
|
||||
return (size == REFRESH_INDEXELEMENTSIZE_16BIT) ? 2 : 4;
|
||||
}
|
||||
|
||||
static inline uint32_t BytesPerRow(
|
||||
int32_t width,
|
||||
Refresh_TextureFormat format
|
||||
) {
|
||||
uint32_t blocksPerRow = width;
|
||||
|
||||
if ( format == REFRESH_TEXTUREFORMAT_BC1 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC2 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC3 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC7 )
|
||||
{
|
||||
blocksPerRow = (width + 3) / 4;
|
||||
}
|
||||
|
||||
return blocksPerRow * Texture_GetFormatSize(format);
|
||||
}
|
||||
|
||||
static inline int32_t BytesPerImage(
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
Refresh_TextureFormat format
|
||||
) {
|
||||
uint32_t blocksPerRow = width;
|
||||
uint32_t blocksPerColumn = height;
|
||||
|
||||
if ( format == REFRESH_TEXTUREFORMAT_BC1 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC2 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC3 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC7 )
|
||||
{
|
||||
blocksPerRow = (width + 3) / 4;
|
||||
blocksPerColumn = (height + 3) / 4;
|
||||
}
|
||||
|
||||
return blocksPerRow * blocksPerColumn * Texture_GetFormatSize(format);
|
||||
}
|
||||
|
||||
/* XNA GraphicsDevice Limits */
|
||||
/* TODO: can these be adjusted for modern low-end? */
|
||||
|
||||
#define MAX_TEXTURE_SAMPLERS 16
|
||||
#define MAX_VERTEXTEXTURE_SAMPLERS 4
|
||||
#define MAX_TOTAL_SAMPLERS (MAX_TEXTURE_SAMPLERS + MAX_VERTEXTEXTURE_SAMPLERS)
|
||||
|
||||
#define MAX_BUFFER_BINDINGS 16
|
||||
|
||||
#define MAX_COLOR_TARGET_BINDINGS 4
|
||||
#define MAX_PRESENT_COUNT 16
|
||||
|
||||
/* Refresh_Device Definition */
|
||||
|
||||
typedef struct Refresh_Renderer Refresh_Renderer;
|
||||
|
||||
struct Refresh_Device
|
||||
{
|
||||
/* Quit */
|
||||
|
||||
void (*DestroyDevice)(Refresh_Device *device);
|
||||
|
||||
/* Drawing */
|
||||
|
||||
void (*DrawInstancedPrimitives)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
uint32_t baseVertex,
|
||||
uint32_t startIndex,
|
||||
uint32_t primitiveCount,
|
||||
uint32_t instanceCount,
|
||||
uint32_t vertexParamOffset,
|
||||
uint32_t fragmentParamOffset
|
||||
);
|
||||
|
||||
void (*DrawIndexedPrimitives)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
uint32_t baseVertex,
|
||||
uint32_t startIndex,
|
||||
uint32_t primitiveCount,
|
||||
uint32_t vertexParamOffset,
|
||||
uint32_t fragmentParamOffset
|
||||
);
|
||||
|
||||
void (*DrawPrimitives)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
uint32_t vertexStart,
|
||||
uint32_t primitiveCount,
|
||||
uint32_t vertexParamOffset,
|
||||
uint32_t fragmentParamOffset
|
||||
);
|
||||
|
||||
void (*DrawPrimitivesIndirect)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Buffer *buffer,
|
||||
uint32_t offsetInBytes,
|
||||
uint32_t drawCount,
|
||||
uint32_t stride,
|
||||
uint32_t vertexParamOffset,
|
||||
uint32_t fragmentParamOffset
|
||||
);
|
||||
|
||||
void (*DispatchCompute)(
|
||||
Refresh_Renderer *device,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
uint32_t groupCountX,
|
||||
uint32_t groupCountY,
|
||||
uint32_t groupCountZ,
|
||||
uint32_t computeParamOffset
|
||||
);
|
||||
|
||||
/* State Creation */
|
||||
|
||||
Refresh_ComputePipeline* (*CreateComputePipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_ComputeShaderInfo *computeShaderInfo
|
||||
);
|
||||
|
||||
Refresh_GraphicsPipeline* (*CreateGraphicsPipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_GraphicsPipelineCreateInfo *pipelineCreateInfo
|
||||
);
|
||||
|
||||
Refresh_Sampler* (*CreateSampler)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_SamplerStateCreateInfo *samplerStateCreateInfo
|
||||
);
|
||||
|
||||
Refresh_ShaderModule* (*CreateShaderModule)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_ShaderModuleCreateInfo *shaderModuleCreateInfo
|
||||
);
|
||||
|
||||
Refresh_Texture* (*CreateTexture)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_TextureCreateInfo *textureCreateInfo
|
||||
);
|
||||
|
||||
Refresh_Buffer* (*CreateBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_BufferUsageFlags usageFlags,
|
||||
uint32_t sizeInBytes
|
||||
);
|
||||
|
||||
/* Setters */
|
||||
|
||||
void (*SetTextureData)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
void *data,
|
||||
uint32_t dataLengthInBytes
|
||||
);
|
||||
|
||||
void (*SetTextureDataYUV)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer* commandBuffer,
|
||||
Refresh_Texture *y,
|
||||
Refresh_Texture *u,
|
||||
Refresh_Texture *v,
|
||||
uint32_t yWidth,
|
||||
uint32_t yHeight,
|
||||
uint32_t uvWidth,
|
||||
uint32_t uvHeight,
|
||||
void *yDataPtr,
|
||||
void *uDataPtr,
|
||||
void *vDataPtr,
|
||||
uint32_t yDataLength,
|
||||
uint32_t uvDataLength,
|
||||
uint32_t yStride,
|
||||
uint32_t uvStride
|
||||
);
|
||||
|
||||
void (*CopyTextureToTexture)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *sourceTextureSlice,
|
||||
Refresh_TextureSlice *destinationTextureSlice,
|
||||
Refresh_Filter filter
|
||||
);
|
||||
|
||||
void (*CopyTextureToBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureSlice *textureSlice,
|
||||
Refresh_Buffer *buffer
|
||||
);
|
||||
|
||||
void (*SetBufferData)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Buffer *buffer,
|
||||
uint32_t offsetInBytes,
|
||||
void* data,
|
||||
uint32_t dataLength
|
||||
);
|
||||
|
||||
uint32_t (*PushVertexShaderUniforms)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
void *data,
|
||||
uint32_t dataLengthInBytes
|
||||
);
|
||||
|
||||
uint32_t (*PushFragmentShaderUniforms)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
void *data,
|
||||
uint32_t dataLengthInBytes
|
||||
);
|
||||
|
||||
uint32_t (*PushComputeShaderUniforms)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
void *data,
|
||||
uint32_t dataLengthInBytes
|
||||
);
|
||||
|
||||
void (*BindVertexSamplers)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Texture **pTextures,
|
||||
Refresh_Sampler **pSamplers
|
||||
);
|
||||
|
||||
void (*BindFragmentSamplers)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Texture **pTextures,
|
||||
Refresh_Sampler **pSamplers
|
||||
);
|
||||
|
||||
/* Getters */
|
||||
|
||||
void (*GetBufferData)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Buffer *buffer,
|
||||
void *data,
|
||||
uint32_t dataLengthInBytes
|
||||
);
|
||||
|
||||
/* Disposal */
|
||||
|
||||
void (*QueueDestroyTexture)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Texture *texture
|
||||
);
|
||||
|
||||
void (*QueueDestroySampler)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Sampler *sampler
|
||||
);
|
||||
|
||||
void (*QueueDestroyBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Buffer *buffer
|
||||
);
|
||||
|
||||
void (*QueueDestroyShaderModule)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_ShaderModule *shaderModule
|
||||
);
|
||||
|
||||
void (*QueueDestroyComputePipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_ComputePipeline *computePipeline
|
||||
);
|
||||
|
||||
void (*QueueDestroyGraphicsPipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_GraphicsPipeline *graphicsPipeline
|
||||
);
|
||||
|
||||
/* Graphics State */
|
||||
|
||||
void (*BeginRenderPass)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
||||
uint32_t colorAttachmentCount,
|
||||
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
||||
);
|
||||
|
||||
void (*EndRenderPass)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer
|
||||
);
|
||||
|
||||
void (*SetViewport)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Viewport *viewport
|
||||
);
|
||||
|
||||
void (*SetScissor)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Rect *scissor
|
||||
);
|
||||
|
||||
void (*BindGraphicsPipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GraphicsPipeline *graphicsPipeline
|
||||
);
|
||||
|
||||
void (*BindVertexBuffers)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
uint32_t firstBinding,
|
||||
uint32_t bindingCount,
|
||||
Refresh_Buffer **pBuffers,
|
||||
uint64_t *pOffsets
|
||||
);
|
||||
|
||||
void (*BindIndexBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Buffer *buffer,
|
||||
uint64_t offset,
|
||||
Refresh_IndexElementSize indexElementSize
|
||||
);
|
||||
|
||||
void (*BindComputePipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_ComputePipeline *computePipeline
|
||||
);
|
||||
|
||||
void (*BindComputeBuffers)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Buffer **pBuffers
|
||||
);
|
||||
|
||||
void (*BindComputeTextures)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Texture **pTextures
|
||||
);
|
||||
|
||||
uint8_t (*ClaimWindow)(
|
||||
Refresh_Renderer *driverData,
|
||||
void *windowHandle,
|
||||
Refresh_PresentMode presentMode
|
||||
);
|
||||
|
||||
void (*UnclaimWindow)(
|
||||
Refresh_Renderer *driverData,
|
||||
void *windowHandle
|
||||
);
|
||||
|
||||
Refresh_CommandBuffer* (*AcquireCommandBuffer)(
|
||||
Refresh_Renderer *driverData
|
||||
);
|
||||
|
||||
Refresh_Texture* (*AcquireSwapchainTexture)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
void *windowHandle,
|
||||
uint32_t *pWidth,
|
||||
uint32_t *pHeight
|
||||
);
|
||||
|
||||
Refresh_TextureFormat (*GetSwapchainFormat)(
|
||||
Refresh_Renderer *driverData,
|
||||
void *windowHandle
|
||||
);
|
||||
|
||||
void (*SetSwapchainPresentMode)(
|
||||
Refresh_Renderer *driverData,
|
||||
void *windowHandle,
|
||||
Refresh_PresentMode presentMode
|
||||
);
|
||||
|
||||
void (*Submit)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer
|
||||
);
|
||||
|
||||
Refresh_Fence* (*SubmitAndAcquireFence)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_CommandBuffer *commandBuffer
|
||||
);
|
||||
|
||||
void (*Wait)(
|
||||
Refresh_Renderer *driverData
|
||||
);
|
||||
|
||||
void (*WaitForFences)(
|
||||
Refresh_Renderer *driverData,
|
||||
uint8_t waitAll,
|
||||
uint32_t fenceCount,
|
||||
Refresh_Fence **pFences
|
||||
);
|
||||
|
||||
int (*QueryFence)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Fence *fence
|
||||
);
|
||||
|
||||
void (*ReleaseFence)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Fence *fence
|
||||
);
|
||||
|
||||
/* Opaque pointer for the Driver */
|
||||
Refresh_Renderer *driverData;
|
||||
};
|
||||
|
||||
#define ASSIGN_DRIVER_FUNC(func, name) \
|
||||
result->func = name##_##func;
|
||||
#define ASSIGN_DRIVER(name) \
|
||||
ASSIGN_DRIVER_FUNC(DestroyDevice, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawIndexedPrimitives, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawInstancedPrimitives, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawPrimitives, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawPrimitivesIndirect, name) \
|
||||
ASSIGN_DRIVER_FUNC(DispatchCompute, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateSampler, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateShaderModule, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetTextureData, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetTextureDataYUV, name) \
|
||||
ASSIGN_DRIVER_FUNC(CopyTextureToTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(CopyTextureToBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetBufferData, name) \
|
||||
ASSIGN_DRIVER_FUNC(PushVertexShaderUniforms, name) \
|
||||
ASSIGN_DRIVER_FUNC(PushFragmentShaderUniforms, name) \
|
||||
ASSIGN_DRIVER_FUNC(PushComputeShaderUniforms, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindVertexSamplers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindFragmentSamplers, name) \
|
||||
ASSIGN_DRIVER_FUNC(GetBufferData, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroySampler, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyShaderModule, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueueDestroyGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(BeginRenderPass, name) \
|
||||
ASSIGN_DRIVER_FUNC(EndRenderPass, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetViewport, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetScissor, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindVertexBuffers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindIndexBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindComputeBuffers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindComputeTextures, name) \
|
||||
ASSIGN_DRIVER_FUNC(ClaimWindow, name) \
|
||||
ASSIGN_DRIVER_FUNC(UnclaimWindow, name) \
|
||||
ASSIGN_DRIVER_FUNC(AcquireCommandBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(AcquireSwapchainTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(GetSwapchainFormat, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetSwapchainPresentMode, name) \
|
||||
ASSIGN_DRIVER_FUNC(Submit, name) \
|
||||
ASSIGN_DRIVER_FUNC(SubmitAndAcquireFence, name) \
|
||||
ASSIGN_DRIVER_FUNC(Wait, name) \
|
||||
ASSIGN_DRIVER_FUNC(WaitForFences, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueryFence, name) \
|
||||
ASSIGN_DRIVER_FUNC(ReleaseFence, name)
|
||||
|
||||
typedef struct Refresh_Driver
|
||||
{
|
||||
const char *Name;
|
||||
uint8_t (*PrepareDriver)(uint32_t *flags);
|
||||
Refresh_Device* (*CreateDevice)(
|
||||
uint8_t debugMode
|
||||
);
|
||||
} Refresh_Driver;
|
||||
|
||||
extern Refresh_Driver VulkanDriver;
|
||||
extern Refresh_Driver PS5Driver;
|
||||
|
||||
#endif /* REFRESH_DRIVER_H */
|
||||
|
||||
/* vim: set noexpandtab shiftwidth=8 tabstop=8: */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,818 @@
|
|||
/* Refresh - a cross-platform hardware-accelerated graphics library with modern capabilities
|
||||
*
|
||||
* Copyright (c) 2020-2024 Evan Hemsley
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
* the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software in a
|
||||
* product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* Evan "cosmonaut" Hemsley <evan@moonside.games>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef REFRESH_DRIVER_H
|
||||
#define REFRESH_DRIVER_H
|
||||
|
||||
#include "Refresh.h"
|
||||
|
||||
/* Common Struct */
|
||||
|
||||
typedef struct Pass
|
||||
{
|
||||
Refresh_CommandBuffer *commandBuffer;
|
||||
SDL_bool inProgress;
|
||||
} Pass;
|
||||
|
||||
typedef struct CommandBufferCommonHeader
|
||||
{
|
||||
Refresh_Device *device;
|
||||
Pass renderPass;
|
||||
SDL_bool graphicsPipelineBound;
|
||||
Pass computePass;
|
||||
SDL_bool computePipelineBound;
|
||||
Pass copyPass;
|
||||
SDL_bool submitted;
|
||||
} CommandBufferCommonHeader;
|
||||
|
||||
/* Internal Helper Utilities */
|
||||
|
||||
static inline Sint32 Texture_GetBlockSize(
|
||||
Refresh_TextureFormat format
|
||||
) {
|
||||
switch (format)
|
||||
{
|
||||
case REFRESH_TEXTUREFORMAT_BC1:
|
||||
case REFRESH_TEXTUREFORMAT_BC2:
|
||||
case REFRESH_TEXTUREFORMAT_BC3:
|
||||
case REFRESH_TEXTUREFORMAT_BC7:
|
||||
case REFRESH_TEXTUREFORMAT_BC3_SRGB:
|
||||
case REFRESH_TEXTUREFORMAT_BC7_SRGB:
|
||||
return 4;
|
||||
case REFRESH_TEXTUREFORMAT_R8:
|
||||
case REFRESH_TEXTUREFORMAT_A8:
|
||||
case REFRESH_TEXTUREFORMAT_R8_UINT:
|
||||
case REFRESH_TEXTUREFORMAT_R5G6B5:
|
||||
case REFRESH_TEXTUREFORMAT_B4G4R4A4:
|
||||
case REFRESH_TEXTUREFORMAT_A1R5G5B5:
|
||||
case REFRESH_TEXTUREFORMAT_R16_SFLOAT:
|
||||
case REFRESH_TEXTUREFORMAT_R8G8_SNORM:
|
||||
case REFRESH_TEXTUREFORMAT_R8G8_UINT:
|
||||
case REFRESH_TEXTUREFORMAT_R16_UINT:
|
||||
case REFRESH_TEXTUREFORMAT_R8G8B8A8:
|
||||
case REFRESH_TEXTUREFORMAT_R32_SFLOAT:
|
||||
case REFRESH_TEXTUREFORMAT_R16G16_SFLOAT:
|
||||
case REFRESH_TEXTUREFORMAT_R8G8B8A8_SNORM:
|
||||
case REFRESH_TEXTUREFORMAT_R8G8B8A8_SRGB:
|
||||
case REFRESH_TEXTUREFORMAT_B8G8R8A8_SRGB:
|
||||
case REFRESH_TEXTUREFORMAT_A2R10G10B10:
|
||||
case REFRESH_TEXTUREFORMAT_R8G8B8A8_UINT:
|
||||
case REFRESH_TEXTUREFORMAT_R16G16_UINT:
|
||||
case REFRESH_TEXTUREFORMAT_R16G16B16A16_SFLOAT:
|
||||
case REFRESH_TEXTUREFORMAT_R16G16B16A16:
|
||||
case REFRESH_TEXTUREFORMAT_R32G32_SFLOAT:
|
||||
case REFRESH_TEXTUREFORMAT_R16G16B16A16_UINT:
|
||||
case REFRESH_TEXTUREFORMAT_R32G32B32A32_SFLOAT:
|
||||
return 1;
|
||||
default:
|
||||
SDL_LogError(
|
||||
SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unrecognized TextureFormat!"
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline SDL_bool IsDepthFormat(
|
||||
Refresh_TextureFormat format
|
||||
) {
|
||||
switch (format)
|
||||
{
|
||||
case REFRESH_TEXTUREFORMAT_D16_UNORM:
|
||||
case REFRESH_TEXTUREFORMAT_D24_UNORM:
|
||||
case REFRESH_TEXTUREFORMAT_D32_SFLOAT:
|
||||
case REFRESH_TEXTUREFORMAT_D24_UNORM_S8_UINT:
|
||||
case REFRESH_TEXTUREFORMAT_D32_SFLOAT_S8_UINT:
|
||||
return SDL_TRUE;
|
||||
|
||||
default:
|
||||
return SDL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static inline SDL_bool IsStencilFormat(
|
||||
Refresh_TextureFormat format
|
||||
) {
|
||||
switch (format)
|
||||
{
|
||||
case REFRESH_TEXTUREFORMAT_D24_UNORM_S8_UINT:
|
||||
case REFRESH_TEXTUREFORMAT_D32_SFLOAT_S8_UINT:
|
||||
return SDL_TRUE;
|
||||
|
||||
default:
|
||||
return SDL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static inline Uint32 PrimitiveVerts(
|
||||
Refresh_PrimitiveType primitiveType,
|
||||
Uint32 primitiveCount
|
||||
) {
|
||||
switch (primitiveType)
|
||||
{
|
||||
case REFRESH_PRIMITIVETYPE_TRIANGLELIST:
|
||||
return primitiveCount * 3;
|
||||
case REFRESH_PRIMITIVETYPE_TRIANGLESTRIP:
|
||||
return primitiveCount + 2;
|
||||
case REFRESH_PRIMITIVETYPE_LINELIST:
|
||||
return primitiveCount * 2;
|
||||
case REFRESH_PRIMITIVETYPE_LINESTRIP:
|
||||
return primitiveCount + 1;
|
||||
case REFRESH_PRIMITIVETYPE_POINTLIST:
|
||||
return primitiveCount;
|
||||
default:
|
||||
SDL_LogError(
|
||||
SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Unrecognized primitive type!"
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline Uint32 IndexSize(Refresh_IndexElementSize size)
|
||||
{
|
||||
return (size == REFRESH_INDEXELEMENTSIZE_16BIT) ? 2 : 4;
|
||||
}
|
||||
|
||||
static inline Uint32 BytesPerRow(
|
||||
Sint32 width,
|
||||
Refresh_TextureFormat format
|
||||
) {
|
||||
Uint32 blocksPerRow = width;
|
||||
|
||||
if ( format == REFRESH_TEXTUREFORMAT_BC1 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC2 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC3 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC7 )
|
||||
{
|
||||
blocksPerRow = (width + 3) / 4;
|
||||
}
|
||||
|
||||
return blocksPerRow * Refresh_TextureFormatTexelBlockSize(format);
|
||||
}
|
||||
|
||||
static inline Sint32 BytesPerImage(
|
||||
Uint32 width,
|
||||
Uint32 height,
|
||||
Refresh_TextureFormat format
|
||||
) {
|
||||
Uint32 blocksPerRow = width;
|
||||
Uint32 blocksPerColumn = height;
|
||||
|
||||
if ( format == REFRESH_TEXTUREFORMAT_BC1 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC2 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC3 ||
|
||||
format == REFRESH_TEXTUREFORMAT_BC7 )
|
||||
{
|
||||
blocksPerRow = (width + 3) / 4;
|
||||
blocksPerColumn = (height + 3) / 4;
|
||||
}
|
||||
|
||||
return blocksPerRow * blocksPerColumn * Refresh_TextureFormatTexelBlockSize(format);
|
||||
}
|
||||
|
||||
/* GraphicsDevice Limits */
|
||||
|
||||
#define MAX_TEXTURE_SAMPLERS_PER_STAGE 16
|
||||
#define MAX_STORAGE_TEXTURES_PER_STAGE 8
|
||||
#define MAX_STORAGE_BUFFERS_PER_STAGE 8
|
||||
#define MAX_UNIFORM_BUFFERS_PER_STAGE 14
|
||||
#define MAX_BUFFER_BINDINGS 16
|
||||
#define MAX_COLOR_TARGET_BINDINGS 4
|
||||
#define MAX_PRESENT_COUNT 16
|
||||
#define MAX_FRAMES_IN_FLIGHT 3
|
||||
|
||||
/* Refresh_Device Definition */
|
||||
|
||||
typedef struct Refresh_Renderer Refresh_Renderer;
|
||||
|
||||
struct Refresh_Device
|
||||
{
|
||||
/* Quit */
|
||||
|
||||
void (*DestroyDevice)(Refresh_Device *device);
|
||||
|
||||
/* State Creation */
|
||||
|
||||
Refresh_ComputePipeline* (*CreateComputePipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_ComputePipelineCreateInfo *pipelineCreateInfo
|
||||
);
|
||||
|
||||
Refresh_GraphicsPipeline* (*CreateGraphicsPipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_GraphicsPipelineCreateInfo *pipelineCreateInfo
|
||||
);
|
||||
|
||||
Refresh_Sampler* (*CreateSampler)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_SamplerCreateInfo *samplerCreateInfo
|
||||
);
|
||||
|
||||
Refresh_Shader* (*CreateShader)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_ShaderCreateInfo *shaderCreateInfo
|
||||
);
|
||||
|
||||
Refresh_Texture* (*CreateTexture)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_TextureCreateInfo *textureCreateInfo
|
||||
);
|
||||
|
||||
Refresh_Buffer* (*CreateBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_BufferUsageFlags usageFlags,
|
||||
Uint32 sizeInBytes
|
||||
);
|
||||
|
||||
Refresh_TransferBuffer* (*CreateTransferBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_TransferUsage usage,
|
||||
Refresh_TransferBufferMapFlags mapFlags,
|
||||
Uint32 sizeInBytes
|
||||
);
|
||||
|
||||
Refresh_OcclusionQuery* (*CreateOcclusionQuery)(
|
||||
Refresh_Renderer *driverData
|
||||
);
|
||||
|
||||
/* Debug Naming */
|
||||
|
||||
void (*SetBufferName)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Buffer *buffer,
|
||||
const char *text
|
||||
);
|
||||
|
||||
void (*SetTextureName)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Texture *texture,
|
||||
const char *text
|
||||
);
|
||||
|
||||
void (*SetStringMarker)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
const char *text
|
||||
);
|
||||
|
||||
/* Disposal */
|
||||
|
||||
void (*ReleaseTexture)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Texture *texture
|
||||
);
|
||||
|
||||
void (*ReleaseSampler)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Sampler *sampler
|
||||
);
|
||||
|
||||
void (*ReleaseBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Buffer *buffer
|
||||
);
|
||||
|
||||
void (*ReleaseTransferBuffer)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_TransferBuffer *transferBuffer
|
||||
);
|
||||
|
||||
void (*ReleaseShader)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Shader *shader
|
||||
);
|
||||
|
||||
void (*ReleaseComputePipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_ComputePipeline *computePipeline
|
||||
);
|
||||
|
||||
void (*ReleaseGraphicsPipeline)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_GraphicsPipeline *graphicsPipeline
|
||||
);
|
||||
|
||||
void (*ReleaseOcclusionQuery)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_OcclusionQuery *query
|
||||
);
|
||||
|
||||
/* Render Pass */
|
||||
|
||||
void (*BeginRenderPass)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_ColorAttachmentInfo *colorAttachmentInfos,
|
||||
Uint32 colorAttachmentCount,
|
||||
Refresh_DepthStencilAttachmentInfo *depthStencilAttachmentInfo
|
||||
);
|
||||
|
||||
void (*BindGraphicsPipeline)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_GraphicsPipeline *graphicsPipeline
|
||||
);
|
||||
|
||||
void (*SetViewport)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Viewport *viewport
|
||||
);
|
||||
|
||||
void (*SetScissor)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Rect *scissor
|
||||
);
|
||||
|
||||
void (*BindVertexBuffers)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 firstBinding,
|
||||
Refresh_BufferBinding *pBindings,
|
||||
Uint32 bindingCount
|
||||
);
|
||||
|
||||
void (*BindIndexBuffer)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_BufferBinding *pBinding,
|
||||
Refresh_IndexElementSize indexElementSize
|
||||
);
|
||||
|
||||
void (*BindVertexSamplers)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 firstSlot,
|
||||
Refresh_TextureSamplerBinding *textureSamplerBindings,
|
||||
Uint32 bindingCount
|
||||
);
|
||||
|
||||
void (*BindVertexStorageTextures)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 firstSlot,
|
||||
Refresh_TextureSlice *storageTextureSlices,
|
||||
Uint32 bindingCount
|
||||
);
|
||||
|
||||
void (*BindVertexStorageBuffers)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 firstSlot,
|
||||
Refresh_Buffer **storageBuffers,
|
||||
Uint32 bindingCount
|
||||
);
|
||||
|
||||
void (*BindFragmentSamplers)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 firstSlot,
|
||||
Refresh_TextureSamplerBinding *textureSamplerBindings,
|
||||
Uint32 bindingCount
|
||||
);
|
||||
|
||||
void (*BindFragmentStorageTextures)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 firstSlot,
|
||||
Refresh_TextureSlice *storageTextureSlices,
|
||||
Uint32 bindingCount
|
||||
);
|
||||
|
||||
void (*BindFragmentStorageBuffers)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 firstSlot,
|
||||
Refresh_Buffer **storageBuffers,
|
||||
Uint32 bindingCount
|
||||
);
|
||||
|
||||
void (*PushVertexUniformData)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 slotIndex,
|
||||
void *data,
|
||||
Uint32 dataLengthInBytes
|
||||
);
|
||||
|
||||
void (*PushFragmentUniformData)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 slotIndex,
|
||||
void *data,
|
||||
Uint32 dataLengthInBytes
|
||||
);
|
||||
|
||||
void (*DrawIndexedPrimitives)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 baseVertex,
|
||||
Uint32 startIndex,
|
||||
Uint32 primitiveCount,
|
||||
Uint32 instanceCount
|
||||
);
|
||||
|
||||
void (*DrawPrimitives)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 vertexStart,
|
||||
Uint32 primitiveCount
|
||||
);
|
||||
|
||||
void (*DrawPrimitivesIndirect)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Buffer *buffer,
|
||||
Uint32 offsetInBytes,
|
||||
Uint32 drawCount,
|
||||
Uint32 stride
|
||||
);
|
||||
|
||||
void (*DrawIndexedPrimitivesIndirect)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Buffer *buffer,
|
||||
Uint32 offsetInBytes,
|
||||
Uint32 drawCount,
|
||||
Uint32 stride
|
||||
);
|
||||
|
||||
void (*EndRenderPass)(
|
||||
Refresh_CommandBuffer *commandBuffer
|
||||
);
|
||||
|
||||
/* Compute Pass */
|
||||
|
||||
void (*BeginComputePass)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_StorageTextureReadWriteBinding *storageTextureBindings,
|
||||
Uint32 storageTextureBindingCount,
|
||||
Refresh_StorageBufferReadWriteBinding *storageBufferBindings,
|
||||
Uint32 storageBufferBindingCount
|
||||
);
|
||||
|
||||
void (*BindComputePipeline)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_ComputePipeline *computePipeline
|
||||
);
|
||||
|
||||
void (*BindComputeStorageTextures)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 firstSlot,
|
||||
Refresh_TextureSlice *storageTextureSlices,
|
||||
Uint32 bindingCount
|
||||
);
|
||||
|
||||
void (*BindComputeStorageBuffers)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 firstSlot,
|
||||
Refresh_Buffer **storageBuffers,
|
||||
Uint32 bindingCount
|
||||
);
|
||||
|
||||
void (*PushComputeUniformData)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 slotIndex,
|
||||
void *data,
|
||||
Uint32 dataLengthInBytes
|
||||
);
|
||||
|
||||
void (*DispatchCompute)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Uint32 groupCountX,
|
||||
Uint32 groupCountY,
|
||||
Uint32 groupCountZ
|
||||
);
|
||||
|
||||
void (*EndComputePass)(
|
||||
Refresh_CommandBuffer *commandBuffer
|
||||
);
|
||||
|
||||
/* TransferBuffer Data */
|
||||
|
||||
void (*MapTransferBuffer)(
|
||||
Refresh_Renderer *device,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
SDL_bool cycle,
|
||||
void **ppData
|
||||
);
|
||||
|
||||
void (*UnmapTransferBuffer)(
|
||||
Refresh_Renderer *device,
|
||||
Refresh_TransferBuffer *transferBuffer
|
||||
);
|
||||
|
||||
void (*SetTransferData)(
|
||||
Refresh_Renderer *driverData,
|
||||
void* data,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_BufferCopy *copyParams,
|
||||
SDL_bool cycle
|
||||
);
|
||||
|
||||
void (*GetTransferData)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
void* data,
|
||||
Refresh_BufferCopy *copyParams
|
||||
);
|
||||
|
||||
/* Copy Pass */
|
||||
|
||||
void (*BeginCopyPass)(
|
||||
Refresh_CommandBuffer *commandBuffer
|
||||
);
|
||||
|
||||
void (*UploadToTexture)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_TextureRegion *textureSlice,
|
||||
Refresh_BufferImageCopy *copyParams,
|
||||
SDL_bool cycle
|
||||
);
|
||||
|
||||
void (*UploadToBuffer)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_Buffer *buffer,
|
||||
Refresh_BufferCopy *copyParams,
|
||||
SDL_bool cycle
|
||||
);
|
||||
|
||||
void (*CopyTextureToTexture)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureRegion *source,
|
||||
Refresh_TextureRegion *destination,
|
||||
SDL_bool cycle
|
||||
);
|
||||
|
||||
void (*CopyBufferToBuffer)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Buffer *source,
|
||||
Refresh_Buffer *destination,
|
||||
Refresh_BufferCopy *copyParams,
|
||||
SDL_bool cycle
|
||||
);
|
||||
|
||||
void (*GenerateMipmaps)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Texture *texture
|
||||
);
|
||||
|
||||
void (*DownloadFromTexture)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureRegion *textureSlice,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_BufferImageCopy *copyParams
|
||||
);
|
||||
|
||||
void (*DownloadFromBuffer)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_Buffer *buffer,
|
||||
Refresh_TransferBuffer *transferBuffer,
|
||||
Refresh_BufferCopy *copyParams
|
||||
);
|
||||
|
||||
void (*EndCopyPass)(
|
||||
Refresh_CommandBuffer *commandBuffer
|
||||
);
|
||||
|
||||
void (*Blit)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_TextureRegion *source,
|
||||
Refresh_TextureRegion *destination,
|
||||
Refresh_Filter filterMode,
|
||||
SDL_bool cycle
|
||||
);
|
||||
|
||||
/* Submission/Presentation */
|
||||
|
||||
SDL_bool (*SupportsSwapchainComposition)(
|
||||
Refresh_Renderer *driverData,
|
||||
SDL_Window *window,
|
||||
Refresh_SwapchainComposition swapchainComposition
|
||||
);
|
||||
|
||||
SDL_bool (*SupportsPresentMode)(
|
||||
Refresh_Renderer *driverData,
|
||||
SDL_Window *window,
|
||||
Refresh_PresentMode presentMode
|
||||
);
|
||||
|
||||
SDL_bool (*ClaimWindow)(
|
||||
Refresh_Renderer *driverData,
|
||||
SDL_Window *window,
|
||||
Refresh_SwapchainComposition swapchainComposition,
|
||||
Refresh_PresentMode presentMode
|
||||
);
|
||||
|
||||
void (*UnclaimWindow)(
|
||||
Refresh_Renderer *driverData,
|
||||
SDL_Window *window
|
||||
);
|
||||
|
||||
void (*SetSwapchainParameters)(
|
||||
Refresh_Renderer *driverData,
|
||||
SDL_Window *window,
|
||||
Refresh_SwapchainComposition swapchainComposition,
|
||||
Refresh_PresentMode presentMode
|
||||
);
|
||||
|
||||
Refresh_TextureFormat (*GetSwapchainTextureFormat)(
|
||||
Refresh_Renderer *driverData,
|
||||
SDL_Window *window
|
||||
);
|
||||
|
||||
Refresh_CommandBuffer* (*AcquireCommandBuffer)(
|
||||
Refresh_Renderer *driverData
|
||||
);
|
||||
|
||||
Refresh_Texture* (*AcquireSwapchainTexture)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
SDL_Window *window,
|
||||
Uint32 *pWidth,
|
||||
Uint32 *pHeight
|
||||
);
|
||||
|
||||
void (*Submit)(
|
||||
Refresh_CommandBuffer *commandBuffer
|
||||
);
|
||||
|
||||
Refresh_Fence* (*SubmitAndAcquireFence)(
|
||||
Refresh_CommandBuffer *commandBuffer
|
||||
);
|
||||
|
||||
void (*Wait)(
|
||||
Refresh_Renderer *driverData
|
||||
);
|
||||
|
||||
void (*WaitForFences)(
|
||||
Refresh_Renderer *driverData,
|
||||
SDL_bool waitAll,
|
||||
Uint32 fenceCount,
|
||||
Refresh_Fence **pFences
|
||||
);
|
||||
|
||||
SDL_bool (*QueryFence)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Fence *fence
|
||||
);
|
||||
|
||||
void (*ReleaseFence)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_Fence *fence
|
||||
);
|
||||
|
||||
/* Queries */
|
||||
|
||||
void (*OcclusionQueryBegin)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_OcclusionQuery *query
|
||||
);
|
||||
|
||||
void (*OcclusionQueryEnd)(
|
||||
Refresh_CommandBuffer *commandBuffer,
|
||||
Refresh_OcclusionQuery *query
|
||||
);
|
||||
|
||||
SDL_bool (*OcclusionQueryPixelCount)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_OcclusionQuery *query,
|
||||
Uint32 *pixelCount
|
||||
);
|
||||
|
||||
/* Feature Queries */
|
||||
|
||||
SDL_bool (*IsTextureFormatSupported)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_TextureFormat format,
|
||||
Refresh_TextureType type,
|
||||
Refresh_TextureUsageFlags usage
|
||||
);
|
||||
|
||||
Refresh_SampleCount (*GetBestSampleCount)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_TextureFormat format,
|
||||
Refresh_SampleCount desiredSampleCount
|
||||
);
|
||||
|
||||
/* SPIR-V Cross Interop */
|
||||
|
||||
Refresh_Shader* (*CompileFromSPIRVCross)(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_ShaderStage shader_stage,
|
||||
const char *entryPointName,
|
||||
const char *source
|
||||
);
|
||||
|
||||
/* Opaque pointer for the Driver */
|
||||
Refresh_Renderer *driverData;
|
||||
|
||||
/* Store this for Refresh_GetBackend() */
|
||||
Refresh_Backend backend;
|
||||
};
|
||||
|
||||
#define ASSIGN_DRIVER_FUNC(func, name) \
|
||||
result->func = name##_##func;
|
||||
#define ASSIGN_DRIVER(name) \
|
||||
ASSIGN_DRIVER_FUNC(DestroyDevice, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateSampler, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateShader, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateTransferBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateOcclusionQuery, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetBufferName, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetTextureName, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetStringMarker, name) \
|
||||
ASSIGN_DRIVER_FUNC(ReleaseTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(ReleaseSampler, name) \
|
||||
ASSIGN_DRIVER_FUNC(ReleaseBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(ReleaseTransferBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(ReleaseShader, name) \
|
||||
ASSIGN_DRIVER_FUNC(ReleaseComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(ReleaseGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(ReleaseOcclusionQuery, name) \
|
||||
ASSIGN_DRIVER_FUNC(BeginRenderPass, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetViewport, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetScissor, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindVertexBuffers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindIndexBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindVertexSamplers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindVertexStorageTextures, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindVertexStorageBuffers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindFragmentSamplers, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindFragmentStorageTextures, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindFragmentStorageBuffers, name) \
|
||||
ASSIGN_DRIVER_FUNC(PushVertexUniformData, name) \
|
||||
ASSIGN_DRIVER_FUNC(PushFragmentUniformData, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawIndexedPrimitives, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawPrimitives, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawPrimitivesIndirect, name) \
|
||||
ASSIGN_DRIVER_FUNC(DrawIndexedPrimitivesIndirect, name) \
|
||||
ASSIGN_DRIVER_FUNC(EndRenderPass, name) \
|
||||
ASSIGN_DRIVER_FUNC(BeginComputePass, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindComputeStorageTextures, name) \
|
||||
ASSIGN_DRIVER_FUNC(BindComputeStorageBuffers, name) \
|
||||
ASSIGN_DRIVER_FUNC(PushComputeUniformData, name) \
|
||||
ASSIGN_DRIVER_FUNC(DispatchCompute, name) \
|
||||
ASSIGN_DRIVER_FUNC(EndComputePass, name) \
|
||||
ASSIGN_DRIVER_FUNC(MapTransferBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(UnmapTransferBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetTransferData, name) \
|
||||
ASSIGN_DRIVER_FUNC(GetTransferData, name) \
|
||||
ASSIGN_DRIVER_FUNC(BeginCopyPass, name) \
|
||||
ASSIGN_DRIVER_FUNC(UploadToTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(UploadToBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(DownloadFromTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(DownloadFromBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(CopyTextureToTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(CopyBufferToBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(GenerateMipmaps, name) \
|
||||
ASSIGN_DRIVER_FUNC(EndCopyPass, name) \
|
||||
ASSIGN_DRIVER_FUNC(Blit, name) \
|
||||
ASSIGN_DRIVER_FUNC(SupportsSwapchainComposition, name) \
|
||||
ASSIGN_DRIVER_FUNC(SupportsPresentMode, name) \
|
||||
ASSIGN_DRIVER_FUNC(ClaimWindow, name) \
|
||||
ASSIGN_DRIVER_FUNC(UnclaimWindow, name) \
|
||||
ASSIGN_DRIVER_FUNC(SetSwapchainParameters, name) \
|
||||
ASSIGN_DRIVER_FUNC(GetSwapchainTextureFormat, name) \
|
||||
ASSIGN_DRIVER_FUNC(AcquireCommandBuffer, name) \
|
||||
ASSIGN_DRIVER_FUNC(AcquireSwapchainTexture, name) \
|
||||
ASSIGN_DRIVER_FUNC(Submit, name) \
|
||||
ASSIGN_DRIVER_FUNC(SubmitAndAcquireFence, name) \
|
||||
ASSIGN_DRIVER_FUNC(Wait, name) \
|
||||
ASSIGN_DRIVER_FUNC(WaitForFences, name) \
|
||||
ASSIGN_DRIVER_FUNC(QueryFence, name) \
|
||||
ASSIGN_DRIVER_FUNC(ReleaseFence, name) \
|
||||
ASSIGN_DRIVER_FUNC(OcclusionQueryBegin, name) \
|
||||
ASSIGN_DRIVER_FUNC(OcclusionQueryEnd, name) \
|
||||
ASSIGN_DRIVER_FUNC(OcclusionQueryPixelCount, name) \
|
||||
ASSIGN_DRIVER_FUNC(IsTextureFormatSupported, name) \
|
||||
ASSIGN_DRIVER_FUNC(GetBestSampleCount, name) \
|
||||
ASSIGN_DRIVER_FUNC(CompileFromSPIRVCross, name)
|
||||
|
||||
typedef struct Refresh_Driver
|
||||
{
|
||||
const char *Name;
|
||||
const Refresh_Backend backendflag;
|
||||
SDL_bool (*PrepareDriver)();
|
||||
Refresh_Device* (*CreateDevice)(SDL_bool debugMode);
|
||||
} Refresh_Driver;
|
||||
|
||||
extern Refresh_Driver VulkanDriver;
|
||||
extern Refresh_Driver D3D11Driver;
|
||||
extern Refresh_Driver MetalDriver;
|
||||
extern Refresh_Driver PS5Driver;
|
||||
|
||||
#endif /* REFRESH_DRIVER_H */
|
|
@ -27,7 +27,7 @@
|
|||
* written by Ethan Lee.
|
||||
*/
|
||||
|
||||
#include "Refresh_Image.h"
|
||||
#include "Refresh_image.h"
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
|
@ -137,6 +137,7 @@ SDL_SIMDRealloc(void *mem, const size_t len)
|
|||
|
||||
#define STB_IMAGE_STATIC
|
||||
#define STBI_NO_HDR
|
||||
#define STBI_NO_GIF
|
||||
#define STBI_ASSERT SDL_assert
|
||||
#define STBI_MALLOC SDL_SIMDAlloc
|
||||
#define STBI_REALLOC SDL_SIMDRealloc
|
|
@ -0,0 +1,168 @@
|
|||
/* Refresh - a cross-platform hardware-accelerated graphics library with modern capabilities
|
||||
*
|
||||
* Copyright (c) 2020-2024 Evan Hemsley
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
* the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software in a
|
||||
* product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* Evan "cosmonaut" Hemsley <evan@moonside.games>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "Refresh_driver.h"
|
||||
#include "Refresh_spirv_c.h"
|
||||
#include "spirv_cross_c.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define SPIRV_CROSS_DLL "spirv-cross-c-shared.dll"
|
||||
#elif defined(__APPLE__)
|
||||
#define SPIRV_CROSS_DLL "libspirv-cross-c-shared.dylib"
|
||||
#else
|
||||
#define SPIRV_CROSS_DLL "libspirv-cross-c-shared.so"
|
||||
#endif
|
||||
|
||||
#define SPVC_ERROR(func) \
|
||||
SDL_SetError(#func " failed: %s", SDL_spvc_context_get_last_error_string(context))
|
||||
|
||||
static void* spirvcross_dll = NULL;
|
||||
|
||||
typedef spvc_result (*pfn_spvc_context_create)(spvc_context *context);
|
||||
typedef void (*pfn_spvc_context_destroy)(spvc_context);
|
||||
typedef spvc_result (*pfn_spvc_context_parse_spirv)(spvc_context, const SpvId*, size_t, spvc_parsed_ir*);
|
||||
typedef spvc_result (*pfn_spvc_context_create_compiler)(spvc_context, spvc_backend, spvc_parsed_ir, spvc_capture_mode, spvc_compiler*);
|
||||
typedef spvc_result (*pfn_spvc_compiler_create_compiler_options)(spvc_compiler, spvc_compiler_options*);
|
||||
typedef spvc_result (*pfn_spvc_compiler_options_set_uint)(spvc_compiler_options, spvc_compiler_option, unsigned);
|
||||
typedef spvc_result (*pfn_spvc_compiler_install_compiler_options)(spvc_compiler, spvc_compiler_options);
|
||||
typedef spvc_result (*pfn_spvc_compiler_compile)(spvc_compiler, const char **);
|
||||
typedef const char *(*pfn_spvc_context_get_last_error_string)(spvc_context);
|
||||
|
||||
static pfn_spvc_context_create SDL_spvc_context_create = NULL;
|
||||
static pfn_spvc_context_destroy SDL_spvc_context_destroy = NULL;
|
||||
static pfn_spvc_context_parse_spirv SDL_spvc_context_parse_spirv = NULL;
|
||||
static pfn_spvc_context_create_compiler SDL_spvc_context_create_compiler = NULL;
|
||||
static pfn_spvc_compiler_create_compiler_options SDL_spvc_compiler_create_compiler_options = NULL;
|
||||
static pfn_spvc_compiler_options_set_uint SDL_spvc_compiler_options_set_uint = NULL;
|
||||
static pfn_spvc_compiler_install_compiler_options SDL_spvc_compiler_install_compiler_options = NULL;
|
||||
static pfn_spvc_compiler_compile SDL_spvc_compiler_compile = NULL;
|
||||
static pfn_spvc_context_get_last_error_string SDL_spvc_context_get_last_error_string = NULL;
|
||||
|
||||
Refresh_Shader* SDL_CreateShaderFromSPIRV(Refresh_Device *device, Refresh_ShaderCreateInfo *createInfo)
|
||||
{
|
||||
Refresh_Shader *shader;
|
||||
spvc_result result;
|
||||
spvc_backend backend;
|
||||
spvc_context context = NULL;
|
||||
spvc_parsed_ir ir = NULL;
|
||||
spvc_compiler compiler = NULL;
|
||||
spvc_compiler_options options = NULL;
|
||||
const char* translated = NULL;
|
||||
|
||||
switch (Refresh_GetBackend(device))
|
||||
{
|
||||
case REFRESH_BACKEND_D3D11: backend = SPVC_BACKEND_HLSL; break;
|
||||
case REFRESH_BACKEND_METAL: backend = SPVC_BACKEND_MSL; break;
|
||||
default:
|
||||
SDL_SetError("SDL_CreateShaderFromSPIRV: Unexpected Refresh_Backend");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* FIXME: spirv-cross could probably be loaded in a better spot */
|
||||
if (spirvcross_dll == NULL) {
|
||||
spirvcross_dll = SDL_LoadObject(SPIRV_CROSS_DLL);
|
||||
if (spirvcross_dll == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#define CHECK_FUNC(func) \
|
||||
if (SDL_##func == NULL) { \
|
||||
SDL_##func = (pfn_##func) SDL_LoadFunction(spirvcross_dll, #func); \
|
||||
if (SDL_##func == NULL) { \
|
||||
return NULL; \
|
||||
} \
|
||||
}
|
||||
CHECK_FUNC(spvc_context_create)
|
||||
CHECK_FUNC(spvc_context_destroy)
|
||||
CHECK_FUNC(spvc_context_parse_spirv)
|
||||
CHECK_FUNC(spvc_context_create_compiler)
|
||||
CHECK_FUNC(spvc_compiler_create_compiler_options)
|
||||
CHECK_FUNC(spvc_compiler_options_set_uint)
|
||||
CHECK_FUNC(spvc_compiler_install_compiler_options)
|
||||
CHECK_FUNC(spvc_compiler_compile)
|
||||
CHECK_FUNC(spvc_context_get_last_error_string)
|
||||
#undef CHECK_FUNC
|
||||
|
||||
/* Create the SPIRV-Cross context */
|
||||
result = SDL_spvc_context_create(&context);
|
||||
if (result < 0) {
|
||||
SDL_SetError("spvc_context_create failed: %X", result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Parse the SPIR-V into IR */
|
||||
result = SDL_spvc_context_parse_spirv(context, (const SpvId*) createInfo->code, createInfo->codeSize / sizeof(SpvId), &ir);
|
||||
if (result < 0) {
|
||||
SPVC_ERROR(spvc_context_parse_spirv);
|
||||
SDL_spvc_context_destroy(context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Create the cross-compiler */
|
||||
result = SDL_spvc_context_create_compiler(context, backend, ir, SPVC_CAPTURE_MODE_TAKE_OWNERSHIP, &compiler);
|
||||
if (result < 0) {
|
||||
SPVC_ERROR(spvc_context_create_compiler);
|
||||
SDL_spvc_context_destroy(context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Set up the cross-compiler options */
|
||||
result = SDL_spvc_compiler_create_compiler_options(compiler, &options);
|
||||
if (result < 0) {
|
||||
SPVC_ERROR(spvc_compiler_create_compiler_options);
|
||||
SDL_spvc_context_destroy(context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (backend == SPVC_BACKEND_HLSL) {
|
||||
SDL_spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_HLSL_SHADER_MODEL, 50);
|
||||
SDL_spvc_compiler_options_set_uint(options, SPVC_COMPILER_OPTION_HLSL_NONWRITABLE_UAV_TEXTURE_AS_SRV, 1);
|
||||
}
|
||||
|
||||
result = SDL_spvc_compiler_install_compiler_options(compiler, options);
|
||||
if (result < 0) {
|
||||
SPVC_ERROR(spvc_compiler_install_compiler_options);
|
||||
SDL_spvc_context_destroy(context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Compile to the target shader language */
|
||||
result = SDL_spvc_compiler_compile(compiler, &translated);
|
||||
if (result < 0) {
|
||||
SPVC_ERROR(spvc_compiler_compile);
|
||||
SDL_spvc_context_destroy(context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Compile the shader */
|
||||
shader = device->CompileFromSPIRVCross(device->driverData, createInfo->stage, createInfo->entryPointName, translated);
|
||||
|
||||
/* Clean up */
|
||||
SDL_spvc_context_destroy(context);
|
||||
|
||||
return shader;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/* Refresh - a cross-platform hardware-accelerated graphics library with modern capabilities
|
||||
*
|
||||
* Copyright (c) 2020-2024 Evan Hemsley
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
* the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software in a
|
||||
* product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* Evan "cosmonaut" Hemsley <evan@moonside.games>
|
||||
*
|
||||
*/
|
||||
#include <SDL.h>
|
||||
|
||||
extern Refresh_Shader* SDL_CreateShaderFromSPIRV(
|
||||
Refresh_Device *device,
|
||||
Refresh_ShaderCreateInfo *createInfo
|
||||
);
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,207 @@
|
|||
/* Refresh - a cross-platform hardware-accelerated graphics library with modern capabilities
|
||||
*
|
||||
* Copyright (c) 2020-2024 Evan Hemsley
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
* the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software in a
|
||||
* product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* Evan "cosmonaut" Hemsley <evan@moonside.games>
|
||||
*
|
||||
*/
|
||||
|
||||
#if REFRESH_D3D11
|
||||
|
||||
#include "Refresh_driver.h"
|
||||
|
||||
#define CINTERFACE
|
||||
#define COBJMACROS
|
||||
#include <d3dcompiler.h>
|
||||
|
||||
/* __stdcall declaration, largely taken from vkd3d_windows.h */
|
||||
#ifdef _WIN32
|
||||
#define D3DCOMPILER_API __stdcall
|
||||
#else
|
||||
# ifdef __stdcall
|
||||
# undef __stdcall
|
||||
# endif
|
||||
# ifdef __x86_64__
|
||||
# define __stdcall __attribute__((ms_abi))
|
||||
# else
|
||||
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
|
||||
# define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
|
||||
# else
|
||||
# define __stdcall __attribute__((__stdcall__))
|
||||
# endif
|
||||
# endif
|
||||
# define D3DCOMPILER_API __stdcall
|
||||
#endif
|
||||
|
||||
/* vkd3d uses stdcall for its ID3D10Blob implementation */
|
||||
#ifndef _WIN32
|
||||
typedef struct VKD3DBlob VKD3DBlob;
|
||||
typedef struct VKD3DBlobVtbl
|
||||
{
|
||||
HRESULT(__stdcall* QueryInterface)(
|
||||
VKD3DBlob* This,
|
||||
REFIID riid,
|
||||
void** ppvObject);
|
||||
ULONG(__stdcall* AddRef)(VKD3DBlob* This);
|
||||
ULONG(__stdcall* Release)(VKD3DBlob* This);
|
||||
LPVOID(__stdcall* GetBufferPointer)(VKD3DBlob* This);
|
||||
SIZE_T(__stdcall* GetBufferSize)(VKD3DBlob* This);
|
||||
} VKD3DBlobVtbl;
|
||||
struct VKD3DBlob
|
||||
{
|
||||
const VKD3DBlobVtbl* lpVtbl;
|
||||
};
|
||||
#define ID3D10Blob VKD3DBlob
|
||||
#define ID3DBlob VKD3DBlob
|
||||
#endif
|
||||
|
||||
/* rename the DLL for different platforms */
|
||||
#if defined(WIN32)
|
||||
#undef D3DCOMPILER_DLL
|
||||
#define D3DCOMPILER_DLL D3DCOMPILER_DLL_A
|
||||
#elif defined(__APPLE__)
|
||||
#undef D3DCOMPILER_DLL
|
||||
#define D3DCOMPILER_DLL "libvkd3d-utils.1.dylib"
|
||||
#else
|
||||
#undef D3DCOMPILER_DLL
|
||||
#define D3DCOMPILER_DLL "libvkd3d-utils.so.1"
|
||||
#endif
|
||||
|
||||
/* D3DCompile signature */
|
||||
typedef HRESULT(D3DCOMPILER_API* PFN_D3DCOMPILE)(
|
||||
LPCVOID pSrcData,
|
||||
SIZE_T SrcDataSize,
|
||||
LPCSTR pSourceName,
|
||||
const D3D_SHADER_MACRO* pDefines,
|
||||
ID3DInclude* pInclude,
|
||||
LPCSTR pEntrypoint,
|
||||
LPCSTR pTarget,
|
||||
UINT Flags1,
|
||||
UINT Flags2,
|
||||
ID3DBlob** ppCode,
|
||||
ID3DBlob** ppErrorMsgs
|
||||
);
|
||||
|
||||
static void* d3dcompiler_dll;
|
||||
static PFN_D3DCOMPILE D3DCompile_func;
|
||||
|
||||
#if 0 /* TODO */
|
||||
static void D3D11_Quit(void)
|
||||
{
|
||||
if (d3dcompiler_dll) {
|
||||
SDL_UnloadObject(d3dcompiler_dll);
|
||||
}
|
||||
d3dcompiler_dll = NULL;
|
||||
D3DCompile_func = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern Refresh_Shader* D3D11_CreateShader(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_ShaderCreateInfo *shaderCreateInfo
|
||||
);
|
||||
|
||||
Refresh_Shader* D3D11_CompileFromSPIRVCross(
|
||||
Refresh_Renderer *driverData,
|
||||
Refresh_ShaderStage shader_stage,
|
||||
const char *entryPointName,
|
||||
const char *source
|
||||
) {
|
||||
HRESULT result;
|
||||
ID3DBlob *blob;
|
||||
ID3DBlob *error_blob;
|
||||
Refresh_ShaderCreateInfo createInfo;
|
||||
Refresh_Shader *shader;
|
||||
const char *profile;
|
||||
|
||||
/* FIXME: d3dcompiler could probably be loaded in a better spot */
|
||||
|
||||
/* Load the DLL if we haven't already */
|
||||
if (!d3dcompiler_dll) {
|
||||
d3dcompiler_dll = SDL_LoadObject(D3DCOMPILER_DLL);
|
||||
if (!d3dcompiler_dll) {
|
||||
SDL_SetError("Failed to load " D3DCOMPILER_DLL);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Load the D3DCompile function if we haven't already */
|
||||
if (!D3DCompile_func) {
|
||||
D3DCompile_func = (PFN_D3DCOMPILE) SDL_LoadFunction(d3dcompiler_dll, "D3DCompile");
|
||||
if (!D3DCompile_func) {
|
||||
SDL_SetError("Failed to load D3DCompile function");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (shader_stage == REFRESH_SHADERSTAGE_VERTEX)
|
||||
{
|
||||
profile = "vs_5_0";
|
||||
}
|
||||
else if (shader_stage == REFRESH_SHADERSTAGE_FRAGMENT)
|
||||
{
|
||||
profile = "ps_5_0";
|
||||
}
|
||||
else if (shader_stage == REFRESH_SHADERSTAGE_COMPUTE)
|
||||
{
|
||||
profile = "cs_5_0";
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_SetError("%s", "Unrecognized shader stage!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Compile! */
|
||||
result = D3DCompile_func(
|
||||
source,
|
||||
SDL_strlen(source),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"main", /* entry point name ignored */
|
||||
profile,
|
||||
0,
|
||||
0,
|
||||
&blob,
|
||||
&error_blob
|
||||
);
|
||||
if (result < 0) {
|
||||
SDL_SetError("%s", (const char*) ID3D10Blob_GetBufferPointer(error_blob));
|
||||
ID3D10Blob_Release(error_blob);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Create the shader */
|
||||
createInfo.code = ID3D10Blob_GetBufferPointer(blob);
|
||||
createInfo.codeSize = ID3D10Blob_GetBufferSize(blob);
|
||||
createInfo.format = REFRESH_SHADERFORMAT_DXBC;
|
||||
createInfo.stage = shader_stage;
|
||||
createInfo.entryPointName = entryPointName;
|
||||
shader = D3D11_CreateShader(driverData, &createInfo);
|
||||
|
||||
/* Clean up */
|
||||
ID3D10Blob_Release(blob);
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
#endif /* REFRESH_D3D11 */
|
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,6 +1,6 @@
|
|||
/* Refresh - XNA-inspired 3D Graphics Library with modern capabilities
|
||||
/* Refresh - a cross-platform hardware-accelerated graphics library with modern capabilities
|
||||
*
|
||||
* Copyright (c) 2020 Evan Hemsley
|
||||
* Copyright (c) 2020-2024 Evan Hemsley
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from
|
||||
|
@ -46,22 +46,23 @@ VULKAN_INSTANCE_FUNCTION(BaseVK, PFN_vkVoidFunction, vkGetDeviceProcAddr, (VkDev
|
|||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkCreateDevice, (VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, void, vkDestroyInstance, (VkInstance instance, const VkAllocationCallbacks *pAllocator))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, void, vkDestroySurfaceKHR, (VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkEnumerateDeviceExtensionProperties, (VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkEnumeratePhysicalDevices, (VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkEnumerateDeviceExtensionProperties, (VkPhysicalDevice physicalDevice, const char *pLayerName, Uint32 *pPropertyCount, VkExtensionProperties *pProperties))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkEnumeratePhysicalDevices, (VkInstance instance, Uint32 *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, void, vkGetPhysicalDeviceFeatures, (VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, void, vkGetPhysicalDeviceFormatProperties, (VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkGetPhysicalDeviceImageFormatProperties, (VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties *pImageFormatProperties))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, void, vkGetPhysicalDeviceMemoryProperties, (VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties *pMemoryProperties))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, void, vkGetPhysicalDeviceProperties, (VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, void, vkGetPhysicalDeviceProperties2KHR, (VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, void, vkGetPhysicalDeviceQueueFamilyProperties, (VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties *pQueueFamilyProperties))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, void, vkGetPhysicalDeviceQueueFamilyProperties, (VkPhysicalDevice physicalDevice, Uint32 *pQueueFamilyPropertyCount, VkQueueFamilyProperties *pQueueFamilyProperties))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkGetPhysicalDeviceSurfaceCapabilitiesKHR, (VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkGetPhysicalDeviceSurfaceFormatsKHR, (VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkGetPhysicalDeviceSurfacePresentModesKHR, (VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkGetPhysicalDeviceSurfaceSupportKHR, (VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 *pSupported))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkGetPhysicalDeviceSurfaceFormatsKHR, (VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, Uint32 *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkGetPhysicalDeviceSurfacePresentModesKHR, (VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, Uint32 *pPresentModeCount, VkPresentModeKHR *pPresentModes))
|
||||
VULKAN_INSTANCE_FUNCTION(BaseVK, VkResult, vkGetPhysicalDeviceSurfaceSupportKHR, (VkPhysicalDevice physicalDevice, Uint32 queueFamilyIndex, VkSurfaceKHR surface, VkBool32 *pSupported))
|
||||
|
||||
/* Optional debug feature, used by SetStringMarker */
|
||||
VULKAN_INSTANCE_FUNCTION(VK_EXT_debug_utils, void, vkCmdInsertDebugUtilsLabelEXT, (VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT *pMarkerInfo))
|
||||
VULKAN_INSTANCE_FUNCTION(VK_EXT_debug_utils, void, vkSetDebugUtilsObjectNameEXT, (VkDevice device, const VkDebugUtilsObjectNameInfoEXT* pNameInfo))
|
||||
|
||||
/*
|
||||
* vkDevice, created by a vkInstance
|
||||
|
@ -70,7 +71,7 @@ VULKAN_INSTANCE_FUNCTION(VK_EXT_debug_utils, void, vkCmdInsertDebugUtilsLabelEXT
|
|||
#ifndef VULKAN_DEVICE_FUNCTION
|
||||
#define VULKAN_DEVICE_FUNCTION(ext, ret, func, params)
|
||||
#endif
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkAcquireNextImageKHR, (VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkAcquireNextImageKHR, (VkDevice device, VkSwapchainKHR swapchain, Uint64 timeout, VkSemaphore semaphore, VkFence fence, Uint32 *pImageIndex))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkAllocateCommandBuffers, (VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkAllocateDescriptorSets, (VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, VkDescriptorSet *pDescriptorSets))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkAllocateMemory, (VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory))
|
||||
|
@ -78,38 +79,39 @@ VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkBeginCommandBuffer, (VkCommandBuffer
|
|||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkBindBufferMemory, (VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkBindImageMemory, (VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdBeginRenderPass, (VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, VkSubpassContents contents))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdBindDescriptorSets, (VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t *pDynamicOffsets))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdBindDescriptorSets, (VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, Uint32 firstSet, Uint32 descriptorSetCount, const VkDescriptorSet *pDescriptorSets, Uint32 dynamicOffsetCount, const Uint32 *pDynamicOffsets))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdBindIndexBuffer, (VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdBindPipeline, (VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdBindVertexBuffers, (VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdBlitImage, (VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit *pRegions, VkFilter filter))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdClearAttachments, (VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment *pAttachments, uint32_t rectCount, const VkClearRect *pRects))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdClearColorImage, (VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue *pColor, uint32_t rangeCount, const VkImageSubresourceRange *pRanges))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdClearDepthStencilImage, (VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange *pRanges))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdCopyBuffer, (VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdCopyBufferToImage, (VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy *pRegions))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdCopyImageToBuffer, (VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdCopyImage, (VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdDispatch, (VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdDraw, (VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdDrawIndexed, (VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdDrawIndirect, (VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdBindVertexBuffers, (VkCommandBuffer commandBuffer, Uint32 firstBinding, Uint32 bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdBlitImage, (VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, Uint32 regionCount, const VkImageBlit *pRegions, VkFilter filter))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdClearAttachments, (VkCommandBuffer commandBuffer, Uint32 attachmentCount, const VkClearAttachment *pAttachments, Uint32 rectCount, const VkClearRect *pRects))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdClearColorImage, (VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue *pColor, Uint32 rangeCount, const VkImageSubresourceRange *pRanges))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdClearDepthStencilImage, (VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue *pDepthStencil, Uint32 rangeCount, const VkImageSubresourceRange *pRanges))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdCopyBuffer, (VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, Uint32 regionCount, const VkBufferCopy* pRegions))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdCopyBufferToImage, (VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, Uint32 regionCount, const VkBufferImageCopy *pRegions))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdCopyImageToBuffer, (VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, Uint32 regionCount, const VkBufferImageCopy *pRegions))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdCopyImage, (VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, Uint32 regionCount, const VkImageCopy* pRegions))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdDispatch, (VkCommandBuffer commandBuffer, Uint32 groupCountX, Uint32 groupCountY, Uint32 groupCountZ))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdDraw, (VkCommandBuffer commandBuffer, Uint32 vertexCount, Uint32 instanceCount, Uint32 firstVertex, Uint32 firstInstance))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdDrawIndexed, (VkCommandBuffer commandBuffer, Uint32 indexCount, Uint32 instanceCount, Uint32 firstIndex, Sint32 vertexOffset, Uint32 firstInstance))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdDrawIndirect, (VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, Uint32 drawCount, Uint32 stride))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdDrawIndexedIndirect, (VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, Uint32 drawCount, Uint32 stride))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdEndRenderPass, (VkCommandBuffer commandBuffer))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdPipelineBarrier, (VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdResolveImage, (VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve *pRegions))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdPipelineBarrier, (VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, Uint32 memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, Uint32 bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, Uint32 imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdResolveImage, (VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, Uint32 regionCount, const VkImageResolve *pRegions))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdSetBlendConstants, (VkCommandBuffer commandBuffer, const float blendConstants[4]))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdSetDepthBias, (VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdSetScissor, (VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *pScissors))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdSetStencilReference, (VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdSetViewport, (VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport *pViewports))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdSetScissor, (VkCommandBuffer commandBuffer, Uint32 firstScissor, Uint32 scissorCount, const VkRect2D *pScissors))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdSetStencilReference, (VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, Uint32 reference))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdSetViewport, (VkCommandBuffer commandBuffer, Uint32 firstViewport, Uint32 viewportCount, const VkViewport *pViewports))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreateBuffer, (VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreateCommandPool, (VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreateDescriptorPool, (VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreateDescriptorSetLayout, (VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorSetLayout *pSetLayout))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreateFence, (VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreateFramebuffer, (VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreateComputePipelines, (VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreateGraphicsPipelines, (VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreateComputePipelines, (VkDevice device, VkPipelineCache pipelineCache, Uint32 createInfoCount, const VkComputePipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreateGraphicsPipelines, (VkDevice device, VkPipelineCache pipelineCache, Uint32 createInfoCount, const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreateImage, (VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreateImageView, (VkDevice device, const VkImageViewCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImageView *pView))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkCreatePipelineCache, (VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache))
|
||||
|
@ -140,29 +142,29 @@ VULKAN_DEVICE_FUNCTION(BaseVK, void, vkDestroySwapchainKHR, (VkDevice device, Vk
|
|||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkDestroyQueryPool, (VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkDeviceWaitIdle, (VkDevice device))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkEndCommandBuffer, (VkCommandBuffer commandBuffer))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkFreeCommandBuffers, (VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkFreeDescriptorSets, (VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkFreeCommandBuffers, (VkDevice device, VkCommandPool commandPool, Uint32 commandBufferCount, const VkCommandBuffer *pCommandBuffers))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkFreeDescriptorSets, (VkDevice device, VkDescriptorPool descriptorPool, Uint32 descriptorSetCount, const VkDescriptorSet *pDescriptorSets))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkFreeMemory, (VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkGetBufferMemoryRequirements2KHR, (VkDevice device, const VkBufferMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkGetDeviceQueue, (VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkGetDeviceQueue, (VkDevice device, Uint32 queueFamilyIndex, Uint32 queueIndex, VkQueue *pQueue))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkGetImageMemoryRequirements2KHR, (VkDevice device, const VkImageMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkGetFenceStatus, (VkDevice device, VkFence fence))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkGetSwapchainImagesKHR, (VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkGetSwapchainImagesKHR, (VkDevice device, VkSwapchainKHR swapchain, Uint32 *pSwapchainImageCount, VkImage *pSwapchainImages))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkMapMemory, (VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkQueuePresentKHR, (VkQueue queue, const VkPresentInfoKHR *pPresentInfo))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkQueueSubmit, (VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkQueueSubmit, (VkQueue queue, Uint32 submitCount, const VkSubmitInfo *pSubmits, VkFence fence))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkQueueWaitIdle, (VkQueue queue))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkResetCommandBuffer, (VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkResetCommandPool, (VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkResetDescriptorPool, (VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkResetFences, (VkDevice device, uint32_t fenceCount, const VkFence *pFences))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkResetFences, (VkDevice device, Uint32 fenceCount, const VkFence *pFences))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkUnmapMemory, (VkDevice device, VkDeviceMemory memory))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkUpdateDescriptorSets, (VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet *pDescriptorCopies))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkWaitForFences, (VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, uint64_t timeout))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdResetQueryPool, (VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdBeginQuery, (VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdEndQuery, (VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkGetQueryPoolResults, (VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkUpdateDescriptorSets, (VkDevice device, Uint32 descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites, Uint32 descriptorCopyCount, const VkCopyDescriptorSet *pDescriptorCopies))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkWaitForFences, (VkDevice device, Uint32 fenceCount, const VkFence *pFences, VkBool32 waitAll, Uint64 timeout))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdResetQueryPool, (VkCommandBuffer commandBuffer, VkQueryPool queryPool, Uint32 firstQuery, Uint32 queryCount))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdBeginQuery, (VkCommandBuffer commandBuffer, VkQueryPool queryPool, Uint32 query, VkQueryControlFlags flags))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, void, vkCmdEndQuery, (VkCommandBuffer commandBuffer, VkQueryPool queryPool, Uint32 query))
|
||||
VULKAN_DEVICE_FUNCTION(BaseVK, VkResult, vkGetQueryPoolResults, (VkDevice device, VkQueryPool queryPool, Uint32 firstQuery, Uint32 queryCount, size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags))
|
||||
|
||||
/*
|
||||
* Redefine these every time you include this header!
|
Loading…
Reference in New Issue