rename SURFACEFORMAT to COLORFORMAT

pull/1/head
cosmonaut 2021-01-03 14:53:12 -08:00
parent b4dee16f80
commit 788c63f3ac
4 changed files with 65 additions and 65 deletions

View File

@ -111,28 +111,28 @@ typedef enum REFRESH_IndexElementSize
REFRESH_INDEXELEMENTSIZE_32BIT REFRESH_INDEXELEMENTSIZE_32BIT
} REFRESH_IndexElementSize; } REFRESH_IndexElementSize;
typedef enum REFRESH_SurfaceFormat typedef enum REFRESH_ColorFormat
{ {
REFRESH_SURFACEFORMAT_R8G8B8A8, REFRESH_COLORFORMAT_R8G8B8A8,
REFRESH_SURFACEFORMAT_R5G6B5, REFRESH_COLORFORMAT_R5G6B5,
REFRESH_SURFACEFORMAT_A1R5G5B5, REFRESH_COLORFORMAT_A1R5G5B5,
REFRESH_SURFACEFORMAT_B4G4R4A4, REFRESH_COLORFORMAT_B4G4R4A4,
REFRESH_SURFACEFORMAT_BC1, REFRESH_COLORFORMAT_BC1,
REFRESH_SURFACEFORMAT_BC2, REFRESH_COLORFORMAT_BC2,
REFRESH_SURFACEFORMAT_BC3, REFRESH_COLORFORMAT_BC3,
REFRESH_SURFACEFORMAT_R8G8_SNORM, REFRESH_COLORFORMAT_R8G8_SNORM,
REFRESH_SURFACEFORMAT_R8G8B8A8_SNORM, REFRESH_COLORFORMAT_R8G8B8A8_SNORM,
REFRESH_SURFACEFORMAT_A2R10G10B10, REFRESH_COLORFORMAT_A2R10G10B10,
REFRESH_SURFACEFORMAT_R16G16, REFRESH_COLORFORMAT_R16G16,
REFRESH_SURFACEFORMAT_R16G16B16A16, REFRESH_COLORFORMAT_R16G16B16A16,
REFRESH_SURFACEFORMAT_R8, REFRESH_COLORFORMAT_R8,
REFRESH_SURFACEFORMAT_R32_SFLOAT, REFRESH_COLORFORMAT_R32_SFLOAT,
REFRESH_SURFACEFORMAT_R32G32_SFLOAT, REFRESH_COLORFORMAT_R32G32_SFLOAT,
REFRESH_SURFACEFORMAT_R32G32B32A32_SFLOAT, REFRESH_COLORFORMAT_R32G32B32A32_SFLOAT,
REFRESH_SURFACEFORMAT_R16_SFLOAT, REFRESH_COLORFORMAT_R16_SFLOAT,
REFRESH_SURFACEFORMAT_R16G16_SFLOAT, REFRESH_COLORFORMAT_R16G16_SFLOAT,
REFRESH_SURFACEFORMAT_R16G16B16A16_SFLOAT REFRESH_COLORFORMAT_R16G16B16A16_SFLOAT
} REFRESH_SurfaceFormat; } REFRESH_ColorFormat;
typedef enum REFRESH_DepthFormat typedef enum REFRESH_DepthFormat
{ {
@ -483,7 +483,7 @@ typedef struct REFRESH_GraphicsPipelineLayoutCreateInfo
typedef struct REFRESH_ColorTargetDescription typedef struct REFRESH_ColorTargetDescription
{ {
REFRESH_SurfaceFormat format; REFRESH_ColorFormat format;
REFRESH_SampleCount multisampleCount; REFRESH_SampleCount multisampleCount;
REFRESH_LoadOp loadOp; REFRESH_LoadOp loadOp;
REFRESH_StoreOp storeOp; REFRESH_StoreOp storeOp;
@ -808,7 +808,7 @@ REFRESHAPI REFRESH_ShaderModule* REFRESH_CreateShaderModule(
*/ */
REFRESHAPI REFRESH_Texture* REFRESH_CreateTexture2D( REFRESHAPI REFRESH_Texture* REFRESH_CreateTexture2D(
REFRESH_Device *device, REFRESH_Device *device,
REFRESH_SurfaceFormat format, REFRESH_ColorFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t levelCount, uint32_t levelCount,
@ -829,7 +829,7 @@ REFRESHAPI REFRESH_Texture* REFRESH_CreateTexture2D(
*/ */
REFRESHAPI REFRESH_Texture* REFRESH_CreateTexture3D( REFRESHAPI REFRESH_Texture* REFRESH_CreateTexture3D(
REFRESH_Device *device, REFRESH_Device *device,
REFRESH_SurfaceFormat format, REFRESH_ColorFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t depth, uint32_t depth,
@ -849,7 +849,7 @@ REFRESHAPI REFRESH_Texture* REFRESH_CreateTexture3D(
*/ */
REFRESHAPI REFRESH_Texture* REFRESH_CreateTextureCube( REFRESHAPI REFRESH_Texture* REFRESH_CreateTextureCube(
REFRESH_Device *device, REFRESH_Device *device,
REFRESH_SurfaceFormat format, REFRESH_ColorFormat format,
uint32_t size, uint32_t size,
uint32_t levelCount, uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags REFRESH_TextureUsageFlags usageFlags

View File

@ -336,7 +336,7 @@ REFRESH_ShaderModule* REFRESH_CreateShaderModule(
REFRESH_Texture* REFRESH_CreateTexture2D( REFRESH_Texture* REFRESH_CreateTexture2D(
REFRESH_Device *device, REFRESH_Device *device,
REFRESH_SurfaceFormat format, REFRESH_ColorFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t levelCount, uint32_t levelCount,
@ -355,7 +355,7 @@ REFRESH_Texture* REFRESH_CreateTexture2D(
REFRESH_Texture* REFRESH_CreateTexture3D( REFRESH_Texture* REFRESH_CreateTexture3D(
REFRESH_Device *device, REFRESH_Device *device,
REFRESH_SurfaceFormat format, REFRESH_ColorFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t depth, uint32_t depth,
@ -376,7 +376,7 @@ REFRESH_Texture* REFRESH_CreateTexture3D(
REFRESH_Texture* REFRESH_CreateTextureCube( REFRESH_Texture* REFRESH_CreateTextureCube(
REFRESH_Device *device, REFRESH_Device *device,
REFRESH_SurfaceFormat format, REFRESH_ColorFormat format,
uint32_t size, uint32_t size,
uint32_t levelCount, uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags REFRESH_TextureUsageFlags usageFlags

View File

@ -43,34 +43,34 @@ extern void REFRESH_LogError(const char *fmt, ...);
/* Internal Helper Utilities */ /* Internal Helper Utilities */
static inline uint32_t Texture_GetFormatSize( static inline uint32_t Texture_GetFormatSize(
REFRESH_SurfaceFormat format REFRESH_ColorFormat format
) { ) {
switch (format) switch (format)
{ {
case REFRESH_SURFACEFORMAT_BC1: case REFRESH_COLORFORMAT_BC1:
return 8; return 8;
case REFRESH_SURFACEFORMAT_BC2: case REFRESH_COLORFORMAT_BC2:
case REFRESH_SURFACEFORMAT_BC3: case REFRESH_COLORFORMAT_BC3:
return 16; return 16;
case REFRESH_SURFACEFORMAT_R8: case REFRESH_COLORFORMAT_R8:
return 1; return 1;
case REFRESH_SURFACEFORMAT_R5G6B5: case REFRESH_COLORFORMAT_R5G6B5:
case REFRESH_SURFACEFORMAT_B4G4R4A4: case REFRESH_COLORFORMAT_B4G4R4A4:
case REFRESH_SURFACEFORMAT_A1R5G5B5: case REFRESH_COLORFORMAT_A1R5G5B5:
case REFRESH_SURFACEFORMAT_R16_SFLOAT: case REFRESH_COLORFORMAT_R16_SFLOAT:
case REFRESH_SURFACEFORMAT_R8G8_SNORM: case REFRESH_COLORFORMAT_R8G8_SNORM:
return 2; return 2;
case REFRESH_SURFACEFORMAT_R8G8B8A8: case REFRESH_COLORFORMAT_R8G8B8A8:
case REFRESH_SURFACEFORMAT_R32_SFLOAT: case REFRESH_COLORFORMAT_R32_SFLOAT:
case REFRESH_SURFACEFORMAT_R16G16_SFLOAT: case REFRESH_COLORFORMAT_R16G16_SFLOAT:
case REFRESH_SURFACEFORMAT_R8G8B8A8_SNORM: case REFRESH_COLORFORMAT_R8G8B8A8_SNORM:
case REFRESH_SURFACEFORMAT_A2R10G10B10: case REFRESH_COLORFORMAT_A2R10G10B10:
return 4; return 4;
case REFRESH_SURFACEFORMAT_R16G16B16A16_SFLOAT: case REFRESH_COLORFORMAT_R16G16B16A16_SFLOAT:
case REFRESH_SURFACEFORMAT_R16G16B16A16: case REFRESH_COLORFORMAT_R16G16B16A16:
case REFRESH_SURFACEFORMAT_R32G32_SFLOAT: case REFRESH_COLORFORMAT_R32G32_SFLOAT:
return 8; return 8;
case REFRESH_SURFACEFORMAT_R32G32B32A32_SFLOAT: case REFRESH_COLORFORMAT_R32G32B32A32_SFLOAT:
return 16; return 16;
default: default:
REFRESH_LogError( REFRESH_LogError(
@ -111,13 +111,13 @@ static inline uint32_t IndexSize(REFRESH_IndexElementSize size)
static inline uint32_t BytesPerRow( static inline uint32_t BytesPerRow(
int32_t width, int32_t width,
REFRESH_SurfaceFormat format REFRESH_ColorFormat format
) { ) {
uint32_t blocksPerRow = width; uint32_t blocksPerRow = width;
if ( format == REFRESH_SURFACEFORMAT_BC1 || if ( format == REFRESH_COLORFORMAT_BC1 ||
format == REFRESH_SURFACEFORMAT_BC2 || format == REFRESH_COLORFORMAT_BC2 ||
format == REFRESH_SURFACEFORMAT_BC3 ) format == REFRESH_COLORFORMAT_BC3 )
{ {
blocksPerRow = (width + 3) / 4; blocksPerRow = (width + 3) / 4;
} }
@ -128,14 +128,14 @@ static inline uint32_t BytesPerRow(
static inline int32_t BytesPerImage( static inline int32_t BytesPerImage(
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
REFRESH_SurfaceFormat format REFRESH_ColorFormat format
) { ) {
uint32_t blocksPerRow = width; uint32_t blocksPerRow = width;
uint32_t blocksPerColumn = height; uint32_t blocksPerColumn = height;
if ( format == REFRESH_SURFACEFORMAT_BC1 || if ( format == REFRESH_COLORFORMAT_BC1 ||
format == REFRESH_SURFACEFORMAT_BC2 || format == REFRESH_COLORFORMAT_BC2 ||
format == REFRESH_SURFACEFORMAT_BC3 ) format == REFRESH_COLORFORMAT_BC3 )
{ {
blocksPerRow = (width + 3) / 4; blocksPerRow = (width + 3) / 4;
blocksPerColumn = (height + 3) / 4; blocksPerColumn = (height + 3) / 4;
@ -259,7 +259,7 @@ struct REFRESH_Device
REFRESH_Texture* (*CreateTexture2D)( REFRESH_Texture* (*CreateTexture2D)(
REFRESH_Renderer *driverData, REFRESH_Renderer *driverData,
REFRESH_SurfaceFormat format, REFRESH_ColorFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t levelCount, uint32_t levelCount,
@ -268,7 +268,7 @@ struct REFRESH_Device
REFRESH_Texture* (*CreateTexture3D)( REFRESH_Texture* (*CreateTexture3D)(
REFRESH_Renderer *driverData, REFRESH_Renderer *driverData,
REFRESH_SurfaceFormat format, REFRESH_ColorFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t depth, uint32_t depth,
@ -278,7 +278,7 @@ struct REFRESH_Device
REFRESH_Texture* (*CreateTextureCube)( REFRESH_Texture* (*CreateTextureCube)(
REFRESH_Renderer *driverData, REFRESH_Renderer *driverData,
REFRESH_SurfaceFormat format, REFRESH_ColorFormat format,
uint32_t size, uint32_t size,
uint32_t levelCount, uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags REFRESH_TextureUsageFlags usageFlags

View File

@ -757,13 +757,13 @@ typedef struct VulkanTexture
uint32_t layerCount; uint32_t layerCount;
uint32_t levelCount; uint32_t levelCount;
VkFormat format; VkFormat format;
REFRESH_SurfaceFormat refreshFormat; REFRESH_ColorFormat refreshFormat;
VulkanResourceAccessType resourceAccessType; VulkanResourceAccessType resourceAccessType;
uint32_t queueFamilyIndex; uint32_t queueFamilyIndex;
REFRESH_TextureUsageFlags usageFlags; REFRESH_TextureUsageFlags usageFlags;
REFRESHNAMELESS union REFRESHNAMELESS union
{ {
REFRESH_SurfaceFormat colorFormat; REFRESH_ColorFormat colorFormat;
REFRESH_DepthFormat depthStencilFormat; REFRESH_DepthFormat depthStencilFormat;
}; };
} VulkanTexture; } VulkanTexture;
@ -5554,7 +5554,7 @@ static uint8_t VULKAN_INTERNAL_CreateTexture(
static REFRESH_Texture* VULKAN_CreateTexture2D( static REFRESH_Texture* VULKAN_CreateTexture2D(
REFRESH_Renderer *driverData, REFRESH_Renderer *driverData,
REFRESH_SurfaceFormat format, REFRESH_ColorFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t levelCount, uint32_t levelCount,
@ -5598,7 +5598,7 @@ static REFRESH_Texture* VULKAN_CreateTexture2D(
static REFRESH_Texture* VULKAN_CreateTexture3D( static REFRESH_Texture* VULKAN_CreateTexture3D(
REFRESH_Renderer *driverData, REFRESH_Renderer *driverData,
REFRESH_SurfaceFormat format, REFRESH_ColorFormat format,
uint32_t width, uint32_t width,
uint32_t height, uint32_t height,
uint32_t depth, uint32_t depth,
@ -5643,7 +5643,7 @@ static REFRESH_Texture* VULKAN_CreateTexture3D(
static REFRESH_Texture* VULKAN_CreateTextureCube( static REFRESH_Texture* VULKAN_CreateTextureCube(
REFRESH_Renderer *driverData, REFRESH_Renderer *driverData,
REFRESH_SurfaceFormat format, REFRESH_ColorFormat format,
uint32_t size, uint32_t size,
uint32_t levelCount, uint32_t levelCount,
REFRESH_TextureUsageFlags usageFlags REFRESH_TextureUsageFlags usageFlags
@ -6134,8 +6134,8 @@ static void VULKAN_SetTextureDataYUV(
VkCommandBuffer commandBuffer = renderer->transferCommandBuffers[renderer->frameIndex]; VkCommandBuffer commandBuffer = renderer->transferCommandBuffers[renderer->frameIndex];
uint8_t *dataPtr = (uint8_t*) data; uint8_t *dataPtr = (uint8_t*) data;
int32_t yDataLength = BytesPerImage(yWidth, yHeight, REFRESH_SURFACEFORMAT_R8); int32_t yDataLength = BytesPerImage(yWidth, yHeight, REFRESH_COLORFORMAT_R8);
int32_t uvDataLength = BytesPerImage(uvWidth, uvHeight, REFRESH_SURFACEFORMAT_R8); int32_t uvDataLength = BytesPerImage(uvWidth, uvHeight, REFRESH_COLORFORMAT_R8);
VkBufferImageCopy imageCopy; VkBufferImageCopy imageCopy;
uint8_t *mapPointer; uint8_t *mapPointer;
VkResult vulkanResult; VkResult vulkanResult;