vkd3d: Emit deadca7 cookie for num_words in debug ring.
Makes it somewhat feasible to fish for message begin codes in the stream. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
e61cc0234a
commit
6d35f98e59
|
@ -51,6 +51,7 @@ const uint DEBUG_CHANNEL_FMT_F32 = 2;
|
|||
const uint DEBUG_CHANNEL_FMT_HEX_ALL = DEBUG_CHANNEL_FMT_HEX * 0x55555555u;
|
||||
const uint DEBUG_CHANNEL_FMT_I32_ALL = DEBUG_CHANNEL_FMT_I32 * 0x55555555u;
|
||||
const uint DEBUG_CHANNEL_FMT_F32_ALL = DEBUG_CHANNEL_FMT_F32 * 0x55555555u;
|
||||
const uint DEBUG_CHANNEL_WORD_COOKIE = 0xdeadca70u; /* Let host fish for this cookie in device lost scenarios. */
|
||||
|
||||
uint DEBUG_CHANNEL_INSTANCE_COUNTER;
|
||||
uvec3 DEBUG_CHANNEL_ID;
|
||||
|
@ -103,7 +104,7 @@ void DEBUG_CHANNEL_UNLOCK_MESSAGE(RingBuffer buf, uint offset, uint num_words)
|
|||
* If the host thread observed a num_word of 0, we know a message was allocated, but we don't necessarily
|
||||
* have a complete write yet.
|
||||
* In a device lost scenario, we can try to fish for valid messages. */
|
||||
buf.data[(offset + 0) & DEBUG_SHADER_RING_MASK] = num_words;
|
||||
buf.data[(offset + 0) & DEBUG_SHADER_RING_MASK] = num_words | DEBUG_CHANNEL_WORD_COOKIE;
|
||||
memoryBarrierBuffer();
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,8 @@ void *vkd3d_shader_debug_ring_thread_main(void *arg)
|
|||
/* The debug ring shader has "release" semantics for the word count write,
|
||||
* so just make sure the reads don't get reordered here. */
|
||||
message_word_count = READ_RING_WORD_ACQUIRE(0);
|
||||
#define DEBUG_CHANNEL_WORD_COOKIE 0xdeadca70u
|
||||
#define DEBUG_CHANNEL_WORD_MASK 0xfffffff0u
|
||||
|
||||
if (message_word_count == 0)
|
||||
{
|
||||
|
@ -114,6 +116,15 @@ void *vkd3d_shader_debug_ring_thread_main(void *arg)
|
|||
break;
|
||||
}
|
||||
|
||||
/* If something is written here, it must be a cookie. */
|
||||
if ((message_word_count & DEBUG_CHANNEL_WORD_MASK) != DEBUG_CHANNEL_WORD_COOKIE)
|
||||
{
|
||||
ERR("Invalid message work cookie detected, 0x%x.\n", message_word_count);
|
||||
break;
|
||||
}
|
||||
|
||||
message_word_count &= ~DEBUG_CHANNEL_WORD_MASK;
|
||||
|
||||
if (i + message_word_count > count)
|
||||
{
|
||||
ERR("Message word count %u is out of bounds (i = %u, count = %u).\n",
|
||||
|
@ -121,7 +132,7 @@ void *vkd3d_shader_debug_ring_thread_main(void *arg)
|
|||
break;
|
||||
}
|
||||
|
||||
if (message_word_count < 8 || message_word_count > 16 + 8)
|
||||
if (message_word_count < 8)
|
||||
{
|
||||
ERR("Message word count %u is invalid.\n", message_word_count);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue