GeometryShaderGen: Add UID enumeration functions

This commit is contained in:
Stenzek 2017-07-20 13:52:23 +10:00
parent 38c48ff72e
commit c783cd2aaf
2 changed files with 22 additions and 0 deletions

View File

@ -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);
}
}
}

View File

@ -4,6 +4,7 @@
#pragma once
#include <functional>
#include "Common/CommonTypes.h"
#include "VideoCommon/ShaderGenCommon.h"
#include "VideoCommon/VertexManagerBase.h"
@ -28,3 +29,4 @@ typedef ShaderUid<geometry_shader_uid_data> GeometryShaderUid;
ShaderCode GenerateGeometryShaderCode(APIType ApiType, const ShaderHostConfig& host_config,
const geometry_shader_uid_data* uid_data);
GeometryShaderUid GetGeometryShaderUid(u32 primitive_type);
void EnumerateGeometryShaderUids(const std::function<void(const GeometryShaderUid&)>& callback);