diff options
| author | 2021-04-12 19:41:22 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:27 -0400 | |
| commit | f263760c5a3aff771123b32b15677e1f7a089640 (patch) | |
| tree | 3d9c41ce708beb8a76f28ceee1c9ebb25108a471 /src/shader_recompiler/backend/spirv/emit_spirv.cpp | |
| parent | shader: Implement OUT (diff) | |
| download | yuzu-f263760c5a3aff771123b32b15677e1f7a089640.tar.gz yuzu-f263760c5a3aff771123b32b15677e1f7a089640.tar.xz yuzu-f263760c5a3aff771123b32b15677e1f7a089640.zip | |
shader: Implement geometry shaders
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_spirv.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.cpp b/src/shader_recompiler/backend/spirv/emit_spirv.cpp index 3258b0cf8..d7c5890ab 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv.cpp | |||
| @@ -134,6 +134,44 @@ void DefineEntryPoint(const IR::Program& program, EmitContext& ctx, Id main) { | |||
| 134 | case Shader::Stage::VertexB: | 134 | case Shader::Stage::VertexB: |
| 135 | execution_model = spv::ExecutionModel::Vertex; | 135 | execution_model = spv::ExecutionModel::Vertex; |
| 136 | break; | 136 | break; |
| 137 | case Shader::Stage::Geometry: | ||
| 138 | execution_model = spv::ExecutionModel::Geometry; | ||
| 139 | ctx.AddCapability(spv::Capability::Geometry); | ||
| 140 | ctx.AddCapability(spv::Capability::GeometryStreams); | ||
| 141 | switch (ctx.profile.input_topology) { | ||
| 142 | case InputTopology::Points: | ||
| 143 | ctx.AddExecutionMode(main, spv::ExecutionMode::InputPoints); | ||
| 144 | break; | ||
| 145 | case InputTopology::Lines: | ||
| 146 | ctx.AddExecutionMode(main, spv::ExecutionMode::InputLines); | ||
| 147 | break; | ||
| 148 | case InputTopology::LinesAdjacency: | ||
| 149 | ctx.AddExecutionMode(main, spv::ExecutionMode::InputLinesAdjacency); | ||
| 150 | break; | ||
| 151 | case InputTopology::Triangles: | ||
| 152 | ctx.AddExecutionMode(main, spv::ExecutionMode::Triangles); | ||
| 153 | break; | ||
| 154 | case InputTopology::TrianglesAdjacency: | ||
| 155 | ctx.AddExecutionMode(main, spv::ExecutionMode::InputTrianglesAdjacency); | ||
| 156 | break; | ||
| 157 | } | ||
| 158 | switch (program.output_topology) { | ||
| 159 | case OutputTopology::PointList: | ||
| 160 | ctx.AddExecutionMode(main, spv::ExecutionMode::OutputPoints); | ||
| 161 | break; | ||
| 162 | case OutputTopology::LineStrip: | ||
| 163 | ctx.AddExecutionMode(main, spv::ExecutionMode::OutputLineStrip); | ||
| 164 | break; | ||
| 165 | case OutputTopology::TriangleStrip: | ||
| 166 | ctx.AddExecutionMode(main, spv::ExecutionMode::OutputTriangleStrip); | ||
| 167 | break; | ||
| 168 | } | ||
| 169 | if (program.info.stores_point_size) { | ||
| 170 | ctx.AddCapability(spv::Capability::GeometryPointSize); | ||
| 171 | } | ||
| 172 | ctx.AddExecutionMode(main, spv::ExecutionMode::OutputVertices, program.output_vertices); | ||
| 173 | ctx.AddExecutionMode(main, spv::ExecutionMode::Invocations, program.invocations); | ||
| 174 | break; | ||
| 137 | case Shader::Stage::Fragment: | 175 | case Shader::Stage::Fragment: |
| 138 | execution_model = spv::ExecutionModel::Fragment; | 176 | execution_model = spv::ExecutionModel::Fragment; |
| 139 | ctx.AddExecutionMode(main, spv::ExecutionMode::OriginUpperLeft); | 177 | ctx.AddExecutionMode(main, spv::ExecutionMode::OriginUpperLeft); |