Trouble with float16

Trouble with float16

Hi,

I got an access violation when I do the following :

shaderParams->params.matte.Cd= RGBAtoSpectrum(shaderParams->params.matte.Cd.s0123);

If I do the following I have no crash :

float16 _tempSpectrum_ = 0;_tempSpectrum_ = shaderParams->params.matte.Cd;shaderParams->params.matte.Cd= RGBAtoSpectrum(_tempSpectrum_.s0123);

Where :

ShaderParameters* shaderParams : It is a local variable

It has the following definition :

struct __attribute__((packed)) ShaderParam_ashikhmin{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float Ks __attribute__((packed));float16 Cs __attribute__((packed));float exponent_u __attribute__((packed));float exponent_v __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_ashikhmin_velvet{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float Ks __attribute__((packed));float16 Cs __attribute__((packed));float rough __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_debug{float Kd __attribute__((packed));float16 Cs __attribute__((packed));};struct __attribute__((packed)) ShaderParam_emitter{float power __attribute__((packed));float16 Cs __attribute__((packed));};struct __attribute__((packed)) ShaderParam_emitter_blackbody{float power __attribute__((packed));float temperature __attribute__((packed));};struct __attribute__((packed)) ShaderParam_emitter_textured{int filename __attribute__((packed));float power __attribute__((packed));};struct __attribute__((packed)) ShaderParam_glass{float Ks __attribute__((packed));float16 Cs __attribute__((packed));float eta __attribute__((packed));int caustics __attribute__((packed));int TIR __attribute__((packed));};struct __attribute__((packed)) ShaderParam_glass_rough{float Ks __attribute__((packed));float16 Cs __attribute__((packed));float roughness __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_glass_textured{int filename __attribute__((packed));float Ks __attribute__((packed));float eta __attribute__((packed));int caustics __attribute__((packed));int TIR __attribute__((packed));};struct __attribute__((packed)) ShaderParam_glossy{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float Ks __attribute__((packed));float16 Cs __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_glossy_textured{int diffuseFilename __attribute__((packed));float Kd __attribute__((packed));int bumpMapFilename __attribute__((packed));float Kb __attribute__((packed));int normalMapFilename __attribute__((packed));float scaleU __attribute__((packed));float scaleV __attribute__((packed));int flipU __attribute__((packed));int flipV __attribute__((packed));float Ks __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_matte{float Kd __attribute__((packed));float16 Cd __attribute__((packed));};struct __attribute__((packed)) ShaderParam_matte_textured{int diffuseFilename __attribute__((packed));float Kd __attribute__((packed));int bumpMapFilename __attribute__((packed));float Kb __attribute__((packed));int normalMapFilename __attribute__((packed));float scaleU __attribute__((packed));float scaleV __attribute__((packed));int flipU __attribute__((packed));int flipV __attribute__((packed));};struct __attribute__((packed)) ShaderParam_metal_rough{float Ks __attribute__((packed));float16 Cs __attribute__((packed));float roughness __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_mirror{float Ks __attribute__((packed));float16 Cs __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_mirror_textured{int filename __attribute__((packed));float16 Cs __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_oren_nayar{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float roughness __attribute__((packed));};struct __attribute__((packed)) ShaderParam_phong{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float Ks __attribute__((packed));float16 Cs __attribute__((packed));float exponent __attribute__((packed));};struct __attribute__((packed)) ShaderParam_phong_textured{int diffuseFilename __attribute__((packed));float Kd __attribute__((packed));int bumpMapFilename __attribute__((packed));float Kb __attribute__((packed));int normalMapFilename __attribute__((packed));float scaleU __attribute__((packed));float scaleV __attribute__((packed));int flipU __attribute__((packed));int flipV __attribute__((packed));float Ks __attribute__((packed));float exponent __attribute__((packed));};struct __attribute__((packed)) ShaderParam_transmissive{float Ks __attribute__((packed));float16 Cs __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_mapping_normal{};struct __attribute__((packed)) ShaderParam_mapping_tangent{};struct __attribute__((packed)) ShaderParam_ward{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float Ks __attribute__((packed));float16 Cs __attribute__((packed));float xrough __attribute__((packed));float yrough __attribute__((packed));};struct __attribute__((packed)) ShaderParam_soap_bubble{};struct __attribute__((packed)) ShaderParam_tc_builtinfunctions{float Kd __attribute__((packed));float16 Cs __attribute__((packed));};struct __attribute__((packed)) ShaderParam_tc_closure_mix{float Kd1 __attribute__((packed));float16 Cd1 __attribute__((packed));float Kd2 __attribute__((packed));float16 Cd2 __attribute__((packed));};struct __attribute__((packed)) ShaderParam_tc_normal_modify{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float sx __attribute__((packed));float sy __attribute__((packed));float sz __attribute__((packed));};struct __attribute__((packed)) ShaderParam_tc_texture{int diffuseFilename __attribute__((packed));float Kd __attribute__((packed));int bumpMapFilename __attribute__((packed));float Kb __attribute__((packed));int normalMapFilename __attribute__((packed));float scaleU __attribute__((packed));float scaleV __attribute__((packed));int flipU __attribute__((packed));int flipV __attribute__((packed));};struct __attribute__((packed)) ShaderParametersStruct{uint shaderId __attribute__((packed));union __attribute__((packed)){struct ShaderParam_ashikhmin ashikhmin;struct ShaderParam_ashikhmin_velvet ashikhmin_velvet;struct ShaderParam_debug debug;struct ShaderParam_emitter emitter;struct ShaderParam_emitter_blackbody emitter_blackbody;struct ShaderParam_emitter_textured emitter_textured;struct ShaderParam_glass glass;struct ShaderParam_glass_rough glass_rough;struct ShaderParam_glass_textured glass_textured;struct ShaderParam_glossy glossy;struct ShaderParam_glossy_textured glossy_textured;struct ShaderParam_matte matte;struct ShaderParam_matte_textured matte_textured;struct ShaderParam_metal_rough metal_rough;struct ShaderParam_mirror mirror;struct ShaderParam_mirror_textured mirror_textured;struct ShaderParam_oren_nayar oren_nayar;struct ShaderParam_phong phong;struct ShaderParam_phong_textured phong_textured;struct ShaderParam_transmissive transmissive;struct ShaderParam_mapping_normal mapping_normal;struct ShaderParam_mapping_tangent mapping_tangent;struct ShaderParam_ward ward;struct ShaderParam_soap_bubble soap_bubble;struct ShaderParam_tc_builtinfunctions tc_builtinfunctions;struct ShaderParam_tc_closure_mix tc_closure_mix;struct ShaderParam_tc_normal_modify tc_normal_modify;struct ShaderParam_tc_texture tc_texture;} params __attribute__((packed));};#define ShaderParameters struct ShaderParametersStructstruct __attribute__((packed)) ShaderParam_ashikhmin{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float Ks __attribute__((packed));float16 Cs __attribute__((packed));float exponent_u __attribute__((packed));float exponent_v __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_ashikhmin_velvet{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float Ks __attribute__((packed));float16 Cs __attribute__((packed));float rough __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_debug{float Kd __attribute__((packed));float16 Cs __attribute__((packed));};struct __attribute__((packed)) ShaderParam_emitter{float power __attribute__((packed));float16 Cs __attribute__((packed));};struct __attribute__((packed)) ShaderParam_emitter_blackbody{float power __attribute__((packed));float temperature __attribute__((packed));};struct __attribute__((packed)) ShaderParam_emitter_textured{int filename __attribute__((packed));float power __attribute__((packed));};struct __attribute__((packed)) ShaderParam_glass{float Ks __attribute__((packed));float16 Cs __attribute__((packed));float eta __attribute__((packed));int caustics __attribute__((packed));int TIR __attribute__((packed));};struct __attribute__((packed)) ShaderParam_glass_rough{float Ks __attribute__((packed));float16 Cs __attribute__((packed));float roughness __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_glass_textured{int filename __attribute__((packed));float Ks __attribute__((packed));float eta __attribute__((packed));int caustics __attribute__((packed));int TIR __attribute__((packed));};struct __attribute__((packed)) ShaderParam_glossy{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float Ks __attribute__((packed));float16 Cs __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_glossy_textured{int diffuseFilename __attribute__((packed));float Kd __attribute__((packed));int bumpMapFilename __attribute__((packed));float Kb __attribute__((packed));int normalMapFilename __attribute__((packed));float scaleU __attribute__((packed));float scaleV __attribute__((packed));int flipU __attribute__((packed));int flipV __attribute__((packed));float Ks __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_matte{float Kd __attribute__((packed));float16 Cd __attribute__((packed));};struct __attribute__((packed)) ShaderParam_matte_textured{int diffuseFilename __attribute__((packed));float Kd __attribute__((packed));int bumpMapFilename __attribute__((packed));float Kb __attribute__((packed));int normalMapFilename __attribute__((packed));float scaleU __attribute__((packed));float scaleV __attribute__((packed));int flipU __attribute__((packed));int flipV __attribute__((packed));};struct __attribute__((packed)) ShaderParam_metal_rough{float Ks __attribute__((packed));float16 Cs __attribute__((packed));float roughness __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_mirror{float Ks __attribute__((packed));float16 Cs __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_mirror_textured{int filename __attribute__((packed));float16 Cs __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_oren_nayar{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float roughness __attribute__((packed));};struct __attribute__((packed)) ShaderParam_phong{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float Ks __attribute__((packed));float16 Cs __attribute__((packed));float exponent __attribute__((packed));};struct __attribute__((packed)) ShaderParam_phong_textured{int diffuseFilename __attribute__((packed));float Kd __attribute__((packed));int bumpMapFilename __attribute__((packed));float Kb __attribute__((packed));int normalMapFilename __attribute__((packed));float scaleU __attribute__((packed));float scaleV __attribute__((packed));int flipU __attribute__((packed));int flipV __attribute__((packed));float Ks __attribute__((packed));float exponent __attribute__((packed));};struct __attribute__((packed)) ShaderParam_transmissive{float Ks __attribute__((packed));float16 Cs __attribute__((packed));float eta __attribute__((packed));};struct __attribute__((packed)) ShaderParam_mapping_normal{};struct __attribute__((packed)) ShaderParam_mapping_tangent{};struct __attribute__((packed)) ShaderParam_ward{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float Ks __attribute__((packed));float16 Cs __attribute__((packed));float xrough __attribute__((packed));float yrough __attribute__((packed));};struct __attribute__((packed)) ShaderParam_soap_bubble{};struct __attribute__((packed)) ShaderParam_tc_builtinfunctions{float Kd __attribute__((packed));float16 Cs __attribute__((packed));};struct __attribute__((packed)) ShaderParam_tc_closure_mix{float Kd1 __attribute__((packed));float16 Cd1 __attribute__((packed));float Kd2 __attribute__((packed));float16 Cd2 __attribute__((packed));};struct __attribute__((packed)) ShaderParam_tc_normal_modify{float Kd __attribute__((packed));float16 Cd __attribute__((packed));float sx __attribute__((packed));float sy __attribute__((packed));float sz __attribute__((packed));};struct __attribute__((packed)) ShaderParam_tc_texture{int diffuseFilename __attribute__((packed));float Kd __attribute__((packed));int bumpMapFilename __attribute__((packed));float Kb __attribute__((packed));int normalMapFilename __attribute__((packed));float scaleU __attribute__((packed));float scaleV __attribute__((packed));int flipU __attribute__((packed));int flipV __attribute__((packed));};struct __attribute__((packed)) ShaderParametersStruct{uint shaderId __attribute__((packed));union __attribute__((packed)){struct ShaderParam_ashikhmin ashikhmin;struct ShaderParam_ashikhmin_velvet ashikhmin_velvet;struct ShaderParam_debug debug;struct ShaderParam_emitter emitter;struct ShaderParam_emitter_blackbody emitter_blackbody;struct ShaderParam_emitter_textured emitter_textured;struct ShaderParam_glass glass;struct ShaderParam_glass_rough glass_rough;struct ShaderParam_glass_textured glass_textured;struct ShaderParam_glossy glossy;struct ShaderParam_glossy_textured glossy_textured;struct ShaderParam_matte matte;struct ShaderParam_matte_textured matte_textured;struct ShaderParam_metal_rough metal_rough;struct ShaderParam_mirror mirror;struct ShaderParam_mirror_textured mirror_textured;struct ShaderParam_oren_nayar oren_nayar;struct ShaderParam_phong phong;struct ShaderParam_phong_textured phong_textured;struct ShaderParam_transmissive transmissive;struct ShaderParam_mapping_normal mapping_normal;struct ShaderParam_mapping_tangent mapping_tangent;struct ShaderParam_ward ward;struct ShaderParam_soap_bubble soap_bubble;struct ShaderParam_tc_builtinfunctions tc_builtinfunctions;struct ShaderParam_tc_closure_mix tc_closure_mix;struct ShaderParam_tc_normal_modify tc_normal_modify;struct ShaderParam_tc_texture tc_texture;} params __attribute__((packed));};#define ShaderParameters struct ShaderParametersStruct

http://spectralbattle.wordpress.com/
1 contenuto / 0 nuovi
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione