Merge branch 'master' of github.com:bkaradzic/bgfx

This commit is contained in:
Branimir Karadžić 2015-02-17 11:50:38 -08:00
commit b8d065da79
15 changed files with 40 additions and 59 deletions

View file

@ -495,6 +495,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
break;
case bgfx::RendererType::Direct3D11:
case bgfx::RendererType::Direct3D12:
vs_metaballs = bgfx::makeRef(vs_metaballs_dx11, sizeof(vs_metaballs_dx11) );
fs_metaballs = bgfx::makeRef(fs_metaballs_dx11, sizeof(fs_metaballs_dx11) );
break;

View file

@ -146,7 +146,6 @@ static const uint16_t s_planeIndices[] =
1, 3, 2,
};
static const char* s_shaderPath = NULL;
static bool s_flipV = false;
static uint32_t s_viewMask = 0;
static uint32_t s_clearMask = 0;
@ -857,23 +856,12 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// for each renderer.
switch (bgfx::getRendererType() )
{
default:
case bgfx::RendererType::Direct3D9:
s_shaderPath = "shaders/dx9/";
break;
case bgfx::RendererType::Direct3D11:
s_shaderPath = "shaders/dx11/";
break;
case bgfx::RendererType::OpenGL:
s_shaderPath = "shaders/glsl/";
case bgfx::RendererType::OpenGLES:
s_flipV = true;
break;
case bgfx::RendererType::OpenGLES:
s_shaderPath = "shaders/gles/";
s_flipV = true;
default:
break;
}

View file

@ -111,7 +111,6 @@ static const uint16_t s_planeIndices[] =
1, 3, 2,
};
static const char* s_shaderPath = NULL;
static bool s_oglNdc = false;
static float s_texelHalf = 0.0f;
@ -1872,24 +1871,16 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// for each renderer.
switch (bgfx::getRendererType() )
{
default:
case bgfx::RendererType::Direct3D9:
s_shaderPath = "shaders/dx9/";
s_texelHalf = 0.5f;
break;
case bgfx::RendererType::Direct3D11:
s_shaderPath = "shaders/dx11/";
break;
case bgfx::RendererType::OpenGL:
s_shaderPath = "shaders/glsl/";
case bgfx::RendererType::OpenGLES:
s_oglNdc = true;
break;
case bgfx::RendererType::OpenGLES:
s_shaderPath = "shaders/gles/";
s_oglNdc = true;
default:
break;
}

View file

@ -220,7 +220,6 @@ static const uint16_t s_planeIndices[] =
1, 3, 2,
};
static const char* s_shaderPath = NULL;
static bool s_flipV = false;
static float s_texelHalf = 0.0f;
@ -1333,24 +1332,16 @@ int _main_(int /*_argc*/, char** /*_argv*/)
// for each renderer.
switch (bgfx::getRendererType() )
{
default:
case bgfx::RendererType::Direct3D9:
s_shaderPath = "shaders/dx9/";
s_texelHalf = 0.5f;
break;
case bgfx::RendererType::Direct3D11:
s_shaderPath = "shaders/dx11/";
break;
case bgfx::RendererType::OpenGL:
s_shaderPath = "shaders/glsl/";
case bgfx::RendererType::OpenGLES:
s_flipV = true;
break;
case bgfx::RendererType::OpenGLES:
s_shaderPath = "shaders/gles/";
s_flipV = true;
default:
break;
}

View file

@ -280,6 +280,7 @@ int _main_(int /*_argc*/, char** /*_argv*/)
break;
case bgfx::RendererType::Direct3D11:
case bgfx::RendererType::Direct3D12:
vs_drawstress = bgfx::makeRef(vs_drawstress_dx11, sizeof(vs_drawstress_dx11) );
fs_drawstress = bgfx::makeRef(fs_drawstress_dx11, sizeof(fs_drawstress_dx11) );
break;

View file

@ -71,6 +71,7 @@ static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name
switch (bgfx::getRendererType() )
{
case bgfx::RendererType::Direct3D11:
case bgfx::RendererType::Direct3D12:
shaderPath = "shaders/dx11/";
break;

View file

@ -326,6 +326,7 @@ void Atlas::init()
break;
case bgfx::RendererType::Direct3D11:
case bgfx::RendererType::Direct3D12:
m_texelOffset[0] = texelHalf;
m_texelOffset[1] = texelHalf;
break;

View file

@ -575,6 +575,7 @@ TextBufferManager::TextBufferManager(FontManager* _fontManager)
break;
case bgfx::RendererType::Direct3D11:
case bgfx::RendererType::Direct3D12:
vs_font_basic = bgfx::makeRef(vs_font_basic_dx11, sizeof(vs_font_basic_dx11) );
fs_font_basic = bgfx::makeRef(fs_font_basic_dx11, sizeof(fs_font_basic_dx11) );
vs_font_distance_field = bgfx::makeRef(vs_font_distance_field_dx11, sizeof(vs_font_distance_field_dx11) );

View file

@ -518,6 +518,7 @@ struct Imgui
break;
case bgfx::RendererType::Direct3D11:
case bgfx::RendererType::Direct3D12:
vs_imgui_color = bgfx::makeRef(vs_imgui_color_dx11, sizeof(vs_imgui_color_dx11) );
fs_imgui_color = bgfx::makeRef(fs_imgui_color_dx11, sizeof(fs_imgui_color_dx11) );
vs_imgui_texture = bgfx::makeRef(vs_imgui_texture_dx11, sizeof(vs_imgui_texture_dx11) );

View file

@ -99,6 +99,7 @@ struct OcornutImguiContext
break;
case bgfx::RendererType::Direct3D11:
case bgfx::RendererType::Direct3D12:
vsmem = bgfx::makeRef(vs_ocornut_imgui_dx11, sizeof(vs_ocornut_imgui_dx11));
fsmem = bgfx::makeRef(fs_ocornut_imgui_dx11, sizeof(fs_ocornut_imgui_dx11));
break;

View file

@ -239,6 +239,7 @@ namespace
break;
case bgfx::RendererType::Direct3D11:
case bgfx::RendererType::Direct3D12:
vs_nanovg_fill = bgfx::makeRef(vs_nanovg_fill_dx11, sizeof(vs_nanovg_fill_dx11) );
fs_nanovg_fill = bgfx::makeRef(fs_nanovg_fill_dx11, sizeof(fs_nanovg_fill_dx11) );
break;

View file

@ -725,7 +725,7 @@ BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_hand
* @param _num Number of vertices.
* @param _decl Vertex declaration.
*/
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint16_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags);
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags);
/**
* Create dynamic vertex buffer and initialize it.
@ -816,7 +816,7 @@ BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_
* NOTE:
* Only 16-bit index buffer is supported.
*/
BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint16_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint16_t _numIndices);
BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices);
/**
* Allocate instance data buffer.

View file

@ -687,7 +687,7 @@ namespace bgfx
/// When buffer is created with `BGFX_BUFFER_COMPUTE_WRITE` flag it cannot be updated
/// from CPU.
///
DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl, uint8_t _flags = BGFX_BUFFER_NONE);
DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint8_t _flags = BGFX_BUFFER_NONE);
/// Create dynamic vertex buffer and initialize it.
///
@ -766,7 +766,7 @@ namespace bgfx
/// @remarks
/// Only 16-bit index buffer is supported.
///
bool allocTransientBuffers(TransientVertexBuffer* _tvb, const VertexDecl& _decl, uint16_t _numVertices, TransientIndexBuffer* _tib, uint16_t _numIndices);
bool allocTransientBuffers(TransientVertexBuffer* _tvb, const VertexDecl& _decl, uint32_t _numVertices, TransientIndexBuffer* _tib, uint32_t _numIndices);
/// Allocate instance data buffer.
///

View file

@ -355,6 +355,7 @@ namespace bgfx
break;
case RendererType::Direct3D11:
case RendererType::Direct3D12:
mem = makeRef(vs_debugfont_dx11, sizeof(vs_debugfont_dx11) );
break;
@ -372,6 +373,7 @@ namespace bgfx
break;
case RendererType::Direct3D11:
case RendererType::Direct3D12:
mem = makeRef(fs_debugfont_dx11, sizeof(fs_debugfont_dx11) );
break;
@ -552,7 +554,8 @@ namespace bgfx
fragMem[ii] = makeRef(mem[ii].data, uint32_t(mem[ii].size) );
}
}
else if (RendererType::Direct3D11 == g_caps.rendererType)
else if (RendererType::Direct3D11 == g_caps.rendererType
|| RendererType::Direct3D12 == g_caps.rendererType)
{
vsh = createShader(makeRef(vs_clear_dx11, sizeof(vs_clear_dx11) ) );
@ -1928,7 +1931,7 @@ again:
uint8_t num = 0;
for (uint8_t ii = 0; ii < uint8_t(RendererType::Count); ++ii)
{
if (RendererType::Direct3D11 == ii
if ( (RendererType::Direct3D11 == ii || RendererType::Direct3D12 == ii)
&& windowsVersionIs(Condition::LessEqual, 0x0502) )
{
continue;
@ -2163,7 +2166,7 @@ again:
s_ctx->destroyDynamicIndexBuffer(_handle);
}
DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl, uint8_t _flags)
DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint8_t _flags)
{
BGFX_CHECK_MAIN_THREAD();
BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
@ -2239,7 +2242,7 @@ again:
return s_ctx->allocTransientVertexBuffer(_tvb, _num, _decl);
}
bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexDecl& _decl, uint16_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint16_t _numIndices)
bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexDecl& _decl, uint32_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint32_t _numIndices)
{
if (checkAvailTransientBuffers(_numVertices, _decl, _numIndices) )
{
@ -3097,7 +3100,7 @@ BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_hand
bgfx::destroyDynamicIndexBuffer(handle.cpp);
}
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint16_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags)
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl, uint8_t _flags)
{
const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle;
@ -3158,7 +3161,7 @@ BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_
bgfx::allocTransientVertexBuffer( (bgfx::TransientVertexBuffer*)_tvb, _num, decl);
}
BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint16_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint16_t _numIndices)
BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices)
{
const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
return bgfx::allocTransientBuffers( (bgfx::TransientVertexBuffer*)_tvb, decl, _numVertices, (bgfx::TransientIndexBuffer*)_tib, _numIndices);

View file

@ -2178,7 +2178,7 @@ namespace bgfx
return ptr;
}
BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl, uint8_t _flags) )
BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(uint32_t _num, const VertexDecl& _decl, uint8_t _flags) )
{
DynamicVertexBufferHandle handle = BGFX_INVALID_HANDLE;
uint32_t size = strideAlign16( (_num+1)*_decl.m_stride, _decl.m_stride);