Hi,
I have some OpenCL code (works on other platforms) but crash with AMD SDK.
It seems that it does an access violation when accessing "shaderParams->params.matte.Kd". in line 9 !
But it print the correct value (1.f). If I remove the line 9 there is no problem !
It looks like a Bug in the SDK (I work on the CPU).
Krys
clReflectance shader_matte2(clScene* scene, ShaderGlobalParameters* globals, ShaderParameters* shaderParams, NextEventPath* nextEventPath) { clReflectance f; ClosureParameters p_21; p_21.params.diffuse.N = globals->N; printf("%f\n", shaderParams->params.matte.Kd); f = Integrator(scene, globals, 0, &p_21, nextEventPath)*shaderParams->params.matte.Cs; //f *= shaderParams->params.matte.Kd; return f; }
I also join the declaration of my structure :
struct __attribute__((packed)) ShaderParam_matte { float Kd __attribute__((packed)); clRGB Cs __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_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_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_transmissive transmissive; struct ShaderParam_ward ward; struct ShaderParam_unit_test_builtinfunctions unit_test_builtinfunctions; } params __attribute__((packed)); };
No reaction ?
It will be fine to have a "bug tracking" tool for us to send you bugs, tests cases etc... 😛
is it the same if you replace:
f *= shaderParams->params.matte.Kd;
by:
float tmp = shaderParams->params.matte.Kd;
f *= tmp
or simply:
f = shaderParams->params.matte.Kd;
?
It's not sure you have access violation whe using shaderParams->params.matte.Kd. What kind of type is that clReflectance and clRGB? What type of return you have with this Integrator() function?
Yes,
I have try all theses combinations ! But it still crash 😞
I have play a lot with this code to try to remove this crash, but no way...
I can send the application to the AMD team if needed !
Thanks
#define clRGB float4 #define clReflectance float4 float4 Integrator(...)
Thanks Micah,
I can't because it only accept file < 5 MB, mine is 17 Mb !
Can I send it to your email ?
Krys
Have ytou tried to debug the kernel using GDB?
It can be good to experiment if the issue is with packed structs only?
I would suggest you to try to create a simple test case that shows tha issue.