diff options
| author | Chris Forbes <chrisforbes@google.com> | 2016-07-25 18:12:05 +1200 |
|---|---|---|
| committer | Chris Forbes <chrisforbes@google.com> | 2016-08-01 09:13:52 +1200 |
| commit | 5dd4fdee649cb8dd745e395b709a7b4f00abfef5 (patch) | |
| tree | 5f9ecbb3d2bc978bdff7480b2ba12462c1a64795 /layers | |
| parent | a003ab3d2d94bd93246b98a36ab42d2c72f084ee (diff) | |
| download | usermoji-5dd4fdee649cb8dd745e395b709a7b4f00abfef5.tar.xz | |
layers: Generate appropriate sets of requirement flags for OpTypeImage
Signed-off-by: Chris Forbes <chrisforbes@google.com>
Diffstat (limited to 'layers')
| -rw-r--r-- | layers/core_validation.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/layers/core_validation.cpp b/layers/core_validation.cpp index bbc2fe70..5e9bf4c5 100644 --- a/layers/core_validation.cpp +++ b/layers/core_validation.cpp @@ -2605,7 +2605,40 @@ static bool validate_shader_capabilities(debug_report_data *report_data, shader_ static uint32_t descriptor_type_to_reqs(shader_module const *module, uint32_t type_id) { - return 0; + auto type = module->get_def(type_id); + + while (true) { + switch (type.opcode()) { + case spv::OpTypeArray: + case spv::OpTypeSampledImage: + type = module->get_def(type.word(2)); + break; + case spv::OpTypePointer: + type = module->get_def(type.word(3)); + break; + case spv::OpTypeImage: { + auto dim = type.word(3); + auto arrayed = type.word(5); + auto msaa = type.word(6); + + switch (dim) { + case spv::Dim1D: + return DESCRIPTOR_REQ_VIEW_TYPE_1D << arrayed; + case spv::Dim2D: + return (msaa ? DESCRIPTOR_REQ_MULTI_SAMPLE : DESCRIPTOR_REQ_SINGLE_SAMPLE) | + (DESCRIPTOR_REQ_VIEW_TYPE_2D << arrayed); + case spv::Dim3D: + return DESCRIPTOR_REQ_VIEW_TYPE_3D; + case spv::DimCube: + return DESCRIPTOR_REQ_VIEW_TYPE_CUBE << arrayed; + default: // subpass, buffer, etc. + return 0; + } + } + default: + return 0; + } + } } |
