2019-12-16 03:28:01 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-07-17 14:00:00 +05:30
|
|
|
#include <unordered_map>
|
|
|
|
|
2019-12-16 03:28:01 +00:00
|
|
|
#include "d3d9_include.h"
|
|
|
|
|
|
|
|
#include "../dxvk/dxvk_shader.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
class D3D9VertexDecl;
|
|
|
|
class D3D9DeviceEx;
|
|
|
|
|
2024-03-13 15:49:46 +01:00
|
|
|
struct D3D9CompactVertexElement {
|
|
|
|
uint16_t Stream : 4;
|
|
|
|
uint16_t Type : 5;
|
|
|
|
uint16_t Method : 3;
|
|
|
|
uint16_t Usage : 4;
|
|
|
|
uint16_t UsageIndex;
|
|
|
|
uint16_t Offset;
|
|
|
|
|
|
|
|
D3D9CompactVertexElement(const D3DVERTEXELEMENT9& element)
|
|
|
|
: Stream(element.Stream), Type(element.Type), Method(element.Method),
|
|
|
|
Usage(element.Usage), UsageIndex(element.UsageIndex), Offset(element.Offset) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
using D3D9CompactVertexElements = small_vector<D3D9CompactVertexElement, 4>;
|
|
|
|
|
2019-12-16 03:28:01 +00:00
|
|
|
struct D3D9VertexDeclHash {
|
2024-03-13 15:49:46 +01:00
|
|
|
size_t operator () (const D3D9CompactVertexElements& key) const;
|
2019-12-16 03:28:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct D3D9VertexDeclEq {
|
2024-03-13 15:49:46 +01:00
|
|
|
bool operator () (const D3D9CompactVertexElements& a, const D3D9CompactVertexElements& b) const;
|
2019-12-16 03:28:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class D3D9SWVPEmulator {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2024-03-13 15:49:46 +01:00
|
|
|
Rc<DxvkShader> GetShaderModule(D3D9DeviceEx* pDevice, D3D9CompactVertexElements&& elements);
|
2019-12-16 03:28:01 +00:00
|
|
|
|
2024-09-17 17:51:44 +02:00
|
|
|
UINT GetShaderCount() const {
|
|
|
|
return m_modules.size();
|
|
|
|
}
|
|
|
|
|
2019-12-16 03:28:01 +00:00
|
|
|
private:
|
|
|
|
|
2021-06-28 19:19:29 +02:00
|
|
|
dxvk::mutex m_mutex;
|
2019-12-16 03:28:01 +00:00
|
|
|
|
|
|
|
std::unordered_map<
|
2024-03-13 15:49:46 +01:00
|
|
|
D3D9CompactVertexElements, Rc<DxvkShader>,
|
2019-12-16 03:28:01 +00:00
|
|
|
D3D9VertexDeclHash, D3D9VertexDeclEq> m_modules;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2020-07-17 14:00:00 +05:30
|
|
|
}
|