2013-04-18 03:09:55 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// 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
|
|
|
|
2009-08-10 06:18:10 +00:00
|
|
|
#include <string>
|
2008-12-08 04:46:09 +00:00
|
|
|
|
2014-09-08 01:06:58 +00:00
|
|
|
#include "Common/CommonTypes.h"
|
2014-06-05 15:55:21 +00:00
|
|
|
#include "VideoCommon/NativeVertexFormat.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
|
2008-12-08 04:46:09 +00:00
|
|
|
namespace VertexLoaderManager
|
|
|
|
{
|
2008-12-25 21:44:56 +00:00
|
|
|
void Init();
|
|
|
|
void Shutdown();
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
void MarkAllDirty();
|
|
|
|
|
|
|
|
int GetVertexSize(int vtx_attr_group);
|
Refactor opcode decoding a bit to kill FifoCommandRunnable.
Separated out from my gpu-determinism branch by request. It's not a big
commit; I just like to write long commit messages.
The main reason to kill it is hopefully a slight performance improvement
from avoiding the double switch (especially in single core mode);
however, this also improves cycle calculation, as described below.
- FifoCommandRunnable is removed; in its stead, Decode returns the
number of cycles (which only matters for "sync" GPU mode), or 0 if there
was not enough data, and is also responsible for unknown opcode alerts.
Decode and DecodeSemiNop are almost identical, so the latter is replaced
with a skipped_frame parameter to Decode. Doesn't mean we can't improve
skipped_frame mode to do less work; if, at such a point, branching on it
has too much overhead (it certainly won't now), it can always be changed
to a template parameter.
- FifoCommandRunnable used a fixed, large cycle count for display lists,
regardless of the contents. Presumably the actual hardware's processing
time is mostly the processing time of whatever commands are in the list,
and with this change InterpretDisplayList can just return the list's
cycle count to be added to the total. (Since the calculation for this
is part of Decode, it didn't seem easy to split this change up.)
To facilitate this, Decode also gains an explicit 'end' parameter in
lieu of FifoCommandRunnable's call to GetVideoBufferEndPtr, which can
point to there or to the end of a display list (or elsewhere in
gpu-determinism, but that's another story). Also, as a small
optimization, InterpretDisplayList now calls OpcodeDecoder_Run rather
than having its own Decode loop, to allow Decode to be inlined (haven't
checked whether this actually happens though).
skipped_frame mode still does not traverse display lists and uses the
old fake value of 45 cycles. degasus has suggested that this hack is
not essential for performance and can be removed, but I want to separate
any potential performance impact of that from this commit.
2014-09-01 05:11:32 +00:00
|
|
|
// Returns false if buf_size is insufficient.
|
2014-09-03 19:49:15 +00:00
|
|
|
bool RunVertices(int vtx_attr_group, int primitive, int count, size_t buf_size, bool skip_drawing = false);
|
2008-12-08 04:46:09 +00:00
|
|
|
|
|
|
|
// For debugging
|
|
|
|
void AppendListToString(std::string *dest);
|
2014-06-05 15:55:21 +00:00
|
|
|
|
2014-07-25 23:10:44 +00:00
|
|
|
NativeVertexFormat* GetCurrentVertexFormat();
|
2008-12-08 04:46:09 +00:00
|
|
|
};
|
|
|
|
|
2009-02-09 20:35:30 +00:00
|
|
|
void RecomputeCachedArraybases();
|