mirror of https://github.com/xemu-project/xemu.git
Move debug routines and macros to nv2a_debug
This commit is contained in:
parent
725a8e14b6
commit
848eaf2b74
|
@ -2,7 +2,7 @@ obj-y += xbox.o chihiro.o
|
|||
obj-y += xbox_pci.o acpi_xbox.o
|
||||
obj-y += amd_smbus.o smbus_xbox_smc.o smbus_cx25871.o smbus_adm1032.o
|
||||
obj-y += nvnet.o
|
||||
obj-y += nv2a.o nv2a_vsh.o nv2a_psh.o nv2a_shaders.o
|
||||
obj-y += nv2a.o nv2a_vsh.o nv2a_psh.o nv2a_shaders.o nv2a_debug.o
|
||||
obj-y += swizzle.o g-lru-cache.o
|
||||
obj-y += mcpx_apu.o mcpx_aci.o
|
||||
obj-y += lpc47m157.o
|
||||
|
|
|
@ -34,87 +34,10 @@
|
|||
#include "hw/xbox/swizzle.h"
|
||||
#include "hw/xbox/u_format_r11g11b10f.h"
|
||||
#include "hw/xbox/nv2a_shaders.h"
|
||||
#include "hw/xbox/nv2a_debug.h"
|
||||
|
||||
#include "hw/xbox/nv2a.h"
|
||||
|
||||
// #define DEBUG_NV2A
|
||||
#ifdef DEBUG_NV2A
|
||||
# define NV2A_DPRINTF(format, ...) printf("nv2a: " format, ## __VA_ARGS__)
|
||||
#else
|
||||
# define NV2A_DPRINTF(format, ...) do { } while (0)
|
||||
#endif
|
||||
|
||||
// #define DEBUG_NV2A_GL
|
||||
#ifdef DEBUG_NV2A_GL
|
||||
|
||||
static void gl_debug_message(bool cc, const char *fmt, ...)
|
||||
{
|
||||
size_t n;
|
||||
char buffer[1024];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
n = vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
||||
assert(n <= sizeof(buffer));
|
||||
va_end(ap);
|
||||
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER,
|
||||
0, GL_DEBUG_SEVERITY_NOTIFICATION, n, buffer);
|
||||
if (cc) {
|
||||
fwrite(buffer, sizeof(char), n, stdout);
|
||||
fputc('\n', stdout);
|
||||
}
|
||||
}
|
||||
|
||||
static void gl_debug_group_begin(const char *fmt, ...)
|
||||
{
|
||||
size_t n;
|
||||
char buffer[1024];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
n = vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
||||
assert(n <= sizeof(buffer));
|
||||
va_end(ap);
|
||||
|
||||
/* Check for errors before entering group */
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, n, buffer);
|
||||
}
|
||||
|
||||
static void gl_debug_group_end(void)
|
||||
{
|
||||
/* Check for errors when leaving group */
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
glPopDebugGroup();
|
||||
}
|
||||
|
||||
static void gl_debug_label(GLenum target, GLuint name, const char *fmt, ...)
|
||||
{
|
||||
size_t n;
|
||||
char buffer[1024];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
n = vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
||||
assert(n <= sizeof(buffer));
|
||||
va_end(ap);
|
||||
|
||||
glObjectLabel(target, name, n, buffer);
|
||||
}
|
||||
|
||||
# define NV2A_GL_DPRINTF(cc, format, ...) \
|
||||
gl_debug_message(cc, "nv2a: " format, ## __VA_ARGS__)
|
||||
# define NV2A_GL_DGROUP_BEGIN(format, ...) \
|
||||
gl_debug_group_begin("nv2a: " format, ## __VA_ARGS__)
|
||||
# define NV2A_GL_DGROUP_END() \
|
||||
gl_debug_group_end()
|
||||
# define NV2A_GL_DLABEL(target, name, format, ...) \
|
||||
gl_debug_label(target, name, "nv2a: { " format " }", ## __VA_ARGS__)
|
||||
|
||||
#else
|
||||
# define NV2A_GL_DPRINTF(cc, format, ...) do { } while (0)
|
||||
# define NV2A_GL_DGROUP_BEGIN(format, ...) do { } while (0)
|
||||
# define NV2A_GL_DGROUP_END() do { } while (0)
|
||||
# define NV2A_GL_DLABEL(target, name, format, ...) do { } while (0)
|
||||
#endif
|
||||
|
||||
#define USE_TEXTURE_CACHE
|
||||
|
||||
#define NV_NUM_BLOCKS 21
|
||||
|
|
|
@ -22,4 +22,4 @@
|
|||
|
||||
void nv2a_init(PCIBus *bus, int devfn, MemoryRegion *ram);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* QEMU Geforce NV2A debug helpers
|
||||
*
|
||||
* Copyright (c) 2015 Jannik Vogel
|
||||
* Copyright (c) 2012 espes
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 or
|
||||
* (at your option) version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "hw/xbox/nv2a_debug.h"
|
||||
|
||||
#ifdef DEBUG_NV2A_GL
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
|
||||
void gl_debug_message(bool cc, const char *fmt, ...)
|
||||
{
|
||||
size_t n;
|
||||
char buffer[1024];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
n = vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
||||
assert(n <= sizeof(buffer));
|
||||
va_end(ap);
|
||||
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER,
|
||||
0, GL_DEBUG_SEVERITY_NOTIFICATION, n, buffer);
|
||||
if (cc) {
|
||||
fwrite(buffer, sizeof(char), n, stdout);
|
||||
fputc('\n', stdout);
|
||||
}
|
||||
}
|
||||
|
||||
void gl_debug_group_begin(const char *fmt, ...)
|
||||
{
|
||||
size_t n;
|
||||
char buffer[1024];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
n = vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
||||
assert(n <= sizeof(buffer));
|
||||
va_end(ap);
|
||||
|
||||
/* Check for errors before entering group */
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, n, buffer);
|
||||
}
|
||||
|
||||
void gl_debug_group_end(void)
|
||||
{
|
||||
/* Check for errors when leaving group */
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
glPopDebugGroup();
|
||||
}
|
||||
|
||||
void gl_debug_label(GLenum target, GLuint name, const char *fmt, ...)
|
||||
{
|
||||
size_t n;
|
||||
char buffer[1024];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
n = vsnprintf(buffer, sizeof(buffer), fmt, ap);
|
||||
assert(n <= sizeof(buffer));
|
||||
va_end(ap);
|
||||
|
||||
glObjectLabel(target, name, n, buffer);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* QEMU Geforce NV2A debug helpers
|
||||
*
|
||||
* Copyright (c) 2015 Jannik Vogel
|
||||
* Copyright (c) 2012 espes
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 or
|
||||
* (at your option) version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef HW_NV2A_DEBUG_H
|
||||
#define HW_NV2A_DEBUG_H
|
||||
|
||||
// #define DEBUG_NV2A
|
||||
#ifdef DEBUG_NV2A
|
||||
# define NV2A_DPRINTF(format, ...) printf("nv2a: " format, ## __VA_ARGS__)
|
||||
#else
|
||||
# define NV2A_DPRINTF(format, ...) do { } while (0)
|
||||
#endif
|
||||
|
||||
// #define DEBUG_NV2A_GL
|
||||
#ifdef DEBUG_NV2A_GL
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "gl/gloffscreen.h"
|
||||
|
||||
void gl_debug_message(bool cc, const char *fmt, ...);
|
||||
void gl_debug_group_begin(const char *fmt, ...);
|
||||
void gl_debug_group_end(void);
|
||||
void gl_debug_label(GLenum target, GLuint name, const char *fmt, ...);
|
||||
|
||||
# define NV2A_GL_DPRINTF(cc, format, ...) \
|
||||
gl_debug_message(cc, "nv2a: " format, ## __VA_ARGS__)
|
||||
# define NV2A_GL_DGROUP_BEGIN(format, ...) \
|
||||
gl_debug_group_begin("nv2a: " format, ## __VA_ARGS__)
|
||||
# define NV2A_GL_DGROUP_END() \
|
||||
gl_debug_group_end()
|
||||
# define NV2A_GL_DLABEL(target, name, format, ...) \
|
||||
gl_debug_label(target, name, "nv2a: { " format " }", ## __VA_ARGS__)
|
||||
|
||||
#else
|
||||
# define NV2A_GL_DPRINTF(cc, format, ...) do { } while (0)
|
||||
# define NV2A_GL_DGROUP_BEGIN(format, ...) do { } while (0)
|
||||
# define NV2A_GL_DGROUP_END() do { } while (0)
|
||||
# define NV2A_GL_DLABEL(target, name, format, ...) do { } while (0)
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -19,16 +19,10 @@
|
|||
*/
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "hw/xbox/nv2a_debug.h"
|
||||
#include "hw/xbox/nv2a_shaders_common.h"
|
||||
#include "hw/xbox/nv2a_shaders.h"
|
||||
|
||||
// #define NV2A_DEBUG
|
||||
#ifdef NV2A_DEBUG
|
||||
# define NV2A_DPRINTF(format, ...) printf("nv2a: " format, ## __VA_ARGS__)
|
||||
#else
|
||||
# define NV2A_DPRINTF(format, ...) do { } while (0)
|
||||
#endif
|
||||
|
||||
static void generate_geometry_shader_pass_vertex(QString* s, const char* v)
|
||||
{
|
||||
qstring_append_fmt(s, " gl_Position = gl_in[%s].gl_Position;\n", v);
|
||||
|
|
Loading…
Reference in New Issue