2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-12-27 20:41:49 +00:00

feat: dump material techniques for T6

This commit is contained in:
Jan Laupetin
2025-11-13 22:44:09 +00:00
parent 18ccbb9180
commit 9b526adaed
8 changed files with 221 additions and 36 deletions

View File

@@ -32,14 +32,17 @@ namespace d3d11
m_flags(0u)
{
}
} // namespace d3d11
static constexpr auto TAG_RDEF = FileUtils::MakeMagic32('R', 'D', 'E', 'F');
static constexpr auto TAG_SHDR = FileUtils::MakeMagic32('S', 'H', 'D', 'R');
namespace
{
constexpr auto TAG_RDEF = FileUtils::MakeMagic32('R', 'D', 'E', 'F');
constexpr auto TAG_SHDR = FileUtils::MakeMagic32('S', 'H', 'D', 'R');
static constexpr auto VERSION_5_0 = 0x500;
static constexpr auto VERSION_5_1 = 0x501;
static constexpr auto TARGET_VERSION_MASK = 0xFFFF;
static constexpr auto CHUNK_TABLE_OFFSET = 28u;
constexpr auto VERSION_5_0 = 0x500;
constexpr auto VERSION_5_1 = 0x501;
constexpr auto TARGET_VERSION_MASK = 0xFFFF;
constexpr auto CHUNK_TABLE_OFFSET = 28u;
struct FileRdefHeader
{
@@ -669,16 +672,16 @@ namespace d3d11
return true;
}
} // namespace d3d11
} // namespace
std::unique_ptr<ShaderInfo> ShaderAnalyser::GetShaderInfo(const uint8_t* shader, const size_t shaderSize)
std::unique_ptr<ShaderInfo> ShaderAnalyser::GetShaderInfo(const void* shader, const size_t shaderSize)
{
if (shader == nullptr || shaderSize == 0)
return nullptr;
auto shaderInfo = std::make_unique<ShaderInfo>();
if (!PopulateShaderInfoFromBytes(*shaderInfo, shader, shaderSize))
if (!PopulateShaderInfoFromBytes(*shaderInfo, static_cast<const uint8_t*>(shader), shaderSize))
return nullptr;
return shaderInfo;

View File

@@ -1,12 +1,13 @@
#pragma once
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
namespace d3d11
{
enum class ShaderType
enum class ShaderType : std::uint8_t
{
UNKNOWN,
PIXEL_SHADER,
@@ -33,7 +34,7 @@ namespace d3d11
unsigned m_flags;
};
enum class ConstantBufferType
enum class ConstantBufferType : std::uint8_t
{
UNKNOWN,
CBUFFER,
@@ -59,7 +60,7 @@ namespace d3d11
std::vector<ConstantBufferVariable> m_variables;
};
enum class BoundResourceType
enum class BoundResourceType : std::uint8_t
{
UNKNOWN,
CBUFFER,
@@ -68,7 +69,7 @@ namespace d3d11
SAMPLER
};
enum class BoundResourceReturnType
enum class BoundResourceReturnType : std::uint8_t
{
UNKNOWN,
UNORM,
@@ -81,7 +82,7 @@ namespace d3d11
CONTINUED,
};
enum class BoundResourceDimension
enum class BoundResourceDimension : std::uint8_t
{
UNKNOWN,
BUFFER,
@@ -131,6 +132,6 @@ namespace d3d11
class ShaderAnalyser
{
public:
static std::unique_ptr<ShaderInfo> GetShaderInfo(const uint8_t* shader, size_t shaderSize);
static std::unique_ptr<ShaderInfo> GetShaderInfo(const void* shader, size_t shaderSize);
};
} // namespace d3d11

View File

@@ -1,12 +1,13 @@
#pragma once
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
namespace d3d9
{
enum class ShaderType
enum class ShaderType : std::uint8_t
{
UNKNOWN,
PIXEL_SHADER,
@@ -14,7 +15,7 @@ namespace d3d9
};
// https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dxregister-set
enum class RegisterSet
enum class RegisterSet : std::uint8_t
{
BOOL,
INT_4,
@@ -26,7 +27,7 @@ namespace d3d9
};
// https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dxparameter-class
enum class ParameterClass
enum class ParameterClass : std::uint8_t
{
SCALAR,
VECTOR,
@@ -40,7 +41,7 @@ namespace d3d9
};
// https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dxparameter-type
enum class ParameterType
enum class ParameterType : std::uint8_t
{
VOID,
BOOL,

View File

@@ -10,15 +10,21 @@ namespace techset
{
public:
std::string m_name;
uint32_t m_version_major;
uint32_t m_version_minor;
const void* m_shader_bin;
size_t m_shader_bin_size;
};
enum class DxVersion : std::uint8_t
{
DX9,
DX11
};
class CommonPass
{
public:
uint64_t m_flags;
uint32_t m_sampler_flags;
DxVersion m_dx_version;
CommonTechniqueShader m_vertex_shader;
CommonTechniqueShader m_pixel_shader;
};
@@ -26,6 +32,7 @@ namespace techset
class CommonTechnique
{
public:
std::string m_name;
uint64_t m_flags;
std::vector<CommonPass> m_passes;
};