Skip to content
This repository was archived by the owner on Jul 19, 2018. It is now read-only.

Commit 96a3862

Browse files
committed
layers:Add read/write mappings for AMD draws
These extended draw types were added without updating the read/write flag LUT. Doh! Initially adding data as copies of matching non-AMD cmds which should work. Added comments to double-check and make sure those are the correct flags. Also added a magic number entry at the end of the LUT CommandToFlags array and a static_assert to make sure this array is correctly sized at compile time.
1 parent 90d9719 commit 96a3862

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

layers/core_validation_types.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ static const uint32_t READ_INDEX = 0;
490490
static const uint32_t WRITE_INDEX = 1;
491491

492492
// Per-cmd read/write flags Read flags in slot 0, Write in 1
493-
static const CmdFlags CommandToFlags[CMD_COUNT][2] = {
493+
constexpr CmdFlags CommandToFlags[CMD_COUNT + 1][2] = {
494494
// CMD_NONE,
495495
{{0, 0}, {0, 0}},
496496
// CMD_BEGINQUERY,
@@ -585,7 +585,7 @@ static const CmdFlags CommandToFlags[CMD_COUNT][2] = {
585585
VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_INDIRECT_COMMAND_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT |
586586
VK_ACCESS_SHADER_READ_BIT},
587587
{VK_PIPELINE_STAGE_ALL_COMMANDS_BIT | VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, 0}},
588-
// CMD_DRAWINDIRECTCOUNTAMD,
588+
// CMD_DRAWINDIRECTCOUNTAMD, TODO : Make sure these are right
589589
{{VK_PIPELINE_STAGE_ALL_COMMANDS_BIT | VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | VK_PIPELINE_STAGE_VERTEX_INPUT_BIT |
590590
VK_PIPELINE_STAGE_VERTEX_SHADER_BIT,
591591
VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_INDIRECT_COMMAND_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT |
@@ -667,8 +667,13 @@ static const CmdFlags CommandToFlags[CMD_COUNT][2] = {
667667
{{0, 0}, {0, 0}},
668668
// CMD_WRITETIMESTAMP,
669669
{{0, 0}, {0, 0}},
670+
// MAGIC NUMBER ENTRY TO MAKE SURE ARRAY IS CORRECT SIZE
671+
{{0, 0}, {0, 0xDEADBEEF}},
670672
};
671673

674+
static_assert((CommandToFlags[CMD_WRITETIMESTAMP + 1][WRITE_INDEX].access_flags) == (0xDEADBEEF),
675+
"CommandToFlags is not correct size. Must have an entry for each CMD_TYPE.");
676+
672677
// fwd decl class for ptr below
673678
class Command;
674679
// Store details of memory access by a cmd

0 commit comments

Comments
 (0)