some gfx headers

This commit is contained in:
shibbo 2024-09-02 17:33:41 -04:00
parent 1402992ff3
commit b196bfc718
7 changed files with 153 additions and 3 deletions

View File

@ -1,9 +1,12 @@
#pragma once
#include <cstdio>
#include "gfx/gfx_DescriptorSlot.hpp"
#include "nn_BitTypes.hpp"
#include "util/util_AccessorBase.hpp"
#include "util/util_BinTypes.hpp"
#include "util/util_MathTypes.hpp"
#include "util/util_ResDic.hpp"
namespace nn {
namespace g3d {
@ -14,6 +17,25 @@ namespace nn {
nn::util::Float3 translate;
};
struct ResRenderInfoData {
nn::util::BinPtrToString pName;
union {
nn::util::BinTPtr<int32_t> intValueArray;
nn::util::BinTPtr<float> floatValueArray;
nn::util::BinTPtr<nn::util::BinPtrToString> stringArray;
};
uint16_t arrayLength;
uint8_t type;
uint8_t res[5];
};
class ResRenderInfo : public nn::util::AccessorBase<ResRenderInfoData> {
public:
enum Type { Type_Int, Type_Float, Type_String };
};
struct ResShaderParamData {
nn::util::BinPtr pCallback;
nn::util::BinPtrToString pId;
@ -78,8 +100,51 @@ namespace nn {
const void*);
};
static size_t ConvertTexSrtCallback(void*, const void*, const ResShaderParam*, const void*);
static size_t ConvertTexSrtExCallback(void*, const void*, const ResShaderParam*,
const void*);
struct ResShaderAssignData {
nn::util::BinPtrToString pShaderArchiveName;
nn::util::BinPtrToString pShadingModelName;
nn::util::BinTPtr<nn::util::BinPtrToString> pAttrAssignArray;
nn::util::BinTPtr<nn::util::ResDic> pAttrAssignDic;
nn::util::BinTPtr<nn::util::BinPtrToString> pSamplerAssignArray;
nn::util::BinTPtr<nn::util::ResDic> pSamplerAssignDic;
nn::util::BinTPtr<nn::util::BinPtrToString> pShaderOptionArray;
nn::util::BinTPtr<nn::util::ResDic> pShaderOptionDic;
uint32_t revision;
uint8_t attrAssignCount;
uint8_t samplerAssignCount;
uint16_t shaderOptionCount;
};
// static size_t ConvertTexSrtCallback(void*, const void*, const ResShaderParam*, const
// void*); static size_t ConvertTexSrtExCallback(void*, const void*, const ResShaderParam*,
// const void*);
struct ResShaderAssignData {
nn::util::BinPtrToString pShaderArchiveName;
nn::util::BinPtrToString pShadingModelName;
nn::util::BinTPtr<nn::util::BinPtrToString> pAttrAssignArray;
nn::util::BinTPtr<nn::util::ResDic> pAttrAssignDic;
nn::util::BinTPtr<nn::util::BinPtrToString> pSamplerAssignArray;
nn::util::BinTPtr<nn::util::ResDic> pSamplerAssignDic;
nn::util::BinTPtr<nn::util::BinPtrToString> pShaderOptionArray;
nn::util::BinTPtr<nn::util::ResDic> pShaderOptionDic;
uint32_t revision;
uint8_t attrAssignCount;
uint8_t samplerAssignCount;
uint16_t shaderOptionCount;
};
class ResShaderAssign : public nn::util::AccessorBase<ResShaderAssignData> {
public:
};
struct ResMaterialData {
nn::util::BinBlockSignature signature;
Bit32 flag;
nn::util::BinPtrToString pName;
nn::util::BinTPtr<ResRenderInfo> pRenderInfoArray;
nn::util::BinTPtr<nn::util::ResDic> pRenderInfoDic;
nn::util::BinTPtr<ResShaderAssign> pShaderAssign;
};
}; // namespace g3d
}; // namespace nn

View File

@ -8,12 +8,18 @@ namespace nn {
template <typename TTarget>
struct DeviceImplData;
template <typename TTarget>
struct TextureInfoImplData;
namespace detail {
template <typename TTarget>
class MemoryPoolImpl;
template <typename TTarget>
class DeviceImpl;
template <typename TTarget>
class TextureInfoImpl;
}; // namespace detail
}; // namespace gfx

View File

@ -0,0 +1,21 @@
#pragma once
#include "gfx/detail/gfx_DataContainer.hpp"
#include "gfx/detail/gfx_Declare.hpp"
#include "gfx/gfx_Texture.hpp"
#include "gfx/gfx_TextureInfoData.hpp"
#include "gfx/gfx_Variaton.hpp"
namespace nn {
namespace gfx {
class TextureInfo;
namespace detail {
template <>
class TextureInfoImpl<ApiVariationNvn8>
: public DataContainer<TextureInfoImplData<ApiVariationNvn8>> {
public:
};
}; // namespace detail
}; // namespace gfx
}; // namespace nn

View File

@ -0,0 +1,21 @@
#pragma once
#include <stdint.h>
#include "gfx/detail/gfx_DataContainer.hpp"
namespace nn {
namespace gfx {
struct DescriptorSlotData {
uint64_t value;
};
class DescriptorSlot : public detail::DataContainer<DescriptorSlotData> {
public:
DescriptorSlot() { this->value = InvalidValue; }
private:
static const uint64_t InvalidValue = static_cast<uint64_t>(-1);
};
}; // namespace gfx
}; // namespace nn

View File

@ -0,0 +1,5 @@
#pragma once
namespace nn {
namespace gfx {};
}; // namespace nn

View File

@ -0,0 +1,26 @@
#pragma once
#include <nvn.h>
#include "gfx/detail/gfx_Declare.hpp"
#include "gfx/gfx_Variaton.hpp"
#include "nn_BitTypes.hpp"
namespace nn {
namespace gfx {
template <>
struct TextureInfoImplData<ApiVariationNvn8> {
NVNtextureBuilder nvnTextureBuilder;
Bit8 imageStorageDimension;
char res;
uint16_t multisampleCount;
Bit16 tileMode;
char res2[2];
uint32_t arrayLength;
Bit32 gpuAccessFlags;
Bit32 imageFormat;
uint32_t width;
uint32_t height;
uint32_t depth;
};
}; // namespace gfx
}; // namespace nn

View File

@ -8,6 +8,8 @@ typedef struct NVNdevice NVNdevice;
typedef struct NVNsamplerBuilder NVNsamplerBuilder;
typedef struct NVNsampler NVNsampler;
typedef struct NVNtextureBuilder NVNtextureBuilder;
#define NVN_PRE_ALIGN(ALIGN)
#ifdef __INTELLISENSE__
@ -52,6 +54,10 @@ NVN_PRE_ALIGN(8) struct NVNsampler {
char reserved[96];
} NVN_POST_ALIGN(8);
NVN_PRE_ALIGN(8) struct NVNtextureBuilder {
char reserved[128];
} NVN_POST_ALIGN(8);
typedef NVNboolean(NVNAPIENTRYP PFNNVNDEVICEINITIALIZEPROC)(NVNdevice* device,
const NVNdeviceBuilder* builder);
typedef void(NVNAPIENTRYP PFNNVNDEVICEFINALIZEPROC)(NVNdevice* device);