summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/GeometryShaderGen.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2017-07-20 13:52:23 +1000
committerStenzek <stenzek@gmail.com>2017-07-30 17:43:59 +1000
commitc783cd2aaf102a006782be64f6a6da3476382eeb (patch)
treebbde79b793a860dab2d2995a3197ec27581c3431 /Source/Core/VideoCommon/GeometryShaderGen.cpp
parent38c48ff72ea280d1c5e8bc82a436f0bba676d14d (diff)
GeometryShaderGen: Add UID enumeration functions
Diffstat (limited to 'Source/Core/VideoCommon/GeometryShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/GeometryShaderGen.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/GeometryShaderGen.cpp b/Source/Core/VideoCommon/GeometryShaderGen.cpp
index bb201ddb0f..4b06c0f7f3 100644
--- a/Source/Core/VideoCommon/GeometryShaderGen.cpp
+++ b/Source/Core/VideoCommon/GeometryShaderGen.cpp
@@ -364,3 +364,23 @@ static void EndPrimitive(ShaderCode& out, const ShaderHostConfig& host_config,
else
out.Write("\toutput.RestartStrip();\n");
}
+
+void EnumerateGeometryShaderUids(const std::function<void(const GeometryShaderUid&)>& callback)
+{
+ GeometryShaderUid uid;
+ std::memset(&uid, 0, sizeof(uid));
+
+ static constexpr std::array<u32, 3> primitive_lut = {
+ {PRIMITIVE_TRIANGLES, PRIMITIVE_LINES, PRIMITIVE_POINTS}};
+ for (u32 primitive : primitive_lut)
+ {
+ auto* guid = uid.GetUidData<geometry_shader_uid_data>();
+ guid->primitive_type = primitive;
+
+ for (u32 texgens = 0; texgens <= 8; texgens++)
+ {
+ guid->numTexGens = texgens;
+ callback(uid);
+ }
+ }
+}