mirror of
https://github.com/libretro/glslang.git
synced 2024-11-27 01:40:44 +00:00
Add lerp, fix sincos return type, ret type tests, non-square mats, HLSL->AST tx semantics
This commit is contained in:
parent
a4a4d5e22c
commit
4624a02e21
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -17,69 +17,70 @@ float PixelShaderFunction(float inF0, float inF1, float inF2, uint inU0, uint in
|
||||
{
|
||||
uint out_u1;
|
||||
|
||||
all(inF0);
|
||||
abs(inF0);
|
||||
acos(inF0);
|
||||
any(inF0);
|
||||
asin(inF0);
|
||||
asint(inF0);
|
||||
asuint(inF0);
|
||||
asfloat(inU0);
|
||||
bool r000 = all(inF0);
|
||||
float r001 = abs(inF0);
|
||||
float r002 = acos(inF0);
|
||||
bool r003 = any(inF0);
|
||||
float r004 = asin(inF0);
|
||||
int r005 = asint(inF0);
|
||||
uint r006 = asuint(inF0);
|
||||
float r007 = asfloat(inU0);
|
||||
// asdouble(inU0, inU1); // TODO: enable when HLSL parser used for intrinsics
|
||||
atan(inF0);
|
||||
atan2(inF0, inF1);
|
||||
ceil(inF0);
|
||||
clamp(inF0, inF1, inF2);
|
||||
float r009 = atan(inF0);
|
||||
float r010 = atan2(inF0, inF1);
|
||||
float r011 = ceil(inF0);
|
||||
float r012 = clamp(inF0, inF1, inF2);
|
||||
clip(inF0);
|
||||
cos(inF0);
|
||||
cosh(inF0);
|
||||
countbits(7);
|
||||
ddx(inF0);
|
||||
ddx_coarse(inF0);
|
||||
ddx_fine(inF0);
|
||||
ddy(inF0);
|
||||
ddy_coarse(inF0);
|
||||
ddy_fine(inF0);
|
||||
degrees(inF0);
|
||||
float r014 = cos(inF0);
|
||||
float r015 = cosh(inF0);
|
||||
uint r016 = countbits(7);
|
||||
float r017 = ddx(inF0);
|
||||
float r018 = ddx_coarse(inF0);
|
||||
float r019 = ddx_fine(inF0);
|
||||
float r020 = ddy(inF0);
|
||||
float r021 = ddy_coarse(inF0);
|
||||
float r022 = ddy_fine(inF0);
|
||||
float r023 = degrees(inF0);
|
||||
// EvaluateAttributeAtCentroid(inF0);
|
||||
// EvaluateAttributeAtSample(inF0, 0);
|
||||
// TODO: EvaluateAttributeSnapped(inF0, int2(1,2));
|
||||
exp(inF0);
|
||||
exp2(inF0);
|
||||
firstbithigh(7);
|
||||
firstbitlow(7);
|
||||
floor(inF0);
|
||||
float r027 = exp(inF0);
|
||||
float r028 = exp2(inF0);
|
||||
uint r029 = firstbithigh(7);
|
||||
uint r030 = firstbitlow(7);
|
||||
float r031 = floor(inF0);
|
||||
// TODO: fma(inD0, inD1, inD2);
|
||||
fmod(inF0, inF1);
|
||||
frac(inF0);
|
||||
frexp(inF0, inF1);
|
||||
fwidth(inF0);
|
||||
isinf(inF0);
|
||||
isnan(inF0);
|
||||
ldexp(inF0, inF1);
|
||||
log(inF0);
|
||||
log10(inF0);
|
||||
log2(inF0);
|
||||
max(inF0, inF1);
|
||||
min(inF0, inF1);
|
||||
pow(inF0, inF1);
|
||||
radians(inF0);
|
||||
rcp(inF0);
|
||||
reversebits(2);
|
||||
round(inF0);
|
||||
rsqrt(inF0);
|
||||
saturate(inF0);
|
||||
sign(inF0);
|
||||
sin(inF0);
|
||||
float r033 = fmod(inF0, inF1);
|
||||
float r034 = frac(inF0);
|
||||
float r035 = frexp(inF0, inF1);
|
||||
float r036 = fwidth(inF0);
|
||||
bool r037 = isinf(inF0);
|
||||
bool r038 = isnan(inF0);
|
||||
float r039 = ldexp(inF0, inF1);
|
||||
float r039a = lerp(inF0, inF1, inF2);
|
||||
float r040 = log(inF0);
|
||||
float r041 = log10(inF0);
|
||||
float r042 = log2(inF0);
|
||||
float r043 = max(inF0, inF1);
|
||||
float r044 = min(inF0, inF1);
|
||||
float r045 = pow(inF0, inF1);
|
||||
float r046 = radians(inF0);
|
||||
float r047 = rcp(inF0);
|
||||
uint r048 = reversebits(2);
|
||||
float r049 = round(inF0);
|
||||
float r050 = rsqrt(inF0);
|
||||
float r051 = saturate(inF0);
|
||||
float r052 = sign(inF0);
|
||||
float r053 = sin(inF0);
|
||||
sincos(inF0, inF1, inF2);
|
||||
sinh(inF0);
|
||||
smoothstep(inF0, inF1, inF2);
|
||||
sqrt(inF0);
|
||||
step(inF0, inF1);
|
||||
tan(inF0);
|
||||
tanh(inF0);
|
||||
float r055 = sinh(inF0);
|
||||
float r056 = smoothstep(inF0, inF1, inF2);
|
||||
float r057 = sqrt(inF0);
|
||||
float r058 = step(inF0, inF1);
|
||||
float r059 = tan(inF0);
|
||||
float r060 = tanh(inF0);
|
||||
// TODO: sampler intrinsics, when we can declare the types.
|
||||
trunc(inF0);
|
||||
float r061 = trunc(inF0);
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
@ -94,76 +95,80 @@ float2 PixelShaderFunction(float2 inF0, float2 inF1, float2 inF2, uint2 inU0, ui
|
||||
{
|
||||
uint2 out_u2;
|
||||
|
||||
all(inF0);
|
||||
abs(inF0);
|
||||
acos(inF0);
|
||||
any(inF0);
|
||||
asin(inF0);
|
||||
asint(inF0);
|
||||
asuint(inF0);
|
||||
asfloat(inU0);
|
||||
bool r000 = all(inF0);
|
||||
float2 r001 = abs(inF0);
|
||||
float2 r002 = acos(inF0);
|
||||
bool r003 = any(inF0);
|
||||
float2 r004 = asin(inF0);
|
||||
int2 r005 = asint(inF0);
|
||||
uint2 r006 = asuint(inF0);
|
||||
float2 r007 = asfloat(inU0);
|
||||
// asdouble(inU0, inU1); // TODO: enable when HLSL parser used for intrinsics
|
||||
atan(inF0);
|
||||
atan2(inF0, inF1);
|
||||
ceil(inF0);
|
||||
clamp(inF0, inF1, inF2);
|
||||
float2 r009 = atan(inF0);
|
||||
float2 r010 = atan2(inF0, inF1);
|
||||
float2 r011 = ceil(inF0);
|
||||
float2 r012 = clamp(inF0, inF1, inF2);
|
||||
clip(inF0);
|
||||
cos(inF0);
|
||||
cosh(inF0);
|
||||
countbits(int2(7,3));
|
||||
ddx(inF0);
|
||||
ddx_coarse(inF0);
|
||||
ddx_fine(inF0);
|
||||
ddy(inF0);
|
||||
ddy_coarse(inF0);
|
||||
ddy_fine(inF0);
|
||||
degrees(inF0);
|
||||
distance(inF0, inF1);
|
||||
dot(inF0, inF1);
|
||||
float2 r013 = cos(inF0);
|
||||
float2 r015 = cosh(inF0);
|
||||
uint2 r016 = countbits(int2(7,3));
|
||||
float2 r017 = ddx(inF0);
|
||||
float2 r018 = ddx_coarse(inF0);
|
||||
float2 r019 = ddx_fine(inF0);
|
||||
float2 r020 = ddy(inF0);
|
||||
float2 r021 = ddy_coarse(inF0);
|
||||
float2 r022 = ddy_fine(inF0);
|
||||
float2 r023 = degrees(inF0);
|
||||
// EvaluateAttributeAtCentroid(inF0);
|
||||
// EvaluateAttributeAtSample(inF0, 0);
|
||||
// TODO: EvaluateAttributeSnapped(inF0, int2(1,2));
|
||||
exp(inF0);
|
||||
exp2(inF0);
|
||||
faceforward(inF0, inF1, inF2);
|
||||
firstbithigh(7);
|
||||
firstbitlow(7);
|
||||
floor(inF0);
|
||||
float r026 = distance(inF0, inF1);
|
||||
float r027 = dot(inF0, inF1);
|
||||
// EvaluateAttributeAtCentroid(inF0);
|
||||
// EvaluateAttributeAtSample(inF0, 0);
|
||||
// TODO: EvaluateAttributeSnapped(inF0, int2(1,2));
|
||||
float2 r028 = exp(inF0);
|
||||
float2 r029 = exp2(inF0);
|
||||
float2 r030 = faceforward(inF0, inF1, inF2);
|
||||
uint2 r031 = firstbithigh(uint2(7,8));
|
||||
uint2 r032 = firstbitlow(uint2(7,8));
|
||||
float2 r033 = floor(inF0);
|
||||
// TODO: fma(inD0, inD1, inD2);
|
||||
fmod(inF0, inF1);
|
||||
frac(inF0);
|
||||
frexp(inF0, inF1);
|
||||
fwidth(inF0);
|
||||
isinf(inF0);
|
||||
isnan(inF0);
|
||||
ldexp(inF0, inF1);
|
||||
length(inF0);
|
||||
log(inF0);
|
||||
log10(inF0);
|
||||
log2(inF0);
|
||||
max(inF0, inF1);
|
||||
min(inF0, inF1);
|
||||
normalize(inF0);
|
||||
pow(inF0, inF1);
|
||||
radians(inF0);
|
||||
rcp(inF0);
|
||||
reflect(inF0, inF1);
|
||||
refract(inF0, inF1, 2.0);
|
||||
reversebits(int2(1,2));
|
||||
round(inF0);
|
||||
rsqrt(inF0);
|
||||
saturate(inF0);
|
||||
sign(inF0);
|
||||
sin(inF0);
|
||||
float2 r035 = fmod(inF0, inF1);
|
||||
float2 r036 = frac(inF0);
|
||||
float2 r037 = frexp(inF0, inF1);
|
||||
float2 r038 = fwidth(inF0);
|
||||
bool2 r039 = isinf(inF0);
|
||||
bool2 r040 = isnan(inF0);
|
||||
float2 r041 = ldexp(inF0, inF1);
|
||||
float2 r039a = lerp(inF0, inF1, inF2);
|
||||
float r042 = length(inF0);
|
||||
float2 r043 = log(inF0);
|
||||
float2 r044 = log10(inF0);
|
||||
float2 r045 = log2(inF0);
|
||||
float2 r046 = max(inF0, inF1);
|
||||
float2 r047 = min(inF0, inF1);
|
||||
float2 r048 = normalize(inF0);
|
||||
float2 r049 = pow(inF0, inF1);
|
||||
float2 r050 = radians(inF0);
|
||||
float2 r051 = rcp(inF0);
|
||||
float2 r052 = reflect(inF0, inF1);
|
||||
float2 r053 = refract(inF0, inF1, 2.0);
|
||||
uint2 r054 = reversebits(uint2(1,2));
|
||||
float2 r055 = round(inF0);
|
||||
float2 r056 = rsqrt(inF0);
|
||||
float2 r057 = saturate(inF0);
|
||||
float2 r058 = sign(inF0);
|
||||
float2 r059 = sin(inF0);
|
||||
sincos(inF0, inF1, inF2);
|
||||
sinh(inF0);
|
||||
smoothstep(inF0, inF1, inF2);
|
||||
sqrt(inF0);
|
||||
step(inF0, inF1);
|
||||
tan(inF0);
|
||||
tanh(inF0);
|
||||
float2 r060 = sinh(inF0);
|
||||
float2 r061 = smoothstep(inF0, inF1, inF2);
|
||||
float2 r062 = sqrt(inF0);
|
||||
float2 r063 = step(inF0, inF1);
|
||||
float2 r064 = tan(inF0);
|
||||
float2 r065 = tanh(inF0);
|
||||
// TODO: sampler intrinsics, when we can declare the types.
|
||||
trunc(inF0);
|
||||
float2 r066 = trunc(inF0);
|
||||
|
||||
// TODO: ... add when float1 prototypes are generated
|
||||
return float2(1,2);
|
||||
@ -173,77 +178,78 @@ float3 PixelShaderFunction(float3 inF0, float3 inF1, float3 inF2, uint3 inU0, ui
|
||||
{
|
||||
uint3 out_u3;
|
||||
|
||||
all(inF0);
|
||||
abs(inF0);
|
||||
acos(inF0);
|
||||
any(inF0);
|
||||
asin(inF0);
|
||||
asint(inF0);
|
||||
asuint(inF0);
|
||||
asfloat(inU0);
|
||||
bool r000 = all(inF0);
|
||||
float3 r001 = abs(inF0);
|
||||
float3 r002 = acos(inF0);
|
||||
bool r003 = any(inF0);
|
||||
float3 r004 = asin(inF0);
|
||||
int3 r005 = asint(inF0);
|
||||
uint3 r006 = asuint(inF0);
|
||||
float3 r007 = asfloat(inU0);
|
||||
// asdouble(inU0, inU1); // TODO: enable when HLSL parser used for intrinsics
|
||||
atan(inF0);
|
||||
atan2(inF0, inF1);
|
||||
ceil(inF0);
|
||||
clamp(inF0, inF1, inF2);
|
||||
float3 r009 = atan(inF0);
|
||||
float3 r010 = atan2(inF0, inF1);
|
||||
float3 r011 = ceil(inF0);
|
||||
float3 r012 = clamp(inF0, inF1, inF2);
|
||||
clip(inF0);
|
||||
cos(inF0);
|
||||
cosh(inF0);
|
||||
countbits(int3(7,3,5));
|
||||
cross(inF0, inF1);
|
||||
ddx(inF0);
|
||||
ddx_coarse(inF0);
|
||||
ddx_fine(inF0);
|
||||
ddy(inF0);
|
||||
ddy_coarse(inF0);
|
||||
ddy_fine(inF0);
|
||||
degrees(inF0);
|
||||
distance(inF0, inF1);
|
||||
dot(inF0, inF1);
|
||||
float3 r013 = cos(inF0);
|
||||
float3 r014 = cosh(inF0);
|
||||
uint3 r015 = countbits(uint3(7,3,5));
|
||||
float3 r016 = cross(inF0, inF1);
|
||||
float3 r017 = ddx(inF0);
|
||||
float3 r018 = ddx_coarse(inF0);
|
||||
float3 r019 = ddx_fine(inF0);
|
||||
float3 r020 = ddy(inF0);
|
||||
float3 r021 = ddy_coarse(inF0);
|
||||
float3 r022 = ddy_fine(inF0);
|
||||
float3 r023 = degrees(inF0);
|
||||
float r024 = distance(inF0, inF1);
|
||||
float r025 = dot(inF0, inF1);
|
||||
// EvaluateAttributeAtCentroid(inF0);
|
||||
// EvaluateAttributeAtSample(inF0, 0);
|
||||
// TODO: EvaluateAttributeSnapped(inF0, int2(1,2));
|
||||
exp(inF0);
|
||||
exp2(inF0);
|
||||
faceforward(inF0, inF1, inF2);
|
||||
firstbithigh(7);
|
||||
firstbitlow(7);
|
||||
floor(inF0);
|
||||
float3 r029 = exp(inF0);
|
||||
float3 r030 = exp2(inF0);
|
||||
float3 r031 = faceforward(inF0, inF1, inF2);
|
||||
uint3 r032 = firstbithigh(uint3(2,3,4));
|
||||
uint3 r033 = firstbitlow(uint3(2,3,4));
|
||||
float3 r034 = floor(inF0);
|
||||
// TODO: fma(inD0, inD1, inD2);
|
||||
fmod(inF0, inF1);
|
||||
frac(inF0);
|
||||
frexp(inF0, inF1);
|
||||
fwidth(inF0);
|
||||
isinf(inF0);
|
||||
isnan(inF0);
|
||||
ldexp(inF0, inF1);
|
||||
length(inF0);
|
||||
log(inF0);
|
||||
log10(inF0);
|
||||
log2(inF0);
|
||||
max(inF0, inF1);
|
||||
min(inF0, inF1);
|
||||
normalize(inF0);
|
||||
pow(inF0, inF1);
|
||||
radians(inF0);
|
||||
rcp(inF0);
|
||||
reflect(inF0, inF1);
|
||||
refract(inF0, inF1, 2.0);
|
||||
reversebits(int3(1,2,3));
|
||||
round(inF0);
|
||||
rsqrt(inF0);
|
||||
saturate(inF0);
|
||||
sign(inF0);
|
||||
sin(inF0);
|
||||
float3 r036 = fmod(inF0, inF1);
|
||||
float3 r037 = frac(inF0);
|
||||
float3 r038 = frexp(inF0, inF1);
|
||||
float3 r039 = fwidth(inF0);
|
||||
bool3 r040 = isinf(inF0);
|
||||
bool3 r041 = isnan(inF0);
|
||||
float3 r042 = ldexp(inF0, inF1);
|
||||
float3 r039a = lerp(inF0, inF1, inF2);
|
||||
float r043 = length(inF0);
|
||||
float3 r044 = log(inF0);
|
||||
float3 r045 = log10(inF0);
|
||||
float3 r046 = log2(inF0);
|
||||
float3 r047 = max(inF0, inF1);
|
||||
float3 r048 = min(inF0, inF1);
|
||||
float3 r049 = normalize(inF0);
|
||||
float3 r050 = pow(inF0, inF1);
|
||||
float3 r051 = radians(inF0);
|
||||
float3 r052 = rcp(inF0);
|
||||
float3 r053 = reflect(inF0, inF1);
|
||||
float3 r054 = refract(inF0, inF1, 2.0);
|
||||
uint3 r055 = reversebits(uint3(1,2,3));
|
||||
float3 r056 = round(inF0);
|
||||
float3 r057 = rsqrt(inF0);
|
||||
float3 r058 = saturate(inF0);
|
||||
float3 r059 = sign(inF0);
|
||||
float3 r060 = sin(inF0);
|
||||
sincos(inF0, inF1, inF2);
|
||||
sinh(inF0);
|
||||
smoothstep(inF0, inF1, inF2);
|
||||
sqrt(inF0);
|
||||
step(inF0, inF1);
|
||||
tan(inF0);
|
||||
tanh(inF0);
|
||||
float3 r061 = sinh(inF0);
|
||||
float3 r062 = smoothstep(inF0, inF1, inF2);
|
||||
float3 r063 = sqrt(inF0);
|
||||
float3 r064 = step(inF0, inF1);
|
||||
float3 r065 = tan(inF0);
|
||||
float3 r066 = tanh(inF0);
|
||||
// TODO: sampler intrinsics, when we can declare the types.
|
||||
trunc(inF0);
|
||||
float3 r067 = trunc(inF0);
|
||||
|
||||
// TODO: ... add when float1 prototypes are generated
|
||||
return float3(1,2,3);
|
||||
@ -253,77 +259,78 @@ float4 PixelShaderFunction(float4 inF0, float4 inF1, float4 inF2, uint4 inU0, ui
|
||||
{
|
||||
uint4 out_u4;
|
||||
|
||||
all(inF0);
|
||||
abs(inF0);
|
||||
acos(inF0);
|
||||
any(inF0);
|
||||
asin(inF0);
|
||||
asint(inF0);
|
||||
asuint(inF0);
|
||||
asfloat(inU0);
|
||||
bool r000 = all(inF0);
|
||||
float4 r001 = abs(inF0);
|
||||
float4 r002 = acos(inF0);
|
||||
bool r003 = any(inF0);
|
||||
float4 r004 = asin(inF0);
|
||||
int4 r005 = asint(inF0);
|
||||
uint4 r006 = asuint(inF0);
|
||||
float4 r007 = asfloat(inU0);
|
||||
// asdouble(inU0, inU1); // TODO: enable when HLSL parser used for intrinsics
|
||||
atan(inF0);
|
||||
atan2(inF0, inF1);
|
||||
ceil(inF0);
|
||||
clamp(inF0, inF1, inF2);
|
||||
float4 r009 = atan(inF0);
|
||||
float4 r010 = atan2(inF0, inF1);
|
||||
float4 r011 = ceil(inF0);
|
||||
float4 r012 = clamp(inF0, inF1, inF2);
|
||||
clip(inF0);
|
||||
cos(inF0);
|
||||
cosh(inF0);
|
||||
countbits(int4(7,3,5,2));
|
||||
ddx(inF0);
|
||||
ddx_coarse(inF0);
|
||||
ddx_fine(inF0);
|
||||
ddy(inF0);
|
||||
ddy_coarse(inF0);
|
||||
ddy_fine(inF0);
|
||||
degrees(inF0);
|
||||
distance(inF0, inF1);
|
||||
dot(inF0, inF1);
|
||||
dst(inF0, inF1);
|
||||
float4 r013 = cos(inF0);
|
||||
float4 r014 = cosh(inF0);
|
||||
uint4 r015 = countbits(uint4(7,3,5,2));
|
||||
float4 r016 = ddx(inF0);
|
||||
float4 r017 = ddx_coarse(inF0);
|
||||
float4 r018 = ddx_fine(inF0);
|
||||
float4 r019 = ddy(inF0);
|
||||
float4 r020 = ddy_coarse(inF0);
|
||||
float4 r021 = ddy_fine(inF0);
|
||||
float4 r022 = degrees(inF0);
|
||||
float r023 = distance(inF0, inF1);
|
||||
float r024 = dot(inF0, inF1);
|
||||
float4 r025 = dst(inF0, inF1);
|
||||
// EvaluateAttributeAtCentroid(inF0);
|
||||
// EvaluateAttributeAtSample(inF0, 0);
|
||||
// TODO: EvaluateAttributeSnapped(inF0, int2(1,2));
|
||||
exp(inF0);
|
||||
exp2(inF0);
|
||||
faceforward(inF0, inF1, inF2);
|
||||
firstbithigh(7);
|
||||
firstbitlow(7);
|
||||
floor(inF0);
|
||||
float4 r029 = exp(inF0);
|
||||
float4 r030 = exp2(inF0);
|
||||
float4 r031 = faceforward(inF0, inF1, inF2);
|
||||
uint4 r032 = firstbithigh(uint4(7,8,9,10));
|
||||
uint4 r033 = firstbitlow(uint4(7,8,9,10));
|
||||
float4 r034 = floor(inF0);
|
||||
// TODO: fma(inD0, inD1, inD2);
|
||||
fmod(inF0, inF1);
|
||||
frac(inF0);
|
||||
frexp(inF0, inF1);
|
||||
fwidth(inF0);
|
||||
isinf(inF0);
|
||||
isnan(inF0);
|
||||
ldexp(inF0, inF1);
|
||||
length(inF0);
|
||||
log(inF0);
|
||||
log10(inF0);
|
||||
log2(inF0);
|
||||
max(inF0, inF1);
|
||||
min(inF0, inF1);
|
||||
normalize(inF0);
|
||||
pow(inF0, inF1);
|
||||
radians(inF0);
|
||||
rcp(inF0);
|
||||
reflect(inF0, inF1);
|
||||
refract(inF0, inF1, 2.0);
|
||||
reversebits(int4(1,2,3,4));
|
||||
round(inF0);
|
||||
rsqrt(inF0);
|
||||
saturate(inF0);
|
||||
sign(inF0);
|
||||
sin(inF0);
|
||||
float4 r036 = fmod(inF0, inF1);
|
||||
float4 r037 = frac(inF0);
|
||||
float4 r038 = frexp(inF0, inF1);
|
||||
float4 r039 = fwidth(inF0);
|
||||
bool4 r040 = isinf(inF0);
|
||||
bool4 r041 = isnan(inF0);
|
||||
float4 r042 = ldexp(inF0, inF1);
|
||||
float4 r039a = lerp(inF0, inF1, inF2);
|
||||
float r043 = length(inF0);
|
||||
float4 r044 = log(inF0);
|
||||
float4 r045 = log10(inF0);
|
||||
float4 r046 = log2(inF0);
|
||||
float4 r047 = max(inF0, inF1);
|
||||
float4 r048 = min(inF0, inF1);
|
||||
float4 r049 = normalize(inF0);
|
||||
float4 r050 = pow(inF0, inF1);
|
||||
float4 r051 = radians(inF0);
|
||||
float4 r052 = rcp(inF0);
|
||||
float4 r053 = reflect(inF0, inF1);
|
||||
float4 r054 = refract(inF0, inF1, 2.0);
|
||||
uint4 r055 = reversebits(uint4(1,2,3,4));
|
||||
float4 r056 = round(inF0);
|
||||
float4 r057 = rsqrt(inF0);
|
||||
float4 r058 = saturate(inF0);
|
||||
float4 r059 = sign(inF0);
|
||||
float4 r060 = sin(inF0);
|
||||
sincos(inF0, inF1, inF2);
|
||||
sinh(inF0);
|
||||
smoothstep(inF0, inF1, inF2);
|
||||
sqrt(inF0);
|
||||
step(inF0, inF1);
|
||||
tan(inF0);
|
||||
tanh(inF0);
|
||||
float4 r061 = sinh(inF0);
|
||||
float4 r062 = smoothstep(inF0, inF1, inF2);
|
||||
float4 r063 = sqrt(inF0);
|
||||
float4 r064 = step(inF0, inF1);
|
||||
float4 r065 = tan(inF0);
|
||||
float4 r066 = tanh(inF0);
|
||||
// TODO: sampler intrinsics, when we can declare the types.
|
||||
trunc(inF0);
|
||||
float4 r067 = trunc(inF0);
|
||||
|
||||
// TODO: ... add when float1 prototypes are generated
|
||||
return float4(1,2,3,4);
|
||||
@ -335,65 +342,64 @@ float4 PixelShaderFunction(float4 inF0, float4 inF1, float4 inF2, uint4 inU0, ui
|
||||
// asuint(inF0); \
|
||||
|
||||
// TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
|
||||
#define MATFNS() \
|
||||
all(inF0); \
|
||||
abs(inF0); \
|
||||
acos(inF0); \
|
||||
any(inF0); \
|
||||
asin(inF0); \
|
||||
atan(inF0); \
|
||||
atan2(inF0, inF1); \
|
||||
ceil(inF0); \
|
||||
clip(inF0); \
|
||||
clamp(inF0, inF1, inF2); \
|
||||
cos(inF0); \
|
||||
cosh(inF0); \
|
||||
ddx(inF0); \
|
||||
ddx_coarse(inF0); \
|
||||
ddx_fine(inF0); \
|
||||
ddy(inF0); \
|
||||
ddy_coarse(inF0); \
|
||||
ddy_fine(inF0); \
|
||||
degrees(inF0); \
|
||||
determinant(inF0); \
|
||||
exp(inF0); \
|
||||
exp2(inF0); \
|
||||
firstbithigh(7); \
|
||||
firstbitlow(7); \
|
||||
floor(inF0); \
|
||||
fmod(inF0, inF1); \
|
||||
frac(inF0); \
|
||||
frexp(inF0, inF1); \
|
||||
fwidth(inF0); \
|
||||
ldexp(inF0, inF1); \
|
||||
log(inF0); \
|
||||
log10(inF0); \
|
||||
log2(inF0); \
|
||||
max(inF0, inF1); \
|
||||
min(inF0, inF1); \
|
||||
pow(inF0, inF1); \
|
||||
radians(inF0); \
|
||||
round(inF0); \
|
||||
rsqrt(inF0); \
|
||||
saturate(inF0); \
|
||||
sign(inF0); \
|
||||
sin(inF0); \
|
||||
sincos(inF0, inF1, inF2); \
|
||||
sinh(inF0); \
|
||||
smoothstep(inF0, inF1, inF2); \
|
||||
sqrt(inF0); \
|
||||
step(inF0, inF1); \
|
||||
tan(inF0); \
|
||||
tanh(inF0); \
|
||||
transpose(inF0); \
|
||||
trunc(inF0);
|
||||
#define MATFNS(MT) \
|
||||
bool r000 = all(inF0); \
|
||||
MT r001 = abs(inF0); \
|
||||
acos(inF0); \
|
||||
bool r003 = any(inF0); \
|
||||
MT r004 = asin(inF0); \
|
||||
MT r005 = atan(inF0); \
|
||||
MT r006 = atan2(inF0, inF1); \
|
||||
MT r007 = ceil(inF0); \
|
||||
clip(inF0); \
|
||||
MT r008 = clamp(inF0, inF1, inF2); \
|
||||
MT r009 = cos(inF0); \
|
||||
MT r010 = cosh(inF0); \
|
||||
MT r011 = ddx(inF0); \
|
||||
MT r012 = ddx_coarse(inF0); \
|
||||
MT r013 = ddx_fine(inF0); \
|
||||
MT r014 = ddy(inF0); \
|
||||
MT r015 = ddy_coarse(inF0); \
|
||||
MT r016 = ddy_fine(inF0); \
|
||||
MT r017 = degrees(inF0); \
|
||||
float r018 = determinant(inF0); \
|
||||
MT r019 = exp(inF0); \
|
||||
MT R020 = exp2(inF0); \
|
||||
MT r021 = floor(inF0); \
|
||||
MT r022 = fmod(inF0, inF1); \
|
||||
MT r023 = frac(inF0); \
|
||||
MT r024 = frexp(inF0, inF1); \
|
||||
MT r025 = fwidth(inF0); \
|
||||
MT r026 = ldexp(inF0, inF1); \
|
||||
MT r026a = lerp(inF0, inF1, inF2); \
|
||||
MT r027 = log(inF0); \
|
||||
MT r028 = log10(inF0); \
|
||||
MT r029 = log2(inF0); \
|
||||
MT r030 = max(inF0, inF1); \
|
||||
MT r031 = min(inF0, inF1); \
|
||||
MT r032 = pow(inF0, inF1); \
|
||||
MT r033 = radians(inF0); \
|
||||
MT r034 = round(inF0); \
|
||||
MT r035 = rsqrt(inF0); \
|
||||
MT r036 = saturate(inF0); \
|
||||
MT r037 = sign(inF0); \
|
||||
MT r038 = sin(inF0); \
|
||||
sincos(inF0, inF1, inF2); \
|
||||
MT r039 = sinh(inF0); \
|
||||
MT r049 = smoothstep(inF0, inF1, inF2); \
|
||||
MT r041 = sqrt(inF0); \
|
||||
MT r042 = step(inF0, inF1); \
|
||||
MT r043 = tan(inF0); \
|
||||
MT r044 = tanh(inF0); \
|
||||
transpose(inF0); \
|
||||
MT r046 = trunc(inF0);
|
||||
|
||||
// TODO: turn on non-square matrix tests when protos are available.
|
||||
|
||||
float2x2 PixelShaderFunction(float2x2 inF0, float2x2 inF1, float2x2 inF2)
|
||||
{
|
||||
// TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
|
||||
MATFNS()
|
||||
MATFNS(float2x2);
|
||||
|
||||
// TODO: ... add when float1 prototypes are generated
|
||||
return float2x2(2,2,2,2);
|
||||
@ -402,7 +408,7 @@ float2x2 PixelShaderFunction(float2x2 inF0, float2x2 inF1, float2x2 inF2)
|
||||
float3x3 PixelShaderFunction(float3x3 inF0, float3x3 inF1, float3x3 inF2)
|
||||
{
|
||||
// TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
|
||||
MATFNS()
|
||||
MATFNS(float3x3);
|
||||
|
||||
// TODO: ... add when float1 prototypes are generated
|
||||
return float3x3(3,3,3,3,3,3,3,3,3);
|
||||
@ -411,7 +417,7 @@ float3x3 PixelShaderFunction(float3x3 inF0, float3x3 inF1, float3x3 inF2)
|
||||
float4x4 PixelShaderFunction(float4x4 inF0, float4x4 inF1, float4x4 inF2)
|
||||
{
|
||||
// TODO: FXC doesn't accept this with (), but glslang doesn't accept it without.
|
||||
MATFNS()
|
||||
MATFNS(float4x4);
|
||||
|
||||
// TODO: ... add when float1 prototypes are generated
|
||||
return float4x4(4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4);
|
||||
@ -449,3 +455,29 @@ void TestGenMul(float inF0, float inF1,
|
||||
{
|
||||
TESTGENMUL(float, float4, float4x4);
|
||||
}
|
||||
|
||||
// Test some non-square mats
|
||||
void TestGenMul(float inF0, float inF1,
|
||||
float2 inFV2, float3 inFV3,
|
||||
float2x3 inFM2x3, float3x2 inFM3x2,
|
||||
float3x3 inFM3x3, float3x4 inFM3x4,
|
||||
float2x4 inFM2x4)
|
||||
{
|
||||
float r00 = mul(inF0, inF1); // S=S*S
|
||||
float2 r01 = mul(inFV2, inF0); // V=V*S
|
||||
float3 r02 = mul(inFV3, inF0); // V=V*S
|
||||
float2 r03 = mul(inF0, inFV2); // V=S*V
|
||||
float3 r04 = mul(inF0, inFV3); // V=S*V
|
||||
float r05 = mul(inFV2, inFV2); // S=V*V
|
||||
float r06 = mul(inFV3, inFV3); // S=V*V
|
||||
float3 r07 = mul(inFV2, inFM2x3); // V=V*M (return V dim is Mcols)
|
||||
float2 r08 = mul(inFV3, inFM3x2); // V=V*M (return V dim is Mcols)
|
||||
float2 r09 = mul(inFM2x3, inFV3); // V=M*V (return V dim is Mrows)
|
||||
float3 r10 = mul(inFM3x2, inFV2); // V=M*V (return V dim is Mrows)
|
||||
float2x3 r11 = mul(inFM2x3, inF0);
|
||||
float3x2 r12 = mul(inFM3x2, inF0);
|
||||
float2x2 r13 = mul(inFM2x3, inFM3x2);
|
||||
float2x3 r14 = mul(inFM2x3, inFM3x3);
|
||||
float2x4 r15 = mul(inFM2x3, inFM3x4);
|
||||
float3x4 r16 = mul(inFM3x2, inFM2x4);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ float VertexShaderFunction(float inF0, float inF1, float inF2, uint inU0, uint i
|
||||
isinf(inF0);
|
||||
isnan(inF0);
|
||||
ldexp(inF0, inF1);
|
||||
lerp(inF0, inF1, inF2);
|
||||
log(inF0);
|
||||
log10(inF0);
|
||||
log2(inF0);
|
||||
@ -102,6 +103,7 @@ float2 VertexShaderFunction(float2 inF0, float2 inF1, float2 inF2, uint2 inU0, u
|
||||
isinf(inF0);
|
||||
isnan(inF0);
|
||||
ldexp(inF0, inF1);
|
||||
lerp(inF0, inF1, inF2);
|
||||
length(inF0);
|
||||
log(inF0);
|
||||
log10(inF0);
|
||||
@ -172,6 +174,7 @@ float3 VertexShaderFunction(float3 inF0, float3 inF1, float3 inF2, uint3 inU0, u
|
||||
isinf(inF0);
|
||||
isnan(inF0);
|
||||
ldexp(inF0, inF1);
|
||||
lerp(inF0, inF1, inF2);
|
||||
length(inF0);
|
||||
log(inF0);
|
||||
log10(inF0);
|
||||
@ -242,6 +245,7 @@ float4 VertexShaderFunction(float4 inF0, float4 inF1, float4 inF2, uint4 inU0, u
|
||||
isinf(inF0);
|
||||
isnan(inF0);
|
||||
ldexp(inF0, inF1);
|
||||
lerp(inF0, inF1, inF2);
|
||||
length(inF0);
|
||||
log(inF0);
|
||||
log10(inF0);
|
||||
@ -303,6 +307,7 @@ float4 VertexShaderFunction(float4 inF0, float4 inF1, float4 inF2, uint4 inU0, u
|
||||
frac(inF0); \
|
||||
frexp(inF0, inF1); \
|
||||
ldexp(inF0, inF1); \
|
||||
lerp(inF0, inF1, inF2); \
|
||||
log(inF0); \
|
||||
log10(inF0); \
|
||||
log2(inF0); \
|
||||
@ -386,3 +391,29 @@ void TestGenMul(float inF0, float inF1,
|
||||
{
|
||||
TESTGENMUL(float, float4, float4x4);
|
||||
}
|
||||
|
||||
// Test some non-square mats
|
||||
void TestGenMul(float inF0, float inF1,
|
||||
float2 inFV2, float3 inFV3,
|
||||
float2x3 inFM2x3, float3x2 inFM3x2,
|
||||
float3x3 inFM3x3, float3x4 inFM3x4,
|
||||
float2x4 inFM2x4)
|
||||
{
|
||||
float r00 = mul(inF0, inF1); // S=S*S
|
||||
float2 r01 = mul(inFV2, inF0); // V=V*S
|
||||
float3 r02 = mul(inFV3, inF0); // V=V*S
|
||||
float2 r03 = mul(inF0, inFV2); // V=S*V
|
||||
float3 r04 = mul(inF0, inFV3); // V=S*V
|
||||
float r05 = mul(inFV2, inFV2); // S=V*V
|
||||
float r06 = mul(inFV3, inFV3); // S=V*V
|
||||
float3 r07 = mul(inFV2, inFM2x3); // V=V*M (return V dim is Mcols)
|
||||
float2 r08 = mul(inFV3, inFM3x2); // V=V*M (return V dim is Mcols)
|
||||
float2 r09 = mul(inFM2x3, inFV3); // V=M*V (return V dim is Mrows)
|
||||
float3 r10 = mul(inFM3x2, inFV2); // V=M*V (return V dim is Mrows)
|
||||
float2x3 r11 = mul(inFM2x3, inF0);
|
||||
float3x2 r12 = mul(inFM3x2, inF0);
|
||||
float2x2 r13 = mul(inFM2x3, inFM3x2);
|
||||
float2x3 r14 = mul(inFM2x3, inFM3x3);
|
||||
float2x4 r15 = mul(inFM2x3, inFM3x4);
|
||||
float3x4 r16 = mul(inFM3x2, inFM2x4);
|
||||
}
|
||||
|
@ -523,6 +523,7 @@ enum TOperator {
|
||||
EOpF32tof16, // HLSL conversion: half of a PackHalf2x16
|
||||
EOpF16tof32, // HLSL conversion: half of an UnpackHalf2x16
|
||||
EOpLit, // HLSL lighting coefficient vector
|
||||
EOpTextureBias, // HLSL texture bias: will be lowered to EOpTexture
|
||||
};
|
||||
|
||||
class TIntermTraverser;
|
||||
|
@ -799,6 +799,68 @@ TOperator HlslParseContext::mapAtomicOp(const TSourceLoc& loc, TOperator op, boo
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Change texture parameters to match AST & SPIR-V semantics
|
||||
//
|
||||
void HlslParseContext::textureParameters(const TSourceLoc& loc, TIntermTyped*& node, TIntermNode* arguments)
|
||||
{
|
||||
if (!node || !node->getAsOperator())
|
||||
return;
|
||||
|
||||
const TOperator op = node->getAsOperator()->getOp();
|
||||
const TIntermAggregate* argAggregate = arguments ? arguments->getAsAggregate() : nullptr;
|
||||
|
||||
switch (op) {
|
||||
case EOpTexture:
|
||||
{
|
||||
// Texture with ddx & ddy is really gradient form
|
||||
if (argAggregate->getSequence().size() == 4) {
|
||||
node->getAsAggregate()->setOperator(EOpTextureGrad);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case EOpTextureBias:
|
||||
{
|
||||
TIntermTyped* arg0 = argAggregate->getSequence()[0]->getAsTyped(); // sampler
|
||||
TIntermTyped* arg1 = argAggregate->getSequence()[1]->getAsTyped(); // coord
|
||||
|
||||
// HLSL puts bias in W component of coordinate. We extract it and add it to
|
||||
// the argument list, instead
|
||||
TIntermTyped* w = intermediate.addConstantUnion(3, loc, true);
|
||||
TIntermTyped* bias = intermediate.addIndex(EOpIndexDirect, arg1, w, loc);
|
||||
|
||||
TOperator constructOp = EOpNull;
|
||||
switch (arg0->getType().getSampler().dim) {
|
||||
case Esd1D: constructOp = EOpConstructFloat; break; // 1D
|
||||
case Esd2D: constructOp = EOpConstructVec2; break; // 2D
|
||||
case Esd3D: constructOp = EOpConstructVec3; break; // 3D
|
||||
case EsdCube: constructOp = EOpConstructVec3; break; // also 3D
|
||||
default: break;
|
||||
}
|
||||
|
||||
TIntermAggregate* constructCoord = new TIntermAggregate(constructOp);
|
||||
constructCoord->getSequence().push_back(arg1);
|
||||
constructCoord->setLoc(loc);
|
||||
|
||||
TIntermAggregate* tex = new TIntermAggregate(EOpTexture);
|
||||
tex->getSequence().push_back(arg0); // sampler
|
||||
tex->getSequence().push_back(constructCoord); // coordinate
|
||||
tex->getSequence().push_back(bias); // bias
|
||||
tex->setLoc(loc);
|
||||
node = tex;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break; // most pass through unchanged
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Optionally decompose intrinsics to AST opcodes.
|
||||
//
|
||||
void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*& node, TIntermNode* arguments)
|
||||
@ -875,6 +937,7 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
|
||||
compoundStatement = intermediate.growAggregate(compoundStatement, cosAssign);
|
||||
compoundStatement->setOperator(EOpSequence);
|
||||
compoundStatement->setLoc(loc);
|
||||
compoundStatement->setType(TType(EbtVoid));
|
||||
|
||||
node = compoundStatement;
|
||||
|
||||
@ -1222,6 +1285,7 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
|
||||
}
|
||||
|
||||
decomposeIntrinsic(loc, result, arguments);
|
||||
textureParameters(loc, result, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,7 @@ public:
|
||||
void handleFunctionArgument(TFunction*, TIntermTyped*& arguments, TIntermTyped* newArg);
|
||||
TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermNode*);
|
||||
void decomposeIntrinsic(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
|
||||
void textureParameters(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
|
||||
TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*);
|
||||
void addInputArgumentConversions(const TFunction&, TIntermNode*&) const;
|
||||
TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermAggregate&) const;
|
||||
|
@ -54,6 +54,8 @@
|
||||
|
||||
namespace { // anonymous namespace functions
|
||||
|
||||
const bool UseHlslTypes = false;
|
||||
|
||||
const char* BaseTypeName(const char* argOrder, const char* scalarName, const char* vecName, const char* matName)
|
||||
{
|
||||
switch (*argOrder) {
|
||||
@ -74,22 +76,38 @@ const char* BaseTypeName(const char* argOrder, const char* scalarName, const cha
|
||||
glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, const char* argType, int dim0, int dim1)
|
||||
{
|
||||
const bool transpose = (argOrder[0] == '^');
|
||||
const bool matMul = (argOrder[0] == '#');
|
||||
|
||||
// Take transpose of matrix dimensions
|
||||
if (transpose) {
|
||||
std::swap(dim0, dim1);
|
||||
if (transpose) { // Take transpose of matrix dimensions
|
||||
std::swap(dim0, dim1);
|
||||
++argOrder;
|
||||
} else if (matMul) {
|
||||
dim0 = dim1; // set vector dimension to mat col
|
||||
++argOrder;
|
||||
}
|
||||
|
||||
switch (*argType) {
|
||||
case '-': s += "void"; break;
|
||||
case 'F': s += BaseTypeName(argOrder, "float", "vec", "mat"); break;
|
||||
case 'D': s += BaseTypeName(argOrder, "double", "dvec", "dmat"); break;
|
||||
case 'I': s += BaseTypeName(argOrder, "int", "ivec", "imat"); break;
|
||||
case 'U': s += BaseTypeName(argOrder, "uint", "uvec", "umat"); break;
|
||||
case 'B': s += BaseTypeName(argOrder, "bool", "bvec", "bmat"); break;
|
||||
case 'S': s += BaseTypeName(argOrder, "sampler", "sampler", "sampler"); break; // TODO:
|
||||
default: s += "UNKNOWN_TYPE"; break;
|
||||
if (UseHlslTypes) {
|
||||
switch (*argType) {
|
||||
case '-': s += "void"; break;
|
||||
case 'F': s += "float"; break;
|
||||
case 'D': s += "double"; break;
|
||||
case 'I': s += "int"; break;
|
||||
case 'U': s += "uint"; break;
|
||||
case 'B': s += "bool"; break;
|
||||
case 'S': s += "sampler"; break;
|
||||
default: s += "UNKNOWN_TYPE"; break;
|
||||
}
|
||||
} else {
|
||||
switch (*argType) {
|
||||
case '-': s += "void"; break;
|
||||
case 'F': s += BaseTypeName(argOrder, "float", "vec", "mat"); break;
|
||||
case 'D': s += BaseTypeName(argOrder, "double", "dvec", "dmat"); break;
|
||||
case 'I': s += BaseTypeName(argOrder, "int", "ivec", "imat"); break;
|
||||
case 'U': s += BaseTypeName(argOrder, "uint", "uvec", "umat"); break;
|
||||
case 'B': s += BaseTypeName(argOrder, "bool", "bvec", "bmat"); break;
|
||||
case 'S': s += BaseTypeName(argOrder, "sampler", "sampler", "sampler"); break; // TODO:
|
||||
default: s += "UNKNOWN_TYPE"; break;
|
||||
}
|
||||
}
|
||||
|
||||
// handle fixed vector sizes, such as float3, and only ever 3.
|
||||
@ -119,7 +137,13 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons
|
||||
case '-': break; // no dimensions for voids
|
||||
case 'S': break; // no dimensions on scalars
|
||||
case 'V': s += ('0' + dim0); break;
|
||||
case 'M': s += ('0' + dim0); s += 'x'; s += ('0' + dim1); break;
|
||||
case 'M':
|
||||
{
|
||||
if (!UseHlslTypes) // GLSL has column first for mat types
|
||||
std::swap(dim0, dim1);
|
||||
s += ('0' + dim0); s += 'x'; s += ('0' + dim1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
@ -142,7 +166,7 @@ inline bool IsValidGlsl(const char* cname, char retOrder, char retType, char arg
|
||||
|
||||
const std::string name(cname); // for ease of comparison. slow, but temporary, until HLSL parser is online.
|
||||
|
||||
if (isMat && dim0 != dim1) // TODO: avoid mats until we find the right GLSL profile
|
||||
if (isMat && dim1 == 1) // TODO: avoid mat Nx1 until we find the right GLSL profile
|
||||
return false;
|
||||
|
||||
if (isMat && (argType == 'I' || argType == 'U' || argType == 'B') ||
|
||||
@ -210,6 +234,39 @@ TBuiltInParseablesHlsl::TBuiltInParseablesHlsl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Handle creation of mat*mat specially, since it doesn't fall conveniently out of
|
||||
// the generic prototype creation code below.
|
||||
//
|
||||
void TBuiltInParseablesHlsl::createMatTimesMat()
|
||||
{
|
||||
TString& s = commonBuiltins;
|
||||
|
||||
const int first = (UseHlslTypes ? 1 : 2);
|
||||
|
||||
for (int xRows = first; xRows <=4; xRows++) {
|
||||
for (int xCols = first; xCols <=4; xCols++) {
|
||||
const int yRows = xCols;
|
||||
for (int yCols = first; yCols <=4; yCols++) {
|
||||
const int retRows = xRows;
|
||||
const int retCols = yCols;
|
||||
|
||||
AppendTypeName(s, "M", "F", retRows, retCols); // add return type
|
||||
s.append(" "); // space between type and name
|
||||
s.append("mul"); // intrinsic name
|
||||
s.append("("); // open paren
|
||||
|
||||
AppendTypeName(s, "M", "F", xRows, xCols); // add X input
|
||||
s.append(", ");
|
||||
AppendTypeName(s, "M", "F", yRows, yCols); // add Y input
|
||||
|
||||
s.append(");\n"); // close paren
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add all context-independent built-in functions and variables that are present
|
||||
// for the given version and profile. Share common ones across stages, otherwise
|
||||
@ -232,6 +289,7 @@ void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, const Spv
|
||||
// '>' as first letter of order creates an output parameter
|
||||
// '<' as first letter of order creates an input parameter
|
||||
// '^' as first letter of order takes transpose dimensions
|
||||
// '#' as first letter of order sets rows=cols for mats
|
||||
|
||||
static const struct {
|
||||
const char* name; // intrinsic name
|
||||
@ -321,6 +379,7 @@ void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, const Spv
|
||||
{ "isnan", nullptr, "B" , "SVM", "F", EShLangAll },
|
||||
{ "ldexp", nullptr, nullptr, "SVM,", "F,", EShLangAll },
|
||||
{ "length", "S", "F", "V", "F", EShLangAll },
|
||||
{ "lerp", nullptr, nullptr, "SVM,,", "F,,", EShLangAll },
|
||||
{ "lit", "V4", "F", "S,,", "F,,", EShLangAll },
|
||||
{ "log", nullptr, nullptr, "SVM", "F", EShLangAll },
|
||||
{ "log10", nullptr, nullptr, "SVM", "F", EShLangAll },
|
||||
@ -330,16 +389,15 @@ void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, const Spv
|
||||
{ "min", nullptr, nullptr, "SVM,", "FI,", EShLangAll },
|
||||
{ "modf", nullptr, nullptr, "SVM,>", "FI,", EShLangAll },
|
||||
{ "msad4", "V4", "U", "S,V2,V4", "U,,", EShLangAll },
|
||||
// TODO: fix matrix return size for non-square mats used with mul opcode
|
||||
{ "mul", "S", nullptr, "S,S", "FI,", EShLangAll },
|
||||
{ "mul", "V", nullptr, "S,V", "FI,", EShLangAll },
|
||||
{ "mul", "M", nullptr, "S,M", "FI,", EShLangAll },
|
||||
{ "mul", "V", nullptr, "V,S", "FI,", EShLangAll },
|
||||
{ "mul", "S", nullptr, "V,V", "FI,", EShLangAll },
|
||||
{ "mul", "V", nullptr, "V,M", "FI,", EShLangAll },
|
||||
{ "mul", "#V", nullptr, "V,M", "FI,", EShLangAll },
|
||||
{ "mul", "M", nullptr, "M,S", "FI,", EShLangAll },
|
||||
{ "mul", "V", nullptr, "M,V", "FI,", EShLangAll },
|
||||
{ "mul", "M", nullptr, "M,M", "FI,", EShLangAll },
|
||||
{ "mul", "V", nullptr, "M,#V", "FI,", EShLangAll },
|
||||
// mat*mat form of mul is handled in createMatTimesMat()
|
||||
{ "noise", "S", "F", "V", "F", EShLangFragmentMask },
|
||||
{ "normalize", nullptr, nullptr, "V", "F", EShLangAll },
|
||||
{ "pow", nullptr, nullptr, "SVM,", "F,", EShLangAll },
|
||||
@ -465,7 +523,7 @@ void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, const Spv
|
||||
if (*nthArgOrder == ',' || *nthArgOrder == '\0') nthArgOrder = argOrder;
|
||||
if (*nthArgType == ',' || *nthArgType == '\0') nthArgType = argType;
|
||||
|
||||
AppendTypeName(s, nthArgOrder, nthArgType, dim0, dim1); // Add first argument
|
||||
AppendTypeName(s, nthArgOrder, nthArgType, dim0, dim1); // Add arguments
|
||||
}
|
||||
|
||||
s.append(");\n"); // close paren and trailing semicolon
|
||||
@ -482,6 +540,8 @@ void TBuiltInParseablesHlsl::initialize(int version, EProfile profile, const Spv
|
||||
}
|
||||
}
|
||||
|
||||
createMatTimesMat(); // handle this case separately, for convenience
|
||||
|
||||
// printf("Common:\n%s\n", getCommonString().c_str());
|
||||
// printf("Frag:\n%s\n", getStageString(EShLangFragment).c_str());
|
||||
// printf("Vertex:\n%s\n", getStageString(EShLangVertex).c_str());
|
||||
@ -586,6 +646,7 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, con
|
||||
symbolTable.relateToOperator("isnan", EOpIsNan);
|
||||
symbolTable.relateToOperator("ldexp", EOpLdexp);
|
||||
symbolTable.relateToOperator("length", EOpLength);
|
||||
symbolTable.relateToOperator("lerp", EOpMix);
|
||||
symbolTable.relateToOperator("lit", EOpLit);
|
||||
symbolTable.relateToOperator("log", EOpLog);
|
||||
symbolTable.relateToOperator("log10", EOpLog10);
|
||||
@ -628,25 +689,25 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int version, EProfile profile, con
|
||||
symbolTable.relateToOperator("tan", EOpTan);
|
||||
symbolTable.relateToOperator("tanh", EOpTanh);
|
||||
symbolTable.relateToOperator("tex1D", EOpTexture);
|
||||
// symbolTable.relateToOperator("tex1Dbias", // TODO:
|
||||
symbolTable.relateToOperator("tex1Dbias", EOpTextureBias);
|
||||
symbolTable.relateToOperator("tex1Dgrad", EOpTextureGrad);
|
||||
symbolTable.relateToOperator("tex1Dlod", EOpTextureLod);
|
||||
symbolTable.relateToOperator("tex1Dproj", EOpTextureProj);
|
||||
symbolTable.relateToOperator("tex2D", EOpTexture);
|
||||
// symbolTable.relateToOperator("tex2Dbias", // TODO:
|
||||
symbolTable.relateToOperator("tex2Dbias", EOpTextureBias);
|
||||
symbolTable.relateToOperator("tex2Dgrad", EOpTextureGrad);
|
||||
symbolTable.relateToOperator("tex2Dlod", EOpTextureLod);
|
||||
// symbolTable.relateToOperator("tex2Dproj", EOpTextureProj);
|
||||
symbolTable.relateToOperator("tex2Dproj", EOpTextureProj);
|
||||
symbolTable.relateToOperator("tex3D", EOpTexture);
|
||||
// symbolTable.relateToOperator("tex3Dbias"); // TODO
|
||||
symbolTable.relateToOperator("tex3Dbias", EOpTextureBias);
|
||||
symbolTable.relateToOperator("tex3Dgrad", EOpTextureGrad);
|
||||
symbolTable.relateToOperator("tex3Dlod", EOpTextureLod);
|
||||
// symbolTable.relateToOperator("tex3Dproj", EOpTextureProj);
|
||||
symbolTable.relateToOperator("tex3Dproj", EOpTextureProj);
|
||||
symbolTable.relateToOperator("texCUBE", EOpTexture);
|
||||
// symbolTable.relateToOperator("texCUBEbias", // TODO
|
||||
symbolTable.relateToOperator("texCUBEbias", EOpTextureBias);
|
||||
symbolTable.relateToOperator("texCUBEgrad", EOpTextureGrad);
|
||||
symbolTable.relateToOperator("texCUBElod", EOpTextureLod);
|
||||
// symbolTable.relateToOperator("texCUBEproj", EOpTextureProj);
|
||||
symbolTable.relateToOperator("texCUBEproj", EOpTextureProj);
|
||||
symbolTable.relateToOperator("transpose", EOpTranspose);
|
||||
symbolTable.relateToOperator("trunc", EOpTrunc);
|
||||
}
|
||||
|
@ -54,6 +54,9 @@ public:
|
||||
void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable);
|
||||
|
||||
void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources);
|
||||
|
||||
private:
|
||||
void createMatTimesMat();
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
Loading…
Reference in New Issue
Block a user