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

Commit 4a14b22

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 f4169d3 commit 4a14b22

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
@@ -474,7 +474,7 @@ static const uint32_t READ_INDEX = 0;
474474
static const uint32_t WRITE_INDEX = 1;
475475

476476
// Per-cmd read/write flags Read flags in slot 0, Write in 1
477-
static const CmdFlags CommandToFlags[CMD_COUNT][2] = {
477+
constexpr CmdFlags CommandToFlags[CMD_COUNT + 1][2] = {
478478
// CMD_NONE,
479479
{{0, 0}, {0, 0}},
480480
// CMD_BEGINQUERY,
@@ -569,7 +569,7 @@ static const CmdFlags CommandToFlags[CMD_COUNT][2] = {
569569
VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_INDIRECT_COMMAND_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT |
570570
VK_ACCESS_SHADER_READ_BIT},
571571
{VK_PIPELINE_STAGE_ALL_COMMANDS_BIT | VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, 0}},
572-
// CMD_DRAWINDIRECTCOUNTAMD,
572+
// CMD_DRAWINDIRECTCOUNTAMD, TODO : Make sure these are right
573573
{{VK_PIPELINE_STAGE_ALL_COMMANDS_BIT | VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT | VK_PIPELINE_STAGE_VERTEX_INPUT_BIT |
574574
VK_PIPELINE_STAGE_VERTEX_SHADER_BIT,
575575
VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_INDIRECT_COMMAND_READ_BIT | VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT |
@@ -651,8 +651,13 @@ static const CmdFlags CommandToFlags[CMD_COUNT][2] = {
651651
{{0, 0}, {0, 0}},
652652
// CMD_WRITETIMESTAMP,
653653
{{0, 0}, {0, 0}},
654+
// MAGIC NUMBER ENTRY TO MAKE SURE ARRAY IS CORRECT SIZE
655+
{{0, 0}, {0, 0xDEADBEEF}},
654656
};
655657

658+
static_assert((CommandToFlags[CMD_WRITETIMESTAMP + 1][WRITE_INDEX].access_flags) == (0xDEADBEEF),
659+
"CommandToFlags is not correct size. Must have an entry for each CMD_TYPE.");
660+
656661
// fwd decl class for ptr below
657662
class Command;
658663
// Store details of memory access by a cmd

0 commit comments

Comments
 (0)