Description
I have run into a problem where the following example code is converting all of the intermediate variables going into "sum" are converted to double precision.
float sum = (samples.x ? 1.0 : 0.0)
+ (samples.y ? 1.0 : 0.0)
+ (samples.z ? 1.0 : 0.0)
+ (samples.w ? 1.0 : 0.0);
Historically the fxc compiler was more forgiving and would keep such values as floating point precision.
This behavior will unintentionally make shaders use double precision which will be slower and may lack support from all hardware vendors.
When I changed the code to:
float sum = (samples.x ? 1.0f : 0.0f)
+ (samples.y ? 1.0f : 0.0f)
+ (samples.z ? 1.0f : 0.0f)
+ (samples.w ? 1.0f : 0.0f);
I was able to run the application on the desired hardware.
Ideally the dxc compiler would be smart enough to keep this data in floating point format.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status