| @@ -27,6 +27,7 @@ unit Vulkan; | |||
| {$LINKLIB c} | |||
| {$ENDIF} | |||
| {$MINENUMSIZE 4} | |||
| {$PACKSET 4} | |||
| {$ENDIF} | |||
| {$I Vulkan.inc} | |||
| @@ -98,13 +98,17 @@ type | |||
| private | |||
| fParent: WideString; | |||
| fAlias: WideString; | |||
| fBitmask: Boolean; | |||
| fRequires: WideString; | |||
| protected | |||
| function GetDependencyOrder: Integer; override; | |||
| procedure GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); override; | |||
| public | |||
| property Parent: WideString read fParent write fParent; | |||
| property Alias: WideString read fAlias write fAlias; | |||
| property BitMask: Boolean read fBitmask write fBitmask; | |||
| property Requires: WideString read fRequires write fRequires; | |||
| procedure ReadXml(const xml: TDOMNode); override; | |||
| procedure GenerateCode(const aCode: TStringTree); override; | |||
| end; | |||
| @@ -112,6 +116,7 @@ type | |||
| TvkType = class(TvkTypeBase) | |||
| public | |||
| procedure ReadXml(const xml: TDOMNode); override; | |||
| procedure GenerateCode(const aCode: TStringTree); override; | |||
| constructor Create; | |||
| end; | |||
| @@ -208,11 +213,13 @@ type | |||
| TValueList = specialize TutlList<TValue>; | |||
| private | |||
| fExpands: WideString; | |||
| fBitmask: Boolean; | |||
| fValues: TValueList; | |||
| protected | |||
| procedure GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); override; | |||
| public | |||
| property Expands: WideString read fExpands write fExpands; | |||
| property Bitmask: Boolean read fBitmask write fBitmask; | |||
| property Values: TValueList read fValues; | |||
| procedure ReadXml(const xml: TDOMNode); override; | |||
| procedure GenerateCode(const aCode: TStringTree); override; | |||
| @@ -276,6 +283,7 @@ const | |||
| KEYWORD_COMMENT = 'COMMENT'; | |||
| KEYWORD_VAR = 'VAR'; | |||
| KEYWORD_CODE = 'CODE'; | |||
| KEYWORD_SETS = 'SETS'; | |||
| KEYWORD_INSTANCE_COMMANDS = 'INSTANCE_COMMANDS'; | |||
| KEYWORD_DEVICE_COMMANDS = 'DEVICE_COMMANDS'; | |||
| @@ -304,19 +312,24 @@ begin | |||
| try | |||
| result := Unassigned; | |||
| rx.Expression := '^-?([0-9]+)$'; | |||
| if rx.Exec(s) then | |||
| rx.Expression := '^-?\s*([0-9]+)\s*$'; | |||
| if rx.Exec(s) then begin | |||
| result := StrToInt(rx.Match[0]); | |||
| exit; | |||
| end; | |||
| rx.Expression := '^0x([0-9A-Fa-f]+)$'; | |||
| if rx.Exec(s) then | |||
| if rx.Exec(s) then begin | |||
| result := '$' + rx.Match[1]; | |||
| exit; | |||
| end; | |||
| rx.Expression := '^([0-9\.]+)(f|d)?$'; | |||
| if rx.Exec(s) then begin | |||
| result := StrToFloat(rx.Match[1], f); | |||
| if (rx.Match[2] = 'd') then | |||
| result := Double(result); | |||
| exit; | |||
| end; | |||
| rx.Expression := '^\(~0U([L]*)\)$'; | |||
| @@ -839,27 +852,24 @@ begin | |||
| inherited GenPascalName(aName, aPointer, aArrSize); | |||
| end; | |||
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| procedure THeaderGenerator.TvkTypeBase.ReadXml(const xml: TDOMNode); | |||
| begin | |||
| inherited ReadXml(xml); | |||
| fRequires := GetNodeAttrib(xml, 'requires', ''); | |||
| fBitmask := (GetNodeAttrib(xml, 'category', '') = 'bitmask'); | |||
| end; | |||
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| procedure THeaderGenerator.TvkTypeBase.GenerateCode(const aCode: TStringTree); | |||
| var st: TStringTree; | |||
| begin | |||
| inherited GenerateCode(aCode); | |||
| if Assigned(fList) and (fParent <> '') then | |||
| fList.GenerateCode(fParent, aCode); | |||
| if Assigned(fList) and (fAlias <> '') then | |||
| fList.GenerateCode(fAlias, aCode); | |||
| st := aCode.GetOrCreateItem(KEYWORD_INTF).GetOrCreateItem(KEYWORD_TYPES); | |||
| if (st.LinesBefore.Count = 0) then | |||
| st.LinesBefore.Add('type { simple types }'); | |||
| st := st.GetOrCreateItem(String(fName)); | |||
| if (st.LinesBefore.Count = 0) and (fParent <> '') and Assigned(List) then begin | |||
| st.LinesBefore.Add(Format(' %-62s = %s;', [ fName, List.GetPascalName(fParent, 0) ])); | |||
| st.LinesBefore.Add(Format(' P%-61s = ^%0:s;', [ fName ])); | |||
| st.LinesBefore.Add(Format(' PP%-60s = ^P%0:s;', [ fName ])); | |||
| st.LinesBefore.Add(''); | |||
| end; | |||
| if Assigned(fList) and (fRequires <> '') then | |||
| fList.GenerateCode(fRequires, aCode); | |||
| end; | |||
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| @@ -872,6 +882,29 @@ begin | |||
| Parent := GetNodeValue(xml, 'type'); | |||
| end; | |||
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| procedure THeaderGenerator.TvkType.GenerateCode(const aCode: TStringTree); | |||
| var | |||
| st: TStringTree; | |||
| n: String; | |||
| begin | |||
| inherited GenerateCode(aCode); | |||
| st := aCode.GetOrCreateItem(KEYWORD_INTF).GetOrCreateItem(KEYWORD_TYPES); | |||
| if (st.LinesBefore.Count = 0) then | |||
| st.LinesBefore.Add('type { simple types }'); | |||
| st := st.GetOrCreateItem(String(fName)); | |||
| n := List.GetPascalName(fParent, 0); | |||
| if fBitmask and (fRequires <> '') then | |||
| n := 'T' + fRequires; | |||
| if (st.LinesBefore.Count = 0) and (fParent <> '') and Assigned(List) then begin | |||
| st.LinesBefore.Add(Format(' %-62s = %s;', [ fName, n ])); | |||
| st.LinesBefore.Add(Format(' P%-61s = ^%0:s;', [ fName ])); | |||
| st.LinesBefore.Add(Format(' PP%-60s = ^P%0:s;', [ fName ])); | |||
| st.LinesBefore.Add(''); | |||
| end; | |||
| end; | |||
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| constructor THeaderGenerator.TvkType.Create; | |||
| begin | |||
| @@ -901,10 +934,7 @@ var | |||
| st: TStringTree; | |||
| s: String; | |||
| begin | |||
| if Assigned(fList) and (fParent <> '') then | |||
| fList.GenerateCode(fParent, aCode); | |||
| if Assigned(fList) and (fAlias <> '') then | |||
| fList.GenerateCode(fAlias, aCode); | |||
| inherited GenerateCode(aCode); | |||
| st := aCode.GetOrCreateItem(KEYWORD_INTF).GetOrCreateItem(KEYWORD_TYPES); | |||
| if (st.LinesBefore.Count = 0) then | |||
| @@ -1383,9 +1413,11 @@ procedure THeaderGenerator.TvkEnum.ReadXml(const xml: TDOMNode); | |||
| var | |||
| x, p: TDOMNode; | |||
| v: TValue; | |||
| i: Integer; | |||
| begin | |||
| Name := GetNodeAttrib(xml, 'name'); | |||
| Expands := GetNodeAttrib(xml, 'expand', ''); | |||
| Name := GetNodeAttrib(xml, 'name'); | |||
| Expands := GetNodeAttrib(xml, 'expand', ''); | |||
| Bitmask := (GetNodeAttrib(xml, 'type', '') = 'bitmask'); | |||
| x := xml.FirstChild; | |||
| while Assigned(x) do begin | |||
| if (x.NodeName = 'enum') then begin | |||
| @@ -1407,6 +1439,16 @@ begin | |||
| if (v.Value = Unassigned) then | |||
| raise XmlException.Create(WideString('invalid enum value (' + p.TextContent + ')'), xml); | |||
| if (Expands <> '') then begin | |||
| i := 1; | |||
| while (i <= Length(Expands)) and (i <= Length(v.Name)) and (v.Name[i] = Expands[i]) do | |||
| inc(i); | |||
| if (i <= Length(Expands)) and (Expands[i] = '_') then | |||
| dec(i); | |||
| Expands := copy(Expands, 1, i-1); | |||
| end else | |||
| Expands := v.Name; | |||
| Values.Add(v); | |||
| except | |||
| FreeAndNil(v); | |||
| @@ -1420,10 +1462,11 @@ end; | |||
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| procedure THeaderGenerator.TvkEnum.GenerateCode(const aCode: TStringTree); | |||
| var | |||
| st, vt: TStringTree; | |||
| st, st2, vt: TStringTree; | |||
| s, bitName, s2: String; | |||
| i: Integer; | |||
| v: TValue; | |||
| postfix: String; | |||
| tmp: QWord; | |||
| v, v2: TValue; | |||
| begin | |||
| inherited GenerateCode(aCode); | |||
| st := aCode | |||
| @@ -1433,22 +1476,56 @@ begin | |||
| st.LinesBefore.Add('type { enumerations }'); | |||
| st := st.GetOrCreateItem(String(fName)); | |||
| if (st.LinesBefore.Count = 0) then begin | |||
| st.LinesBefore.Add(Format(' %s = (', [GetPascalName(0, '')])); | |||
| postfix := ','; | |||
| bitName := GetPascalName(0, ''); | |||
| if fBitmask then | |||
| bitName := StringReplace(bitName, 'Bits', 'Bit', [rfReplaceAll]); | |||
| st.LinesBefore.Add(Format(' %s = (', [bitName])); | |||
| vt := st.GetOrCreateItem(KEYWORD_ENUM_VALUES); | |||
| s := ''; | |||
| for i := 0 to fValues.Count-1 do begin | |||
| v := fValues[i]; | |||
| if (i = fValues.Count-1) and (fExpands = '') then | |||
| postfix := ''; | |||
| if (v.IsBit) | |||
| then vt.LinesBefore.Add(Format(' %-60s = (1 shl %s)%s', [v.Name, v.Value, postfix])) | |||
| else vt.LinesBefore.Add(Format(' %-60s = %s%s', [v.Name, v.Value, postfix])); | |||
| if not v.IsBit and fBitmask then begin | |||
| st2 := aCode | |||
| .GetOrCreateItem(KEYWORD_INTF) | |||
| .GetOrCreateItem(KEYWORD_SETS); | |||
| if (st2.LinesBefore.Count = 0) then | |||
| st2.LinesBefore.Add('const { predefined flags / sets }'); | |||
| st2 := st2.GetOrCreateItem(v.Name); | |||
| if (st2.LinesBefore.Count = 0) then begin | |||
| tmp := StrToInt(v.Value); | |||
| s2 := ''; | |||
| for v2 in fValues do begin | |||
| if v2.IsBit and ((tmp and (1 shl v2.Value)) <> 0) then begin | |||
| if (s2 <> '') then | |||
| s2 := s2 + ',' + sLineBreak; | |||
| s2 := s2 + ' ' + v2.Name; | |||
| end; | |||
| end; | |||
| if (s2 <> '') then | |||
| s2 := sLineBreak + s2 + sLineBreak; | |||
| st2.LinesBefore.Text := Format(' %s: %s = [' + | |||
| '%s' + | |||
| ' ];', [v.Name, GetPascalName(0, ''), s2]); | |||
| end; | |||
| end else begin | |||
| if (s <> '') then | |||
| s := s + ',' + sLineBreak; | |||
| s := s + Format(' %-60s = %s', [v.Name, v.Value]); | |||
| end; | |||
| end; | |||
| if (fExpands <> '') then | |||
| st.LinesAfter.Add(Format(' %-60s = %s', [fExpands + '_MAX_ENUM', '$7FFFFFFF'])); | |||
| if (fExpands <> '') then begin | |||
| if fBitmask | |||
| then s := s + ',' + sLineBreak + Format(' %-60s = 31', [fExpands+'MAX_BIT']) | |||
| else s := s + ',' + sLineBreak + Format(' %-60s = %s', [fExpands + '_MAX_ENUM', '$7FFFFFFF']); | |||
| end; | |||
| vt.LinesBefore.Text := s; | |||
| st.LinesAfter.Add(' );'); | |||
| st.LinesAfter.Add(' P%s = ^T%0:s;', [ fName ]); | |||
| st.LinesAfter.Add(' PP%s = ^P%0:s;', [ fName ]); | |||
| if not fBitmask then begin | |||
| st.LinesAfter.Add(' P%s = ^T%0:s;', [ fName ]); | |||
| st.LinesAfter.Add(' PP%s = ^P%0:s;', [ fName ]); | |||
| end else | |||
| st.LinesAfter.Add(' %s = set of %s;', [ GetPascalName(0, ''), bitName ]); | |||
| st.LinesAfter.Add(''); | |||
| end; | |||
| end; | |||
| @@ -1531,8 +1608,8 @@ var | |||
| procedure UpdateComments; | |||
| begin | |||
| UpdateComment([KEYWORD_INTF, KEYWORD_CONST]); | |||
| UpdateComment([KEYWORD_INTF, KEYWORD_TYPES]); | |||
| UpdateComment([KEYWORD_INTF, KEYWORD_ENUM]); | |||
| UpdateComment([KEYWORD_INTF, KEYWORD_TYPES]); | |||
| UpdateComment([KEYWORD_INTF, KEYWORD_FUNCPTR]); | |||
| UpdateComment([KEYWORD_INTF, KEYWORD_STRUCT]); | |||
| UpdateComment([KEYWORD_INTF, KEYWORD_COMMAND]); | |||
| @@ -1604,6 +1681,7 @@ var | |||
| value: WideString; | |||
| offset: Integer; | |||
| s: String; | |||
| i: Integer; | |||
| c: TvkConst; | |||
| begin | |||
| result := false; | |||
| @@ -1615,12 +1693,17 @@ var | |||
| offset := 1000000000 + 1000 * (CurrentNumber-1) + offset; | |||
| if (GetNodeAttrib(xml, 'dir', '') = '-') then | |||
| offset := -1 * offset; | |||
| Code | |||
| with Code | |||
| .GetOrCreateItem(KEYWORD_INTF) | |||
| .GetOrCreateItem(KEYWORD_ENUM) | |||
| .GetOrCreateItem(String(ex)) | |||
| .GetOrCreateItem(KEYWORD_ENUM_VALUES) | |||
| .LinesBefore.Add(Format(' %-60s = %s,', [name, IntToStr(offset)])); | |||
| .GetOrCreateItem(KEYWORD_ENUM_VALUES) do | |||
| begin | |||
| i := LinesBefore.Count-1; | |||
| if (i >= 0) and (Pos('MAX_ENUM', LinesBefore[i]) > 0) then | |||
| dec(i); | |||
| LinesBefore.Insert(i+1, Format(' %-60s = %s,', [name, IntToStr(offset)])); | |||
| end; | |||
| end else begin | |||
| if not TryGetNodeAttrib(xml, 'value', value) then | |||
| exit; | |||
| @@ -1802,8 +1885,8 @@ begin | |||
| Code.GetOrCreateItem(KEYWORD_COMMENT).LinesBefore.Text := Trim(String(fComment)); | |||
| with Code.GetOrCreateItem(KEYWORD_INTF) do begin | |||
| GetOrCreateItem(KEYWORD_CONST).LinesAfter.Add(''); | |||
| GetOrCreateItem(KEYWORD_TYPES).LinesAfter.Add(''); | |||
| GetOrCreateItem(KEYWORD_ENUM).LinesAfter.Add(''); | |||
| GetOrCreateItem(KEYWORD_TYPES).LinesAfter.Add(''); | |||
| GetOrCreateItem(KEYWORD_FUNCPTR).LinesAfter.Add(''); | |||
| GetOrCreateItem(KEYWORD_STRUCT).LinesAfter.Add(''); | |||
| GetOrCreateItem(KEYWORD_COMMAND).LinesAfter.Add(''); | |||
| @@ -8,161 +8,176 @@ | |||
| <Unit0> | |||
| <Filename Value="generator.lpr"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <CursorPos X="3" Y="11"/> | |||
| <UsageCount Value="21"/> | |||
| <TopLine Value="63"/> | |||
| <CursorPos Y="78"/> | |||
| <UsageCount Value="23"/> | |||
| <Loaded Value="True"/> | |||
| </Unit0> | |||
| <Unit1> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <IsVisibleTab Value="True"/> | |||
| <EditorIndex Value="1"/> | |||
| <UsageCount Value="21"/> | |||
| <TopLine Value="1494"/> | |||
| <CursorPos X="78" Y="1518"/> | |||
| <UsageCount Value="23"/> | |||
| <Loaded Value="True"/> | |||
| </Unit1> | |||
| <Unit2> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <EditorIndex Value="3"/> | |||
| <EditorIndex Value="4"/> | |||
| <TopLine Value="1374"/> | |||
| <CursorPos X="63" Y="1393"/> | |||
| <UsageCount Value="10"/> | |||
| <UsageCount Value="11"/> | |||
| <Loaded Value="True"/> | |||
| </Unit2> | |||
| <Unit3> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <IsVisibleTab Value="True"/> | |||
| <EditorIndex Value="2"/> | |||
| <TopLine Value="3935"/> | |||
| <CursorPos X="33" Y="4655"/> | |||
| <UsageCount Value="10"/> | |||
| <TopLine Value="666"/> | |||
| <CursorPos X="41" Y="691"/> | |||
| <UsageCount Value="11"/> | |||
| <Loaded Value="True"/> | |||
| </Unit3> | |||
| <Unit4> | |||
| <Filename Value="..\utils\uvkuSurfaceFactory.pas"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="247"/> | |||
| <CursorPos X="4" Y="275"/> | |||
| <EditorIndex Value="3"/> | |||
| <CursorPos X="68"/> | |||
| <UsageCount Value="10"/> | |||
| <Loaded Value="True"/> | |||
| </Unit4> | |||
| </Units> | |||
| <JumpHistory Count="30" HistoryIndex="29"> | |||
| <Position1> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="1193" Column="73" TopLine="1178"/> | |||
| <Caret Line="1446" TopLine="1432"/> | |||
| </Position1> | |||
| <Position2> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="997" Column="33" TopLine="984"/> | |||
| <Caret Line="1450" TopLine="1432"/> | |||
| </Position2> | |||
| <Position3> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="989" Column="35" TopLine="974"/> | |||
| <Caret Line="1446" TopLine="1432"/> | |||
| </Position3> | |||
| <Position4> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="986" Column="7" TopLine="971"/> | |||
| <Caret Line="1450" TopLine="1432"/> | |||
| </Position4> | |||
| <Position5> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="961" Column="3" TopLine="945"/> | |||
| <Caret Line="1446" Column="19" TopLine="1432"/> | |||
| </Position5> | |||
| <Position6> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="912" Column="41" TopLine="897"/> | |||
| <Caret Line="215" Column="27" TopLine="205"/> | |||
| </Position6> | |||
| <Position7> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="914" Column="17" TopLine="899"/> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret TopLine="69"/> | |||
| </Position7> | |||
| <Position8> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="970" Column="59" TopLine="955"/> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="528" Column="31" TopLine="503"/> | |||
| </Position8> | |||
| <Position9> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="977" Column="33" TopLine="963"/> | |||
| <Caret Line="1447" Column="20" TopLine="1432"/> | |||
| </Position9> | |||
| <Position10> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="1186" Column="75" TopLine="1175"/> | |||
| </Position10> | |||
| <Position11> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Caret Line="777" Column="19" TopLine="762"/> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="215" Column="70" TopLine="200"/> | |||
| </Position11> | |||
| <Position12> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Caret Line="791" Column="28" TopLine="776"/> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="1447" TopLine="1431"/> | |||
| </Position12> | |||
| <Position13> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Caret Line="817" Column="10" TopLine="802"/> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="1518" Column="89" TopLine="1504"/> | |||
| </Position13> | |||
| <Position14> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Caret Line="885" Column="77" TopLine="870"/> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="1449" Column="49" TopLine="1431"/> | |||
| </Position14> | |||
| <Position15> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Caret Line="830" TopLine="819"/> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="1448" TopLine="1431"/> | |||
| </Position15> | |||
| <Position16> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Caret Line="885" Column="90" TopLine="870"/> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="1452" TopLine="1431"/> | |||
| </Position16> | |||
| <Position17> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Caret Line="889" Column="77" TopLine="874"/> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="1446" TopLine="1431"/> | |||
| </Position17> | |||
| <Position18> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Caret Line="920" Column="27" TopLine="905"/> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="527" Column="31" TopLine="504"/> | |||
| </Position18> | |||
| <Position19> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Caret Line="1014" Column="29" TopLine="999"/> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="557" Column="28" TopLine="532"/> | |||
| </Position19> | |||
| <Position20> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Caret Line="1027" Column="12" TopLine="1012"/> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="567" Column="29" TopLine="542"/> | |||
| </Position20> | |||
| <Position21> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Caret Line="1038" Column="19" TopLine="1023"/> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="579" Column="29" TopLine="554"/> | |||
| </Position21> | |||
| <Position22> | |||
| <Filename Value="uutlGenerics.pas"/> | |||
| <Caret Line="1073" Column="46" TopLine="1058"/> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="599" Column="22" TopLine="574"/> | |||
| </Position22> | |||
| <Position23> | |||
| <Filename Value="generator.lpr"/> | |||
| <Caret Line="9" Column="58"/> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="609" Column="32" TopLine="584"/> | |||
| </Position23> | |||
| <Position24> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="4455" Column="18" TopLine="4434"/> | |||
| <Caret Line="615" Column="44" TopLine="590"/> | |||
| </Position24> | |||
| <Position25> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="4644" Column="115" TopLine="4641"/> | |||
| <Caret Line="637" Column="31" TopLine="612"/> | |||
| </Position25> | |||
| <Position26> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="646" Column="29" TopLine="621"/> | |||
| </Position26> | |||
| <Position27> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="4306" Column="20" TopLine="4299"/> | |||
| <Caret Line="654" Column="36" TopLine="629"/> | |||
| </Position27> | |||
| <Position28> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="4663" Column="5" TopLine="4649"/> | |||
| <Caret Line="660" Column="47" TopLine="635"/> | |||
| </Position28> | |||
| <Position29> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="690" Column="70" TopLine="675"/> | |||
| <Caret Line="666" Column="41" TopLine="641"/> | |||
| </Position29> | |||
| <Position30> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="4565" Column="21" TopLine="4550"/> | |||
| <Filename Value="HeaderGenerator.pas"/> | |||
| <Caret Line="1446" TopLine="1431"/> | |||
| </Position30> | |||
| </JumpHistory> | |||
| </ProjectSession> | |||
| <Debugging> | |||
| <Watches Count="2"> | |||
| <Item1> | |||
| <Expression Value="s"/> | |||
| </Item1> | |||
| <Item2> | |||
| <Expression Value="fExpands"/> | |||
| </Item2> | |||
| </Watches> | |||
| </Debugging> | |||
| </CONFIG> | |||
| @@ -33,7 +33,7 @@ | |||
| <PackageName Value="LCL"/> | |||
| </Item1> | |||
| </RequiredPackages> | |||
| <Units Count="12"> | |||
| <Units Count="14"> | |||
| <Unit0> | |||
| <Filename Value="triangle.lpr"/> | |||
| <IsPartOfProject Value="True"/> | |||
| @@ -85,6 +85,14 @@ | |||
| <Filename Value="..\utils\uvkuSurfaceFactory.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| </Unit11> | |||
| <Unit12> | |||
| <Filename Value="..\utils\uvkuSwapChainFactory.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| </Unit12> | |||
| <Unit13> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| </Unit13> | |||
| </Units> | |||
| </ProjectOptions> | |||
| <CompilerOptions> | |||
| @@ -7,7 +7,7 @@ uses | |||
| {$IFDEF UNIX}{$IFDEF UseCThreads} | |||
| cthreads, | |||
| {$ENDIF}{$ENDIF} | |||
| Interfaces, Dialogs, Forms, uMainForm, Vulkan, uvkuDevice, uvkuDeviceFactory; | |||
| Interfaces, Dialogs, Forms, uMainForm, Vulkan; | |||
| {$R *.res} | |||
| @@ -4,14 +4,13 @@ | |||
| <PathDelim Value="\"/> | |||
| <Version Value="9"/> | |||
| <BuildModes Active="Default"/> | |||
| <Units Count="30"> | |||
| <Units Count="32"> | |||
| <Unit0> | |||
| <Filename Value="triangle.lpr"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <EditorIndex Value="7"/> | |||
| <CursorPos X="79" Y="10"/> | |||
| <UsageCount Value="51"/> | |||
| <Loaded Value="True"/> | |||
| <EditorIndex Value="-1"/> | |||
| <CursorPos X="48" Y="10"/> | |||
| <UsageCount Value="55"/> | |||
| </Unit0> | |||
| <Unit1> | |||
| <Filename Value="uMainForm.pas"/> | |||
| @@ -19,353 +18,387 @@ | |||
| <ComponentName Value="MainForm"/> | |||
| <HasResources Value="True"/> | |||
| <ResourceBaseClass Value="Form"/> | |||
| <IsVisibleTab Value="True"/> | |||
| <TopLine Value="65"/> | |||
| <CursorPos X="28" Y="79"/> | |||
| <UsageCount Value="51"/> | |||
| <TopLine Value="20"/> | |||
| <CursorPos X="5" Y="36"/> | |||
| <UsageCount Value="55"/> | |||
| <Loaded Value="True"/> | |||
| <LoadedDesigner Value="True"/> | |||
| </Unit1> | |||
| <Unit2> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <EditorIndex Value="5"/> | |||
| <TopLine Value="163"/> | |||
| <CursorPos X="63" Y="188"/> | |||
| <EditorIndex Value="7"/> | |||
| <TopLine Value="4263"/> | |||
| <CursorPos X="61" Y="4268"/> | |||
| <ExtraEditorCount Value="1"/> | |||
| <ExtraEditor1> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="4282"/> | |||
| <CursorPos X="79" Y="4295"/> | |||
| <TopLine Value="42"/> | |||
| <CursorPos X="12" Y="50"/> | |||
| </ExtraEditor1> | |||
| <UsageCount Value="51"/> | |||
| <UsageCount Value="55"/> | |||
| <Loaded Value="True"/> | |||
| </Unit2> | |||
| <Unit3> | |||
| <Filename Value="..\utils\uvkuInstance.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <EditorIndex Value="8"/> | |||
| <TopLine Value="12"/> | |||
| <CursorPos X="10" Y="24"/> | |||
| <UsageCount Value="49"/> | |||
| <Loaded Value="True"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="98"/> | |||
| <CursorPos X="33" Y="117"/> | |||
| <UsageCount Value="53"/> | |||
| </Unit3> | |||
| <Unit4> | |||
| <Filename Value="..\utils\uvkuInstanceFactory.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <EditorIndex Value="4"/> | |||
| <CursorPos X="58" Y="160"/> | |||
| <UsageCount Value="43"/> | |||
| <Loaded Value="True"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="42"/> | |||
| <CursorPos Y="55"/> | |||
| <UsageCount Value="47"/> | |||
| </Unit4> | |||
| <Unit5> | |||
| <Filename Value="..\utils\uvkuPhysicalDevice.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <EditorIndex Value="10"/> | |||
| <TopLine Value="241"/> | |||
| <CursorPos Y="250"/> | |||
| <UsageCount Value="43"/> | |||
| <EditorIndex Value="4"/> | |||
| <TopLine Value="154"/> | |||
| <CursorPos X="3" Y="163"/> | |||
| <UsageCount Value="47"/> | |||
| <Loaded Value="True"/> | |||
| </Unit5> | |||
| <Unit6> | |||
| <Filename Value="..\utils\uvkuAllocationHandler.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <EditorIndex Value="-1"/> | |||
| <EditorIndex Value="5"/> | |||
| <TopLine Value="73"/> | |||
| <CursorPos X="23" Y="93"/> | |||
| <UsageCount Value="33"/> | |||
| <CursorPos Y="100"/> | |||
| <UsageCount Value="37"/> | |||
| <Loaded Value="True"/> | |||
| </Unit6> | |||
| <Unit7> | |||
| <Filename Value="..\utils\uvkuUtils.pas"/> | |||
| <EditorIndex Value="-1"/> | |||
| <UsageCount Value="43"/> | |||
| </Unit7> | |||
| <Unit8> | |||
| <Filename Value="..\utils\uvkuDevice.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <EditorIndex Value="1"/> | |||
| <TopLine Value="18"/> | |||
| <CursorPos X="17" Y="32"/> | |||
| <UsageCount Value="36"/> | |||
| <EditorIndex Value="3"/> | |||
| <TopLine Value="21"/> | |||
| <CursorPos Y="50"/> | |||
| <UsageCount Value="41"/> | |||
| <Loaded Value="True"/> | |||
| </Unit7> | |||
| <Unit8> | |||
| <Filename Value="..\utils\uvkuDeviceFactory.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="165"/> | |||
| <CursorPos Y="158"/> | |||
| <UsageCount Value="39"/> | |||
| </Unit8> | |||
| <Unit9> | |||
| <Filename Value="..\utils\uvkuDeviceFactory.pas"/> | |||
| <Filename Value="..\utils\uvkuPhysicalDeviceFactory.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <EditorIndex Value="2"/> | |||
| <TopLine Value="44"/> | |||
| <CursorPos X="73" Y="58"/> | |||
| <UsageCount Value="34"/> | |||
| <Loaded Value="True"/> | |||
| <EditorIndex Value="-1"/> | |||
| <CursorPos X="74" Y="30"/> | |||
| <UsageCount Value="40"/> | |||
| </Unit9> | |||
| <Unit10> | |||
| <Filename Value="..\utils\uvkuPhysicalDeviceFactory.pas"/> | |||
| <Filename Value="..\utils\uvkuSurface.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <EditorIndex Value="9"/> | |||
| <CursorPos X="74" Y="30"/> | |||
| <UsageCount Value="35"/> | |||
| <EditorIndex Value="2"/> | |||
| <TopLine Value="11"/> | |||
| <CursorPos X="71" Y="66"/> | |||
| <UsageCount Value="34"/> | |||
| <Loaded Value="True"/> | |||
| </Unit10> | |||
| <Unit11> | |||
| <Filename Value="..\utils\uvkuSurface.pas"/> | |||
| <Filename Value="..\utils\uvkuSurfaceFactory.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <EditorIndex Value="3"/> | |||
| <CursorPos Y="59"/> | |||
| <UsageCount Value="29"/> | |||
| <Loaded Value="True"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="187"/> | |||
| <CursorPos Y="200"/> | |||
| <UsageCount Value="33"/> | |||
| </Unit11> | |||
| <Unit12> | |||
| <Filename Value="..\utils\uvkuSurfaceFactory.pas"/> | |||
| <Filename Value="..\utils\uvkuSwapChainFactory.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <EditorIndex Value="6"/> | |||
| <TopLine Value="9"/> | |||
| <CursorPos X="20" Y="18"/> | |||
| <UsageCount Value="28"/> | |||
| <EditorIndex Value="1"/> | |||
| <TopLine Value="128"/> | |||
| <CursorPos Y="152"/> | |||
| <UsageCount Value="24"/> | |||
| <Loaded Value="True"/> | |||
| </Unit12> | |||
| <Unit13> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <IsPartOfProject Value="True"/> | |||
| <IsVisibleTab Value="True"/> | |||
| <EditorIndex Value="6"/> | |||
| <CursorPos X="65" Y="93"/> | |||
| <UsageCount Value="23"/> | |||
| <Loaded Value="True"/> | |||
| </Unit13> | |||
| <Unit14> | |||
| <Filename Value="..\utils\uvkuUtils.pas"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="423"/> | |||
| <CursorPos X="61" Y="447"/> | |||
| <UsageCount Value="43"/> | |||
| </Unit14> | |||
| <Unit15> | |||
| <Filename Value="..\..\data\Vulkan.tpl"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="44"/> | |||
| <CursorPos X="27" Y="22"/> | |||
| <UsageCount Value="14"/> | |||
| <DefaultSyntaxHighlighter Value="None"/> | |||
| </Unit13> | |||
| <Unit14> | |||
| </Unit15> | |||
| <Unit16> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\3.1.1\source\packages\fcl-base\src\custapp.pp"/> | |||
| <UnitName Value="CustApp"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="13"/> | |||
| <CursorPos X="3" Y="30"/> | |||
| <UsageCount Value="10"/> | |||
| </Unit14> | |||
| <Unit15> | |||
| </Unit16> | |||
| <Unit17> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\3.1.1\source\rtl\inc\objpash.inc"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="213"/> | |||
| <CursorPos X="21" Y="224"/> | |||
| <UsageCount Value="9"/> | |||
| </Unit15> | |||
| <Unit16> | |||
| </Unit17> | |||
| <Unit18> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\lcl\include\customform.inc"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="138"/> | |||
| <CursorPos Y="154"/> | |||
| <UsageCount Value="9"/> | |||
| </Unit16> | |||
| <Unit17> | |||
| </Unit18> | |||
| <Unit19> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\3.1.1\source\rtl\objpas\sysutils\sysstrh.inc"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="96"/> | |||
| <CursorPos X="10" Y="112"/> | |||
| <UsageCount Value="10"/> | |||
| </Unit17> | |||
| <Unit18> | |||
| </Unit19> | |||
| <Unit20> | |||
| <Filename Value="..\Vulkan_old.pas"/> | |||
| <EditorIndex Value="-1"/> | |||
| <WindowIndex Value="-1"/> | |||
| <TopLine Value="2195"/> | |||
| <CursorPos X="3" Y="2211"/> | |||
| <UsageCount Value="10"/> | |||
| </Unit18> | |||
| <Unit19> | |||
| </Unit20> | |||
| <Unit21> | |||
| <Filename Value="..\Vulkan.inc"/> | |||
| <EditorIndex Value="-1"/> | |||
| <CursorPos X="9" Y="5"/> | |||
| <UsageCount Value="11"/> | |||
| </Unit19> | |||
| <Unit20> | |||
| </Unit21> | |||
| <Unit22> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\lcl\forms.pp"/> | |||
| <UnitName Value="Forms"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="1249"/> | |||
| <CursorPos X="3" Y="1268"/> | |||
| <UsageCount Value="10"/> | |||
| </Unit20> | |||
| <Unit21> | |||
| </Unit22> | |||
| <Unit23> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\3.1.1\source\rtl\objpas\classes\classesh.inc"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="2100"/> | |||
| <CursorPos X="38" Y="2125"/> | |||
| <UsageCount Value="10"/> | |||
| </Unit21> | |||
| <Unit22> | |||
| </Unit23> | |||
| <Unit24> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\lcl\extctrls.pp"/> | |||
| <UnitName Value="ExtCtrls"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="1023"/> | |||
| <CursorPos X="3" Y="1038"/> | |||
| <UsageCount Value="10"/> | |||
| </Unit22> | |||
| <Unit23> | |||
| </Unit24> | |||
| <Unit25> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\lcl\controls.pp"/> | |||
| <UnitName Value="Controls"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="2240"/> | |||
| <CursorPos X="3" Y="2255"/> | |||
| <UsageCount Value="10"/> | |||
| </Unit23> | |||
| <Unit24> | |||
| </Unit25> | |||
| <Unit26> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\3.1.1\source\rtl\objpas\sysutils\sysutilh.inc"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="22"/> | |||
| <CursorPos X="4" Y="37"/> | |||
| <UsageCount Value="12"/> | |||
| </Unit24> | |||
| <Unit25> | |||
| </Unit26> | |||
| <Unit27> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\3.1.1\source\rtl\win\sysosh.inc"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="7"/> | |||
| <CursorPos X="3" Y="22"/> | |||
| <UsageCount Value="12"/> | |||
| </Unit25> | |||
| <Unit26> | |||
| </Unit27> | |||
| <Unit28> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\3.1.1\source\rtl\inc\systemh.inc"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="93"/> | |||
| <CursorPos X="19" Y="108"/> | |||
| <UsageCount Value="12"/> | |||
| </Unit26> | |||
| <Unit27> | |||
| </Unit28> | |||
| <Unit29> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\3.1.1\source\rtl\win\wininc\ascdef.inc"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="57"/> | |||
| <CursorPos X="10" Y="72"/> | |||
| <UsageCount Value="12"/> | |||
| </Unit27> | |||
| <Unit28> | |||
| </Unit29> | |||
| <Unit30> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\3.1.1\source\rtl\win32\windows.pp"/> | |||
| <EditorIndex Value="-1"/> | |||
| <UsageCount Value="12"/> | |||
| </Unit28> | |||
| <Unit29> | |||
| </Unit30> | |||
| <Unit31> | |||
| <Filename Value="C:\Zusatzprogramme\Lazarus\fpc\3.1.1\source\rtl\win\wininc\base.inc"/> | |||
| <EditorIndex Value="-1"/> | |||
| <TopLine Value="84"/> | |||
| <CursorPos X="6" Y="99"/> | |||
| <UsageCount Value="12"/> | |||
| </Unit29> | |||
| </Unit31> | |||
| </Units> | |||
| <JumpHistory Count="30" HistoryIndex="28"> | |||
| <JumpHistory Count="30" HistoryIndex="29"> | |||
| <Position1> | |||
| <Filename Value="..\utils\uvkuPhysicalDevice.pas"/> | |||
| <Caret Line="272" Column="3" TopLine="246"/> | |||
| <Filename Value="..\utils\uvkuSwapChainFactory.pas"/> | |||
| <Caret Line="134" TopLine="127"/> | |||
| </Position1> | |||
| <Position2> | |||
| <Filename Value="..\utils\uvkuPhysicalDevice.pas"/> | |||
| <Caret Line="258" Column="10" TopLine="239"/> | |||
| <Filename Value="..\utils\uvkuSwapChainFactory.pas"/> | |||
| <Caret Line="135" TopLine="127"/> | |||
| </Position2> | |||
| <Position3> | |||
| <Filename Value="..\utils\uvkuPhysicalDevice.pas"/> | |||
| <Caret Line="262" Column="79" TopLine="244"/> | |||
| <Filename Value="..\utils\uvkuSwapChainFactory.pas"/> | |||
| <Caret Line="136" TopLine="127"/> | |||
| </Position3> | |||
| <Position4> | |||
| <Filename Value="..\utils\uvkuPhysicalDevice.pas"/> | |||
| <Caret Line="62" Column="63" TopLine="48"/> | |||
| <Filename Value="..\utils\uvkuSwapChainFactory.pas"/> | |||
| <Caret Line="151" TopLine="127"/> | |||
| </Position4> | |||
| <Position5> | |||
| <Filename Value="..\utils\uvkuPhysicalDevice.pas"/> | |||
| <Caret Line="262" Column="101" TopLine="244"/> | |||
| <Filename Value="..\utils\uvkuSwapChainFactory.pas"/> | |||
| <Caret Line="152" TopLine="128"/> | |||
| </Position5> | |||
| <Position6> | |||
| <Filename Value="..\utils\uvkuSurface.pas"/> | |||
| <Caret Line="14" Column="3"/> | |||
| <Filename Value="..\utils\uvkuAllocationHandler.pas"/> | |||
| <Caret Line="93" TopLine="73"/> | |||
| </Position6> | |||
| <Position7> | |||
| <Filename Value="..\utils\uvkuSurface.pas"/> | |||
| <Caret Line="57" Column="51" TopLine="42"/> | |||
| <Filename Value="..\utils\uvkuAllocationHandler.pas"/> | |||
| <Caret Line="94" TopLine="73"/> | |||
| </Position7> | |||
| <Position8> | |||
| <Filename Value="..\utils\uvkuSurface.pas"/> | |||
| <Caret Line="69" Column="12" TopLine="63"/> | |||
| <Filename Value="..\utils\uvkuAllocationHandler.pas"/> | |||
| <Caret Line="95" TopLine="73"/> | |||
| </Position8> | |||
| <Position9> | |||
| <Filename Value="..\utils\uvkuSurface.pas"/> | |||
| <Caret Line="24" Column="67" TopLine="14"/> | |||
| <Filename Value="..\utils\uvkuAllocationHandler.pas"/> | |||
| <Caret Line="96" TopLine="73"/> | |||
| </Position9> | |||
| <Position10> | |||
| <Filename Value="..\utils\uvkuSurfaceFactory.pas"/> | |||
| <Caret Line="198" Column="87" TopLine="176"/> | |||
| <Filename Value="..\utils\uvkuAllocationHandler.pas"/> | |||
| <Caret Line="97" TopLine="73"/> | |||
| </Position10> | |||
| <Position11> | |||
| <Filename Value="triangle.lpr"/> | |||
| <Caret Line="10" Column="48"/> | |||
| <Filename Value="..\utils\uvkuAllocationHandler.pas"/> | |||
| <Caret Line="98" TopLine="73"/> | |||
| </Position11> | |||
| <Position12> | |||
| <Filename Value="uMainForm.pas"/> | |||
| <Caret Line="100" Column="60" TopLine="76"/> | |||
| <Filename Value="..\utils\uvkuAllocationHandler.pas"/> | |||
| <Caret Line="99" TopLine="73"/> | |||
| </Position12> | |||
| <Position13> | |||
| <Filename Value="..\utils\uvkuInstance.pas"/> | |||
| <Caret Line="31" Column="27" TopLine="14"/> | |||
| <Filename Value="..\utils\uvkuAllocationHandler.pas"/> | |||
| <Caret Line="100" TopLine="73"/> | |||
| </Position13> | |||
| <Position14> | |||
| <Filename Value="..\utils\uvkuSurfaceFactory.pas"/> | |||
| <Caret Line="161" Column="87" TopLine="115"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="74" TopLine="61"/> | |||
| </Position14> | |||
| <Position15> | |||
| <Filename Value="..\utils\uvkuSurfaceFactory.pas"/> | |||
| <Caret Line="150" Column="14" TopLine="136"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="79" TopLine="61"/> | |||
| </Position15> | |||
| <Position16> | |||
| <Filename Value="..\utils\uvkuSurfaceFactory.pas"/> | |||
| <Caret Line="188" Column="24" TopLine="174"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="76" TopLine="61"/> | |||
| </Position16> | |||
| <Position17> | |||
| <Filename Value="uMainForm.pas"/> | |||
| <Caret Line="11" Column="34" TopLine="90"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="77" TopLine="61"/> | |||
| </Position17> | |||
| <Position18> | |||
| <Filename Value="uMainForm.pas"/> | |||
| <Caret Line="101" TopLine="91"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="78" TopLine="61"/> | |||
| </Position18> | |||
| <Position19> | |||
| <Filename Value="..\utils\uvkuDevice.pas"/> | |||
| <Caret Line="96" Column="15" TopLine="56"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="51" TopLine="36"/> | |||
| </Position19> | |||
| <Position20> | |||
| <Filename Value="..\utils\uvkuDevice.pas"/> | |||
| <Caret Line="55" Column="11" TopLine="40"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="52" TopLine="36"/> | |||
| </Position20> | |||
| <Position21> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="4454" Column="11" TopLine="4439"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="53" TopLine="36"/> | |||
| </Position21> | |||
| <Position22> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="55" TopLine="36"/> | |||
| </Position22> | |||
| <Position23> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="86" Column="30" TopLine="61"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="57" TopLine="36"/> | |||
| </Position23> | |||
| <Position24> | |||
| <Filename Value="..\utils\uvkuDeviceFactory.pas"/> | |||
| <Caret Line="76" Column="22" TopLine="58"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="78" TopLine="63"/> | |||
| </Position24> | |||
| <Position25> | |||
| <Filename Value="..\utils\uvkuDeviceFactory.pas"/> | |||
| <Caret Line="179" TopLine="215"/> | |||
| <Filename Value="uMainForm.pas"/> | |||
| <Caret Line="203" TopLine="190"/> | |||
| </Position25> | |||
| <Position26> | |||
| <Filename Value="uMainForm.pas"/> | |||
| <Caret Line="30" Column="5" TopLine="4"/> | |||
| <Caret Line="36" Column="5" TopLine="20"/> | |||
| </Position26> | |||
| <Position27> | |||
| <Filename Value="..\utils\uvkuDeviceFactory.pas"/> | |||
| <Caret Line="198" Column="96" TopLine="187"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="15" Column="28" TopLine="11"/> | |||
| </Position27> | |||
| <Position28> | |||
| <Filename Value="uMainForm.pas"/> | |||
| <Caret Line="12" Column="32"/> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="1635" Column="61" TopLine="1626"/> | |||
| </Position28> | |||
| <Position29> | |||
| <Filename Value="uMainForm.pas"/> | |||
| <Caret Line="111" Column="6" TopLine="89"/> | |||
| <Filename Value="..\Vulkan.pas"/> | |||
| <Caret Line="3089" Column="61" TopLine="3081"/> | |||
| </Position29> | |||
| <Position30> | |||
| <Filename Value="..\utils\uvkuDeviceFactory.pas"/> | |||
| <Caret Line="58" Column="73" TopLine="44"/> | |||
| <Filename Value="..\utils\uvkuSwapChain.pas"/> | |||
| <Caret Line="29" Column="20" TopLine="20"/> | |||
| </Position30> | |||
| </JumpHistory> | |||
| </ProjectSession> | |||
| <Debugging> | |||
| <BreakPoints Count="1"> | |||
| <Item1> | |||
| <Kind Value="bpkSource"/> | |||
| <WatchScope Value="wpsLocal"/> | |||
| <WatchKind Value="wpkWrite"/> | |||
| <Source Value="uMainForm.pas"/> | |||
| <Line Value="203"/> | |||
| </Item1> | |||
| </BreakPoints> | |||
| <Watches Count="1"> | |||
| <Item1> | |||
| <Expression Value="self"/> | |||
| </Item1> | |||
| </Watches> | |||
| </Debugging> | |||
| </CONFIG> | |||
| @@ -8,8 +8,10 @@ uses | |||
| Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, | |||
| Vulkan, uvkuAllocationHandler, | |||
| uvkuInstance, uvkuInstanceFactory, | |||
| uvkuPhysicalDevice, uvkuPhysicalDeviceFactory, | |||
| uvkuSurface, uvkuSurfaceFactory, | |||
| uvkuDevice, uvkuDeviceFactory; | |||
| uvkuDevice, uvkuDeviceFactory, | |||
| uvkuSwapChain, uvkuSwapChainFactory; | |||
| type | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| @@ -28,8 +30,10 @@ type | |||
| private | |||
| fAllocHandler: TCustomAllocHandler; | |||
| fInstance: TvkuInstance; | |||
| fPhyDevice: TvkuPhysicalDevice; | |||
| fDevice: TvkuDevice; | |||
| fSurface: TvkuSurface; | |||
| fSwapChain: TvkuSwapChain; | |||
| public | |||
| { public declarations } | |||
| end; | |||
| @@ -74,25 +78,42 @@ procedure TMainForm.FormCreate(Sender: TObject); | |||
| var | |||
| PhyDevices: TvkuPhysicalDeviceArr; | |||
| iFactory: TvkuInstanceFactory; | |||
| pdFactory: TvkuPhysicalDeviceFactory; | |||
| dFactory: TvkuDeviceFactory; | |||
| sFactory: TvkuSurfaceFactory; | |||
| scFactory: TvkuSwapChainFactory; | |||
| qci: TvkuQueueCreateInfo; | |||
| SrfFormats: TvkuSurfaceFormatArr; | |||
| SurfaceCapabilities: TVkSurfaceCapabilitiesKHR; | |||
| PresentModes: TvkuPresentModeArr; | |||
| pm: TVkPresentModeKHR; | |||
| begin | |||
| fAllocHandler := TCustomAllocHandler.Create; | |||
| WriteLn('create vulkan instance'); | |||
| iFactory := TvkuInstanceFactory.Create; | |||
| try | |||
| iFactory.Extensions.Add(VK_KHR_SURFACE_EXTENSION_NAME); | |||
| iFactory.Extensions.Add(TvkuInstanceFactory.GetPlatformSurfaceExtensionName); | |||
| iFactory.Extensions.Add(TvkuSurface.GetPlatformSurfaceExtensionName); | |||
| fInstance := iFactory.CreateInstance(fAllocHandler, false); | |||
| finally | |||
| FreeAndNil(iFactory); | |||
| end; | |||
| WriteLn('check physical devices'); | |||
| PhyDevices := fInstance.GetPhysicalDevices; | |||
| if (Length(PhyDevices) <= 0) then | |||
| raise Exception.Create('unable to get physical device'); | |||
| pdFactory := TvkuPhysicalDeviceFactory.Create(fInstance); | |||
| try | |||
| fPhyDevice := pdFactory.CreatePhysicalDevice(PhyDevices[0]); | |||
| finally | |||
| FreeAndNil(pdFactory); | |||
| end; | |||
| WriteLn('create vulkan surface'); | |||
| sFactory := TvkuSurfaceFactory.Create(fInstance); | |||
| @@ -103,6 +124,7 @@ begin | |||
| FreeAndNil(sFactory); | |||
| end; | |||
| WriteLn('create vulkan device'); | |||
| dFactory := TvkuDeviceFactory.Create(fInstance); | |||
| try | |||
| @@ -114,17 +136,83 @@ begin | |||
| dFactory.QueueCreateInfoCount := 1; | |||
| dFactory.QueueCreateInfo[0] := qci; | |||
| fDevice := dFactory.CreateDevice(PhyDevices[0], fAllocHandler, false); | |||
| fDevice := dFactory.CreateDevice(fPhyDevice.Handle, fAllocHandler, false); | |||
| finally | |||
| FreeAndNil(dFactory); | |||
| end; | |||
| WriteLn('create swap chain'); | |||
| scFactory := TvkuSwapChainFactory.Create(fDevice); | |||
| try | |||
| scFactory.Surface := fSurface.Handle; | |||
| scFactory.ImageUsage := [ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT ]; | |||
| scFactory.ImageArrayLayers := 1; | |||
| scFactory.ImageSharingMode := VK_SHARING_MODE_EXCLUSIVE; | |||
| scFactory.Clipped := true; | |||
| scFactory.ComposideAlpha := [ VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR ]; | |||
| WriteLn(' get surface capabilities'); | |||
| SurfaceCapabilities := fPhyDevice.GetSurfaceCapabilities(fSurface.Handle); | |||
| if (SurfaceCapabilities.currentExtent.width = High(VkUint32)) then begin | |||
| SurfaceCapabilities.currentExtent.width := ClientWidth; | |||
| SurfaceCapabilities.currentExtent.height := ClientHeight; | |||
| end else begin | |||
| ClientWidth := SurfaceCapabilities.currentExtent.width; | |||
| ClientHeight := SurfaceCapabilities.currentExtent.height; | |||
| end; | |||
| scFactory.ImageExtent := SurfaceCapabilities.currentExtent; | |||
| WriteLn(' set min image count'); | |||
| scFactory.MinImageCount := SurfaceCapabilities.minImageCount + 1; | |||
| if (SurfaceCapabilities.maxImageCount > 0) and | |||
| (scFactory.MinImageCount > SurfaceCapabilities.maxImageCount) then | |||
| scFactory.MinImageCount := SurfaceCapabilities.maxImageCount; | |||
| WriteLn(' find suitable image format'); | |||
| SrfFormats := fPhyDevice.GetSurfaceFormats(fSurface.Handle); | |||
| if (Length(SrfFormats) = 0) then begin | |||
| WriteLn('no suitable formats found'); | |||
| halt; | |||
| end; | |||
| if (Length(SrfFormats) = 1) and (SrfFormats[0].format = VK_FORMAT_UNDEFINED) then begin | |||
| scFactory.ImageFormat := VK_FORMAT_R8G8B8A8_UNORM; | |||
| scFactory.ImageColorSpace := VK_COLORSPACE_SRGB_NONLINEAR_KHR; | |||
| end else begin | |||
| scFactory.ImageFormat := SrfFormats[0].format; | |||
| scFactory.ImageColorSpace := SrfFormats[0].colorSpace; | |||
| end; | |||
| WriteLn(' set pre transform'); | |||
| scFactory.PreTransform := SurfaceCapabilities.currentTransform; | |||
| if (VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR in SurfaceCapabilities.supportedTransforms) then | |||
| scFactory.PreTransform := scFactory.PreTransform + [ VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR ]; | |||
| WriteLn(' find suitable present mode'); | |||
| PresentModes := fPhyDevice.GetSurfacePresentModes(fSurface.Handle); | |||
| if (Length(PresentModes) = 0) then begin | |||
| WriteLn('unable to get present modes'); | |||
| halt; | |||
| end; | |||
| for pm in PresentModes do begin | |||
| if (pm = VK_PRESENT_MODE_MAILBOX_KHR) then begin | |||
| scFactory.PresentMode := pm; | |||
| break; | |||
| end; | |||
| end; | |||
| fSwapChain := scFactory.CreateSwapchain(fAllocHandler, false); | |||
| finally | |||
| FreeAndNil(scFactory); | |||
| end; | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| procedure TMainForm.FormDestroy(Sender: TObject); | |||
| begin | |||
| FreeAndNil(fSwapChain); | |||
| FreeAndNil(fDevice); | |||
| FreeAndNil(fSurface); | |||
| FreeAndNil(fPhyDevice); | |||
| FreeAndNil(fInstance); | |||
| FreeAndNil(fAllocHandler); | |||
| end; | |||
| @@ -22,8 +22,9 @@ type | |||
| const aCreateInfo: PVkDeviceCreateInfo; | |||
| const aAllocCallbacks: PVkAllocationCallbacks); | |||
| public | |||
| property Handle: VkDevice read fHandle; | |||
| property PhysicalDevice: VkPhysicalDevice read fPhysicalDevice; | |||
| property Handle: VkDevice read fHandle; | |||
| property PhysicalDevice: VkPhysicalDevice read fPhysicalDevice; | |||
| property DeviceCommands: TVkDeviceCommands read fDeviceCommands; | |||
| constructor Create( | |||
| const aPhysicalDevice: VkPhysicalDevice; | |||
| @@ -89,7 +90,7 @@ destructor TvkuDevice.Destroy; | |||
| begin | |||
| if (fHandle <> VK_INVALID_HANDLE) then begin | |||
| fDeviceCommands.vkDestroyDevice(fHandle, fAllocCallbacks); | |||
| fHandle := nil; | |||
| fHandle := VK_INVALID_HANDLE; | |||
| end; | |||
| if Assigned(fAllocCallbacks) then begin | |||
| Dispose(fAllocCallbacks); | |||
| @@ -30,7 +30,7 @@ type | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| TvkuDeviceFactory = class(TObject) | |||
| private | |||
| fInstance: TvkuInstance; | |||
| fInstanceCommands: TVkInstanceCommands; | |||
| fFeatures: TVkPhysicalDeviceFeatures; | |||
| fFlags: VkDeviceCreateFlags; | |||
| fLayers: TStringList; | |||
| @@ -65,6 +65,7 @@ type | |||
| const aOwnsHandler: Boolean): TvkuDevice; | |||
| constructor Create(const aInstance: TvkuInstance); | |||
| constructor Create(const aInstanceCommands: TVkInstanceCommands); | |||
| destructor Destroy; override; | |||
| end; | |||
| @@ -154,8 +155,6 @@ var | |||
| lay: array of PVkChar; | |||
| ext: array of PVkChar; | |||
| i: Integer; | |||
| prio: VkFloat; | |||
| err: TVkResult; | |||
| begin | |||
| if (Length(fQueueCreateInfos) <= 0) then | |||
| raise TvkuException.Create('no queue create infos assigned'); | |||
| @@ -194,8 +193,8 @@ begin | |||
| CreateInfo.pEnabledFeatures := @fFeatures; | |||
| if Assigned(aAllocHandler) | |||
| then result := TvkuDeviceEx.Create(aPhysicalDevice, CreateInfo, fInstance.InstanceCommands, aAllocHandler.GetAllocationCallbacks) | |||
| else result := TvkuDeviceEx.Create(aPhysicalDevice, CreateInfo, fInstance.InstanceCommands); | |||
| then result := TvkuDeviceEx.Create(aPhysicalDevice, CreateInfo, fInstanceCommands, aAllocHandler.GetAllocationCallbacks) | |||
| else result := TvkuDeviceEx.Create(aPhysicalDevice, CreateInfo, fInstanceCommands); | |||
| try | |||
| TvkuDeviceEx(result).fAllocHandler := aAllocHandler; | |||
| TvkuDeviceEx(result).fOwnsHandler := aOwnsHandler; | |||
| @@ -207,12 +206,18 @@ end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| constructor TvkuDeviceFactory.Create(const aInstance: TvkuInstance); | |||
| begin | |||
| Create(aInstance.InstanceCommands); | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| constructor TvkuDeviceFactory.Create(const aInstanceCommands: TVkInstanceCommands); | |||
| begin | |||
| inherited Create; | |||
| FillByte(fFeatures, SizeOf(fFeatures), 0); | |||
| fInstance := aInstance; | |||
| fLayers := TStringList.Create; | |||
| fExtensions := TStringList.Create; | |||
| fInstanceCommands := aInstanceCommands; | |||
| fLayers := TStringList.Create; | |||
| fExtensions := TStringList.Create; | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| @@ -114,7 +114,7 @@ destructor TvkuInstance.Destroy; | |||
| begin | |||
| if (fHandle <> VK_INVALID_HANDLE) then begin | |||
| InstanceCommands.vkDestroyInstance(fHandle, fAllocCallbacks); | |||
| fHandle := nil; | |||
| fHandle := VK_INVALID_HANDLE; | |||
| end; | |||
| if Assigned(fAllocCallbacks) then begin | |||
| Dispose(fAllocCallbacks); | |||
| @@ -52,8 +52,6 @@ type | |||
| constructor Create; | |||
| destructor Destroy; override; | |||
| public | |||
| class function GetPlatformSurfaceExtensionName: String; | |||
| end; | |||
| function vkuApplicationInfo: TvkuApplicationInfo; | |||
| @@ -183,25 +181,5 @@ begin | |||
| inherited Destroy; | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| class function TvkuInstanceFactory.GetPlatformSurfaceExtensionName: String; | |||
| begin | |||
| {$IF DEFINED(VK_USE_PLATFORM_XLIB_KHR)} | |||
| result := VK_KHR_XLIB_SURFACE_EXTENSION_NAME; | |||
| {$ELSEIF DEFINED(VK_USE_PLATFORM_XCB_KHR)} | |||
| result := VK_KHR_XCB_SURFACE_EXTENSION_NAME; | |||
| {$ELSEIF DEFINED(VK_USE_PLATFORM_WAYLAND_KHR)} | |||
| result := VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME; | |||
| {$ELSEIF DEFINED(VK_USE_PLATFORM_MIR_KHR)} | |||
| result := VK_KHR_MIR_SURFACE_EXTENSION_NAME; | |||
| {$ELSEIF DEFINED(VK_USE_PLATFORM_ANDROID_KHR)} | |||
| result := VK_KHR_ANDROID_SURFACE_EXTENSION_NAME; | |||
| {$ELSEIF DEFINED(VK_USE_PLATFORM_WIN32_KHR)} | |||
| result := VK_KHR_WIN32_SURFACE_EXTENSION_NAME; | |||
| {$ELSE} | |||
| {$ERROR 'unknown or unsupportet platform'} | |||
| {$ENDIF} | |||
| end; | |||
| end. | |||
| @@ -10,14 +10,14 @@ uses | |||
| type | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| TVkQueueFamilyPropertiesArr = array of TVkQueueFamilyProperties; | |||
| TVkSparseImageFormatPropertiesArr = array of TVkSparseImageFormatProperties; | |||
| TVkSurfaceFormatArr = array of TVkSurfaceFormatKHR; | |||
| TVkPresentModeArr = array of TVkPresentModeKHR; | |||
| TVkDisplayPropertiesArr = array of TVkDisplayPropertiesKHR; | |||
| TVkDisplayPlanePropertiesArr = array of TVkDisplayPlanePropertiesKHR; | |||
| TVkDisplayArr = array of VkDisplayKHR; | |||
| TVkDisplayModePropertiesArr = array of TVkDisplayModePropertiesKHR; | |||
| TvkuQueueFamilyPropertiesArr = array of TVkQueueFamilyProperties; | |||
| TvkuSparseImageFormatPropertiesArr = array of TVkSparseImageFormatProperties; | |||
| TvkuSurfaceFormatArr = array of TVkSurfaceFormatKHR; | |||
| TvkuPresentModeArr = array of TVkPresentModeKHR; | |||
| TvkuDisplayPropertiesArr = array of TVkDisplayPropertiesKHR; | |||
| TvkuDisplayPlanePropertiesArr = array of TVkDisplayPlanePropertiesKHR; | |||
| TvkuDisplayArr = array of VkDisplayKHR; | |||
| TvkuDisplayModePropertiesArr = array of TVkDisplayModePropertiesKHR; | |||
| TvkuPhysicalDevice = class(TObject) | |||
| private | |||
| @@ -28,7 +28,7 @@ type | |||
| function GetFeatures: TVkPhysicalDeviceFeatures; | |||
| function GetProperties: TVkPhysicalDeviceProperties; | |||
| function GetMemoryProperties: TVkPhysicalDeviceMemoryProperties; | |||
| function GetQueueFamilyProperties: TVkQueueFamilyPropertiesArr; | |||
| function GetQueueFamilyProperties: TvkuQueueFamilyPropertiesArr; | |||
| function GetFormatProperties(const aFormat: TVkFormat): TVkFormatProperties; | |||
| function GetImageFormatProperties( | |||
| const aFormat: TVkFormat; | |||
| @@ -41,19 +41,19 @@ type | |||
| const aImageType: TVkImageType; | |||
| const aSamples: TVkSampleCountFlagBits; | |||
| const aUsage: VkImageUsageFlags; | |||
| const aTiling: TVkImageTiling): TVkSparseImageFormatPropertiesArr; | |||
| const aTiling: TVkImageTiling): TvkuSparseImageFormatPropertiesArr; | |||
| public { VK_KHR_surface } | |||
| function GetSurfaceSupport(const aQueueFamilyIndex: VkUint32; const aSurface: VkSurfaceKHR): Boolean; | |||
| function GetSurfaceCapabilities(const aSurface: VkSurfaceKHR): TVkSurfaceCapabilitiesKHR; | |||
| function GetSurfaceFormats(const aSurface: VkSurfaceKHR): TVkSurfaceFormatArr; | |||
| function GetSurfacePresentModes(const aSurface: VkSurfaceKHR): TVkPresentModeArr; | |||
| function GetSurfaceFormats(const aSurface: VkSurfaceKHR): TvkuSurfaceFormatArr; | |||
| function GetSurfacePresentModes(const aSurface: VkSurfaceKHR): TvkuPresentModeArr; | |||
| public { VK_KHR_display } | |||
| function GetDisplayProperties: TVkDisplayPropertiesArr; | |||
| function GetDisplayPlaneProperties: TVkDisplayPlanePropertiesArr; | |||
| function GetDisplayPlaneSupportedDisplays(const aPlaneIndex: VkUint32): TVkDisplayArr; | |||
| function GetDisplayModeProperties(const aDisplay: VkDisplayKHR): TVkDisplayModePropertiesArr; | |||
| function GetDisplayProperties: TvkuDisplayPropertiesArr; | |||
| function GetDisplayPlaneProperties: TvkuDisplayPlanePropertiesArr; | |||
| function GetDisplayPlaneSupportedDisplays(const aPlaneIndex: VkUint32): TvkuDisplayArr; | |||
| function GetDisplayModeProperties(const aDisplay: VkDisplayKHR): TvkuDisplayModePropertiesArr; | |||
| public | |||
| property Handle: VkPhysicalDevice read fHandle; | |||
| @@ -94,9 +94,10 @@ begin | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuPhysicalDevice.GetQueueFamilyProperties: TVkQueueFamilyPropertiesArr; | |||
| function TvkuPhysicalDevice.GetQueueFamilyProperties: TvkuQueueFamilyPropertiesArr; | |||
| var c: VkUint32; | |||
| begin | |||
| result := nil; | |||
| if not Assigned(fInstanceCommands.vkGetPhysicalDeviceQueueFamilyProperties) then | |||
| raise TvkuException.Create('invalid function pointer: vkGetPhysicalDeviceQueueFamilyProperties; did you load the vulkan core commands?'); | |||
| fInstanceCommands.vkGetPhysicalDeviceQueueFamilyProperties(fHandle, @c, nil); | |||
| @@ -126,9 +127,10 @@ end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuPhysicalDevice.GetSparseImageFormatProperties(const aFormat: TVkFormat; const aImageType: TVkImageType; | |||
| const aSamples: TVkSampleCountFlagBits; const aUsage: VkImageUsageFlags; const aTiling: TVkImageTiling): TVkSparseImageFormatPropertiesArr; | |||
| const aSamples: TVkSampleCountFlagBits; const aUsage: VkImageUsageFlags; const aTiling: TVkImageTiling): TvkuSparseImageFormatPropertiesArr; | |||
| var c: VkUint32; | |||
| begin | |||
| result := nil; | |||
| if not Assigned(fInstanceCommands.vkGetPhysicalDeviceSparseImageFormatProperties) then | |||
| raise TvkuException.Create('invalid function pointer: vkGetPhysicalDeviceSparseImageFormatProperties; did you load the vulkan core commands?'); | |||
| fInstanceCommands.vkGetPhysicalDeviceSparseImageFormatProperties(fHandle, aFormat, aImageType, aSamples, aUsage, aTiling, @c, nil); | |||
| @@ -163,22 +165,24 @@ begin | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuPhysicalDevice.GetSurfaceFormats(const aSurface: VkSurfaceKHR): TVkSurfaceFormatArr; | |||
| function TvkuPhysicalDevice.GetSurfaceFormats(const aSurface: VkSurfaceKHR): TvkuSurfaceFormatArr; | |||
| var c: VkUint32; | |||
| begin | |||
| result := nil; | |||
| if not Assigned(fInstanceCommands.vkGetPhysicalDeviceSurfaceFormatsKHR) then | |||
| raise TvkuException.Create('invalid function pointer: vkGetPhysicalDeviceSurfaceFormatsKHR; did you enabled the VK_KHR_surface extension?'); | |||
| fInstanceCommands.vkGetPhysicalDeviceSurfaceFormatsKHR(fHandle, aSurface, @c, nil); | |||
| SetLength(result, c); | |||
| fInstanceCommands.vkGetPhysicalDeviceSurfaceFormatsKHR(fHandle, aSurface, @c, @result[0]); | |||
| fInstanceCommands.vkGetPhysicalDeviceSurfaceFormatsKHR(fHandle, aSurface, @c, nil); | |||
| SetLength(result, c); | |||
| fInstanceCommands.vkGetPhysicalDeviceSurfaceFormatsKHR(fHandle, aSurface, @c, @result[0]); | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuPhysicalDevice.GetSurfacePresentModes(const aSurface: VkSurfaceKHR): TVkPresentModeArr; | |||
| function TvkuPhysicalDevice.GetSurfacePresentModes(const aSurface: VkSurfaceKHR): TvkuPresentModeArr; | |||
| var | |||
| c: VkUint32; | |||
| err: TVkResult; | |||
| begin | |||
| result := nil; | |||
| if not Assigned(fInstanceCommands.vkGetPhysicalDeviceSurfacePresentModesKHR) then | |||
| raise TvkuException.Create('invalid function pointer: vkGetPhysicalDeviceSurfacePresentModesKHR; did you enabled the VK_KHR_surface extension?'); | |||
| err := fInstanceCommands.vkGetPhysicalDeviceSurfacePresentModesKHR(fHandle, aSurface, @c, nil); | |||
| @@ -191,11 +195,12 @@ begin | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuPhysicalDevice.GetDisplayProperties: TVkDisplayPropertiesArr; | |||
| function TvkuPhysicalDevice.GetDisplayProperties: TvkuDisplayPropertiesArr; | |||
| var | |||
| err: TVkResult; | |||
| c: VkUint32; | |||
| begin | |||
| result := nil; | |||
| if not Assigned(fInstanceCommands.vkGetPhysicalDeviceDisplayPropertiesKHR) then | |||
| raise TvkuException.Create('invalid function pointer: vkGetPhysicalDeviceDisplayPropertiesKHR; did you enabled the VK_KHR_display extension?'); | |||
| err := fInstanceCommands.vkGetPhysicalDeviceDisplayPropertiesKHR(fHandle, @c, nil); | |||
| @@ -208,11 +213,12 @@ begin | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuPhysicalDevice.GetDisplayPlaneProperties: TVkDisplayPlanePropertiesArr; | |||
| function TvkuPhysicalDevice.GetDisplayPlaneProperties: TvkuDisplayPlanePropertiesArr; | |||
| var | |||
| err: TVkResult; | |||
| c: VkUint32; | |||
| begin | |||
| result := nil; | |||
| if not Assigned(fInstanceCommands.vkGetPhysicalDeviceDisplayPlanePropertiesKHR) then | |||
| raise TvkuException.Create('invalid function pointer: vkGetPhysicalDeviceDisplayPlanePropertiesKHR; did you enabled the VK_KHR_display extension?'); | |||
| err := fInstanceCommands.vkGetPhysicalDeviceDisplayPlanePropertiesKHR(fHandle, @c, nil); | |||
| @@ -225,11 +231,12 @@ begin | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuPhysicalDevice.GetDisplayPlaneSupportedDisplays(const aPlaneIndex: VkUint32): TVkDisplayArr; | |||
| function TvkuPhysicalDevice.GetDisplayPlaneSupportedDisplays(const aPlaneIndex: VkUint32): TvkuDisplayArr; | |||
| var | |||
| err: TVkResult; | |||
| c: VkUint32; | |||
| begin | |||
| result := nil; | |||
| if not Assigned(fInstanceCommands.vkGetDisplayPlaneSupportedDisplaysKHR) then | |||
| raise TvkuException.Create('invalid function pointer: vkGetDisplayPlaneSupportedDisplaysKHR; did you enabled the VK_KHR_display extension?'); | |||
| err := fInstanceCommands.vkGetDisplayPlaneSupportedDisplaysKHR(fHandle, aPlaneIndex, @c, nil); | |||
| @@ -242,11 +249,12 @@ begin | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuPhysicalDevice.GetDisplayModeProperties(const aDisplay: VkDisplayKHR): TVkDisplayModePropertiesArr; | |||
| function TvkuPhysicalDevice.GetDisplayModeProperties(const aDisplay: VkDisplayKHR): TvkuDisplayModePropertiesArr; | |||
| var | |||
| err: TVkResult; | |||
| c: VkUint32; | |||
| begin | |||
| result := nil; | |||
| if not Assigned(fInstanceCommands.vkGetDisplayModePropertiesKHR) then | |||
| raise TvkuException.Create('invalid function pointer: vkGetDisplayModePropertiesKHR; did you enabled the VK_KHR_display extension?'); | |||
| err := fInstanceCommands.vkGetDisplayModePropertiesKHR(fHandle, aDisplay, @c, nil); | |||
| @@ -38,6 +38,8 @@ type | |||
| {$ERROR 'unknown or unsupportet platform'} | |||
| {$ENDIF} | |||
| destructor Destroy; override; | |||
| public | |||
| class function GetPlatformSurfaceExtensionName: String; | |||
| end; | |||
| implementation | |||
| @@ -91,7 +93,7 @@ destructor TvkuSurface.Destroy; | |||
| begin | |||
| if (fHandle <> VK_INVALID_NDP_HANDLE) then begin | |||
| fInstanceCommands.vkDestroySurfaceKHR(fInstance, fHandle, fAllocCallbacks); | |||
| fHandle := 0; | |||
| fHandle := VK_INVALID_NDP_HANDLE; | |||
| end; | |||
| if Assigned(fAllocCallbacks) then begin | |||
| Dispose(fAllocCallbacks); | |||
| @@ -100,5 +102,25 @@ begin | |||
| inherited Destroy; | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| class function TvkuSurface.GetPlatformSurfaceExtensionName: String; | |||
| begin | |||
| {$IF DEFINED(VK_USE_PLATFORM_XLIB_KHR)} | |||
| result := VK_KHR_XLIB_SURFACE_EXTENSION_NAME; | |||
| {$ELSEIF DEFINED(VK_USE_PLATFORM_XCB_KHR)} | |||
| result := VK_KHR_XCB_SURFACE_EXTENSION_NAME; | |||
| {$ELSEIF DEFINED(VK_USE_PLATFORM_WAYLAND_KHR)} | |||
| result := VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME; | |||
| {$ELSEIF DEFINED(VK_USE_PLATFORM_MIR_KHR)} | |||
| result := VK_KHR_MIR_SURFACE_EXTENSION_NAME; | |||
| {$ELSEIF DEFINED(VK_USE_PLATFORM_ANDROID_KHR)} | |||
| result := VK_KHR_ANDROID_SURFACE_EXTENSION_NAME; | |||
| {$ELSEIF DEFINED(VK_USE_PLATFORM_WIN32_KHR)} | |||
| result := VK_KHR_WIN32_SURFACE_EXTENSION_NAME; | |||
| {$ELSE} | |||
| {$ERROR 'unknown or unsupportet platform'} | |||
| {$ENDIF} | |||
| end; | |||
| end. | |||
| @@ -34,7 +34,8 @@ type | |||
| private | |||
| fFlags: VkFlags; | |||
| fWinControl: TWinControl; | |||
| fInstance: TvkuInstance; | |||
| fInstance: VkInstance; | |||
| fInstanceCommands: TVkInstanceCommands; | |||
| procedure SetWinControl(aValue: TWinControl); | |||
| public | |||
| property WinControl: TWinControl read fWinControl write SetWinControl; | |||
| @@ -46,6 +47,7 @@ type | |||
| const aOwnsHandler: Boolean): TvkuSurface; | |||
| constructor Create(const aInstance: TvkuInstance); | |||
| constructor Create(const aInstance: VkInstance; const aInstanceCommands: TVkInstanceCommands); | |||
| end; | |||
| implementation | |||
| @@ -193,8 +195,8 @@ begin | |||
| CreateInfo.hwnd := fHwnd; | |||
| {$ENDIF} | |||
| if Assigned(aAllocHandler) | |||
| then srf := TvkuSurfaceEx.Create(fInstance.Handle, CreateInfo, fInstance.InstanceCommands, aAllocHandler.GetAllocationCallbacks) | |||
| else srf := TvkuSurfaceEx.Create(fInstance.Handle, CreateInfo, fInstance.InstanceCommands); | |||
| then srf := TvkuSurfaceEx.Create(fInstance, CreateInfo, fInstanceCommands, aAllocHandler.GetAllocationCallbacks) | |||
| else srf := TvkuSurfaceEx.Create(fInstance, CreateInfo, fInstanceCommands); | |||
| try | |||
| srf.fAllocHandler := aAllocHandler; | |||
| srf.fOwnsHandler := aOwnsHandler; | |||
| @@ -206,6 +208,12 @@ end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| constructor TvkuSurfaceFactory.Create(const aInstance: TvkuInstance); | |||
| begin | |||
| Create(aInstance.Handle, aInstance.InstanceCommands); | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| constructor TvkuSurfaceFactory.Create(const aInstance: VkInstance; const aInstanceCommands: TVkInstanceCommands); | |||
| begin | |||
| inherited Create; | |||
| {$IF DEFINED(VK_USE_PLATFORM_XLIB_KHR)} | |||
| @@ -221,8 +229,9 @@ begin | |||
| {$ELSEIF DEFINED(VK_USE_PLATFORM_WIN32_KHR)} | |||
| fHInstance := Vulkan.HINSTANCE(GetModuleHandle(nil)); | |||
| {$ENDIF} | |||
| fInstance := aInstance; | |||
| fFlags := 0; | |||
| fInstance := aInstance; | |||
| fInstanceCommands := aInstanceCommands; | |||
| fFlags := 0; | |||
| end; | |||
| end. | |||
| @@ -0,0 +1,130 @@ | |||
| unit uvkuSwapChain; | |||
| {$mode objfpc}{$H+} | |||
| interface | |||
| uses | |||
| Classes, SysUtils, | |||
| Vulkan; | |||
| type | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| TvkuImageArr = array of VkImage; | |||
| TvkuSwapChain = class(TObject) | |||
| private | |||
| fHandle: VkSwapchainKHR; | |||
| fDevice: VkDevice; | |||
| fAllocCallbacks: PVkAllocationCallbacks; | |||
| fDeviceCommands: TVkDeviceCommands; | |||
| procedure CreateHandle( | |||
| const aCreateInfo: PVkSwapchainCreateInfoKHR; | |||
| const aAllocCallbacks: PVkAllocationCallbacks); | |||
| public | |||
| property Handle: VkSwapchainKHR read fHandle; | |||
| property Device: VkDevice read fDevice; | |||
| property DeviceCommands: TVkDeviceCommands read fDeviceCommands; | |||
| function GetImages: TvkuImageArr; | |||
| function AcquireNextImage(const aTimeout: VkUint64; const aSemaphore: VkSemaphore; const aFence: VkFence): VkUint32; | |||
| constructor Create( | |||
| const aDevice: VkDevice; | |||
| const aCreateInfo: TVkSwapchainCreateInfoKHR; | |||
| const aDeviceCommands: TVkDeviceCommands); | |||
| constructor Create( | |||
| const aDevice: VkDevice; | |||
| const aCreateInfo: TVkSwapchainCreateInfoKHR; | |||
| const aDeviceCommands: TVkDeviceCommands; | |||
| const aAllocCallbacks: TVkAllocationCallbacks); | |||
| destructor Destroy; override; | |||
| end; | |||
| implementation | |||
| uses | |||
| uvkuUtils; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| //TvkuSwapChain////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| procedure TvkuSwapChain.CreateHandle(const aCreateInfo: PVkSwapchainCreateInfoKHR; const aAllocCallbacks: PVkAllocationCallbacks); | |||
| var err: TVkResult; | |||
| begin | |||
| if Assigned(aAllocCallbacks) then begin | |||
| new(fAllocCallbacks); | |||
| fAllocCallbacks^ := aAllocCallbacks^; | |||
| end; | |||
| if not Assigned(fDeviceCommands.vkCreateSwapchainKHR) then | |||
| raise TvkuException.Create('invalid function pointer: vkCreateSwapchainKHR; did you enabled the VK_KHR_swapchain extension?'); | |||
| err := fDeviceCommands.vkCreateSwapchainKHR(fDevice, aCreateInfo, fAllocCallbacks, @fHandle); | |||
| if (err < VK_SUCCESS) then | |||
| raise TvkuErrorException.Create('unable to create surface', err); | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuSwapChain.GetImages: TvkuImageArr; | |||
| var | |||
| c: VkUint32; | |||
| err: TVkResult; | |||
| begin | |||
| if not Assigned(fDeviceCommands.vkGetSwapchainImagesKHR) then | |||
| raise TvkuException.Create('invalid function pointer: vkGetSwapchainImagesKHR; did you enabled the VK_KHR_swapchain extension?'); | |||
| err := fDeviceCommands.vkGetSwapchainImagesKHR(fDevice, fHandle, @c, nil); | |||
| if (err < VK_SUCCESS) then | |||
| raise TvkuErrorException.Create('unable to get swap chain image count', err); | |||
| SetLength(result, c); | |||
| err := fDeviceCommands.vkGetSwapchainImagesKHR(fDevice, fHandle, @c, @result[0]); | |||
| if (err < VK_SUCCESS) then | |||
| raise TvkuErrorException.Create('unable to get swap chain images', err); | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuSwapChain.AcquireNextImage(const aTimeout: VkUint64; const aSemaphore: VkSemaphore; const aFence: VkFence): VkUint32; | |||
| var | |||
| c: VkUint32; | |||
| err: TVkResult; | |||
| begin | |||
| if not Assigned(fDeviceCommands.vkAcquireNextImageKHR) then | |||
| raise TvkuException.Create('invalid function pointer: vkAcquireNextImageKHR; did you enabled the VK_KHR_swapchain extension?'); | |||
| err := fDeviceCommands.vkAcquireNextImageKHR(fDevice, fHandle, aTimeout, aSemaphore, aFence, @result); | |||
| if (err < VK_SUCCESS) then | |||
| raise TvkuErrorException.Create('unable to aquire next image', err); | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| constructor TvkuSwapChain.Create(const aDevice: VkDevice; const aCreateInfo: TVkSwapchainCreateInfoKHR; const aDeviceCommands: TVkDeviceCommands); | |||
| begin | |||
| inherited Create; | |||
| fDevice := aDevice; | |||
| fDeviceCommands := aDeviceCommands; | |||
| CreateHandle(@aCreateInfo, nil); | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| constructor TvkuSwapChain.Create(const aDevice: VkDevice; const aCreateInfo: TVkSwapchainCreateInfoKHR; | |||
| const aDeviceCommands: TVkDeviceCommands; const aAllocCallbacks: TVkAllocationCallbacks); | |||
| begin | |||
| inherited Create; | |||
| fDevice := aDevice; | |||
| fDeviceCommands := aDeviceCommands; | |||
| CreateHandle(@aCreateInfo, @aAllocCallbacks); | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| destructor TvkuSwapChain.Destroy; | |||
| begin | |||
| if (fHandle <> VK_INVALID_NDP_HANDLE) then begin | |||
| fDeviceCommands.vkDestroySwapchainKHR(fDevice, fHandle, fAllocCallbacks); | |||
| fHandle := VK_INVALID_NDP_HANDLE; | |||
| end; | |||
| if Assigned(fAllocCallbacks) then begin | |||
| Dispose(fAllocCallbacks); | |||
| fAllocCallbacks := nil; | |||
| end; | |||
| inherited Destroy; | |||
| end; | |||
| end. | |||
| @@ -0,0 +1,178 @@ | |||
| unit uvkuSwapChainFactory; | |||
| {$mode objfpc}{$H+} | |||
| interface | |||
| uses | |||
| Classes, SysUtils, | |||
| Vulkan, uvkuSwapChain, uvkuAllocationHandler, uvkuDevice; | |||
| type | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| TvkuSwapChainEx = class(TvkuSwapChain) | |||
| private | |||
| fAllocHandler: TvkuAllocationHandler; | |||
| fOwnsHandler: Boolean; | |||
| public | |||
| destructor Destroy; override; | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| TvkuUint32Arr = array of VkUint32; | |||
| TvkuSwapChainFactory = class(TObject) | |||
| private | |||
| fDevice: VkDevice; | |||
| fDeviceCommands: TVkDeviceCommands; | |||
| fFlags: VkSwapchainCreateFlagsKHR; | |||
| fSurface: VkSurfaceKHR; | |||
| fMinImageCount: VkUint32; | |||
| fImageFormat: TVkFormat; | |||
| fImageColorSpace: TVkColorSpaceKHR; | |||
| fImageExtent: TVkExtent2D; | |||
| fImageArrayLayers: VkUint32; | |||
| fImageUsage: VkImageUsageFlags; | |||
| fImageSharingMode: TVkSharingMode; | |||
| fQueueFamilyIndices: TvkuUint32Arr; | |||
| fPreTransform: TVkSurfaceTransformFlagBitsKHR; | |||
| fComposideAlpha: TVkCompositeAlphaFlagBitsKHR; | |||
| fPresentMode: TVkPresentModeKHR; | |||
| fClipped: Boolean; | |||
| fOldSwapChain: VkSwapchainKHR; | |||
| function GetQueueFamilyIndexCount: Integer; | |||
| function GetQueueFamilyIndex(const aIndex: Integer): VkUint32; | |||
| procedure SetQueueFamilyIndex(const aIndex: Integer; aValue: VkUint32); | |||
| public | |||
| property Device: VkDevice read fDevice; | |||
| property DeviceCommands: TVkDeviceCommands read fDeviceCommands; | |||
| property Flags: VkSwapchainCreateFlagsKHR read fFlags write fFlags; | |||
| property Surface: VkSurfaceKHR read fSurface write fSurface; | |||
| property MinImageCount: VkUint32 read fMinImageCount write fMinImageCount; | |||
| property ImageFormat: TVkFormat read fImageFormat write fImageFormat; | |||
| property ImageColorSpace: TVkColorSpaceKHR read fImageColorSpace write fImageColorSpace; | |||
| property ImageExtent: TVkExtent2D read fImageExtent write fImageExtent; | |||
| property ImageArrayLayers: VkUint32 read fImageArrayLayers write fImageArrayLayers; | |||
| property ImageUsage: VkImageUsageFlags read fImageUsage write fImageUsage; | |||
| property ImageSharingMode: TVkSharingMode read fImageSharingMode write fImageSharingMode; | |||
| property PreTransform: TVkSurfaceTransformFlagBitsKHR read fPreTransform write fPreTransform; | |||
| property ComposideAlpha: TVkCompositeAlphaFlagBitsKHR read fComposideAlpha write fComposideAlpha; | |||
| property PresentMode: TVkPresentModeKHR read fPresentMode write fPresentMode; | |||
| property Clipped: Boolean read fClipped write fClipped; | |||
| property OldSwapChain: VkSwapchainKHR read fOldSwapChain write fOldSwapChain; | |||
| property QueueFamilyIndices: TvkuUint32Arr read fQueueFamilyIndices write fQueueFamilyIndices; | |||
| property QueueFamilyIndexCount: Integer read GetQueueFamilyIndexCount; | |||
| property QueueFamilyIndex[const aIndex: Integer]: VkUint32 read GetQueueFamilyIndex write SetQueueFamilyIndex; | |||
| function CreateSwapchain: TvkuSwapChain; | |||
| function CreateSwapchain( | |||
| const aAllocHandler: TvkuAllocationHandler; | |||
| const aOwnsHandler: Boolean): TvkuSwapChain; | |||
| constructor Create(const aDevice: TvkuDevice); | |||
| constructor Create(const aDevice: VkDevice; const aDeviceCommands: TVkDeviceCommands); | |||
| end; | |||
| implementation | |||
| uses | |||
| uvkuUtils; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| //TvkuSwapChainEx//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| destructor TvkuSwapChainEx.Destroy; | |||
| begin | |||
| inherited Destroy; | |||
| if fOwnsHandler then | |||
| FreeAndNil(fAllocHandler); | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| //TvkuSwapChainFactory/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuSwapChainFactory.GetQueueFamilyIndexCount: Integer; | |||
| begin | |||
| result := Length(fQueueFamilyIndices); | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuSwapChainFactory.GetQueueFamilyIndex(const aIndex: Integer): VkUint32; | |||
| begin | |||
| if (aIndex < low(fQueueFamilyIndices)) or (aIndex > high(fQueueFamilyIndices)) then | |||
| raise TvkuException.CreateFmt('index (%d) out of range (%d : %d)', [aIndex, Low(fQueueFamilyIndices), High(fQueueFamilyIndices)]); | |||
| result := fQueueFamilyIndices[aIndex]; | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| procedure TvkuSwapChainFactory.SetQueueFamilyIndex(const aIndex: Integer; aValue: VkUint32); | |||
| begin | |||
| if (aIndex < low(fQueueFamilyIndices)) or (aIndex > high(fQueueFamilyIndices)) then | |||
| raise TvkuException.CreateFmt('index (%d) out of range (%d : %d)', [aIndex, Low(fQueueFamilyIndices), High(fQueueFamilyIndices)]); | |||
| fQueueFamilyIndices[aIndex] := aValue; | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuSwapChainFactory.CreateSwapchain: TvkuSwapChain; | |||
| begin | |||
| result := CreateSwapchain(nil, false); | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| function TvkuSwapChainFactory.CreateSwapchain(const aAllocHandler: TvkuAllocationHandler; const aOwnsHandler: Boolean): TvkuSwapChain; | |||
| var | |||
| CreateInfo: TVkSwapchainCreateInfoKHR; | |||
| begin | |||
| FillByte(CreateInfo, SizeOf(CreateInfo), 0); | |||
| CreateInfo.sType := VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; | |||
| CreateInfo.pNext := nil; | |||
| CreateInfo.flags := fFlags; | |||
| CreateInfo.surface := fSurface; | |||
| CreateInfo.minImageCount := fMinImageCount; | |||
| CreateInfo.imageFormat := fImageFormat; | |||
| CreateInfo.imageColorSpace := fImageColorSpace; | |||
| CreateInfo.imageExtent := fImageExtent; | |||
| CreateInfo.imageArrayLayers := fImageArrayLayers; | |||
| CreateInfo.imageUsage := fImageUsage; | |||
| CreateInfo.imageSharingMode := fImageSharingMode; | |||
| CreateInfo.queueFamilyIndexCount := Length(fQueueFamilyIndices); | |||
| CreateInfo.pQueueFamilyIndices := @fQueueFamilyIndices[0]; | |||
| CreateInfo.preTransform := fPreTransform; | |||
| CreateInfo.compositeAlpha := fComposideAlpha; | |||
| CreateInfo.presentMode := fPresentMode; | |||
| CreateInfo.oldSwapchain := fOldSwapChain; | |||
| if fClipped | |||
| then CreateInfo.clipped := VK_TRUE | |||
| else CreateInfo.clipped := VK_FALSE; | |||
| if Assigned(aAllocHandler) | |||
| then result := TvkuSwapChainEx.Create(fDevice, CreateInfo, fDeviceCommands, aAllocHandler.GetAllocationCallbacks) | |||
| else result := TvkuSwapChainEx.Create(fDevice, CreateInfo, fDeviceCommands); | |||
| try | |||
| TvkuSwapChainEx(result).fAllocHandler := aAllocHandler; | |||
| TvkuSwapChainEx(result).fOwnsHandler := aOwnsHandler; | |||
| except | |||
| FreeAndNil(result); | |||
| end; | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| constructor TvkuSwapChainFactory.Create(const aDevice: TvkuDevice); | |||
| begin | |||
| Create(aDevice.Handle, aDevice.DeviceCommands); | |||
| end; | |||
| ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |||
| constructor TvkuSwapChainFactory.Create(const aDevice: VkDevice; const aDeviceCommands: TVkDeviceCommands); | |||
| begin | |||
| inherited Create; | |||
| fDevice := aDevice; | |||
| fDeviceCommands := aDeviceCommands; | |||
| fPresentMode := VK_PRESENT_MODE_FIFO_KHR; | |||
| end; | |||
| end. | |||
| @@ -380,16 +380,16 @@ begin | |||
| toString(aProperties.limits.maxFramebufferWidth), | |||
| toString(aProperties.limits.maxFramebufferHeight), | |||
| toString(aProperties.limits.maxFramebufferLayers), | |||
| toString(aProperties.limits.framebufferColorSampleCounts), | |||
| toString(aProperties.limits.framebufferDepthSampleCounts), | |||
| toString(aProperties.limits.framebufferStencilSampleCounts), | |||
| toString(aProperties.limits.framebufferNoAttachmentsSampleCounts), | |||
| toString(PVkUint32(@aProperties.limits.framebufferColorSampleCounts)^), | |||
| toString(PVkUint32(@aProperties.limits.framebufferDepthSampleCounts)^), | |||
| toString(PVkUint32(@aProperties.limits.framebufferStencilSampleCounts)^), | |||
| toString(PVkUint32(@aProperties.limits.framebufferNoAttachmentsSampleCounts)^), | |||
| toString(aProperties.limits.maxColorAttachments), | |||
| toString(aProperties.limits.sampledImageColorSampleCounts), | |||
| toString(aProperties.limits.sampledImageIntegerSampleCounts), | |||
| toString(aProperties.limits.sampledImageDepthSampleCounts), | |||
| toString(aProperties.limits.sampledImageStencilSampleCounts), | |||
| toString(aProperties.limits.storageImageSampleCounts), | |||
| toString(PVkUint32(@aProperties.limits.sampledImageColorSampleCounts)^), | |||
| toString(PVkUint32(@aProperties.limits.sampledImageIntegerSampleCounts)^), | |||
| toString(PVkUint32(@aProperties.limits.sampledImageDepthSampleCounts)^), | |||
| toString(PVkUint32(@aProperties.limits.sampledImageStencilSampleCounts)^), | |||
| toString(PVkUint32(@aProperties.limits.storageImageSampleCounts)^), | |||
| toString(aProperties.limits.maxSampleMaskWords), | |||
| toString(aProperties.limits.timestampComputeAndGraphics), | |||
| toString(aProperties.limits.timestampPeriod), | |||
| @@ -436,7 +436,7 @@ begin | |||
| ' Type %d:' + sLineBreak + | |||
| ' PropertyFlags: 0x%.16X' + sLineBreak + | |||
| ' HeapIndex: %d (0x%2:.16X)' + sLineBreak, | |||
| [i, aMemoryProperties.memoryTypes[i].propertyFlags, aMemoryProperties.memoryTypes[i].heapIndex]); | |||
| [i, PVkUint32(@aMemoryProperties.memoryTypes[i].propertyFlags)^, aMemoryProperties.memoryTypes[i].heapIndex]); | |||
| end; | |||
| result := result + 'Heaps:' + sLineBreak; | |||
| for i := 0 to aMemoryProperties.memoryHeapCount-1 do begin | |||
| @@ -444,7 +444,7 @@ begin | |||
| ' Heap %d:' + sLineBreak + | |||
| ' Size: %d (0x%1:.16X)' + sLineBreak + | |||
| ' Flags: 0x%.16X' + sLineBreak, | |||
| [i, aMemoryProperties.memoryHeaps[i].size, aMemoryProperties.memoryHeaps[i].flags]); | |||
| [i, aMemoryProperties.memoryHeaps[i].size, PVkUint32(@aMemoryProperties.memoryHeaps[i].flags)^]); | |||
| end; | |||
| end; | |||