This commit is contained in:
Pavel 2025-03-14 14:19:37 +03:00
parent de522560cc
commit 36828c69ad
5 changed files with 190 additions and 64 deletions

View File

@ -991,6 +991,12 @@ begin
With UniformBuilder.FImages[i] do
begin
if (FImage.params.invalid<>0) then
begin
//skip
Continue;
end;
resource_instance:=ctx.node^.scope.find_image_resource_instance(FImage);
if (resource_instance=nil) then
@ -1185,26 +1191,39 @@ var
aiv:array[0..15] of TVkImageView;
MView:TvImageViewKey;
begin
p:=0;
For i:=FView.base_level to FView.last_level do
if (ri=nil) then
begin
MView:=FView;
MView.base_level:=i;
MView.last_level:=i;
//
iv:=ri.FetchView(ctx.Cmd,MView,iu_storage);
aiv[p]:=iv.FHandle;
//
Inc(p);
end;
//fill by 16?
For i:=0 to 15 do
begin
aiv[i]:=VK_NULL_HANDLE;
end;
while (p<16) do
end else
begin
aiv[p]:=iv.FHandle;
//
Inc(p);
p:=0;
For i:=FView.base_level to FView.last_level do
begin
MView:=FView;
MView.base_level:=i;
MView.last_level:=i;
//
iv:=ri.FetchView(ctx.Cmd,MView,iu_storage);
aiv[p]:=iv.FHandle;
//
Inc(p);
end;
//fill by 16?
while (p<16) do
begin
aiv[p]:=iv.FHandle;
//
Inc(p);
end;
end;
DescriptorGroup.BindStorages(fset,bind,
@ -1234,6 +1253,8 @@ var
range:TVkDeviceSize;
resource_instance:p_pm4_resource_instance;
Layout:TVkImageLayout;
begin
DescriptorGroup:=ctx.Cmd.FetchDescriptorInterface(BindPoint);
@ -1244,59 +1265,107 @@ begin
With UniformBuilder.FImages[i] do
begin
resource_instance:=ctx.node^.scope.find_image_resource_instance(FImage);
if (FImage.params.invalid<>0) then
begin
Assert(resource_instance<>nil);
if (limits.nullDescriptor<>VK_TRUE) then
begin
Assert(false,'unsupported nullDescriptor');
end;
ri:=TvImage2(resource_instance^.resource^.rimage);
case btype of
vbSampled:
begin
DescriptorGroup.BindImage(fset,bind,
VK_NULL_HANDLE,
VK_IMAGE_LAYOUT_GENERAL);
end;
vbStorage:
begin
DescriptorGroup.BindStorage(fset,bind,
VK_NULL_HANDLE,
VK_IMAGE_LAYOUT_GENERAL);
end;
vbMipStorage:
begin
BindMipStorage(ctx,
fset,bind,
DescriptorGroup,
nil,
FView,
VK_IMAGE_LAYOUT_GENERAL);
Assert(ri<>nil);
end;
else
Assert(false);
end;
case btype of
vbSampled:
begin
iv:=ri.FetchView(ctx.Cmd,FView,iu_sampled);
end else
begin
resource_instance:=ctx.node^.scope.find_image_resource_instance(FImage);
Writeln('BindImage:->'#13#10,
' 0x',HexStr(ri.FHandle,16),':',ri.key.cformat,':',ri.FName,'->'#13#10,
' 0x',HexStr(iv.FHandle,16),':',iv.key.cformat,':',iv.FName);
Assert(resource_instance<>nil);
DescriptorGroup.BindImage(fset,bind,
iv.FHandle,
GetImageLayout(resource_instance^.curr));
end;
vbStorage:
begin
//reset dst_sel
FView.dstSel:=Default(TvDstSel);
//
//ri:=TvImage2(resource_instance^.resource^.rimage);
iv:=ri.FetchView(ctx.Cmd,FView,iu_storage);
ri:=FetchImage(ctx.Cmd,
FImage,
resource_instance^.curr.img_usage
);
Writeln('BindStorage:->'#13#10,
' 0x',HexStr(ri.FHandle,16),':',ri.key.cformat,':',ri.FName,'->'#13#10,
' 0x',HexStr(iv.FHandle,16),':',iv.key.cformat,':',iv.FName);
Assert(ri<>nil);
DescriptorGroup.BindStorage(fset,bind,
iv.FHandle,
GetImageLayout(resource_instance^.curr));
end;
vbMipStorage:
begin
//reset dst_sel
FView.dstSel:=Default(TvDstSel);
//
Layout:=GetImageLayout(resource_instance^.curr);
BindMipStorage(ctx,
fset,bind,
DescriptorGroup,
ri,
FView,
GetImageLayout(resource_instance^.curr));
case btype of
vbSampled:
begin
iv:=ri.FetchView(ctx.Cmd,FView,iu_sampled);
Assert(iv<>nil);
Writeln('BindImage:->'#13#10,
' 0x',HexStr(ri.FHandle,16),':',ri.key.cformat,':',ri.FName,'->'#13#10,
' 0x',HexStr(iv.FHandle,16),':',iv.key.cformat,':',iv.FName);
DescriptorGroup.BindImage(fset,bind,
iv.FHandle,
Layout);
end;
vbStorage:
begin
//reset dst_sel
FView.dstSel:=Default(TvDstSel);
//
iv:=ri.FetchView(ctx.Cmd,FView,iu_storage);
Assert(iv<>nil);
Writeln('BindStorage:->'#13#10,
' 0x',HexStr(ri.FHandle,16),':',ri.key.cformat,':',ri.FName,'->'#13#10,
' 0x',HexStr(iv.FHandle,16),':',iv.key.cformat,':',iv.FName);
DescriptorGroup.BindStorage(fset,bind,
iv.FHandle,
Layout);
end;
vbMipStorage:
begin
//reset dst_sel
FView.dstSel:=Default(TvDstSel);
//
BindMipStorage(ctx,
fset,bind,
DescriptorGroup,
ri,
FView,
Layout);
end;
else
Assert(false);
end;
end;
else
Assert(false);
end;
end;

View File

@ -568,6 +568,7 @@ var
tmp:t_pm4_resource;
begin
if (rkey.cformat=VK_FORMAT_UNDEFINED) then Exit(nil);
if (rkey.params.invalid<>0) then Exit(nil);
tmp:=Default(t_pm4_resource);
tmp.rtype:=R_IMG;
@ -717,6 +718,7 @@ var
i:p_pm4_resource_instance;
begin
if (rkey.cformat=VK_FORMAT_UNDEFINED) then Exit(nil);
if (rkey.params.invalid<>0) then Exit(nil);
r:=fetch_image_resource (rkey,hint);
i:=fetch_resource_instance(scope,r,mem_usage,img_usage);

View File

@ -492,7 +492,7 @@ end;
/////////
const
dst_sel_char:array[0..7] of AnsiChar='01__RGBA';
dst_sel_char:array[0..7] of AnsiChar='0123RGBA';
function _get_dst_sel_str(x,y,z,w:Byte):RawByteString;
begin

View File

@ -482,11 +482,13 @@ var
pSrc,pDst:Pointer;
begin
{
pDst:=nil;
if get_dmem_ptr(dst,@pDst,nil) then
begin
dst:=pDst;
end;
}
//
m_bytePerElement:=tiler.m_bytePerElement;
@ -1094,7 +1096,12 @@ begin
if (IMAGE_USAGE and TM_READ)=0 then Exit;
if image.key.params.samples>1 then
if (image.key.params.samples>1) then
begin
Exit;
end;
if (image.key.params.invalid<>0) then
begin
Exit;
end;
@ -1150,7 +1157,12 @@ begin
Result:=True;
if (cmd=nil) or (image=nil) then Exit;
if image.key.params.samples>1 then
if (image.key.params.samples>1) then
begin
Exit;
end;
if (image.key.params.invalid<>0) then
begin
Exit;
end;

View File

@ -1910,9 +1910,17 @@ begin
Result:=VK_FORMAT_UNDEFINED;
if (PV=nil) then Exit;
if (PV^.dfmt=BUF_DATA_FORMAT_INVALID) then
begin
Exit(VK_FORMAT_UNDEFINED);
Case PV^.nfmt of
BUF_NUM_FORMAT_RESERVED_6:
Exit(VK_FORMAT_UNDEFINED);
else;
end;
case PV^.dfmt of
BUF_DATA_FORMAT_INVALID,
BUF_DATA_FORMAT_RESERVED_15:
Exit(VK_FORMAT_UNDEFINED);
else;
end;
Case PV^.nfmt of
@ -2025,6 +2033,36 @@ begin
Result:=VK_FORMAT_UNDEFINED;
if (PT=nil) then Exit;
Case PT^.nfmt of
IMG_NUM_FORMAT_RESERVED_6 ,
IMG_NUM_FORMAT_RESERVED_8 ,
IMG_NUM_FORMAT_RESERVED_10,
IMG_NUM_FORMAT_RESERVED_11,
IMG_NUM_FORMAT_RESERVED_12,
IMG_NUM_FORMAT_RESERVED_13,
IMG_NUM_FORMAT_RESERVED_14,
IMG_NUM_FORMAT_RESERVED_15:
Exit(VK_FORMAT_UNDEFINED);
else;
end;
Case PT^.dfmt of
IMG_DATA_FORMAT_INVALID ,
IMG_DATA_FORMAT_RESERVED_15,
IMG_DATA_FORMAT_RESERVED_23,
IMG_DATA_FORMAT_RESERVED_24,
IMG_DATA_FORMAT_RESERVED_25,
IMG_DATA_FORMAT_RESERVED_26,
IMG_DATA_FORMAT_RESERVED_27,
IMG_DATA_FORMAT_RESERVED_28,
IMG_DATA_FORMAT_RESERVED_29,
IMG_DATA_FORMAT_RESERVED_30,
IMG_DATA_FORMAT_RESERVED_31,
IMG_DATA_FORMAT_1_REVERSED :
Exit(VK_FORMAT_UNDEFINED);
else;
end;
Case PT^.nfmt of
IMG_NUM_FORMAT_UNORM :
case PT^.dfmt of
@ -2196,6 +2234,11 @@ begin
Result.Addr:=Pointer(PT^.base shl 8);
Result.cformat:=_get_tsharp4_cformat(PT);
if (Result.cformat=VK_FORMAT_UNDEFINED) then
begin
Result.params.invalid:=1;
end;
Case PT^._type of
SQ_RSRC_IMG_1D,
SQ_RSRC_IMG_1D_ARRAY :Result.params.itype:=ord(VK_IMAGE_TYPE_1D);