Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2de391c
Disable a warning when #ifdef'ing off all the code within a switch, b…
ashleyharris-maptek-com-au May 20, 2025
b807712
Add a very basic reference hlsl geometry shader.
ashleyharris-maptek-com-au May 20, 2025
fc46e64
Implement HLSL export of geometry shaders.
ashleyharris-maptek-com-au May 20, 2025
b919a16
Add a test for hlsl geometry shaders that call emit from functions, i…
ashleyharris-maptek-com-au May 23, 2025
6db3f85
For each function, store a bool whether it, or any function called by…
ashleyharris-maptek-com-au May 23, 2025
429a9e0
When calling a function in HLSL, if that function emits geometry, app…
ashleyharris-maptek-com-au May 23, 2025
5113120
Tweaks to hlsl geoemtry shader function argument signitures, we add t…
ashleyharris-maptek-com-au May 23, 2025
98f4d55
When running the tests, don't pollute the repo with compiled .spv files.
ashleyharris-maptek-com-au May 23, 2025
e9f780f
Shrink clang-format execution scope from 'touched function' to 'hunk'
ashleyharris-maptek-com-au May 23, 2025
facca17
Re-apply input struct handling code.
ashleyharris-maptek-com-au May 23, 2025
16503b2
Refactor "execution mode to vertex count" into it's own function, as …
ashleyharris-maptek-com-au May 23, 2025
7b0bee4
Don't return the output struct from main in geometry shaders. (Re-add…
ashleyharris-maptek-com-au May 23, 2025
860d63c
Test update - all geometry streams are just called geometry_stream now.
ashleyharris-maptek-com-au May 27, 2025
05d0f33
Add discover_geometry_emitters() and it's helper GeometryEmitDisocver…
ashleyharris-maptek-com-au May 27, 2025
43ab16c
Remove naming the geometry_stream - just call it geometry_stream ever…
ashleyharris-maptek-com-au May 27, 2025
efe825d
Revert my earlier change - detecting geometry emition in the parser i…
ashleyharris-maptek-com-au May 27, 2025
6447d77
Don't worry about naming the geometry stream - it's strongly typed in…
ashleyharris-maptek-com-au May 27, 2025
c674dc4
Add maybe_unused to dismiss compilation warning in non-debug builds.
ashleyharris-maptek-com-au May 27, 2025
155f9a1
PR changes - Geometry shader handling wasn't needed in all paths, and…
ashleyharris-maptek-com-au May 27, 2025
be91880
Update tests for latest PR suggested changes - indentation of geometr…
ashleyharris-maptek-com-au May 27, 2025
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
55 changes: 55 additions & 0 deletions reference/opt/shaders-hlsl/geom/triangles.geom
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
static float4 gl_Position;
static float4 vPositionIn[1];
static float3 vColorIn[1];
static float3 gColor;

struct SPIRV_Cross_Input
{
float4 vPositionIn : TEXCOORD0;
float3 vColorIn : TEXCOORD1;
};

struct SPIRV_Cross_Output
{
float3 gColor : TEXCOORD0;
float4 gl_Position : SV_Position;
};

void geom_main(point SPIRV_Cross_Input stage_input[1], inout TriangleStream<SPIRV_Cross_Output> triStream)
{
gColor = vColorIn[0];
gl_Position = vPositionIn[0] + float4(-0.100000001490116119384765625f, -0.100000001490116119384765625f, 0.0f, 0.0f);
{
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.gColor = gColor;
triStream.Append(stage_output);
}
gColor = vColorIn[0];
gl_Position = vPositionIn[0] + float4(0.100000001490116119384765625f, -0.100000001490116119384765625f, 0.0f, 0.0f);
{
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.gColor = gColor;
triStream.Append(stage_output);
}
gColor = vColorIn[0];
gl_Position = vPositionIn[0] + float4(0.0f, 0.100000001490116119384765625f, 0.0f, 0.0f);
{
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.gColor = gColor;
triStream.Append(stage_output);
}
triStream.RestartStrip();
}

[maxvertexcount(3)]
void main(point SPIRV_Cross_Input stage_input[1], inout TriangleStream<SPIRV_Cross_Output> triStream)
{
for(int i = 0; i < 1; i++)
vPositionIn[i] = stage_input[i].vPositionIn;
for(int i = 0; i < 1; i++)
vColorIn[i] = stage_input[i].vColorIn;
geom_main(stage_input, triStream);
}
57 changes: 57 additions & 0 deletions reference/shaders-hlsl/geom/triangles.geom
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
static float4 gl_Position;
static float4 vPositionIn[1];
static float3 vColorIn[1];
static float3 gColor;

struct SPIRV_Cross_Input
{
float4 vPositionIn : TEXCOORD0;
float3 vColorIn : TEXCOORD1;
};

struct SPIRV_Cross_Output
{
float3 gColor : TEXCOORD0;
float4 gl_Position : SV_Position;
};

void geom_main(point SPIRV_Cross_Input stage_input[1], inout TriangleStream<SPIRV_Cross_Output> triStream)
{
float4 center = vPositionIn[0];
float3 color = vColorIn[0];
gColor = color;
gl_Position = center + float4(-0.100000001490116119384765625f, -0.100000001490116119384765625f, 0.0f, 0.0f);
{
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.gColor = gColor;
triStream.Append(stage_output);
}
gColor = color;
gl_Position = center + float4(0.100000001490116119384765625f, -0.100000001490116119384765625f, 0.0f, 0.0f);
{
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.gColor = gColor;
triStream.Append(stage_output);
}
gColor = color;
gl_Position = center + float4(0.0f, 0.100000001490116119384765625f, 0.0f, 0.0f);
{
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;
stage_output.gColor = gColor;
triStream.Append(stage_output);
}
triStream.RestartStrip();
}

[maxvertexcount(3)]
void main(point SPIRV_Cross_Input stage_input[1], inout TriangleStream<SPIRV_Cross_Output> triStream)
{
for(int i = 0; i < 1; i++)
vPositionIn[i] = stage_input[i].vPositionIn;
for(int i = 0; i < 1; i++)
vColorIn[i] = stage_input[i].vColorIn;
geom_main(stage_input, triStream);
}
28 changes: 28 additions & 0 deletions shaders-hlsl/geom/triangles.geom
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#version 450

layout(points) in;
layout(triangle_strip, max_vertices = 3) out;

layout(location = 0) in vec4 vPositionIn[1];
layout(location = 1) in vec3 vColorIn[1];

layout(location = 0) out vec3 gColor;

void main() {
Comment thread
ashleyharris-maptek-com-au marked this conversation as resolved.
vec4 center = vPositionIn[0];
vec3 color = vColorIn[0];

gColor = color;
gl_Position = center + vec4(-0.1, -0.1, 0.0, 0.0);
EmitVertex();

gColor = color;
gl_Position = center + vec4(0.1, -0.1, 0.0, 0.0);
EmitVertex();

gColor = color;
gl_Position = center + vec4(0.0, 0.1, 0.0, 0.0);
EmitVertex();

EndPrimitive();
}