Browse Source

gpu: avoid unnecessary OpenGL context changes.

undefined
Sam Hocevar 11 years ago
parent
commit
ccc9369660
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      src/scene.cpp

+ 8
- 3
src/scene.cpp View File

@@ -190,13 +190,14 @@ Array<Light *> const &Scene::GetLights() const
void Scene::Render() // XXX: rename to Blit()
{
RenderContext rc;
rc.SetDepthFunc(DepthFunc::LessOrEqual);
rc.SetBlendFunc(BlendFunc::SrcAlpha, BlendFunc::OneMinusSrcAlpha);
rc.SetAlphaFunc(AlphaFunc::GreaterOrEqual, 0.01f);

/* Early test if nothing needs to be rendered */
if (data->m_tiles.Count())
{
rc.SetDepthFunc(DepthFunc::LessOrEqual);
rc.SetBlendFunc(BlendFunc::SrcAlpha, BlendFunc::OneMinusSrcAlpha);
rc.SetAlphaFunc(AlphaFunc::GreaterOrEqual, 0.01f);

PushCamera(data->m_default_cam);

#if defined USE_D3D9 || defined _XBOX
@@ -295,6 +296,10 @@ void Scene::Render() // XXX: rename to Blit()

if (data->m_lines.Count())
{
rc.SetDepthFunc(DepthFunc::LessOrEqual);
rc.SetBlendFunc(BlendFunc::SrcAlpha, BlendFunc::OneMinusSrcAlpha);
rc.SetAlphaFunc(AlphaFunc::GreaterOrEqual, 0.01f);

int linecount = data->m_lines.Count();

if (!data->m_line_shader)


Loading…
Cancel
Save