From 9e3e826338997b38f7f54b7a100c4b314b4557bf Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 21 Jan 2025 13:26:15 +0900 Subject: [PATCH] [qfcc] "Implement" a pile more GLSL functions `not` isn't working for some reason. --- tools/qfcc/source/glsl-builtins.c | 130 ++++++++++++++++-------------- 1 file changed, 70 insertions(+), 60 deletions(-) diff --git a/tools/qfcc/source/glsl-builtins.c b/tools/qfcc/source/glsl-builtins.c index 1f1c02b6d..ec39c4381 100644 --- a/tools/qfcc/source/glsl-builtins.c +++ b/tools/qfcc/source/glsl-builtins.c @@ -550,25 +550,25 @@ SRC_LINE "genFType abs(genFType x) = " GLSL(FAbs) ";" "\n" "genIType abs(genIType x) = " GLSL(SAbs) ";" "\n" "genDType abs(genDType x) = " GLSL(FAbs) ";" "\n" -"genFType sign(genFType x);" "\n" -"genIType sign(genIType x);" "\n" -"genDType sign(genDType x);" "\n" -"genFType floor(genFType x);" "\n" -"genDType floor(genDType x);" "\n" -"genFType trunc(genFType x);" "\n" -"genDType trunc(genDType x);" "\n" -"genFType round(genFType x);" "\n" -"genDType round(genDType x);" "\n" -"genFType roundEven(genFType x);" "\n" -"genDType roundEven(genDType x);" "\n" -"genFType ceil(genFType x);" "\n" -"genDType ceil(genDType x);" "\n" -"genFType fract(genFType x);" "\n" -"genDType fract(genDType x);" "\n" -"genFType mod(genFType x, float y);" "\n" -"genFType mod(genFType x, genFType y);" "\n" -"genDType mod(genDType x, double y);" "\n" -"genDType mod(genDType x, genDType y);" "\n" +"genFType sign(genFType x) = " GLSL(FSign) ";" "\n" +"genIType sign(genIType x) = " GLSL(SSign) ";" "\n" +"genDType sign(genDType x) = " GLSL(FSign) ";" "\n" +"genFType floor(genFType x) = " GLSL(Floor) ";" "\n" +"genDType floor(genDType x) = " GLSL(Floor) ";" "\n" +"genFType trunc(genFType x) = " GLSL(Trunc) ";" "\n" +"genDType trunc(genDType x) = " GLSL(Trunc) ";" "\n" +"genFType round(genFType x) = " GLSL(Round) ";" "\n" +"genDType round(genDType x) = " GLSL(Round) ";" "\n" +"genFType roundEven(genFType x) = " GLSL(RoundEven) ";" "\n" +"genDType roundEven(genDType x) = " GLSL(RoundEven) ";" "\n" +"genFType ceil(genFType x) = " GLSL(Ceil) ";" "\n" +"genDType ceil(genDType x) = " GLSL(Ceil) ";" "\n" +"genFType fract(genFType x) = " GLSL(Fract) ";" "\n" +"genDType fract(genDType x) = " GLSL(Fract) ";" "\n" +"genFType mod(genFType x, float y) = " SPV(OpFMod) "[x, @construct (genFType, y)];" "\n" +"genFType mod(genFType x, genFType y) = " SPV(OpFMod) ";" "\n" +"genDType mod(genDType x, double y) = " SPV(OpFMod) "[x, @construct (genDType, y)];" "\n" +"genDType mod(genDType x, genDType y) = " SPV(OpFMod) ";" "\n" "genFType modf(genFType x, out genFType i);" "\n" "genDType modf(genDType x, out genDType i);" "\n" "genFType min(genFType x, genFType y) = " GLSL(FMin) ";" "\n" @@ -604,28 +604,38 @@ SRC_LINE "genIType mix(genIType x, genIType y, genBType a) = " SPV(OpSelect) ";" "\n" "genUType mix(genUType x, genUType y, genBType a) = " SPV(OpSelect) ";" "\n" "genBType mix(genBType x, genBType y, genBType a) = " SPV(OpSelect) ";" "\n" -"genFType step(genFType edge, genFType x);" "\n" -"genFType step(float edge, genFType x);" "\n" -"genDType step(genDType edge, genDType x);" "\n" -"genDType step(double edge, genDType x);" "\n" -"genFType smoothstep(genFType edge0, genFType edge1, genFType x);" "\n" -"genFType smoothstep(float edge0, float edge1, genFType x);" "\n" -"genDType smoothstep(genDType edge0, genDType edge1, genDType x);" "\n" -"genDType smoothstep(double edge0, double edge1, genDType x);" "\n" -"gbvec(genFType) isnan(genFType x);" "\n" -"gbvec(genDType) isnan(genDType x);" "\n" -"gbvec(genFType) isinf(genFType x);" "\n" -"gbvec(genDType) isinf(genDType x);" "\n" +"genFType step(genFType edge, genFType x)" "\n" + " = " GLSL(Step) ";" "\n" +"genFType step(float edge, genFType x)" "\n" + " = " GLSL(Step) "[@construct(genFType, edge), x];" "\n" +"genDType step(genDType edge, genDType x)" "\n" + " = " GLSL(Step) ";" "\n" +"genDType step(double edge, genDType x)" "\n" + " = " GLSL(Step) "[@construct(genDType, edge), x];" "\n" +"genFType smoothstep(genFType edge0, genFType edge1, genFType x)" "\n" + " = " GLSL(SmoothStep) ";" "\n" +"genFType smoothstep(float edge0, float edge1, genFType x)" "\n" + " = " GLSL(SmoothStep) "[@construct(genFType, edge0)," "\n" + "@construct(genFType, edge1), x];" "\n" +"genDType smoothstep(genDType edge0, genDType edge1, genDType x)" "\n" + " = " GLSL(SmoothStep) ";" "\n" +"genDType smoothstep(double edge0, double edge1, genDType x)" "\n" + " = " GLSL(SmoothStep) "[@construct(genDType, edge0)," "\n" + "@construct(genDType, edge1), x];" "\n" +"gbvec(genFType) isnan(genFType x) = " SPV(OpIsNan) ";" "\n" +"gbvec(genDType) isnan(genDType x) = " SPV(OpIsNan) ";" "\n" +"gbvec(genFType) isinf(genFType x) = " SPV(OpIsInf) ";" "\n" +"gbvec(genDType) isinf(genDType x) = " SPV(OpIsInf) ";" "\n" "givec(genFType) floatBitsToInt(highp genFType value) = " SPV(OpBitcast) ";" "\n" "guvec(genFType) floatBitsToUint(highp genFType value) = " SPV(OpBitcast) ";" "\n" "gvec(genIType) intBitsToFloat(highp genIType value) = " SPV(OpBitcast) ";" "\n" "gvec(genUType) uintBitsToFloat(highp genUType value) = " SPV(OpBitcast) ";" "\n" -"genFType fma(genFType a, genFType b, genFType c);" "\n" -"genDType fma(genDType a, genDType b, genDType c);" "\n" -"genFType frexp(highp genFType x, out highp genIType exp);" "\n" -"genDType frexp(genDType x, out genIType exp);" "\n" -"genFType ldexp(highp genFType x, highp genIType exp);" "\n" -"genDType ldexp(genDType x, genIType exp);" "\n" +"genFType fma(genFType a, genFType b, genFType c) = " GLSL(Fma) ";" "\n" +"genDType fma(genDType a, genDType b, genDType c) = " GLSL(Fma) ";" "\n" +"genFType frexp(highp genFType x, out highp genIType exp) = " GLSL(Frexp) ";" "\n" +"genDType frexp(genDType x, out genIType exp) = " GLSL(Frexp) ";" "\n" +"genFType ldexp(highp genFType x, highp genIType exp) = " GLSL(Ldexp) ";" "\n" +"genDType ldexp(genDType x, genIType exp) = " GLSL(Ldexp) ";" "\n" //floating-point pack and unpack functions SRC_LINE @@ -691,29 +701,29 @@ SRC_LINE //vector relational functions SRC_LINE -"gbvec(vec) lessThan(vec x, vec y);" "\n" -"gbvec(ivec) lessThan(ivec x, ivec y);" "\n" -"gbvec(uvec) lessThan(uvec x, uvec y);" "\n" -"gbvec(vec) lessThanEqual(vec x, vec y);" "\n" -"gbvec(ivec) lessThanEqual(ivec x, ivec y);" "\n" -"gbvec(uvec) lessThanEqual(uvec x, uvec y);" "\n" -"gbvec(vec) greaterThan(vec x, vec y);" "\n" -"gbvec(ivec) greaterThan(ivec x, ivec y);" "\n" -"gbvec(uvec) greaterThan(uvec x, uvec y);" "\n" -"gbvec(vec) greaterThanEqual(vec x, vec y);" "\n" -"gbvec(ivec) greaterThanEqual(ivec x, ivec y);" "\n" -"gbvec(uvec) greaterThanEqual(uvec x, uvec y);" "\n" -"gbvec(vec) equal(vec x, vec y);" "\n" -"gbvec(ivec) equal(ivec x, ivec y);" "\n" -"gbvec(uvec) equal(uvec x, uvec y);" "\n" -"gbvec(bvec) equal(bvec x, bvec y);" "\n" -"gbvec(vec) notEqual(vec x, vec y);" "\n" -"gbvec(ivec) notEqual(ivec x, ivec y);" "\n" -"gbvec(uvec) notEqual(uvec x, uvec y);" "\n" -"gbvec(bvec) notEqual(bvec x, bvec y);" "\n" -"bool any(bvec x);" "\n" -"bool all(bvec x);" "\n" -"bvec not(bvec x);" "\n" +"gbvec(vec) lessThan(vec x, vec y) = " SPV(OpFOrdLessThan) ";" "\n" +"gbvec(ivec) lessThan(ivec x, ivec y) = " SPV(OpSLessThan) ";" "\n" +"gbvec(uvec) lessThan(uvec x, uvec y) = " SPV(OpULessThan) ";" "\n" +"gbvec(vec) lessThanEqual(vec x, vec y) = " SPV(OpFOrdLessThanEqual) ";" "\n" +"gbvec(ivec) lessThanEqual(ivec x, ivec y) = " SPV(OpSLessThanEqual) ";" "\n" +"gbvec(uvec) lessThanEqual(uvec x, uvec y) = " SPV(OpULessThanEqual) ";" "\n" +"gbvec(vec) greaterThan(vec x, vec y) = " SPV(OpFOrdGreaterThan) ";" "\n" +"gbvec(ivec) greaterThan(ivec x, ivec y) = " SPV(OpSGreaterThan) ";" "\n" +"gbvec(uvec) greaterThan(uvec x, uvec y) = " SPV(OpUGreaterThan) ";" "\n" +"gbvec(vec) greaterThanEqual(vec x, vec y) = "SPV(OpFOrdGreaterThanEqual)";""\n" +"gbvec(ivec) greaterThanEqual(ivec x, ivec y) = "SPV(OpUGreaterThanEqual)";""\n" +"gbvec(uvec) greaterThanEqual(uvec x, uvec y) = "SPV(OpSGreaterThanEqual)";""\n" +"gbvec(vec) equal(vec x, vec y) = " SPV(OpFOrdEqual) ";" "\n" +"gbvec(ivec) equal(ivec x, ivec y) = " SPV(OpIEqual) ";" "\n" +"gbvec(uvec) equal(uvec x, uvec y) = " SPV(OpIEqual) ";" "\n" +"gbvec(bvec) equal(bvec x, bvec y) = " SPV(OpLogicalEqual) ";" "\n" +"gbvec(vec) notEqual(vec x, vec y) = " SPV(OpFOrdNotEqual) ";" "\n" +"gbvec(ivec) notEqual(ivec x, ivec y) = " SPV(OpINotEqual) ";" "\n" +"gbvec(uvec) notEqual(uvec x, uvec y) = " SPV(OpINotEqual) ";" "\n" +"gbvec(bvec) notEqual(bvec x, bvec y) = " SPV(OpLogicalNotEqual) ";" "\n" +"bool any(bvec x) = " SPV(OpAny) ";" "\n" +"bool all(bvec x) = " SPV(OpAll) ";" "\n" +"bvec not(bvec x) = " SPV(OpLogicalNot) ";" "\n" //integer functions SRC_LINE