mirror of https://github.com/bjornbytes/lovr.git
Improve graphics error handling;
This commit is contained in:
parent
0d4d7bc0e3
commit
6f16385fa1
|
@ -1352,7 +1352,7 @@ void gpu_pipeline_destroy(gpu_pipeline* pipeline) {
|
||||||
|
|
||||||
gpu_stream* gpu_stream_begin(const char* label) {
|
gpu_stream* gpu_stream_begin(const char* label) {
|
||||||
gpu_tick* tick = &state.ticks[state.tick[CPU] & TICK_MASK];
|
gpu_tick* tick = &state.ticks[state.tick[CPU] & TICK_MASK];
|
||||||
CHECK(state.streamCount < COUNTOF(tick->streams), "Too many streams") return NULL;
|
CHECK(state.streamCount < COUNTOF(tick->streams), "Too many passes") return NULL;
|
||||||
gpu_stream* stream = &tick->streams[state.streamCount];
|
gpu_stream* stream = &tick->streams[state.streamCount];
|
||||||
nickname(stream->commands, VK_OBJECT_TYPE_COMMAND_BUFFER, label);
|
nickname(stream->commands, VK_OBJECT_TYPE_COMMAND_BUFFER, label);
|
||||||
|
|
||||||
|
@ -2691,7 +2691,7 @@ static void nickname(void* handle, VkObjectType type, const char* name) {
|
||||||
static bool vcheck(VkResult result, const char* message) {
|
static bool vcheck(VkResult result, const char* message) {
|
||||||
if (result >= 0) return true;
|
if (result >= 0) return true;
|
||||||
if (!state.config.callback) return false;
|
if (!state.config.callback) return false;
|
||||||
#define CASE(x) case x: state.config.callback(state.config.userdata, "Vulkan error: " #x, false); break;
|
#define CASE(x) case x: state.config.callback(state.config.userdata, "Vulkan error: " #x, true); break;
|
||||||
switch (result) {
|
switch (result) {
|
||||||
CASE(VK_ERROR_OUT_OF_HOST_MEMORY);
|
CASE(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
CASE(VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
CASE(VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
||||||
|
|
|
@ -2861,7 +2861,7 @@ static void checkShaderFeatures(uint32_t* features, uint32_t count) {
|
||||||
|
|
||||||
static void onMessage(void* context, const char* message, bool severe) {
|
static void onMessage(void* context, const char* message, bool severe) {
|
||||||
if (severe) {
|
if (severe) {
|
||||||
lovrLog(LOG_ERROR, "GPU", message);
|
lovrThrow("GPU error: %s", message);
|
||||||
} else {
|
} else {
|
||||||
lovrLog(LOG_DEBUG, "GPU", message);
|
lovrLog(LOG_DEBUG, "GPU", message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue