mirror of https://github.com/red-prig/fpPS4.git
This commit is contained in:
parent
2ce5c4caca
commit
8dd93f0106
|
@ -165,8 +165,50 @@ type
|
|||
|
||||
Function GetAspectMaskByFormat(cformat:TVkFormat):DWORD;
|
||||
|
||||
Function getFormatSize(cformat:TVkFormat):Byte; //in bytes
|
||||
function IsTexelFormat(cformat:TVkFormat):Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
Function getFormatSize(cformat:TVkFormat):Byte; //in bytes
|
||||
begin
|
||||
Result:=0;
|
||||
Case cformat of
|
||||
//pixel size
|
||||
VK_FORMAT_R8G8B8A8_SRGB :Result:=4;
|
||||
VK_FORMAT_R8G8B8A8_UNORM :Result:=4;
|
||||
VK_FORMAT_R8G8_UNORM :Result:=2;
|
||||
VK_FORMAT_R8_UNORM :Result:=1;
|
||||
VK_FORMAT_R8_UINT :Result:=4;
|
||||
VK_FORMAT_R5G6B5_UNORM_PACK16 :Result:=2;
|
||||
|
||||
//texel size
|
||||
VK_FORMAT_BC1_RGB_UNORM_BLOCK..
|
||||
VK_FORMAT_BC1_RGBA_SRGB_BLOCK,
|
||||
VK_FORMAT_BC4_UNORM_BLOCK..
|
||||
VK_FORMAT_BC4_SNORM_BLOCK :Result:=8;
|
||||
|
||||
VK_FORMAT_BC2_UNORM_BLOCK..
|
||||
VK_FORMAT_BC3_SRGB_BLOCK,
|
||||
VK_FORMAT_BC5_UNORM_BLOCK..
|
||||
VK_FORMAT_BC7_SRGB_BLOCK :Result:=16;
|
||||
|
||||
else
|
||||
Assert(false,'TODO');
|
||||
end;
|
||||
end;
|
||||
|
||||
function IsTexelFormat(cformat:TVkFormat):Boolean;
|
||||
begin
|
||||
Case cformat of
|
||||
VK_FORMAT_BC1_RGB_UNORM_BLOCK..
|
||||
VK_FORMAT_BC7_SRGB_BLOCK:
|
||||
Result:=True;
|
||||
else
|
||||
Result:=False;
|
||||
end;
|
||||
end;
|
||||
|
||||
Procedure TvFramebuffer.SetRenderPass(r:TvRenderPass);
|
||||
begin
|
||||
if (r=FRenderPass) then Exit;
|
||||
|
|
|
@ -8,6 +8,7 @@ uses
|
|||
SysUtils,
|
||||
RWLock,
|
||||
g23tree,
|
||||
sys_types,
|
||||
Vulkan,
|
||||
vDevice,
|
||||
vMemory,
|
||||
|
@ -251,10 +252,29 @@ begin
|
|||
end;
|
||||
|
||||
function TvHostImage2.GetImageInfo:TVkImageCreateInfo;
|
||||
var
|
||||
bpp,size:qword;
|
||||
begin
|
||||
Result:=Parent.GetImageInfo;
|
||||
Result.tiling:=VK_IMAGE_TILING_LINEAR;
|
||||
Result.usage :=FUsage;
|
||||
if (Parent.key.params.tiling_idx=8) then
|
||||
begin
|
||||
size:=Result.extent.width;
|
||||
bpp:=getFormatSize(Result.format);
|
||||
if IsTexelFormat(Result.format) then
|
||||
begin
|
||||
size:=(size+3) div 4;
|
||||
end;
|
||||
size:=size*bpp;
|
||||
size:=AlignUp(size,128);
|
||||
size:=size div bpp;
|
||||
if IsTexelFormat(Result.format) then
|
||||
begin
|
||||
size:=size*4;
|
||||
end;
|
||||
Result.extent.width:=size;
|
||||
end;
|
||||
end;
|
||||
|
||||
Function TvImage2.GetSubresRange:TVkImageSubresourceRange;
|
||||
|
|
|
@ -24,45 +24,6 @@ implementation
|
|||
uses
|
||||
vImageManager;
|
||||
|
||||
Function getFormatSize(cformat:TVkFormat):Byte; //in bytes
|
||||
begin
|
||||
Result:=0;
|
||||
Case cformat of
|
||||
//pixel size
|
||||
VK_FORMAT_R8G8B8A8_SRGB :Result:=4;
|
||||
VK_FORMAT_R8G8B8A8_UNORM :Result:=4;
|
||||
VK_FORMAT_R8G8_UNORM :Result:=2;
|
||||
VK_FORMAT_R8_UNORM :Result:=1;
|
||||
VK_FORMAT_R8_UINT :Result:=4;
|
||||
VK_FORMAT_R5G6B5_UNORM_PACK16 :Result:=2;
|
||||
|
||||
//texel size
|
||||
VK_FORMAT_BC1_RGB_UNORM_BLOCK..
|
||||
VK_FORMAT_BC1_RGBA_SRGB_BLOCK,
|
||||
VK_FORMAT_BC4_UNORM_BLOCK..
|
||||
VK_FORMAT_BC4_SNORM_BLOCK :Result:=8;
|
||||
|
||||
VK_FORMAT_BC2_UNORM_BLOCK..
|
||||
VK_FORMAT_BC3_SRGB_BLOCK,
|
||||
VK_FORMAT_BC5_UNORM_BLOCK..
|
||||
VK_FORMAT_BC7_SRGB_BLOCK :Result:=16;
|
||||
|
||||
else
|
||||
Assert(false,'TODO');
|
||||
end;
|
||||
end;
|
||||
|
||||
function IsTexelFormat(cformat:TVkFormat):Boolean;
|
||||
begin
|
||||
Case cformat of
|
||||
VK_FORMAT_BC1_RGB_UNORM_BLOCK..
|
||||
VK_FORMAT_BC7_SRGB_BLOCK:
|
||||
Result:=True;
|
||||
else
|
||||
Result:=False;
|
||||
end;
|
||||
end;
|
||||
|
||||
{
|
||||
Procedure _Load_Linear(cmd:TvCustomCmdBuffer;image:TvImage2);
|
||||
var
|
||||
|
|
Loading…
Reference in New Issue