Can surf2Dwrite write to GL_RGB?

can surf2Dwrite write to GL_RGB ?
seems all demos write to GL_RGBA, found no one write to GL_RGB yet…

We have covered the idea that the texture mechanism does not support 3-component textures. (Also see here). I believe the surface mechanism behaves the same way.

A similar statement is here pertaining to interchange formats support for GL Interop.

thank! so still surf2Dwrite ‘unsigned int’ for GL_RGB, totoally same as for GL_RGBA, while the alpha channel was just ignored by the GPU, no matter what value was set, right?

I don’t really understand what you are asking. The texture or surface format, (resource descriptor) has to be 1, 2, or 4 component.

If its a one component surface, you are going to use surf2Dwrite with a unsigned quantity (and probably unsigned index scaling in x). If it is two component, you are going to use unsigned2 (for quantity and scaling). If it is four component, you are going to use unsigned4 (for quantity and scaling).

i mean i still create a texture with GL_RGB, then cudaGraphicsGLRegisterImage it with FlagsSurfaceLoadStore. and in kernel when surf2Dwrite still write 4 components as unsigned int while the alpha channel was just ignored ie. no matter what value it was.

I’m not sure what would happen in that case. I wouldn’t expect it to work. You can try it if you wish.