This commit is contained in:
Pavel 2025-05-27 14:17:12 +03:00
parent b75f4ed26a
commit 368d9bc2dc
6 changed files with 59 additions and 22 deletions

View File

@ -1108,6 +1108,7 @@ begin
begin
For i:=0 to High(UniformBuilder.FBuffers) do
With UniformBuilder.FBuffers[i] do
if (memuse and TM_INVAL)=0 then
begin
resource_instance:=ctx.node^.scope.find_buffer_resource_instance(R_BUF,addr,size);
@ -1412,6 +1413,7 @@ begin
begin
For i:=0 to High(UniformBuilder.FBuffers) do
With UniformBuilder.FBuffers[i] do
if (memuse and TM_INVAL)=0 then
begin
resource_instance:=ctx.node^.scope.find_buffer_resource_instance(R_BUF,addr,size);
@ -2321,17 +2323,17 @@ begin
case node^.ntype of
ntDrawIndex2:
begin
Writeln('DrawIndexOffset2(',node^.indexOffset,',',node^.vertexOffset,',',node^.indexCount,')');
Writeln(node^.id,':DrawIndexOffset2(',node^.indexOffset,',',node^.vertexOffset,',',node^.indexCount,')');
ctx.Cmd.DrawIndexOffset2(Pointer(node^.indexBase),node^.indexOffset,node^.vertexOffset,node^.indexCount);
end;
ntDrawIndexOffset2:
begin
Writeln('DrawIndexOffset2(',node^.indexOffset,',',node^.vertexOffset,',',node^.indexCount,')');
Writeln(node^.id,':DrawIndexOffset2(',node^.indexOffset,',',node^.vertexOffset,',',node^.indexCount,')');
ctx.Cmd.DrawIndexOffset2(Pointer(node^.indexBase),node^.indexOffset,node^.vertexOffset,node^.indexCount);
end;
ntDrawIndexAuto:
begin
Writeln('DrawIndexAuto(',node^.vertexOffset,',',node^.indexCount,')');
Writeln(node^.id,':DrawIndexAuto(',node^.vertexOffset,',',node^.indexCount,')');
ctx.Cmd.DrawIndexAuto(node^.vertexOffset,node^.indexCount);
end;
ntClearDepth:

View File

@ -1448,6 +1448,7 @@ begin
begin
For i:=0 to High(UniformBuilder.FBuffers) do
With UniformBuilder.FBuffers[i] do
if (memuse and TM_INVAL)=0 then
begin
insert_buffer_resource(@node^.scope,

View File

@ -916,6 +916,9 @@ end;
procedure print_vsharp(PV:PVSharpResource4);
begin
if (PV=nil) then Exit;
Writeln('[V#]:0x',HexStr(PV));
Writeln('base=',HexStr(PV^.base and (not 3),10));
Writeln('stride=',PV^.stride);
Writeln('cache_swizzle=',PV^.cache_swizzle);
@ -943,6 +946,9 @@ end;
procedure print_tsharp4(PT:PTSharpResource4);
begin
if (PT=nil) then Exit;
Writeln('[T#]:0x',HexStr(PT));
Writeln('base=',HexStr(QWORD(PT^.base) shl 8,10));
Writeln('min_lod=',_get_lod_str(PT^.min_lod));

View File

@ -977,6 +977,9 @@ begin
Writer.IntOpt('NFMT',nfmt);
Writer.IntOpt('STRD',stride);
Writer.StrOpt('DSEL',_get_dst_sel_str(dst_sel_x,dst_sel_y,dst_sel_z,dst_sel_w));
end else
begin
Writer.IntOpt('DFMT',dfmt); //0->invalid
end;
end;
@ -999,7 +1002,8 @@ begin
Writer.StrOpt('DSEL',_get_dst_sel_str(dst_sel_x,dst_sel_y,dst_sel_z,dst_sel_w));
end else
begin
Writer.IntOpt('NUMT',GetNumType(nfmt));
Writer.IntOpt('DFMT',dfmt); //0->invalid
Writer.IntOpt('NFMT',nfmt);
end;
end;

View File

@ -87,10 +87,11 @@ type
const
//usage image
TM_READ =1;
TM_WRITE=2;
TM_CLEAR=4;
TM_MIXED=8;
TM_READ =1;
TM_WRITE =2;
TM_CLEAR =4; //Render target is cleared
TM_MIXED =8; //Mixed image usage
TM_INVAL=16; //invalid buffer/image
type
t_image_usage=(iu_attachment,iu_depthstenc,iu_sampled,iu_storage,iu_transfer,iu_buffer,iu_htile,iu_cmask);

View File

@ -778,7 +778,6 @@ begin
'DFMT':L^.rinfo.dfmt :=StrToDWord2(V);
'NFMT':L^.rinfo.nfmt :=StrToDWord2(V);
'STRD':L^.rinfo.stride :=StrToDWord2(V);
'NUMT':L^.rinfo.nfmt :=StrToDWord2(V);
'TYPE':L^.rinfo.rtype :=StrToDWord2(V);
'DSEL':L^.rinfo.dstsel :=StrToDstSel(V);
@ -1317,6 +1316,8 @@ var
begin
if (PV=nil) then Exit;
Assert(PV^.dfmt<>0,'AddVSharp:invalid dfmt!');
pv_base :=Pointer(PV^.base and (not 3));
pv_stride:=PV^.stride;
pv_count :=PV^.num_records;
@ -1431,7 +1432,7 @@ begin
Assert(PV<>nil);
if (PV=nil) then Exit;
//print_vsharp(PV);
//print_vsharp(PVSharpResource4(PV));
b:=Default(TBufBindExt);
b.fset :=fset;
@ -1475,17 +1476,21 @@ Procedure TvUniformBuilder.AddVSharp4(PV:PVSharpResource4;fset,bind,size,offset:
var
b:TBufBindExt;
stride,num_records:Integer;
invalid:Integer;
begin
Assert(PV<>nil);
if (PV=nil) then Exit;
//print_vsharp(PV);
invalid:=ord(PV^.dfmt=0)*TM_INVAL;
b:=Default(TBufBindExt);
b.fset :=fset;
b.bind :=bind;
b.offset:=offset;
b.memuse:=_get_buf_mem_usage(flags);
b.memuse:=_get_buf_mem_usage(flags) or invalid;
b.addr:=Pointer(PV^.base and (not 3));
@ -1548,6 +1553,8 @@ begin
b.FImage:=_get_tsharp4_image_info(PT,hint);
b.FView :=_get_tsharp4_image_view(PT,hint);
b.memuse:=b.memuse or (b.FImage.params.invalid)*TM_INVAL;
Insert(b,FImages,Length(FImages));
end;
@ -1578,6 +1585,8 @@ begin
b.FImage:=_get_tsharp8_image_info(PT,hint);
b.FView :=_get_tsharp8_image_view(PT,hint);
b.memuse:=b.memuse or (b.FImage.params.invalid)*TM_INVAL;
Insert(b,FImages,Length(FImages));
end;
@ -1871,6 +1880,11 @@ begin
end;
end;
function IsInvalid(dfmt:Byte):Boolean; inline;
begin
Result:=(dfmt=0);
end;
procedure TvUnifChecker.AddAttr(const b:TvCustomLayout;Fset:TVkUInt32;pUserData,pImmData:PDWORD);
var
P:Pointer;
@ -1933,16 +1947,25 @@ begin
begin
if rinfo.enable then
if ( dfmt<>rinfo.dfmt ) or
( nfmt<>rinfo.nfmt ) or
( stride<>rinfo.stride ) or
(dst_sel_x<>rinfo.dstsel.x) or
(dst_sel_y<>rinfo.dstsel.y) or
(dst_sel_z<>rinfo.dstsel.z) or
(dst_sel_w<>rinfo.dstsel.w) then
begin
FResult:=False;
Exit;
if ( dfmt<>rinfo.dfmt ) or
( nfmt<>rinfo.nfmt ) or
( stride<>rinfo.stride ) or
(dst_sel_x<>rinfo.dstsel.x) or
(dst_sel_y<>rinfo.dstsel.y) or
(dst_sel_z<>rinfo.dstsel.z) or
(dst_sel_w<>rinfo.dstsel.w) then
begin
FResult:=False;
Exit;
end;
end else
begin
if (IsInvalid(dfmt)<>IsInvalid(rinfo.dfmt)) then
begin
FResult:=False;
Exit;
end;
end;
end;
@ -1971,8 +1994,8 @@ begin
end;
end else
begin
//rinfo.nfmt -> NUMT
if (GetNumType(nfmt)<>rinfo.nfmt) then
if ( IsInvalid(dfmt)<>IsInvalid(rinfo.dfmt) ) or
(GetNumType(nfmt)<>GetNumType(rinfo.nfmt)) then
begin
FResult:=False;
Exit;