Skip to content

Add geometry shader support with point -> quad test#1203

Open
EmilioLaiso wants to merge 2 commits into
llvm:mainfrom
Traverse-Research:geometry-shader-point-to-quad-v2
Open

Add geometry shader support with point -> quad test#1203
EmilioLaiso wants to merge 2 commits into
llvm:mainfrom
Traverse-Research:geometry-shader-point-to-quad-v2

Conversation

@EmilioLaiso
Copy link
Copy Markdown
Collaborator

@EmilioLaiso EmilioLaiso commented May 18, 2026

Add geometry shader support to the engine and introduce PrimitiveTopology type.
PrimitiveTopology defaults to TriangleList so that we don't have to specify it in all our existing rasterization tests.

Add a new test Graphics/gs_point_to_quad.test exercising a VS → GS → PS pipeline:

  • VS is a pass-through
  • GS expands a single input point into a fullscreen quad
  • PS writes red.
  • A 2x2 render target verifies that all four pixels are rasterized.

Add GraphicsPipelineCreateDesc to keep the pipeline creation function signature tidy.
GS and PS within GraphicsPipelineCreateDesc are optional, but for the time being the backends assert that a PS is set. We can lift that assert once we need a VS-only test.

@EmilioLaiso EmilioLaiso marked this pull request as ready for review May 18, 2026 14:09
Comment thread lib/Support/Pipeline.cpp Outdated
Comment thread include/Support/Pipeline.h
Comment thread lib/API/MTL/MTLDevice.cpp Outdated
@EmilioLaiso EmilioLaiso force-pushed the geometry-shader-point-to-quad-v2 branch 2 times, most recently from 7a5aac7 to e5071c0 Compare May 21, 2026 11:41
Copy link
Copy Markdown
Contributor

@manon-traverse manon-traverse left a comment

Choose a reason for hiding this comment

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

Really nice changes! Awesome that we now have geometry shader support :D

Comment thread include/API/Device.h Outdated
Copy link
Copy Markdown
Contributor

@bogner bogner left a comment

Choose a reason for hiding this comment

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

A few minor comments but otherwise LGTM!

Comment thread lib/API/DX/Device.cpp Outdated
Comment thread lib/API/MTL/MTLDevice.cpp Outdated
Comment thread lib/API/MTL/MTLDevice.cpp Outdated
Comment on lines +1785 to +1786
else if (Shader.Stage == Stages::Geometry)
PipelineDesc.GS = std::move(SC);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Technically this is unreachable, but given that this is the only thing that could possibly make sense here it's probably fine as is.

Comment thread test/Graphics/gs_point_to_quad.test Outdated
Comment thread lib/API/MTL/MTLDevice.cpp Outdated
Copy link
Copy Markdown
Collaborator

@MarijnS95 MarijnS95 left a comment

Choose a reason for hiding this comment

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

Once PS is optional on Metal again, this has a thumbs-up from me!

Adds Stages::Geometry, PrimitiveTopology enum and IOBindings::Topology,
and a GraphicsPipelineCreateDesc that bundles vertex/geometry/pixel
shader containers plus topology, input layout and RT/DS formats. The
backends' createPipelineVsPs is replaced by createGraphicsPipeline
taking that desc. VK and DX wire an optional geometry stage into the
pipeline and pass through PointList topology; Metal has no GS and
rejects it at runtime. The new gs_point_to_quad.test expands a single
point into a fullscreen quad via a triangle-strip GS.

address pr feedback

rename to `createTraditionalRasterPipeline`
@EmilioLaiso EmilioLaiso force-pushed the geometry-shader-point-to-quad-v2 branch from cd882dd to 4938802 Compare May 22, 2026 13:38
Comment thread include/API/Device.h
llvm::SmallVector<SpecializationConstant> SpecializationConstants;
};

struct GraphicsPipelineCreateDesc {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
struct GraphicsPipelineCreateDesc {
struct TraditionalRasterPipelineCreateDesc {

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.

4 participants