From caa637dbd5d6a532ff3a7ea66d6eb98043d26810 Mon Sep 17 00:00:00 2001 From: Francis Hart Date: Mon, 27 Feb 2023 17:10:53 +0200 Subject: [PATCH] Expose nvgCreateBgfxTexture() helper function (#3046) The nvgCreateBgfxTexture() helper function is already implemented in the nanovg wrapper library, so its useful to expose this function to the user. Also expose the NVG_IMAGE_NODELETE flag so this can be passed to the nvgCreateBgfxTexture() function, to indicate that the caller retains ownership of the bgfx texture. --- examples/common/nanovg/nanovg_bgfx.cpp | 5 ----- examples/common/nanovg/nanovg_bgfx.h | 8 ++++++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/common/nanovg/nanovg_bgfx.cpp b/examples/common/nanovg/nanovg_bgfx.cpp index 8eeb8570a..c7626f949 100644 --- a/examples/common/nanovg/nanovg_bgfx.cpp +++ b/examples/common/nanovg/nanovg_bgfx.cpp @@ -58,11 +58,6 @@ namespace NSVG_SHADER_IMG }; - // These are additional flags on top of NVGimageFlags. - enum NVGimageFlagsGL { - NVG_IMAGE_NODELETE = 1<<16, // Do not delete GL texture handle. - }; - struct GLNVGtexture { bgfx::TextureHandle id; diff --git a/examples/common/nanovg/nanovg_bgfx.h b/examples/common/nanovg/nanovg_bgfx.h index 78257930a..a0beb9261 100644 --- a/examples/common/nanovg/nanovg_bgfx.h +++ b/examples/common/nanovg/nanovg_bgfx.h @@ -20,6 +20,11 @@ struct NVGLUframebuffer bgfx::ViewId viewId; }; +// These are additional flags on top of NVGimageFlags. +enum NVGimageFlagsGL { + NVG_IMAGE_NODELETE = 1<<16, // Do not delete GL texture handle. +}; + /// NVGcontext* nvgCreate(int32_t _edgeaa, bgfx::ViewId _viewId, bx::AllocatorI* _allocator); @@ -76,4 +81,7 @@ void nvgluDeleteFramebuffer(NVGLUframebuffer* _framebuffer); /// void nvgluSetViewFramebuffer(bgfx::ViewId _viewId, NVGLUframebuffer* _framebuffer); +/// +int nvgCreateBgfxTexture(struct NVGcontext *_ctx, bgfx::TextureHandle _id, int _width, int _height, int _flags); + #endif // NANOVG_BGFX_H_HEADER_GUARD