diff --git a/spirv/emit_mimg.pas b/spirv/emit_mimg.pas index 04f343b1..4447acfd 100644 --- a/spirv/emit_mimg.pas +++ b/spirv/emit_mimg.pas @@ -1251,9 +1251,13 @@ begin pLayout_Sgrp:=nil; pLayout_Tgrp:=nil; + Sgrp:=nil; + Tgrp:=nil; + Case FSPI.MIMG.OP of IMAGE_SAMPLE ..IMAGE_SAMPLE_C_LZ_O, //sampled - IMAGE_GATHER4..IMAGE_GATHER4_C_LZ_O: //sampled gather + IMAGE_GATHER4..IMAGE_GATHER4_C_LZ_O, //sampled gather + IMAGE_GET_LOD: begin if not get_srsrc(FSPI.MIMG.SSAMP,4,@src) then Assert(false); diff --git a/spirv/emit_post_op.pas b/spirv/emit_post_op.pas index 69883dc1..2f588bc1 100644 --- a/spirv/emit_post_op.pas +++ b/spirv/emit_post_op.pas @@ -6,6 +6,7 @@ interface uses sysutils, + math, bittype, Half16, spirv, @@ -1368,6 +1369,8 @@ var src:array[0..1] of TsrRegNode; pCon:array[0..1] of TsrConst; + s:Single; + procedure _SetConst_s(dtype:TsrDataType;value:Single); begin Assert(dtype=dtFloat32); @@ -1396,7 +1399,9 @@ begin Case src[0].dtype of dtFloat32: begin - _SetConst_s(dst.dtype,pCon[0].AsFloat32/pCon[1].AsFloat32); + s:=pCon[1].AsFloat32; + if IsZero(s) or IsNan(s) or IsInfinite(s) then Exit(0); + _SetConst_s(dst.dtype,pCon[0].AsFloat32/s); end; else; end; diff --git a/spirv/srBuffer.pas b/spirv/srBuffer.pas index c056513c..b25a4bee 100644 --- a/spirv/srBuffer.pas +++ b/spirv/srBuffer.pas @@ -169,6 +169,9 @@ type procedure AllocName; end; +Const + MAX_BUF_SIZE=QWORD(High(DWORD)+1); + operator := (i:TObject):TsrField; inline; implementation @@ -278,7 +281,7 @@ begin //update only struct if (node.Fdtype<>dtTypeStruct) then Exit; //dont clear max size - if (node.FFSize=High(PtrUint)) then Exit; + if (node.FFSize=MAX_BUF_SIZE) then Exit; // node.FFSize:=0; // @@ -519,13 +522,13 @@ begin end; //find intersec - node:=FindIntersect(_offset,High(PtrUint)-offset); + node:=FindIntersect(_offset,MAX_BUF_SIZE-offset); if (node=nil) then begin //new node:=Fetch(_offset); - node.FFSize:=High(PtrUint); //fixed size + node.FFSize:=MAX_BUF_SIZE; //fixed size node.stride:=_stride; node.count :=node.FFSize div _stride; node.Fdtype :=dtTypeRuntimeArray; @@ -617,7 +620,7 @@ begin if (Fdtype=dtTypeRuntimeArray) then begin //runtame array - FFSize:=High(Ptruint); + FFSize:=MAX_BUF_SIZE; end else begin //struct @@ -626,7 +629,7 @@ begin begin FFSize:=node.size; //check max - if (FFSize=High(PtrUint)) then Exit; + if (FFSize=MAX_BUF_SIZE) then Exit; FFSize:=node.offset+FFSize; end; end; @@ -1178,7 +1181,7 @@ begin Writer.Header(GetTypeStr); // Writer.IntOpt('BND',FBinding); - if (GetSize<>High(PtrUint)) then + if (GetSize<>MAX_BUF_SIZE) then begin Writer.HexOpt('LEN',GetSize); end; diff --git a/spirv/srTypes.pas b/spirv/srTypes.pas index 3d19f8e2..b3a484e9 100644 --- a/spirv/srTypes.pas +++ b/spirv/srTypes.pas @@ -81,8 +81,8 @@ type function FetchPointer(child:TsrType;storage_class:DWORD):TsrType; function FetchFunction(ret:TsrType):TsrType; function FetchFunction(copy:Boolean;count:Byte;pData:PPsrType):TsrType; - function FetchStruct (count:Word;pData:PPsrType;copy:Boolean;_size:DWORD):TsrType; - function InsertStruct(count:Word;pData:PPsrType;copy:Boolean;_size:DWORD):TsrType; + function FetchStruct (count:Word;pData:PPsrType;copy:Boolean;_size:QWORD):TsrType; + function InsertStruct(count:Word;pData:PPsrType;copy:Boolean;_size:QWORD):TsrType; function FetchArray(child:TsrType;array_count:DWORD):TsrType; function FetchRuntimeArray(child:TsrType):TsrType; function FetchImage(child:TsrType;image_info:TsrTypeImageInfo):TsrType; @@ -666,7 +666,7 @@ begin Result:=_Fetch(@key,copy); end; -function TsrTypeList.FetchStruct(count:Word;pData:PPsrType;copy:Boolean;_size:DWORD):TsrType; +function TsrTypeList.FetchStruct(count:Word;pData:PPsrType;copy:Boolean;_size:QWORD):TsrType; var key:TsrTypeKey; begin @@ -684,7 +684,7 @@ begin Result:=_Fetch(@key,copy); end; -function TsrTypeList.InsertStruct(count:Word;pData:PPsrType;copy:Boolean;_size:DWORD):TsrType; +function TsrTypeList.InsertStruct(count:Word;pData:PPsrType;copy:Boolean;_size:QWORD):TsrType; var key:TsrTypeKey; begin