Skip to content

RageDisplay Vulkan support#1418

Open
convextriangle wants to merge 263 commits intoetternagame:developfrom
convextriangle:unstable_vk
Open

RageDisplay Vulkan support#1418
convextriangle wants to merge 263 commits intoetternagame:developfrom
convextriangle:unstable_vk

Conversation

@convextriangle
Copy link
Copy Markdown

@convextriangle convextriangle commented Mar 15, 2026

Adds a Vulkan implementation of RageDisplay (with custom shader support for it).

To test, in Preferences.ini:

VideoRenderers=vulkan, d3d, opengl

Also, Vulkan SDK is necessary for building Vulkan stuffs (some drivers ship with older versions of Vulkan libraries, specify the SDK location in the VULKAN_SDK env var so CMake can pick it up - see here for info)...

Note - macOS support doesn't exist because I don't have a mac to test/code the MoltenVK support / Metal surface...

Copy link
Copy Markdown
Author

@convextriangle convextriangle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more notes to myself from debugging and etterna dev group chats

Comment thread Data/Shaders/Vulkan/vertex.glsl Outdated
Comment thread src/RageUtil/Graphics/RendererVK/RendererVK.cpp
Comment thread src/RageUtil/Graphics/RendererVK/RendererVK.cpp
Comment thread src/RageUtil/Graphics/RendererVK/RendererVK.cpp
Comment thread src/RageUtil/Graphics/RendererVK/RendererVK.cpp
const std::string& vertexShaderPath,
const std::string& fragmentShaderPath)
{
return m_Renderer->CreateGraphicsPipeline(vertexShaderPath,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe these paths should be... sanitized/sandboxed? e.g. in other stepman lua, file access is generally constrained to the game root dir (or something)

function install_linux() {
test -d $VULKAN_SDK && test -f vulkan_sdk.tar.gz
echo "extract just the SDK's prebuilt binaries ($VULKAN_SDK_VERSION/x86_64) from vulkan_sdk.tar.gz into $VULKAN_SDK" >&2
tar -C "$VULKAN_SDK" --strip-components 2 -xf vulkan_sdk.tar.gz $VULKAN_SDK_VERSION/x86_64
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this doesn't work for aarch64 for obvious reasons...

Comment thread extern/CMakeLists.txt Outdated
Comment thread src/RageUtil/Graphics/Display/Display.cpp Outdated
Comment thread src/arch/arch_default.h
@convextriangle convextriangle marked this pull request as draft April 11, 2026 11:44
@convextriangle convextriangle marked this pull request as ready for review April 11, 2026 13:41
Copy link
Copy Markdown
Author

@convextriangle convextriangle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more stuffs i forgot

bufferInfo.commandPool = m_CommandPool;
bufferInfo.commandBufferCount = 1;

auto buffers = m_Device.allocateCommandBuffers(bufferInfo);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe reuse the command buffer instead of allocating for every call...

copyBufferInfo.level = vk::CommandBufferLevel::ePrimary;
copyBufferInfo.commandPool = m_CommandPool;
copyBufferInfo.commandBufferCount = 1;
vk::raii::CommandBuffer copyBuffer =
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reuse the command buffer here as well

m_PendingTextureUpdates[m_CurrentFrame] = false;

std::vector<vk::DescriptorImageInfo> textureInfo(GetMaxTextureCount());
for (int i = 0; i < textureInfo.size(); i++) {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if it's any faster to update descriptors for textures that have actually been added/removed
increasing the texture binding limit would also be a bonus (^^)
also would be nice if we can get away with not removing references to deleted textures

const DisplayAdapter::CommandBatcher& batcher);

constexpr static size_t FramesInFlight = 3;
constexpr static size_t MaxDrawCount = 25'000;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be too small... bump to sizeof(DisplayAdapter::Vertex)*MaxDrawCount ≈ 4MB?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant