summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/common/bgfx_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/common/bgfx_utils.cpp')
-rw-r--r--3rdparty/bgfx/examples/common/bgfx_utils.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/3rdparty/bgfx/examples/common/bgfx_utils.cpp b/3rdparty/bgfx/examples/common/bgfx_utils.cpp
index 9b03d3d70b9..8de8bf30964 100644
--- a/3rdparty/bgfx/examples/common/bgfx_utils.cpp
+++ b/3rdparty/bgfx/examples/common/bgfx_utils.cpp
@@ -389,7 +389,7 @@ struct Group
namespace bgfx
{
- int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl);
+ int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl, bx::Error* _err = NULL);
}
struct Mesh
@@ -540,17 +540,16 @@ struct Mesh
;
}
- uint32_t cached = bgfx::setTransform(_mtx);
+ bgfx::setTransform(_mtx);
+ bgfx::setState(_state);
for (GroupArray::const_iterator it = m_groups.begin(), itEnd = m_groups.end(); it != itEnd; ++it)
{
const Group& group = *it;
- bgfx::setTransform(cached);
bgfx::setIndexBuffer(group.m_ibh);
bgfx::setVertexBuffer(group.m_vbh);
- bgfx::setState(_state);
- bgfx::submit(_id, _program);
+ bgfx::submit(_id, _program, 0, it != itEnd-1);
}
}
@@ -560,26 +559,28 @@ struct Mesh
for (uint32_t pass = 0; pass < _numPasses; ++pass)
{
+ bgfx::setTransform(cached, _numMatrices);
+
const MeshState& state = *_state[pass];
+ bgfx::setState(state.m_state);
+
+ for (uint8_t tex = 0; tex < state.m_numTextures; ++tex)
+ {
+ const MeshState::Texture& texture = state.m_textures[tex];
+ bgfx::setTexture(texture.m_stage
+ , texture.m_sampler
+ , texture.m_texture
+ , texture.m_flags
+ );
+ }
for (GroupArray::const_iterator it = m_groups.begin(), itEnd = m_groups.end(); it != itEnd; ++it)
{
const Group& group = *it;
- bgfx::setTransform(cached, _numMatrices);
- for (uint8_t tex = 0; tex < state.m_numTextures; ++tex)
- {
- const MeshState::Texture& texture = state.m_textures[tex];
- bgfx::setTexture(texture.m_stage
- , texture.m_sampler
- , texture.m_texture
- , texture.m_flags
- );
- }
bgfx::setIndexBuffer(group.m_ibh);
bgfx::setVertexBuffer(group.m_vbh);
- bgfx::setState(state.m_state);
- bgfx::submit(state.m_viewId, state.m_program);
+ bgfx::submit(state.m_viewId, state.m_program, 0, it != itEnd-1);
}
}
}
@@ -646,10 +647,13 @@ Args::Args(int _argc, char** _argv)
{
m_type = bgfx::RendererType::OpenGL;
}
- else if (cmdLine.hasArg("noop")
- || cmdLine.hasArg("vk") )
+ else if (cmdLine.hasArg("vk") )
{
- m_type = bgfx::RendererType::OpenGL;
+ m_type = bgfx::RendererType::Vulkan;
+ }
+ else if (cmdLine.hasArg("noop") )
+ {
+ m_type = bgfx::RendererType::Null;
}
else if (BX_ENABLED(BX_PLATFORM_WINDOWS) )
{