mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
Added destroy shaders option when creating program.
This commit is contained in:
parent
877621105d
commit
7884a72df2
2 changed files with 15 additions and 5 deletions
|
@ -835,10 +835,12 @@ namespace bgfx
|
|||
///
|
||||
/// @param _vsh Vertex shader.
|
||||
/// @param _fsh Fragment shader.
|
||||
/// @param _destroyShaders If true, shaders will be destroyed when
|
||||
/// program is destroyed.
|
||||
/// @returns Program handle if vertex shader output and fragment shader
|
||||
/// input are matching, otherwise returns invalid program handle.
|
||||
///
|
||||
ProgramHandle createProgram(VertexShaderHandle _vsh, FragmentShaderHandle _fsh);
|
||||
ProgramHandle createProgram(VertexShaderHandle _vsh, FragmentShaderHandle _fsh, bool _destroyShaders = false);
|
||||
|
||||
/// Destroy program.
|
||||
void destroyProgram(ProgramHandle _handle);
|
||||
|
@ -974,8 +976,8 @@ namespace bgfx
|
|||
///
|
||||
/// @param _num Number of texture attachments.
|
||||
/// @param _handles Texture attachments.
|
||||
/// @param _destroyTextures Destroy textures when frame buffer is
|
||||
/// destroyed.
|
||||
/// @param _destroyTextures If true, textures will be destroyed when
|
||||
/// frame buffer is destroyed.
|
||||
///
|
||||
FrameBufferHandle createFrameBuffer(uint8_t _num, TextureHandle* _handles, bool _destroyTextures = false);
|
||||
|
||||
|
|
12
src/bgfx.cpp
12
src/bgfx.cpp
|
@ -1856,10 +1856,18 @@ namespace bgfx
|
|||
s_ctx->destroyFragmentShader(_handle);
|
||||
}
|
||||
|
||||
ProgramHandle createProgram(VertexShaderHandle _vsh, FragmentShaderHandle _fsh)
|
||||
ProgramHandle createProgram(VertexShaderHandle _vsh, FragmentShaderHandle _fsh, bool _destroyShaders)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
return s_ctx->createProgram(_vsh, _fsh);
|
||||
ProgramHandle handle = s_ctx->createProgram(_vsh, _fsh);
|
||||
|
||||
if (_destroyShaders)
|
||||
{
|
||||
destroyVertexShader(_vsh);
|
||||
destroyFragmentShader(_fsh);
|
||||
}
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
void destroyProgram(ProgramHandle _handle)
|
||||
|
|
Loading…
Reference in a new issue