2013-04-18 03:09:55 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2009-03-07 08:35:01 +00:00
|
|
|
|
2010-03-06 02:07:48 +00:00
|
|
|
#include <algorithm>
|
2014-06-05 15:55:21 +00:00
|
|
|
#include <memory>
|
2014-08-25 03:53:28 +00:00
|
|
|
#include <mutex>
|
2012-12-10 06:40:28 +00:00
|
|
|
#include <unordered_map>
|
2014-08-15 14:17:06 +00:00
|
|
|
#include <utility>
|
2009-03-07 08:35:01 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2014-09-19 04:17:41 +00:00
|
|
|
#include "Common/CommonFuncs.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Core/HW/Memmap.h"
|
2009-03-07 08:35:01 +00:00
|
|
|
|
2014-08-05 02:51:42 +00:00
|
|
|
#include "VideoCommon/BPMemory.h"
|
2014-08-02 06:42:15 +00:00
|
|
|
#include "VideoCommon/IndexGenerator.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "VideoCommon/Statistics.h"
|
|
|
|
#include "VideoCommon/VertexLoader.h"
|
|
|
|
#include "VideoCommon/VertexLoaderManager.h"
|
2014-07-25 23:10:44 +00:00
|
|
|
#include "VideoCommon/VertexManagerBase.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "VideoCommon/VertexShaderManager.h"
|
|
|
|
#include "VideoCommon/VideoCommon.h"
|
2009-03-07 08:35:01 +00:00
|
|
|
|
2014-07-25 23:10:44 +00:00
|
|
|
static NativeVertexFormat* s_current_vtx_fmt;
|
2014-08-15 14:17:06 +00:00
|
|
|
|
2012-12-10 14:40:27 +00:00
|
|
|
namespace std
|
|
|
|
{
|
2013-04-02 00:24:27 +00:00
|
|
|
|
|
|
|
template <>
|
|
|
|
struct hash<VertexLoaderUID>
|
|
|
|
{
|
|
|
|
size_t operator()(const VertexLoaderUID& uid) const
|
|
|
|
{
|
|
|
|
return uid.GetHash();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-03-06 02:07:48 +00:00
|
|
|
}
|
2012-12-10 14:40:27 +00:00
|
|
|
|
2014-08-25 03:53:28 +00:00
|
|
|
typedef std::unordered_map<VertexLoaderUID, std::unique_ptr<VertexLoader>> VertexLoaderMap;
|
2010-03-06 02:07:48 +00:00
|
|
|
|
2009-03-07 08:35:01 +00:00
|
|
|
namespace VertexLoaderManager
|
|
|
|
{
|
|
|
|
|
2014-08-25 03:53:28 +00:00
|
|
|
static std::mutex s_vertex_loader_map_lock;
|
|
|
|
static VertexLoaderMap s_vertex_loader_map;
|
2009-03-07 08:35:01 +00:00
|
|
|
// TODO - change into array of pointers. Keep a map of all seen so far.
|
|
|
|
|
|
|
|
void Init()
|
|
|
|
{
|
|
|
|
MarkAllDirty();
|
2014-08-27 17:38:00 +00:00
|
|
|
for (auto& map_entry : g_main_cp_state.vertex_loaders)
|
|
|
|
map_entry = nullptr;
|
|
|
|
for (auto& map_entry : g_preprocess_cp_state.vertex_loaders)
|
2014-08-25 03:53:28 +00:00
|
|
|
map_entry = nullptr;
|
2009-04-24 16:40:58 +00:00
|
|
|
RecomputeCachedArraybases();
|
2009-03-07 08:35:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Shutdown()
|
|
|
|
{
|
2014-08-25 03:53:28 +00:00
|
|
|
std::lock_guard<std::mutex> lk(s_vertex_loader_map_lock);
|
|
|
|
s_vertex_loader_map.clear();
|
|
|
|
VertexLoader::ClearNativeVertexFormatCache();
|
2009-03-07 08:35:01 +00:00
|
|
|
}
|
|
|
|
|
2013-04-24 13:21:54 +00:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
struct entry
|
|
|
|
{
|
2009-03-07 08:35:01 +00:00
|
|
|
std::string text;
|
|
|
|
u64 num_verts;
|
2013-04-24 13:21:54 +00:00
|
|
|
bool operator < (const entry &other) const
|
|
|
|
{
|
2009-03-07 08:35:01 +00:00
|
|
|
return num_verts > other.num_verts;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
void AppendListToString(std::string *dest)
|
|
|
|
{
|
2014-08-25 03:53:28 +00:00
|
|
|
std::lock_guard<std::mutex> lk(s_vertex_loader_map_lock);
|
2009-03-07 08:35:01 +00:00
|
|
|
std::vector<entry> entries;
|
|
|
|
|
|
|
|
size_t total_size = 0;
|
2014-08-25 03:53:28 +00:00
|
|
|
for (const auto& map_entry : s_vertex_loader_map)
|
2009-03-07 08:35:01 +00:00
|
|
|
{
|
|
|
|
entry e;
|
2014-08-25 03:53:28 +00:00
|
|
|
map_entry.second->AppendToString(&e.text);
|
|
|
|
e.num_verts = map_entry.second->GetNumLoadedVerts();
|
2009-03-07 08:35:01 +00:00
|
|
|
entries.push_back(e);
|
|
|
|
total_size += e.text.size() + 1;
|
|
|
|
}
|
|
|
|
sort(entries.begin(), entries.end());
|
|
|
|
dest->reserve(dest->size() + total_size);
|
2014-02-12 15:00:34 +00:00
|
|
|
for (const entry& entry : entries)
|
2013-04-24 13:21:54 +00:00
|
|
|
{
|
2014-02-12 15:00:34 +00:00
|
|
|
dest->append(entry.text);
|
2009-03-07 08:35:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MarkAllDirty()
|
|
|
|
{
|
2014-10-22 00:42:55 +00:00
|
|
|
g_main_cp_state.attr_dirty = BitSet32::AllTrue(8);
|
|
|
|
g_preprocess_cp_state.attr_dirty = BitSet32::AllTrue(8);
|
2009-03-07 08:35:01 +00:00
|
|
|
}
|
|
|
|
|
2014-08-27 17:38:00 +00:00
|
|
|
static VertexLoader* RefreshLoader(int vtx_attr_group, CPState* state)
|
2014-08-15 14:17:06 +00:00
|
|
|
{
|
2014-08-25 03:53:28 +00:00
|
|
|
VertexLoader* loader;
|
2014-10-22 00:42:55 +00:00
|
|
|
if (state->attr_dirty[vtx_attr_group])
|
2014-08-15 14:17:06 +00:00
|
|
|
{
|
2014-08-27 17:38:00 +00:00
|
|
|
VertexLoaderUID uid(state->vtx_desc, state->vtx_attr[vtx_attr_group]);
|
2014-08-25 03:53:28 +00:00
|
|
|
std::lock_guard<std::mutex> lk(s_vertex_loader_map_lock);
|
|
|
|
VertexLoaderMap::iterator iter = s_vertex_loader_map.find(uid);
|
|
|
|
if (iter != s_vertex_loader_map.end())
|
2014-08-15 14:17:06 +00:00
|
|
|
{
|
2014-08-25 03:53:28 +00:00
|
|
|
loader = iter->second.get();
|
2014-08-15 14:17:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-08-27 17:38:00 +00:00
|
|
|
loader = new VertexLoader(state->vtx_desc, state->vtx_attr[vtx_attr_group]);
|
2014-08-25 03:53:28 +00:00
|
|
|
s_vertex_loader_map[uid] = std::unique_ptr<VertexLoader>(loader);
|
2014-08-15 14:17:06 +00:00
|
|
|
INCSTAT(stats.numVertexLoaders);
|
|
|
|
}
|
2014-08-27 17:38:00 +00:00
|
|
|
state->vertex_loaders[vtx_attr_group] = loader;
|
2014-10-22 00:42:55 +00:00
|
|
|
state->attr_dirty[vtx_attr_group] = false;
|
2014-08-25 03:53:28 +00:00
|
|
|
} else {
|
2014-08-27 17:38:00 +00:00
|
|
|
loader = state->vertex_loaders[vtx_attr_group];
|
2014-08-15 14:17:06 +00:00
|
|
|
}
|
2014-08-25 03:53:28 +00:00
|
|
|
return loader;
|
2014-08-15 14:17:06 +00:00
|
|
|
}
|
|
|
|
|
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)
|
2009-03-07 08:35:01 +00:00
|
|
|
{
|
|
|
|
if (!count)
|
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
|
|
|
return true;
|
2014-08-27 17:38:00 +00:00
|
|
|
|
|
|
|
CPState* state = &g_main_cp_state;
|
|
|
|
|
|
|
|
VertexLoader* loader = RefreshLoader(vtx_attr_group, state);
|
2014-07-25 23:10:44 +00:00
|
|
|
|
2014-08-25 03:53:28 +00:00
|
|
|
size_t size = count * loader->GetVertexSize();
|
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
|
|
|
if (buf_size < size)
|
|
|
|
return false;
|
|
|
|
|
2014-09-03 19:49:15 +00:00
|
|
|
if (skip_drawing || (bpmem.genMode.cullmode == GenMode::CULL_ALL && primitive < 5))
|
2014-08-05 02:51:42 +00:00
|
|
|
{
|
|
|
|
// if cull mode is CULL_ALL, ignore triangles and quads
|
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
|
|
|
DataSkip((u32)size);
|
|
|
|
return true;
|
2014-08-05 02:51:42 +00:00
|
|
|
}
|
|
|
|
|
2014-08-25 03:53:28 +00:00
|
|
|
NativeVertexFormat* native = loader->GetNativeVertexFormat();
|
|
|
|
|
2014-07-25 23:10:44 +00:00
|
|
|
// If the native vertex format changed, force a flush.
|
2014-08-25 03:53:28 +00:00
|
|
|
if (native != s_current_vtx_fmt)
|
2014-07-25 23:10:44 +00:00
|
|
|
VertexManager::Flush();
|
2014-08-25 03:53:28 +00:00
|
|
|
s_current_vtx_fmt = native;
|
2014-07-25 23:10:44 +00:00
|
|
|
|
2014-08-02 06:42:15 +00:00
|
|
|
VertexManager::PrepareForAdditionalData(primitive, count,
|
2014-08-25 03:53:28 +00:00
|
|
|
loader->GetNativeVertexDeclaration().stride);
|
2014-08-02 06:42:15 +00:00
|
|
|
|
2014-08-27 17:38:00 +00:00
|
|
|
loader->RunVertices(state->vtx_attr[vtx_attr_group], primitive, count);
|
2014-08-02 06:42:15 +00:00
|
|
|
|
|
|
|
IndexGenerator::AddIndices(primitive, count);
|
|
|
|
|
|
|
|
ADDSTAT(stats.thisFrame.numPrims, count);
|
|
|
|
INCSTAT(stats.thisFrame.numPrimitiveJoins);
|
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
|
|
|
return true;
|
2014-01-30 13:48:23 +00:00
|
|
|
}
|
2009-08-08 01:39:56 +00:00
|
|
|
|
2014-08-27 17:38:00 +00:00
|
|
|
int GetVertexSize(int vtx_attr_group, bool preprocess)
|
2009-03-07 08:35:01 +00:00
|
|
|
{
|
2014-08-27 17:38:00 +00:00
|
|
|
return RefreshLoader(vtx_attr_group, preprocess ? &g_preprocess_cp_state : &g_main_cp_state)->GetVertexSize();
|
2009-03-07 08:35:01 +00:00
|
|
|
}
|
|
|
|
|
2014-07-25 23:10:44 +00:00
|
|
|
NativeVertexFormat* GetCurrentVertexFormat()
|
2014-06-05 15:55:21 +00:00
|
|
|
{
|
2014-07-25 23:10:44 +00:00
|
|
|
return s_current_vtx_fmt;
|
2014-06-05 15:55:21 +00:00
|
|
|
}
|
|
|
|
|
2009-03-07 08:35:01 +00:00
|
|
|
} // namespace
|
|
|
|
|
2014-08-27 17:38:00 +00:00
|
|
|
void LoadCPReg(u32 sub_cmd, u32 value, bool is_preprocess)
|
2009-03-07 08:35:01 +00:00
|
|
|
{
|
2014-08-27 17:38:00 +00:00
|
|
|
bool update_global_state = !is_preprocess;
|
|
|
|
CPState* state = is_preprocess ? &g_preprocess_cp_state : &g_main_cp_state;
|
2009-03-07 08:35:01 +00:00
|
|
|
switch (sub_cmd & 0xF0)
|
|
|
|
{
|
|
|
|
case 0x30:
|
2014-08-27 17:38:00 +00:00
|
|
|
if (update_global_state)
|
|
|
|
VertexShaderManager::SetTexMatrixChangedA(value);
|
2009-03-07 08:35:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x40:
|
2014-08-27 17:38:00 +00:00
|
|
|
if (update_global_state)
|
|
|
|
VertexShaderManager::SetTexMatrixChangedB(value);
|
2009-03-07 08:35:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x50:
|
2014-08-27 17:38:00 +00:00
|
|
|
state->vtx_desc.Hex &= ~0x1FFFF; // keep the Upper bits
|
|
|
|
state->vtx_desc.Hex |= value;
|
2014-10-22 00:42:55 +00:00
|
|
|
state->attr_dirty = BitSet32::AllTrue(8);
|
2009-03-07 08:35:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x60:
|
2014-08-27 17:38:00 +00:00
|
|
|
state->vtx_desc.Hex &= 0x1FFFF; // keep the lower 17Bits
|
|
|
|
state->vtx_desc.Hex |= (u64)value << 17;
|
2014-10-22 00:42:55 +00:00
|
|
|
state->attr_dirty = BitSet32::AllTrue(8);
|
2009-03-07 08:35:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x70:
|
|
|
|
_assert_((sub_cmd & 0x0F) < 8);
|
2014-08-27 17:38:00 +00:00
|
|
|
state->vtx_attr[sub_cmd & 7].g0.Hex = value;
|
2014-10-22 00:42:55 +00:00
|
|
|
state->attr_dirty[sub_cmd & 7] = true;
|
2009-03-07 08:35:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x80:
|
|
|
|
_assert_((sub_cmd & 0x0F) < 8);
|
2014-08-27 17:38:00 +00:00
|
|
|
state->vtx_attr[sub_cmd & 7].g1.Hex = value;
|
2014-10-22 00:42:55 +00:00
|
|
|
state->attr_dirty[sub_cmd & 7] = true;
|
2009-03-07 08:35:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x90:
|
|
|
|
_assert_((sub_cmd & 0x0F) < 8);
|
2014-08-27 17:38:00 +00:00
|
|
|
state->vtx_attr[sub_cmd & 7].g2.Hex = value;
|
2014-10-22 00:42:55 +00:00
|
|
|
state->attr_dirty[sub_cmd & 7] = true;
|
2009-03-07 08:35:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
// Pointers to vertex arrays in GC RAM
|
|
|
|
case 0xA0:
|
2014-08-27 17:38:00 +00:00
|
|
|
state->array_bases[sub_cmd & 0xF] = value;
|
|
|
|
if (update_global_state)
|
|
|
|
cached_arraybases[sub_cmd & 0xF] = Memory::GetPointer(value);
|
2009-03-07 08:35:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0xB0:
|
2014-08-27 17:38:00 +00:00
|
|
|
state->array_strides[sub_cmd & 0xF] = value & 0xFF;
|
2009-03-07 08:35:01 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-27 02:55:08 +00:00
|
|
|
void FillCPMemoryArray(u32 *memory)
|
|
|
|
{
|
2014-08-27 17:26:06 +00:00
|
|
|
memory[0x30] = g_main_cp_state.matrix_index_a.Hex;
|
|
|
|
memory[0x40] = g_main_cp_state.matrix_index_b.Hex;
|
|
|
|
memory[0x50] = (u32)g_main_cp_state.vtx_desc.Hex;
|
|
|
|
memory[0x60] = (u32)(g_main_cp_state.vtx_desc.Hex >> 17);
|
2011-03-27 02:55:08 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < 8; ++i)
|
|
|
|
{
|
2014-08-27 17:26:06 +00:00
|
|
|
memory[0x70 + i] = g_main_cp_state.vtx_attr[i].g0.Hex;
|
|
|
|
memory[0x80 + i] = g_main_cp_state.vtx_attr[i].g1.Hex;
|
|
|
|
memory[0x90 + i] = g_main_cp_state.vtx_attr[i].g2.Hex;
|
2011-03-27 02:55:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 16; ++i)
|
|
|
|
{
|
2014-08-27 17:26:06 +00:00
|
|
|
memory[0xA0 + i] = g_main_cp_state.array_bases[i];
|
|
|
|
memory[0xB0 + i] = g_main_cp_state.array_strides[i];
|
2011-03-27 02:55:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-07 08:35:01 +00:00
|
|
|
void RecomputeCachedArraybases()
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 16; i++)
|
|
|
|
{
|
2014-08-27 17:26:06 +00:00
|
|
|
cached_arraybases[i] = Memory::GetPointer(g_main_cp_state.array_bases[i]);
|
2009-03-07 08:35:01 +00:00
|
|
|
}
|
|
|
|
}
|