This commit is contained in:
Pavel 2024-07-19 22:19:52 +03:00
parent 5ffc77219b
commit 20caf6debf
14 changed files with 395 additions and 262 deletions

View File

@ -633,6 +633,8 @@ Procedure t_me_render_context.InsertLabel(pLabelName:PVkChar);
begin
if (DebugReport.FCmdInsertDebugUtilsLabel=nil) then Exit;
if (Cmd=nil) then Exit;
BeginCmdBuffer;
Cmd.InsertLabel(pLabelName);
@ -642,6 +644,8 @@ Procedure t_me_render_context.BeginLabel(pLabelName:PVkChar);
begin
if (DebugReport.FCmdBeginDebugUtilsLabel=nil) then Exit;
if (Cmd=nil) then Exit;
BeginCmdBuffer;
Cmd.BeginLabel(pLabelName);
@ -778,9 +782,9 @@ begin
_init;
DescriptorGroup.FSets[fset].BindImg(bind,0,
iv.FHandle,
VK_IMAGE_LAYOUT_GENERAL);
DescriptorGroup.FSets[fset].BindImage(bind,0,
iv.FHandle,
VK_IMAGE_LAYOUT_GENERAL);
end;
@ -797,7 +801,7 @@ begin
_init;
DescriptorGroup.FSets[fset].BindSmp(bind,0,sm.FHandle);
DescriptorGroup.FSets[fset].BindSampler(bind,0,sm.FHandle);
end;
end;
@ -839,11 +843,11 @@ begin
_init;
DescriptorGroup.FSets[fset].BindBuf(bind,0,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
buf.FHandle,
diff,
range {VK_WHOLE_SIZE});
DescriptorGroup.FSets[fset].BindBuffer(bind,0,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
buf.FHandle,
diff,
range {VK_WHOLE_SIZE});
if ((memuse and TM_WRITE)<>0) then
begin
@ -856,13 +860,45 @@ begin
end;
procedure Bind_Pushs(var ctx:t_me_render_context;
ShaderGroup:TvShaderGroup;
dst:PGPU_USERDATA);
const
bind_points:array[Boolean] of TVkPipelineBindPoint=(VK_PIPELINE_BIND_POINT_GRAPHICS,VK_PIPELINE_BIND_POINT_COMPUTE);
var
Shader:TvShaderExt;
i:TvShaderStage;
FData:PDWORD;
addr:Pointer;
begin
For i:=Low(TvShaderStage) to High(TvShaderStage) do
begin
Shader:=ShaderGroup.FKey.FShaders[i];
if (Shader<>nil) then
if (Shader.FPushConst.size<>0) then
begin
FData:=dst^.get_user_data(i);
addr :=Shader.GetPushConstData(FData);
Assert(addr<>nil,'push const');
ctx.Cmd.PushConstant(bind_points[Shader.FStage=VK_SHADER_STAGE_COMPUTE_BIT],
ord(Shader.FStage),
Shader.FPushConst.offset,
Shader.FPushConst.size,
addr);
end;
end;
end;
procedure pm4_InitStream(var ctx:t_me_render_context);
var
i:p_pm4_resource_instance;
resource:p_pm4_resource;
ri:TvImage2;
ht:TvHtile;
ht:TvMetaHtile;
begin
if ctx.stream^.init then Exit;
@ -1279,6 +1315,8 @@ begin
ctx.Cmd.BindSets(BP_GRAPHICS,FDescriptorGroup);
end;
Bind_Pushs(ctx,ctx.rt_info^.ShaderGroup,@ctx.rt_info^.USERDATA);
end;
procedure pm4_Writeback_After(var ctx:t_me_render_context);
@ -1382,7 +1420,7 @@ end;
procedure pm4_Writeback_Finish(var ctx:t_me_render_context);
var
ri:TvImage2;
ht:TvHtile;
ht:TvMetaHtile;
resource:p_pm4_resource;
begin
@ -1547,7 +1585,8 @@ var
resource_instance:p_pm4_resource_instance;
resource:p_pm4_resource;
ht:TvHtile;
//ht:TvMetaHtile;
hb:TvMetaBuffer;
begin
resource:=nil;
@ -1558,34 +1597,35 @@ begin
With UniformBuilder.FBuffers[i] do
begin
resource_instance:=ctx.node^.scope.find_buffer_resource_instance(addr,size);
if (resource_instance<>nil) then
if ((memuse and TM_WRITE)<>0) then
begin
if (iu_htile in resource_instance^.next.img_usage) then
resource_instance:=ctx.node^.scope.find_buffer_resource_instance(addr,size);
if (resource_instance<>nil) then
begin
resource:=ctx.stream^.find_htile_resource(addr,size);
resource:=resource_instance^.resource;
Break;
end;
end;
end;
end;
//buffers
if (resource<>nil) then
begin
resource^.rclear:=True;
end else
if Length(UniformBuilder.FBuffers)>2 then
With UniformBuilder.FBuffers[2] do
begin
ht:=FetchHtile(ctx.Cmd,addr,size);
Assert(resource<>nil);
ht.rclear:=True;
resource^.rclear:=True;
hb:=FetchBuffer(ctx.Cmd,resource^.rkey.Addr,resource^.rsize);
hb.rclear:=True;
if (iu_htile in resource_instance^.next.img_usage) then
begin
resource:=ctx.stream^.find_htile_resource(resource^.rkey.Addr,resource^.rsize);
//
if (resource<>nil) then
begin
resource^.rclear:=True;
end;
end;
end;
@ -1644,6 +1684,8 @@ begin
ctx.Cmd.BindSets(BP_COMPUTE,FDescriptorGroup);
end;
Bind_Pushs(ctx,CP_KEY.FShaderGroup,dst);
end;
procedure pm4_DispatchDirect(var ctx:t_me_render_context;node:p_pm4_node_DispatchDirect);

View File

@ -1493,7 +1493,7 @@ begin
begin
Writeln('\HINT_PUSH_MARKER:',Body);
end;
pctx^.stream[pctx^.curr_ibuf^.buft].Hint(PChar('\HINT_PUSH_MARKER:'+Body));
pctx^.stream[pctx^.curr_ibuf^.buft].Hint('\HINT_PUSH_MARKER:',Body);
end;
procedure onPopMarker(pctx:p_pfp_ctx);
@ -1502,7 +1502,7 @@ begin
begin
Writeln('\HINT_POP_MARKER');
end;
pctx^.stream[pctx^.curr_ibuf^.buft].Hint('\HINT_POP_MARKER');
pctx^.stream[pctx^.curr_ibuf^.buft].Hint('\HINT_POP_MARKER','');
end;
procedure onSetMarker(pctx:p_pfp_ctx;Body:PChar);
@ -1511,7 +1511,7 @@ begin
begin
Writeln('\HINT_SET_MARKER:',Body);
end;
pctx^.stream[pctx^.curr_ibuf^.buft].Hint(PChar('\HINT_SET_MARKER:'+Body));
pctx^.stream[pctx^.curr_ibuf^.buft].Hint('\HINT_SET_MARKER:',Body);
end;
procedure onWidthHeight(Body:PWORD);

View File

@ -356,7 +356,7 @@ type
procedure Acquire;
function Release:Boolean;
//
procedure Hint (P:PChar);
procedure Hint (P1,P2:PChar);
procedure LoadConstRam (addr:Pointer;num_dw,offset:Word);
procedure EventWrite (eventType:Byte);
procedure EventWriteEop(addr:Pointer;data:QWORD;eventType,dataSel,intSel:Byte);
@ -368,7 +368,10 @@ type
procedure FastClear (var CX_REG:TCONTEXT_REG_GROUP);
procedure Resolve (var CX_REG:TCONTEXT_REG_GROUP);
function ColorControl (var CX_REG:TCONTEXT_REG_GROUP):Boolean;
procedure Init_Uniforms(node:p_pm4_node;var FUniformBuilder:TvUniformBuilder);
procedure Init_Uniforms(node:p_pm4_node;var UniformBuilder:TvUniformBuilder);
procedure Init_Pushs (node:p_pm4_node;
ShaderGroup:TvShaderGroup;
var GPU_REGS:TGPU_REGS);
procedure Build_rt_info(node:p_pm4_node;
var rt_info:t_pm4_rt_info;
var GPU_REGS:TGPU_REGS);
@ -832,18 +835,20 @@ end;
//
procedure t_pm4_stream.Hint(P:PChar);
procedure t_pm4_stream.Hint(P1,P2:PChar);
var
len:ptruint;
len1,len2:ptruint;
node:p_pm4_node_Hint;
begin
len:=StrLen(P);
node:=allocator.Alloc(SizeOf(t_pm4_node_Hint)+len+1);
len1:=StrLen(P1);
len2:=StrLen(P2);
node:=allocator.Alloc(SizeOf(t_pm4_node_Hint)+len1+len2+1);
node^.ntype :=ntHint;
node^.scope :=Default(t_pm4_resource_curr_scope);
Move(P^,node^.data,len+1);
Move(P1^,node^.data,len1);
Move(P2^,PChar(@node^.data)[len1],len2+1);
add_node(node);
end;
@ -1077,17 +1082,16 @@ begin
end;
procedure t_pm4_stream.Init_Uniforms(node:p_pm4_node;var FUniformBuilder:TvUniformBuilder);
procedure t_pm4_stream.Init_Uniforms(node:p_pm4_node;var UniformBuilder:TvUniformBuilder);
var
i:Integer;
begin
//images
if (Length(FUniformBuilder.FImages)<>0) then
if (Length(UniformBuilder.FImages)<>0) then
begin
For i:=0 to High(FUniformBuilder.FImages) do
With FUniformBuilder.FImages[i] do
For i:=0 to High(UniformBuilder.FImages) do
With UniformBuilder.FImages[i] do
begin
insert_image_resource(@node^.scope,
@ -1100,10 +1104,10 @@ begin
//images
//buffers
if (Length(FUniformBuilder.FBuffers)<>0) then
if (Length(UniformBuilder.FBuffers)<>0) then
begin
For i:=0 to High(FUniformBuilder.FBuffers) do
With FUniformBuilder.FBuffers[i] do
For i:=0 to High(UniformBuilder.FBuffers) do
With UniformBuilder.FBuffers[i] do
begin
insert_buffer_resource(@node^.scope,
@ -1117,6 +1121,33 @@ begin
end;
procedure t_pm4_stream.Init_Pushs(node:p_pm4_node;
ShaderGroup:TvShaderGroup;
var GPU_REGS:TGPU_REGS);
var
Shader:TvShaderExt;
i:TvShaderStage;
FData:PDWORD;
addr:Pointer;
begin
For i:=Low(TvShaderStage) to High(TvShaderStage) do
begin
Shader:=ShaderGroup.FKey.FShaders[i];
if (Shader<>nil) then
if (Shader.FPushConst.size<>0) then
begin
FData:=GPU_REGS.get_user_data(i);
addr :=Shader.GetPushConstData(FData);
insert_buffer_resource(@node^.scope,
addr,
Shader.FPushConst.size,
TM_READ);
end;
end;
end;
procedure t_pm4_stream.Build_rt_info(node:p_pm4_node;
var rt_info:t_pm4_rt_info;
var GPU_REGS:TGPU_REGS);
@ -1125,6 +1156,9 @@ var
RT:TRT_INFO;
FUniformBuilder:TvUniformBuilder;
pa:TPushConstAllocator;
pp:PPushConstAllocator;
resource_instance:p_pm4_resource_instance;
begin
for i:=0 to 31 do
@ -1134,9 +1168,6 @@ begin
GPU_REGS.export_user_data_rt(@rt_info.USERDATA);
rt_info.ShaderGroup:=FetchShaderGroupRT(GPU_REGS,nil{@pa});
Assert(rt_info.ShaderGroup<>nil);
rt_info.RT_COUNT:=0;
if GPU_REGS.COMP_ENABLE then
@ -1217,6 +1248,14 @@ begin
//
pa.Init;
pp:=@pa;
rt_info.ShaderGroup:=FetchShaderGroupRT(GPU_REGS,pp);
Assert(rt_info.ShaderGroup<>nil);
//
FUniformBuilder:=Default(TvUniformBuilder);
rt_info.ShaderGroup.ExportUnifBuilder(FUniformBuilder,@rt_info.USERDATA);
@ -1314,13 +1353,19 @@ procedure t_pm4_stream.Build_cs_info(node:p_pm4_node_DispatchDirect;var GPU_REGS
var
dst:PGPU_USERDATA;
FUniformBuilder:TvUniformBuilder;
pa:TPushConstAllocator;
pp:PPushConstAllocator;
begin
//hack
dst:=Pointer(@node^.USER_DATA_CS)-Ptruint(@TGPU_USERDATA(nil^).A[vShaderStageCs]);
GPU_REGS.export_user_data_cs(dst);
node^.ShaderGroup:=FetchShaderGroupCS(GPU_REGS,nil{@pa});
pa.Init;
pp:=@pa;
node^.ShaderGroup:=FetchShaderGroupCS(GPU_REGS,pp);
Assert(node^.ShaderGroup<>nil);
node^.DIM_X:=GPU_REGS.SH_REG^.COMPUTE_DIM_X;

View File

@ -952,8 +952,10 @@ begin
pConfig:=FEmit.GetConfig;
node:=FindUserDataBuf;
if (node<>nil) and (FPushConstant=nil) then
if (node^.write_count=0) and
if (node<>nil) and
(FPushConstant=nil) then
if (node^.bType=btStorageBuffer) and
(node^.chain_write=0) and
(node^.GetSize<=pConfig^.maxPushConstantsSize) then
begin
node^.bType :=btPushConstant;
@ -969,7 +971,8 @@ begin
fchain_write:=node^.chain_write;
if (FPushConstant=nil) and
if (not pConfig^.UseOnlyUserdataPushConst) and
(FPushConstant=nil) and
(fchain_write=0) and
(node^.GetSize<=pConfig^.maxPushConstantsSize) then
begin

View File

@ -11,6 +11,7 @@ type
UseVertexInput:Boolean; //True
UseTexelBuffer:Boolean;
UseOutput16:Boolean;
UseOnlyUserdataPushConst:Boolean;
//
DescriptorSet:DWORD; //0
//

View File

@ -6,7 +6,6 @@ interface
uses
SysUtils,
Math,
atomic,
Vulkan;
@ -27,6 +26,7 @@ type
F16_8:TVkPhysicalDeviceShaderFloat16Int8Features;
FSF_8:TVkPhysicalDevice8BitStorageFeatures;
FSF16:TVkPhysicalDevice16BitStorageFeatures;
FSFRF:TVkPhysicalDeviceRobustness2FeaturesEXT;
//
Constructor Create(debug,printf,validate:Boolean);
Destructor Destroy; override;
@ -268,6 +268,8 @@ var
VK_KHR_shader_non_semantic_info :Boolean;
VK_EXT_index_type_uint8 :Boolean;
VK_EXT_scalar_block_layout :Boolean;
VK_EXT_robustness2 :Boolean;
VK_EXT_image_view_min_lod :Boolean;
VK_AMD_device_coherent_memory :Boolean;
@ -445,6 +447,8 @@ begin
VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME :limits.VK_KHR_shader_non_semantic_info :=True;
VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME :limits.VK_EXT_index_type_uint8 :=True;
VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME :limits.VK_EXT_scalar_block_layout :=True;
VK_EXT_ROBUSTNESS_2_EXTENSION_NAME :limits.VK_EXT_robustness2 :=True;
VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME :limits.VK_EXT_image_view_min_lod :=True;
VK_AMD_DEVICE_COHERENT_MEMORY_EXTENSION_NAME :limits.VK_AMD_device_coherent_memory :=True;
end;
@ -870,6 +874,7 @@ begin
F16_8:=Default(TVkPhysicalDeviceShaderFloat16Int8Features);
FSF_8:=Default(TVkPhysicalDevice8BitStorageFeatures);
FSF16:=Default(TVkPhysicalDevice16BitStorageFeatures);
FSFRF:=Default(TVkPhysicalDeviceRobustness2FeaturesEXT);
if (vkGetPhysicalDeviceFeatures2<>nil) then
begin
@ -885,6 +890,9 @@ begin
FSF_8.pNext:=@FSF16;
FSF16.sType:=VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES;
FSF16.pNext:=@FSFRF;
FSFRF.sType:=VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT;
vkGetPhysicalDeviceFeatures2(FPhysicalDevice,@Features2);
@ -1702,6 +1710,8 @@ var
F16_8:TVkPhysicalDeviceShaderFloat16Int8Features;
FSF_8:TVkPhysicalDevice8BitStorageFeatures;
FSF16:TVkPhysicalDevice16BitStorageFeatures;
FSFRF:TVkPhysicalDeviceRobustness2FeaturesEXT;
FIVML:TVkPhysicalDeviceImageViewMinLodFeaturesEXT;
FScalar:TVkPhysicalDeviceScalarBlockLayoutFeatures;
@ -1879,6 +1889,28 @@ begin
DeviceInfo.add_feature(@FSF16);
end;
if limits.VK_EXT_robustness2 then
begin
DeviceInfo.add_ext(VK_EXT_ROBUSTNESS_2_EXTENSION_NAME);
FSFRF:=Default(TVkPhysicalDeviceRobustness2FeaturesEXT);
FSFRF.sType :=VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT;
FSFRF.nullDescriptor:=VulkanApp.FSFRF.nullDescriptor;
DeviceInfo.add_feature(@FSFRF);
end;
if limits.VK_EXT_image_view_min_lod then
begin
DeviceInfo.add_ext(VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME);
FIVML:=Default(TVkPhysicalDeviceImageViewMinLodFeaturesEXT);
FIVML.sType :=VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_MIN_LOD_FEATURES_EXT;
FIVML.minLod:=VK_TRUE;
DeviceInfo.add_feature(@FIVML);
end;
Device:=TvDevice.Create(DeviceInfo);
DeviceInfo.Free;

View File

@ -12,6 +12,9 @@ uses
vMemory,
vDependence;
const
VK_FORMAT_R10G11B11_UFLOAT_FAKE32=TVkFormat(ord(VK_FORMAT_B10G11R11_UFLOAT_PACK32)+1000000000);
type
PvImageBarrier=^TvImageBarrier;
TvImageBarrier=object
@ -141,6 +144,7 @@ type
last_level:Byte; //last mip level (0..15)
base_array:Word; //first array index (0..16383)
last_array:Word; //texture height (0..16383)
minLod :TVkFloat;
end;
TvImage=class(TvCustomImage)
@ -339,6 +343,8 @@ begin
VK_FORMAT_A2B10G10R10_UNORM_PACK32:Result:=4;
VK_FORMAT_B10G11R11_UFLOAT_PACK32 :Result:=4;
VK_FORMAT_R10G11B11_UFLOAT_FAKE32 :Result:=4;
VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 :Result:=4;
//stencil
@ -773,6 +779,7 @@ begin
VK_FORMAT_R32_SINT :Result:=@MUTABLE_8888;
VK_FORMAT_R32_SFLOAT :Result:=@MUTABLE_8888;
VK_FORMAT_B10G11R11_UFLOAT_PACK32 :Result:=@MUTABLE_8888;
VK_FORMAT_R10G11B11_UFLOAT_FAKE32 :Result:=@MUTABLE_8888;
VK_FORMAT_R16G16B16A16_UNORM :Result:=@MUTABLE_3232;
VK_FORMAT_R16G16B16A16_SNORM :Result:=@MUTABLE_3232;
@ -913,6 +920,8 @@ begin
VK_FORMAT_R32_SFLOAT,
VK_FORMAT_B10G11R11_UFLOAT_PACK32:Result:=VK_FORMAT_R32_UINT;
VK_FORMAT_R10G11B11_UFLOAT_FAKE32:Result:=VK_FORMAT_R32_UINT;
VK_FORMAT_R16G16B16A16_SNORM,
VK_FORMAT_R16G16B16A16_USCALED,
VK_FORMAT_R16G16B16A16_SSCALED,
@ -967,6 +976,8 @@ begin
VK_FORMAT_A8B8G8R8_UNORM_PACK32..
VK_FORMAT_A2B10G10R10_SINT_PACK32,
VK_FORMAT_R10G11B11_UFLOAT_FAKE32,
VK_FORMAT_B10G11R11_UFLOAT_PACK32..
VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
Result:=VK_IMAGE_USAGE_DEFAULT;
@ -993,6 +1004,8 @@ begin
VK_FORMAT_A8B8G8R8_UNORM_PACK32..
VK_FORMAT_A2B10G10R10_SINT_PACK32,
VK_FORMAT_R10G11B11_UFLOAT_FAKE32,
VK_FORMAT_B10G11R11_UFLOAT_PACK32..
VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:
Result:=ord(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
@ -1033,10 +1046,10 @@ begin
begin
Result.width :=(Result.width +3) shr 2;
Result.height:=(Result.height+3) shr 2;
//
Result.pad_width :=(Result.pad_width +3) shr 2;
Result.pad_height:=(Result.pad_height+3) shr 2;
end;
Result.pad_width :=0;
Result.pad_height:=0;
end;
Function CompareNormalized(const a,b:TvImageKey):Integer;
@ -1575,8 +1588,8 @@ begin
end;
//D16_UNORM_S8_UINT -> D24_UNORM_S8_UINT -> D32_SFLOAT_S8_UINT
//X8_D24_UNORM_PACK32 -> D32_SFLOAT
//D16_UNORM_S8_UINT -> D24_UNORM_S8_UINT -> D32_SFLOAT_S8_UINT
//D16_UNORM -> X8_D24_UNORM_PACK32 -> D32_SFLOAT
function vkFixFormatSupport(format:TVkFormat;tiling:TVkImageTiling;usage:TVkImageUsageFlags):TVkFormat;
begin
@ -1598,6 +1611,12 @@ begin
Result:=VK_FORMAT_D32_SFLOAT_S8_UINT;
end;
VK_FORMAT_D16_UNORM:
begin
if vkGetFormatSupport(Result,tiling,usage) then Break;
Result:=VK_FORMAT_X8_D24_UNORM_PACK32;
end;
VK_FORMAT_X8_D24_UNORM_PACK32:
begin
if vkGetFormatSupport(Result,tiling,usage) then Break;

View File

@ -497,6 +497,7 @@ var
cinfo:TVkImageViewCreateInfo;
uinfo:TVkImageViewUsageCreateInfo;
minfo:TVkImageViewMinLodCreateInfoEXT;
FView:TVkImageView;
r:TVkResult;
@ -540,11 +541,19 @@ begin
cinfo.format:=vkFixFormatSupport(cinfo.format,VK_IMAGE_TILING_OPTIMAL,usage);
cinfo.pNext:=@uinfo;
uinfo:=Default(TVkImageViewUsageCreateInfo);
uinfo.sType:=VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO;
uinfo.usage:=usage;
cinfo.pNext:=@uinfo;
if limits.VK_EXT_image_view_min_lod and
(F.minLod<>0) then
begin
minfo:=Default(TVkImageViewMinLodCreateInfoEXT);
minfo.sType :=VK_STRUCTURE_TYPE_IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT;
minfo.minLod:=F.minLod;
end;
FView:=VK_NULL_HANDLE;
r:=vkCreateImageView(Device.FHandle,@cinfo,nil,@FView);

View File

@ -8,8 +8,7 @@ uses
SysUtils,
g23tree,
vDependence,
vImage,
vRegs2Vulkan;
vImage;
type
PMetaKey=^TMetaKey;
@ -24,14 +23,22 @@ type
Key:TMetaKey;
end;
//
TvHtile=class(TvCustomMeta)
TvMetaBuffer=class(TvCustomMeta)
rclear:Boolean;
end;
function FetchHtile(cmd:TvDependenciesObject;const F:TvImageKey;size:DWORD):TvHtile;
function FetchHtile(cmd:TvDependenciesObject;addr:Pointer;size:DWORD):TvHtile;
//
TvMetaHtile=class(TvCustomMeta)
private
function get_rclear:Boolean;
procedure set_rclear(b:Boolean);
public
buffer:TvMetaBuffer;
property rclear:Boolean read get_rclear write set_rclear;
end;
function FetchHtile (cmd:TvDependenciesObject;const F:TvImageKey;size:DWORD;force:Boolean=True):TvMetaHtile;
function FetchBuffer(cmd:TvDependenciesObject;addr:Pointer;size:DWORD;force:Boolean=True):TvMetaBuffer;
implementation
@ -60,53 +67,40 @@ var
lock:Pointer=nil;
FMeta2Set:TvCustomMeta2Set;
//
function TvMetaHtile.get_rclear:Boolean; inline;
begin
Result:=buffer.rclear;
end;
procedure TvMetaHtile.set_rclear(b:Boolean); inline;
begin
buffer.rclear:=b;
end;
//
function Key2CustomMeta(P:PMetaKey):TvCustomMeta; inline;
begin
Result:=TvCustomMeta(ptruint(P)-ptruint(@TvCustomMeta(nil).key));
end;
function _Find(const F:TMetaKey):TvCustomMeta;
label
_repeat;
var
T:TMetaKey;
i:TvCustomMeta2Set.Iterator;
P:PMetaKey;
begin
Result:=nil;
_repeat:
i:=FMeta2Set.find(@F);
if (i.Item=nil) then
begin
T:=F;
T.mkey:=Default(TvImageKey);
T.mkey.Addr:=F.mkey.Addr;
//
i:=FMeta2Set.find(@T);
//
if (i.Item<>nil) then
begin
P:=i.Item^;
//
FMeta2Set.erase(i);
//
P^:=F;
//
FMeta2Set.Insert(P);
//
goto _repeat;
end;
end;
if (i.Item<>nil) then
begin
Result:=Key2CustomMeta(i.Item^);
end;
end;
{
function _Find_be(const F:TMetaKey):TvCustomMeta;
var
i:TvCustomMeta2Set.Iterator;
@ -126,66 +120,93 @@ begin
Result:=Key2CustomMeta(P);
end;
end;
function _FetchHtile(const F:TvImageKey;size:DWORD;is_full:Boolean):TvHtile;
function _Find_buffer(const F:TvImageKey;size:DWORD):TvCustomMeta;
var
t:TvHtile;
M:TMetaKey;
begin
M.mtype:=iu_buffer;
M.mkey :=F;
M.msize:=size;
//
Result:=_Find_be(M);
end;
}
function _FetchMeta(mtype:t_image_usage;const F:TvImageKey;size:DWORD;force:Boolean):TvCustomMeta;
var
t:TvCustomMeta;
M:TMetaKey;
begin
Result:=nil;
M.mtype:=iu_htile;
M.mtype:=mtype;
M.mkey :=F;
M.msize:=size;
if is_full then
begin
t:=TvHtile(_Find(M));
end else
begin
t:=TvHtile(_Find_be(M));
end;
t:=_Find(M);
if (t<>nil) then
begin
//
end else
if force then
begin
t:=TvHtile.Create;
t.Key:=M;
if FMeta2Set.Insert(@t.key) then
begin
t.Acquire(nil); //map ref
case mtype of
iu_buffer:t:=TvMetaBuffer.Create;
iu_htile :t:=TvMetaHtile .Create;
else;
end;
if (t<>nil) then
begin
t.Key:=M;
if FMeta2Set.Insert(@t.key) then
begin
t.Acquire(nil); //map ref
end;
end;
end;
Result:=t;
end;
function FetchHtile(cmd:TvDependenciesObject;const F:TvImageKey;size:DWORD):TvHtile;
function FetchHtile(cmd:TvDependenciesObject;const F:TvImageKey;size:DWORD;force:Boolean=True):TvMetaHtile;
var
B:TvImageKey;
begin
rw_wlock(lock);
Result:=_FetchHtile(F,size,True);
Result:=TvMetaHtile(_FetchMeta(iu_htile,F,size,force));
if (Result<>nil) then
if (Result.buffer=nil) then
begin
//link buffer
B:=Default(TvImageKey);
B.Addr:=F.Addr;
//
Result.buffer:=TvMetaBuffer(_FetchMeta(iu_buffer,B,size,True));
end;
cmd.RefTo(Result);
rw_wunlock(lock);
end;
function FetchHtile(cmd:TvDependenciesObject;addr:Pointer;size:DWORD):TvHtile;
function FetchBuffer(cmd:TvDependenciesObject;addr:Pointer;size:DWORD;force:Boolean=True):TvMetaBuffer;
var
F:TvImageKey;
B:TvImageKey;
begin
F:=Default(TvImageKey);
F.Addr:=addr;
B:=Default(TvImageKey);
B.Addr:=addr;
rw_wlock(lock);
Result:=_FetchHtile(F,size,False);
Result:=TvMetaBuffer(_FetchMeta(iu_buffer,B,size,force));
cmd.RefTo(Result);

View File

@ -45,14 +45,21 @@ type
TvPipelineLayout=class
FHandle:TVkPipelineLayout;
FBinds:ptruint;
key:TvPipelineLayoutKey;
//
FBinds:TVkUInt32;
FSets :TVkUInt32;
FTypes:TVkUInt32;
//
FCounts:TvCountsGroup;
//
Procedure AddLayout(F:TvSetLayout);
Procedure SetLayouts(const A:AvSetLayout);
Procedure AddPushConst(offset,size:TVkUInt32;Flags:TVkShaderStageFlags);
Procedure SetPushConst(const A:AvPushConstantRange);
procedure Clear;
function Compile:Boolean;
procedure calc_counts;
Destructor Destroy; override;
Function isSpace:Boolean;
end;
@ -101,7 +108,6 @@ type
_TvDescriptorSetSet=specialize T23treeSet<TvDescriptorSet,_TvDescriptorSetCompare>;
TvCountsGroup=array[0..14] of TVkUInt32;
AvDescriptorPoolSize=array of TVkDescriptorPoolSize;
TvSetsPool=class
@ -123,10 +129,10 @@ type
TvDescriptorSet2=object
FHandle:TVkDescriptorSet;
Function IsValid:Boolean;
Procedure BindBuf(aBind,aElem:TVkUInt32;dtype:TVkDescriptorType;buffer:TVkBuffer;offset,range:TVkDeviceSize);
Procedure BindSTI(aBind,aElem:TVkUInt32;img:TVkImageView;Layout:TVkImageLayout);
Procedure BindImg(aBind,aElem:TVkUInt32;img:TVkImageView;Layout:TVkImageLayout);
Procedure BindSmp(aBind,aElem:TVkUInt32;smp:TVkSampler);
Procedure BindBuffer (aBind,aElem:TVkUInt32;dtype:TVkDescriptorType;buffer:TVkBuffer;offset,range:TVkDeviceSize);
Procedure BindStorage(aBind,aElem:TVkUInt32;img:TVkImageView;Layout:TVkImageLayout);
Procedure BindImage (aBind,aElem:TVkUInt32;img:TVkImageView;Layout:TVkImageLayout);
Procedure BindSampler(aBind,aElem:TVkUInt32;smp:TVkSampler);
end;
AvDescriptorSet2=Array of TvDescriptorSet2;
@ -299,14 +305,18 @@ end;
Function TvPipelineLayout.isSpace:Boolean;
begin
Result:=FBinds=0;
Result:=(FBinds=0);
end;
procedure TvPipelineLayout.Clear;
begin
SetLength(key.FLayouts,0);
SetLength(key.FLayouts ,0);
SetLength(key.FPushConsts,0);
FBinds:=0;
FSets :=0;
FTypes:=0;
//
FCounts:=Default(TvCountsGroup);
end;
function TvPipelineLayout.Compile:Boolean;
@ -320,7 +330,6 @@ begin
if (FHandle<>VK_NULL_HANDLE) then Exit(True);
FBinds:=0;
if (Length(key.FLayouts)<>0) then
begin
_data_set:=nil;
@ -329,9 +338,9 @@ begin
begin
Assert(key.FLayouts[i]<>nil,'key.FLayouts[i]=nil');
_data_set[i]:=key.FLayouts[i].FHandle;
FBinds:=FBinds+Length(key.FLayouts[i].key.FBinds);
end;
end;
cinfo:=Default(TVkPipelineLayoutCreateInfo);
cinfo.sType :=VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
cinfo.setLayoutCount:=Length(_data_set);
@ -350,9 +359,41 @@ begin
Writeln(StdErr,'vkCreatePipelineLayout:',r);
Exit;
end;
calc_counts;
Result:=True;
end;
procedure TvPipelineLayout.calc_counts;
var
i,b:Integer;
t:Byte;
begin
if Length(key.FLayouts)<>0 then
begin
For i:=0 to High(key.FLayouts) do
With key.FLayouts[i] do
if (Length(key.FBinds)<>0) then
begin
Inc(FBinds,Length(key.FBinds));
Inc(FSets);
For b:=0 to High(key.FBinds) do
with key.FBinds[b] do
begin
t:=_GetIdByType(descriptorType);
if (FCounts[t]=0) then
begin
Inc(FTypes);
end;
Inc(FCounts[t],descriptorCount);
end;
end;
end;
end;
Constructor TvPipelineCache.Create(data:Pointer;size:TVkSize);
var
info:TVkPipelineCacheCreateInfo;
@ -414,52 +455,6 @@ begin
FLayouts.Free;
end;
function _GetTypeById(i:Byte):TVkDescriptorType;
begin
Result:=VK_DESCRIPTOR_TYPE_SAMPLER;
Case i of
0:Result:=VK_DESCRIPTOR_TYPE_SAMPLER ;
1:Result:=VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER ;
2:Result:=VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE ;
3:Result:=VK_DESCRIPTOR_TYPE_STORAGE_IMAGE ;
4:Result:=VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER ;
5:Result:=VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER ;
6:Result:=VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER ;
7:Result:=VK_DESCRIPTOR_TYPE_STORAGE_BUFFER ;
8:Result:=VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC ;
9:Result:=VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC ;
10:Result:=VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT ;
11:Result:=VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT ;
12:Result:=VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR;
13:Result:=VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV ;
14:Result:=VK_DESCRIPTOR_TYPE_MUTABLE_VALVE ;
else;
end;
end;
function _GetIdByType(i:TVkDescriptorType):Byte;
begin
Result:=0;
Case i of
VK_DESCRIPTOR_TYPE_SAMPLER :Result:=0;
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER :Result:=1;
VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE :Result:=2;
VK_DESCRIPTOR_TYPE_STORAGE_IMAGE :Result:=3;
VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER :Result:=4;
VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER :Result:=5;
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER :Result:=6;
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER :Result:=7;
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC :Result:=8;
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC :Result:=9;
VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT :Result:=10;
VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT :Result:=11;
VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR:Result:=12;
VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV :Result:=13;
VK_DESCRIPTOR_TYPE_MUTABLE_VALVE :Result:=14;
else;
end;
end;
function TvSetsPool.Compile:Boolean;
var
i,b,L:Integer;
@ -496,7 +491,7 @@ begin
end;
until not It.Next;
For i:=0 to 14 do
For i:=LO_DESCRIPTOR_ID to HI_DESCRIPTOR_ID do
if (FCounts[i]<>0) then
begin
L:=Length(FSizes);
@ -724,7 +719,7 @@ begin
Result:=FHandle<>VK_NULL_HANDLE;
end;
Procedure TvDescriptorSet2.BindBuf(aBind,aElem:TVkUInt32;dtype:TVkDescriptorType;buffer:TVkBuffer;offset,range:TVkDeviceSize);
Procedure TvDescriptorSet2.BindBuffer(aBind,aElem:TVkUInt32;dtype:TVkDescriptorType;buffer:TVkBuffer;offset,range:TVkDeviceSize);
var
dwrite:TVkWriteDescriptorSet;
buf:TVkDescriptorBufferInfo;
@ -746,7 +741,7 @@ begin
vkUpdateDescriptorSets(Device.FHandle,1,@dwrite,0,nil);
end;
Procedure TvDescriptorSet2.BindSTI(aBind,aElem:TVkUInt32;img:TVkImageView;Layout:TVkImageLayout);
Procedure TvDescriptorSet2.BindStorage(aBind,aElem:TVkUInt32;img:TVkImageView;Layout:TVkImageLayout);
var
dwrite:TVkWriteDescriptorSet;
dimg:TVkDescriptorImageInfo;
@ -765,7 +760,7 @@ begin
vkUpdateDescriptorSets(Device.FHandle,1,@dwrite,0,nil);
end;
Procedure TvDescriptorSet2.BindImg(aBind,aElem:TVkUInt32;img:TVkImageView;Layout:TVkImageLayout);
Procedure TvDescriptorSet2.BindImage(aBind,aElem:TVkUInt32;img:TVkImageView;Layout:TVkImageLayout);
var
dwrite:TVkWriteDescriptorSet;
dimg:TVkDescriptorImageInfo;
@ -784,7 +779,7 @@ begin
vkUpdateDescriptorSets(Device.FHandle,1,@dwrite,0,nil);
end;
Procedure TvDescriptorSet2.BindSmp(aBind,aElem:TVkUInt32;smp:TVkSampler);
Procedure TvDescriptorSet2.BindSampler(aBind,aElem:TVkUInt32;smp:TVkSampler);
var
dwrite:TVkWriteDescriptorSet;
dimg:TVkDescriptorImageInfo;
@ -818,8 +813,7 @@ end;
function TvSetsPool2.Compile:Boolean;
var
i,b,L:Integer;
FCounts:TvCountsGroup;
i,p:Integer;
FSizes:AvDescriptorPoolSize;
cinfo:TVkDescriptorPoolCreateInfo;
r:TVkResult;
@ -831,32 +825,23 @@ begin
if (FmaxGroup=0) then Exit;
if (not FPipeline.Compile) then Exit;
FSizes:=Default(AvDescriptorPoolSize);
SetLength(FSizes,FPipeline.FTypes);
FmaxSets:=0;
FCounts:=Default(TvCountsGroup);
FmaxSets:=FPipeline.FSets*FmaxGroup;
if Length(FPipeline.key.FLayouts)<>0 then
For i:=0 to High(FPipeline.key.FLayouts) do
With FPipeline.key.FLayouts[i] do
if (Length(key.FBinds)<>0) then
begin
Inc(FmaxSets,FmaxGroup);
For b:=0 to High(key.FBinds) do
with key.FBinds[b] do
begin
Inc(FCounts[_GetIdByType(descriptorType)],descriptorCount*FmaxGroup);
end;
end;
For i:=0 to 14 do
if (FCounts[i]<>0) then
p:=0;
For i:=LO_DESCRIPTOR_ID to HI_DESCRIPTOR_ID do
begin
if (FPipeline.FCounts[i]<>0) then
begin
L:=Length(FSizes);
SetLength(FSizes,L+1);
FSizes[L].type_ :=_GetTypeById(i);
FSizes[L].descriptorCount:=FCounts[i];
FSizes[p].type_ :=_GetTypeById(i);
FSizes[p].descriptorCount:=FPipeline.FCounts[i]*FmaxGroup;
Inc(p);
end;
end;
if (Length(FSizes)=0) then Exit;
cinfo:=Default(TVkDescriptorPoolCreateInfo);
@ -893,7 +878,7 @@ begin
ainfo.sType :=VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
ainfo.descriptorPool :=FHandle;
ainfo.descriptorSetCount:=1;
ainfo.pSetLayouts:=@L.FHandle;
ainfo.pSetLayouts :=@L.FHandle;
r:=vkAllocateDescriptorSets(Device.FHandle,@ainfo,@FResult);
if (r<>VK_SUCCESS) then
begin

View File

@ -126,23 +126,9 @@ function GET_INDEX_TYPE_SIZE(i:TVkIndexType):Byte;
//
const
// Provided by VK_EXT_image_view_min_lod
VK_STRUCTURE_TYPE_IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT = 1000391001;
type
PVkImageViewMinLodCreateInfoEXT=^TVkImageViewMinLodCreateInfoEXT;
TVkImageViewMinLodCreateInfoEXT=record
sType :TVkStructureType; //< Must be VK_STRUCTURE_TYPE_IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT
pNext :PVkVoid;
minLod:TVkFloat;
end;
function _get_vsharp_cformat(PV:PVSharpResource4):TVkFormat;
function _get_tsharp4_cformat(PT:PTSharpResource4):TVkFormat;
function _get_tsharp4_min_lod(PT:PTSharpResource4):TVkImageViewMinLodCreateInfoEXT;
function _get_tsharp4_image_info(PT:PTSharpResource4):TvImageKey;
function _get_tsharp8_image_info(PT:PTSharpResource8):TvImageKey;
@ -813,7 +799,7 @@ begin
COLOR_11_11_10: //R:10 G:11 B:11
Case NUMBER_TYPE of
NUMBER_FLOAT :Result:=VK_FORMAT_B10G11R11_UFLOAT_PACK32; //Not directly handled to a vulkan
NUMBER_FLOAT :Result:=VK_FORMAT_R10G11B11_UFLOAT_FAKE32; //Not directly handled to a vulkan
else;
end;
@ -1901,6 +1887,7 @@ begin
IMG_DATA_FORMAT_5_9_9_9 :Result:=VK_FORMAT_E5B9G9R9_UFLOAT_PACK32;
IMG_DATA_FORMAT_10_11_11 :Result:=VK_FORMAT_B10G11R11_UFLOAT_PACK32;
IMG_DATA_FORMAT_11_11_10 :Result:=VK_FORMAT_R10G11B11_UFLOAT_FAKE32;
else;
end;
@ -1999,22 +1986,13 @@ begin
end;
end;
function _get_lod(w:Word):TVkFloat; forward;
function _get_tsharp4_min_lod(PT:PTSharpResource4):TVkImageViewMinLodCreateInfoEXT;
begin
Result:=Default(TVkImageViewMinLodCreateInfoEXT);
if (PT=nil) then Exit;
ord(Result.sType):=VK_STRUCTURE_TYPE_IMAGE_VIEW_MIN_LOD_CREATE_INFO_EXT;
Result.minLod:=_get_lod(PT^.min_lod);
end;
//perf_mod:bit3; //0=0/16, 1=2/16, 2=5/16, 3=7/16, 4=9/16, 5=11/16, 6=14/16, 7=16/16
//interlaced:bit1; //texture is interlaced
//tiling_idx:bit5; //index into lookup table of surface tiling settings
//pow2pad:bit1; //memory footprint is padded to power of 2 dimensions
function _get_lod(w:Word):TVkFloat; forward;
function _get_tsharp4_image_view(PT:PTSharpResource4):TvImageViewKey;
var
t:Byte;
@ -2059,6 +2037,8 @@ begin
Result.last_level:=PT^.last_level;
end;
Result.minLod:=_get_lod(PT^.min_lod);
//Result.base_level:=0; /////
//Result.last_level:=0; /////
end;

View File

@ -22,7 +22,12 @@ type
vShaderStageCs
);
TvSupportDescriptorType=array[0..1] of TVkDescriptorType;
const
LO_DESCRIPTOR_ID=ord(VK_DESCRIPTOR_TYPE_SAMPLER);
HI_DESCRIPTOR_ID=ord(VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT);
type
TvCountsGroup=array[LO_DESCRIPTOR_ID..HI_DESCRIPTOR_ID] of TVkUInt32;
TvShader=class;
@ -62,6 +67,9 @@ type
function parser:CvShaderParser; override;
end;
function _GetTypeById(i:Byte):TVkDescriptorType;
function _GetIdByType(i:TVkDescriptorType):Byte;
implementation
Destructor TvShader.Destroy;
@ -497,36 +505,21 @@ begin
Result:=TvShaderParserCompute;
end;
// =0,
// VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER=1,
// VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE=2,
// VK_DESCRIPTOR_TYPE_STORAGE_IMAGE=3,
// VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER=4,
// VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER=5,
// VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER=6,
// VK_DESCRIPTOR_TYPE_STORAGE_BUFFER=7,
// VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC=8,
// VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC=9,
// VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT=10,
// VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT=1000138000,
// VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR=1000150000,
// VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV=1000165000,
// VK_DESCRIPTOR_TYPE_MUTABLE_VALVE=1000351000
//
{
function TvShaderBind.GetSupportTypes:TvSupportDescriptorType;
function _GetTypeById(i:Byte):TVkDescriptorType;
begin
Result:=Default(TvSupportDescriptorType);
case FType of
Sample shl 16 :begin Result[0]:=VK_DESCRIPTOR_TYPE_SAMPLER; end;;
UniformConstant :begin Result[0]:=; end;;
Uniform :begin Result[0]:=; end;;
Workgroup :begin Result[0]:=; end;;
CrossWorkgroup :begin Result[0]:=; end;;
Image :begin Result[0]:=; end;;
StorageBuffer :begin Result[0]:=; end;;
end;
end;}
Assert(i<=HI_DESCRIPTOR_ID);
//
Result:=TVkDescriptorType(i);
end;
function _GetIdByType(i:TVkDescriptorType):Byte;
begin
Assert(i<=VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT);
//
Result:=ord(i);
end;
end.

View File

@ -165,7 +165,7 @@ type
Procedure AddTSharp4(PT:PTSharpResource4;fset,bind:DWord);
Procedure AddTSharp8(PT:PTSharpResource8;fset,bind:DWord);
Procedure AddSSharp4(PS:PSSharpResource4;fset,bind:DWord);
procedure AddAttr(const b:TvCustomLayout;Fset:TVkUInt32;FData:PDWORD);
procedure AddAttr (const b:TvCustomLayout;Fset:TVkUInt32;FData:PDWORD);
end;
AvShaderStage=array[TvShaderStage] of TvShaderExt;
@ -1319,13 +1319,15 @@ Procedure TvShaderGroup.ExportUnifBuilder(var UniformBuilder:TvUniformBuilder;GP
var
Shader:TvShaderExt;
i:TvShaderStage;
FData:PDWORD;
begin
For i:=Low(TvShaderStage) to High(TvShaderStage) do
begin
Shader:=FKey.FShaders[i];
if (Shader<>nil) then
begin
Shader.EnumUnifLayout(@UniformBuilder.AddAttr,Shader.FDescSetId,GPU_USERDATA^.get_user_data(i));
FData:=GPU_USERDATA^.get_user_data(i);
Shader.EnumUnifLayout(@UniformBuilder.AddAttr,Shader.FDescSetId,FData);
end;
end;
end;

View File

@ -333,6 +333,7 @@ begin
SprvEmit.Config.UseVertexInput:=True;
SprvEmit.Config.UseTexelBuffer:=False;
SprvEmit.Config.UseOutput16 :=storageInputOutput16;
SprvEmit.Config.UseOnlyUserdataPushConst:=True;
SprvEmit.Config.maxUniformBufferRange :=0; // $FFFF
SprvEmit.Config.PushConstantsOffset :=0; // 0