|
@@ -1229,6 +1229,61 @@ NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* _ctx, int32_t _width, int32
|
|
|
return framebuffer;
|
|
return framebuffer;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int32_t imageFlags, bgfx::ViewId viewId)
|
|
|
|
|
+{
|
|
|
|
|
+ NVGLUframebuffer* framebuffer = nvgluCreateFramebuffer(ctx, imageFlags);
|
|
|
|
|
+
|
|
|
|
|
+ if (framebuffer != NULL)
|
|
|
|
|
+ {
|
|
|
|
|
+ nvgluSetViewFramebuffer(viewId, framebuffer);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return framebuffer;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* _ctx, int32_t _imageFlags)
|
|
|
|
|
+{
|
|
|
|
|
+ BX_UNUSED(_imageFlags);
|
|
|
|
|
+ bgfx::TextureHandle textures[] =
|
|
|
|
|
+ {
|
|
|
|
|
+ bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::RGBA8, BGFX_TEXTURE_RT),
|
|
|
|
|
+ bgfx::createTexture2D(bgfx::BackbufferRatio::Equal, false, 1, bgfx::TextureFormat::D24S8, BGFX_TEXTURE_RT | BGFX_TEXTURE_RT_WRITE_ONLY)
|
|
|
|
|
+ };
|
|
|
|
|
+ bgfx::FrameBufferHandle fbh = bgfx::createFrameBuffer(
|
|
|
|
|
+ BX_COUNTOF(textures)
|
|
|
|
|
+ , textures
|
|
|
|
|
+ , true
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ if (!bgfx::isValid(fbh) )
|
|
|
|
|
+ {
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ struct NVGparams* params = nvgInternalParams(_ctx);
|
|
|
|
|
+ struct GLNVGcontext* gl = (struct GLNVGcontext*)params->userPtr;
|
|
|
|
|
+ struct GLNVGtexture* tex = glnvg__allocTexture(gl);
|
|
|
|
|
+
|
|
|
|
|
+ if (NULL == tex)
|
|
|
|
|
+ {
|
|
|
|
|
+ bgfx::destroy(fbh);
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ tex->width = 0;
|
|
|
|
|
+ tex->height = 0;
|
|
|
|
|
+ tex->type = NVG_TEXTURE_RGBA;
|
|
|
|
|
+ tex->flags = _imageFlags | NVG_IMAGE_PREMULTIPLIED;
|
|
|
|
|
+ tex->id = bgfx::getTexture(fbh);
|
|
|
|
|
+
|
|
|
|
|
+ NVGLUframebuffer* framebuffer = BX_NEW(gl->allocator, NVGLUframebuffer);
|
|
|
|
|
+ framebuffer->ctx = _ctx;
|
|
|
|
|
+ framebuffer->image = tex->id.idx;
|
|
|
|
|
+ framebuffer->handle = fbh;
|
|
|
|
|
+
|
|
|
|
|
+ return framebuffer;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
void nvgluBindFramebuffer(NVGLUframebuffer* _framebuffer)
|
|
void nvgluBindFramebuffer(NVGLUframebuffer* _framebuffer)
|
|
|
{
|
|
{
|
|
|
static NVGcontext* s_prevCtx = NULL;
|
|
static NVGcontext* s_prevCtx = NULL;
|