[QUOTE=tonyo_au;1257907]The following is working on nVidia but not on AMD Radeon R9 290
class C3D_VertexN
{
float x,y,z,w,nx,ny,nz;
...
sizeof(C3D_VertexN)
but
class C3D_VertexN
{
float x,y,z,w,nx,ny,nz,FILLER;
...
sizeof(C3D_VertexN)
works fine[/QUOTE]
I suspect this is not an NVidia vs. AMD issue. But a structure size/alignment issue between your systems.
Print sizeof(C3D_VertexN) and verify that it is 28 for the first definition. I suspect you’ll find that it is 32 on the AMD system.
Try adding #pragma pack(push[,n]) / #pragma pack(pop) around your struct, or adding [FONT=courier new]attribute((packed)) [/FONT]to it, or whatever your compiler supports to eliminate the implicit padding that is probably being added. I think that’ll fix your problem.
That said, it is generally recommended to keep your vertex sizes a multiple of 16 bytes. So I’d benchmark against the struct with FILLER in-place.
Wow. If true, that’s ugly. I would have thought I’d have seen some mention of that before if that was the case.
Are you sure you’re not doing something else wrong like overrunning your vertex buffer(s)? I would run a memory checker like valgrind, purify, or similar to double check that.
I am less sure on what is happening in the compute shader (it is my first attempt to use one). But the change for the vertex structure for rendering the DTM fixed my problem. Everything renders correctly including textures where I generate uv’s procedurally.