82 Commits
Author SHA1 Message Date
Serdar Kocdemir 9252a7f85f Provide python version of shader generation script
To be able to regenerate compositor shaders from Windows.

Bug: 389646068
Test: ./generate-compositor-shader-headers.py
Change-Id: Icb91fedc5d85cf4ac4e9f407ba05acb52fe0b379
2025-09-04 19:31:59 +00:00
Serdar Kocdemir dd708ba563 Normalize paths added into shader header gen
Helps generate exactly the same shader header when compiled from
Windows.

Bug: 389646068
Test: generate-compositor-shader-headers
Change-Id: Ie4738d6c346f4178eaf5dfe7d8f086ce59783b62
2025-09-04 19:31:59 +00:00
Serdar Kocdemir e9e9512698 Update compositor shader generation scripts
To be able to recompile when needed and reflect the recent
codegen related changes.

Bug: 420586022
Test: ./scripts/generate-compositor-shader-headers.sh
Change-Id: I8db822dcacba74bf2a1baf7bb2a27f4b0e8ba5ed
2025-07-10 23:58:52 +00:00
Jason Macnak 31adc8a3e6 Minor codegen changes
* Pragma macros are typcially not indented

 * Use GFXSTREAM_ERROR instead of fprintf

 * Update the run command in the header comments
2025-06-11 23:10:29 +00:00
Jason Macnak 900317596d Cleanup apigen
* Switched to snake case for filenames since there was a mix

 * Clang-format

 * Bazel support for binary and tests
2025-06-11 23:10:29 +00:00
Jason Macnak 20f40153ae Update codegen
Bug: b/416342919
Test: n/a
Change-Id: I64f7fa1b545a6dec04bce6065a9c04451ed78931
2025-05-14 16:14:09 -07:00
Serdar Kocdemir 60beb01f14 Update vulkan headers to v313
Includes a small change to keep using MTLResource_id
which actually didn't make it into the spec.
A typo fix in vulkansc_raii.hpp
Fixes on end2end tests for vulkanhpp changes.
Change to enable comparison operators on handles even when
the spaceship operator is available, to avoid errors on
old compilers where they are not generated.

Bug: 417150515
Test: CI
Test: dEQP-VK.api.info.vulkan1p2
Test: atest GfxstreamEnd2EndTests
Change-Id: Ic9b9256541dde50b77c4d6d63d277bc222a64157
2025-05-14 12:36:42 +01:00
Jason Macnak d905d112f6 More release tool findings
* Delete getopt and replace with simple string arg parsing.

* Remove unused windows files.

Bug: b/416342919
Test: n/a
Change-Id: Ic30a6321308b5d062df7eb906ad0e646cd2a7d69
2025-05-12 22:45:46 +00:00
Jason Macnak e4360539f2 Even more fixups found be release tool
Bug: b/403363880
Test: n/a
Change-Id: I40e2b9cbae7f4e6dfe4ad7193607aa0f7cfc4131
2025-05-09 10:22:46 -07:00
Jason Macnak 9478b2108c More licensing findings and deletions
Bug: b/403363880
Test: n/a
Change-Id: Ifd09b680a2b20760450bff141a7b9166951a2be9
2025-05-09 10:22:45 -07:00
Jason Macnak d2de457391 Add apache header to apigen sources
Bug: b/403363880
Test: n/a
Change-Id: I88968b9231ed387dfe752760d9321a29997a7b0e
2025-05-08 12:21:45 -07:00
Serdar Kocdemir 547bb35b4f Track pipeline layouts on decoder
Track pipeline layout creation and destroy calls
to cleanup them correctly on device teardown.

Pipeline layouts require delayed delete operations for
VulkanQueueSubmitWithCommands feature which modifies order
of commands and they need to stay valid during recording.

Bug: 342343008
Test: run and shutdown gltfviewer with VVL
Change-Id: I465a8e3f6ed7e621470f32cdb7cda91ec3dcbba6
2025-01-21 03:17:49 -08:00
Serdar Kocdemir 4d94b08137 Fix vkCmdSetLineStippleKHR decoding
Add missing alias for the vkCmd function to the vk.xml to be
able to use it correctly at the host side decoder and subdecoder.

Bug: 357829977
Test: dEQP-VK.dynamic_state.monolithic.line_width.
Change-Id: If81e932ae9527eab8d0b09e2c3446f2f4c526bc6
2024-10-28 19:50:35 +00:00
Serdar Kocdemir d41a3b97b5 Update autogen for VK_KHR_line_rasterization
With recent mesa related changes, we started using a recent version of
vk.xml and this promoted extension was being used as EXT in our codegen
scripts. This resulted in some code loss, skips on pNext chain of
commands sent from the guest side and eventually CTS/dEQP failures.

Updating vulkan headers partially with this change to accomodate KHR
version of the extension correctly.

Bug: b/357832421
Test: dEQP-VK.api.info.vulkan1p2_limits_validation*
Change-Id: I53fbb2742a846dbce55080deb46f5e4fd46e6c11
2024-10-10 10:57:01 +01:00
Gurchetan Singh 4943dccf17 gfxstream: modify script to point to gfxstream version of codgen
We have two versions of the same code, and we keep it
in sync via batch updates.

BUG=369906368
TEST=CI

Change-Id: I6852092fdd9e8a72d9921e693870722337c376cb
2024-09-30 21:27:30 +00:00
Gurchetan Singh 08f5c21ebc gfxstream: fix scripts/generate-gfxstream-vulkan.sh
Mostly just change the locations of directories.

One exception is aosp/3271678, which needs to land in the
Mesa codegen directory.

For workflows without an AOSP tree, one can just pass in
the path to Mesa tree.

Mesa uses a newer version of vk.xml than the host does,
so some changes are observed.

BUG=369200554
TEST=generate-gfxstream-vulkan.sh in AOSP

or

cd ~/
git clone https://gitlab.freedesktop.org/mesa/mesa.git
cd ${gfxstream_dir}
./scripts/generate-gfxstream-vulkan.sh ~/mesa

Change-Id: I5a023ed4d8788a31f352d017f321656c7b7a7410
2024-09-25 08:56:30 -07:00
Treehugger Robot 9200414d9f Merge "Add VK_EXT_external_memory_metal definitions" into main 2024-09-18 11:05:36 +00:00
Gurchetan Singh 4f8febda59 gfxstream: simplify codegen
This simplifies the amount of code imported from Vulkan
docs.  It vendors the code to just a subset needed by
the cerealgenerator.  The files that are kept are:

    - generator.py
    - cgenerator.py
    - reg.py
    - genvk.py

Since these files originate with Khronos, they are
Apache licensed.

Long-term, there are various ideas on how to proceed
with codegen.  Probably the above files can be nuked
in the event some of those ideas come to pass.

BUG=296903491
TEST=./generate-gfxstream-vulkan.sh

Change-Id: I55842e778af9b71ceab2dcaf1c2d7aafebe86b14
2024-09-17 09:31:46 -07:00
Serdar Kocdemir a3b628b880 Add VK_EXT_external_memory_metal definitions
Partial update to vulkan headers and auto generated code to
include the new extension. It will be used to fix issues on
external memory implementation with MoltenVK later on.
References:
Khronos MR 6800
MoltenVK PR 2314

Bug: b/349066492
Test: build & presubmit
Change-Id: I91f0e6c73bfa3c8c13b8008b7913d72fda371403
2024-09-17 11:26:08 +01:00
Jason Macnak dc539fa81d Merge changes I1d65fc2b,I53eb60cc,I3e1b29a9,I54f79366 into main
* changes:
  Switch inline shaders to std::vector<uint32_t>
  Move end2end shaders into a subdirectory
  Update glsl to c++ spirv array script to include source
  Use gfxstream::expected for end2end tests
2024-07-11 18:51:16 +00:00
Gurchetan Singh 4bd2f4b291 gfxstream: host: introduce vkGetSemaphoreGOOGLE
New protocol which instructs the host to share sync descriptor
with ExternalObjectManager.

BUG=350965057
TEST=compile

Change-Id: Ia009c0278a02d631ff2f8edd18bee85bbaa030f3
2024-07-10 07:59:48 -07:00
Jason Macnak 1ce326db5b Switch inline shaders to std::vector<uint32_t>
... as these are easier to pass around in upcoming helper
functions.

Bug: b/347288539
Test: GfxstreamEnd2EndTests
Change-Id: I1d65fc2b8e14d44c873b6b63dce49ee0718b5bad
2024-07-09 09:42:54 -07:00
Jason Macnak 94dda8499b Update glsl to c++ spirv array script to include source
Bug: n/a
Test: regenerate end2end shaders
Change-Id: I3e1b29a9c775ce44cdb529fbcfc5b5cee7f9c11d
2024-07-09 09:42:54 -07:00
Serdar Kocdemir fa050d101b Remove direct usages of MoltenVK library functions
These APIs and the related extension are deprecated in favor of the new
metal_objects extension to make sure the loader can intercept them, so that the layers, such as VVL, would work fine.
Removes necessity to load functions directly from a separate dylib.
VK_MVK_moltenvk extension support is still passed to the guest side
due to the existing checks for enabling the AHB extension.

Bug: 333460957
Test: run with swiftshader, host and use-host-vulkan arguments on MacOS
Change-Id: I17ce958bc6498029ad4c525e80764060f88df118
2024-06-27 10:06:59 +00:00
Gurchetan Singh 1da942b1dd Revert "Revert "gfxstream: Add vkCmdPipelineBarrier2 implementat..."
Revert submission 3125001

BUG=346348303
TEST=atbd

Change-Id: Iefe1c2754ee522380647fa226e84fec653154da3
2024-06-14 07:48:21 -07:00
Gurchetan Singh 79959280c0 Revert "gfxstream: Add vkCmdPipelineBarrier2 implementation in VkDecoderGlobalState"
BUG=346348303
TEST=todo

This reverts commit c4de357e4f.

Change-Id: I950ddea16a83f3e50c356e90e6cf0826de908c92
2024-06-13 18:31:45 +00:00
Aaron Ruby c4de357e4f gfxstream: Add vkCmdPipelineBarrier2 implementation in VkDecoderGlobalState
Useful for specializing this function.

BUG=343234676
TEST=compile

Change-Id: Ic6bff75d2a6e227a0b17ebf35cd128d1693de612
2024-06-06 16:21:07 -07:00
Gurchetan Singh a2bb14fcba gfxstream: use absolute path for some code
Some code may be auto-generated, some may not be.

Eventually we want to move autogenerated code into specialized
directories, so it be generated but not necessarily checked
in [for certain cases].

Also, nuke codegen for CMakeLists.txt: we have multiple other
build systems now (Blueprint, meson), and it doesn't make
sense codegen one anymore.

BUG=296903491
TEST=compile

Change-Id: I63beff1726074268188694fbfeb803429ee96478
2024-01-04 17:23:05 -08:00
Jason Macnak abf4920f75 Handle SOLID_COLOR layers in CompositorVk
Bug: b/315817323
Test: cvd start --gpu_mode=gfxstream_guest_angle
Test: cvd start --gpu_mode=gfxstream_guest_angle_host_swiftshader
Test: atest --host gfxstream_compositorvk_test
Change-Id: I5eeaef8ef421104b91434b73b6fdeab714c43fcf
2023-12-13 20:02:04 +00:00
Jason Macnak cb5ce07c55 Use a nested Vulkan Loader when GFXSTREAM_VK_ env var found
... and add script to build a version of the Vulkan Loader which
uses "GFXSTREAM" prefixed env vars and logging.

Bug: b/315317383
Test: deqp-vk w/ Gfxstream ICD
Change-Id: I7202379dbc27a9519b55434e889139810078020d
2023-12-11 02:38:04 +00:00
Gurchetan Singh 1b5e649b42 gfxstream: nuke vulkan-docs
Use vulkan-docs-next: a newer and less-forky version  of same repo.

Eventually, vulkan-docs-next can be renamed too, but not
now to make cherry-picks easier.  Maybe we can upstream
the cerealgenerator to the official Vulkan docs too.

BUG=310206667
TEST=compile

Change-Id: I35011f760fadb7042455642904f7def672a30633
2023-11-20 16:49:41 +00:00
Gurchetan Singh 2cf08adf4c gfxstream: use standard Vulkan headers and new auto-gen flow
This modifies gfxstream to use standard Vulkan headers,
and updates to 1.3.269.

Previously, the headers were mostly standard, but added in
vk_android_native_buffer into vulkan_core.h.  That breaks down
when using auto-gen scripts from outside gfxstream, which will
happen in a subsequent patchset.

For vk_native_buffer_android, we can simply provide a
vk_android_native_buffer_gfxstream.h.

Long-term, vk_native_buffer_android.h should be deprecated in
favor of VK_ANDROID_external_memory_android_hardware_buffer, in
Android's libvulkan and elsewhere.

For the Vulkan headers, the new procedure is generate them in the
directions found here in the following repos:

https://github.com/KhronosGroup/Vulkan-Headers
https://github.com/KhronosGroup/Vulkan-Hpp

Those headers can be copied over using cp.  For gfxstream encoder
+ decoders, that's still generated via ./generate-gfxstream-vulkan.sh

The only catch is you must use the same vk.xml for Vulkan-Headers,
Vulkan-Hpp, and for the cereal generator.  The recommended flow
is use whatever the xml is in Vulkan-Headers ToT and copy to
Vulkan-Hpp and cerealgenerator.py before running those scripts.

The End2End tests that relied on vk_android_native_buffer were
also modified.  Long-term, the AHB extension could be used
instead of ANB for tests.

BUG=310206667
TEST=launch_cvd --gpu_mode=gfxstream_guest_angle

Change-Id: Ib43d8555cf37a9e9a7189ec7597f78f12cd53b5d
2023-11-13 09:54:42 -08:00
Gurchetan Singh 401599fdc9 gfxstream: add generate-gfxstream-vulkan.sh
Simpler version of the generate-vulkan-sources.sh
script.

BUG=310206667
TEST=launch_cvd --gpu_mode=gfxstream_guest_angle

Change-Id: Ie24b8846e87aad7dec1fc681364cbe64b64401df
2023-11-13 09:54:42 -08:00
Jason Macnak 3d35277485 Add Vulkan-Hpp generated from Gfxstream's vk.xml
... which includes VK_ANDROID_native_buffer.

Bug: b/292257025
Test: atest --host GfxstreamEnd2EndTests
Change-Id: If07eab38e275876f4a61bf2189fb43e9ed49ef6f
2023-09-11 12:15:13 -07:00
Jason Macnak d89ae47a52 Add note about why vk_android_native_buffer is separate
Bug: b/292257025
Test: ./scripts/generate-vulkan-sources.sh && mma
Change-Id: I50d199e064297ec6e880be4cabc0c0e17224fa8d
2023-09-11 12:15:13 -07:00
Jason Macnak 9919fbf12f Move existing vulkan codegen into nested vulkan-docs subdirectory
Bug: b/292257025
Test: ./scripts/generate-vulkan-sources.sh
Change-Id: I8994625ffa20ff56579a7ef1992844f580a6d88a
2023-09-11 12:15:13 -07:00
Jason Macnak 80a36d12b8 Update iostream namespace to gfxstream::guest
... to avoid conflicts with
hardware/google/gfxstream/include/render-utils/IOStream.h
when the guest is built for the host
for end2end tests.

Bug: b/292257025
Test: cvd start --gpu_mode=gfxstream
Change-Id: I2f2d5b7d670e67953d89142fd152d089ac40b13e
2023-09-11 12:15:12 -07:00
Yahan Zhou 8b6b92df97 Merge changes I72dad62b,Ida30e4ec,I8ac88c69 into main
* changes:
  Update vk.xml and code generator
  Update vk headers to 1.3.250.1
  Split gfxstream specific from vk.xml to vk_gfxstream.xml
2023-08-22 23:05:26 +00:00
Gurchetan Singh 08d743bbb7 gfxstream: don't delete dir when auto-generating
Don't remove the existing header directory, since it
deletes build files.

BUG=296903491
TEST=generate-vulkan-source.sh

Change-Id: Ife2b6fa38cc462e1af32d9f632ba4326afc3a5ed
2023-08-21 12:30:26 -07:00
Yahan Zhou 1c3da73640 Update vk.xml and code generator
This commit updates vk.xml and code generator to make them backward
compatible. The updates in code generator includes:

 1. Parse "protect" properly.
 2. Ignore "optional" if the "optional" was added in newer vk.xml.
    - This is done by having an extra table for related fields.
 3. Parse latexmath properly.
 4. Parse "supported" properly.
 5. Skip parameters and members if they are not for Vulkan API.
 6. VkNativeBufferANDROID diverged from upstream, keep the old one.

Bug: 293346694
Test: rebuild and run aemu with older system images
Change-Id: I72dad62bcbeb041bb49f1a6467ec5af2a1ef7960
2023-08-16 15:03:00 -07:00
Yahan Zhou 70e0f380ed Split gfxstream specific from vk.xml to vk_gfxstream.xml
This would make our life easier when updating vk.xml.

Also remove MoltenVK specific bits, as the guest is not supposed
to directly call MoltenVK.

Bug: 294595194
Test: rerun code generator, get almost the same code
Change-Id: I8ac88c69aa968607d6e2c7a22972554a20e28255
2023-08-16 13:46:40 -07:00
Gurchetan Singh c59eba1f11 gfxstream: ignore AOSP dir when generating
- AOSP paths is no longer necessary, everything is in the
  gfxstream repo.
- We shouldn't need to create any new directories.

BUG=295248855
TEST=run codegen, see minimal modifications caused by this change

Change-Id: Iac63276a51db9842c064093d09377875acbc4bd1
2023-08-14 11:33:00 -07:00
Jason Macnak 02e4e8af51 Update codegen paths after move
Bug: b/271464937
Test: mkdir build
      cd build
      cmake .. -G Ninja
      ninja
      cd ..
      ./scripts/generate-apigen-sources.sh
Change-Id: I47f44fb421266834ab2d496ba5499214ac891b0b
2023-07-19 11:02:48 -07:00
Jason Macnak a157e8a750 Handle deferred AHB memory bind
... by replacing the underlying host image with a new host image
created using the usual vkCreateImage() with VkNativeBufferANDROID.

Bug: b/286234683
Test: cvd start --gpu_mode=gfxstream_guest_angle
Test: cvd start --gpu_mode=gfxstream_guest_angle_host_swiftshader
Change-Id: I7fd7fb635417b2512691bc699f8a344b2bf757c2
Merged-In: I7fd7fb635417b2512691bc699f8a344b2bf757c2
2023-06-23 13:54:12 -07:00
Jason Macnak 00ba9db671 Move protocols to codegen and erun apigen codegen
... to ensure new paths work.

Bug: b/271464937
Test: mkdir build
      cd build
      cmake . ../
      make gfxstream-generic-apigen
      cd ..
      ./scripts/generate-apigen-sources.sh
Change-Id: If316939d8c767dde0cc6f5e222bc7e97a8c543f8
2023-05-30 10:40:00 -07:00
Jason Macnak 4d76330c73 Rerun vulkan codegen after move
... to update auto-generated path comments.

Bug: b/271464937
Test: ./scripts/generate-vulkan-sources.sh
Change-Id: If668cdd17ea819d84ec9cd703079b4042eda4d87
2023-05-30 10:21:36 -07:00
Gurchetan Singh 6c32ee05d0 Revert "Revert "vulkan-cereal: codegen for vkGetBlobGOOGLE and V..."
Revert submission 2521483-revert-2516960-gfxstream-guest-mem-XARGEGZPAM

Reason for revert: Easiest to revert the entire topic

Reverted changes: /q/submissionid:2521483-revert-2516960-gfxstream-guest-mem-XARGEGZPAM

Change-Id: I71a72a59df3fdaaaf1bf6465e44521f31c2bd574
2023-04-04 12:01:02 -07:00
Bo Hu 605ca0b3ee Merge changes from topic "revert-2516960-gfxstream-guest-mem-XARGEGZPAM"
* changes:
  Revert "vulkan-cereal: codegen for vkGetBlobGOOGLE and VkCreateB..."
  Revert "vulkan-cereal: deferred resource creation host-side impl..."
  Revert "vulkan-cereal: guest memory prototype"
2023-04-04 02:07:00 +00:00
Bo Hu a704ba6ee8 Revert "vulkan-cereal: codegen for vkGetBlobGOOGLE and VkCreateB..."
Revert submission 2516960-gfxstream-guest-mem

Reason for revert: broke windows build
Reverted changes: /q/submissionid:2516960-gfxstream-guest-mem

Change-Id: I7c035a5b53ad8154563967165031917b00649401
2023-04-04 01:42:55 +00:00
Treehugger Robot e02e4a2661 Merge changes from topic "gfxstream-guest-mem"
* changes:
  vulkan-cereal: guest memory prototype
  vulkan-cereal: deferred resource creation host-side implementation
  vulkan-cereal: codegen for vkGetBlobGOOGLE and VkCreateBlobGOOGLE
2023-04-03 23:20:25 +00:00