VOP3a?299

This commit is contained in:
Pavel 2022-12-23 16:59:23 +03:00
parent dc5c0b9734
commit f117332e8b
3 changed files with 59 additions and 0 deletions

View File

@ -129,6 +129,7 @@ type
function OpFToF(src:PsrRegNode;rtype:TsrDataType;ppLine:PPspirvOp=nil):PsrRegNode;
//
function OpFloorTo(src:PsrRegNode;ppLine:PPspirvOp=nil):PsrRegNode;
function OpPowTo(src0,src1:PsrRegNode;ppLine:PPspirvOp=nil):PsrRegNode;
//
procedure OpNot(dst:PsrRegSlot;src:PsrRegNode);
procedure OpLogicalNot(dst:PsrRegSlot;src:PsrRegNode);
@ -1208,6 +1209,14 @@ begin
_OpGlsl1(_get_line(ppLine),GlslOp.Floor,Result,src)
end;
function TEmitOp.OpPowTo(src0,src1:PsrRegNode;ppLine:PPspirvOp=nil):PsrRegNode;
begin
if (src1=nil) then Exit(nil);
Result:=NewReg(src0^.dtype);
_set_line(ppLine,_OpGlsl2(_get_line(ppLine),GlslOp.Pow,Result,src0,src1));
end;
//
procedure TEmitOp.OpNot(dst:PsrRegSlot;src:PsrRegNode);

View File

@ -37,6 +37,7 @@ type
procedure emit_V_MADMK_F32;
procedure emit_V_BCNT_U32_B32;
procedure emit_V_MMX(OpId:DWORD;rtype:TsrDataType);
procedure emit_V_LDEXP_F32;
end;
implementation
@ -403,6 +404,25 @@ begin
OpGlsl2(OpId,rtype,dst,src[0],src[1]);
end;
procedure TEmit_VOP2.emit_V_LDEXP_F32; //vdst.f = vsrc0.f * pow(2.0, vsrc1.s)
Var
dst:PsrRegSlot;
src:array[0..2] of PsrRegNode;
two:PsrRegNode;
begin
dst:=get_vdst8(FSPI.VOP2.VDST);
src[0]:=fetch_ssrc9(FSPI.VOP2.SRC0 ,dtFloat32);
src[1]:=fetch_vsrc8(FSPI.VOP2.VSRC1,dtInt32);
two:=NewReg_s(dtFloat32,2);
src[1]:=OpSToF(src[1],dtFloat32);
src[1]:=OpPowTo(two,src[1]);
Op2(Op.OpFMul,dtFloat32,dst,src[0],src[1]);
end;
procedure TEmit_VOP2.emit_VOP2;
begin
@ -457,6 +477,8 @@ begin
V_MIN_U32: emit_V_MMX(GlslOp.UMin,dtUint32);
V_MAX_U32: emit_V_MMX(GlslOp.UMax,dtUint32);
V_LDEXP_F32: emit_V_LDEXP_F32;
else
Assert(false,'VOP2?'+IntToStr(FSPI.VOP2.OP));
end;

View File

@ -40,6 +40,7 @@ type
procedure emit_V_MUL_U32_U24;
procedure emit_V_MUL_HI(rtype:TsrDataType);
procedure emit_V_MAC_F32;
procedure emit_V_LDEXP_F32;
procedure emit_V_BFE_U32;
procedure emit_V_BFI_B32;
@ -430,6 +431,31 @@ begin
emit_dst_clamp_f(dst);
end;
procedure TEmit_VOP3.emit_V_LDEXP_F32; //vdst.f = vsrc0.f * pow(2.0, vsrc1.s)
Var
dst:PsrRegSlot;
src:array[0..2] of PsrRegNode;
two:PsrRegNode;
begin
dst:=get_vdst8(FSPI.VOP3a.VDST);
src[0]:=fetch_ssrc9(FSPI.VOP3a.SRC0,dtFloat32);
src[1]:=fetch_ssrc9(FSPI.VOP3a.SRC1,dtInt32);
emit_src_abs_bit(@src,1);
emit_src_neg_bit(@src,1);
two:=NewReg_s(dtFloat32,2);
src[1]:=OpSToF(src[1],dtFloat32);
src[1]:=OpPowTo(two,src[1]);
Op2(Op.OpFMul,dtFloat32,dst,src[0],src[1]);
emit_dst_omod_f(dst);
emit_dst_clamp_f(dst);
end;
procedure TEmit_VOP3.emit_V_BFE_U32;
Var
dst:PsrRegSlot;
@ -1034,6 +1060,8 @@ begin
256+V_MAC_F32: emit_V_MAC_F32;
256+V_LDEXP_F32: emit_V_LDEXP_F32;
//VOP3 only
V_MUL_LO_U32: emit_V_MUL_LO(dtUint32);