Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Convert tutorial to asciidoc and add Antora setup #5

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ ads.txt
build_ebook.log
temp_ebook.md
ebook/*.pdf
ebook/*.epub
ebook/*.epub

convert.py
17 changes: 17 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
= Khronos Vulkan^®^ Tutorial

== Attribution

The Khronos Vulkan^®^ Tutorial is based on the "link:https://vulkan-tutorial.com/[Vulkan Tutorial]" by Alexander Overvoorde licensed under link:https://creativecommons.org/licenses/by-sa/4.0/[CC BY-SA 4.0].

== About

This repository hosts the contents of the link:https:://learn.vulkan.org/vulkan-tutorial[Khronos Vulkan Tutorial]. The tutorial is part of the link:https://github.com/KhronosGroup/Vulkan-Site[Vulkan Documentation Project].

== License

The contents of this repository are licensed as https://creativecommons.org/licenses/by-sa/4.0/[CC BY-SA 4.0], unless stated otherwise.
By contributing to this repository, you agree to license your contributions to the public under that same license.

The code listings in the `code` directory are licensed as https://creativecommons.org/publicdomain/zero/1.0/[CC0 1.0 Universal].
By contributing to that directory, you agree to license your contributions to the public under that same public domain-like license.
144 changes: 0 additions & 144 deletions README.md

This file was deleted.

4 changes: 4 additions & 0 deletions antora/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
modules/ROOT/attachments/**
modules/ROOT/images/**
modules/ROOT/pages/**
!modules/ROOT/pages/index.adoc
35 changes: 35 additions & 0 deletions antora/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (c) 2023 Sascha Willems
# SPDX-License-Identifier: CC-BY-SA-4.0

# Configure the Khronos Vulkan Samples Antora tree with transformed markup files

RMRF = rm -rf
CP = cp

# Antora ROOT module directory where files are copied
ROOT = modules/ROOT

# Some Antora related documentation files are fixed and and shouldn't be delete
EXCLUDE = 'index.adoc'

setup: setup_tutorial

setup_tutorial:
# In order to keep the image links we need to have the image folder inside the image folder (due to how Antora works)
mkdir -p $(ROOT)/images/images
rsync -a --delete ../images $(ROOT)/images
rsync -a --delete ../attachments $(ROOT)
mkdir -p $(ROOT)/pages
rsync -a --delete --exclude ${EXCLUDE} ../en/ $(ROOT)/pages
# Use a python script to automat some file content changes that are necessary due to differences between Antora and github
python3 make_helper.py

# @todo
# Files generated by 'setup' target
# ANTORA_GENERATED = \
# $(filter-out $(ROOT)/pages/index.adoc,$(wildcard $(ROOT)/pages/*.adoc)) \
# $(ROOT)/pages/extensions \
# $(ROOT)/images

# clean:
# $(RMRF) $(ANTORA_GENERATED)
9 changes: 9 additions & 0 deletions antora/antora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023 Sascha Willems
# SPDX-License-Identifier: CC-BY-SA-4.0

name: tutorial
title: Khronos Vulkan Tutorial
version: latest
start_page: 00_Introduction.adoc
nav:
- modules/ROOT/nav.adoc
24 changes: 24 additions & 0 deletions antora/make_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) 2023 Sascha Willems
# SPDX-License-Identifier: CC-BY-SA-4.0

# Does automated changes to the asciidoc files required to make them properly work with Antora

import os

for root, dirs, files in os.walk("modules/ROOT/pages/"):
for file in files:
if (file.endswith(".adoc")):
file_name = os.path.join(root, file);
print("Fixing " + file_name)
s = ""
with open(file_name, "r+") as f:
if file in ["index.adoc"]:
continue
s = f.read()
f.seek(0)
f.truncate()
# We need to change the attachment links (e.g. used to link to the chapter's source files)
# It's not possible to format them in a way to works both with github and Antora
s = s.replace("link:/attachments/", "link:{attachmentsdir}/")
f.write(s)
f.close
49 changes: 49 additions & 0 deletions antora/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
////
- Copyright (c) 2023, Sascha Willems
- SPDX-License-Identifier: CC-BY-SA-4.0
////

* xref:00_Introduction.adoc[Introduction]
* xref:01_Overview.adoc[Overview]
* xref:02_Development_environment.adoc[Development environment]
* xref:03_Drawing_a_triangle/00_Setup/00_Base_code.adoc[Drawing a triangle]
** xref:03_Drawing_a_triangle/00_Setup/00_Base_code.adoc[Setup]
*** xref:03_Drawing_a_triangle/00_Setup/00_Base_code.adoc[Base Code]
*** xref:03_Drawing_a_triangle/00_Setup/01_Instance.adoc[Instance]
*** xref:03_Drawing_a_triangle/00_Setup/02_Validation_layers.adoc[Validation layers]
*** xref:03_Drawing_a_triangle/00_Setup/03_Physical_devices_and_queue_families.adoc[Physical devices and queue families]
*** xref:03_Drawing_a_triangle/00_Setup/04_Logical_device_and_queues.adoc[Logical device and queues]
** xref:03_Drawing_a_triangle/01_Presentation/00_Window_surface.adoc[Presentation]
*** xref:03_Drawing_a_triangle/01_Presentation/00_Window_surface.adoc[Window surface]
*** xref:03_Drawing_a_triangle/01_Presentation/01_Swap_chain.adoc[Swap chain]
*** xref:03_Drawing_a_triangle/01_Presentation/02_Image_views.adoc[Image views]
** xref:03_Drawing_a_triangle/02_Graphics_pipeline_basics/00_Introduction.adoc[Graphics pipeline basics]
*** xref:03_Drawing_a_triangle/02_Graphics_pipeline_basics/00_Introduction.adoc[Introduction]
*** xref:03_Drawing_a_triangle/02_Graphics_pipeline_basics/01_Shader_modules.adoc[Shader modules]
*** xref:03_Drawing_a_triangle/02_Graphics_pipeline_basics/02_Fixed_functions.adoc[Fixed functions]
*** xref:03_Drawing_a_triangle/02_Graphics_pipeline_basics/03_Render_passes.adoc[Render passes]
*** xref:03_Drawing_a_triangle/02_Graphics_pipeline_basics/04_Conclusion.adoc[Conclusion]
** xref:03_Drawing_a_triangle/03_Drawing/00_Framebuffers.adoc[Drawing]
*** xref:03_Drawing_a_triangle/03_Drawing/00_Framebuffers.adoc[Framebuffers]
*** xref:03_Drawing_a_triangle/03_Drawing/01_Command_buffers.adoc[Command buffers]
*** xref:03_Drawing_a_triangle/03_Drawing/02_Rendering_and_presentation.adoc[Rendering and presentation]
*** xref:03_Drawing_a_triangle/03_Drawing/03_Frames_in_flight.adoc[Frames in flight]
** xref:03_Drawing_a_triangle/04_Swap_chain_recreation.adoc[Swap chain recreation]
* xref:04_Vertex_buffers/00_Vertex_input_description.adoc[Vertex buffers]
** xref:04_Vertex_buffers/00_Vertex_input_description.adoc[Vertex input description]
** xref:04_Vertex_buffers/01_Vertex_buffer_creation.adoc[Vertex buffer creation]
** xref:04_Vertex_buffers/02_Staging_buffer.adoc[Staging buffer]
** xref:04_Vertex_buffers/03_Index_buffer.adoc[Index buffer]
* xref:05_Uniform_buffers/00_Descriptor_layout_and_buffer.adoc[Uniform buffers]
** xref:05_Uniform_buffers/00_Descriptor_layout_and_buffer.adoc[Descriptor layout and buffer]
** xref:05_Uniform_buffers/01_Descriptor_pool_and_sets.adoc[Descriptor pool and sets]
* xref:06_Texture_mapping/00_Images.adoc[Texture mapping]
** xref:06_Texture_mapping/00_Images.adoc[Images]
** xref:06_Texture_mapping/01_Image_view_and_sampler.adoc[Image view and sampler]
** xref:06_Texture_mapping/02_Combined_image_sampler.adoc[Combined image sampler]
* xref:07_Depth_buffering.adoc[Depth buffering]
* xref:08_Loading_models.adoc[Loading models]
* xref:09_Generating_Mipmaps.adoc[Generating Mipmaps]
* xref:10_Multisampling.adoc[Multisampling]
* xref:11_Compute_Shader.adoc[Compute Shader]
* xref:90_FAQ.adoc[FAQ]
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 20 additions & 20 deletions code/09_shader_base.vert → attachments/09_shader_base.vert
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#version 450
layout(location = 0) out vec3 fragColor;
vec2 positions[3] = vec2[](
vec2(0.0, -0.5),
vec2(0.5, 0.5),
vec2(-0.5, 0.5)
);
vec3 colors[3] = vec3[](
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0)
);
void main() {
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
fragColor = colors[gl_VertexIndex];
}
#version 450

layout(location = 0) out vec3 fragColor;

vec2 positions[3] = vec2[](
vec2(0.0, -0.5),
vec2(0.5, 0.5),
vec2(-0.5, 0.5)
);

vec3 colors[3] = vec3[](
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0),
vec3(0.0, 0.0, 1.0)
);

void main() {
gl_Position = vec4(positions[gl_VertexIndex], 0.0, 1.0);
fragColor = colors[gl_VertexIndex];
}
18 changes: 9 additions & 9 deletions code/09_shader_base.frag → attachments/22_shader_ubo.frag
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#version 450
layout(location = 0) in vec3 fragColor;
layout(location = 0) out vec4 outColor;
void main() {
outColor = vec4(fragColor, 1.0);
}
#version 450

layout(location = 0) in vec3 fragColor;

layout(location = 0) out vec4 outColor;

void main() {
outColor = vec4(fragColor, 1.0);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading