mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-19 15:01:11 +00:00
Added "-debugrenderdevice" command line argument to write a logfile for the render device
This commit is contained in:
parent
91010eb92f
commit
d597c11e1f
8 changed files with 30 additions and 21 deletions
|
@ -231,6 +231,7 @@ namespace CodeImp.DoomBuilder
|
||||||
private static bool delaymainwindow;
|
private static bool delaymainwindow;
|
||||||
private static bool nosettings;
|
private static bool nosettings;
|
||||||
private static bool portablemode; //mxd
|
private static bool portablemode; //mxd
|
||||||
|
private static bool debugrenderdevice;
|
||||||
|
|
||||||
//misc
|
//misc
|
||||||
private static readonly Random random = new Random(); //mxd
|
private static readonly Random random = new Random(); //mxd
|
||||||
|
@ -275,6 +276,7 @@ namespace CodeImp.DoomBuilder
|
||||||
public static DataLocationList AutoLoadResources { get { return new DataLocationList(autoloadresources); } }
|
public static DataLocationList AutoLoadResources { get { return new DataLocationList(autoloadresources); } }
|
||||||
public static bool DelayMainWindow { get { return delaymainwindow; } }
|
public static bool DelayMainWindow { get { return delaymainwindow; } }
|
||||||
public static bool NoSettings { get { return nosettings; } }
|
public static bool NoSettings { get { return nosettings; } }
|
||||||
|
public static bool DebugRenderDevice { get { return debugrenderdevice; } }
|
||||||
public static EditingManager Editing { get { return editing; } }
|
public static EditingManager Editing { get { return editing; } }
|
||||||
public static ErrorLogger ErrorLogger { get { return errorlogger; } }
|
public static ErrorLogger ErrorLogger { get { return errorlogger; } }
|
||||||
public static string CommitHash { get { return commithash; } } //mxd
|
public static string CommitHash { get { return commithash; } } //mxd
|
||||||
|
@ -956,6 +958,10 @@ namespace CodeImp.DoomBuilder
|
||||||
if(!string.IsNullOrEmpty(dl.location))
|
if(!string.IsNullOrEmpty(dl.location))
|
||||||
autoloadresources.Add(dl);
|
autoloadresources.Add(dl);
|
||||||
}
|
}
|
||||||
|
else if (string.Compare(curarg, "-DEBUGRENDERDEVICE", true) == 0)
|
||||||
|
{
|
||||||
|
debugrenderdevice = true;
|
||||||
|
}
|
||||||
// Every other arg
|
// Every other arg
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -134,7 +134,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
display = (IntPtr)xplatui.GetField("DisplayHandle", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
|
display = (IntPtr)xplatui.GetField("DisplayHandle", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle = RenderDevice_New(display, RenderTarget.Handle);
|
Handle = RenderDevice_New(display, RenderTarget.Handle, General.DebugRenderDevice);
|
||||||
if (Handle == IntPtr.Zero)
|
if (Handle == IntPtr.Zero)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder(4096);
|
StringBuilder sb = new StringBuilder(4096);
|
||||||
|
@ -571,7 +571,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
||||||
IntPtr Handle;
|
IntPtr Handle;
|
||||||
|
|
||||||
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
|
||||||
static extern IntPtr RenderDevice_New(IntPtr display, IntPtr window);
|
static extern IntPtr RenderDevice_New(IntPtr display, IntPtr window, bool debug);
|
||||||
|
|
||||||
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport("BuilderNative", CallingConvention = CallingConvention.Cdecl)]
|
||||||
static extern void RenderDevice_Delete(IntPtr handle);
|
static extern void RenderDevice_Delete(IntPtr handle);
|
||||||
|
|
|
@ -66,9 +66,9 @@ Backend* Backend::Get()
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
RenderDevice* RenderDevice_New(void* disp, void* window)
|
RenderDevice* RenderDevice_New(void* disp, void* window, bool debug)
|
||||||
{
|
{
|
||||||
return Backend::Get()->NewRenderDevice(disp, window);
|
return Backend::Get()->NewRenderDevice(disp, window, debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderDevice_Delete(RenderDevice* device)
|
void RenderDevice_Delete(RenderDevice* device)
|
||||||
|
|
|
@ -133,7 +133,7 @@ public:
|
||||||
|
|
||||||
static Backend* Get();
|
static Backend* Get();
|
||||||
|
|
||||||
virtual RenderDevice* NewRenderDevice(void* disp, void* window) = 0;
|
virtual RenderDevice* NewRenderDevice(void* disp, void* window, bool debug) = 0;
|
||||||
virtual void DeleteRenderDevice(RenderDevice* device) = 0;
|
virtual void DeleteRenderDevice(RenderDevice* device) = 0;
|
||||||
|
|
||||||
virtual VertexBuffer* NewVertexBuffer() = 0;
|
virtual VertexBuffer* NewVertexBuffer() = 0;
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
#include "GLIndexBuffer.h"
|
#include "GLIndexBuffer.h"
|
||||||
#include "GLTexture.h"
|
#include "GLTexture.h"
|
||||||
|
|
||||||
RenderDevice* GLBackend::NewRenderDevice(void* disp, void* window)
|
RenderDevice* GLBackend::NewRenderDevice(void* disp, void* window, bool debug)
|
||||||
{
|
{
|
||||||
GLRenderDevice* device = new GLRenderDevice(disp, window);
|
GLRenderDevice* device = new GLRenderDevice(disp, window, debug);
|
||||||
if (!device->Context)
|
if (!device->Context)
|
||||||
{
|
{
|
||||||
delete device;
|
delete device;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
class GLBackend : public Backend
|
class GLBackend : public Backend
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RenderDevice* NewRenderDevice(void* disp, void* window) override;
|
RenderDevice* NewRenderDevice(void* disp, void* window, bool debug) override;
|
||||||
void DeleteRenderDevice(RenderDevice* device) override;
|
void DeleteRenderDevice(RenderDevice* device) override;
|
||||||
|
|
||||||
VertexBuffer* NewVertexBuffer() override;
|
VertexBuffer* NewVertexBuffer() override;
|
||||||
|
|
|
@ -44,27 +44,30 @@ static const char* GLLogCheckNull(const GLubyte* str)
|
||||||
return str ? (const char*)str : "null";
|
return str ? (const char*)str : "null";
|
||||||
}
|
}
|
||||||
|
|
||||||
GLRenderDevice::GLRenderDevice(void* disp, void* window)
|
GLRenderDevice::GLRenderDevice(void* disp, void* window, bool debug)
|
||||||
{
|
{
|
||||||
Context = IOpenGLContext::Create(disp, window);
|
Context = IOpenGLContext::Create(disp, window);
|
||||||
if (Context)
|
if (Context)
|
||||||
{
|
{
|
||||||
Context->MakeCurrent();
|
Context->MakeCurrent();
|
||||||
|
|
||||||
#ifdef _DEBUG
|
//#ifdef _DEBUG
|
||||||
FILE* f = fopen("OpenGLDebug.log", "wb");
|
if (debug)
|
||||||
if (f)
|
|
||||||
{
|
{
|
||||||
fprintf(f, "GL_VENDOR = %s\r\n", GLLogCheckNull(glGetString(GL_VENDOR)));
|
FILE* f = fopen("OpenGLDebug.log", "wb");
|
||||||
fprintf(f, "GL_RENDERER = %s\r\n", GLLogCheckNull(glGetString(GL_RENDERER)));
|
if (f)
|
||||||
fprintf(f, "GL_VERSION = %s\r\n", GLLogCheckNull(glGetString(GL_VERSION)));
|
{
|
||||||
fprintf(f, "GL_SHADING_LANGUAGE_VERSION = %s\r\n", GLLogCheckNull(glGetString(GL_SHADING_LANGUAGE_VERSION)));
|
fprintf(f, "GL_VENDOR = %s\r\n", GLLogCheckNull(glGetString(GL_VENDOR)));
|
||||||
fclose(f);
|
fprintf(f, "GL_RENDERER = %s\r\n", GLLogCheckNull(glGetString(GL_RENDERER)));
|
||||||
|
fprintf(f, "GL_VERSION = %s\r\n", GLLogCheckNull(glGetString(GL_VERSION)));
|
||||||
|
fprintf(f, "GL_SHADING_LANGUAGE_VERSION = %s\r\n", GLLogCheckNull(glGetString(GL_SHADING_LANGUAGE_VERSION)));
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
glEnable(GL_DEBUG_OUTPUT);
|
glEnable(GL_DEBUG_OUTPUT);
|
||||||
glDebugMessageCallback(&GLLogCallback, nullptr);
|
glDebugMessageCallback(&GLLogCallback, nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
glGenVertexArrays(1, &mStreamVAO);
|
glGenVertexArrays(1, &mStreamVAO);
|
||||||
glGenBuffers(1, &mStreamVertexBuffer);
|
glGenBuffers(1, &mStreamVertexBuffer);
|
||||||
|
|
|
@ -35,7 +35,7 @@ class GLTexture;
|
||||||
class GLRenderDevice : public RenderDevice
|
class GLRenderDevice : public RenderDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLRenderDevice(void* disp, void* window);
|
GLRenderDevice(void* disp, void* window, bool debug);
|
||||||
~GLRenderDevice();
|
~GLRenderDevice();
|
||||||
|
|
||||||
void DeclareUniform(UniformName name, const char* glslname, UniformType type) override;
|
void DeclareUniform(UniformName name, const char* glslname, UniformType type) override;
|
||||||
|
|
Loading…
Reference in a new issue