VertexLoaderManager: Add methods to generate "uber" vertex formats

These vertex formats enable all attributes. Inactive attributes are set
to offset=0, and the smallest type possible. This "optimization" stops
the NV compiler from generating variants of vertex shaders.
This commit is contained in:
Stenzek
2017-07-03 19:43:47 +10:00
parent f48ef65bec
commit 38c48ff72e
2 changed files with 79 additions and 0 deletions

View File

@ -26,6 +26,16 @@ void MarkAllDirty();
NativeVertexFormatMap* GetNativeVertexFormatMap();
// Creates or obtains a pointer to a VertexFormat representing decl.
// If this results in a VertexFormat being created, if the game later uses a matching vertex
// declaration, the one that was previously created will be used.
NativeVertexFormat* GetOrCreateMatchingFormat(const PortableVertexDeclaration& decl);
// For vertex ubershaders, all attributes need to be present, even when the vertex
// format does not contain them. This function returns a vertex format with dummy
// offsets set to the unused attributes.
NativeVertexFormat* GetUberVertexFormat(const PortableVertexDeclaration& decl);
// Returns -1 if buf_size is insufficient, else the amount of bytes consumed
int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bool is_preprocess);