Change log for November 11, 2016 Vulkan 1.0.33 spec update:

* Bump API patch number and header version number to 33 for this update.

Github Issues:

  * Added implicit external synchronization parameters to
    vkBegin/EndCommandBuffer, and fixed missing command pool host
    synchronization from per-command lists (public issue 398).
  * Started using git tags including the spec release number, such as
    'v1.0.32-core', instead of tags including the date of release, such as
    'v1.0-core-20161025' (public issue 405).

Internal Issues:

  * Add validity constraint for
    slink:VkImportMemoryWin32HandleInfoNV::pname:handle (internal issue
    #480).
  * Add scripts to compare two Vulkan HTML specifications, derived from W3
    htmldiff service (internal issue 525).
  * Relax requirement that memoryTypeBits can't depend on format, to allow
    it to differ only for depth/stencil formats (internal issue 544).
  * Add a new generator script to create a simple extension loader for
    Vulkan based on +vk.xml+ (internal issue 558).
  * Add the overlooked requirement that buffer and image memory
    alignment requirements must be a power of two in the
    <<resources-association,Resource Memory Association>> section
    (internal issue 569).

Other Issues:

  * Add a naming rule to the style guide for members of extension structures
    defining array lengths which are the same as array lengths of the core
    structure they are chained from.
  * Add a new generator to create a simple extension loader in
    +src/ext_loader/vulkan_ext.[ch]+ from +vk.xml+. This code can be
    included in your project, and is expected to be packaged in the Vulkan
    SDK provided by LunarG in the future.
This commit is contained in:
Jon Leech 2016-11-12 03:23:34 -08:00
parent 368b08a7b2
commit 6cdc56d0d7
33 changed files with 2362 additions and 86 deletions

View File

@ -1394,11 +1394,11 @@ Internal Issues:
Other Issues:
* Reflowed text of the entire spec using the 'reflow' Makefile gater,
to (hopefully) reduce future internal git churn as edits are made
and extensions added in return for one-time pain. This has no
perceptible change on the spec outputs but considerable changes on
the asciidoc source (internal issue 367).
* Reflowed text of the entire spec using the 'reflow' Makefile target, to
(hopefully) reduce future internal git churn as edits are made and
extensions added in return for one-time pain. This has no perceptible
effect on the spec outputs, but considerable changes on the asciidoc
source (internal issue 367).
-----------------------------------------------------
@ -1558,3 +1558,43 @@ Internal Issues:
validity. Doesn't affect output, other than some statements
appearing in another block now (internal issue 513).
-----------------------------------------------------
Change log for November 11, 2016 Vulkan 1.0.33 spec update:
* Bump API patch number and header version number to 33 for this update.
Github Issues:
* Added implicit external synchronization parameters to
vkBegin/EndCommandBuffer, and fixed missing command pool host
synchronization from per-command lists (public issue 398).
* Started using git tags including the spec release number, such as
'v1.0.32-core', instead of tags including the date of release, such as
'v1.0-core-20161025' (public issue 405).
Internal Issues:
* Add validity constraint for
slink:VkImportMemoryWin32HandleInfoNV::pname:handle (internal issue
#480).
* Add scripts to compare two Vulkan HTML specifications, derived from W3
htmldiff service (internal issue 525).
* Relax requirement that memoryTypeBits can't depend on format, to allow
it to differ only for depth/stencil formats (internal issue 544).
* Add a new generator script to create a simple extension loader for
Vulkan based on +vk.xml+ (internal issue 558).
* Add the overlooked requirement that buffer and image memory
alignment requirements must be a power of two in the
<<resources-association,Resource Memory Association>> section
(internal issue 569).
Other Issues:
* Add a naming rule to the style guide for members of extension structures
defining array lengths which are the same as array lengths of the core
structure they are chained from.
* Add a new generator to create a simple extension loader in
+src/ext_loader/vulkan_ext.[ch]+ from +vk.xml+. This code can be
included in your project, and is expected to be packaged in the Vulkan
SDK provided by LunarG in the future.

View File

@ -160,7 +160,7 @@ GENDEPENDS = api/timeMarker validity/timeMarker hostsynctable/timeMarker
COMMONDOCS = $(CHAPTERS) $(GENINCLUDE) $(GENDEPENDS)
# A generated included file containing the spec version, date, and git commit
SPECVERSION = specversion.txt
SPECREVISION = 1.0.32
SPECREVISION = 1.0.33
SPECREMARK =
# Spec targets

View File

@ -1288,39 +1288,39 @@ Devel/git (2.5.1-1) - Needed for updating specversion.txt
<div class="ulist"><ul>
<li>
<p>
2016/08/25 - Update for the single-branch model.
2016-08-25 - Update for the single-branch model.
</p>
</li>
<li>
<p>
2016/07/10 - Update for current state of spec and ref page generation.
2016-07-10 - Update for current state of spec and ref page generation.
</p>
</li>
<li>
<p>
2015/11/11 - Add new <span role="normative">can</span> etc. macros and DBLATEXPREFIX variable.
2015-11-11 - Add new <span role="normative">can</span> etc. macros and DBLATEXPREFIX variable.
</p>
</li>
<li>
<p>
2015/09/21 - Convert document to asciidoc and rename to README.md
2015-09-21 - Convert document to asciidoc and rename to README.md
in the hope the gitlab browser will render it in some fashion.
</p>
</li>
<li>
<p>
2015/09/21 - Add descriptions of LaTeX+MathJax math support for all
2015-09-21 - Add descriptions of LaTeX+MathJax math support for all
output formats.
</p>
</li>
<li>
<p>
2015/09/02 - Added Cygwin package info.
2015-09-02 - Added Cygwin package info.
</p>
</li>
<li>
<p>
2015/09/02 - Initial version documenting macros, required toolchain
2015-09-02 - Initial version documenting macros, required toolchain
components and versions, etc.
</p>
</li>
@ -1332,7 +1332,7 @@ Devel/git (2.5.1-1) - Needed for updating specversion.txt
<div id="footer">
<div id="footer-text">
Last updated
2016-08-26 17:00:49 PDT
2016-10-25 14:15:38 KST
</div>
</div>
</body>

View File

@ -11,7 +11,7 @@
*Registered Extension Number*::
9
*Last Modified Date*::
2016-14-01
2016-01-14
*Revision*::
6
*IP Status*::

View File

@ -11,7 +11,7 @@
*Registered Extension Number*::
1
*Last Modified Date*::
2016-14-01
2016-08-25
*Revision*::
25
*IP Status*::

View File

@ -44,8 +44,7 @@ The sname:VkDebugMarkerObjectNameInfoEXT structure is defined as:
include::../api/structs/VkDebugMarkerObjectNameInfoEXT.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:objectType is a elink:VkDebugReportObjectTypeEXT specifying the
type of the object to be named.
@ -90,8 +89,7 @@ The sname:VkDebugMarkerObjectTagInfoEXT structure is defined as:
include::../api/structs/VkDebugMarkerObjectTagInfoEXT.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:objectType is a elink:VkDebugReportObjectTypeEXT specifying the
type of the object to be named.
@ -200,8 +198,7 @@ The sname:VkDebugMarkerMarkerInfoEXT structure is defined as:
include::../api/structs/VkDebugMarkerMarkerInfoEXT.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:pMarkerName is a pointer to a null-terminated UTF-8 string that
contains the name of the marker.

View File

@ -55,8 +55,7 @@ The sname:VkAndroidSurfaceCreateInfoKHR structure is defined as:
include::../../api/structs/VkAndroidSurfaceCreateInfoKHR.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:flags is reserved for future use.
* pname:window is a pointer to the code:ANativeWindow to associate the

View File

@ -277,8 +277,7 @@ The sname:VkDisplayModeCreateInfoKHR structure is defined as:
include::../../api/structs/VkDisplayModeCreateInfoKHR.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:flags is reserved for future use, and must: be zero.
* pname:parameters is a sname:VkDisplayModeParametersKHR structure
@ -413,8 +412,7 @@ The sname:VkDisplaySurfaceCreateInfoKHR structure is defined as:
include::../../api/structs/VkDisplaySurfaceCreateInfoKHR.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:flags is reserved for future use, and must: be zero.
* pname:displayMode is the mode to use when displaying this surface.

View File

@ -14,8 +14,7 @@ The sname:VkDisplayPresentInfoKHR structure is defined as:
include::../../api/structs/VkDisplayPresentInfoKHR.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:srcRect is a rectangular region of pixels to present.
It must: be a subset of the image being presented.

View File

@ -29,8 +29,7 @@ The sname:VkMirSurfaceCreateInfoKHR structure is defined as:
include::../../api/structs/VkMirSurfaceCreateInfoKHR.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:flags is reserved for future use.
* pname:connection and pname:surface are pointers to the

View File

@ -90,8 +90,7 @@ The sname:VkSwapchainCreateInfoKHR structure is defined as:
include::../../api/structs/VkSwapchainCreateInfoKHR.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:flags is reserved for future use, and must: be zero.
* pname:surface is the surface that the swapchain will present images to.
@ -678,8 +677,7 @@ The sname:VkPresentInfoKHR structure is defined as:
include::../../api/structs/VkPresentInfoKHR.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_PRESENT_INFO_KHR.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:waitSemaphoreCount is the number of semaphores to wait for before
issuing the present request.

View File

@ -29,8 +29,7 @@ The sname:VkWaylandSurfaceCreateInfoKHR structure is defined as:
include::../../api/structs/VkWaylandSurfaceCreateInfoKHR.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:flags is reserved for future use.
* pname:display and pname:surface are pointers to the Wayland

View File

@ -29,8 +29,7 @@ The sname:VkWin32SurfaceCreateInfoKHR structure is defined as:
include::../../api/structs/VkWin32SurfaceCreateInfoKHR.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:flags is reserved for future use.
* pname:hinstance and pname:hwnd are the Win32 code:HINSTANCE and

View File

@ -30,8 +30,7 @@ The sname:VkXcbSurfaceCreateInfoKHR structure is defined as:
include::../../api/structs/VkXcbSurfaceCreateInfoKHR.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:flags is reserved for future use.
* pname:connection is a pointer to an code:xcb_connection_t to the X

View File

@ -30,8 +30,7 @@ The sname:VkXlibSurfaceCreateInfoKHR structure is defined as:
include::../../api/structs/VkXlibSurfaceCreateInfoKHR.txt[]
* pname:sType is the type of this structure and must: be
ename:VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR.
* pname:sType is the type of this structure.
* pname:pNext is `NULL` or a pointer to an extension-specific structure.
* pname:flags is reserved for future use.
* pname:dpy is a pointer to an Xlib code:Display connection to the X

View File

@ -19,22 +19,30 @@ include::../../api/structs/VkImportMemoryWin32HandleInfoNV.txt[]
// refBegin VkExternalMemoryHandleTypeFlagBitsNV - Bitmask specifying memory handle types
include::../../api/enums/VkExternalMemoryHandleTypeFlagBitsNV.txt[]
--
* pname:handle is a Windows code:HANDLE referring to the memory.
** if pname:handleType is
ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV or
ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV,
pname:handle must: be a valid handle returned by
flink:vkGetMemoryWin32HandleNV or, in the case of
ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV, a handle
ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV, the
handle is one returned by flink:vkGetMemoryWin32HandleNV or, in the
case of ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV, one
duplicated from such a handle using `DuplicateHandle()`.
** if pname:handleType is
ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV, pname:handle
must: be a valid NT handle returned by
`IDXGIResource1::ftext:CreateSharedHandle()` or a handle duplicated
ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV, the handle is
a valid NT handle returned by
`IDXGIResource1::ftext:CreateSharedHandle()`, or a handle duplicated
from such a handle using `DuplicateHandle()`.
** if pname:handleType is
ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV,
pname:handle must: be a valid handle returned by
`IDXGIResource::GetSharedHandle()`.
ename:VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV, the handle
is one returned by `IDXGIResource::GetSharedHandle()`.
* pname:handle is a Windows code:HANDLE referring to the memory.
If pname:handleType is 0, this structure is ignored by consumers of the
slink:VkMemoryAllocateInfo structure it is chained from.
.Valid Usage
****
* pname:handleType must: not have more than one bit set.
* pname:handle must: be a valid handle to memory, obtained as specified by
pname:handleType.
****
include::../../validity/structs/VkImportMemoryWin32HandleInfoNV.txt[]

View File

@ -1761,16 +1761,25 @@ flink:vkGetImageMemoryRequirements:
pname:memoryTypeBits returned for code:usage1 must: be a subset of the
bits set in pname:memoryTypeBits returned for code:usage2, for all
values of pname:flags.
* The pname:alignment member is a power of two.
* The pname:alignment member is identical for all sname:VkBuffer objects
created with the same combination of values for the pname:usage and
pname:flags members in the sname:VkBufferCreateInfo structure passed to
fname:vkCreateBuffer.
* The pname:memoryTypeBits member is identical for all sname:VkImage
objects created with the same combination of values for the pname:tiling
member and the ename:VK_IMAGE_CREATE_SPARSE_BINDING_BIT bit of the
pname:flags member and the ename:VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT
of the pname:usage member in the sname:VkImageCreateInfo structure
passed to fname:vkCreateImage.
* For images created with a color format, the pname:memoryTypeBits member
is identical for all sname:VkImage objects created with the same
combination of values for the pname:tiling member, the
ename:VK_IMAGE_CREATE_SPARSE_BINDING_BIT bit of the pname:flags member,
and the ename:VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT of the pname:usage
member in the sname:VkImageCreateInfo structure passed to
fname:vkCreateImage.
* For images created with a depth/stencil format, the pname:memoryTypeBits
member is identical for all sname:VkImage objects created with the same
combination of values for the pname:format member, the pname:tiling
member, the ename:VK_IMAGE_CREATE_SPARSE_BINDING_BIT bit of the
pname:flags member, and the
ename:VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT of the pname:usage member
in the sname:VkImageCreateInfo structure passed to fname:vkCreateImage.
* If the memory requirements are for a sname:VkImage, the
pname:memoryTypeBits member must: not refer to a sname:VkMemoryType with
a pname:propertyFlags that has the

View File

@ -47,4 +47,4 @@ buildBranch('1.0',
print('echo Info: post-generation cleanup')
createTags(buildOnFriday())
createTags(releaseNum(), buildOnFriday())

View File

@ -60,6 +60,10 @@ allExtensions = KHRextensions + [
'VK_NV_glsl_shader'
]
# Return the Vulkan release number, used for tags
def releaseNum():
return '$REVISION'
# Return a date for the current, or upcoming if not already, Friday,
# which is when releases happen
def buildOnFriday():
@ -154,12 +158,15 @@ def buildBranch(targetDir, extensions, apititle,
miscSrc, miscDst, needRefSources)
# Commands to tag the git branches
# tagdate = date to tag the tree with when done
def createTags(tagdate):
# releaseNum = release number of this spec update, to tag the tree with
# tagdate = date (used to be used to tag the tree with)
def createTags(releaseNum, tagdate):
# Tag date in YYYYMMDD format
now = tagdate.strftime('%Y%m%d')
print('echo To tag the spec branch for this release, execute the command:')
print('echo git tag -a -m \\"Tag Vulkan API specification for', now,
'release\\"', 'v1.0-core-' + now)
print('echo git tag -a -m \\"Tag Vulkan API specification for 1.0.' +
releaseNum, 'release\\"', 'v1.0.' + releaseNum + '-core')
#print('echo git tag -a -m \\"Tag Vulkan API specification for', now,
# 'release\\"', 'v1.0-core-' + now)

View File

@ -0,0 +1,26 @@
HTML Diff Script for Vulkan
===========================
This is a first cut at a script to compare Vulkan HTML specifications. Usage
is simply 'htmldiff file1.html file2.html > diff.html'. The script does not
copy CSS and images requires by the input specs, so it's best to generate
the output in the same directory as one of the inputs.
The scripts used require Python and Perl. Additionally, the python
'utidylib' module and the underlying libtidy C library are required,
which may make it challenging to run the scripts on non-Linux platforms
- I haven't checked and those requirements cannot be easily removed. On
Debian Linux, it may be necessary to install the 'python-utidylib' and
'libtidy' packages if they are not already present. I haven't checked
dependencies for other Linux distributions but they are probably
similar.
The scripts are taken from the code backing the
http://services.w3.org/htmldiff
website. 'htmldiff' is the Python driver script. 'htmldiff.pl' is the
Perl script which generates the diff after preprocessing of the input
HTML by 'htmldiff'. 'htmldiff.orig' is the original Python script from
the website, modified to run at the command line instead of as a CGI
script.

View File

@ -0,0 +1,78 @@
#!/usr/bin/python
#
# Modified from the htmldiff script developed by Dominique HazaC+l-Massieux
# for the http://services.w3.org/htmldiff website. That script did not
# include a copyright statement.
import atexit
import os
import re
import sys
import tempfile
import tidy
from subprocess import Popen, PIPE
def tidyFile(filename):
ifp = open(filename, 'r')
# option for tidy
options = dict(tidy_mark=0,show_warnings=0,quiet=1,char_encoding='utf8')
html5 = re.search(r"<!doctype\s+html\s*>", ifp.read(4096),
re.IGNORECASE)
ifp.seek(0)
html5_options = {'add_xml_space': 'no',
'output_xhtml': 'no',
'tidy_mark': 'no',
'new_blocklevel_tags': 'article,aside,canvas,dialog,details,figcaption,figure,footer,header,hgroup,menu,nav,section,main,summary,math,semantics,mrow,mfenced,mtable,mtr,mtd,mi,mn,msub,mo,mfrac,munderover,mtext,svg,g,image,rect,text,desc,line,path,polygon,ellipse,tspan,defs,feoffset,fecolormatrix,filter,fegaussianblur,feblend,marker,circle',
'new_inline_tags': 'video,audio,canvas,ruby,rt,rp,time,meter,progress,track,source,emu-val,emu-nt,emu-t,mark',
'break_before_br': 'no',
'vertical_space': 'no',
'enclose_text': 'no',
'numeric_entities': 'yes',
'wrap': '1000',
'wrap_attributes': 'no',
'drop_empty_paras': 'no'
}
if html5:
options.update(html5_options)
newtidy = tidy.parseString(ifp.read(), **options)
if len(newtidy.errors) > 0:
if not html5:
ifp.seek(0)
options.update(html5_options)
newtidy = tidy.parseString(ifp.read(), **options)
ifp.close()
fp = tempfile.NamedTemporaryFile(
mode='w+', prefix='htmldiff-', suffix='.html')
atexit.register(fp.close)
fp.write(str(newtidy))
fp.flush()
fp.seek(0)
# sys.stderr.write('tidyFile: tempfile name %s\n' % fp.name)
if (newtidy.errors):
sys.stderr.write('tidyFile: tidy.parseString error: %s\n' % str(newtidy.errors))
return fp
if __name__ == '__main__':
if (len(sys.argv) < 3):
sys.stderr.write('tidy: need args file1 file2\n')
sys.exit(1)
refdoc = tidyFile(sys.argv[1])
newdoc = tidyFile(sys.argv[2])
p = Popen(['htmldiff.pl', refdoc.name, newdoc.name],
stdin=PIPE, stdout=PIPE, stderr=PIPE)
sys.stdout.flush()
sys.stderr.flush()
(out, err) = p.communicate()
p.stdin.close()
if err:
sys.stderr.write('htmldiff: An error occured when running htmldiff.pl on the documents:', str(err))
exit(1)
else:
print(out)

View File

@ -0,0 +1,242 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" $Id: htmldiff,v 1.62 2016/10/06 10:46:19 dom Exp $
"""
import atexit
import cgi
import http_auth
import httplib
import os
import re
import surbl
import sys
import tempfile
import tidy
import urlparse
from subprocess import Popen, PIPE
CONTENT_TYPE = "text/html;charset=utf-8"
Page = """
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head><title>HTML Diff service</title>
<link rel="stylesheet" href="http://www.w3.org/StyleSheets/base" />
</head>
<body>
<p><a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C"/></a> <a href="http://www.w3.org/2003/Editors">W3C Editors homepage</a></p>
<h1>Create Diff between HTML pages</h1>
"""
Page2 = """
<form method="GET">
<p>Address of reference document: <input name="doc1" type="url" value="%s" style="width:100%%"/></p>
<p>Address of new document: <input name="doc2" value="%s" style="width:100%%"/></p>
<p><input type="submit" value="get Diff"/></p>
</form>
<p><strong>Tip</strong>: if the document uses the W3C convention on linking to its previous version, you can specify only the address of the new document — the previous link will be automatically detected.</p>
<h2>Diff markings</h2>
<p>This service relies on <a href="https://www.gnu.org/software/diffutils/">GNU diff</a>. The found differences are roughly marked as follow:
<ul>
<li>deleted text is shown in pink with down-arrows (as styled for a &lt;del> element)</li>
<li>where there is replacement, its shown in green with bi-directional arrows,</li>
<li>where there is newly inserted text, its yellow with up arrows (&lt;ins> element)</li>
</ul>
<address>
script $Revision: 1.62 $ of $Date: 2016/10/06 10:46:19 $<br />
by <a href="http://www.w3.org/People/Dom/">Dominique Hazaël-Massieux</a><br />based on <a href="https://dev.w3.org/cvsweb/2009/htmldiff/htmldiff.pl">Shane McCarron Perl script</a> wrapped in a <a href="http://dev.w3.org/cvsweb/2009/htmldiff/">Python CGI</a>
</address>
</body>
</html>
"""
def checkInputUrl(url):
checker = surbl.SurblChecker('/usr/local/share/surbl/two-level-tlds','/afs/w3.org/pub/WWW/Systems/Server/debian/generic/usr/local/etc/surbl.whitelist')
if url[:5] == 'file:' or len(urlparse.urlparse(url)[0])<2:
print "Status: 403"
print "Content-Type: text/plain"
print
print "sorry, I decline to handle file: addresses"
sys.exit()
elif checker.isMarkedAsSpam(url):
print "Status: 403"
print "Content-Type: text/plain; charset=utf-8"
print
print "sorry, this URL matches a record known in SURBL. See http://www.surbl.org/"
sys.exit()
def copyHeader(copy_func, source, key, header_name=None):
value = source.get(key)
if not value:
return False
elif header_name is None:
header_name = key
copy_func(header_name, value)
return True
def setupRequest(source_headers):
opener = http_auth.ProxyAuthURLopener()
copyHeader(opener.addheader, source_headers, 'If-Modified-Since')
copyHeader(opener.addheader, os.environ, 'REMOTE_ADDR', 'X_Forward_IP_Addr')
return opener
def tidyFile(file):
# option for tidy
options = dict(tidy_mark=0,show_warnings=0,quiet=1,char_encoding='utf8')
html5 = re.search(r"<!doctype\s+html\s*>", file.read(4096),
re.IGNORECASE)
file.seek(0)
html5_options = {"add_xml_space": "no",
"output_xhtml": "no",
"tidy_mark": "no",
"new_blocklevel_tags": 'article,aside,canvas,dialog,details,figcaption,figure,footer,header,hgroup,menu,nav,section,main,summary,math,semantics,mrow,mfenced,mtable,mtr,mtd,mi,mn,msub,mo,mfrac,munderover,mtext,svg,g,image,rect,text,desc,line,path,polygon,ellipse,tspan,defs,feoffset,fecolormatrix,filter,fegaussianblur,feblend,marker,circle',
"new_inline_tags": 'video,audio,canvas,ruby,rt,rp,time,meter,progress,track,source,emu-val,emu-nt,emu-t,mark',
"break_before_br": "no",
"vertical_space": "no",
"enclose_text": "no",
"numeric_entities": "yes",
"wrap": "1000",
"wrap_attributes": "no",
"drop_empty_paras": "no"
}
if html5:
options.update(html5_options)
newtidy = tidy.parseString(file.read(), **options)
if len(newtidy.errors) > 0:
if not html5:
file.seek(0)
options.update(html5_options)
newtidy = tidy.parseString(file.read(), **options)
file.close()
file = tempfile.NamedTemporaryFile(
mode='w+', prefix='htmldiff-', suffix='.html')
atexit.register(file.close)
file.write(str(newtidy))
file.flush()
file.seek(0)
return (file, newtidy.errors)
def matchPredecessorRel(rel):
return rel and "predecessor-version" in rel.lower().split(" ")
def mirrorURL(url, opener):
try:
filename, headers = opener.retrieve(url)
except IOError, error:
opener.error = "I/O error: %s %s" % (error.errno, error.strerror)
except httplib.InvalidURL:
opener.error = "Invalid URL submitted"
except AttributeError: # ProxyAuthURLopener returned None.
pass # There's already an error set.
else:
atexit.register(os.unlink, filename)
file = open(filename)
if headers.has_key("content-encoding") and headers["content-encoding"] == "gzip":
import gzip
from StringIO import StringIO
data = StringIO(file.read())
file.close()
file = gzip.GzipFile(fileobj=data)
file,errors = tidyFile(file)
if len(errors) == 0:
return (file, headers)
else:
opener.error = "Tidy errors: %s" % (str(errors))
return (None, {})
def showPage(url1='', url2='', error_html='', **headers):
for name, value in headers.items():
print "%s: %s" % (name.replace('_', '-'), value)
print
print Page
print error_html
print Page2 % (url1, url2)
sys.exit()
def serveRequest():
fields = cgi.FieldStorage()
if (not fields.has_key('doc2')):
showPage(Content_Type=CONTENT_TYPE)
# if doc1 is not specified, we load doc2 to check if it has a previous version link
doc2 = fields['doc2'].value
checkInputUrl(doc2)
url_opener2 = setupRequest(fields.headers)
newdoc, newheaders = mirrorURL(doc2, url_opener2)
if fields.has_key('doc1'):
doc1 = fields['doc1'].value
elif newdoc is not None:
from BeautifulSoup import BeautifulSoup
soup = BeautifulSoup(newdoc.read())
newdoc.seek(0)
try:
doc1 = soup.find(text=re.compile("Previous Version",re.IGNORECASE)).findNext(name="a", attrs={"href":True})["href"]
except:
try:
doc1 = soup.find(name=["a", "link"], attrs={"href":True, rel:matchPredecessorRel})["href"]
except:
doc1 = None
else:
doc1 = None
if (not doc1):
showPage(Content_Type=CONTENT_TYPE)
checkInputUrl(doc1)
esc1 = cgi.escape(doc1, True)
esc2 = cgi.escape(doc2, True)
urlcomponents1 = urlparse.urlparse(doc1)
urlcomponents2 = urlparse.urlparse(doc2)
# if same domain, we can use the same urlopener
# otherwise, we create a separate one
if urlcomponents2[1] == urlcomponents1[1]:
url_opener = url_opener2
else:
url_opener = setupRequest(fields.headers)
refdoc, refheaders = mirrorURL(doc1, url_opener)
if not (refdoc and newdoc):
http_error = ""
url = ""
if not refdoc:
http_error = url_opener.error
url = esc1
else:
http_error = url_opener2.error
url = esc2
if re.match("^[1234][0-9][0-9] ", http_error):
print "Status: %s" %(http_error)
error="<p style='color:#FF0000'>An error (%s) occured trying to get <a href='%s'>%s</a>.</p>" % (cgi.escape(http_error), url, url)
showPage(esc1, esc2, error, Content_Type=CONTENT_TYPE)
print "Content-Type: text/html"
if newheaders.has_key('Content-Type'):
contentType = cgi.parse_header(newheaders["Content-Type"])
if contentType[1].has_key('charset'):
charset = contentType[1]['charset'].lower()
#if charset == "iso-8859-1":
# options["char_encoding"]='latin1'
for proxy_header in ('Last-Modified', 'Expires'):
if copyHeader(lambda header, value: sys.stdout.write("%s: %s" %(header, value)), newheaders, proxy_header):
print
print
p = Popen(["/usr/local/bin/htmldiff", refdoc.name, newdoc.name],
stdin=PIPE, stdout=PIPE, stderr=PIPE)
sys.stdout.flush()
sys.stderr.flush()
(out, err) = p.communicate()
p.stdin.close()
if err:
error = "<p style='color:#FF0000'>An error occured when running <code>htmldiff</code> on the documents:</p><pre>%s</pre>" % (cgi.escape(err),)
showPage(esc1, esc2, error)
else:
print out
if __name__ == '__main__':
if os.environ.has_key('SCRIPT_NAME'):
serveRequest()

View File

@ -0,0 +1,570 @@
#!/usr/bin/perl
#
# htmldiff - present a diff marked version of two html documents
#
# Copyright (c) 1998-2006 MACS, Inc.
#
# Copyright (c) 2007 SiSco, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# See http://www.themacs.com for more information.
#
# usage: htmldiff [[-c] [-l] [-o] oldversion newversion [output]]
#
# -c - disable metahtml comment processing
# -o - disable outputting of old text
# -l - use navindex to create sequence of diffs
# oldversion - the previous version of the document
# newversion - the newer version of the document
# output - a filename to place the output in. If omitted, the output goes to
# standard output.
#
# if invoked with no options or arguments, operates as a CGI script. It then
# takes the following parameters:
#
# oldfile - the URL of the original file
# newfile - the URL of the new file
# mhtml - a flag to indicate whether it should be aware of MetaHTML comments.
#
# requires GNU diff utility
# also requires the perl modules Getopt::Std
#
# NOTE: The markup created by htmldiff may not validate against the HTML 4.0
# DTD. This is because the algorithm is realtively simple, and there are
# places in the markup content model where the span element is not allowed.
# Htmldiff is NOT aware of these places.
#
# $Source: /u/sources/public/2009/htmldiff/htmldiff.pl,v $
# $Revision: 1.3 $
#
# $Log: htmldiff.pl,v $
# Revision 1.3 2016/10/24 15:06:51 dom
# Summary: Use nav script always
#
# Revision 1.2 2016/10/24 15:04:28 dom
# Add navigation script
#
# Revision 1.1 2014-01-06 08:04:51 dom
# added copy of htmldiff perl script since aptest.com repo no longer available
#
# Revision 1.5 2008/03/05 13:23:16 ahby
# Fixed a problem with leading whitespace before markup.
#
# Revision 1.4 2007/12/13 13:09:16 ahby
# Updated copyright and license.
#
# Revision 1.3 2007/12/13 12:53:34 ahby
# Changed use of span to ins and del
#
# Revision 1.2 2002/02/13 16:27:23 ahby
# Changed processing model.
# Improved handling of old text and changed styles.
#
# Revision 1.1 2000/07/12 12:20:04 ahby
# Updated to remove empty spans - this fixes validation problems under
# strict.
#
# Revision 1.11 1999/12/08 19:46:45 ahby
# Fixed validation errors introduced by placing markup where it didn't
# belong.
#
# Revision 1.10 1999/10/18 13:42:58 ahby
# Added -o to the usage message.
#
# Revision 1.9 1999/05/04 12:29:11 ahby
# Added an option to turn off the display of old text.
#
# Revision 1.8 1999/04/09 14:37:27 ahby
# Fixed a perl syntax error.
#
# Revision 1.7 1999/04/09 14:35:49 ahby
# Added reference to MACS homepage.
#
# Revision 1.6 1999/04/09 14:35:09 ahby
# Added comment about validity of generated markup.
#
# Revision 1.5 1999/02/22 22:17:54 ahby
# Changed to use stylesheets.
# Changed to rely upon span.
# Changed to work around content model problems.
#
# Revision 1.4 1999/02/08 02:32:22 ahby
# Added a copyright statement.
#
# Revision 1.3 1999/02/08 02:30:40 ahby
# Added header processing.
#
# Revision 1.2 1998/12/10 17:31:31 ahby
# Fixed to escape less-thans in change blocks and to not permit change
# markup within specific elements (like TITLE).
#
# Revision 1.1 1998/11/26 00:09:22 ahby
# Initial revision
#
#
use Getopt::Std;
sub usage {
print STDERR "htmldiff [-c] [-o] oldversion newversion [output]\n";
exit;
}
sub url_encode {
my $str = shift;
$str =~ s/([\x00-\x1f\x7F-\xFF])/
sprintf ('%%%02x', ord ($1))/eg;
return $str;
}
# markit - diff-mark the streams
#
# markit(file1, file2)
#
# markit relies upon GNUdiff to mark up the text.
#
# The markup is encoded using special control sequences:
#
# a block wrapped in control-a is deleted text
# a block wrapped in control-b is old text
# a block wrapped in control-c is new text
#
# The main processing loop attempts to wrap the text blocks in appropriate
# SPANs based upon the type of text that it is.
#
# When the loop encounters a < in the text, it stops the span. Then it outputs
# the element that is defined, then it restarts the span.
sub markit {
my $retval = "";
my($file1) = shift;
my($file2) = shift;
# my $old="<span class=\\\"diff-old-a\\\">deleted text: </span>%c'\012'%c'\001'%c'\012'%<%c'\012'%c'\001'%c'\012'";
my $old="%c'\012'%c'\001'%c'\012'%<%c'\012'%c'\001'%c'\012'";
my $new="%c'\012'%c'\003'%c'\012'%>%c'\012'%c'\003'%c'\012'";
my $unchanged="%=";
my $changed="%c'\012'%c'\001'%c'\012'%<%c'\012'%c'\001'%c'\012'%c'\004'%c'\012'%>%c'\012'%c'\004'%c'\012'";
if ($opt_o) {
$old = "";
$changed = "%c'\012'%c'\004'%c'\012'%>%c'\012'%c'\004'%c'\012'";
}
# my $old="%c'\002'<font color=\\\"purple\\\" size=\\\"-2\\\">deleted text:</font><s>%c'\012'%c'\001'%c'\012'%<%c'\012'%c'\001'%c'\012'</s>%c'\012'%c'\002'";
# my $new="%c'\002'<font color=\\\"purple\\\"><u>%c'\012'%c'\002'%>%c'\002'</u></font>%c'\002'%c'\012'";
# my $unchanged="%=";
# my $changed="%c'\002'<s>%c'\012'%c'\001'%c'\012'%<%c'\012'%c'\001'%c'\012'</s><font color=\\\"purple\\\"><u>%c'\002'%c'\012'%>%c'\012'%c'\002'</u></font>%c'\002'%c'\012'";
my @span;
$span[0]="</span>";
$span[1]="<del class=\"diff-old\">";
$span[2]="<del class=\"diff-old\">";
$span[3]="<ins class=\"diff-new\">";
$span[4]="<ins class=\"diff-chg\">";
my @diffEnd ;
$diffEnd[1] = '</del>';
$diffEnd[2] = '</del>';
$diffEnd[3] = '</ins>';
$diffEnd[4] = '</ins>';
my $diffcounter = 0;
open(FILE, qq(diff -d --old-group-format="$old" --new-group-format="$new" --changed-group-format="$changed" --unchanged-group-format="$unchanged" $file1 $file2 |)) || die("Diff failed: $!");
# system (qq(diff --old-group-format="$old" --new-group-format="$new" --changed-group-format="$changed" --unchanged-group-format="$unchanged" $file1 $file2 > /tmp/output));
my $state = 0;
my $inblock = 0;
my $temp = "";
my $lineCount = 0;
# strategy:
#
# process the output of diff...
#
# a link with control A-D means the start/end of the corresponding ordinal
# state (1-4). Resting state is state 0.
#
# While in a state, accumulate the contents for that state. When exiting the
# state, determine if it is appropriate to emit the contents with markup or
# not (basically, if the accumulated buffer contains only empty lines or lines
# with markup, then we don't want to emit the wrappers. We don't need them.
#
# Note that if there is markup in the "old" block, that markup is silently
# removed. It isn't really that interesting, and it messes up the output
# something fierce.
while (<FILE>) {
my $anchor = $opt_l ? qq[<a tabindex="$diffcounter">] : "" ;
my $anchorEnd = $opt_l ? q[</a>] : "" ;
$lineCount ++;
if ($state == 0) { # if we are resting and we find a marker,
# then we must be entering a block
if (m/^([\001-\004])/) {
$state = ord($1);
$_ = "";
}
# if (m/^\001/) {
# $state = 1;
# s/^/$span[1]/;
# } elsif (m/^\002/) {
# $state = 2;
# s/^/$span[2]/;
# } elsif (m/^\003/) {
# $state = 3;
# s/^/$span[3]/;
# } elsif (m/^\004/) {
# $state = 4;
# s/^/$span[4]/;
# }
} else {
# if we are in "old" state, remove markup
if (($state == 1) || ($state == 2)) {
s/\<.*\>//; # get rid of any old markup
s/\</&lt;/g; # escape any remaining STAG or ETAGs
s/\>/&gt;/g;
}
# if we found another marker, we must be exiting the state
if (m/^([\001-\004])/) {
if ($temp ne "") {
$_ = $span[$state] . $anchor . $temp . $anchorEnd . $diffEnd[$state] . "\n";
$temp = "";
} else {
$_ = "" ;
}
$state = 0;
} elsif (m/^\s*\</) { # otherwise, is this line markup?
# if it is markup AND we haven't seen anything else yet,
# then we will emit the markup
if ($temp eq "") {
$retval .= $_;
$_ = "";
} else { # we wrap it with the state switches and hold it
s/^/$anchorEnd$diffEnd[$state]/;
s/$/$span[$state]$anchor/;
$temp .= $_;
$_ = "";
}
} else {
if (m/.+/) {
$temp .= $_;
$_ = "";
}
}
}
s/\001//g;
s/\002//g;
s/\003//g;
s/\004//g;
if ($_ !~ m/^$/) {
$retval .= $_;
}
$diffcounter++;
}
close FILE;
$retval =~ s/$span[1]\n+$diffEnd[1]//g;
$retval =~ s/$span[2]\n+$diffEnd[2]//g;
$retval =~ s/$span[3]\n+$diffEnd[3]//g;
$retval =~ s/$span[4]\n+$diffEnd[4]//g;
$retval =~ s/$span[1]\n*$//g;
$retval =~ s/$span[2]\n*$//g;
$retval =~ s/$span[3]\n*$//g;
$retval =~ s/$span[4]\n*$//g;
return $retval;
}
sub splitit {
my $filename = shift;
my $headertmp = shift;
my $inheader=0;
my $preformatted=0;
my $inelement=0;
my $retval = "";
my $styles = q(<style type='text/css'>
.diff-old-a {
font-size: smaller;
color: red;
}
.diff-new { background-color: yellow; }
.diff-chg { background-color: lime; }
.diff-new:before,
.diff-new:after
{ content: "\2191" }
.diff-chg:before, .diff-chg:after
{ content: "\2195" }
.diff-old { text-decoration: line-through; background-color: #FBB; }
.diff-old:before,
.diff-old:after
{ content: "\2193" }
:focus { border: thin red solid}
</style>
<script src="https://www.w3.org/2016/10/htmldiff-nav.js"></script>);
if ($opt_t) {
$styles .= q(
<script type="text/javascript">
<!--
function setOldDisplay() {
for ( var s = 0; s < document.styleSheets.length; s++ ) {
var css = document.styleSheets[s];
var mydata ;
try { mydata = css.cssRules ;
if ( ! mydata ) mydata = css.rules;
for ( var r = 0; r < mydata.length; r++ ) {
if ( mydata[r].selectorText == '.diff-old' ) {
mydata[r].style.display = ( mydata[r].style.display == '' ) ? 'none'
: '';
return;
}
}
} catch(e) {} ;
}
}
-->
</script>
);
}
if ($stripheader) {
open(HEADER, ">$headertmp");
}
my $incomment = 0;
my $inhead = 1;
open(FILE, $filename) || die("File $filename cannot be opened: $!");
while (<FILE>) {
if ($inhead == 1) {
if (m/\<\/head/i) {
print HEADER $styles;
}
if (m/\<body/i) {
$inhead = 0;
print HEADER;
if ($opt_t) {
print HEADER q(
<form action=""><input type="button" onclick="setOldDisplay()" value="Show/Hide Old Content" /></form>
);
}
close HEADER;
} else {
print HEADER;
}
} else {
if ($incomment) {
if (m;-->;) {
$incomment = 0;
s/.*-->//;
} else {
next;
}
}
if (m;<!--;) {
while (m;<!--.*-->;) {
s/<!--.*?-->//;
}
if (m;<!--; ) {
$incomment = 1;
s/<!--.*//;
}
}
if (m/\<pre/i) {
$preformatted = 1;
}
if (m/\<\/pre\>/i) {
$preformatted = 0;
}
if ($preformatted) {
$retval .= $_;
} elsif ($mhtmlcomments && /^;;;/) {
$retval .= $_;
} else {
my @list = split(' ');
foreach $element (@list) {
if ($element =~ m/\<H[1-6]/i) {
# $inheader = 1;
}
if ($inheader == 0) {
$element =~ s/</\n</g;
$element =~ s/^\n//;
$element =~ s/>/>\n/g;
$element =~ s/\n$//;
$element =~ s/>\n([.,:!]+)/>$1/g;
}
if ($element =~ m/\<\/H[1-6]\>/i) {
$inheader = 0;
}
$retval .= "$element";
$inelement += ($element =~ s/</&lt;/g);
$inelement -= ($element =~ s/>/&gt;/g);
if ($inelement < 0) {
$inelement = 0;
}
if (($inelement == 0) && ($inheader == 0)) {
$retval .= "\n";
} else {
$retval .= " ";
}
}
undef @list;
}
}
}
$retval .= "\n";
close FILE;
return $retval;
}
$mhtmlcomments = 1;
sub cli {
getopts("clto") || usage();
if ($opt_c) {$mhtmlcomments = 0;}
if (@ARGV < 2) { usage(); }
$file1 = $ARGV[0];
$file2 = $ARGV[1];
$file3 = $ARGV[2];
$tmp = splitit($file1, $headertmp1);
open (FILE, ">$tmp1");
print FILE $tmp;
close FILE;
$tmp = splitit($file2, $headertmp2);
open (FILE, ">$tmp2");
print FILE $tmp;
close FILE;
$output = "";
if ($stripheader) {
open(FILE, $headertmp2);
while (<FILE>) {
$output .= $_;
}
close(FILE);
}
$output .= markit($tmp1, $tmp2);
if ($file3) {
open(FILE, ">$file3");
print FILE $output;
close FILE;
} else {
print $output;
}
}
sub cgi {
# use LWP::UserAgent;
# use CGI;
my $query = new CGI;
my $url1 = $query->param("oldfile");
my $url2 = $query->param("newfile");
my $mhtml = $query->param("mhtml");
my $file1 = "/tmp/htdcgi1.$$";
my $file2 = "/tmp/htdcgi2.$$";
my $ua = new LWP::UserAgent;
$ua->agent("MACS, Inc. HTMLdiff/0.9 " . $ua->agent);
# Create a request
my $req1 = new HTTP::Request GET => $url1;
my $res1 = $ua->request($req1, $file1);
if ($res1->is_error) {
print $res1->error_as_HTML();
print "<p>The URL $url1 could not be found. Please check it and try again.</p>";
return;
}
my $req2 = new HTTP::Request GET => $url2;
my $res2 = $ua->request($req2, $file2);
if ($res2->is_error) {
print $res2->error_as_HTML();
print "<p>The URL $url2 could not be found. Please check it and try again.</p>";
return;
}
$split1 = splitit($file1, $headertmp1);
open (FILE, ">$tmp1");
print FILE $split1;
close FILE;
$split2 = splitit($file2, $headertmp2);
open (FILE, ">$tmp2");
print FILE $split2;
close FILE;
$output = "";
if ($stripheader) {
open(FILE, $headertmp2);
while (<FILE>) {
$output .= $_;
}
close(FILE);
}
$output .= markit($tmp1, $tmp2);
my $base=$res2->base;
if ($base !~ /\/$/) {
$base =~ s/[^\/]*$//;
}
if ( $output !~ /<base/i ) {
$output =~ s/<head>/<head>\n<base href="$base">/i ||
$output =~ s/<html>/<html>\n<base href="$base">/i ;
}
print $query->header(-type=>'text/html',-nph=>1);
print $output;
unlink $file1;
unlink $file2;
}
$tmp1="/tmp/htdtmp1.$$";
$headertmp1="/tmp/htdhtmp1.$$";
$tmp2="/tmp/htdtmp2.$$";
$headertmp2="/tmp/htdhtmp2.$$";
$stripheader = 1;
if (@ARGV == 0) {
cgi(); # if no arguments, we must be operating as a cgi script
} else {
cli(); # if there are arguments, then we are operating as a CLI
}
unlink $tmp1;
unlink $headertmp1;
unlink $tmp2;
unlink $headertmp2;

View File

@ -207,10 +207,15 @@ be named `size`.
Any member that describes the number of something, such as an array length
or number of internal allocations, should be suffixed with `Count`.
If the context is self-evident from the structure name, then it may simply
be named `count`.
The `size` rule overrides this rule, though it is possible to have multiple
sizes (e.g. `sizeCount`).
If the member is an array length, then the name of length should correspond
to the name of the array member, usually `XYZCount` for an array named
`pXYZs`.
If a member of a chained extension structure is an array whose length must
match the length of an array of the base structure, then the chained
extension structure should include an array length member with the same name
as the length in the base structure.
These rules apply to all function parameters and struct/union members, with
a single exception:

851
src/ext_loader/vulkan_ext.c Normal file
View File

@ -0,0 +1,851 @@
/*
** Copyright (c) 2015-2016 The Khronos Group Inc.
**
** 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.
*/
/*
** This header is generated from the Khronos Vulkan XML API Registry.
**
*/
#include <vulkan/vulkan.h>
#ifdef VK_KHR_surface
static PFN_vkDestroySurfaceKHR pfn_vkDestroySurfaceKHR;
void vkDestroySurfaceKHR(
VkInstance instance,
VkSurfaceKHR surface,
const VkAllocationCallbacks* pAllocator)
{
pfn_vkDestroySurfaceKHR(
instance,
surface,
pAllocator
);
}
static PFN_vkGetPhysicalDeviceSurfaceSupportKHR pfn_vkGetPhysicalDeviceSurfaceSupportKHR;
VkResult vkGetPhysicalDeviceSurfaceSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex,
VkSurfaceKHR surface,
VkBool32* pSupported)
{
return pfn_vkGetPhysicalDeviceSurfaceSupportKHR(
physicalDevice,
queueFamilyIndex,
surface,
pSupported
);
}
static PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR pfn_vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
VkResult vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
VkPhysicalDevice physicalDevice,
VkSurfaceKHR surface,
VkSurfaceCapabilitiesKHR* pSurfaceCapabilities)
{
return pfn_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
physicalDevice,
surface,
pSurfaceCapabilities
);
}
static PFN_vkGetPhysicalDeviceSurfaceFormatsKHR pfn_vkGetPhysicalDeviceSurfaceFormatsKHR;
VkResult vkGetPhysicalDeviceSurfaceFormatsKHR(
VkPhysicalDevice physicalDevice,
VkSurfaceKHR surface,
uint32_t* pSurfaceFormatCount,
VkSurfaceFormatKHR* pSurfaceFormats)
{
return pfn_vkGetPhysicalDeviceSurfaceFormatsKHR(
physicalDevice,
surface,
pSurfaceFormatCount,
pSurfaceFormats
);
}
static PFN_vkGetPhysicalDeviceSurfacePresentModesKHR pfn_vkGetPhysicalDeviceSurfacePresentModesKHR;
VkResult vkGetPhysicalDeviceSurfacePresentModesKHR(
VkPhysicalDevice physicalDevice,
VkSurfaceKHR surface,
uint32_t* pPresentModeCount,
VkPresentModeKHR* pPresentModes)
{
return pfn_vkGetPhysicalDeviceSurfacePresentModesKHR(
physicalDevice,
surface,
pPresentModeCount,
pPresentModes
);
}
#endif /* VK_KHR_surface */
#ifdef VK_KHR_swapchain
static PFN_vkCreateSwapchainKHR pfn_vkCreateSwapchainKHR;
VkResult vkCreateSwapchainKHR(
VkDevice device,
const VkSwapchainCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSwapchainKHR* pSwapchain)
{
return pfn_vkCreateSwapchainKHR(
device,
pCreateInfo,
pAllocator,
pSwapchain
);
}
static PFN_vkDestroySwapchainKHR pfn_vkDestroySwapchainKHR;
void vkDestroySwapchainKHR(
VkDevice device,
VkSwapchainKHR swapchain,
const VkAllocationCallbacks* pAllocator)
{
pfn_vkDestroySwapchainKHR(
device,
swapchain,
pAllocator
);
}
static PFN_vkGetSwapchainImagesKHR pfn_vkGetSwapchainImagesKHR;
VkResult vkGetSwapchainImagesKHR(
VkDevice device,
VkSwapchainKHR swapchain,
uint32_t* pSwapchainImageCount,
VkImage* pSwapchainImages)
{
return pfn_vkGetSwapchainImagesKHR(
device,
swapchain,
pSwapchainImageCount,
pSwapchainImages
);
}
static PFN_vkAcquireNextImageKHR pfn_vkAcquireNextImageKHR;
VkResult vkAcquireNextImageKHR(
VkDevice device,
VkSwapchainKHR swapchain,
uint64_t timeout,
VkSemaphore semaphore,
VkFence fence,
uint32_t* pImageIndex)
{
return pfn_vkAcquireNextImageKHR(
device,
swapchain,
timeout,
semaphore,
fence,
pImageIndex
);
}
static PFN_vkQueuePresentKHR pfn_vkQueuePresentKHR;
VkResult vkQueuePresentKHR(
VkQueue queue,
const VkPresentInfoKHR* pPresentInfo)
{
return pfn_vkQueuePresentKHR(
queue,
pPresentInfo
);
}
#endif /* VK_KHR_swapchain */
#ifdef VK_KHR_display
static PFN_vkGetPhysicalDeviceDisplayPropertiesKHR pfn_vkGetPhysicalDeviceDisplayPropertiesKHR;
VkResult vkGetPhysicalDeviceDisplayPropertiesKHR(
VkPhysicalDevice physicalDevice,
uint32_t* pPropertyCount,
VkDisplayPropertiesKHR* pProperties)
{
return pfn_vkGetPhysicalDeviceDisplayPropertiesKHR(
physicalDevice,
pPropertyCount,
pProperties
);
}
static PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR pfn_vkGetPhysicalDeviceDisplayPlanePropertiesKHR;
VkResult vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
VkPhysicalDevice physicalDevice,
uint32_t* pPropertyCount,
VkDisplayPlanePropertiesKHR* pProperties)
{
return pfn_vkGetPhysicalDeviceDisplayPlanePropertiesKHR(
physicalDevice,
pPropertyCount,
pProperties
);
}
static PFN_vkGetDisplayPlaneSupportedDisplaysKHR pfn_vkGetDisplayPlaneSupportedDisplaysKHR;
VkResult vkGetDisplayPlaneSupportedDisplaysKHR(
VkPhysicalDevice physicalDevice,
uint32_t planeIndex,
uint32_t* pDisplayCount,
VkDisplayKHR* pDisplays)
{
return pfn_vkGetDisplayPlaneSupportedDisplaysKHR(
physicalDevice,
planeIndex,
pDisplayCount,
pDisplays
);
}
static PFN_vkGetDisplayModePropertiesKHR pfn_vkGetDisplayModePropertiesKHR;
VkResult vkGetDisplayModePropertiesKHR(
VkPhysicalDevice physicalDevice,
VkDisplayKHR display,
uint32_t* pPropertyCount,
VkDisplayModePropertiesKHR* pProperties)
{
return pfn_vkGetDisplayModePropertiesKHR(
physicalDevice,
display,
pPropertyCount,
pProperties
);
}
static PFN_vkCreateDisplayModeKHR pfn_vkCreateDisplayModeKHR;
VkResult vkCreateDisplayModeKHR(
VkPhysicalDevice physicalDevice,
VkDisplayKHR display,
const VkDisplayModeCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDisplayModeKHR* pMode)
{
return pfn_vkCreateDisplayModeKHR(
physicalDevice,
display,
pCreateInfo,
pAllocator,
pMode
);
}
static PFN_vkGetDisplayPlaneCapabilitiesKHR pfn_vkGetDisplayPlaneCapabilitiesKHR;
VkResult vkGetDisplayPlaneCapabilitiesKHR(
VkPhysicalDevice physicalDevice,
VkDisplayModeKHR mode,
uint32_t planeIndex,
VkDisplayPlaneCapabilitiesKHR* pCapabilities)
{
return pfn_vkGetDisplayPlaneCapabilitiesKHR(
physicalDevice,
mode,
planeIndex,
pCapabilities
);
}
static PFN_vkCreateDisplayPlaneSurfaceKHR pfn_vkCreateDisplayPlaneSurfaceKHR;
VkResult vkCreateDisplayPlaneSurfaceKHR(
VkInstance instance,
const VkDisplaySurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
return pfn_vkCreateDisplayPlaneSurfaceKHR(
instance,
pCreateInfo,
pAllocator,
pSurface
);
}
#endif /* VK_KHR_display */
#ifdef VK_KHR_display_swapchain
static PFN_vkCreateSharedSwapchainsKHR pfn_vkCreateSharedSwapchainsKHR;
VkResult vkCreateSharedSwapchainsKHR(
VkDevice device,
uint32_t swapchainCount,
const VkSwapchainCreateInfoKHR* pCreateInfos,
const VkAllocationCallbacks* pAllocator,
VkSwapchainKHR* pSwapchains)
{
return pfn_vkCreateSharedSwapchainsKHR(
device,
swapchainCount,
pCreateInfos,
pAllocator,
pSwapchains
);
}
#endif /* VK_KHR_display_swapchain */
#ifdef VK_KHR_xlib_surface
#ifdef VK_USE_PLATFORM_XLIB_KHR
static PFN_vkCreateXlibSurfaceKHR pfn_vkCreateXlibSurfaceKHR;
VkResult vkCreateXlibSurfaceKHR(
VkInstance instance,
const VkXlibSurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
return pfn_vkCreateXlibSurfaceKHR(
instance,
pCreateInfo,
pAllocator,
pSurface
);
}
static PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR pfn_vkGetPhysicalDeviceXlibPresentationSupportKHR;
VkBool32 vkGetPhysicalDeviceXlibPresentationSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex,
Display* dpy,
VisualID visualID)
{
return pfn_vkGetPhysicalDeviceXlibPresentationSupportKHR(
physicalDevice,
queueFamilyIndex,
dpy,
visualID
);
}
#endif /* VK_USE_PLATFORM_XLIB_KHR */
#endif /* VK_KHR_xlib_surface */
#ifdef VK_KHR_xcb_surface
#ifdef VK_USE_PLATFORM_XCB_KHR
static PFN_vkCreateXcbSurfaceKHR pfn_vkCreateXcbSurfaceKHR;
VkResult vkCreateXcbSurfaceKHR(
VkInstance instance,
const VkXcbSurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
return pfn_vkCreateXcbSurfaceKHR(
instance,
pCreateInfo,
pAllocator,
pSurface
);
}
static PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR pfn_vkGetPhysicalDeviceXcbPresentationSupportKHR;
VkBool32 vkGetPhysicalDeviceXcbPresentationSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex,
xcb_connection_t* connection,
xcb_visualid_t visual_id)
{
return pfn_vkGetPhysicalDeviceXcbPresentationSupportKHR(
physicalDevice,
queueFamilyIndex,
connection,
visual_id
);
}
#endif /* VK_USE_PLATFORM_XCB_KHR */
#endif /* VK_KHR_xcb_surface */
#ifdef VK_KHR_wayland_surface
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
static PFN_vkCreateWaylandSurfaceKHR pfn_vkCreateWaylandSurfaceKHR;
VkResult vkCreateWaylandSurfaceKHR(
VkInstance instance,
const VkWaylandSurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
return pfn_vkCreateWaylandSurfaceKHR(
instance,
pCreateInfo,
pAllocator,
pSurface
);
}
static PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR pfn_vkGetPhysicalDeviceWaylandPresentationSupportKHR;
VkBool32 vkGetPhysicalDeviceWaylandPresentationSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex,
struct wl_display* display)
{
return pfn_vkGetPhysicalDeviceWaylandPresentationSupportKHR(
physicalDevice,
queueFamilyIndex,
display
);
}
#endif /* VK_USE_PLATFORM_WAYLAND_KHR */
#endif /* VK_KHR_wayland_surface */
#ifdef VK_KHR_mir_surface
#ifdef VK_USE_PLATFORM_MIR_KHR
static PFN_vkCreateMirSurfaceKHR pfn_vkCreateMirSurfaceKHR;
VkResult vkCreateMirSurfaceKHR(
VkInstance instance,
const VkMirSurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
return pfn_vkCreateMirSurfaceKHR(
instance,
pCreateInfo,
pAllocator,
pSurface
);
}
static PFN_vkGetPhysicalDeviceMirPresentationSupportKHR pfn_vkGetPhysicalDeviceMirPresentationSupportKHR;
VkBool32 vkGetPhysicalDeviceMirPresentationSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex,
MirConnection* connection)
{
return pfn_vkGetPhysicalDeviceMirPresentationSupportKHR(
physicalDevice,
queueFamilyIndex,
connection
);
}
#endif /* VK_USE_PLATFORM_MIR_KHR */
#endif /* VK_KHR_mir_surface */
#ifdef VK_KHR_android_surface
#ifdef VK_USE_PLATFORM_ANDROID_KHR
static PFN_vkCreateAndroidSurfaceKHR pfn_vkCreateAndroidSurfaceKHR;
VkResult vkCreateAndroidSurfaceKHR(
VkInstance instance,
const VkAndroidSurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
return pfn_vkCreateAndroidSurfaceKHR(
instance,
pCreateInfo,
pAllocator,
pSurface
);
}
#endif /* VK_USE_PLATFORM_ANDROID_KHR */
#endif /* VK_KHR_android_surface */
#ifdef VK_KHR_win32_surface
#ifdef VK_USE_PLATFORM_WIN32_KHR
static PFN_vkCreateWin32SurfaceKHR pfn_vkCreateWin32SurfaceKHR;
VkResult vkCreateWin32SurfaceKHR(
VkInstance instance,
const VkWin32SurfaceCreateInfoKHR* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkSurfaceKHR* pSurface)
{
return pfn_vkCreateWin32SurfaceKHR(
instance,
pCreateInfo,
pAllocator,
pSurface
);
}
static PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR pfn_vkGetPhysicalDeviceWin32PresentationSupportKHR;
VkBool32 vkGetPhysicalDeviceWin32PresentationSupportKHR(
VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex)
{
return pfn_vkGetPhysicalDeviceWin32PresentationSupportKHR(
physicalDevice,
queueFamilyIndex
);
}
#endif /* VK_USE_PLATFORM_WIN32_KHR */
#endif /* VK_KHR_win32_surface */
#ifdef VK_EXT_debug_report
static PFN_vkCreateDebugReportCallbackEXT pfn_vkCreateDebugReportCallbackEXT;
VkResult vkCreateDebugReportCallbackEXT(
VkInstance instance,
const VkDebugReportCallbackCreateInfoEXT* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDebugReportCallbackEXT* pCallback)
{
return pfn_vkCreateDebugReportCallbackEXT(
instance,
pCreateInfo,
pAllocator,
pCallback
);
}
static PFN_vkDestroyDebugReportCallbackEXT pfn_vkDestroyDebugReportCallbackEXT;
void vkDestroyDebugReportCallbackEXT(
VkInstance instance,
VkDebugReportCallbackEXT callback,
const VkAllocationCallbacks* pAllocator)
{
pfn_vkDestroyDebugReportCallbackEXT(
instance,
callback,
pAllocator
);
}
static PFN_vkDebugReportMessageEXT pfn_vkDebugReportMessageEXT;
void vkDebugReportMessageEXT(
VkInstance instance,
VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objectType,
uint64_t object,
size_t location,
int32_t messageCode,
const char* pLayerPrefix,
const char* pMessage)
{
pfn_vkDebugReportMessageEXT(
instance,
flags,
objectType,
object,
location,
messageCode,
pLayerPrefix,
pMessage
);
}
#endif /* VK_EXT_debug_report */
#ifdef VK_EXT_debug_marker
static PFN_vkDebugMarkerSetObjectTagEXT pfn_vkDebugMarkerSetObjectTagEXT;
VkResult vkDebugMarkerSetObjectTagEXT(
VkDevice device,
VkDebugMarkerObjectTagInfoEXT* pTagInfo)
{
return pfn_vkDebugMarkerSetObjectTagEXT(
device,
pTagInfo
);
}
static PFN_vkDebugMarkerSetObjectNameEXT pfn_vkDebugMarkerSetObjectNameEXT;
VkResult vkDebugMarkerSetObjectNameEXT(
VkDevice device,
VkDebugMarkerObjectNameInfoEXT* pNameInfo)
{
return pfn_vkDebugMarkerSetObjectNameEXT(
device,
pNameInfo
);
}
static PFN_vkCmdDebugMarkerBeginEXT pfn_vkCmdDebugMarkerBeginEXT;
void vkCmdDebugMarkerBeginEXT(
VkCommandBuffer commandBuffer,
VkDebugMarkerMarkerInfoEXT* pMarkerInfo)
{
pfn_vkCmdDebugMarkerBeginEXT(
commandBuffer,
pMarkerInfo
);
}
static PFN_vkCmdDebugMarkerEndEXT pfn_vkCmdDebugMarkerEndEXT;
void vkCmdDebugMarkerEndEXT(
VkCommandBuffer commandBuffer)
{
pfn_vkCmdDebugMarkerEndEXT(
commandBuffer
);
}
static PFN_vkCmdDebugMarkerInsertEXT pfn_vkCmdDebugMarkerInsertEXT;
void vkCmdDebugMarkerInsertEXT(
VkCommandBuffer commandBuffer,
VkDebugMarkerMarkerInfoEXT* pMarkerInfo)
{
pfn_vkCmdDebugMarkerInsertEXT(
commandBuffer,
pMarkerInfo
);
}
#endif /* VK_EXT_debug_marker */
#ifdef VK_AMD_draw_indirect_count
static PFN_vkCmdDrawIndirectCountAMD pfn_vkCmdDrawIndirectCountAMD;
void vkCmdDrawIndirectCountAMD(
VkCommandBuffer commandBuffer,
VkBuffer buffer,
VkDeviceSize offset,
VkBuffer countBuffer,
VkDeviceSize countBufferOffset,
uint32_t maxDrawCount,
uint32_t stride)
{
pfn_vkCmdDrawIndirectCountAMD(
commandBuffer,
buffer,
offset,
countBuffer,
countBufferOffset,
maxDrawCount,
stride
);
}
static PFN_vkCmdDrawIndexedIndirectCountAMD pfn_vkCmdDrawIndexedIndirectCountAMD;
void vkCmdDrawIndexedIndirectCountAMD(
VkCommandBuffer commandBuffer,
VkBuffer buffer,
VkDeviceSize offset,
VkBuffer countBuffer,
VkDeviceSize countBufferOffset,
uint32_t maxDrawCount,
uint32_t stride)
{
pfn_vkCmdDrawIndexedIndirectCountAMD(
commandBuffer,
buffer,
offset,
countBuffer,
countBufferOffset,
maxDrawCount,
stride
);
}
#endif /* VK_AMD_draw_indirect_count */
#ifdef VK_NV_external_memory_capabilities
static PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV pfn_vkGetPhysicalDeviceExternalImageFormatPropertiesNV;
VkResult vkGetPhysicalDeviceExternalImageFormatPropertiesNV(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkImageType type,
VkImageTiling tiling,
VkImageUsageFlags usage,
VkImageCreateFlags flags,
VkExternalMemoryHandleTypeFlagsNV externalHandleType,
VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties)
{
return pfn_vkGetPhysicalDeviceExternalImageFormatPropertiesNV(
physicalDevice,
format,
type,
tiling,
usage,
flags,
externalHandleType,
pExternalImageFormatProperties
);
}
#endif /* VK_NV_external_memory_capabilities */
#ifdef VK_NV_external_memory_win32
#ifdef VK_USE_PLATFORM_WIN32_KHR
static PFN_vkGetMemoryWin32HandleNV pfn_vkGetMemoryWin32HandleNV;
VkResult vkGetMemoryWin32HandleNV(
VkDevice device,
VkDeviceMemory memory,
VkExternalMemoryHandleTypeFlagsNV handleType,
HANDLE* pHandle)
{
return pfn_vkGetMemoryWin32HandleNV(
device,
memory,
handleType,
pHandle
);
}
#endif /* VK_USE_PLATFORM_WIN32_KHR */
#endif /* VK_NV_external_memory_win32 */
void vkExtInitInstance(VkInstance instance)
{
#ifdef VK_KHR_surface
pfn_vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR)vkGetInstanceProcAddr(instance, "vkDestroySurfaceKHR");
pfn_vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceSupportKHR");
pfn_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
pfn_vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfaceFormatsKHR");
pfn_vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceSurfacePresentModesKHR");
#endif /* VK_KHR_surface */
#ifdef VK_KHR_swapchain
pfn_vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)vkGetInstanceProcAddr(instance, "vkCreateSwapchainKHR");
pfn_vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR)vkGetInstanceProcAddr(instance, "vkDestroySwapchainKHR");
pfn_vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR)vkGetInstanceProcAddr(instance, "vkGetSwapchainImagesKHR");
pfn_vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR)vkGetInstanceProcAddr(instance, "vkAcquireNextImageKHR");
pfn_vkQueuePresentKHR = (PFN_vkQueuePresentKHR)vkGetInstanceProcAddr(instance, "vkQueuePresentKHR");
#endif /* VK_KHR_swapchain */
#ifdef VK_KHR_display
pfn_vkGetPhysicalDeviceDisplayPropertiesKHR = (PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPropertiesKHR");
pfn_vkGetPhysicalDeviceDisplayPlanePropertiesKHR = (PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR");
pfn_vkGetDisplayPlaneSupportedDisplaysKHR = (PFN_vkGetDisplayPlaneSupportedDisplaysKHR)vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneSupportedDisplaysKHR");
pfn_vkGetDisplayModePropertiesKHR = (PFN_vkGetDisplayModePropertiesKHR)vkGetInstanceProcAddr(instance, "vkGetDisplayModePropertiesKHR");
pfn_vkCreateDisplayModeKHR = (PFN_vkCreateDisplayModeKHR)vkGetInstanceProcAddr(instance, "vkCreateDisplayModeKHR");
pfn_vkGetDisplayPlaneCapabilitiesKHR = (PFN_vkGetDisplayPlaneCapabilitiesKHR)vkGetInstanceProcAddr(instance, "vkGetDisplayPlaneCapabilitiesKHR");
pfn_vkCreateDisplayPlaneSurfaceKHR = (PFN_vkCreateDisplayPlaneSurfaceKHR)vkGetInstanceProcAddr(instance, "vkCreateDisplayPlaneSurfaceKHR");
#endif /* VK_KHR_display */
#ifdef VK_KHR_display_swapchain
pfn_vkCreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR)vkGetInstanceProcAddr(instance, "vkCreateSharedSwapchainsKHR");
#endif /* VK_KHR_display_swapchain */
#ifdef VK_KHR_xlib_surface
#ifndef VK_KHR_xlib_surface
pfn_vkCreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr(instance, "vkCreateXlibSurfaceKHR");
pfn_vkGetPhysicalDeviceXlibPresentationSupportKHR = (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceXlibPresentationSupportKHR");
#endif /* VK_USE_PLATFORM_XLIB_KHR */
#endif /* VK_KHR_xlib_surface */
#ifdef VK_KHR_xcb_surface
#ifndef VK_KHR_xcb_surface
pfn_vkCreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr(instance, "vkCreateXcbSurfaceKHR");
pfn_vkGetPhysicalDeviceXcbPresentationSupportKHR = (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceXcbPresentationSupportKHR");
#endif /* VK_USE_PLATFORM_XCB_KHR */
#endif /* VK_KHR_xcb_surface */
#ifdef VK_KHR_wayland_surface
#ifndef VK_KHR_wayland_surface
pfn_vkCreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR)vkGetInstanceProcAddr(instance, "vkCreateWaylandSurfaceKHR");
pfn_vkGetPhysicalDeviceWaylandPresentationSupportKHR = (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceWaylandPresentationSupportKHR");
#endif /* VK_USE_PLATFORM_WAYLAND_KHR */
#endif /* VK_KHR_wayland_surface */
#ifdef VK_KHR_mir_surface
#ifndef VK_KHR_mir_surface
pfn_vkCreateMirSurfaceKHR = (PFN_vkCreateMirSurfaceKHR)vkGetInstanceProcAddr(instance, "vkCreateMirSurfaceKHR");
pfn_vkGetPhysicalDeviceMirPresentationSupportKHR = (PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceMirPresentationSupportKHR");
#endif /* VK_USE_PLATFORM_MIR_KHR */
#endif /* VK_KHR_mir_surface */
#ifdef VK_KHR_android_surface
#ifndef VK_KHR_android_surface
pfn_vkCreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)vkGetInstanceProcAddr(instance, "vkCreateAndroidSurfaceKHR");
#endif /* VK_USE_PLATFORM_ANDROID_KHR */
#endif /* VK_KHR_android_surface */
#ifdef VK_KHR_win32_surface
#ifndef VK_KHR_win32_surface
pfn_vkCreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)vkGetInstanceProcAddr(instance, "vkCreateWin32SurfaceKHR");
pfn_vkGetPhysicalDeviceWin32PresentationSupportKHR = (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceWin32PresentationSupportKHR");
#endif /* VK_USE_PLATFORM_WIN32_KHR */
#endif /* VK_KHR_win32_surface */
#ifdef VK_EXT_debug_report
pfn_vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(instance, "vkCreateDebugReportCallbackEXT");
pfn_vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(instance, "vkDestroyDebugReportCallbackEXT");
pfn_vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT)vkGetInstanceProcAddr(instance, "vkDebugReportMessageEXT");
#endif /* VK_EXT_debug_report */
#ifdef VK_EXT_debug_marker
pfn_vkDebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT)vkGetInstanceProcAddr(instance, "vkDebugMarkerSetObjectTagEXT");
pfn_vkDebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)vkGetInstanceProcAddr(instance, "vkDebugMarkerSetObjectNameEXT");
pfn_vkCmdDebugMarkerBeginEXT = (PFN_vkCmdDebugMarkerBeginEXT)vkGetInstanceProcAddr(instance, "vkCmdDebugMarkerBeginEXT");
pfn_vkCmdDebugMarkerEndEXT = (PFN_vkCmdDebugMarkerEndEXT)vkGetInstanceProcAddr(instance, "vkCmdDebugMarkerEndEXT");
pfn_vkCmdDebugMarkerInsertEXT = (PFN_vkCmdDebugMarkerInsertEXT)vkGetInstanceProcAddr(instance, "vkCmdDebugMarkerInsertEXT");
#endif /* VK_EXT_debug_marker */
#ifdef VK_AMD_draw_indirect_count
pfn_vkCmdDrawIndirectCountAMD = (PFN_vkCmdDrawIndirectCountAMD)vkGetInstanceProcAddr(instance, "vkCmdDrawIndirectCountAMD");
pfn_vkCmdDrawIndexedIndirectCountAMD = (PFN_vkCmdDrawIndexedIndirectCountAMD)vkGetInstanceProcAddr(instance, "vkCmdDrawIndexedIndirectCountAMD");
#endif /* VK_AMD_draw_indirect_count */
#ifdef VK_NV_external_memory_capabilities
pfn_vkGetPhysicalDeviceExternalImageFormatPropertiesNV = (PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)vkGetInstanceProcAddr(instance, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV");
#endif /* VK_NV_external_memory_capabilities */
#ifdef VK_NV_external_memory_win32
#ifndef VK_NV_external_memory_win32
pfn_vkGetMemoryWin32HandleNV = (PFN_vkGetMemoryWin32HandleNV)vkGetInstanceProcAddr(instance, "vkGetMemoryWin32HandleNV");
#endif /* VK_USE_PLATFORM_WIN32_KHR */
#endif /* VK_NV_external_memory_win32 */
}
void vkExtInitDevice(VkDevice device)
{
#ifdef VK_KHR_surface
pfn_vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR)vkGetDeviceProcAddr(device, "vkDestroySurfaceKHR");
pfn_vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR)vkGetDeviceProcAddr(device, "vkGetPhysicalDeviceSurfaceSupportKHR");
pfn_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)vkGetDeviceProcAddr(device, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
pfn_vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)vkGetDeviceProcAddr(device, "vkGetPhysicalDeviceSurfaceFormatsKHR");
pfn_vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)vkGetDeviceProcAddr(device, "vkGetPhysicalDeviceSurfacePresentModesKHR");
#endif /* VK_KHR_surface */
#ifdef VK_KHR_swapchain
pfn_vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)vkGetDeviceProcAddr(device, "vkCreateSwapchainKHR");
pfn_vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR)vkGetDeviceProcAddr(device, "vkDestroySwapchainKHR");
pfn_vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR)vkGetDeviceProcAddr(device, "vkGetSwapchainImagesKHR");
pfn_vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR)vkGetDeviceProcAddr(device, "vkAcquireNextImageKHR");
pfn_vkQueuePresentKHR = (PFN_vkQueuePresentKHR)vkGetDeviceProcAddr(device, "vkQueuePresentKHR");
#endif /* VK_KHR_swapchain */
#ifdef VK_KHR_display
pfn_vkGetPhysicalDeviceDisplayPropertiesKHR = (PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)vkGetDeviceProcAddr(device, "vkGetPhysicalDeviceDisplayPropertiesKHR");
pfn_vkGetPhysicalDeviceDisplayPlanePropertiesKHR = (PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)vkGetDeviceProcAddr(device, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR");
pfn_vkGetDisplayPlaneSupportedDisplaysKHR = (PFN_vkGetDisplayPlaneSupportedDisplaysKHR)vkGetDeviceProcAddr(device, "vkGetDisplayPlaneSupportedDisplaysKHR");
pfn_vkGetDisplayModePropertiesKHR = (PFN_vkGetDisplayModePropertiesKHR)vkGetDeviceProcAddr(device, "vkGetDisplayModePropertiesKHR");
pfn_vkCreateDisplayModeKHR = (PFN_vkCreateDisplayModeKHR)vkGetDeviceProcAddr(device, "vkCreateDisplayModeKHR");
pfn_vkGetDisplayPlaneCapabilitiesKHR = (PFN_vkGetDisplayPlaneCapabilitiesKHR)vkGetDeviceProcAddr(device, "vkGetDisplayPlaneCapabilitiesKHR");
pfn_vkCreateDisplayPlaneSurfaceKHR = (PFN_vkCreateDisplayPlaneSurfaceKHR)vkGetDeviceProcAddr(device, "vkCreateDisplayPlaneSurfaceKHR");
#endif /* VK_KHR_display */
#ifdef VK_KHR_display_swapchain
pfn_vkCreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR)vkGetDeviceProcAddr(device, "vkCreateSharedSwapchainsKHR");
#endif /* VK_KHR_display_swapchain */
#ifdef VK_KHR_xlib_surface
#ifndef VK_KHR_xlib_surface
pfn_vkCreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR)vkGetDeviceProcAddr(device, "vkCreateXlibSurfaceKHR");
pfn_vkGetPhysicalDeviceXlibPresentationSupportKHR = (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)vkGetDeviceProcAddr(device, "vkGetPhysicalDeviceXlibPresentationSupportKHR");
#endif /* VK_USE_PLATFORM_XLIB_KHR */
#endif /* VK_KHR_xlib_surface */
#ifdef VK_KHR_xcb_surface
#ifndef VK_KHR_xcb_surface
pfn_vkCreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR)vkGetDeviceProcAddr(device, "vkCreateXcbSurfaceKHR");
pfn_vkGetPhysicalDeviceXcbPresentationSupportKHR = (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)vkGetDeviceProcAddr(device, "vkGetPhysicalDeviceXcbPresentationSupportKHR");
#endif /* VK_USE_PLATFORM_XCB_KHR */
#endif /* VK_KHR_xcb_surface */
#ifdef VK_KHR_wayland_surface
#ifndef VK_KHR_wayland_surface
pfn_vkCreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR)vkGetDeviceProcAddr(device, "vkCreateWaylandSurfaceKHR");
pfn_vkGetPhysicalDeviceWaylandPresentationSupportKHR = (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)vkGetDeviceProcAddr(device, "vkGetPhysicalDeviceWaylandPresentationSupportKHR");
#endif /* VK_USE_PLATFORM_WAYLAND_KHR */
#endif /* VK_KHR_wayland_surface */
#ifdef VK_KHR_mir_surface
#ifndef VK_KHR_mir_surface
pfn_vkCreateMirSurfaceKHR = (PFN_vkCreateMirSurfaceKHR)vkGetDeviceProcAddr(device, "vkCreateMirSurfaceKHR");
pfn_vkGetPhysicalDeviceMirPresentationSupportKHR = (PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)vkGetDeviceProcAddr(device, "vkGetPhysicalDeviceMirPresentationSupportKHR");
#endif /* VK_USE_PLATFORM_MIR_KHR */
#endif /* VK_KHR_mir_surface */
#ifdef VK_KHR_android_surface
#ifndef VK_KHR_android_surface
pfn_vkCreateAndroidSurfaceKHR = (PFN_vkCreateAndroidSurfaceKHR)vkGetDeviceProcAddr(device, "vkCreateAndroidSurfaceKHR");
#endif /* VK_USE_PLATFORM_ANDROID_KHR */
#endif /* VK_KHR_android_surface */
#ifdef VK_KHR_win32_surface
#ifndef VK_KHR_win32_surface
pfn_vkCreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)vkGetDeviceProcAddr(device, "vkCreateWin32SurfaceKHR");
pfn_vkGetPhysicalDeviceWin32PresentationSupportKHR = (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)vkGetDeviceProcAddr(device, "vkGetPhysicalDeviceWin32PresentationSupportKHR");
#endif /* VK_USE_PLATFORM_WIN32_KHR */
#endif /* VK_KHR_win32_surface */
#ifdef VK_EXT_debug_report
pfn_vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)vkGetDeviceProcAddr(device, "vkCreateDebugReportCallbackEXT");
pfn_vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)vkGetDeviceProcAddr(device, "vkDestroyDebugReportCallbackEXT");
pfn_vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT)vkGetDeviceProcAddr(device, "vkDebugReportMessageEXT");
#endif /* VK_EXT_debug_report */
#ifdef VK_EXT_debug_marker
pfn_vkDebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT)vkGetDeviceProcAddr(device, "vkDebugMarkerSetObjectTagEXT");
pfn_vkDebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)vkGetDeviceProcAddr(device, "vkDebugMarkerSetObjectNameEXT");
pfn_vkCmdDebugMarkerBeginEXT = (PFN_vkCmdDebugMarkerBeginEXT)vkGetDeviceProcAddr(device, "vkCmdDebugMarkerBeginEXT");
pfn_vkCmdDebugMarkerEndEXT = (PFN_vkCmdDebugMarkerEndEXT)vkGetDeviceProcAddr(device, "vkCmdDebugMarkerEndEXT");
pfn_vkCmdDebugMarkerInsertEXT = (PFN_vkCmdDebugMarkerInsertEXT)vkGetDeviceProcAddr(device, "vkCmdDebugMarkerInsertEXT");
#endif /* VK_EXT_debug_marker */
#ifdef VK_AMD_draw_indirect_count
pfn_vkCmdDrawIndirectCountAMD = (PFN_vkCmdDrawIndirectCountAMD)vkGetDeviceProcAddr(device, "vkCmdDrawIndirectCountAMD");
pfn_vkCmdDrawIndexedIndirectCountAMD = (PFN_vkCmdDrawIndexedIndirectCountAMD)vkGetDeviceProcAddr(device, "vkCmdDrawIndexedIndirectCountAMD");
#endif /* VK_AMD_draw_indirect_count */
#ifdef VK_NV_external_memory_capabilities
pfn_vkGetPhysicalDeviceExternalImageFormatPropertiesNV = (PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)vkGetDeviceProcAddr(device, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV");
#endif /* VK_NV_external_memory_capabilities */
#ifdef VK_NV_external_memory_win32
#ifndef VK_NV_external_memory_win32
pfn_vkGetMemoryWin32HandleNV = (PFN_vkGetMemoryWin32HandleNV)vkGetDeviceProcAddr(device, "vkGetMemoryWin32HandleNV");
#endif /* VK_USE_PLATFORM_WIN32_KHR */
#endif /* VK_NV_external_memory_win32 */
}

View File

@ -0,0 +1,63 @@
#ifndef VULKAN_EXT_H
#define VULKAN_EXT_H
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2015-2016 The Khronos Group Inc.
**
** 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.
*/
/*
** This header is generated from the Khronos Vulkan XML API Registry.
**
*/
/*
** This is a simple extension loader which provides the implementations for the
** extension prototypes declared in vulkan header. It supports loading extensions either
** for a single instance or a single device. Multiple instances are not yet supported.
**
** To use the loader add vulkan_ext.c to your solution and include <vulkan/vulkan_ext.h>.
**
** If your application is using a single instance, but multiple devices callParam
**
** vkExtInitInstance(instance);
**
** after initializing the instance. This way the extension loader will use the loaders
** trampoline functions to call the correct driver for each call. This method is safe
** if your application might use more than one device at the cost of one additional
** indirection, the dispatch table of each dispatchable object.
**
** If your application uses only a single device it's better to use
**
** vkExtInitDevice(device);
**
** once the device has been initialized. This will resolve the function pointers
** upfront and thus removes one indirection for each call into the driver. This *can*
** result in slightly more performance for calling overhead limited cases.
*/
#include <vulkan/vulkan.h>
void vkExtInitInstance(VkInstance instance);
void vkExtInitDevice(VkDevice device);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -36,27 +36,31 @@ OUTDIR = ../../out/1.0
# clean_dirt - remove intermediate files.
# clean - remove installed and intermediate files.
HEADERS = ../vulkan/vulkan.h
VULKAN = ../vulkan
HEADERS = $(VULKAN)/vulkan.h
EXTLOADER = ../ext_loader
EXTSRCS = $(EXTLOADER)/vulkan_ext.c
default install: $(HEADERS)
default install: $(HEADERS) $(EXTSRCS)
doc_install: $(OUTDIR)/registry.html
################################################
# Autogenerate vulkan header from XML API description
# Python and XML files on which vulkan.h depends
VKH_DEPENDS = vk.xml genvk.py reg.py generator.py
# Autogenerate installed header from XML API description
../vulkan/vulkan.h: $(VKH_DEPENDS)
$(PYTHON) genvk.py -registry vk.xml -o ../vulkan vulkan.h
$(VULKAN)/vulkan.h: $(VKH_DEPENDS)
$(PYTHON) genvk.py -registry vk.xml -o $(VULKAN) vulkan.h
# Verify registry XML file against the schema
validate:
jing -c registry.rnc vk.xml
# Test that vulkan.h compiles
test: ../vulkan/vulkan.h ../vulkan/vk_platform.h
test: $(VULKAN)/vulkan.h $(VULKAN)/vk_platform.h
gcc -Wall -pedantic -std=c99 -c -I.. test.c
g++ -Wall -c -std=c++98 -I.. test.c
g++ -Wall -c -std=c++11 -I.. test.c
@ -64,6 +68,15 @@ test: ../vulkan/vulkan.h ../vulkan/vk_platform.h
################################################
# Autogenerate extension loader from XML API description
# This also generates $(EXTLOADER)/vulkan_ext.h
#$(EXTLOADER)/vulkan_ext.c: $(VKH_DEPENDS)
$(EXTSRCS): $(VKH_DEPENDS)
$(PYTHON) genvk.py -registry vk.xml -o $(EXTLOADER) vulkan_ext.c
################################################
# Documentation targets
ASCIIDOC = asciidoc
@ -93,4 +106,4 @@ clean_dirt:
# Clean generated targets as well as intermediates.
clean clobber: clean_dirt
-rm -f $(HEADERS) $(OUTDIR)/registry.html
-rm -f $(HEADERS) $(EXTSRCS) $(OUTDIR)/registry.html

View File

@ -0,0 +1,330 @@
#!/usr/bin/python3 -i
#
# Copyright (c) 2013-2016 The Khronos Group Inc.
#
# 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.
import os,re,sys
from generator import *
doc = """
/*
** This is a simple extension loader which provides the implementations for the
** extension prototypes declared in vulkan header. It supports loading extensions either
** for a single instance or a single device. Multiple instances are not yet supported.
**
** To use the loader add vulkan_ext.c to your solution and include <vulkan/vulkan_ext.h>.
**
** If your application is using a single instance, but multiple devices callParam
**
** vkExtInitInstance(instance);
**
** after initializing the instance. This way the extension loader will use the loaders
** trampoline functions to call the correct driver for each call. This method is safe
** if your application might use more than one device at the cost of one additional
** indirection, the dispatch table of each dispatchable object.
**
** If your application uses only a single device it's better to use
**
** vkExtInitDevice(device);
**
** once the device has been initialized. This will resolve the function pointers
** upfront and thus removes one indirection for each call into the driver. This *can*
** result in slightly more performance for calling overhead limited cases.
*/
"""
# StubExtGeneratorOptions - subclass of GeneratorOptions.
#
# Adds options used by COutputGenerator objects during C language header
# generation.
#
# Additional members
# prefixText - list of strings to prefix generated header with
# (usually a copyright statement + calling convention macros).
# alignFuncParam - if nonzero and parameters are being put on a
# separate line, align parameter names at the specified column
class StubExtGeneratorOptions(GeneratorOptions):
"""Represents options during C interface generation for headers"""
def __init__(self,
filename = None,
directory = '.',
apiname = None,
profile = None,
versions = '.*',
emitversions = '.*',
defaultExtensions = None,
addExtensions = None,
removeExtensions = None,
sortProcedure = regSortFeatures,
prefixText = "",
alignFuncParam = 0):
GeneratorOptions.__init__(self, filename, directory, apiname, profile,
versions, emitversions, defaultExtensions,
addExtensions, removeExtensions, sortProcedure)
self.prefixText = prefixText
self.alignFuncParam = alignFuncParam
# ExtensionStubSourceOutputGenerator - subclass of OutputGenerator.
# Generates C-language extension wrapper interface sources.
#
# ---- methods ----
# ExtensionStubSourceOutputGenerator(errFile, warnFile, diagFile) - args as for
# OutputGenerator. Defines additional internal state.
# ---- methods overriding base class ----
# beginFile(genOpts)
# endFile()
# beginFeature(interface, emit)
# endFeature()
# genType(typeinfo,name)
# genStruct(typeinfo,name)
# genGroup(groupinfo,name)
# genEnum(enuminfo, name)
# genCmd(cmdinfo)
class ExtensionStubSourceOutputGenerator(OutputGenerator):
"""Generate specified API interfaces in a specific style, such as a C header"""
# This is an ordered list of sections in the header file.
TYPE_SECTIONS = ['include', 'define', 'basetype', 'handle', 'enum',
'group', 'bitmask', 'funcpointer', 'struct']
ALL_SECTIONS = TYPE_SECTIONS + ['commandPointer', 'command']
def __init__(self,
errFile = sys.stderr,
warnFile = sys.stderr,
diagFile = sys.stdout):
OutputGenerator.__init__(self, errFile, warnFile, diagFile)
#
def beginFile(self, genOpts):
OutputGenerator.beginFile(self, genOpts)
# C-specific
#
# Multiple inclusion protection & C++ wrappers.
# Internal state - accumulators for function pointers and function pointer initializatoin
self.pointers = [];
self.pointerInitializersInstance = [];
self.pointerInitializersDevice = [];
#
# Write header protection
self.outFileHeader = open(self.genOpts.directory + '/' + 'vulkan_ext.h', 'w')
write('#ifndef VULKAN_EXT_H', file=self.outFileHeader)
write('#define VULKAN_EXT_H', file=self.outFileHeader)
write('', file=self.outFileHeader)
write('#ifdef __cplusplus', file=self.outFileHeader)
write('extern "C" {', file=self.outFileHeader)
write('#endif', file=self.outFileHeader)
#
# User-supplied prefix text, if any (list of strings)
if (genOpts.prefixText):
for s in genOpts.prefixText:
write(s, file=self.outFile)
write(s, file=self.outFileHeader)
write(doc, file=self.outFileHeader)
write('#include <vulkan/vulkan.h>', file=self.outFile)
self.newline()
write('#include <vulkan/vulkan.h>', file=self.outFileHeader)
write('', file=self.outFileHeader)
write('void vkExtInitInstance(VkInstance instance);', file=self.outFileHeader)
write('void vkExtInitDevice(VkDevice device);', file=self.outFileHeader)
write('', file=self.outFileHeader)
def endFile(self):
for pointer in self.pointers:
write(pointer, file=self.outFile)
self.newline()
write('void vkExtInitInstance(VkInstance instance)\n{', file=self.outFile)
for pointerInitializer in self.pointerInitializersInstance:
write(pointerInitializer, file=self.outFile)
write('}', file=self.outFile)
self.newline()
write('void vkExtInitDevice(VkDevice device)\n{', file=self.outFile)
for pointerInitializer in self.pointerInitializersDevice:
write(pointerInitializer, file=self.outFile)
write('}', file=self.outFile)
self.newline()
#Finish header file
write('#ifdef __cplusplus', file=self.outFileHeader)
write('}', file=self.outFileHeader)
write('#endif', file=self.outFileHeader)
write('', file=self.outFileHeader)
write('#endif', file=self.outFileHeader)
self.outFileHeader.close()
# Finish processing in superclass
OutputGenerator.endFile(self)
def beginFeature(self, interface, emit):
# Start processing in superclass
OutputGenerator.beginFeature(self, interface, emit)
# Accumulate function pointers and function pointer initialization
self.featurePointers = []
self.featurePointerInitializersInstance = []
self.featurePointerInitializersDevice = []
def endFeature(self):
# Add feature to global list with protectFeature
if (self.emit and self.featurePointers):
if (self.genOpts.protectFeature):
self.pointers.append('#ifdef ' + self.featureName)
self.pointerInitializersInstance.append('#ifdef ' + self.featureName)
self.pointerInitializersDevice.append('#ifdef ' + self.featureName)
if (self.featureExtraProtect != None):
self.pointers.append('#ifdef ' + self.featureExtraProtect)
self.pointerInitializersInstance.append('#ifndef ' + self.featureName)
self.pointerInitializersDevice.append('#ifndef ' + self.featureName)
self.pointers += self.featurePointers;
self.pointerInitializersInstance += self.featurePointerInitializersInstance;
self.pointerInitializersDevice += self.featurePointerInitializersDevice;
if (self.featureExtraProtect != None):
self.pointers.append('#endif /* ' + self.featureExtraProtect + ' */')
self.pointerInitializersInstance.append('#endif /* ' + self.featureExtraProtect + ' */')
self.pointerInitializersDevice.append('#endif /* ' + self.featureExtraProtect + ' */')
if (self.genOpts.protectFeature):
self.pointers.append('#endif /* ' + self.featureName + ' */')
self.pointerInitializersInstance.append('#endif /* ' + self.featureName + ' */')
self.pointerInitializersDevice.append('#endif /* ' + self.featureName + ' */')
# Finish processing in superclass
OutputGenerator.endFeature(self)
#
# Type generation
def genType(self, typeinfo, name):
pass
def genStruct(self, typeinfo, typeName):
pass
def genGroup(self, groupinfo, groupName):
pass
def genEnum(self, enuminfo, name):
pass
#
# Command generation
def genCmd(self, cmdinfo, name):
OutputGenerator.genCmd(self, cmdinfo, name)
#
decls = self.makeStub(cmdinfo.elem)
self.featurePointerInitializersInstance.append(decls[0])
self.featurePointerInitializersDevice.append(decls[1])
self.featurePointers.append(decls[2])
#
# makeStub - return static declaration for function pointer and initialization of function pointer
# as a two-element list of strings.
# cmd - Element containing a <command> tag
def makeStub(self, cmd):
"""Generate a stub function pointer <command> Element"""
proto = cmd.find('proto')
params = cmd.findall('param')
name = cmd.find('name')
# Begin accumulating prototype and typedef strings
pfnDecl = 'static '
pfnDecl += noneStr(proto.text)
# Find the name tag and generate the function pointer and function pointer initialization code
nameTag = proto.find('name')
tail = noneStr(nameTag.tail)
returnType = noneStr(proto.find('type').text)
type = self.makeFunctionPointerType(nameTag.text, tail)
# For each child element, if it's a <name> wrap in appropriate
# declaration. Otherwise append its contents and tail con#tents.
stubDecl = ''
for elem in proto:
text = noneStr(elem.text)
tail = noneStr(elem.tail)
if (elem.tag == 'name'):
name = self.makeProtoName(text, tail)
stubDecl += name
else:
stubDecl += text + tail
pfnName = self.makeFunctionPointerName(nameTag.text, noneStr(tail));
pfnDecl += type + ' ' + pfnName + ';'
# Now generate the stub function
pfnDecl += '\n'
# Now add the parameter declaration list, which is identical
# for prototypes and typedefs. Concatenate all the text from
# a <param> node without the tags. No tree walking required
# since all tags are ignored.
n = len(params)
paramdecl = '(\n'
pfnCall = '\n{\n ' + ('return ', '')[returnType == 'void'] + pfnName + '(\n'
# Indented parameters
if n > 0:
indentCallParam = '(\n'
indentdecl = '(\n'
for i in range(0,n):
callParam = ''
paramdecl += self.makeCParamDecl(params[i], self.genOpts.alignFuncParam)
pfnCall += self.makeCCallParam(params[i], self.genOpts.alignFuncParam)
if (i < n - 1):
paramdecl += ',\n'
pfnCall += ',\n'
else:
paramdecl += ')'
pfnCall += '\n );\n'
indentdecl += paramdecl
indentCallParam += pfnCall
else:
indentdecl = '(void);'
pfnCall += '}\n'
featureInstance = ' ' + pfnName + ' = ('+type+')vkGetInstanceProcAddr(instance, "' + name + '");'
featureDevice = ' ' + pfnName + ' = ('+type+')vkGetDeviceProcAddr(device, "' + name + '");'
return [featureInstance, featureDevice , pfnDecl + stubDecl + paramdecl + pfnCall]
# Return function pointer type for given function
def makeFunctionPointerType(self, name, tail):
return 'PFN_' + name + tail
# Return name of static variable which stores the function pointer for the given function
def makeFunctionPointerName(self, name, tail):
return 'pfn_' + name + tail
#
# makeCParamDecl - return a string which is an indented, formatted
# declaration for a <param> or <member> block (e.g. function parameter
# or structure/union member).
# param - Element (<param> or <member>) to format
# aligncol - if non-zero, attempt to align the nested <name> element
# at this column
def makeCCallParam(self, param, aligncol):
return ' ' + param.find('name').text

View File

@ -22,6 +22,7 @@ from docgenerator import DocGeneratorOptions, DocOutputGenerator
from pygenerator import PyOutputGenerator
from validitygenerator import ValidityOutputGenerator
from hostsyncgenerator import HostSynchronizationOutputGenerator
from extensionStubSource import ExtensionStubSourceOutputGenerator
# Simple timer functions
startTime = None
@ -193,6 +194,23 @@ def makeGenOpts(extensions = [], protect = True, directory = '.'):
removeExtensions = removeExtensions)
]
genOpts['vulkan_ext.c'] = [
ExtensionStubSourceOutputGenerator,
CGeneratorOptions(
filename = 'vulkan_ext.c',
directory = directory,
apiname = 'vulkan',
profile = None,
versions = allVersions,
emitversions = None,
defaultExtensions = None,
addExtensions = '.*',
removeExtensions = None,
prefixText = prefixStrings + vkPrefixStrings,
alignFuncParam = 48)
]
# Generate a target based on the options in the matching genOpts{} object.
# This is encapsulated in a function so it can be profiled and/or timed.
# The args parameter is an parsed argument object containing the following

View File

@ -176,7 +176,7 @@ class HostSynchronizationOutputGenerator(OutputGenerator):
self.threadsafety['implicit'] += '\n'
# For any vkCmd* functions, the commandBuffer parameter must be being recorded
# For any vkCmd* functions, the command pool is externally synchronized
if protoname is not None and 'vkCmd' in protoname:
self.threadsafety['implicit'] += '* '
self.threadsafety['implicit'] += 'The sname:VkCommandPool that pname:commandBuffer was allocated from, in '

View File

@ -861,13 +861,7 @@ class ValidityOutputGenerator(OutputGenerator):
def makeThreadSafetyBlock(self, cmd, paramtext):
"""Generate C function pointer typedef for <command> Element"""
paramdecl = ''
# For any vkCmd* functions, the commandBuffer parameter must be being recorded
if cmd.find('proto/name') is not None and 'vkCmd' in cmd.find('proto/name'):
paramdecl += '* '
paramdecl += 'The sname:VkCommandPool that pname:commandBuffer was created from'
paramdecl += '\n'
# Find and add any parameters that are thread unsafe
explicitexternsyncparams = cmd.findall(paramtext + "[@externsync]")
if (explicitexternsyncparams is not None):
@ -889,6 +883,12 @@ class ValidityOutputGenerator(OutputGenerator):
paramdecl += externsyncattrib
paramdecl += ' must: be externally synchronized\n'
# For any vkCmd* functions, the command pool is externally synchronized
if cmd.find('proto/name') is not None and 'vkCmd' in cmd.find('proto/name').text:
paramdecl += '* '
paramdecl += 'Host access to the sname:VkCommandPool that pname:commandBuffer was allocated from must: be externally synchronized'
paramdecl += '\n'
# Find and add any "implicit" parameters that are thread unsafe
implicitexternsyncparams = cmd.find('implicitexternsyncparams')
if (implicitexternsyncparams is not None):

View File

@ -104,7 +104,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<type category="define">// Vulkan 1.0 version number
#define <name>VK_API_VERSION_1_0</name> <type>VK_MAKE_VERSION</type>(1, 0, 0)</type> <!-- The patch version here should never be set to anything other than 0 -->
<type category="define">// Version of this file
#define <name>VK_HEADER_VERSION</name> 32</type>
#define <name>VK_HEADER_VERSION</name> 33</type>
<type category="define">
#define <name>VK_DEFINE_HANDLE</name>(object) typedef struct object##_T* object;</type>
@ -1590,7 +1590,7 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<type category="struct" name="VkImportMemoryWin32HandleInfoNV">
<member values="VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV"><type>VkStructureType</type> <name>sType</name></member>
<member>const <type>void</type>* <name>pNext</name></member>
<member><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>handleType</name></member>
<member optional="true"><type>VkExternalMemoryHandleTypeFlagsNV</type> <name>handleType</name></member>
<member><type>HANDLE</type> <name>handle</name></member>
</type>
<type category="struct" name="VkExportMemoryWin32HandleInfoNV">
@ -3028,10 +3028,16 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<proto><type>VkResult</type> <name>vkBeginCommandBuffer</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<param>const <type>VkCommandBufferBeginInfo</type>* <name>pBeginInfo</name></param>
<implicitexternsyncparams>
<param>the sname:VkCommandPool that pname:commandBuffer was allocated from</param>
</implicitexternsyncparams>
</command>
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
<proto><type>VkResult</type> <name>vkEndCommandBuffer</name></proto>
<param externsync="true"><type>VkCommandBuffer</type> <name>commandBuffer</name></param>
<implicitexternsyncparams>
<param>the sname:VkCommandPool that pname:commandBuffer was allocated from</param>
</implicitexternsyncparams>
</command>
<command successcodes="VK_SUCCESS" errorcodes="VK_ERROR_OUT_OF_HOST_MEMORY,VK_ERROR_OUT_OF_DEVICE_MEMORY">
<proto><type>VkResult</type> <name>vkResetCommandBuffer</name></proto>
@ -4529,5 +4535,29 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
<enum value="&quot;VK_KHR_extension_84&quot;" name="VK_KHR_EXTENSION_84_EXTENSION_NAME"/>
</require>
</extension>
<extension name="VK_KHR_extension_85" number="85" author="KHR" contact="Ian Elliott @ianelliott" supported="disabled">
<require>
<enum value="0" name="VK_KHR_EXTENSION_85_SPEC_VERSION"/>
<enum value="&quot;VK_KHR_extension_85&quot;" name="VK_KHR_EXTENSION_85_EXTENSION_NAME"/>
</require>
</extension>
<extension name="VK_KHR_extension_86" number="86" author="KHR" contact="Markus Tavenrath @mtavenrath" supported="disabled">
<require>
<enum value="0" name="VK_KHR_EXTENSION_86_SPEC_VERSION"/>
<enum value="&quot;VK_KHR_extension_86&quot;" name="VK_KHR_EXTENSION_86_EXTENSION_NAME"/>
</require>
</extension>
<extension name="VK_NV_extension_87" number="87" author="NVIDIA" contact="Christoph Kubisch @pixeljetstream" supported="disabled">
<require>
<enum value="0" name="VK_NV_EXTENSION_87_SPEC_VERSION"/>
<enum value="&quot;VK_NV_extension_87&quot;" name="VK_NV_EXTENSION_87_EXTENSION_NAME"/>
</require>
</extension>
<extension name="VK_KHR_extension_88" number="88" author="NV" contact="Eric Werness @ewerness" supported="disabled">
<require>
<enum value="0" name="VK_KHR_EXTENSION_88_SPEC_VERSION"/>
<enum value="&quot;VK_KHR_extension_88&quot;" name="VK_KHR_EXTENSION_88_EXTENSION_NAME"/>
</require>
</extension>
</extensions>
</registry>

View File

@ -43,7 +43,7 @@ extern "C" {
#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff)
// Version of this file
#define VK_HEADER_VERSION 32
#define VK_HEADER_VERSION 33
#define VK_NULL_HANDLE 0