Vulkan-Docs/scripts/test_check_spec_links_api_specific.py

133 lines
4.9 KiB
Python
Raw Normal View History

Change log for February 3, 2019 Vulkan 1.1.99 spec update: * Update release number to 99. Public Issues: * Add missing pname:pMemoryHostPointerProperties description to flink:vkGetMemoryHostPointerPropertiesEXT.txt (public pull request 896). * Minor markup fixes (public pull request 900). * Minor update to `khronos.css` and markup fixes (originally proposed in public pull request 901, but done via an internal MR). Internal Issues: * Document restrictions on image queries for Y'CbCr formats in the <<features-formats-requiring-sampler-ycbcr-conversion>> table as well as for slink:sname:VkImageFormatProperties and slink:VkImageCreateInfo (internal issue 1361). * Correct type of the code:FragSizeEXT built-in in the <<interfaces-builtin-variables, Built-In Variables>> section (internal issue 1526). * Clean up math in the <<textures, Image Operations>> chapter by refactoring, using better naming conventions, updating diagrams to use the correct orientation, etc. (internal merge request 2968). * Fix minor typos for slink:VkImageCreateInfo and slink:VkImageStencilUsageCreateInfoEXT. * Add missing documentation for tlink:VkResolveModeFlagsKHR. * Fix extension dependency of pname:scalarBlockLayout in the <<features-features-requirements, Feature Requirements>> section. * Fix indexing math for shader binding table calculations in the <<shader-binding-table-indexing-rules, Indexing Rules>> section, and use spelling "`any-hit`" consistently. * Reconcile valid usage statement and text for sampled image layouts in slink:VkWriteDescriptorSet (https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/551). * Make SPIR-V code:OpConvertUToPtr and code:OpConvertPtrToU operations require a 64-bit integer for physical storage buffer pointers in the <<spirvenv-module-validation, Validation Rules within a Module>> section. * Update to KaTeX 10.0. New Extensions: * `VK_EXT_filter_cubic` * `VK_NV_dedicated_allocation_image_aliasing`
2019-02-04 01:26:23 -08:00
#!/usr/bin/python3
#
# Copyright (c) 2018-2019 Collabora, Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author(s): Ryan Pavlik <ryan.pavlik@collabora.com>
#
# Purpose: This file contains tests for check_spec_links.py
# that depend on the API being used.
import pytest
from check_spec_links import MacroChecker, MessageId, makeMacroChecker
from spec_tools.console_printer import ConsolePrinter
from spec_tools.macro_checker_file import shouldEntityBeText
from test_check_spec_links import (CheckerWrapper, allMessages,
loneMsgReplacement, message, msgReplacement)
@pytest.fixture
def ckr(capsys):
"""Fixture - add an arg named ckr to your test function to automatically get one passed to you."""
return CheckerWrapper(capsys)
def test_vulkan_refpage_mismatch(ckr):
"""Vulkan-specific tests of the REFPAGE_MISMATCH message."""
ckr.enabled([MessageId.REFPAGE_MISMATCH])
# Should error: this is actually a mismatch in Vulkan
assert(ckr.check(
"""[open,refpage='VkQueueFlags']
--
include::../api/enums/VkQueueFlagBits.txt[]""").numDiagnostics() == 1)
assert(ckr.check(
"""[open,refpage='VkQueueFlags']
--
include::../validity/enums/VkQueueFlagBits.txt[]""").numDiagnostics() == 1)
Change log for April 16, 2019 Vulkan 1.1.107 spec update: * Update release number to 107. Public Issues: * Fix revision date for the `<<VK_AMD_gpu_shader_half_float>>` appendix (public issue 617). * Make <<synchronization-pipeline-barriers-subpass-self-dependencies, subpass self-dependencies>> less restrictive (public issue 777). * Fix the `<<VK_EXT_full_screen_exclusive>>` dependency on `<<VK_KHR_win32_surface>>` in `vk.xml` (public pull request 849). * Remove single-page (`apispec.html`) refpage sub-targets from the Makefile `allman` target and the build instructions. The target is still present in the Makefile, but we have not been actively maintaining the single-page document and do not promise it will work. The full Specification and the individual API reference pages are what we support and publish at present (public issue 949). Internal Issues: * De-duplicate common valid usage statements shared by multiple commands or structures by using asciidoctor includes and dynamically assigning part of the valid usage ID based on which command or structure they're being applied to (internal issue 779). * Add reference pages for constructs not part of the formal API, such as platform calling convention macros, and script changes supporting them This required suppressing some check_spec_links warning classes in order to pass CI, until a more sophisticated fix can be done (internal issue 888). * Change math notation for the elink:VkPrimitiveTopology descriptions to use short forms `v` and `p` instead of `vertex` and `primitive`, increasing legibility (internal issue 1611). * Rewrite generated file includes relative to a globally specified path, fixing some issues with refpage generation (internal issue 1630). * Update contributor list for `<<VK_EXT_calibrated_timestamps>>`. * Fix use of pathlin in `scripts/generator.py` so the script will work on Windows under Python 3.5 (internal merge request 3107). * Add missing conditionals around the <<descriptorsets-accelerationstructure, Acceleration Structure>> section (internal merge request 3108). * More script synchronization with OpenXR spec repository (internal merge request 3109). * Mark the `<<VK_AMD_gpu_shader_half_float>>` and `<<VK_AMD_gpu_shader_int16>>` extensions as deprecated in `vk.xml` and the corresponding extension appendices (internal merge request 3112). New Extensions: * `<<VK_EXT_headless_surface>>`
2019-04-16 05:19:43 -07:00
# Should not error: this is just an alias
assert(ckr.check(
"""[open,refpage='vkUpdateDescriptorSetWithTemplate']
--
include::../api/protos/vkUpdateDescriptorSetWithTemplateKHR.txt[]""").numDiagnostics() == 0)
Change log for February 3, 2019 Vulkan 1.1.99 spec update: * Update release number to 99. Public Issues: * Add missing pname:pMemoryHostPointerProperties description to flink:vkGetMemoryHostPointerPropertiesEXT.txt (public pull request 896). * Minor markup fixes (public pull request 900). * Minor update to `khronos.css` and markup fixes (originally proposed in public pull request 901, but done via an internal MR). Internal Issues: * Document restrictions on image queries for Y'CbCr formats in the <<features-formats-requiring-sampler-ycbcr-conversion>> table as well as for slink:sname:VkImageFormatProperties and slink:VkImageCreateInfo (internal issue 1361). * Correct type of the code:FragSizeEXT built-in in the <<interfaces-builtin-variables, Built-In Variables>> section (internal issue 1526). * Clean up math in the <<textures, Image Operations>> chapter by refactoring, using better naming conventions, updating diagrams to use the correct orientation, etc. (internal merge request 2968). * Fix minor typos for slink:VkImageCreateInfo and slink:VkImageStencilUsageCreateInfoEXT. * Add missing documentation for tlink:VkResolveModeFlagsKHR. * Fix extension dependency of pname:scalarBlockLayout in the <<features-features-requirements, Feature Requirements>> section. * Fix indexing math for shader binding table calculations in the <<shader-binding-table-indexing-rules, Indexing Rules>> section, and use spelling "`any-hit`" consistently. * Reconcile valid usage statement and text for sampled image layouts in slink:VkWriteDescriptorSet (https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/551). * Make SPIR-V code:OpConvertUToPtr and code:OpConvertPtrToU operations require a 64-bit integer for physical storage buffer pointers in the <<spirvenv-module-validation, Validation Rules within a Module>> section. * Update to KaTeX 10.0. New Extensions: * `VK_EXT_filter_cubic` * `VK_NV_dedicated_allocation_image_aliasing`
2019-02-04 01:26:23 -08:00
def test_vulkan_refpage_missing(ckr):
"""Vulkan-specific tests of the REFPAGE_MISSING message."""
ckr.enabled([MessageId.REFPAGE_MISSING])
# Should error: flags are expected to have their own ref page.
assert(ckr.check(
"include::../api/flags/VkQueueFlags.txt[]").numDiagnostics() == 1)
def test_vulkan_refpage_block(ckr):
"""Vulkan-specific tests of the REFPAGE_BLOCK message."""
ckr.enabled([MessageId.REFPAGE_BLOCK])
# Should have no errors: Non-refpage usage of '--' is acceptable
assert(not ckr.check(
"""--
bla
--""").messages)
# Should have 1 error:
# - line after tag isn't '--'
result = ckr.check(
"""--
[open,]
bla
--""")
assert(result.numDiagnostics() == 1)
# Internally, it's as if the following were the spec source, after putting in the "fake" lines
# (each of the added lines comes from one message):
#
# --
# [open,]
# --
# bla
# --
assert("but did not find, a line containing only -- following a reference page tag" in message(result))
def test_vulkan_legacy(ckr):
"""Test the LEGACY message which is Vulkan-only."""
ckr.enabled([MessageId.LEGACY])
# Should complain about LEGACY
assert(ckr.check('sname:VkDeviceMemory').numDiagnostics() == 1)
Change log for April 16, 2019 Vulkan 1.1.107 spec update: * Update release number to 107. Public Issues: * Fix revision date for the `<<VK_AMD_gpu_shader_half_float>>` appendix (public issue 617). * Make <<synchronization-pipeline-barriers-subpass-self-dependencies, subpass self-dependencies>> less restrictive (public issue 777). * Fix the `<<VK_EXT_full_screen_exclusive>>` dependency on `<<VK_KHR_win32_surface>>` in `vk.xml` (public pull request 849). * Remove single-page (`apispec.html`) refpage sub-targets from the Makefile `allman` target and the build instructions. The target is still present in the Makefile, but we have not been actively maintaining the single-page document and do not promise it will work. The full Specification and the individual API reference pages are what we support and publish at present (public issue 949). Internal Issues: * De-duplicate common valid usage statements shared by multiple commands or structures by using asciidoctor includes and dynamically assigning part of the valid usage ID based on which command or structure they're being applied to (internal issue 779). * Add reference pages for constructs not part of the formal API, such as platform calling convention macros, and script changes supporting them This required suppressing some check_spec_links warning classes in order to pass CI, until a more sophisticated fix can be done (internal issue 888). * Change math notation for the elink:VkPrimitiveTopology descriptions to use short forms `v` and `p` instead of `vertex` and `primitive`, increasing legibility (internal issue 1611). * Rewrite generated file includes relative to a globally specified path, fixing some issues with refpage generation (internal issue 1630). * Update contributor list for `<<VK_EXT_calibrated_timestamps>>`. * Fix use of pathlin in `scripts/generator.py` so the script will work on Windows under Python 3.5 (internal merge request 3107). * Add missing conditionals around the <<descriptorsets-accelerationstructure, Acceleration Structure>> section (internal merge request 3108). * More script synchronization with OpenXR spec repository (internal merge request 3109). * Mark the `<<VK_AMD_gpu_shader_half_float>>` and `<<VK_AMD_gpu_shader_int16>>` extensions as deprecated in `vk.xml` and the corresponding extension appendices (internal merge request 3112). New Extensions: * `<<VK_EXT_headless_surface>>`
2019-04-16 05:19:43 -07:00
def test_vulkan_alias(ckr):
"""Tests of the aliasing data structure, dependent on Vulkan-specific registry."""
entity_db = ckr.ckr.entity_db
assert(entity_db.areAliases(
'VkCommandPoolTrimFlagsKHR', 'VkCommandPoolTrimFlags'))
# Try one reversed-order, though the assert in that method should fire if this is wrong.
assert(entity_db.areAliases(
'VkCommandPoolTrimFlags', 'VkCommandPoolTrimFlagsKHR'))
assert(entity_db.areAliases(
'VkDescriptorUpdateTemplateKHR', 'VkDescriptorUpdateTemplate'))
assert(entity_db.areAliases('VkDescriptorUpdateTemplateTypeKHR',
'VkDescriptorUpdateTemplateType'))
assert(entity_db.areAliases('VkQueueFamilyProperties2KHR',
'VkQueueFamilyProperties2'))
assert(entity_db.areAliases('VK_COLORSPACE_SRGB_NONLINEAR_KHR',
'VK_COLOR_SPACE_SRGB_NONLINEAR_KHR'))
assert(entity_db.areAliases('vkEnumeratePhysicalDeviceGroupsKHR',
'vkEnumeratePhysicalDeviceGroups'))
assert(entity_db.areAliases(
'vkCmdDrawIndirectCountAMD', 'vkCmdDrawIndirectCountKHR'))
assert(entity_db.areAliases('VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT',
'VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT'))
assert(entity_db.areAliases('VK_LUID_SIZE_KHR', 'VK_LUID_SIZE'))
Change log for August 17, 2019 Vulkan 1.1.120 spec update: * Update release number to 120. Github Issues: * Add slink:VkAccelerationStructureTypeNV explicitly to extension XML for `<<VK_NV_ray_tracing>>` (public issue 848). * Add missing valid usage statements for feature flags in slink:VkCommandBufferInheritanceInfo (public pull request 1017). Internal Issues: * Clarify behavior of non-premultiplied destination colors for `<<VK_EXT_blend_operation_advanced>>` prior to the definition of slink:VkBlendOverlapEXT (internal issue 1766). * Fix the confusing phrasing "`no other queue must: be (doing something)`" for flink:vkQueuePresentKHR, flink:vkQueueSubmit, and flink:vkQueueBindSparse (internal issue 1774). * Add `<<VK_EXT_validation_features>>` flag to enable best practices checks, which will soon be available in the validation layer (internal issue 1779). * Specify allowed characters for VUID tag name components in the style guide (internal issue 1788). * Update links to SPIR-V extension specifications, and parameterize their markup in case the URLs change in the future (internal issue 1797). * Fix an off-by-one error in the valid usage statement for slink:VkPipelineExecutableInfoKHR (internal merge request 3303). * Clean up markup indentation not matching the style guide (internal merge request 3314). * Minor script updates to allow refpage aliases, generate a dynamic TOC for refpages, generate Apache rewrite rules for aliases, open external links from refpages in a new window, and synchronize with the OpenCL scripts. This will shortly enable a paned navigation setup for refpages, similar to the OpenCL 2.2 refpages (internal merge request 3322). * Script updates to add tests to the checker, refactor and reformat code, generate better text for some valid usage statements, use more Pythonic idioms, and synchronize with the OpenXR scripts (internal merge request 3239). * Script updates and minor fixes in spec language to not raise checker errors for refpage markup of pages not existing in the API, such as VKAPI_NO_STDINT_H. Remove corresponding suppression of some check_spec_links.py tests from .gitlab-ci.yml and 'allchecks' target (internal merge request 3315).
2019-08-17 15:33:21 -07:00
def test_vulkan_entity_detection(ckr):
ckr.enabled([MessageId.BAD_ENTITY])
# Should complain about BAD_ENTITY even though it's sname
assert(ckr.check('sname:VkInstanceCreateInfoBOGUS').numDiagnostics() == 1)