mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-18 21:13:02 +01:00
GL: Added support for texture array.
This commit is contained in:
23
src/bgfx.cpp
23
src/bgfx.cpp
@@ -1101,6 +1101,8 @@ namespace bgfx
|
||||
CAPS_FLAGS(BGFX_CAPS_OCCLUSION_QUERY),
|
||||
CAPS_FLAGS(BGFX_CAPS_ALPHA_TO_COVERAGE),
|
||||
CAPS_FLAGS(BGFX_CAPS_CONSERVATIVE_RASTER),
|
||||
CAPS_FLAGS(BGFX_CAPS_TEXTURE_2D_ARRAY),
|
||||
CAPS_FLAGS(BGFX_CAPS_TEXTURE_CUBE_ARRAY),
|
||||
#undef CAPS_FLAGS
|
||||
};
|
||||
|
||||
@@ -2977,7 +2979,7 @@ error:
|
||||
tc.m_width = _width;
|
||||
tc.m_height = _height;
|
||||
tc.m_depth = 0;
|
||||
tc.m_numLayers = 1;
|
||||
tc.m_numLayers = _numLayers;
|
||||
tc.m_numMips = numMips;
|
||||
tc.m_format = _format;
|
||||
tc.m_cubeMap = false;
|
||||
@@ -3076,7 +3078,7 @@ error:
|
||||
tc.m_width = _size;
|
||||
tc.m_height = _size;
|
||||
tc.m_depth = 0;
|
||||
tc.m_numLayers = 1;
|
||||
tc.m_numLayers = _numLayers;
|
||||
tc.m_numMips = numMips;
|
||||
tc.m_format = _format;
|
||||
tc.m_cubeMap = true;
|
||||
@@ -3092,7 +3094,7 @@ error:
|
||||
s_ctx->destroyTexture(_handle);
|
||||
}
|
||||
|
||||
void updateTexture2D(TextureHandle _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
|
||||
void updateTexture2D(TextureHandle _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(NULL != _mem, "_mem can't be NULL");
|
||||
@@ -3103,7 +3105,7 @@ error:
|
||||
}
|
||||
else
|
||||
{
|
||||
s_ctx->updateTexture(_handle, 0, _mip, _x, _y, 0, _width, _height, 1, _pitch, _mem);
|
||||
s_ctx->updateTexture(_handle, 0, _mip, _x, _y, _layer, _width, _height, 1, _pitch, _mem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3125,7 +3127,7 @@ error:
|
||||
}
|
||||
}
|
||||
|
||||
void updateTextureCube(TextureHandle _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
|
||||
void updateTextureCube(TextureHandle _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
|
||||
{
|
||||
BGFX_CHECK_MAIN_THREAD();
|
||||
BX_CHECK(NULL != _mem, "_mem can't be NULL");
|
||||
@@ -3137,7 +3139,7 @@ error:
|
||||
}
|
||||
else
|
||||
{
|
||||
s_ctx->updateTexture(_handle, _side, _mip, _x, _y, 0, _width, _height, 1, _pitch, _mem);
|
||||
s_ctx->updateTexture(_handle, _side, _mip, _x, _y, _layer, _width, _height, 1, _pitch, _mem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4186,10 +4188,10 @@ BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _
|
||||
return handle.c;
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
|
||||
BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
|
||||
{
|
||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
||||
bgfx::updateTexture2D(handle.cpp, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
|
||||
bgfx::updateTexture2D(handle.cpp, _layer, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem)
|
||||
@@ -4198,10 +4200,10 @@ BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _m
|
||||
bgfx::updateTexture3D(handle.cpp, _mip, _x, _y, _z, _width, _height, _depth, (const bgfx::Memory*)_mem);
|
||||
}
|
||||
|
||||
BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
|
||||
BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
|
||||
{
|
||||
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
|
||||
bgfx::updateTextureCube(handle.cpp, _side, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
|
||||
bgfx::updateTextureCube(handle.cpp, _layer, _side, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
|
||||
}
|
||||
|
||||
BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data)
|
||||
@@ -4650,6 +4652,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
|
||||
BGFX_IMPORT_FUNC(set_debug) \
|
||||
BGFX_IMPORT_FUNC(dbg_text_clear) \
|
||||
BGFX_IMPORT_FUNC(dbg_text_printf) \
|
||||
BGFX_IMPORT_FUNC(dbg_text_vprintf) \
|
||||
BGFX_IMPORT_FUNC(dbg_text_image) \
|
||||
BGFX_IMPORT_FUNC(create_index_buffer) \
|
||||
BGFX_IMPORT_FUNC(destroy_index_buffer) \
|
||||
|
||||
Reference in New Issue
Block a user