Description
The following code will cause a crash when compiling for DXIL output:
void crash_test(out float3x3 output)
{
output = (float3x3)0;
}
float4 main() : SV_Position
{
half3x3 output;
crash_test(output); // <- the output parameter is not able to cast between halfNxM and floatNxM
return (float4)0;
}
The cause is the function crash_test() having an output parameter of type float3x3, but passing in a variable of type half3x3 when calling it from main(). After a bit of digging in a debug build, it seem a DXASSERT is being hit in ConvertScalarOrVector() because the source and destination values are neither scalars nor vectors. It is getting to that code because there is no specific behavior defined in CGMSHLSLRuntime::EmitHLSLOutParamConversionCopyBack() for handling matrix type casting.
Steps to Reproduce
- Compile the above code with the command line arguments:
-E main -T vs_6_0
Actual Behavior
The following DXASSERT in ConvertScalarOrVector() is being hit when attempting to compile the above code for DXIL:
DXASSERT(
(SrcTy->isIntOrIntVectorTy() || SrcTy->isFPOrFPVectorTy()) &&
(DstTy->isIntOrIntVectorTy() || DstTy->isFPOrFPVectorTy()),
"EmitNumericConversion can only be used with int/float scalars/vectors.");
Environment
- DXC version:
dxcompiler.dll: 1.10(5434-75cab590)(1.9.0.15434) - 1.9.0.15434 (main, 75cab590f)
- Host Operating System: Windows 11
Description
The following code will cause a crash when compiling for DXIL output:
The cause is the function
crash_test()having an output parameter of typefloat3x3, but passing in a variable of typehalf3x3when calling it frommain(). After a bit of digging in a debug build, it seem aDXASSERTis being hit inConvertScalarOrVector()because the source and destination values are neither scalars nor vectors. It is getting to that code because there is no specific behavior defined inCGMSHLSLRuntime::EmitHLSLOutParamConversionCopyBack()for handling matrix type casting.Steps to Reproduce
-E main -T vs_6_0Actual Behavior
The following
DXASSERTinConvertScalarOrVector()is being hit when attempting to compile the above code for DXIL:Environment
dxcompiler.dll: 1.10(5434-75cab590)(1.9.0.15434) - 1.9.0.15434 (main, 75cab590f)