Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of R8G8B8 texture format ? #687

Closed
hcomere opened this issue Feb 19, 2016 · 9 comments
Closed

Support of R8G8B8 texture format ? #687

hcomere opened this issue Feb 19, 2016 · 9 comments

Comments

@hcomere
Copy link
Contributor

hcomere commented Feb 19, 2016

Hello,

I do not see support for R8G8B8 texture format, is there a good reason ?

I am capturing images from a video that are in R8G8B8 pixel format, i would like to send it on GPU without conversion.

Regards,
Harold

@bkaradzic
Copy link
Owner

No GPU actually supports 24-bit RGB format. There is only legacy GL support for it, but otherwise unavailable on other graphics APIs.

@RichardGale
Copy link
Contributor

Oh, did not know that. I always used that format as a nice saving over RGBA8888 for those full screen textures artists like. Is RGB565 our best option for non-alpha textures?

@bkaradzic
Copy link
Owner

I was just checking Vulkan headers and they have it too:
https://github.com/bkaradzic/bgfx/blob/master/3rdparty/khronos/vulkan/vulkan.h#L263

I might just add it, but D3D doesn't have it. Anyhow I have ability to convert between all uncompressed formats inside bgfx, just features is not hooked up for all formats, and I don't know when I'm going to do it.

@hcomere
Copy link
Contributor Author

hcomere commented Feb 20, 2016

Ok, thanks for your answer.

I will convert my video image into RGBA8 until you add support for RGB8.
Will i receive an email when this will be ready ?

Regards,
Harold

@bkaradzic
Copy link
Owner

Yeah, I'll just post update here.

@hcomere
Copy link
Contributor Author

hcomere commented Feb 22, 2016

A bit off-topic as i dont want to create an issue for this but ...

About this video-grabber, here what i am roughtly doing :

while video is not terminated
      grab next image from video
      update texture with image pixel buffer
      render one frame

That means the bgfx::memory i am creating to send pixel buffer to gpu is needed only one bgfx::frame().
But i have issues if i delete the memory just after the bgfx::frame, the doc stating :
" or you must make sure data is available for at least 2 bgfx::frame calls "

It makes not sense in my case to defer the memory deletion of one frame.
Why does bgfx requires memory to be alive for 2 frames ?

Regards,
Harold

@bkaradzic
Copy link
Owner

That's only requirement for bgfx::makeRef if you're not providing ReleaseFn callback. ReleaseFn callback in case you want to release it as soon as bgfx is done with it. The reason why there is 2 frames requirement is because bgfx is asynchronous and when you pass data, it gets processed at some later point (after 2 bgfx::frame calls it's guaranteed that data is processed).

There is also bgfx::alloc when you don't have your buffer, but want to allocate it for bgfx and not worry about it.

See here:
https://bkaradzic.github.io/bgfx/bgfx.html#_CPPv2N4bgfx6MemoryE

@bkaradzic
Copy link
Owner

@hcomere
Copy link
Contributor Author

hcomere commented Mar 2, 2016

Great, it works well for me !

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants