浏览代码

gpu: make the GL errors non-fatal but still log an error.

legacy
Sam Hocevar 5 年前
父节点
当前提交
aa0cf5a218
共有 7 个文件被更改,包括 68 次插入3 次删除
  1. +2
    -2
      src/Makefile.am
  2. +26
    -0
      src/gpu/debug.cpp
  3. +2
    -0
      src/lol-core.vcxproj
  4. +6
    -0
      src/lol-core.vcxproj.filters
  5. +1
    -0
      src/lol/gpu/all.h
  6. +26
    -0
      src/lol/gpu/debug.h
  7. +5
    -1
      src/lolgl.h

+ 2
- 2
src/Makefile.am 查看文件

@@ -63,7 +63,7 @@ liblol_core_headers = \
lol/gpu/all.h \
lol/gpu/shader.h lol/gpu/indexbuffer.h lol/gpu/vertexbuffer.h \
lol/gpu/framebuffer.h lol/gpu/texture.h lol/gpu/lolfx.h \
lol/gpu/renderer.h lol/gpu/rendercontext.h \
lol/gpu/renderer.h lol/gpu/rendercontext.h lol/gpu/debug.h \
\
lol/debug/all.h \
lol/debug/lines.h
@@ -95,7 +95,7 @@ liblol_core_sources = \
\
gpu/shader.cpp gpu/indexbuffer.cpp gpu/vertexbuffer.cpp \
gpu/framebuffer.cpp gpu/texture.cpp gpu/renderer.cpp \
gpu/rendercontext.cpp \
gpu/rendercontext.cpp gpu/debug.cpp \
\
audio/audio.cpp audio/sample.cpp \
\


+ 26
- 0
src/gpu/debug.cpp 查看文件

@@ -0,0 +1,26 @@
//
// Lol Engine
//
// Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//

#include <lol/engine-internal.h>

#include "lolgl.h"

namespace lol
{

void gpu::error(char const *msg, int error)
{
msg::error("%s: GL error 0x%04x\n", msg, error);
}

}


+ 2
- 0
src/lol-core.vcxproj 查看文件

@@ -129,6 +129,7 @@
<ClCompile Include="engine\worldentity.cpp" />
<ClCompile Include="emitter.cpp" />
<ClCompile Include="font.cpp" />
<ClCompile Include="gpu\debug.cpp" />
<ClCompile Include="gpu\framebuffer.cpp" />
<ClCompile Include="gpu\indexbuffer.cpp" />
<ClCompile Include="gpu\lolfx.cpp" />
@@ -261,6 +262,7 @@
<ClInclude Include="lol\engine-internal.h" />
<ClInclude Include="lol\extras.h" />
<ClInclude Include="lol\gpu\all.h" />
<ClInclude Include="lol\gpu\debug.h" />
<ClInclude Include="lol\gpu\framebuffer.h" />
<ClInclude Include="lol\gpu\indexbuffer.h" />
<ClInclude Include="lol\gpu\lolfx.h" />


+ 6
- 0
src/lol-core.vcxproj.filters 查看文件

@@ -79,6 +79,9 @@
</ClCompile>
<ClCompile Include="emitter.cpp" />
<ClCompile Include="font.cpp" />
<ClCompile Include="gpu\debug.cpp">
<Filter>gpu</Filter>
</ClCompile>
<ClCompile Include="gpu\framebuffer.cpp">
<Filter>gpu</Filter>
</ClCompile>
@@ -387,6 +390,9 @@
<ClInclude Include="lol\gpu\all.h">
<Filter>lol\gpu</Filter>
</ClInclude>
<ClInclude Include="lol\gpu\debug.h">
<Filter>lol\gpu</Filter>
</ClInclude>
<ClInclude Include="lol\gpu\framebuffer.h">
<Filter>lol\gpu</Filter>
</ClInclude>


+ 1
- 0
src/lol/gpu/all.h 查看文件

@@ -10,6 +10,7 @@

#pragma once

#include <lol/gpu/debug.h>
#include <lol/gpu/shader.h>
#include <lol/gpu/indexbuffer.h>
#include <lol/gpu/vertexbuffer.h>


+ 26
- 0
src/lol/gpu/debug.h 查看文件

@@ -0,0 +1,26 @@
//
// Lol Engine
//
// Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//

#pragma once

namespace lol
{

namespace gpu
{

void error(char const *msg, int error);

} // namespace gpu

} // namespace lol


+ 5
- 1
src/lolgl.h 查看文件

@@ -61,9 +61,13 @@
# endif
#endif

#define LOL_STRINGIFY_INNER(n) #n
#define LOL_STRINGIFY(n) LOL_STRINGIFY_INNER(n)

#define LOL_CHECK_GLERROR() \
{ \
GLenum error = glGetError(); \
ASSERT(error == GL_NO_ERROR, "OpenGL error: 0x%04x\n", error); \
if (error != GL_NO_ERROR) \
lol::gpu::error(__FILE__ ":" LOL_STRINGIFY(__LINE__), (int)error); \
}


正在加载...
取消
保存