forked from pupbrained/vulkan-test
holy shit
This commit is contained in:
parent
7181c58033
commit
b19910cb24
3
.envrc
3
.envrc
|
@ -1 +1,2 @@
|
|||
use_flake
|
||||
export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1
|
||||
use_flake . --impure
|
||||
|
|
|
@ -1,315 +0,0 @@
|
|||
{
|
||||
"file_format_version": "1.2.0",
|
||||
"layer": {
|
||||
"name": "VK_LAYER_LUNARG_api_dump",
|
||||
"type": "GLOBAL",
|
||||
"library_path": "../../../lib/libVkLayer_api_dump.dylib",
|
||||
"api_version": "1.3.290",
|
||||
"implementation_version": "2",
|
||||
"description": "LunarG API dump layer",
|
||||
"introduction": "The API Dump utility layer prints API calls, parameters, and values to the identified output stream.",
|
||||
"url": "https://vulkan.lunarg.com/doc/sdk/latest/windows/api_dump_layer.html",
|
||||
"platforms": [
|
||||
"WINDOWS",
|
||||
"LINUX",
|
||||
"MACOS",
|
||||
"ANDROID"
|
||||
],
|
||||
"instance_extensions": [
|
||||
{
|
||||
"name": "VK_EXT_layer_settings",
|
||||
"spec_version": "2"
|
||||
}
|
||||
],
|
||||
"device_extensions": [
|
||||
{
|
||||
"name": "VK_EXT_tooling_info",
|
||||
"spec_version": "1",
|
||||
"entrypoints": [
|
||||
"vkGetPhysicalDeviceToolPropertiesEXT"
|
||||
]
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"presets": [
|
||||
{
|
||||
"label": "Console Output",
|
||||
"description": "Output API dump to stdout",
|
||||
"platforms": [
|
||||
"WINDOWS",
|
||||
"LINUX",
|
||||
"MACOS",
|
||||
"ANDROID"
|
||||
],
|
||||
"status": "STABLE",
|
||||
"settings": [
|
||||
{
|
||||
"key": "output_format",
|
||||
"value": "text"
|
||||
},
|
||||
{
|
||||
"key": "log_filename",
|
||||
"value": "stdout"
|
||||
},
|
||||
{
|
||||
"key": "file",
|
||||
"value": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "Text Output",
|
||||
"description": "Output API dump to a text file",
|
||||
"platforms": [
|
||||
"WINDOWS",
|
||||
"LINUX",
|
||||
"MACOS",
|
||||
"ANDROID"
|
||||
],
|
||||
"status": "STABLE",
|
||||
"settings": [
|
||||
{
|
||||
"key": "output_format",
|
||||
"value": "text"
|
||||
},
|
||||
{
|
||||
"key": "log_filename",
|
||||
"value": "${VK_LOCAL}/vk_apidump.txt"
|
||||
},
|
||||
{
|
||||
"key": "file",
|
||||
"value": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "HTML Output",
|
||||
"description": "Output API dump to a HTML file",
|
||||
"platforms": [
|
||||
"WINDOWS",
|
||||
"LINUX",
|
||||
"MACOS",
|
||||
"ANDROID"
|
||||
],
|
||||
"status": "STABLE",
|
||||
"settings": [
|
||||
{
|
||||
"key": "output_format",
|
||||
"value": "html"
|
||||
},
|
||||
{
|
||||
"key": "log_filename",
|
||||
"value": "${VK_LOCAL}/vk_apidump.html"
|
||||
},
|
||||
{
|
||||
"key": "file",
|
||||
"value": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "JSON Output",
|
||||
"description": "Output API dump to a JSON file",
|
||||
"platforms": [
|
||||
"WINDOWS",
|
||||
"LINUX",
|
||||
"MACOS",
|
||||
"ANDROID"
|
||||
],
|
||||
"status": "STABLE",
|
||||
"settings": [
|
||||
{
|
||||
"key": "output_format",
|
||||
"value": "json"
|
||||
},
|
||||
{
|
||||
"key": "log_filename",
|
||||
"value": "${VK_LOCAL}/vk_apidump.json"
|
||||
},
|
||||
{
|
||||
"key": "file",
|
||||
"value": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"settings": [
|
||||
{
|
||||
"key": "output_range",
|
||||
"env": "VK_APIDUMP_OUTPUT_RANGE",
|
||||
"label": "Output Range",
|
||||
"description": "Comma separated list of frames to output or a range of frames with a start, count, and optional interval separated by a dash. A count of 0 will output every frame after the start of the range. Example: \"5-8-2\" will output frame 5, continue until frame 13, dumping every other frame. Example: \"3,8-2\" will output frames 3, 8, and 9.",
|
||||
"type": "STRING",
|
||||
"default": "0-0"
|
||||
},
|
||||
{
|
||||
"key": "output_format",
|
||||
"env": "VK_APIDUMP_OUTPUT_FORMAT",
|
||||
"label": "Output Format",
|
||||
"description": "Specifies the format used for output; can be HTML, JSON, or Text (default -- outputs plain text)",
|
||||
"type": "ENUM",
|
||||
"flags": [
|
||||
{
|
||||
"key": "text",
|
||||
"label": "Text",
|
||||
"description": "Plain text"
|
||||
},
|
||||
{
|
||||
"key": "html",
|
||||
"label": "HTML",
|
||||
"description": "HTML"
|
||||
},
|
||||
{
|
||||
"key": "json",
|
||||
"label": "JSON",
|
||||
"description": "Json"
|
||||
}
|
||||
],
|
||||
"default": "text"
|
||||
},
|
||||
{
|
||||
"key": "file",
|
||||
"label": "Output to File",
|
||||
"description": "Setting this to true indicates that output should be written to file instead of stdout",
|
||||
"type": "BOOL",
|
||||
"default": false,
|
||||
"settings": [
|
||||
{
|
||||
"key": "log_filename",
|
||||
"env": "VK_APIDUMP_LOG_FILENAME",
|
||||
"label": "Log Filename",
|
||||
"description": "Specifies the file to dump to when output files are enabled",
|
||||
"type": "SAVE_FILE",
|
||||
"filter": "*.txt,*.html,*.json",
|
||||
"default": "stdout",
|
||||
"dependence": {
|
||||
"mode": "ALL",
|
||||
"settings": [
|
||||
{
|
||||
"key": "file",
|
||||
"value": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "flush",
|
||||
"env": "VK_APIDUMP_FLUSH",
|
||||
"label": "Log Flush After Write",
|
||||
"description": "Setting this to true causes IO to be flushed after each API call that is written",
|
||||
"type": "BOOL",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"key": "name_size",
|
||||
"label": "Name Size",
|
||||
"description": "The number of characters the name of a variable should consume, assuming more are not required",
|
||||
"type": "INT",
|
||||
"default": 32,
|
||||
"range": {
|
||||
"min": 1
|
||||
},
|
||||
"unit": "chars"
|
||||
},
|
||||
{
|
||||
"key": "show_types",
|
||||
"label": "Show Types",
|
||||
"description": "Dump types in addition to values",
|
||||
"type": "BOOL",
|
||||
"default": true,
|
||||
"settings": [
|
||||
{
|
||||
"key": "type_size",
|
||||
"label": "Type Size",
|
||||
"description": "The number of characters the name of a type should consume, assuming more are not required",
|
||||
"type": "INT",
|
||||
"default": 0,
|
||||
"range": {
|
||||
"min": 0
|
||||
},
|
||||
"dependence": {
|
||||
"mode": "ALL",
|
||||
"settings": [
|
||||
{
|
||||
"key": "show_types",
|
||||
"value": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "timestamp",
|
||||
"env": "VK_APIDUMP_TIMESTAMP",
|
||||
"label": "Show Timestamp",
|
||||
"description": "Show the timestamp of function calls since start in microseconds",
|
||||
"type": "BOOL",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"key": "show_shader",
|
||||
"label": "Show Shader",
|
||||
"description": "Dump the shader binary code in pCode",
|
||||
"type": "BOOL",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"key": "detailed",
|
||||
"env": "VK_APIDUMP_DETAILED",
|
||||
"label": "Show Parameter Details",
|
||||
"description": "Dump parameter details in addition to API calls",
|
||||
"type": "BOOL",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"key": "no_addr",
|
||||
"env": "VK_APIDUMP_NO_ADDR",
|
||||
"label": "Hide Addresses",
|
||||
"description": "Dump \"address\" in place of hex addresses",
|
||||
"type": "BOOL",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"key": "use_spaces",
|
||||
"label": "Use Spaces",
|
||||
"description": "Setting this to true causes all tab characters to be replaced with spaces",
|
||||
"type": "BOOL",
|
||||
"default": true,
|
||||
"settings": [
|
||||
{
|
||||
"key": "indent_size",
|
||||
"label": "Indent Size",
|
||||
"description": "Specifies the number of spaces that a tab is equal to",
|
||||
"type": "INT",
|
||||
"default": 4,
|
||||
"range": {
|
||||
"min": 1,
|
||||
"max": 16
|
||||
},
|
||||
"unit": "chars",
|
||||
"dependence": {
|
||||
"mode": "ALL",
|
||||
"settings": [
|
||||
{
|
||||
"key": "use_spaces",
|
||||
"value": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "show_thread_and_frame",
|
||||
"label": "Show Thread and Frame",
|
||||
"description": "Show the thread and frame of each function called",
|
||||
"type": "BOOL",
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,90 +0,0 @@
|
|||
{
|
||||
"file_format_version": "1.2.0",
|
||||
"layer": {
|
||||
"name": "VK_LAYER_KHRONOS_shader_object",
|
||||
"type": "GLOBAL",
|
||||
"library_path": "../../../lib/libVkLayer_khronos_shader_object.dylib",
|
||||
"api_version": "1.3.290",
|
||||
"implementation_version": "1",
|
||||
"description": "Khronos Shader object layer",
|
||||
"instance_extensions": [
|
||||
{
|
||||
"name": "VK_EXT_layer_settings",
|
||||
"spec_version": "2"
|
||||
}
|
||||
],
|
||||
"device_extensions": [
|
||||
{
|
||||
"name": "VK_EXT_shader_object",
|
||||
"spec_version": "1",
|
||||
"entrypoints": [
|
||||
"vkCmdBindShadersEXT",
|
||||
"vkCmdBindVertexBuffers2EXT",
|
||||
"vkCmdSetAlphaToCoverageEnableEXT",
|
||||
"vkCmdSetAlphaToOneEnableEXT",
|
||||
"vkCmdSetColorBlendAdvancedEXT",
|
||||
"vkCmdSetColorBlendEnableEXT",
|
||||
"vkCmdSetColorBlendEquationEXT",
|
||||
"vkCmdSetColorWriteMaskEXT",
|
||||
"vkCmdSetConservativeRasterizationModeEXT",
|
||||
"vkCmdSetCoverageModulationModeNV",
|
||||
"vkCmdSetCoverageModulationTableEnableNV",
|
||||
"vkCmdSetCoverageModulationTableNV",
|
||||
"vkCmdSetCoverageReductionModeNV",
|
||||
"vkCmdSetCoverageToColorEnableNV",
|
||||
"vkCmdSetCoverageToColorLocationNV",
|
||||
"vkCmdSetCullModeEXT",
|
||||
"vkCmdSetDepthBiasEnableEXT",
|
||||
"vkCmdSetDepthBoundsTestEnableEXT",
|
||||
"vkCmdSetDepthClampEnableEXT",
|
||||
"vkCmdSetDepthClipEnableEXT",
|
||||
"vkCmdSetDepthClipNegativeOneToOneEXT",
|
||||
"vkCmdSetDepthCompareOpEXT",
|
||||
"vkCmdSetDepthTestEnableEXT",
|
||||
"vkCmdSetDepthWriteEnableEXT",
|
||||
"vkCmdSetExtraPrimitiveOverestimationSizeEXT",
|
||||
"vkCmdSetFrontFaceEXT",
|
||||
"vkCmdSetLineRasterizationModeEXT",
|
||||
"vkCmdSetLineStippleEnableEXT",
|
||||
"vkCmdSetLogicOpEXT",
|
||||
"vkCmdSetLogicOpEnableEXT",
|
||||
"vkCmdSetPatchControlPointsEXT",
|
||||
"vkCmdSetPolygonModeEXT",
|
||||
"vkCmdSetPrimitiveRestartEnableEXT",
|
||||
"vkCmdSetPrimitiveTopologyEXT",
|
||||
"vkCmdSetProvokingVertexModeEXT",
|
||||
"vkCmdSetRasterizationSamplesEXT",
|
||||
"vkCmdSetRasterizationStreamEXT",
|
||||
"vkCmdSetRasterizerDiscardEnableEXT",
|
||||
"vkCmdSetRepresentativeFragmentTestEnableNV",
|
||||
"vkCmdSetSampleLocationsEnableEXT",
|
||||
"vkCmdSetSampleMaskEXT",
|
||||
"vkCmdSetScissorWithCountEXT",
|
||||
"vkCmdSetShadingRateImageEnableNV",
|
||||
"vkCmdSetStencilOpEXT",
|
||||
"vkCmdSetStencilTestEnableEXT",
|
||||
"vkCmdSetTessellationDomainOriginEXT",
|
||||
"vkCmdSetVertexInputEXT",
|
||||
"vkCmdSetViewportSwizzleNV",
|
||||
"vkCmdSetViewportWScalingEnableNV",
|
||||
"vkCmdSetViewportWithCountEXT",
|
||||
"vkCreateShadersEXT",
|
||||
"vkDestroyShaderEXT",
|
||||
"vkGetShaderBinaryDataEXT"
|
||||
]
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"settings": [
|
||||
{
|
||||
"key": "force_enable",
|
||||
"env": "VK_SHADER_OBJECT_FORCE_ENABLE",
|
||||
"label": "Force Enable",
|
||||
"description": "Force the layer to be active even if the underlying driver also implements the shader object extension.",
|
||||
"type": "BOOL",
|
||||
"default": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
{
|
||||
"file_format_version": "1.2.0",
|
||||
"layer": {
|
||||
"name": "VK_LAYER_KHRONOS_synchronization2",
|
||||
"type": "GLOBAL",
|
||||
"library_path": "../../../lib/libVkLayer_khronos_synchronization2.dylib",
|
||||
"api_version": "1.3.290",
|
||||
"implementation_version": "1",
|
||||
"description": "Khronos Synchronization2 layer",
|
||||
"introduction": "The VK_LAYER_KHRONOS_synchronization2 extension layer implements the VK_KHR_synchronization2 extension.",
|
||||
"url": "https://vulkan.lunarg.com/doc/sdk/latest/windows/synchronization2_layer.html",
|
||||
"status": "STABLE",
|
||||
"platforms": [
|
||||
"WINDOWS",
|
||||
"LINUX",
|
||||
"MACOS",
|
||||
"ANDROID"
|
||||
],
|
||||
"instance_extensions": [
|
||||
{
|
||||
"name": "VK_EXT_layer_settings",
|
||||
"spec_version": "2"
|
||||
}
|
||||
],
|
||||
"device_extensions": [
|
||||
{
|
||||
"name": "VK_KHR_synchronization2",
|
||||
"spec_version": "1",
|
||||
"entrypoints": [
|
||||
"vkCmdSetEvent2KHR",
|
||||
"vkCmdResetEvent2KHR",
|
||||
"vkCmdWaitEvents2KHR",
|
||||
"vkCmdPipelineBarrier2KHR",
|
||||
"vkCmdWriteTimestamp2KHR",
|
||||
"vkQueueSubmit2KHR",
|
||||
"vkCmdWriteBufferMarker2AMD",
|
||||
"vkGetQueueCheckpointData2NV"
|
||||
]
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"settings": [
|
||||
{
|
||||
"key": "force_enable",
|
||||
"env": "VK_SYNCHRONIZATION2_FORCE_ENABLE",
|
||||
"label": "Force Enable",
|
||||
"description": "Force the layer to be active even if the underlying driver also implements the synchonization2 extension.",
|
||||
"type": "BOOL",
|
||||
"default": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,104 +0,0 @@
|
|||
{
|
||||
"file_format_version": "1.2.0",
|
||||
"layer": {
|
||||
"name": "VK_LAYER_LUNARG_screenshot",
|
||||
"type": "GLOBAL",
|
||||
"library_path": "../../../lib/libVkLayer_screenshot.dylib",
|
||||
"api_version": "1.3.290",
|
||||
"implementation_version": "1",
|
||||
"description": "LunarG image capture layer",
|
||||
"introduction": "The screenshot layer records frames to image files.",
|
||||
"url": "https://vulkan.lunarg.com/doc/sdk/latest/windows/screenshot_layer.html",
|
||||
"platforms": [
|
||||
"WINDOWS",
|
||||
"LINUX",
|
||||
"MACOS",
|
||||
"ANDROID"
|
||||
],
|
||||
"instance_extensions": [
|
||||
{
|
||||
"name": "VK_EXT_layer_settings",
|
||||
"spec_version": "2"
|
||||
}
|
||||
],
|
||||
"device_extensions": [
|
||||
{
|
||||
"name": "VK_EXT_tooling_info",
|
||||
"spec_version": "1",
|
||||
"entrypoints": [
|
||||
"vkGetPhysicalDeviceToolPropertiesEXT"
|
||||
]
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"settings": [
|
||||
{
|
||||
"key": "frames",
|
||||
"env": "VK_SCREENSHOT_FRAMES",
|
||||
"label": "Frames",
|
||||
"description": "Specifies list of frames to output as screenshots. It is specified as a comma-separated list of frames or a range of frames with a start, count, and optional interval separated by a dash. Setting the variable to \"all\" will output every frame. Example: \"5-8-2\" will output frame 5, continue until frame 13, dumping every other frame. Example: \"3,8-2\" will output frames 3, 8, and 9. If it is not set or it set to an empty string, no screenshots are created.",
|
||||
"type": "STRING",
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"key": "dir",
|
||||
"env": "VK_SCREENSHOT_DIR",
|
||||
"label": "Directory",
|
||||
"description": "Specifies the directory in which to create the screenshot files. If it is not set or is set to an empty string, the files will be created in the current working directory.",
|
||||
"type": "SAVE_FOLDER",
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"key": "format",
|
||||
"env": "VK_SCREENSHOT_FORMAT",
|
||||
"label": "Format",
|
||||
"description": "Specify a color space for the output. If it is not set, set to null, or set to USE_SWAPCHAIN_COLORSPACE the format will be set to use the same color space as the swapchain object.",
|
||||
"type": "ENUM",
|
||||
"flags": [
|
||||
{
|
||||
"key": "UNORM",
|
||||
"label": "UNORM",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"key": "SNORM",
|
||||
"label": "SNORM",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"key": "USCALED",
|
||||
"label": "USCALED",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"key": "SSCALED",
|
||||
"label": "SSCALED",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"key": "UINT",
|
||||
"label": "UINT",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"key": "SINT",
|
||||
"label": "SINT",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"key": "SRGB",
|
||||
"label": "SRGB",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"key": "USE_SWAPCHAIN_COLORSPACE",
|
||||
"label": "USE_SWAPCHAIN_COLORSPACE",
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"default": "USE_SWAPCHAIN_COLORSPACE"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
12
flake.nix
12
flake.nix
|
@ -39,6 +39,7 @@
|
|||
fmt
|
||||
glfw
|
||||
glm
|
||||
vulkan-tools
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
darwin.apple_sdk.frameworks.AppKit
|
||||
|
@ -47,7 +48,7 @@
|
|||
darwin.apple_sdk.frameworks.QuartzCore
|
||||
];
|
||||
in
|
||||
with pkgs; {
|
||||
with pkgs; rec {
|
||||
packages = rec {
|
||||
graphics-test = stdenv.mkDerivation {
|
||||
name = "graphics-test";
|
||||
|
@ -108,16 +109,17 @@
|
|||
(writeScriptBin "build" "meson compile -C build")
|
||||
(writeScriptBin "clean" "meson setup build --wipe")
|
||||
(writeScriptBin "reconfigure" "meson setup build --reconfigure")
|
||||
(writeScriptBin "run" "meson compile -C build && build/graphics-test")
|
||||
(writeScriptBin "run" "meson compile -C build && build/${packages.default.name}")
|
||||
]
|
||||
++ deps;
|
||||
|
||||
shellHook = lib.optionals stdenv.isDarwin ''
|
||||
export MOLTENVK_LIBRARY_PATH="${darwin.moltenvk}/lib"
|
||||
export PATH="${llvmPackages_18.clang-tools}/bin:$PATH"
|
||||
export MOLTENVK_LIBRARY_PATH="${darwin.moltenvk}/lib";
|
||||
export VULKAN_INCLUDE_DIRS="${darwin.moltenvk.dev}/include:${vulkan-headers}/include";
|
||||
export VK_ICD_FILENAMES="${darwin.moltenvk}/share/vulkan/icd.d/MoltenVK_icd.json"
|
||||
export VK_LAYER_PATH="${./explicit_layer.d}";
|
||||
export VK_LAYER_PATH="${vulkan-validation-layers}/share/vulkan/explicit_layer.d"
|
||||
export VULKAN_INCLUDE_DIRS="${darwin.moltenvk.dev}/include:${vulkan-headers}/include"
|
||||
export VK_LOADER_DEBUG=all
|
||||
'';
|
||||
|
||||
name = "C++";
|
||||
|
|
27
meson.build
27
meson.build
|
@ -41,37 +41,12 @@ deps = [
|
|||
dependency('fmt', static: true),
|
||||
dependency('glfw3'),
|
||||
dependency('glm'),
|
||||
dependency('vulkan')
|
||||
]
|
||||
|
||||
if build_machine.system() == 'darwin'
|
||||
molten_dirs = []
|
||||
|
||||
pymodule = import('python3')
|
||||
|
||||
python3 = pymodule.find_python()
|
||||
|
||||
res = run_command(python3, '-c', 'import os; print(os.environ["MOLTENVK_LIBRARY_PATH"])', check: false)
|
||||
|
||||
if res.returncode() == 0
|
||||
molten_dirs += res.stdout().strip()
|
||||
elif import('fs').exists('/opt/homebrew/lib/libMoltenVK.a')
|
||||
molten_dirs += '/opt/homebrew/lib'
|
||||
endif
|
||||
|
||||
deps += cpp.find_library('MoltenVK', required: true, dirs: molten_dirs)
|
||||
|
||||
res = run_command(python3, '-c', 'import os; print(os.environ["VULKAN_INCLUDE_DIRS"])', check: false)
|
||||
|
||||
if res.returncode() == 0
|
||||
include_dirs = include_directories(res.stdout().strip().split(':'), is_system: true)
|
||||
endif
|
||||
else
|
||||
deps += dependency('vulkan')
|
||||
endif
|
||||
|
||||
executable(
|
||||
'graphics-test',
|
||||
sources,
|
||||
include_directories: include_dirs,
|
||||
dependencies: deps,
|
||||
)
|
||||
|
|
19
src/main.cpp
19
src/main.cpp
|
@ -14,7 +14,7 @@ constexpr u32 HEIGHT = 600;
|
|||
|
||||
constexpr std::array<const char*, 1> validationLayers = { "VK_LAYER_KHRONOS_validation" };
|
||||
|
||||
#if defined(NDEBUG) or defined(__APPLE__)
|
||||
#if defined(NDEBUG)
|
||||
const bool enableValidationLayers = false;
|
||||
#else
|
||||
const bool enableValidationLayers = true;
|
||||
|
@ -42,9 +42,8 @@ class Application {
|
|||
|
||||
fmt::println("Available layers:");
|
||||
|
||||
for (const auto& layerProperties : availableLayers) {
|
||||
for (const auto& layerProperties : availableLayers)
|
||||
fmt::println("\t{}", layerProperties.layerName);
|
||||
}
|
||||
|
||||
for (const char* layerName : validationLayers) {
|
||||
bool layerFound = false;
|
||||
|
@ -103,8 +102,18 @@ class Application {
|
|||
createInfo.ppEnabledExtensionNames = glfwExtensions;
|
||||
createInfo.enabledLayerCount = 0;
|
||||
|
||||
if (vkCreateInstance(&createInfo, nullptr, &mInstance) != VK_SUCCESS)
|
||||
throw std::runtime_error("Failed to create Vulkan instance!");
|
||||
std::vector<const char*> requiredExtensions;
|
||||
|
||||
requiredExtensions.emplace_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME);
|
||||
|
||||
createInfo.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
|
||||
|
||||
createInfo.enabledExtensionCount = static_cast<u32>(requiredExtensions.size());
|
||||
createInfo.ppEnabledExtensionNames = requiredExtensions.data();
|
||||
|
||||
if (vkCreateInstance(&createInfo, nullptr, &mInstance) != VK_SUCCESS) {
|
||||
throw std::runtime_error("failed to create instance!");
|
||||
}
|
||||
}
|
||||
|
||||
fn initWindow() -> void {
|
||||
|
|
Loading…
Reference in a new issue