Skip to content

Commit

Permalink
An attempt to fix the regression
Browse files Browse the repository at this point in the history
  • Loading branch information
red-prig committed Feb 19, 2024
1 parent 97dd675 commit 091deb5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
9 changes: 7 additions & 2 deletions chip/ps4_gpu_regs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ function _get_vsharp_cformat(PV:PVSharpResource4):TVkFormat;
BUF_DATA_FORMAT_16 :Result:=VK_FORMAT_R16_UNORM;
BUF_DATA_FORMAT_16_16 :Result:=VK_FORMAT_R16G16_UNORM;
BUF_DATA_FORMAT_16_16_16_16:Result:=VK_FORMAT_R16G16B16A16_UNORM;
BUF_DATA_FORMAT_2_10_10_10 :Result:=VK_FORMAT_A2B10G10R10_UNORM_PACK32;
BUF_DATA_FORMAT_2_10_10_10 :Result:=VK_FORMAT_A2R10G10B10_UNORM_PACK32;
else;
end;

Expand Down Expand Up @@ -1699,7 +1699,7 @@ function _get_tsharp4_cformat(PT:PTSharpResource4):TVkFormat;
IMG_DATA_FORMAT_BC6 :Result:=VK_FORMAT_BC6H_UFLOAT_BLOCK;
IMG_DATA_FORMAT_BC7 :Result:=VK_FORMAT_BC7_UNORM_BLOCK;

IMG_DATA_FORMAT_2_10_10_10 :Result:=VK_FORMAT_A2B10G10R10_UNORM_PACK32;
IMG_DATA_FORMAT_2_10_10_10 :Result:=VK_FORMAT_A2R10G10B10_UNORM_PACK32;
else;
end;

Expand All @@ -1711,7 +1711,12 @@ function _get_tsharp4_cformat(PT:PTSharpResource4):TVkFormat;
IMG_DATA_FORMAT_BC1 :Result:=VK_FORMAT_BC1_RGBA_SRGB_BLOCK;
IMG_DATA_FORMAT_BC2 :Result:=VK_FORMAT_BC2_SRGB_BLOCK;
IMG_DATA_FORMAT_BC3 :Result:=VK_FORMAT_BC3_SRGB_BLOCK;
IMG_DATA_FORMAT_BC4 :Result:=VK_FORMAT_BC4_UNORM_BLOCK;
IMG_DATA_FORMAT_BC5 :Result:=VK_FORMAT_BC5_UNORM_BLOCK;
IMG_DATA_FORMAT_BC6 :Result:=VK_FORMAT_BC6H_UFLOAT_BLOCK;
IMG_DATA_FORMAT_BC7 :Result:=VK_FORMAT_BC7_SRGB_BLOCK;

IMG_DATA_FORMAT_2_10_10_10 :Result:=VK_FORMAT_A2R10G10B10_UNORM_PACK32;
else;
end;

Expand Down
21 changes: 14 additions & 7 deletions chip/ps4_videodrv.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,7 @@ TvEvent2=class(TvEvent)
VK_IMAGE_USAGE_DEFAULT or
ord(VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT);

function VK_IMAGE_USAGE_DEFAULT_COLOR(cformat:TVkFormat):TVkFlags;
function VK_IMAGE_USAGE_DEFAULT_COLOR(cformat:TVkFormat;rt:Boolean):TVkFlags;
begin
Case cformat of
VK_FORMAT_R4G4_UNORM_PACK8..
Expand All @@ -1636,6 +1636,13 @@ function VK_IMAGE_USAGE_DEFAULT_COLOR(cformat:TVkFormat):TVkFlags;
Result:=VK_IMAGE_USAGE_DEFAULT or
ord(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
end;

if rt then
begin
Result:=VK_IMAGE_USAGE_DEFAULT or
ord(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
end;

end;

procedure ClearRenderTarget;
Expand All @@ -1653,7 +1660,7 @@ procedure ClearRenderTarget;

ri:=FetchImage(GFXRing.CmdBuffer,
RT_INFO.FImageInfo,
VK_IMAGE_USAGE_DEFAULT_COLOR(RT_INFO.FImageInfo.cformat),
VK_IMAGE_USAGE_DEFAULT_COLOR(RT_INFO.FImageInfo.cformat,true),
TM_CLEAR
);

Expand Down Expand Up @@ -1689,13 +1696,13 @@ procedure ResolveRenderTarget;

ri_src:=FetchImage(GFXRing.CmdBuffer,
RT_INFO_SRC.FImageInfo,
VK_IMAGE_USAGE_DEFAULT_COLOR(RT_INFO_SRC.FImageInfo.cformat),
VK_IMAGE_USAGE_DEFAULT_COLOR(RT_INFO_SRC.FImageInfo.cformat,true),
{TM_READ}0
);

ri_dst:=FetchImage(GFXRing.CmdBuffer,
RT_INFO_DST.FImageInfo,
VK_IMAGE_USAGE_DEFAULT_COLOR(RT_INFO_DST.FImageInfo.cformat),
VK_IMAGE_USAGE_DEFAULT_COLOR(RT_INFO_DST.FImageInfo.cformat,true),
TM_WRITE
);

Expand Down Expand Up @@ -1969,7 +1976,7 @@ function UpdateGpuRegsInfo:Boolean;

ri:=FetchImage(GFXRing.CmdBuffer,
RT_INFO.FImageInfo,
VK_IMAGE_USAGE_DEFAULT_COLOR(RT_INFO.FImageInfo.cformat),
VK_IMAGE_USAGE_DEFAULT_COLOR(RT_INFO.FImageInfo.cformat,true),
RT_INFO.IMAGE_USAGE
);

Expand Down Expand Up @@ -2179,7 +2186,7 @@ function UpdateGpuRegsInfo:Boolean;

ri:=FetchImage(GFXRing.CmdBuffer,
FImage,
VK_IMAGE_USAGE_DEFAULT_COLOR(FImage.cformat),
VK_IMAGE_USAGE_DEFAULT_COLOR(FImage.cformat,false),
TM_READ
);

Expand Down Expand Up @@ -2283,7 +2290,7 @@ function UpdateGpuRegsInfo:Boolean;

ri:=FetchImage(GFXRing.CmdBuffer,
FImage,
VK_IMAGE_USAGE_DEFAULT_COLOR(FImage.cformat),
VK_IMAGE_USAGE_DEFAULT_COLOR(FImage.cformat,false),
TM_READ
);

Expand Down

0 comments on commit 091deb5

Please sign in to comment.