Skip to content

Commit

Permalink
rpcsx-gpu: add a bit more vk formats
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Sep 1, 2024
1 parent df3a2d3 commit 6455fe6
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions hw/amdgpu/device/src/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,17 @@ static int getBitWidthOfSurfaceFormat(SurfaceFormat format) {
static VkFormat surfaceFormatToVkFormat(SurfaceFormat surface,
TextureChannelType channel) {
switch (surface) {
case kSurfaceFormat4_4_4_4: {
switch (channel) {
case kTextureChannelTypeUNorm:
return VK_FORMAT_R4G4B4A4_UNORM_PACK16;
default:
break;
}

break;
}

case kSurfaceFormat8: {
switch (channel) {
case kTextureChannelTypeUNorm:
Expand Down Expand Up @@ -1412,6 +1423,15 @@ static VkFormat surfaceFormatToVkFormat(SurfaceFormat surface,
}
break;

case kSurfaceFormat5_9_9_9:
switch (channel) {
case kTextureChannelTypeFloat:
return VK_FORMAT_E5B9G9R9_UFLOAT_PACK32;
default:
break;
}
break;

case kSurfaceFormat5_6_5:
switch (channel) {
case kTextureChannelTypeUNorm:
Expand Down Expand Up @@ -1542,19 +1562,36 @@ static VkFormat surfaceFormatToVkFormat(SurfaceFormat surface,

case kSurfaceFormatBc1:
switch (channel) {
case kTextureChannelTypeUNorm:
return VK_FORMAT_BC1_RGBA_UNORM_BLOCK;
case kTextureChannelTypeSrgb:
return VK_FORMAT_BC1_RGBA_SRGB_BLOCK;
default:
break;
}
break;

case kSurfaceFormatBc2:
switch (channel) {
case kTextureChannelTypeUNorm:
return VK_FORMAT_BC2_UNORM_BLOCK;
case kTextureChannelTypeSrgb:
return VK_FORMAT_BC2_SRGB_BLOCK;
default:
break;
}
break;

case kSurfaceFormatBc3:
switch (channel) {
case kTextureChannelTypeUNorm:
return VK_FORMAT_BC3_UNORM_BLOCK;
case kTextureChannelTypeSrgb:
return VK_FORMAT_BC3_SRGB_BLOCK;
default:
break;
}
break;

case kSurfaceFormatBc4:
switch (channel) {
Expand All @@ -1567,6 +1604,7 @@ static VkFormat surfaceFormatToVkFormat(SurfaceFormat surface,
default:
break;
}
break;
case kSurfaceFormatBc5:
switch (channel) {
case kTextureChannelTypeUNorm:
Expand All @@ -1578,6 +1616,20 @@ static VkFormat surfaceFormatToVkFormat(SurfaceFormat surface,
default:
break;
}
break;

case kSurfaceFormatBc6:
switch (channel) {
case kTextureChannelTypeUNorm:
return VK_FORMAT_BC6H_UFLOAT_BLOCK;

case kTextureChannelTypeSNorm:
return VK_FORMAT_BC6H_SFLOAT_BLOCK;

default:
break;
}
break;

case kSurfaceFormatBc7:
switch (channel) {
Expand All @@ -1590,6 +1642,7 @@ static VkFormat surfaceFormatToVkFormat(SurfaceFormat surface,
default:
break;
}
break;

default:
break;
Expand Down

0 comments on commit 6455fe6

Please sign in to comment.