2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2008 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 03:09:55 +00:00
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2016-02-26 19:55:34 +00:00
|
|
|
#include <memory>
|
2009-08-10 06:18:10 +00:00
|
|
|
#include <string>
|
2016-01-08 03:38:00 +00:00
|
|
|
#include <unordered_map>
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-09-08 01:06:58 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2021-03-26 22:46:37 +00:00
|
|
|
#include "VideoCommon/CPMemory.h"
|
2016-01-17 21:54:31 +00:00
|
|
|
|
2016-01-31 19:51:55 +00:00
|
|
|
class DataReader;
|
2016-01-17 21:54:31 +00:00
|
|
|
class NativeVertexFormat;
|
2016-01-08 03:38:00 +00:00
|
|
|
struct PortableVertexDeclaration;
|
2014-02-17 10:18:15 +00:00
|
|
|
|
2008-10-25 12:35:55 +00:00
|
|
|
namespace VertexLoaderManager
|
|
|
|
{
|
2016-01-08 03:38:00 +00:00
|
|
|
using NativeVertexFormatMap =
|
|
|
|
std::unordered_map<PortableVertexDeclaration, std::unique_ptr<NativeVertexFormat>>;
|
|
|
|
|
2008-12-25 21:44:56 +00:00
|
|
|
void Init();
|
2016-01-13 20:14:20 +00:00
|
|
|
void Clear();
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2008-10-25 15:53:43 +00:00
|
|
|
void MarkAllDirty();
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2017-07-03 09:43:47 +00:00
|
|
|
// 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);
|
|
|
|
|
2014-12-09 07:35:04 +00:00
|
|
|
// Returns -1 if buf_size is insufficient, else the amount of bytes consumed
|
2016-10-08 02:55:47 +00:00
|
|
|
int RunVertices(int vtx_attr_group, int primitive, int count, DataReader src, bool is_preprocess);
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-07-25 23:10:44 +00:00
|
|
|
NativeVertexFormat* GetCurrentVertexFormat();
|
2015-05-29 12:42:45 +00:00
|
|
|
|
|
|
|
// Resolved pointers to array bases. Used by vertex loaders.
|
2021-03-26 22:46:37 +00:00
|
|
|
extern u8* cached_arraybases[NUM_VERTEX_COMPONENT_ARRAYS];
|
2015-05-29 12:42:45 +00:00
|
|
|
void UpdateVertexArrayPointers();
|
2015-06-01 17:58:27 +00:00
|
|
|
|
|
|
|
// Position cache for zfreeze (3 vertices, 4 floats each to allow SIMD overwrite).
|
|
|
|
// These arrays are in reverse order.
|
|
|
|
extern float position_cache[3][4];
|
2016-05-07 07:35:40 +00:00
|
|
|
extern u32 position_matrix_index[4];
|
2015-11-01 21:39:31 +00:00
|
|
|
|
|
|
|
// VB_HAS_X. Bitmask telling what vertex components are present.
|
|
|
|
extern u32 g_current_components;
|
2019-05-05 23:48:12 +00:00
|
|
|
} // namespace VertexLoaderManager
|