mirror of https://github.com/AxioDL/metaforce.git
aurora: Reimplement textures
This commit is contained in:
parent
dcc040c7e0
commit
c64f9eb2d1
|
@ -472,7 +472,7 @@ function(shaderc out)
|
|||
endfunction()
|
||||
|
||||
include(hecl/ApplicationTools.cmake)
|
||||
#add_subdirectory(Shaders)
|
||||
add_subdirectory(extern/xxhash EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(imgui)
|
||||
add_subdirectory(extern/libSquish EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(extern/libpng EXCLUDE_FROM_ALL)
|
||||
|
|
|
@ -74,7 +74,7 @@ add_library(AssetNameMapNull
|
|||
|
||||
get_target_property(HECL_INCLUDES hecl-full INCLUDE_DIRECTORIES)
|
||||
target_include_directories(RetroDataSpec PUBLIC ${HECL_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR})
|
||||
target_link_libraries(RetroDataSpec PUBLIC amuse zeus nod squish ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} lzokay logvisor aurora)
|
||||
target_link_libraries(RetroDataSpec PUBLIC amuse zeus nod squish ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} lzokay logvisor aurora xxhash)
|
||||
if (COMMAND add_sanitizers)
|
||||
add_sanitizers(RetroDataSpec)
|
||||
endif ()
|
||||
|
|
|
@ -35,7 +35,7 @@ private:
|
|||
zeus::CColor m_color;
|
||||
};
|
||||
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_texture;
|
||||
aurora::gfx::TextureHandle m_texture;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||
// boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||
// boo::ObjToken<boo::IShaderDataBinding> m_shadBind;
|
||||
|
|
|
@ -64,7 +64,7 @@ private:
|
|||
CLineRenderer m_outline;
|
||||
explicit DoorSurface()
|
||||
: m_surface(skDoorVerts, skDoorIndices)
|
||||
, m_outline(CLineRenderer::EPrimitiveMode::LineLoop, 5, nullptr, false, false, true) {}
|
||||
, m_outline(CLineRenderer::EPrimitiveMode::LineLoop, 5, {}, false, false, true) {}
|
||||
};
|
||||
std::optional<DoorSurface> m_doorSurface;
|
||||
std::optional<CTexturedQuadFilter> m_texQuadFilter;
|
||||
|
|
|
@ -644,7 +644,7 @@ void CBooRenderer::ReallyRenderFogVolume(const zeus::CColor& color, const zeus::
|
|||
// m_scanLinesOddVBO = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts.data(), sizeof(zeus::CVector3f), verts.size());
|
||||
//}
|
||||
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> CBooRenderer::GetColorTexture(const zeus::CColor& color) {
|
||||
aurora::gfx::TextureHandle CBooRenderer::GetColorTexture(const zeus::CColor& color) {
|
||||
const auto search = m_colorTextures.find(color);
|
||||
if (search != m_colorTextures.end()) {
|
||||
return search->second;
|
||||
|
@ -652,7 +652,7 @@ std::shared_ptr<aurora::gfx::TextureHandle> CBooRenderer::GetColorTexture(const
|
|||
|
||||
std::array<u8, 4> pixel{};
|
||||
color.toRGBA8(pixel[0], pixel[1], pixel[2], pixel[3]);
|
||||
auto tex = aurora::gfx::new_static_texture_2d(1, 1, 1, aurora::gfx::TextureFormat::RGBA8, pixel, "Color Texture"sv);
|
||||
auto tex = aurora::gfx::new_static_texture_2d(1, 1, 1, aurora::gfx::TextureFormat::RGBA8, pixel, "Color Texture");
|
||||
m_colorTextures.emplace(color, tex);
|
||||
return tex;
|
||||
}
|
||||
|
@ -681,13 +681,13 @@ CBooRenderer::CBooRenderer(IObjectStore& store, IFactory& resFac)
|
|||
|
||||
constexpr std::array<u8, 4> clearPixel{0, 0, 0, 0};
|
||||
m_clearTexture =
|
||||
aurora::gfx::new_static_texture_2d(1, 1, 1, aurora::gfx::TextureFormat::RGBA8, clearPixel, "Clear Texture"sv);
|
||||
aurora::gfx::new_static_texture_2d(1, 1, 1, aurora::gfx::TextureFormat::RGBA8, clearPixel, "Clear Texture");
|
||||
constexpr std::array<u8, 4> blackPixel{0, 0, 0, 255};
|
||||
m_blackTexture =
|
||||
aurora::gfx::new_static_texture_2d(1, 1, 1, aurora::gfx::TextureFormat::RGBA8, blackPixel, "Black Texture"sv);
|
||||
aurora::gfx::new_static_texture_2d(1, 1, 1, aurora::gfx::TextureFormat::RGBA8, blackPixel, "Black Texture");
|
||||
constexpr std::array<u8, 4> whitePixel{255, 255, 255, 255};
|
||||
m_whiteTexture =
|
||||
aurora::gfx::new_static_texture_2d(1, 1, 1, aurora::gfx::TextureFormat::RGBA8, whitePixel, "White Texture"sv);
|
||||
aurora::gfx::new_static_texture_2d(1, 1, 1, aurora::gfx::TextureFormat::RGBA8, whitePixel, "White Texture");
|
||||
|
||||
// GenerateFogVolumeRampTex();
|
||||
// GenerateSphereRampTex();
|
||||
|
|
|
@ -101,20 +101,20 @@ class CBooRenderer final : public IRenderer {
|
|||
// boo::ITextureS* xe4_blackTex = nullptr;
|
||||
bool xee_24_ : 1 = true;
|
||||
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_clearTexture;
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_blackTexture;
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_whiteTexture;
|
||||
std::unordered_map<zeus::CColor, std::shared_ptr<aurora::gfx::TextureHandle>> m_colorTextures;
|
||||
aurora::gfx::TextureHandle m_clearTexture;
|
||||
aurora::gfx::TextureHandle m_blackTexture;
|
||||
aurora::gfx::TextureHandle m_whiteTexture;
|
||||
std::unordered_map<zeus::CColor, aurora::gfx::TextureHandle> m_colorTextures;
|
||||
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> x14c_reflectionTex;
|
||||
aurora::gfx::TextureHandle x14c_reflectionTex;
|
||||
// boo::ITextureS* x150_mirrorRamp = nullptr;
|
||||
// std::shared_ptr<aurora::gfx::TextureHandle> x1b8_fogVolumeRamp;
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> x220_sphereRamp;
|
||||
// aurora::gfx::TextureHandle x1b8_fogVolumeRamp;
|
||||
aurora::gfx::TextureHandle x220_sphereRamp;
|
||||
// TLockedToken<CTexture> m_thermoPaletteTex;
|
||||
// std::shared_ptr<aurora::gfx::TextureHandle> x288_thermoPalette;
|
||||
// aurora::gfx::TextureHandle x288_thermoPalette;
|
||||
// TLockedToken<CTexture> m_ballFadeTex;
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_ballFade;
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_ballShadowId;
|
||||
aurora::gfx::TextureHandle m_ballFade;
|
||||
aurora::gfx::TextureHandle m_ballShadowId;
|
||||
// boo::ObjToken<boo::IGraphicsBufferS> m_scanLinesEvenVBO;
|
||||
// boo::ObjToken<boo::IGraphicsBufferS> m_scanLinesOddVBO;
|
||||
int m_ballShadowIdW = 64;
|
||||
|
@ -269,11 +269,11 @@ public:
|
|||
// const boo::ObjToken<boo::IGraphicsBufferS>& GetScanLinesEvenVBO() const { return m_scanLinesEvenVBO; }
|
||||
// const boo::ObjToken<boo::IGraphicsBufferS>& GetScanLinesOddVBO() const { return m_scanLinesOddVBO; }
|
||||
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& GetClearTexture() const { return m_clearTexture; }
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& GetBlackTexture() const { return m_blackTexture; }
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& GetWhiteTexture() const { return m_whiteTexture; }
|
||||
const aurora::gfx::TextureHandle& GetClearTexture() const { return m_clearTexture; }
|
||||
const aurora::gfx::TextureHandle& GetBlackTexture() const { return m_blackTexture; }
|
||||
const aurora::gfx::TextureHandle& GetWhiteTexture() const { return m_whiteTexture; }
|
||||
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> GetColorTexture(const zeus::CColor& color);
|
||||
aurora::gfx::TextureHandle GetColorTexture(const zeus::CColor& color);
|
||||
|
||||
static void BindMainDrawTarget() {
|
||||
// CGraphics::g_BooMainCommandQueue->setRenderTarget(CGraphics::g_SpareTexture);
|
||||
|
|
|
@ -20,7 +20,7 @@ void CLineRenderer::Shutdown() {
|
|||
//hecl::VertexBufferPool<CLineRenderer::SDrawVertNoTex> CLineRenderer::s_vertPoolNoTex = {};
|
||||
//hecl::UniformBufferPool<CLineRenderer::SDrawUniform> CLineRenderer::s_uniformPool = {};
|
||||
|
||||
CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const std::shared_ptr<aurora::gfx::TextureHandle>& texture,
|
||||
CLineRenderer::CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const aurora::gfx::TextureHandle& texture,
|
||||
bool additive, bool zTest, bool zGEqual)
|
||||
: m_mode(mode), m_maxVerts(maxVerts) {
|
||||
OPTICK_EVENT();
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
// hecl::UniformBufferPool<SDrawUniform>::Token m_uniformBuf;
|
||||
// std::array<boo::ObjToken<boo::IShaderDataBinding>, 2> m_shaderBind;
|
||||
|
||||
CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const std::shared_ptr<aurora::gfx::TextureHandle>& texture, bool additive,
|
||||
CLineRenderer(EPrimitiveMode mode, u32 maxVerts, const aurora::gfx::TextureHandle& texture, bool additive,
|
||||
bool zTest = false, bool zGEqual = false);
|
||||
CLineRenderer(CLineRenderer&&) = default;
|
||||
|
||||
|
|
|
@ -239,16 +239,16 @@ public:
|
|||
static void EnsureViewDepStateCached(const CBooModel& model, const CBooSurface* surf, zeus::CMatrix4f* mtxsOut,
|
||||
float& alphaOut);
|
||||
|
||||
static inline std::shared_ptr<aurora::gfx::TextureHandle> g_shadowMap;
|
||||
static inline aurora::gfx::TextureHandle g_shadowMap;
|
||||
static inline zeus::CTransform g_shadowTexXf;
|
||||
static void EnableShadowMaps(const std::shared_ptr<aurora::gfx::TextureHandle>& map, const zeus::CTransform& texXf);
|
||||
static void EnableShadowMaps(const aurora::gfx::TextureHandle& map, const zeus::CTransform& texXf);
|
||||
static void DisableShadowMaps();
|
||||
|
||||
static inline std::shared_ptr<aurora::gfx::TextureHandle> g_disintegrateTexture;
|
||||
static void SetDisintegrateTexture(const std::shared_ptr<aurora::gfx::TextureHandle>& map) { g_disintegrateTexture = map; }
|
||||
static inline aurora::gfx::TextureHandle g_disintegrateTexture;
|
||||
static void SetDisintegrateTexture(const aurora::gfx::TextureHandle& map) { g_disintegrateTexture = map; }
|
||||
|
||||
static inline std::shared_ptr<aurora::gfx::TextureHandle> g_reflectionCube;
|
||||
static void SetReflectionCube(const std::shared_ptr<aurora::gfx::TextureHandle>& map) { g_reflectionCube = map; }
|
||||
static inline aurora::gfx::TextureHandle g_reflectionCube;
|
||||
static void SetReflectionCube(const aurora::gfx::TextureHandle& map) { g_reflectionCube = map; }
|
||||
|
||||
static void SetDummyTextures(bool b) { g_DummyTextures = b; }
|
||||
static void SetRenderModelBlack(bool b) { g_RenderModelBlack = b; }
|
||||
|
|
|
@ -135,11 +135,11 @@ void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurfa
|
|||
}
|
||||
}
|
||||
|
||||
void CBooModel::EnableShadowMaps(const std::shared_ptr<aurora::gfx::TextureHandle>& map, const zeus::CTransform& texXf) {
|
||||
void CBooModel::EnableShadowMaps(const aurora::gfx::TextureHandle& map, const zeus::CTransform& texXf) {
|
||||
g_shadowMap = map;
|
||||
g_shadowTexXf = texXf;
|
||||
}
|
||||
void CBooModel::DisableShadowMaps() { g_shadowMap = nullptr; }
|
||||
void CBooModel::DisableShadowMaps() { g_shadowMap.reset(); }
|
||||
|
||||
CBooModel::~CBooModel() {
|
||||
if (m_prev)
|
||||
|
|
|
@ -373,8 +373,8 @@ void CMoviePlayer::DrawFrame() {
|
|||
|
||||
/* draw appropriate field */
|
||||
CTHPTextureSet& tex = x80_textures[xd0_drawTexSlot];
|
||||
aurora::gfx::queue_movie_player(tex.Y[m_deinterlace ? (xfc_fieldIndex != 0) : 0]->ref, tex.U->ref, tex.V->ref,
|
||||
zeus::skWhite, m_hpad, m_vpad);
|
||||
aurora::gfx::queue_movie_player(tex.Y[m_deinterlace ? (xfc_fieldIndex != 0) : 0], tex.U, tex.V, zeus::skWhite, m_hpad,
|
||||
m_vpad);
|
||||
|
||||
/* ensure second field is being displayed by VI to signal advance
|
||||
* (faked in metaforce with continuous xor) */
|
||||
|
@ -495,18 +495,18 @@ void CMoviePlayer::DecodeFromRead(const void* data) {
|
|||
memcpy(buffer.get() + x6c_videoInfo.width * y, m_yuvBuf.get() + x6c_videoInfo.width * (y * 2),
|
||||
x6c_videoInfo.width);
|
||||
}
|
||||
aurora::gfx::write_texture(tex.Y[0]->ref, {buffer.get(), planeSizeHalf});
|
||||
aurora::gfx::write_texture(tex.Y[0], {buffer.get(), planeSizeHalf});
|
||||
for (unsigned y = 0; y < x6c_videoInfo.height / 2; ++y) {
|
||||
memcpy(buffer.get() + x6c_videoInfo.width * y, m_yuvBuf.get() + x6c_videoInfo.width * (y * 2 + 1),
|
||||
x6c_videoInfo.width);
|
||||
}
|
||||
aurora::gfx::write_texture(tex.Y[1]->ref, {buffer.get(), planeSizeHalf});
|
||||
aurora::gfx::write_texture(tex.Y[1], {buffer.get(), planeSizeHalf});
|
||||
} else {
|
||||
/* Direct planar load */
|
||||
aurora::gfx::write_texture(tex.Y[0]->ref, {m_yuvBuf.get(), planeSize});
|
||||
aurora::gfx::write_texture(tex.Y[0], {m_yuvBuf.get(), planeSize});
|
||||
}
|
||||
aurora::gfx::write_texture(tex.U->ref, {m_yuvBuf.get() + planeSize, planeSizeQuarter});
|
||||
aurora::gfx::write_texture(tex.V->ref, {m_yuvBuf.get() + planeSize + planeSizeQuarter, planeSizeQuarter});
|
||||
aurora::gfx::write_texture(tex.U, {m_yuvBuf.get() + planeSize, planeSizeQuarter});
|
||||
aurora::gfx::write_texture(tex.V, {m_yuvBuf.get() + planeSize + planeSizeQuarter, planeSizeQuarter});
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -69,9 +69,9 @@ private:
|
|||
};
|
||||
|
||||
struct CTHPTextureSet {
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> Y[2];
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> U;
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> V;
|
||||
std::array<aurora::gfx::TextureHandle, 2> Y;
|
||||
aurora::gfx::TextureHandle U;
|
||||
aurora::gfx::TextureHandle V;
|
||||
u32 playedSamples = 0;
|
||||
u32 audioSamples = 0;
|
||||
std::unique_ptr<s16[]> audioBuf;
|
||||
|
|
|
@ -71,7 +71,7 @@ void CRainSplashGenerator::Draw(const zeus::CTransform& xf) {
|
|||
}
|
||||
|
||||
CRainSplashGenerator::SSplashLine::SSplashLine()
|
||||
: m_renderer(CLineRenderer::EPrimitiveMode::LineStrip, 3, nullptr, false) {}
|
||||
: m_renderer(CLineRenderer::EPrimitiveMode::LineStrip, 3, {}, false) {}
|
||||
|
||||
CRainSplashGenerator::SRainSplash::SRainSplash() {
|
||||
for (size_t i = 0; i < x0_lines.capacity(); ++i) {
|
||||
|
|
|
@ -33,30 +33,30 @@ private:
|
|||
u16 x6_h;
|
||||
u32 x8_mips;
|
||||
// boo::ObjToken<boo::ITexture> m_booTex;
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_tex;
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_paletteTex;
|
||||
aurora::gfx::TextureHandle m_tex;
|
||||
aurora::gfx::TextureHandle m_paletteTex;
|
||||
std::unique_ptr<u8[]> m_otex;
|
||||
EFontType m_ftype = EFontType::None;
|
||||
const CTextureInfo* m_textureInfo;
|
||||
|
||||
size_t ComputeMippedTexelCount() const;
|
||||
size_t ComputeMippedBlockCountDXT1() const;
|
||||
void BuildI4FromGCN(CInputStream& in, std::string_view label);
|
||||
void BuildI8FromGCN(CInputStream& in, std::string_view label);
|
||||
void BuildIA4FromGCN(CInputStream& in, std::string_view label);
|
||||
void BuildIA8FromGCN(CInputStream& in, std::string_view label);
|
||||
void BuildC4FromGCN(CInputStream& in, std::string_view label);
|
||||
void BuildC8FromGCN(CInputStream& in, std::string_view label);
|
||||
void BuildC14X2FromGCN(CInputStream& in, std::string_view label);
|
||||
void BuildRGB565FromGCN(CInputStream& in, std::string_view label);
|
||||
void BuildRGB5A3FromGCN(CInputStream& in, std::string_view label);
|
||||
void BuildRGBA8FromGCN(CInputStream& in, std::string_view label);
|
||||
void BuildDXT1FromGCN(CInputStream& in, std::string_view label);
|
||||
void BuildRGBA8(const void* data, size_t length, std::string_view label);
|
||||
void BuildC8(const void* data, size_t length, std::string_view label);
|
||||
void BuildC8Font(const void* data, EFontType ftype, std::string_view label);
|
||||
void BuildDXT1(const void* data, size_t length, std::string_view label);
|
||||
void BuildDXT3(const void* data, size_t length, std::string_view label);
|
||||
void BuildI4FromGCN(CInputStream& in, aurora::zstring_view label);
|
||||
void BuildI8FromGCN(CInputStream& in, aurora::zstring_view label);
|
||||
void BuildIA4FromGCN(CInputStream& in, aurora::zstring_view label);
|
||||
void BuildIA8FromGCN(CInputStream& in, aurora::zstring_view label);
|
||||
void BuildC4FromGCN(CInputStream& in, aurora::zstring_view label);
|
||||
void BuildC8FromGCN(CInputStream& in, aurora::zstring_view label);
|
||||
void BuildC14X2FromGCN(CInputStream& in, aurora::zstring_view label);
|
||||
void BuildRGB565FromGCN(CInputStream& in, aurora::zstring_view label);
|
||||
void BuildRGB5A3FromGCN(CInputStream& in, aurora::zstring_view label);
|
||||
void BuildRGBA8FromGCN(CInputStream& in, aurora::zstring_view label);
|
||||
void BuildDXT1FromGCN(CInputStream& in, aurora::zstring_view label);
|
||||
void BuildRGBA8(const void* data, size_t length, aurora::zstring_view label);
|
||||
void BuildC8(const void* data, size_t length, aurora::zstring_view label);
|
||||
void BuildC8Font(const void* data, EFontType ftype, aurora::zstring_view label);
|
||||
void BuildDXT1(const void* data, size_t length, aurora::zstring_view label);
|
||||
void BuildDXT3(const void* data, size_t length, aurora::zstring_view label);
|
||||
|
||||
public:
|
||||
CTexture(ETexelFormat, s16, s16, s32);
|
||||
|
@ -70,11 +70,11 @@ public:
|
|||
u16 GetHeight() const { return x6_h; }
|
||||
u32 GetNumMips() const { return x8_mips; }
|
||||
void Load(int slot, EClampMode clamp) const;
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& GetTexture() const { return m_tex; }
|
||||
const aurora::gfx::TextureHandle& GetTexture() const { return m_tex; }
|
||||
// const boo::ObjToken<boo::ITexture>& GetBooTexture() const { return m_booTex; }
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& GetPaletteTexture() const { return m_paletteTex; }
|
||||
const aurora::gfx::TextureHandle& GetPaletteTexture() const { return m_paletteTex; }
|
||||
std::unique_ptr<u8[]> BuildMemoryCardTex(u32& sizeOut, ETexelFormat& fmtOut, std::unique_ptr<u8[]>& paletteOut) const;
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& GetFontTexture(EFontType tp);
|
||||
const aurora::gfx::TextureHandle& GetFontTexture(EFontType tp);
|
||||
|
||||
const CTextureInfo* GetTextureInfo() const { return m_textureInfo; }
|
||||
};
|
||||
|
|
|
@ -75,7 +75,7 @@ size_t CTexture::ComputeMippedBlockCountDXT1() const {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void CTexture::BuildI4FromGCN(CInputStream& in, std::string_view label) {
|
||||
void CTexture::BuildI4FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
|
@ -115,7 +115,7 @@ void CTexture::BuildI4FromGCN(CInputStream& in, std::string_view label) {
|
|||
{reinterpret_cast<const uint8_t*>(buf.get()), texelCount * 4}, label);
|
||||
}
|
||||
|
||||
void CTexture::BuildI8FromGCN(CInputStream& in, std::string_view label) {
|
||||
void CTexture::BuildI8FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
|
@ -155,7 +155,7 @@ void CTexture::BuildI8FromGCN(CInputStream& in, std::string_view label) {
|
|||
{reinterpret_cast<const uint8_t*>(buf.get()), texelCount * 4}, label);
|
||||
}
|
||||
|
||||
void CTexture::BuildIA4FromGCN(CInputStream& in, std::string_view label) {
|
||||
void CTexture::BuildIA4FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
|
@ -196,7 +196,7 @@ void CTexture::BuildIA4FromGCN(CInputStream& in, std::string_view label) {
|
|||
{reinterpret_cast<const uint8_t*>(buf.get()), texelCount * 4}, label);
|
||||
}
|
||||
|
||||
void CTexture::BuildIA8FromGCN(CInputStream& in, std::string_view label) {
|
||||
void CTexture::BuildIA8FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
|
@ -278,7 +278,7 @@ static std::vector<RGBA8> DecodePalette(int numEntries, CInputStream& in) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void CTexture::BuildC4FromGCN(CInputStream& in, std::string_view label) {
|
||||
void CTexture::BuildC4FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
std::vector<RGBA8> palette = DecodePalette(16, in);
|
||||
|
@ -316,7 +316,7 @@ void CTexture::BuildC4FromGCN(CInputStream& in, std::string_view label) {
|
|||
{reinterpret_cast<const uint8_t*>(buf.get()), texelCount * 4}, label);
|
||||
}
|
||||
|
||||
void CTexture::BuildC8FromGCN(CInputStream& in, std::string_view label) {
|
||||
void CTexture::BuildC8FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
std::vector<RGBA8> palette = DecodePalette(256, in);
|
||||
|
@ -354,11 +354,11 @@ void CTexture::BuildC8FromGCN(CInputStream& in, std::string_view label) {
|
|||
{reinterpret_cast<const uint8_t*>(buf.get()), texelCount * 4}, label);
|
||||
}
|
||||
|
||||
void CTexture::BuildC14X2FromGCN(CInputStream& in, std::string_view label) {
|
||||
void CTexture::BuildC14X2FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
Log.report(logvisor::Fatal, FMT_STRING("C14X2 not implemented"));
|
||||
}
|
||||
|
||||
void CTexture::BuildRGB565FromGCN(CInputStream& in, std::string_view label) {
|
||||
void CTexture::BuildRGB565FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
|
@ -397,7 +397,7 @@ void CTexture::BuildRGB565FromGCN(CInputStream& in, std::string_view label) {
|
|||
{reinterpret_cast<const uint8_t*>(buf.get()), texelCount * 4}, label);
|
||||
}
|
||||
|
||||
void CTexture::BuildRGB5A3FromGCN(CInputStream& in, std::string_view label) {
|
||||
void CTexture::BuildRGB5A3FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
|
@ -443,7 +443,7 @@ void CTexture::BuildRGB5A3FromGCN(CInputStream& in, std::string_view label) {
|
|||
{reinterpret_cast<const uint8_t*>(buf.get()), texelCount * 4}, label);
|
||||
}
|
||||
|
||||
void CTexture::BuildRGBA8FromGCN(CInputStream& in, std::string_view label) {
|
||||
void CTexture::BuildRGBA8FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
const size_t texelCount = ComputeMippedTexelCount();
|
||||
std::unique_ptr<RGBA8[]> buf(new RGBA8[texelCount]);
|
||||
|
||||
|
@ -488,7 +488,7 @@ void CTexture::BuildRGBA8FromGCN(CInputStream& in, std::string_view label) {
|
|||
{reinterpret_cast<const uint8_t*>(buf.get()), texelCount * 4}, label);
|
||||
}
|
||||
|
||||
void CTexture::BuildDXT1FromGCN(CInputStream& in, std::string_view label) {
|
||||
void CTexture::BuildDXT1FromGCN(CInputStream& in, aurora::zstring_view label) {
|
||||
const size_t blockCount = ComputeMippedBlockCountDXT1();
|
||||
std::unique_ptr<DXT1Block[]> buf(new DXT1Block[blockCount]);
|
||||
|
||||
|
@ -536,7 +536,7 @@ void CTexture::BuildDXT1FromGCN(CInputStream& in, std::string_view label) {
|
|||
{reinterpret_cast<const uint8_t*>(buf.get()), blockCount * 8}, label);
|
||||
}
|
||||
|
||||
void CTexture::BuildRGBA8(const void* data, size_t length, std::string_view label) {
|
||||
void CTexture::BuildRGBA8(const void* data, size_t length, aurora::zstring_view label) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
size_t expectedSize = texelCount * 4;
|
||||
if (expectedSize > length)
|
||||
|
@ -546,7 +546,7 @@ void CTexture::BuildRGBA8(const void* data, size_t length, std::string_view labe
|
|||
{reinterpret_cast<const uint8_t*>(data), expectedSize}, label);
|
||||
}
|
||||
|
||||
void CTexture::BuildC8(const void* data, size_t length, std::string_view label) {
|
||||
void CTexture::BuildC8(const void* data, size_t length, aurora::zstring_view label) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
if (texelCount > length)
|
||||
Log.report(logvisor::Fatal, FMT_STRING("insufficient TXTR length ({}/{})"), length, texelCount);
|
||||
|
@ -560,7 +560,7 @@ void CTexture::BuildC8(const void* data, size_t length, std::string_view label)
|
|||
label);
|
||||
}
|
||||
|
||||
void CTexture::BuildC8Font(const void* data, EFontType ftype, std::string_view label) {
|
||||
void CTexture::BuildC8Font(const void* data, EFontType ftype, aurora::zstring_view label) {
|
||||
size_t texelCount = ComputeMippedTexelCount();
|
||||
|
||||
size_t layerCount = 1;
|
||||
|
@ -659,12 +659,12 @@ void CTexture::BuildC8Font(const void* data, EFontType ftype, std::string_view l
|
|||
// } BooTrace);
|
||||
}
|
||||
|
||||
void CTexture::BuildDXT1(const void* data, size_t length, std::string_view label) {
|
||||
void CTexture::BuildDXT1(const void* data, size_t length, aurora::zstring_view label) {
|
||||
m_tex = aurora::gfx::new_static_texture_2d(x4_w, x6_h, x8_mips, aurora::gfx::TextureFormat::DXT1,
|
||||
{reinterpret_cast<const uint8_t*>(data), length}, label);
|
||||
}
|
||||
|
||||
void CTexture::BuildDXT3(const void* data, size_t length, std::string_view label) {
|
||||
void CTexture::BuildDXT3(const void* data, size_t length, aurora::zstring_view label) {
|
||||
m_tex = aurora::gfx::new_static_texture_2d(x4_w, x6_h, x8_mips, aurora::gfx::TextureFormat::DXT3,
|
||||
{reinterpret_cast<const uint8_t*>(data), length}, label);
|
||||
}
|
||||
|
@ -881,10 +881,10 @@ std::unique_ptr<u8[]> CTexture::BuildMemoryCardTex(u32& sizeOut, ETexelFormat& f
|
|||
return ret;
|
||||
}
|
||||
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& CTexture::GetFontTexture(EFontType tp) {
|
||||
const aurora::gfx::TextureHandle& CTexture::GetFontTexture(EFontType tp) {
|
||||
if (m_ftype != tp && x0_fmt == ETexelFormat::C8PC) {
|
||||
m_ftype = tp;
|
||||
BuildC8Font(m_otex.get() + 12, m_ftype, "Font (TODO)"sv);
|
||||
BuildC8Font(m_otex.get() + 12, m_ftype, "Font (TODO)");
|
||||
}
|
||||
return m_tex;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ void CColoredStripShader::Shutdown() {
|
|||
// stages.data(), nullptr, nullptr, texs.size(), texs.data(), nullptr, nullptr);
|
||||
//}
|
||||
|
||||
CColoredStripShader::CColoredStripShader(size_t maxVerts, Mode mode, std::shared_ptr<aurora::gfx::TextureHandle> tex) {
|
||||
CColoredStripShader::CColoredStripShader(size_t maxVerts, Mode mode, aurora::gfx::TextureHandle tex) {
|
||||
// CGraphics::CommitResources([this, maxVerts, mode, tex](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
// BuildResources(ctx, maxVerts, mode, tex);
|
||||
// return true;
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
};
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
CColoredStripShader(size_t maxVerts, Mode mode, std::shared_ptr<aurora::gfx::TextureHandle> tex);
|
||||
CColoredStripShader(size_t maxVerts, Mode mode, aurora::gfx::TextureHandle tex);
|
||||
void draw(const zeus::CColor& color, size_t numVerts, const Vert* verts);
|
||||
};
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ CFluidPlaneShader::CFluidPlaneShader(EFluidType type, const TLockedToken<CTextur
|
|||
const TLockedToken<CTexture>& patternTex2, const TLockedToken<CTexture>& colorTex,
|
||||
const TLockedToken<CTexture>& bumpMap, const TLockedToken<CTexture>& envMap,
|
||||
const TLockedToken<CTexture>& envBumpMap, const TLockedToken<CTexture>& lightmap,
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& rippleMap, bool doubleLightmapBlend,
|
||||
const aurora::gfx::TextureHandle& rippleMap, bool doubleLightmapBlend,
|
||||
bool additive, u32 maxVertCount)
|
||||
: m_patternTex1(patternTex1)
|
||||
, m_patternTex2(patternTex2)
|
||||
|
|
|
@ -106,7 +106,7 @@ private:
|
|||
TLockedToken<CTexture> m_envMap;
|
||||
TLockedToken<CTexture> m_envBumpMap;
|
||||
TLockedToken<CTexture> m_lightmap;
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_rippleMap;
|
||||
aurora::gfx::TextureHandle m_rippleMap;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_pvbo;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||
|
@ -145,7 +145,7 @@ public:
|
|||
const TLockedToken<CTexture>& patternTex2, const TLockedToken<CTexture>& colorTex,
|
||||
const TLockedToken<CTexture>& bumpMap, const TLockedToken<CTexture>& envMap,
|
||||
const TLockedToken<CTexture>& envBumpMap, const TLockedToken<CTexture>& lightmap,
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& rippleMap, bool doubleLightmapBlend, bool additive,
|
||||
const aurora::gfx::TextureHandle& rippleMap, bool doubleLightmapBlend, bool additive,
|
||||
u32 maxVertCount);
|
||||
CFluidPlaneShader(const TLockedToken<CTexture>& patternTex1, const TLockedToken<CTexture>& patternTex2,
|
||||
const TLockedToken<CTexture>& colorTex, u32 maxVertCount);
|
||||
|
|
|
@ -54,7 +54,7 @@ void CLineRendererShaders::Shutdown() {
|
|||
}
|
||||
|
||||
void CLineRendererShaders::BuildShaderDataBinding(CLineRenderer& renderer,
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& texture, bool additive,
|
||||
const aurora::gfx::TextureHandle& texture, bool additive,
|
||||
bool zTest, bool zGEqual) {
|
||||
// std::array<boo::ObjToken<boo::IShaderPipeline>, 2>* pipeline = nullptr;
|
||||
//
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
static void Initialize();
|
||||
static void Shutdown();
|
||||
static void BuildShaderDataBinding(CLineRenderer& renderer,
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& texture, bool additive, bool zTest,
|
||||
const aurora::gfx::TextureHandle& texture, bool additive, bool zTest,
|
||||
bool zGEqual);
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class CSpaceWarpFilter {
|
|||
zeus::CVector3f m_strength;
|
||||
};
|
||||
std::array<std::array<std::array<u8, 4>, 8>, 4> m_shiftTexture{};
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_warpTex;
|
||||
aurora::gfx::TextureHandle m_warpTex;
|
||||
// boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||
// boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||
|
|
|
@ -178,11 +178,11 @@ void CTexturedQuadFilterAlpha::Shutdown() {
|
|||
// }
|
||||
//}
|
||||
|
||||
CTexturedQuadFilter::CTexturedQuadFilter(const std::shared_ptr<aurora::gfx::TextureHandle>& tex) : m_booTex(tex) {
|
||||
CTexturedQuadFilter::CTexturedQuadFilter(const aurora::gfx::TextureHandle& tex) : m_booTex(tex) {
|
||||
m_flipRect = true; // TODO?
|
||||
}
|
||||
|
||||
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, const std::shared_ptr<aurora::gfx::TextureHandle>& tex, ERglEnum ztest)
|
||||
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, const aurora::gfx::TextureHandle& tex, ERglEnum ztest)
|
||||
: m_booTex(tex), m_zTest(ztest) {
|
||||
m_flipRect = true; // TODO?
|
||||
// tex->setClampMode(boo::TextureClampMode::ClampToEdge);
|
||||
|
@ -201,7 +201,7 @@ CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, const std::shared_ptr
|
|||
}
|
||||
|
||||
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, TLockedToken<CTexture> tex, ERglEnum ztest)
|
||||
: CTexturedQuadFilter(type, (tex ? tex->GetTexture() : nullptr), ztest) {
|
||||
: CTexturedQuadFilter(type, (tex ? tex->GetTexture() : aurora::gfx::TextureHandle{}), ztest) {
|
||||
m_flipRect = true; // TODO?
|
||||
m_tex = tex;
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ void CTexturedQuadFilter::DrawFilter(EFilterShape shape, const zeus::CColor& col
|
|||
}
|
||||
}
|
||||
|
||||
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, const std::shared_ptr<aurora::gfx::TextureHandle>& tex)
|
||||
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, const aurora::gfx::TextureHandle& tex)
|
||||
: CTexturedQuadFilter(tex) {
|
||||
// CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
// m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 4);
|
||||
|
@ -339,7 +339,7 @@ CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, const std::
|
|||
}
|
||||
|
||||
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, TLockedToken<CTexture> tex)
|
||||
: CTexturedQuadFilterAlpha(type, (tex ? tex->GetTexture() : nullptr)) {
|
||||
: CTexturedQuadFilterAlpha(type, (tex ? tex->GetTexture() : aurora::gfx::TextureHandle{})) {
|
||||
m_tex = tex;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ protected:
|
|||
float m_lod = 0.f;
|
||||
};
|
||||
TLockedToken<CTexture> m_tex;
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_booTex;
|
||||
aurora::gfx::TextureHandle m_booTex;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_vbo;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||
// boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||
|
@ -34,7 +34,7 @@ protected:
|
|||
ERglEnum m_zTest;
|
||||
bool m_flipRect = false;
|
||||
|
||||
explicit CTexturedQuadFilter(const std::shared_ptr<aurora::gfx::TextureHandle>& tex);
|
||||
explicit CTexturedQuadFilter(const aurora::gfx::TextureHandle& tex);
|
||||
|
||||
public:
|
||||
struct Vert {
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
static void Shutdown();
|
||||
static constexpr zeus::CRectangle DefaultRect{0.f, 0.f, 1.f, 1.f};
|
||||
explicit CTexturedQuadFilter(EFilterType type, TLockedToken<CTexture> tex, ERglEnum zTest = ERglEnum::Never);
|
||||
explicit CTexturedQuadFilter(EFilterType type, const std::shared_ptr<aurora::gfx::TextureHandle>& tex,
|
||||
explicit CTexturedQuadFilter(EFilterType type, const aurora::gfx::TextureHandle& tex,
|
||||
ERglEnum zTest = ERglEnum::Never);
|
||||
CTexturedQuadFilter(const CTexturedQuadFilter&) = delete;
|
||||
CTexturedQuadFilter& operator=(const CTexturedQuadFilter&) = delete;
|
||||
|
@ -56,7 +56,7 @@ public:
|
|||
void drawVerts(const zeus::CColor& color, std::array<Vert, 4> verts, float lod = 0.f);
|
||||
void DrawFilter(EFilterShape shape, const zeus::CColor& color, float t);
|
||||
const TLockedToken<CTexture>& GetTex() const { return m_tex; }
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& GetBooTex() const { return m_booTex; }
|
||||
const aurora::gfx::TextureHandle& GetBooTex() const { return m_booTex; }
|
||||
};
|
||||
|
||||
class CTexturedQuadFilterAlpha : public CTexturedQuadFilter {
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
static void Initialize();
|
||||
static void Shutdown();
|
||||
explicit CTexturedQuadFilterAlpha(EFilterType type, TLockedToken<CTexture> tex);
|
||||
explicit CTexturedQuadFilterAlpha(EFilterType type, const std::shared_ptr<aurora::gfx::TextureHandle>& tex);
|
||||
explicit CTexturedQuadFilterAlpha(EFilterType type, const aurora::gfx::TextureHandle& tex);
|
||||
};
|
||||
|
||||
} // namespace metaforce
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace metaforce {
|
||||
|
||||
class CWorldShadowShader {
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_tex;
|
||||
aurora::gfx::TextureHandle m_tex;
|
||||
std::optional<CTexturedQuadFilter> m_prevQuad;
|
||||
u32 m_w, m_h;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public:
|
|||
u32 GetWidth() const { return m_w; }
|
||||
u32 GetHeight() const { return m_h; }
|
||||
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& GetTexture() const { return m_tex; }
|
||||
const aurora::gfx::TextureHandle& GetTexture() const { return m_tex; }
|
||||
};
|
||||
|
||||
} // namespace metaforce
|
||||
|
|
|
@ -15,7 +15,7 @@ class CXRayBlurFilter {
|
|||
std::array<zeus::CMatrix4f, 8> m_uv;
|
||||
};
|
||||
TLockedToken<CTexture> m_paletteTex;
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_booTex;
|
||||
aurora::gfx::TextureHandle m_booTex;
|
||||
// boo::ObjToken<boo::IGraphicsBufferS> m_vbo;
|
||||
// boo::ObjToken<boo::IGraphicsBufferD> m_uniBuf;
|
||||
// boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
|
||||
|
|
|
@ -83,17 +83,17 @@ void CAuiImagePane::DoDrawImagePane(const zeus::CColor& color, const CTexture& t
|
|||
|
||||
bool zTest = xac_drawFlags == EGuiModelDrawFlags::Shadeless || xac_drawFlags == EGuiModelDrawFlags::Opaque;
|
||||
if (noBlur) {
|
||||
aurora::gfx::queue_textured_quad_verts(aurora::gfx::CameraFilterType(filter), tex.GetTexture()->ref,
|
||||
aurora::gfx::queue_textured_quad_verts(aurora::gfx::CameraFilterType(filter), tex.GetTexture(),
|
||||
aurora::gfx::ZTest::LEqual, zTest, useColor, xe0_coords, realUseUvs, 0);
|
||||
// quad.drawVerts(useColor, verts);
|
||||
} else if ((x14c_deResFactor == 0.f && alpha == 1.f) || tex.GetNumMips() == 1) {
|
||||
aurora::gfx::queue_textured_quad_verts(aurora::gfx::CameraFilterType(filter), tex.GetTexture()->ref,
|
||||
aurora::gfx::queue_textured_quad_verts(aurora::gfx::CameraFilterType(filter), tex.GetTexture(),
|
||||
aurora::gfx::ZTest::LEqual, zTest, useColor, xe0_coords, realUseUvs, 0);
|
||||
} else {
|
||||
const float tmp = (1.f - x14c_deResFactor) * alpha;
|
||||
const float tmp3 = 1.f - tmp * tmp * tmp;
|
||||
const float mip = tmp3 * static_cast<float>(tex.GetNumMips() - 1);
|
||||
aurora::gfx::queue_textured_quad_verts(aurora::gfx::CameraFilterType(filter), tex.GetTexture()->ref,
|
||||
aurora::gfx::queue_textured_quad_verts(aurora::gfx::CameraFilterType(filter), tex.GetTexture(),
|
||||
aurora::gfx::ZTest::LEqual, zTest, useColor, xe0_coords, realUseUvs, mip);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,9 +72,9 @@ CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr)
|
|||
CCompoundTargetReticle::SScanReticuleRenderer::SScanReticuleRenderer() {
|
||||
// CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx) {
|
||||
for (size_t i = 0; i < m_lineRenderers.size(); ++i) {
|
||||
m_lineRenderers[i].emplace(CLineRenderer::EPrimitiveMode::Lines, 8, nullptr, true, true);
|
||||
m_lineRenderers[i].emplace(CLineRenderer::EPrimitiveMode::Lines, 8, aurora::gfx::TextureHandle{}, true, true);
|
||||
for (auto& stripRenderer : m_stripRenderers[i]) {
|
||||
stripRenderer.emplace(CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true, true);
|
||||
stripRenderer.emplace(CLineRenderer::EPrimitiveMode::LineStrip, 4, aurora::gfx::TextureHandle{}, true, true);
|
||||
}
|
||||
}
|
||||
// return true;
|
||||
|
|
|
@ -148,7 +148,7 @@ public:
|
|||
const char16_t* str, int len) const;
|
||||
const CGlyph* GetGlyph(char16_t chr) const { return InternalGetGlyph(chr); }
|
||||
void GetSize(const CDrawStringOptions& opts, int& width, int& height, const char16_t* str, int len) const;
|
||||
const std::shared_ptr<aurora::gfx::TextureHandle>& GetTexture() { return x80_texture->GetFontTexture(x2c_mode); }
|
||||
const aurora::gfx::TextureHandle& GetTexture() { return x80_texture->GetFontTexture(x2c_mode); }
|
||||
|
||||
bool IsFinishedLoading() const;
|
||||
};
|
||||
|
|
|
@ -75,7 +75,7 @@ void CSplashScreen::Draw() {
|
|||
|
||||
aurora::gfx::queue_textured_quad(
|
||||
aurora::gfx::CameraFilterType::Blend,
|
||||
m_texture->GetTexture()->ref,
|
||||
m_texture->GetTexture(),
|
||||
aurora::gfx::ZTest::Always,
|
||||
false,
|
||||
color,
|
||||
|
|
|
@ -2045,7 +2045,7 @@ void CFrontEndUI::Draw() {
|
|||
x38_pressStart->GetHeight() / 480.f * vPad);
|
||||
zeus::CColor color = zeus::skWhite;
|
||||
color.a() = x64_pressStartAlpha;
|
||||
aurora::gfx::queue_textured_quad(aurora::gfx::CameraFilterType::Add, x38_pressStart->GetTexture()->ref,
|
||||
aurora::gfx::queue_textured_quad(aurora::gfx::CameraFilterType::Add, x38_pressStart->GetTexture(),
|
||||
aurora::gfx::ZTest::Always, false, color, 1.f, rect, 0.f);
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ CElementGen::CElementGen(TToken<CGenDescription> gen, EModelOrientationType orie
|
|||
|
||||
if (x26c_31_LINE) {
|
||||
CUVElement* texr = desc->x54_x40_TEXR.get();
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> tex;
|
||||
aurora::gfx::TextureHandle tex;
|
||||
if (texr)
|
||||
tex = texr->GetValueTexture(0).GetObj()->GetTexture();
|
||||
int maxVerts = x90_MAXP;
|
||||
|
|
|
@ -98,8 +98,8 @@ void CParticleElectric::DrawLineStrip(const std::vector<zeus::CVector3f>& verts,
|
|||
m_lineRenderers.resize(m_nextLineRenderer);
|
||||
}
|
||||
if (!m_lineRenderers[useIdx]) {
|
||||
m_lineRenderers[useIdx] =
|
||||
std::make_unique<CLineRenderer>(CLineRenderer::EPrimitiveMode::LineStrip, x150_SSEG, nullptr, true, true);
|
||||
m_lineRenderers[useIdx] = std::make_unique<CLineRenderer>(CLineRenderer::EPrimitiveMode::LineStrip, x150_SSEG,
|
||||
aurora::gfx::TextureHandle{}, true, true);
|
||||
}
|
||||
CLineRenderer& renderer = *m_lineRenderers[useIdx];
|
||||
const zeus::CColor useColor = x1b8_moduColor * color;
|
||||
|
|
|
@ -67,7 +67,7 @@ CParticleSwoosh::CParticleSwoosh(const TToken<CSwooshDescription>& desc, int len
|
|||
if (x1c_desc->x44_29_WIRE) {
|
||||
const int maxVerts = x1b4_LENG * (x1b0_SPLN + 1) * x1b8_SIDE * 12;
|
||||
m_lineRenderer.reset(
|
||||
new CLineRenderer(CLineRenderer::EPrimitiveMode::Lines, maxVerts * 2, nullptr, x1d0_25_AALP));
|
||||
new CLineRenderer(CLineRenderer::EPrimitiveMode::Lines, maxVerts * 2, {}, x1d0_25_AALP));
|
||||
} else {
|
||||
const auto maxVerts = size_t(x1b4_LENG * (x1b0_SPLN + 1) * x1b8_SIDE * 4);
|
||||
m_cachedVerts.reserve(maxVerts);
|
||||
|
|
|
@ -12,17 +12,16 @@
|
|||
|
||||
namespace metaforce {
|
||||
|
||||
CPlasmaProjectile::RenderObjects::RenderObjects(std::shared_ptr<aurora::gfx::TextureHandle> tex,
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> glowTex)
|
||||
CPlasmaProjectile::RenderObjects::RenderObjects(aurora::gfx::TextureHandle tex, aurora::gfx::TextureHandle glowTex)
|
||||
: m_beamStrip1(8, CColoredStripShader::Mode::Additive, {})
|
||||
, m_beamStrip2( 10, CColoredStripShader::Mode::FullAdditive, tex)
|
||||
, m_beamStrip3( 18, CColoredStripShader::Mode::FullAdditive, tex)
|
||||
, m_beamStrip4( 14, CColoredStripShader::Mode::Additive, glowTex)
|
||||
, m_beamStrip1Sub( 8, CColoredStripShader::Mode::Subtractive, {})
|
||||
, m_beamStrip2Sub( 10, CColoredStripShader::Mode::Subtractive, tex)
|
||||
, m_beamStrip3Sub( 18, CColoredStripShader::Mode::Subtractive, tex)
|
||||
, m_beamStrip4Sub( 14, CColoredStripShader::Mode::Subtractive, glowTex)
|
||||
, m_motionBlurStrip( 16, CColoredStripShader::Mode::Alpha, {}) {}
|
||||
, m_beamStrip2(10, CColoredStripShader::Mode::FullAdditive, tex)
|
||||
, m_beamStrip3(18, CColoredStripShader::Mode::FullAdditive, tex)
|
||||
, m_beamStrip4(14, CColoredStripShader::Mode::Additive, glowTex)
|
||||
, m_beamStrip1Sub(8, CColoredStripShader::Mode::Subtractive, {})
|
||||
, m_beamStrip2Sub(10, CColoredStripShader::Mode::Subtractive, tex)
|
||||
, m_beamStrip3Sub(18, CColoredStripShader::Mode::Subtractive, tex)
|
||||
, m_beamStrip4Sub(14, CColoredStripShader::Mode::Subtractive, glowTex)
|
||||
, m_motionBlurStrip(16, CColoredStripShader::Mode::Alpha, {}) {}
|
||||
|
||||
CPlasmaProjectile::CPlasmaProjectile(const TToken<CWeaponDescription>& wDesc, std::string_view name, EWeaponType wType,
|
||||
const CBeamInfo& bInfo, const zeus::CTransform& xf, EMaterialTypes matType,
|
||||
|
|
|
@ -91,8 +91,7 @@ private:
|
|||
CColoredStripShader m_beamStrip3Sub;
|
||||
CColoredStripShader m_beamStrip4Sub;
|
||||
CColoredStripShader m_motionBlurStrip;
|
||||
RenderObjects(std::shared_ptr<aurora::gfx::TextureHandle> tex,
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> glowTex);
|
||||
RenderObjects(aurora::gfx::TextureHandle tex, aurora::gfx::TextureHandle glowTex);
|
||||
};
|
||||
std::optional<RenderObjects> m_renderObjs;
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@ CWaveBuster::CWaveBuster(const TToken<CWeaponDescription>& desc, EWeaponType typ
|
|||
, x360_busterSwoosh2(g_SimplePool->GetObj("BusterSwoosh2"))
|
||||
, x36c_busterSparks(g_SimplePool->GetObj("BusterSparks"))
|
||||
, x378_busterLight(g_SimplePool->GetObj("BusterLight"))
|
||||
, m_lineRenderer1(CLineRenderer::EPrimitiveMode::LineStrip, 36 * 6, nullptr, true)
|
||||
, m_lineRenderer2(CLineRenderer::EPrimitiveMode::LineStrip, 36 * 6, nullptr, true) {
|
||||
, m_lineRenderer1(CLineRenderer::EPrimitiveMode::LineStrip, 36 * 6, {}, true)
|
||||
, m_lineRenderer2(CLineRenderer::EPrimitiveMode::LineStrip, 36 * 6, {}, true) {
|
||||
x354_busterSwoosh1.GetObj();
|
||||
x360_busterSwoosh2.GetObj();
|
||||
x36c_busterSparks.GetObj();
|
||||
|
@ -302,7 +302,7 @@ CRayCastResult CWaveBuster::SeekDamageTarget(TUniqueId& uid, const zeus::CVector
|
|||
uid = physId;
|
||||
return physRes;
|
||||
}
|
||||
|
||||
|
||||
if (actRes.IsValid() && ApplyDamageToTarget(physId, actRes, physRes, res, mgr, dt)) {
|
||||
uid = actId;
|
||||
return actRes;
|
||||
|
|
|
@ -75,7 +75,7 @@ protected:
|
|||
bool xe7_30_doTargetDistanceTest : 1 = true;
|
||||
bool xe7_31_targetable : 1 = true;
|
||||
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> m_reflectionCube;
|
||||
aurora::gfx::TextureHandle m_reflectionCube;
|
||||
zeus::CColor m_debugAddColor = zeus::skClear;
|
||||
float m_debugAddColorTime = 0.f;
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ CFluidPlaneShader::RenderSetupInfo CFluidPlaneCPU::RenderSetup(const CStateManag
|
|||
m_cachedAdditive = mgr.GetThermalDrawFlag() == EThermalDrawFlag::Hot;
|
||||
m_shader.emplace(x44_fluidType, x10_texPattern1, x20_texPattern2, x30_texColor, xb0_bumpMap, xc0_envMap,
|
||||
xd0_envBumpMap, xe0_lightmap,
|
||||
m_tessellation ? CFluidPlaneManager::RippleMapTex : std::shared_ptr<aurora::gfx::TextureHandle>{},
|
||||
m_tessellation ? CFluidPlaneManager::RippleMapTex : aurora::gfx::TextureHandle{},
|
||||
m_cachedDoubleLightmapBlend, m_cachedAdditive, m_maxVertCount);
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ static bool g_RippleMapSetup = false;
|
|||
std::array<std::array<u8, 64>, 64> CFluidPlaneManager::RippleValues{};
|
||||
std::array<u8, 64> CFluidPlaneManager::RippleMins{};
|
||||
std::array<u8, 64> CFluidPlaneManager::RippleMaxs{};
|
||||
std::shared_ptr<aurora::gfx::TextureHandle> CFluidPlaneManager::RippleMapTex;
|
||||
aurora::gfx::TextureHandle CFluidPlaneManager::RippleMapTex;
|
||||
|
||||
void CFluidPlaneManager::SetupRippleMap() {
|
||||
if (g_RippleMapSetup) {
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
static std::array<std::array<u8, 64>, 64> RippleValues;
|
||||
static std::array<u8, 64> RippleMins;
|
||||
static std::array<u8, 64> RippleMaxs;
|
||||
static std::shared_ptr<aurora::gfx::TextureHandle> RippleMapTex;
|
||||
static aurora::gfx::TextureHandle RippleMapTex;
|
||||
|
||||
CFluidPlaneManager();
|
||||
void StartFrame(bool);
|
||||
|
|
|
@ -14,13 +14,16 @@ add_library(aurora STATIC
|
|||
lib/imgui.cpp
|
||||
lib/dawn/BackendBinding.cpp
|
||||
lib/gfx/common.cpp
|
||||
lib/gfx/texture.cpp
|
||||
lib/gfx/movie_player/shader.cpp
|
||||
# TODO move to imgui? or move imgui impl to here?
|
||||
../extern/imgui/backends/imgui_impl_sdl.cpp
|
||||
../extern/imgui/backends/imgui_impl_wgpu.cpp
|
||||
)
|
||||
target_compile_definitions(aurora PRIVATE IMGUI_USER_CONFIG="imconfig_user.h") # IMGUI_USE_WCHAR32
|
||||
target_include_directories(aurora PUBLIC include ../Runtime)
|
||||
target_include_directories(aurora PRIVATE ../imgui ../extern/imgui)
|
||||
target_link_libraries(aurora PRIVATE dawn_native dawncpp webgpu_dawn zeus logvisor SDL2-static)
|
||||
target_link_libraries(aurora PRIVATE dawn_native dawncpp webgpu_dawn zeus logvisor SDL2-static xxhash)
|
||||
if (APPLE)
|
||||
target_compile_definitions(aurora PRIVATE DAWN_ENABLE_BACKEND_METAL)
|
||||
target_sources(aurora PRIVATE lib/dawn/MetalBinding.mm)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "common.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
#include <zeus/CAABox.hpp>
|
||||
#include <zeus/CColor.hpp>
|
||||
|
@ -39,16 +40,13 @@ struct CFogState {
|
|||
} // namespace metaforce
|
||||
|
||||
namespace aurora::gfx {
|
||||
struct TextureRef {
|
||||
uint32_t id;
|
||||
bool render;
|
||||
};
|
||||
struct TextureRef;
|
||||
struct TextureHandle {
|
||||
TextureRef ref;
|
||||
explicit TextureHandle(TextureRef ref) : ref(ref) {}
|
||||
~TextureHandle() noexcept;
|
||||
TextureHandle(const TextureHandle&) = delete;
|
||||
TextureHandle& operator=(const TextureHandle&) = delete;
|
||||
std::shared_ptr<TextureRef> ref;
|
||||
TextureHandle() = default;
|
||||
TextureHandle(std::shared_ptr<TextureRef>&& ref) : ref(std::move(ref)) {}
|
||||
operator bool() const { return ref.operator bool(); }
|
||||
void reset() { ref.reset(); }
|
||||
};
|
||||
enum class TextureFormat : uint8_t {
|
||||
RGBA8,
|
||||
|
@ -106,24 +104,23 @@ void add_model(/* TODO */) noexcept;
|
|||
void queue_aabb(const zeus::CAABox& aabb, const zeus::CColor& color, bool z_only) noexcept;
|
||||
void queue_fog_volume_plane(const ArrayRef<zeus::CVector4f>& verts, uint8_t pass);
|
||||
void queue_fog_volume_filter(const zeus::CColor& color, bool two_way) noexcept;
|
||||
void queue_textured_quad_verts(CameraFilterType filter_type, TextureRef texture, ZTest z_comparison, bool z_test,
|
||||
const zeus::CColor& color, const ArrayRef<zeus::CVector3f>& pos,
|
||||
void queue_textured_quad_verts(CameraFilterType filter_type, const TextureHandle& texture, ZTest z_comparison,
|
||||
bool z_test, const zeus::CColor& color, const ArrayRef<zeus::CVector3f>& pos,
|
||||
const ArrayRef<zeus::CVector2f>& uvs, float lod) noexcept;
|
||||
void queue_textured_quad(CameraFilterType filter_type, TextureRef texture, ZTest z_comparison, bool z_test,
|
||||
void queue_textured_quad(CameraFilterType filter_type, const TextureHandle& texture, ZTest z_comparison, bool z_test,
|
||||
const zeus::CColor& color, float uv_scale, const zeus::CRectangle& rect, float z) noexcept;
|
||||
void queue_colored_quad_verts(CameraFilterType filter_type, ZTest z_comparison, bool z_test, const zeus::CColor& color,
|
||||
const ArrayRef<zeus::CVector3f>& pos) noexcept;
|
||||
void queue_colored_quad(CameraFilterType filter_type, ZTest z_comparison, bool z_test, const zeus::CColor& color,
|
||||
const zeus::CRectangle& rect, float z) noexcept;
|
||||
void queue_movie_player(TextureRef tex_y, TextureRef tex_u, TextureRef tex_v, const zeus::CColor& color, float h_pad,
|
||||
float v_pad) noexcept;
|
||||
void queue_movie_player(const TextureHandle& tex_y, const TextureHandle& tex_u, const TextureHandle& tex_v,
|
||||
const zeus::CColor& color, float h_pad, float v_pad) noexcept;
|
||||
|
||||
std::shared_ptr<TextureHandle> new_static_texture_2d(uint32_t width, uint32_t height, uint32_t mips,
|
||||
TextureFormat format, ArrayRef<uint8_t> data,
|
||||
std::string_view label) noexcept;
|
||||
std::shared_ptr<TextureHandle> new_dynamic_texture_2d(uint32_t width, uint32_t height, uint32_t mips,
|
||||
TextureFormat format, std::string_view label) noexcept;
|
||||
std::shared_ptr<TextureHandle> new_render_texture(uint32_t width, uint32_t height, uint32_t color_bind_count,
|
||||
uint32_t depth_bind_count, std::string_view label) noexcept;
|
||||
void write_texture(TextureRef ref, ArrayRef<uint8_t> data) noexcept;
|
||||
TextureHandle new_static_texture_2d(uint32_t width, uint32_t height, uint32_t mips, TextureFormat format,
|
||||
ArrayRef<uint8_t> data, zstring_view label) noexcept;
|
||||
TextureHandle new_dynamic_texture_2d(uint32_t width, uint32_t height, uint32_t mips, TextureFormat format,
|
||||
zstring_view label) noexcept;
|
||||
TextureHandle new_render_texture(uint32_t width, uint32_t height, uint32_t color_bind_count, uint32_t depth_bind_count,
|
||||
zstring_view label) noexcept;
|
||||
void write_texture(const TextureHandle& handle, ArrayRef<uint8_t> data) noexcept;
|
||||
} // namespace aurora::gfx
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <SDL.h>
|
||||
#include <dawn/native/DawnNative.h>
|
||||
// TODO HACK: dawn doesn't expose device toggles
|
||||
#include "../extern/dawn/src/dawn/native/Toggles.h"
|
||||
#include <dawn/webgpu_cpp.h>
|
||||
#include <logvisor/logvisor.hpp>
|
||||
#include <magic_enum.hpp>
|
||||
|
@ -25,6 +27,14 @@
|
|||
#include <backends/imgui_impl_sdl.h>
|
||||
#include <backends/imgui_impl_wgpu.h>
|
||||
|
||||
// TODO HACK: dawn doesn't expose device toggles
|
||||
namespace dawn::native {
|
||||
class DeviceBase {
|
||||
public:
|
||||
void SetToggle(Toggle toggle, bool isEnabled);
|
||||
};
|
||||
} // namespace dawn::native
|
||||
|
||||
namespace aurora {
|
||||
// TODO: Move global state to a class/struct?
|
||||
static logvisor::Module Log("aurora");
|
||||
|
@ -184,13 +194,7 @@ static bool poll_events() noexcept {
|
|||
Log.report(logvisor::Info, FMT_STRING("Received quit request"));
|
||||
return false;
|
||||
}
|
||||
// TODO why doesn't this work?
|
||||
// const auto typedEvent = magic_enum::enum_cast<SDL_EventType>(event.type);
|
||||
// if (typedEvent) {
|
||||
// Log.report(logvisor::Info, FMT_STRING("Received SDL event: {}"), magic_enum::enum_name(typedEvent.value()));
|
||||
// } else {
|
||||
// Log.report(logvisor::Info, FMT_STRING("Received SDL event: {}"), event.type);
|
||||
// }
|
||||
// Log.report(logvisor::Info, FMT_STRING("Received SDL event: {}"), event.type);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -252,7 +256,20 @@ void app_run(std::unique_ptr<AppDelegate> app, Icon icon, int argc, char** argv)
|
|||
const auto backendName = magic_enum::enum_name(g_AdapterProperties.backendType);
|
||||
Log.report(logvisor::Info, FMT_STRING("Using {} graphics backend"), backendName);
|
||||
|
||||
g_Device = wgpu::Device::Acquire(g_Adapter.CreateDevice());
|
||||
{
|
||||
const std::array<wgpu::FeatureName, 1> requiredFeatures{
|
||||
wgpu::FeatureName::TextureCompressionBC,
|
||||
};
|
||||
const auto deviceDescriptor = wgpu::DeviceDescriptor{
|
||||
.requiredFeaturesCount = requiredFeatures.size(),
|
||||
.requiredFeatures = requiredFeatures.data(),
|
||||
};
|
||||
g_Device = wgpu::Device::Acquire(g_Adapter.CreateDevice(&deviceDescriptor));
|
||||
// TODO HACK: dawn doesn't expose device toggles
|
||||
static_cast<dawn::native::DeviceBase*>(static_cast<void*>(g_Device.Get()))
|
||||
->SetToggle(dawn::native::Toggle::UseUserDefinedLabelsInBackend, true);
|
||||
}
|
||||
|
||||
g_BackendBinding = std::unique_ptr<utils::BackendBinding>(
|
||||
utils::CreateBinding(g_AdapterProperties.backendType, g_Window, g_Device.Get()));
|
||||
if (!g_BackendBinding) {
|
||||
|
@ -268,6 +285,7 @@ void app_run(std::unique_ptr<AppDelegate> app, Icon icon, int argc, char** argv)
|
|||
{
|
||||
auto size = get_window_size();
|
||||
auto format = static_cast<wgpu::TextureFormat>(g_BackendBinding->GetPreferredSwapChainTextureFormat());
|
||||
Log.report(logvisor::Info, FMT_STRING("Using swapchain format {}"), magic_enum::enum_name(format));
|
||||
g_SwapChain.Configure(format, wgpu::TextureUsage::RenderAttachment, size.width, size.height);
|
||||
}
|
||||
|
||||
|
@ -283,7 +301,6 @@ void app_run(std::unique_ptr<AppDelegate> app, Icon icon, int argc, char** argv)
|
|||
g_AppDelegate->onAppLaunched();
|
||||
g_AppDelegate->onAppWindowResized(get_window_size());
|
||||
|
||||
bool showDemo = true;
|
||||
while (poll_events()) {
|
||||
ImGui_ImplWGPU_NewFrame();
|
||||
ImGui_ImplSDL2_NewFrame();
|
||||
|
@ -293,9 +310,6 @@ void app_run(std::unique_ptr<AppDelegate> app, Icon icon, int argc, char** argv)
|
|||
|
||||
const wgpu::TextureView view = g_SwapChain.GetCurrentTextureView();
|
||||
g_AppDelegate->onAppDraw();
|
||||
if (showDemo) {
|
||||
ImGui::ShowDemoWindow(&showDemo);
|
||||
}
|
||||
ImGui::Render();
|
||||
|
||||
auto encoder = g_Device.CreateCommandEncoder();
|
||||
|
|
|
@ -1,24 +1,65 @@
|
|||
#include <aurora/gfx.hpp>
|
||||
#include "common.hpp"
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
|
||||
#include "movie_player/shader.hpp"
|
||||
|
||||
namespace aurora::gfx {
|
||||
bool get_dxt_compression_supported() noexcept {
|
||||
return true; // TODO
|
||||
}
|
||||
struct ShaderDrawCommand {
|
||||
ShaderType type;
|
||||
union {
|
||||
movie_player::DrawData moviePlayer;
|
||||
};
|
||||
};
|
||||
struct PipelineCreateCommand {
|
||||
ShaderType type;
|
||||
union {
|
||||
movie_player::PipelineConfig moviePlayer;
|
||||
};
|
||||
};
|
||||
enum class CommandType {
|
||||
SetViewport,
|
||||
SetScissor,
|
||||
Draw,
|
||||
};
|
||||
struct Command {
|
||||
CommandType type;
|
||||
union Data {
|
||||
struct SetViewportCommand {
|
||||
zeus::CRectangle rect;
|
||||
float znear;
|
||||
float zfar;
|
||||
} setViewport;
|
||||
struct SetScissorCommand {
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t w;
|
||||
uint32_t h;
|
||||
} setScissor;
|
||||
ShaderDrawCommand draw;
|
||||
} data;
|
||||
};
|
||||
|
||||
zeus::CMatrix4f g_mv;
|
||||
zeus::CMatrix4f g_mvInv;
|
||||
zeus::CMatrix4f g_proj;
|
||||
metaforce::CFogState g_fogState;
|
||||
|
||||
std::vector<Command> g_commands;
|
||||
|
||||
bool get_dxt_compression_supported() noexcept { return g_Device.HasFeature(wgpu::FeatureName::TextureCompressionBC); }
|
||||
|
||||
void update_model_view(const zeus::CMatrix4f& mv, const zeus::CMatrix4f& mv_inv) noexcept {
|
||||
// TODO
|
||||
}
|
||||
void update_projection(const zeus::CMatrix4f& proj) noexcept {
|
||||
// TODO
|
||||
}
|
||||
void update_fog_state(const metaforce::CFogState& state) noexcept {
|
||||
// TODO
|
||||
g_mv = mv;
|
||||
g_mvInv = mv_inv;
|
||||
}
|
||||
void update_projection(const zeus::CMatrix4f& proj) noexcept { g_proj = proj; }
|
||||
void update_fog_state(const metaforce::CFogState& state) noexcept { g_fogState = state; }
|
||||
void set_viewport(const zeus::CRectangle& rect, float znear, float zfar) noexcept {
|
||||
// TODO
|
||||
g_commands.push_back({CommandType::SetViewport, {.setViewport = {rect, znear, zfar}}});
|
||||
}
|
||||
void set_scissor(uint32_t x, uint32_t y, uint32_t w, uint32_t h) noexcept {
|
||||
// TODO
|
||||
g_commands.push_back({CommandType::SetScissor, {.setScissor = {x, y, w, h}}});
|
||||
}
|
||||
|
||||
void resolve_color(const ClipRect& rect, uint32_t bind, bool clear_depth) noexcept {
|
||||
|
@ -40,12 +81,12 @@ void queue_fog_volume_plane(const ArrayRef<zeus::CVector4f>& verts, uint8_t pass
|
|||
void queue_fog_volume_filter(const zeus::CColor& color, bool two_way) noexcept {
|
||||
// TODO
|
||||
}
|
||||
void queue_textured_quad_verts(CameraFilterType filter_type, TextureRef texture, ZTest z_comparison, bool z_test,
|
||||
const zeus::CColor& color, const ArrayRef<zeus::CVector3f>& pos,
|
||||
void queue_textured_quad_verts(CameraFilterType filter_type, const TextureHandle& texture, ZTest z_comparison,
|
||||
bool z_test, const zeus::CColor& color, const ArrayRef<zeus::CVector3f>& pos,
|
||||
const ArrayRef<zeus::CVector2f>& uvs, float lod) noexcept {
|
||||
// TODO
|
||||
}
|
||||
void queue_textured_quad(CameraFilterType filter_type, TextureRef texture, ZTest z_comparison, bool z_test,
|
||||
void queue_textured_quad(CameraFilterType filter_type, const TextureHandle& texture, ZTest z_comparison, bool z_test,
|
||||
const zeus::CColor& color, float uv_scale, const zeus::CRectangle& rect, float z) noexcept {
|
||||
// TODO
|
||||
}
|
||||
|
@ -57,25 +98,8 @@ void queue_colored_quad(CameraFilterType filter_type, ZTest z_comparison, bool z
|
|||
const zeus::CRectangle& rect, float z) noexcept {
|
||||
// TODO
|
||||
}
|
||||
void queue_movie_player(TextureRef tex_y, TextureRef tex_u, TextureRef tex_v, const zeus::CColor& color, float h_pad,
|
||||
float v_pad) noexcept {
|
||||
// TODO
|
||||
}
|
||||
|
||||
std::shared_ptr<TextureHandle> new_static_texture_2d(uint32_t width, uint32_t height, uint32_t mips,
|
||||
TextureFormat format, ArrayRef<uint8_t> data,
|
||||
std::string_view label) noexcept {
|
||||
return {}; // TODO
|
||||
}
|
||||
std::shared_ptr<TextureHandle> new_dynamic_texture_2d(uint32_t width, uint32_t height, uint32_t mips,
|
||||
TextureFormat format, std::string_view label) noexcept {
|
||||
return {}; // TODO
|
||||
}
|
||||
std::shared_ptr<TextureHandle> new_render_texture(uint32_t width, uint32_t height, uint32_t color_bind_count,
|
||||
uint32_t depth_bind_count, std::string_view label) noexcept {
|
||||
return {}; // TODO
|
||||
}
|
||||
void write_texture(TextureRef ref, ArrayRef<uint8_t> data) noexcept {
|
||||
void queue_movie_player(const TextureHandle& tex_y, const TextureHandle& tex_u, const TextureHandle& tex_v,
|
||||
const zeus::CColor& color, float h_pad, float v_pad) noexcept {
|
||||
// TODO
|
||||
}
|
||||
} // namespace aurora::gfx
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
#pragma once
|
||||
#include <aurora/gfx.hpp>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <dawn/webgpu_cpp.h>
|
||||
#include <xxhash.h>
|
||||
#if defined(__x86_64__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64)
|
||||
#include <xxh_x86dispatch.h>
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
XXH64_hash_t xxh3_hash(const T& input, XXH64_hash_t seed = 0) {
|
||||
return XXH3_64bits_withSeed(&input, sizeof(T), seed);
|
||||
}
|
||||
|
||||
namespace aurora {
|
||||
extern wgpu::Device g_Device;
|
||||
extern wgpu::Queue g_Queue;
|
||||
} // namespace aurora
|
||||
|
||||
namespace aurora::gfx {
|
||||
static logvisor::Module Log("aurora::gfx");
|
||||
|
||||
extern zeus::CMatrix4f g_mv;
|
||||
extern zeus::CMatrix4f g_mvInv;
|
||||
extern zeus::CMatrix4f g_proj;
|
||||
extern metaforce::CFogState g_fogState;
|
||||
|
||||
struct TextureRef {
|
||||
wgpu::Texture texture;
|
||||
wgpu::TextureView view;
|
||||
wgpu::Extent3D size;
|
||||
wgpu::TextureFormat format;
|
||||
|
||||
TextureRef(wgpu::Texture&& texture, wgpu::TextureView&& view, wgpu::Extent3D size, wgpu::TextureFormat format)
|
||||
: texture(std::move(texture)), view(std::move(view)), size(size), format(format) {}
|
||||
};
|
||||
|
||||
using PipelineRef = uint64_t;
|
||||
using Range = std::pair<uint64_t, uint64_t>;
|
||||
|
||||
enum class ShaderType {
|
||||
Aabb,
|
||||
TexturedQuad,
|
||||
MoviePlayer,
|
||||
};
|
||||
} // namespace aurora::gfx
|
|
@ -0,0 +1,29 @@
|
|||
#include "../common.hpp"
|
||||
|
||||
namespace aurora::gfx::movie_player {
|
||||
struct DrawData {
|
||||
PipelineRef pipeline;
|
||||
Range vertRange;
|
||||
Range uniformRange;
|
||||
uint64_t bindGroupId;
|
||||
};
|
||||
|
||||
struct PipelineConfig {
|
||||
// nothing
|
||||
};
|
||||
const std::array INITIAL_PIPELINES{
|
||||
PipelineConfig{},
|
||||
};
|
||||
|
||||
struct State {
|
||||
wgpu::ShaderModule shader;
|
||||
wgpu::BindGroupLayout uniformLayout;
|
||||
wgpu::BindGroup uniformBindGroup;
|
||||
wgpu::BindGroupLayout textureLayout;
|
||||
wgpu::Sampler sampler;
|
||||
wgpu::PipelineLayout pipelineLayout;
|
||||
// Transient state
|
||||
std::unordered_map<uint64_t, wgpu::BindGroup> textureBindGroups;
|
||||
std::vector<uint64_t> frameUsedTextures;
|
||||
};
|
||||
} // namespace aurora::gfx::movie_player
|
|
@ -0,0 +1,42 @@
|
|||
struct Uniform {
|
||||
xf: mat4x4<f32>;
|
||||
color: vec4<f32>;
|
||||
};
|
||||
@group(0) @binding(0)
|
||||
var<uniform> ubuf: Uniform;
|
||||
@group(0) @binding(1)
|
||||
var tex_sampler: sampler;
|
||||
@group(1) @binding(0)
|
||||
var tex_y: texture_2d<f32>;
|
||||
@group(1) @binding(1)
|
||||
var tex_u: texture_2d<f32>;
|
||||
@group(1) @binding(2)
|
||||
var tex_v: texture_2d<f32>;
|
||||
|
||||
struct VertexOutput {
|
||||
@builtin(position) pos: vec4<f32>;
|
||||
@location(0) uv: vec2<f32>;
|
||||
};
|
||||
|
||||
@stage(vertex)
|
||||
fn vs_main(@location(0) in_pos: vec3<f32>, @location(1) in_uv: vec2<f32>) -> VertexOutput {
|
||||
var out: VertexOutput;
|
||||
out.pos = ubuf.xf * vec4<f32>(in_pos, 1.0);
|
||||
out.uv = in_uv;
|
||||
return out;
|
||||
}
|
||||
|
||||
@stage(fragment)
|
||||
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
var yuv = vec3<f32>(
|
||||
1.1643 * (textureSample(tex_y, tex_sampler, in.uv).x - 0.0625),
|
||||
textureSample(tex_u, tex_sampler, in.uv).x - 0.5,
|
||||
textureSample(tex_v, tex_sampler, in.uv).x - 0.5
|
||||
);
|
||||
return ubuf.color * vec4<f32>(
|
||||
yuv.x + 1.5958 * yuv.z,
|
||||
yuv.x - 0.39173 * yuv.y - 0.8129 * yuv.z,
|
||||
yuv.x + 2.017 * yuv.y,
|
||||
1.0
|
||||
);
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
#include "common.hpp"
|
||||
|
||||
#include <magic_enum.hpp>
|
||||
|
||||
namespace aurora::gfx {
|
||||
static wgpu::TextureFormat to_wgpu(TextureFormat format) {
|
||||
switch (format) {
|
||||
case TextureFormat::RGBA8:
|
||||
return wgpu::TextureFormat::RGBA8Unorm;
|
||||
case TextureFormat::R8:
|
||||
return wgpu::TextureFormat::R8Unorm;
|
||||
case TextureFormat::R32Float:
|
||||
return wgpu::TextureFormat::R32Float;
|
||||
case TextureFormat::DXT1:
|
||||
return wgpu::TextureFormat::BC1RGBAUnorm;
|
||||
case TextureFormat::DXT3:
|
||||
return wgpu::TextureFormat::BC3RGBAUnorm;
|
||||
case TextureFormat::DXT5:
|
||||
return wgpu::TextureFormat::BC5RGUnorm;
|
||||
case TextureFormat::BPTC:
|
||||
return wgpu::TextureFormat::BC7RGBAUnorm;
|
||||
}
|
||||
}
|
||||
struct TextureFormatInfo {
|
||||
uint8_t blockWidth;
|
||||
uint8_t blockHeight;
|
||||
uint8_t blockSize;
|
||||
bool compressed;
|
||||
};
|
||||
static TextureFormatInfo format_info(wgpu::TextureFormat format) {
|
||||
switch (format) {
|
||||
case wgpu::TextureFormat::R8Unorm:
|
||||
return {1, 1, 1, false};
|
||||
case wgpu::TextureFormat::RGBA8Unorm:
|
||||
case wgpu::TextureFormat::R32Float:
|
||||
return {1, 1, 4, false};
|
||||
case wgpu::TextureFormat::BC1RGBAUnorm:
|
||||
return {4, 4, 8, true};
|
||||
default:
|
||||
Log.report(logvisor::Fatal, FMT_STRING("format_info: unimplemented format {}"), magic_enum::enum_name(format));
|
||||
return {0, 0, 0, false};
|
||||
}
|
||||
}
|
||||
static wgpu::Extent3D physical_size(wgpu::Extent3D size, TextureFormatInfo info) {
|
||||
const uint32_t width = ((size.width + info.blockWidth - 1) / info.blockWidth) * info.blockWidth;
|
||||
const uint32_t height = ((size.height + info.blockHeight - 1) / info.blockHeight) * info.blockHeight;
|
||||
return {width, height, size.depthOrArrayLayers};
|
||||
}
|
||||
|
||||
TextureHandle new_static_texture_2d(uint32_t width, uint32_t height, uint32_t mips, TextureFormat format,
|
||||
ArrayRef<uint8_t> data, zstring_view label) noexcept {
|
||||
auto handle = new_dynamic_texture_2d(width, height, mips, format, label);
|
||||
const TextureRef& ref = *handle.ref;
|
||||
uint32_t offset = 0;
|
||||
for (uint32_t mip = 0; mip < mips; ++mip) {
|
||||
const auto mipSize = wgpu::Extent3D{
|
||||
.width = std::max(ref.size.width >> mip, 1u),
|
||||
.height = std::max(ref.size.height >> mip, 1u),
|
||||
.depthOrArrayLayers = ref.size.depthOrArrayLayers,
|
||||
};
|
||||
const auto info = format_info(ref.format);
|
||||
const auto physicalSize = physical_size(mipSize, info);
|
||||
const uint32_t widthBlocks = physicalSize.width / info.blockWidth;
|
||||
const uint32_t heightBlocks = physicalSize.height / info.blockHeight;
|
||||
const uint32_t bytesPerRow = widthBlocks * info.blockSize;
|
||||
const uint32_t dataSize = bytesPerRow * heightBlocks * mipSize.depthOrArrayLayers;
|
||||
if (offset + dataSize > data.size()) {
|
||||
Log.report(logvisor::Fatal, FMT_STRING("new_static_texture_2d[{}]: expected at least {} bytes, got {}"), label,
|
||||
offset + dataSize, data.size());
|
||||
return {};
|
||||
}
|
||||
const auto dstView = wgpu::ImageCopyTexture{
|
||||
.texture = ref.texture,
|
||||
.mipLevel = mip,
|
||||
};
|
||||
const auto dataLayout = wgpu::TextureDataLayout{
|
||||
.bytesPerRow = bytesPerRow,
|
||||
.rowsPerImage = heightBlocks,
|
||||
};
|
||||
g_Queue.WriteTexture(&dstView, data.data() + offset, dataSize, &dataLayout, &physicalSize);
|
||||
offset += dataSize;
|
||||
}
|
||||
if (offset < data.size()) {
|
||||
Log.report(logvisor::Warning, FMT_STRING("new_static_texture_2d[{}]: texture used {} bytes, but given {} bytes"),
|
||||
label, offset, data.size());
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
|
||||
TextureHandle new_dynamic_texture_2d(uint32_t width, uint32_t height, uint32_t mips, TextureFormat format,
|
||||
zstring_view label) noexcept {
|
||||
const auto wgpuFormat = to_wgpu(format);
|
||||
const auto size = wgpu::Extent3D{
|
||||
.width = width,
|
||||
.height = height,
|
||||
};
|
||||
const auto textureDescriptor = wgpu::TextureDescriptor{
|
||||
.label = label.c_str(),
|
||||
.usage = wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopyDst,
|
||||
.size = size,
|
||||
.format = wgpuFormat,
|
||||
.mipLevelCount = mips,
|
||||
};
|
||||
const auto viewLabel = fmt::format(FMT_STRING("{} view"), label);
|
||||
const auto textureViewDescriptor = wgpu::TextureViewDescriptor{
|
||||
.label = viewLabel.c_str(),
|
||||
.format = wgpuFormat,
|
||||
.dimension = wgpu::TextureViewDimension::e2D,
|
||||
.mipLevelCount = mips,
|
||||
};
|
||||
auto texture = g_Device.CreateTexture(&textureDescriptor);
|
||||
auto textureView = texture.CreateView(&textureViewDescriptor);
|
||||
return {std::make_shared<TextureRef>(std::move(texture), std::move(textureView), size, wgpuFormat)};
|
||||
}
|
||||
|
||||
TextureHandle new_render_texture(uint32_t width, uint32_t height, uint32_t color_bind_count, uint32_t depth_bind_count,
|
||||
zstring_view label) noexcept {
|
||||
return {}; // TODO
|
||||
}
|
||||
|
||||
// TODO accept mip/layer parameters
|
||||
void write_texture(const TextureHandle& handle, ArrayRef<uint8_t> data) noexcept {
|
||||
const TextureRef& ref = *handle.ref;
|
||||
const auto dstView = wgpu::ImageCopyTexture{
|
||||
.texture = ref.texture,
|
||||
};
|
||||
if (ref.size.depthOrArrayLayers != 1) {
|
||||
Log.report(logvisor::Fatal, FMT_STRING("write_texture: unsupported depth {}"), ref.size.depthOrArrayLayers);
|
||||
return;
|
||||
}
|
||||
const auto info = format_info(ref.format);
|
||||
const auto physicalSize = physical_size(ref.size, info);
|
||||
const uint32_t widthBlocks = physicalSize.width / info.blockWidth;
|
||||
const uint32_t heightBlocks = physicalSize.height / info.blockHeight;
|
||||
const uint32_t bytesPerRow = widthBlocks * info.blockSize;
|
||||
const uint32_t dataSize = bytesPerRow * heightBlocks * ref.size.depthOrArrayLayers;
|
||||
if (dataSize > data.size()) {
|
||||
Log.report(logvisor::Fatal, FMT_STRING("write_texture: expected at least {} bytes, got {}"), dataSize, data.size());
|
||||
return;
|
||||
}
|
||||
const auto dataLayout = wgpu::TextureDataLayout{
|
||||
.bytesPerRow = bytesPerRow,
|
||||
.rowsPerImage = heightBlocks,
|
||||
};
|
||||
g_Queue.WriteTexture(&dstView, data.data(), dataSize, &dataLayout, &ref.size);
|
||||
}
|
||||
} // namespace aurora::gfx
|
|
@ -1 +1 @@
|
|||
Subproject commit 693500c055a5c328dbf3de90c94033f8ca497bb3
|
||||
Subproject commit e458d1999cb613c5dc221c9805c81cf7e8a24fb6
|
|
@ -0,0 +1,6 @@
|
|||
add_library(xxhash xxhash.c)
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64")
|
||||
target_sources(xxhash PRIVATE xxh_x86dispatch.c)
|
||||
endif ()
|
||||
target_include_directories(xxhash PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_compile_definitions(xxhash INTERFACE XXH_STATIC_LINKING_ONLY)
|
|
@ -0,0 +1,26 @@
|
|||
xxHash Library
|
||||
Copyright (c) 2012-2021 Yann Collet
|
||||
All rights reserved.
|
||||
|
||||
BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,770 @@
|
|||
/*
|
||||
* xxHash - Extremely Fast Hash algorithm
|
||||
* Copyright (C) 2020-2021 Yann Collet
|
||||
*
|
||||
* BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* You can contact the author at:
|
||||
* - xxHash homepage: https://www.xxhash.com
|
||||
* - xxHash source repository: https://github.com/Cyan4973/xxHash
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
* @file xxh_x86dispatch.c
|
||||
*
|
||||
* Automatic dispatcher code for the @ref XXH3_family on x86-based targets.
|
||||
*
|
||||
* Optional add-on.
|
||||
*
|
||||
* **Compile this file with the default flags for your target.** Do not compile
|
||||
* with flags like `-mavx*`, `-march=native`, or `/arch:AVX*`, there will be
|
||||
* an error. See @ref XXH_X86DISPATCH_ALLOW_AVX for details.
|
||||
*
|
||||
* @defgroup dispatch x86 Dispatcher
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !(defined(__x86_64__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64))
|
||||
# error "Dispatching is currently only supported on x86 and x86_64."
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @def XXH_X86DISPATCH_ALLOW_AVX
|
||||
* @brief Disables the AVX sanity check.
|
||||
*
|
||||
* Don't compile xxh_x86dispatch.c with options like `-mavx*`, `-march=native`,
|
||||
* or `/arch:AVX*`. It is intended to be compiled for the minimum target, and
|
||||
* it selectively enables SSE2, AVX2, and AVX512 when it is needed.
|
||||
*
|
||||
* Using this option _globally_ allows this feature, and therefore makes it
|
||||
* undefined behavior to execute on any CPU without said feature.
|
||||
*
|
||||
* Even if the source code isn't directly using AVX intrinsics in a function,
|
||||
* the compiler can still generate AVX code from autovectorization and by
|
||||
* "upgrading" SSE2 intrinsics to use the VEX prefixes (a.k.a. AVX128).
|
||||
*
|
||||
* Use the same flags that you use to compile the rest of the program; this
|
||||
* file will safely generate SSE2, AVX2, and AVX512 without these flags.
|
||||
*
|
||||
* Define XXH_X86DISPATCH_ALLOW_AVX to ignore this check, and feel free to open
|
||||
* an issue if there is a target in the future where AVX is a default feature.
|
||||
*/
|
||||
#ifdef XXH_DOXYGEN
|
||||
# define XXH_X86DISPATCH_ALLOW_AVX
|
||||
#endif
|
||||
|
||||
#if defined(__AVX__) && !defined(XXH_X86DISPATCH_ALLOW_AVX)
|
||||
# error "Do not compile xxh_x86dispatch.c with AVX enabled! See the comment above."
|
||||
#endif
|
||||
|
||||
#ifdef __has_include
|
||||
# define XXH_HAS_INCLUDE(header) __has_include(header)
|
||||
#else
|
||||
# define XXH_HAS_INCLUDE(header) 0
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @def XXH_DISPATCH_SCALAR
|
||||
* @brief Enables/dispatching the scalar code path.
|
||||
*
|
||||
* If this is defined to 0, SSE2 support is assumed. This reduces code size
|
||||
* when the scalar path is not needed.
|
||||
*
|
||||
* This is automatically defined to 0 when...
|
||||
* - SSE2 support is enabled in the compiler
|
||||
* - Targeting x86_64
|
||||
* - Targeting Android x86
|
||||
* - Targeting macOS
|
||||
*/
|
||||
#ifndef XXH_DISPATCH_SCALAR
|
||||
# if defined(__SSE2__) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2) /* SSE2 on by default */ \
|
||||
|| defined(__x86_64__) || defined(_M_X64) /* x86_64 */ \
|
||||
|| defined(__ANDROID__) || defined(__APPLEv__) /* Android or macOS */
|
||||
# define XXH_DISPATCH_SCALAR 0 /* disable */
|
||||
# else
|
||||
# define XXH_DISPATCH_SCALAR 1
|
||||
# endif
|
||||
#endif
|
||||
/*!
|
||||
* @def XXH_DISPATCH_AVX2
|
||||
* @brief Enables/disables dispatching for AVX2.
|
||||
*
|
||||
* This is automatically detected if it is not defined.
|
||||
* - GCC 4.7 and later are known to support AVX2, but >4.9 is required for
|
||||
* to get the AVX2 intrinsics and typedefs without -mavx -mavx2.
|
||||
* - Visual Studio 2013 Update 2 and later are known to support AVX2.
|
||||
* - The GCC/Clang internal header `<avx2intrin.h>` is detected. While this is
|
||||
* not allowed to be included directly, it still appears in the builtin
|
||||
* include path and is detectable with `__has_include`.
|
||||
*
|
||||
* @see XXH_AVX2
|
||||
*/
|
||||
#ifndef XXH_DISPATCH_AVX2
|
||||
# if (defined(__GNUC__) && (__GNUC__ > 4)) /* GCC 5.0+ */ \
|
||||
|| (defined(_MSC_VER) && _MSC_VER >= 1900) /* VS 2015+ */ \
|
||||
|| (defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 180030501) /* VS 2013 Update 2 */ \
|
||||
|| XXH_HAS_INCLUDE(<avx2intrin.h>) /* GCC/Clang internal header */
|
||||
# define XXH_DISPATCH_AVX2 1 /* enable dispatch towards AVX2 */
|
||||
# else
|
||||
# define XXH_DISPATCH_AVX2 0
|
||||
# endif
|
||||
#endif /* XXH_DISPATCH_AVX2 */
|
||||
|
||||
/*!
|
||||
* @def XXH_DISPATCH_AVX512
|
||||
* @brief Enables/disables dispatching for AVX512.
|
||||
*
|
||||
* Automatically detected if one of the following conditions is met:
|
||||
* - GCC 4.9 and later are known to support AVX512.
|
||||
* - Visual Studio 2017 and later are known to support AVX2.
|
||||
* - The GCC/Clang internal header `<avx512fintrin.h>` is detected. While this
|
||||
* is not allowed to be included directly, it still appears in the builtin
|
||||
* include path and is detectable with `__has_include`.
|
||||
*
|
||||
* @see XXH_AVX512
|
||||
*/
|
||||
#ifndef XXH_DISPATCH_AVX512
|
||||
# if (defined(__GNUC__) \
|
||||
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9))) /* GCC 4.9+ */ \
|
||||
|| (defined(_MSC_VER) && _MSC_VER >= 1910) /* VS 2017+ */ \
|
||||
|| XXH_HAS_INCLUDE(<avx512fintrin.h>) /* GCC/Clang internal header */
|
||||
# define XXH_DISPATCH_AVX512 1 /* enable dispatch towards AVX512 */
|
||||
# else
|
||||
# define XXH_DISPATCH_AVX512 0
|
||||
# endif
|
||||
#endif /* XXH_DISPATCH_AVX512 */
|
||||
|
||||
/*!
|
||||
* @def XXH_TARGET_SSE2
|
||||
* @brief Allows a function to be compiled with SSE2 intrinsics.
|
||||
*
|
||||
* Uses `__attribute__((__target__("sse2")))` on GCC to allow SSE2 to be used
|
||||
* even with `-mno-sse2`.
|
||||
*
|
||||
* @def XXH_TARGET_AVX2
|
||||
* @brief Like @ref XXH_TARGET_SSE2, but for AVX2.
|
||||
*
|
||||
* @def XXH_TARGET_AVX512
|
||||
* @brief Like @ref XXH_TARGET_SSE2, but for AVX512.
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
# include <emmintrin.h> /* SSE2 */
|
||||
# if XXH_DISPATCH_AVX2 || XXH_DISPATCH_AVX512
|
||||
# include <immintrin.h> /* AVX2, AVX512F */
|
||||
# endif
|
||||
# define XXH_TARGET_SSE2 __attribute__((__target__("sse2")))
|
||||
# define XXH_TARGET_AVX2 __attribute__((__target__("avx2")))
|
||||
# define XXH_TARGET_AVX512 __attribute__((__target__("avx512f")))
|
||||
#elif defined(_MSC_VER)
|
||||
# include <intrin.h>
|
||||
# define XXH_TARGET_SSE2
|
||||
# define XXH_TARGET_AVX2
|
||||
# define XXH_TARGET_AVX512
|
||||
#else
|
||||
# error "Dispatching is currently not supported for your compiler."
|
||||
#endif
|
||||
|
||||
#ifdef XXH_DISPATCH_DEBUG
|
||||
/* debug logging */
|
||||
# include <stdio.h>
|
||||
# define XXH_debugPrint(str) { fprintf(stderr, "DEBUG: xxHash dispatch: %s \n", str); fflush(NULL); }
|
||||
#else
|
||||
# define XXH_debugPrint(str) ((void)0)
|
||||
# undef NDEBUG /* avoid redefinition */
|
||||
# define NDEBUG
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#define XXH_INLINE_ALL
|
||||
#define XXH_X86DISPATCH
|
||||
#include "xxhash.h"
|
||||
|
||||
/*
|
||||
* Support both AT&T and Intel dialects
|
||||
*
|
||||
* GCC doesn't convert AT&T syntax to Intel syntax, and will error out if
|
||||
* compiled with -masm=intel. Instead, it supports dialect switching with
|
||||
* curly braces: { AT&T syntax | Intel syntax }
|
||||
*
|
||||
* Clang's integrated assembler automatically converts AT&T syntax to Intel if
|
||||
* needed, making the dialect switching useless (it isn't even supported).
|
||||
*
|
||||
* Note: Comments are written in the inline assembly itself.
|
||||
*/
|
||||
#ifdef __clang__
|
||||
# define XXH_I_ATT(intel, att) att "\n\t"
|
||||
#else
|
||||
# define XXH_I_ATT(intel, att) "{" att "|" intel "}\n\t"
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @internal
|
||||
* @brief Runs CPUID.
|
||||
*
|
||||
* @param eax , ecx The parameters to pass to CPUID, %eax and %ecx respectively.
|
||||
* @param abcd The array to store the result in, `{ eax, ebx, ecx, edx }`
|
||||
*/
|
||||
static void XXH_cpuid(xxh_u32 eax, xxh_u32 ecx, xxh_u32* abcd)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
__cpuidex(abcd, eax, ecx);
|
||||
#else
|
||||
xxh_u32 ebx, edx;
|
||||
# if defined(__i386__) && defined(__PIC__)
|
||||
__asm__(
|
||||
"# Call CPUID\n\t"
|
||||
"#\n\t"
|
||||
"# On 32-bit x86 with PIC enabled, we are not allowed to overwrite\n\t"
|
||||
"# EBX, so we use EDI instead.\n\t"
|
||||
XXH_I_ATT("mov edi, ebx", "movl %%ebx, %%edi")
|
||||
XXH_I_ATT("cpuid", "cpuid" )
|
||||
XXH_I_ATT("xchg edi, ebx", "xchgl %%ebx, %%edi")
|
||||
: "=D" (ebx),
|
||||
# else
|
||||
__asm__(
|
||||
"# Call CPUID\n\t"
|
||||
XXH_I_ATT("cpuid", "cpuid")
|
||||
: "=b" (ebx),
|
||||
# endif
|
||||
"+a" (eax), "+c" (ecx), "=d" (edx));
|
||||
abcd[0] = eax;
|
||||
abcd[1] = ebx;
|
||||
abcd[2] = ecx;
|
||||
abcd[3] = edx;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Modified version of Intel's guide
|
||||
* https://software.intel.com/en-us/articles/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family
|
||||
*/
|
||||
|
||||
#if XXH_DISPATCH_AVX2 || XXH_DISPATCH_AVX512
|
||||
/*!
|
||||
* @internal
|
||||
* @brief Runs `XGETBV`.
|
||||
*
|
||||
* While the CPU may support AVX2, the operating system might not properly save
|
||||
* the full YMM/ZMM registers.
|
||||
*
|
||||
* xgetbv is used for detecting this: Any compliant operating system will define
|
||||
* a set of flags in the xcr0 register indicating how it saves the AVX registers.
|
||||
*
|
||||
* You can manually disable this flag on Windows by running, as admin:
|
||||
*
|
||||
* bcdedit.exe /set xsavedisable 1
|
||||
*
|
||||
* and rebooting. Run the same command with 0 to re-enable it.
|
||||
*/
|
||||
static xxh_u64 XXH_xgetbv(void)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
return _xgetbv(0); /* min VS2010 SP1 compiler is required */
|
||||
#else
|
||||
xxh_u32 xcr0_lo, xcr0_hi;
|
||||
__asm__(
|
||||
"# Call XGETBV\n\t"
|
||||
"#\n\t"
|
||||
"# Older assemblers (e.g. macOS's ancient GAS version) don't support\n\t"
|
||||
"# the XGETBV opcode, so we encode it by hand instead.\n\t"
|
||||
"# See <https://github.com/asmjit/asmjit/issues/78> for details.\n\t"
|
||||
".byte 0x0f, 0x01, 0xd0\n\t"
|
||||
: "=a" (xcr0_lo), "=d" (xcr0_hi) : "c" (0));
|
||||
return xcr0_lo | ((xxh_u64)xcr0_hi << 32);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#define XXH_SSE2_CPUID_MASK (1 << 26)
|
||||
#define XXH_OSXSAVE_CPUID_MASK ((1 << 26) | (1 << 27))
|
||||
#define XXH_AVX2_CPUID_MASK (1 << 5)
|
||||
#define XXH_AVX2_XGETBV_MASK ((1 << 2) | (1 << 1))
|
||||
#define XXH_AVX512F_CPUID_MASK (1 << 16)
|
||||
#define XXH_AVX512F_XGETBV_MASK ((7 << 5) | (1 << 2) | (1 << 1))
|
||||
|
||||
/*!
|
||||
* @internal
|
||||
* @brief Returns the best XXH3 implementation.
|
||||
*
|
||||
* Runs various CPUID/XGETBV tests to try and determine the best implementation.
|
||||
*
|
||||
* @return The best @ref XXH_VECTOR implementation.
|
||||
* @see XXH_VECTOR_TYPES
|
||||
*/
|
||||
static int XXH_featureTest(void)
|
||||
{
|
||||
xxh_u32 abcd[4];
|
||||
xxh_u32 max_leaves;
|
||||
int best = XXH_SCALAR;
|
||||
#if XXH_DISPATCH_AVX2 || XXH_DISPATCH_AVX512
|
||||
xxh_u64 xgetbv_val;
|
||||
#endif
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
xxh_u32 cpuid_supported;
|
||||
__asm__(
|
||||
"# For the sake of ruthless backwards compatibility, check if CPUID\n\t"
|
||||
"# is supported in the EFLAGS on i386.\n\t"
|
||||
"# This is not necessary on x86_64 - CPUID is mandatory.\n\t"
|
||||
"# The ID flag (bit 21) in the EFLAGS register indicates support\n\t"
|
||||
"# for the CPUID instruction. If a software procedure can set and\n\t"
|
||||
"# clear this flag, the processor executing the procedure supports\n\t"
|
||||
"# the CPUID instruction.\n\t"
|
||||
"# <https://c9x.me/x86/html/file_module_x86_id_45.html>\n\t"
|
||||
"#\n\t"
|
||||
"# Routine is from <https://wiki.osdev.org/CPUID>.\n\t"
|
||||
|
||||
"# Save EFLAGS\n\t"
|
||||
XXH_I_ATT("pushfd", "pushfl" )
|
||||
"# Store EFLAGS\n\t"
|
||||
XXH_I_ATT("pushfd", "pushfl" )
|
||||
"# Invert the ID bit in stored EFLAGS\n\t"
|
||||
XXH_I_ATT("xor dword ptr[esp], 0x200000", "xorl $0x200000, (%%esp)")
|
||||
"# Load stored EFLAGS (with ID bit inverted)\n\t"
|
||||
XXH_I_ATT("popfd", "popfl" )
|
||||
"# Store EFLAGS again (ID bit may or not be inverted)\n\t"
|
||||
XXH_I_ATT("pushfd", "pushfl" )
|
||||
"# eax = modified EFLAGS (ID bit may or may not be inverted)\n\t"
|
||||
XXH_I_ATT("pop eax", "popl %%eax" )
|
||||
"# eax = whichever bits were changed\n\t"
|
||||
XXH_I_ATT("xor eax, dword ptr[esp]", "xorl (%%esp), %%eax" )
|
||||
"# Restore original EFLAGS\n\t"
|
||||
XXH_I_ATT("popfd", "popfl" )
|
||||
"# eax = zero if ID bit can't be changed, else non-zero\n\t"
|
||||
XXH_I_ATT("and eax, 0x200000", "andl $0x200000, %%eax" )
|
||||
: "=a" (cpuid_supported) :: "cc");
|
||||
|
||||
if (XXH_unlikely(!cpuid_supported)) {
|
||||
XXH_debugPrint("CPUID support is not detected!");
|
||||
return best;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Check how many CPUID pages we have */
|
||||
XXH_cpuid(0, 0, abcd);
|
||||
max_leaves = abcd[0];
|
||||
|
||||
/* Shouldn't happen on hardware, but happens on some QEMU configs. */
|
||||
if (XXH_unlikely(max_leaves == 0)) {
|
||||
XXH_debugPrint("Max CPUID leaves == 0!");
|
||||
return best;
|
||||
}
|
||||
|
||||
/* Check for SSE2, OSXSAVE and xgetbv */
|
||||
XXH_cpuid(1, 0, abcd);
|
||||
|
||||
/*
|
||||
* Test for SSE2. The check is redundant on x86_64, but it doesn't hurt.
|
||||
*/
|
||||
if (XXH_unlikely((abcd[3] & XXH_SSE2_CPUID_MASK) != XXH_SSE2_CPUID_MASK))
|
||||
return best;
|
||||
|
||||
XXH_debugPrint("SSE2 support detected.");
|
||||
|
||||
best = XXH_SSE2;
|
||||
#if XXH_DISPATCH_AVX2 || XXH_DISPATCH_AVX512
|
||||
/* Make sure we have enough leaves */
|
||||
if (XXH_unlikely(max_leaves < 7))
|
||||
return best;
|
||||
|
||||
/* Test for OSXSAVE and XGETBV */
|
||||
if ((abcd[2] & XXH_OSXSAVE_CPUID_MASK) != XXH_OSXSAVE_CPUID_MASK)
|
||||
return best;
|
||||
|
||||
/* CPUID check for AVX features */
|
||||
XXH_cpuid(7, 0, abcd);
|
||||
|
||||
xgetbv_val = XXH_xgetbv();
|
||||
#if XXH_DISPATCH_AVX2
|
||||
/* Validate that AVX2 is supported by the CPU */
|
||||
if ((abcd[1] & XXH_AVX2_CPUID_MASK) != XXH_AVX2_CPUID_MASK)
|
||||
return best;
|
||||
|
||||
/* Validate that the OS supports YMM registers */
|
||||
if ((xgetbv_val & XXH_AVX2_XGETBV_MASK) != XXH_AVX2_XGETBV_MASK) {
|
||||
XXH_debugPrint("AVX2 supported by the CPU, but not the OS.");
|
||||
return best;
|
||||
}
|
||||
|
||||
/* AVX2 supported */
|
||||
XXH_debugPrint("AVX2 support detected.");
|
||||
best = XXH_AVX2;
|
||||
#endif
|
||||
#if XXH_DISPATCH_AVX512
|
||||
/* Check if AVX512F is supported by the CPU */
|
||||
if ((abcd[1] & XXH_AVX512F_CPUID_MASK) != XXH_AVX512F_CPUID_MASK) {
|
||||
XXH_debugPrint("AVX512F not supported by CPU");
|
||||
return best;
|
||||
}
|
||||
|
||||
/* Validate that the OS supports ZMM registers */
|
||||
if ((xgetbv_val & XXH_AVX512F_XGETBV_MASK) != XXH_AVX512F_XGETBV_MASK) {
|
||||
XXH_debugPrint("AVX512F supported by the CPU, but not the OS.");
|
||||
return best;
|
||||
}
|
||||
|
||||
/* AVX512F supported */
|
||||
XXH_debugPrint("AVX512F support detected.");
|
||||
best = XXH_AVX512;
|
||||
#endif
|
||||
#endif
|
||||
return best;
|
||||
}
|
||||
|
||||
|
||||
/* === Vector implementations === */
|
||||
|
||||
/*!
|
||||
* @internal
|
||||
* @brief Defines the various dispatch functions.
|
||||
*
|
||||
* TODO: Consolidate?
|
||||
*
|
||||
* @param suffix The suffix for the functions, e.g. sse2 or scalar
|
||||
* @param target XXH_TARGET_* or empty.
|
||||
*/
|
||||
#define XXH_DEFINE_DISPATCH_FUNCS(suffix, target) \
|
||||
\
|
||||
/* === XXH3, default variants === */ \
|
||||
\
|
||||
XXH_NO_INLINE target XXH64_hash_t \
|
||||
XXHL64_default_##suffix(const void* XXH_RESTRICT input, size_t len) \
|
||||
{ \
|
||||
return XXH3_hashLong_64b_internal( \
|
||||
input, len, XXH3_kSecret, sizeof(XXH3_kSecret), \
|
||||
XXH3_accumulate_512_##suffix, XXH3_scrambleAcc_##suffix \
|
||||
); \
|
||||
} \
|
||||
\
|
||||
/* === XXH3, Seeded variants === */ \
|
||||
\
|
||||
XXH_NO_INLINE target XXH64_hash_t \
|
||||
XXHL64_seed_##suffix(const void* XXH_RESTRICT input, size_t len, \
|
||||
XXH64_hash_t seed) \
|
||||
{ \
|
||||
return XXH3_hashLong_64b_withSeed_internal( \
|
||||
input, len, seed, XXH3_accumulate_512_##suffix, \
|
||||
XXH3_scrambleAcc_##suffix, XXH3_initCustomSecret_##suffix \
|
||||
); \
|
||||
} \
|
||||
\
|
||||
/* === XXH3, Secret variants === */ \
|
||||
\
|
||||
XXH_NO_INLINE target XXH64_hash_t \
|
||||
XXHL64_secret_##suffix(const void* XXH_RESTRICT input, size_t len, \
|
||||
const void* secret, size_t secretLen) \
|
||||
{ \
|
||||
return XXH3_hashLong_64b_internal( \
|
||||
input, len, secret, secretLen, \
|
||||
XXH3_accumulate_512_##suffix, XXH3_scrambleAcc_##suffix \
|
||||
); \
|
||||
} \
|
||||
\
|
||||
/* === XXH3 update variants === */ \
|
||||
\
|
||||
XXH_NO_INLINE target XXH_errorcode \
|
||||
XXH3_update_##suffix(XXH3_state_t* state, const void* input, size_t len) \
|
||||
{ \
|
||||
return XXH3_update(state, (const xxh_u8*)input, len, \
|
||||
XXH3_accumulate_512_##suffix, XXH3_scrambleAcc_##suffix); \
|
||||
} \
|
||||
\
|
||||
/* === XXH128 default variants === */ \
|
||||
\
|
||||
XXH_NO_INLINE target XXH128_hash_t \
|
||||
XXHL128_default_##suffix(const void* XXH_RESTRICT input, size_t len) \
|
||||
{ \
|
||||
return XXH3_hashLong_128b_internal( \
|
||||
input, len, XXH3_kSecret, sizeof(XXH3_kSecret), \
|
||||
XXH3_accumulate_512_##suffix, XXH3_scrambleAcc_##suffix \
|
||||
); \
|
||||
} \
|
||||
\
|
||||
/* === XXH128 Secret variants === */ \
|
||||
\
|
||||
XXH_NO_INLINE target XXH128_hash_t \
|
||||
XXHL128_secret_##suffix(const void* XXH_RESTRICT input, size_t len, \
|
||||
const void* XXH_RESTRICT secret, size_t secretLen) \
|
||||
{ \
|
||||
return XXH3_hashLong_128b_internal( \
|
||||
input, len, (const xxh_u8*)secret, secretLen, \
|
||||
XXH3_accumulate_512_##suffix, XXH3_scrambleAcc_##suffix); \
|
||||
} \
|
||||
\
|
||||
/* === XXH128 Seeded variants === */ \
|
||||
\
|
||||
XXH_NO_INLINE target XXH128_hash_t \
|
||||
XXHL128_seed_##suffix(const void* XXH_RESTRICT input, size_t len, \
|
||||
XXH64_hash_t seed) \
|
||||
{ \
|
||||
return XXH3_hashLong_128b_withSeed_internal(input, len, seed, \
|
||||
XXH3_accumulate_512_##suffix, XXH3_scrambleAcc_##suffix, \
|
||||
XXH3_initCustomSecret_##suffix); \
|
||||
}
|
||||
|
||||
/* End XXH_DEFINE_DISPATCH_FUNCS */
|
||||
|
||||
#if XXH_DISPATCH_SCALAR
|
||||
XXH_DEFINE_DISPATCH_FUNCS(scalar, /* nothing */)
|
||||
#endif
|
||||
XXH_DEFINE_DISPATCH_FUNCS(sse2, XXH_TARGET_SSE2)
|
||||
#if XXH_DISPATCH_AVX2
|
||||
XXH_DEFINE_DISPATCH_FUNCS(avx2, XXH_TARGET_AVX2)
|
||||
#endif
|
||||
#if XXH_DISPATCH_AVX512
|
||||
XXH_DEFINE_DISPATCH_FUNCS(avx512, XXH_TARGET_AVX512)
|
||||
#endif
|
||||
#undef XXH_DEFINE_DISPATCH_FUNCS
|
||||
|
||||
/* ==== Dispatchers ==== */
|
||||
|
||||
typedef XXH64_hash_t (*XXH3_dispatchx86_hashLong64_default)(const void* XXH_RESTRICT, size_t);
|
||||
|
||||
typedef XXH64_hash_t (*XXH3_dispatchx86_hashLong64_withSeed)(const void* XXH_RESTRICT, size_t, XXH64_hash_t);
|
||||
|
||||
typedef XXH64_hash_t (*XXH3_dispatchx86_hashLong64_withSecret)(const void* XXH_RESTRICT, size_t, const void* XXH_RESTRICT, size_t);
|
||||
|
||||
typedef XXH_errorcode (*XXH3_dispatchx86_update)(XXH3_state_t*, const void*, size_t);
|
||||
|
||||
typedef struct {
|
||||
XXH3_dispatchx86_hashLong64_default hashLong64_default;
|
||||
XXH3_dispatchx86_hashLong64_withSeed hashLong64_seed;
|
||||
XXH3_dispatchx86_hashLong64_withSecret hashLong64_secret;
|
||||
XXH3_dispatchx86_update update;
|
||||
} XXH_dispatchFunctions_s;
|
||||
|
||||
#define XXH_NB_DISPATCHES 4
|
||||
|
||||
/*!
|
||||
* @internal
|
||||
* @brief Table of dispatchers for @ref XXH3_64bits().
|
||||
*
|
||||
* @pre The indices must match @ref XXH_VECTOR_TYPE.
|
||||
*/
|
||||
static const XXH_dispatchFunctions_s XXH_kDispatch[XXH_NB_DISPATCHES] = {
|
||||
#if XXH_DISPATCH_SCALAR
|
||||
/* Scalar */ { XXHL64_default_scalar, XXHL64_seed_scalar, XXHL64_secret_scalar, XXH3_update_scalar },
|
||||
#else
|
||||
/* Scalar */ { NULL, NULL, NULL, NULL },
|
||||
#endif
|
||||
/* SSE2 */ { XXHL64_default_sse2, XXHL64_seed_sse2, XXHL64_secret_sse2, XXH3_update_sse2 },
|
||||
#if XXH_DISPATCH_AVX2
|
||||
/* AVX2 */ { XXHL64_default_avx2, XXHL64_seed_avx2, XXHL64_secret_avx2, XXH3_update_avx2 },
|
||||
#else
|
||||
/* AVX2 */ { NULL, NULL, NULL, NULL },
|
||||
#endif
|
||||
#if XXH_DISPATCH_AVX512
|
||||
/* AVX512 */ { XXHL64_default_avx512, XXHL64_seed_avx512, XXHL64_secret_avx512, XXH3_update_avx512 }
|
||||
#else
|
||||
/* AVX512 */ { NULL, NULL, NULL, NULL }
|
||||
#endif
|
||||
};
|
||||
/*!
|
||||
* @internal
|
||||
* @brief The selected dispatch table for @ref XXH3_64bits().
|
||||
*/
|
||||
static XXH_dispatchFunctions_s XXH_g_dispatch = { NULL, NULL, NULL, NULL };
|
||||
|
||||
|
||||
typedef XXH128_hash_t (*XXH3_dispatchx86_hashLong128_default)(const void* XXH_RESTRICT, size_t);
|
||||
|
||||
typedef XXH128_hash_t (*XXH3_dispatchx86_hashLong128_withSeed)(const void* XXH_RESTRICT, size_t, XXH64_hash_t);
|
||||
|
||||
typedef XXH128_hash_t (*XXH3_dispatchx86_hashLong128_withSecret)(const void* XXH_RESTRICT, size_t, const void* XXH_RESTRICT, size_t);
|
||||
|
||||
typedef struct {
|
||||
XXH3_dispatchx86_hashLong128_default hashLong128_default;
|
||||
XXH3_dispatchx86_hashLong128_withSeed hashLong128_seed;
|
||||
XXH3_dispatchx86_hashLong128_withSecret hashLong128_secret;
|
||||
XXH3_dispatchx86_update update;
|
||||
} XXH_dispatch128Functions_s;
|
||||
|
||||
|
||||
/*!
|
||||
* @internal
|
||||
* @brief Table of dispatchers for @ref XXH3_128bits().
|
||||
*
|
||||
* @pre The indices must match @ref XXH_VECTOR_TYPE.
|
||||
*/
|
||||
static const XXH_dispatch128Functions_s XXH_kDispatch128[XXH_NB_DISPATCHES] = {
|
||||
#if XXH_DISPATCH_SCALAR
|
||||
/* Scalar */ { XXHL128_default_scalar, XXHL128_seed_scalar, XXHL128_secret_scalar, XXH3_update_scalar },
|
||||
#else
|
||||
/* Scalar */ { NULL, NULL, NULL, NULL },
|
||||
#endif
|
||||
/* SSE2 */ { XXHL128_default_sse2, XXHL128_seed_sse2, XXHL128_secret_sse2, XXH3_update_sse2 },
|
||||
#if XXH_DISPATCH_AVX2
|
||||
/* AVX2 */ { XXHL128_default_avx2, XXHL128_seed_avx2, XXHL128_secret_avx2, XXH3_update_avx2 },
|
||||
#else
|
||||
/* AVX2 */ { NULL, NULL, NULL, NULL },
|
||||
#endif
|
||||
#if XXH_DISPATCH_AVX512
|
||||
/* AVX512 */ { XXHL128_default_avx512, XXHL128_seed_avx512, XXHL128_secret_avx512, XXH3_update_avx512 }
|
||||
#else
|
||||
/* AVX512 */ { NULL, NULL, NULL, NULL }
|
||||
#endif
|
||||
};
|
||||
|
||||
/*!
|
||||
* @internal
|
||||
* @brief The selected dispatch table for @ref XXH3_64bits().
|
||||
*/
|
||||
static XXH_dispatch128Functions_s XXH_g_dispatch128 = { NULL, NULL, NULL, NULL };
|
||||
|
||||
/*!
|
||||
* @internal
|
||||
* @brief Runs a CPUID check and sets the correct dispatch tables.
|
||||
*/
|
||||
static void XXH_setDispatch(void)
|
||||
{
|
||||
int vecID = XXH_featureTest();
|
||||
XXH_STATIC_ASSERT(XXH_AVX512 == XXH_NB_DISPATCHES-1);
|
||||
assert(XXH_SCALAR <= vecID && vecID <= XXH_AVX512);
|
||||
#if !XXH_DISPATCH_SCALAR
|
||||
assert(vecID != XXH_SCALAR);
|
||||
#endif
|
||||
#if !XXH_DISPATCH_AVX512
|
||||
assert(vecID != XXH_AVX512);
|
||||
#endif
|
||||
#if !XXH_DISPATCH_AVX2
|
||||
assert(vecID != XXH_AVX2);
|
||||
#endif
|
||||
XXH_g_dispatch = XXH_kDispatch[vecID];
|
||||
XXH_g_dispatch128 = XXH_kDispatch128[vecID];
|
||||
}
|
||||
|
||||
|
||||
/* ==== XXH3 public functions ==== */
|
||||
|
||||
static XXH64_hash_t
|
||||
XXH3_hashLong_64b_defaultSecret_selection(const void* input, size_t len,
|
||||
XXH64_hash_t seed64, const xxh_u8* secret, size_t secretLen)
|
||||
{
|
||||
(void)seed64; (void)secret; (void)secretLen;
|
||||
if (XXH_g_dispatch.hashLong64_default == NULL) XXH_setDispatch();
|
||||
return XXH_g_dispatch.hashLong64_default(input, len);
|
||||
}
|
||||
|
||||
XXH64_hash_t XXH3_64bits_dispatch(const void* input, size_t len)
|
||||
{
|
||||
return XXH3_64bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_defaultSecret_selection);
|
||||
}
|
||||
|
||||
static XXH64_hash_t
|
||||
XXH3_hashLong_64b_withSeed_selection(const void* input, size_t len,
|
||||
XXH64_hash_t seed64, const xxh_u8* secret, size_t secretLen)
|
||||
{
|
||||
(void)secret; (void)secretLen;
|
||||
if (XXH_g_dispatch.hashLong64_seed == NULL) XXH_setDispatch();
|
||||
return XXH_g_dispatch.hashLong64_seed(input, len, seed64);
|
||||
}
|
||||
|
||||
XXH64_hash_t XXH3_64bits_withSeed_dispatch(const void* input, size_t len, XXH64_hash_t seed)
|
||||
{
|
||||
return XXH3_64bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_64b_withSeed_selection);
|
||||
}
|
||||
|
||||
static XXH64_hash_t
|
||||
XXH3_hashLong_64b_withSecret_selection(const void* input, size_t len,
|
||||
XXH64_hash_t seed64, const xxh_u8* secret, size_t secretLen)
|
||||
{
|
||||
(void)seed64;
|
||||
if (XXH_g_dispatch.hashLong64_secret == NULL) XXH_setDispatch();
|
||||
return XXH_g_dispatch.hashLong64_secret(input, len, secret, secretLen);
|
||||
}
|
||||
|
||||
XXH64_hash_t XXH3_64bits_withSecret_dispatch(const void* input, size_t len, const void* secret, size_t secretLen)
|
||||
{
|
||||
return XXH3_64bits_internal(input, len, 0, secret, secretLen, XXH3_hashLong_64b_withSecret_selection);
|
||||
}
|
||||
|
||||
XXH_errorcode
|
||||
XXH3_64bits_update_dispatch(XXH3_state_t* state, const void* input, size_t len)
|
||||
{
|
||||
if (XXH_g_dispatch.update == NULL) XXH_setDispatch();
|
||||
return XXH_g_dispatch.update(state, (const xxh_u8*)input, len);
|
||||
}
|
||||
|
||||
|
||||
/* ==== XXH128 public functions ==== */
|
||||
|
||||
static XXH128_hash_t
|
||||
XXH3_hashLong_128b_defaultSecret_selection(const void* input, size_t len,
|
||||
XXH64_hash_t seed64, const void* secret, size_t secretLen)
|
||||
{
|
||||
(void)seed64; (void)secret; (void)secretLen;
|
||||
if (XXH_g_dispatch128.hashLong128_default == NULL) XXH_setDispatch();
|
||||
return XXH_g_dispatch128.hashLong128_default(input, len);
|
||||
}
|
||||
|
||||
XXH128_hash_t XXH3_128bits_dispatch(const void* input, size_t len)
|
||||
{
|
||||
return XXH3_128bits_internal(input, len, 0, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_128b_defaultSecret_selection);
|
||||
}
|
||||
|
||||
static XXH128_hash_t
|
||||
XXH3_hashLong_128b_withSeed_selection(const void* input, size_t len,
|
||||
XXH64_hash_t seed64, const void* secret, size_t secretLen)
|
||||
{
|
||||
(void)secret; (void)secretLen;
|
||||
if (XXH_g_dispatch128.hashLong128_seed == NULL) XXH_setDispatch();
|
||||
return XXH_g_dispatch128.hashLong128_seed(input, len, seed64);
|
||||
}
|
||||
|
||||
XXH128_hash_t XXH3_128bits_withSeed_dispatch(const void* input, size_t len, XXH64_hash_t seed)
|
||||
{
|
||||
return XXH3_128bits_internal(input, len, seed, XXH3_kSecret, sizeof(XXH3_kSecret), XXH3_hashLong_128b_withSeed_selection);
|
||||
}
|
||||
|
||||
static XXH128_hash_t
|
||||
XXH3_hashLong_128b_withSecret_selection(const void* input, size_t len,
|
||||
XXH64_hash_t seed64, const void* secret, size_t secretLen)
|
||||
{
|
||||
(void)seed64;
|
||||
if (XXH_g_dispatch128.hashLong128_secret == NULL) XXH_setDispatch();
|
||||
return XXH_g_dispatch128.hashLong128_secret(input, len, secret, secretLen);
|
||||
}
|
||||
|
||||
XXH128_hash_t XXH3_128bits_withSecret_dispatch(const void* input, size_t len, const void* secret, size_t secretLen)
|
||||
{
|
||||
return XXH3_128bits_internal(input, len, 0, secret, secretLen, XXH3_hashLong_128b_withSecret_selection);
|
||||
}
|
||||
|
||||
XXH_errorcode
|
||||
XXH3_128bits_update_dispatch(XXH3_state_t* state, const void* input, size_t len)
|
||||
{
|
||||
if (XXH_g_dispatch128.update == NULL) XXH_setDispatch();
|
||||
return XXH_g_dispatch128.update(state, (const xxh_u8*)input, len);
|
||||
}
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
/*! @} */
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* xxHash - XXH3 Dispatcher for x86-based targets
|
||||
* Copyright (C) 2020-2021 Yann Collet
|
||||
*
|
||||
* BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* You can contact the author at:
|
||||
* - xxHash homepage: https://www.xxhash.com
|
||||
* - xxHash source repository: https://github.com/Cyan4973/xxHash
|
||||
*/
|
||||
|
||||
#ifndef XXH_X86DISPATCH_H_13563687684
|
||||
#define XXH_X86DISPATCH_H_13563687684
|
||||
|
||||
#include "xxhash.h" /* XXH64_hash_t, XXH3_state_t */
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_dispatch(const void* input, size_t len);
|
||||
XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSeed_dispatch(const void* input, size_t len, XXH64_hash_t seed);
|
||||
XXH_PUBLIC_API XXH64_hash_t XXH3_64bits_withSecret_dispatch(const void* input, size_t len, const void* secret, size_t secretLen);
|
||||
XXH_PUBLIC_API XXH_errorcode XXH3_64bits_update_dispatch(XXH3_state_t* state, const void* input, size_t len);
|
||||
|
||||
XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_dispatch(const void* input, size_t len);
|
||||
XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSeed_dispatch(const void* input, size_t len, XXH64_hash_t seed);
|
||||
XXH_PUBLIC_API XXH128_hash_t XXH3_128bits_withSecret_dispatch(const void* input, size_t len, const void* secret, size_t secretLen);
|
||||
XXH_PUBLIC_API XXH_errorcode XXH3_128bits_update_dispatch(XXH3_state_t* state, const void* input, size_t len);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* automatic replacement of XXH3 functions.
|
||||
* can be disabled by setting XXH_DISPATCH_DISABLE_REPLACE */
|
||||
#ifndef XXH_DISPATCH_DISABLE_REPLACE
|
||||
|
||||
# undef XXH3_64bits
|
||||
# define XXH3_64bits XXH3_64bits_dispatch
|
||||
# undef XXH3_64bits_withSeed
|
||||
# define XXH3_64bits_withSeed XXH3_64bits_withSeed_dispatch
|
||||
# undef XXH3_64bits_withSecret
|
||||
# define XXH3_64bits_withSecret XXH3_64bits_withSecret_dispatch
|
||||
# undef XXH3_64bits_update
|
||||
# define XXH3_64bits_update XXH3_64bits_update_dispatch
|
||||
|
||||
# undef XXH128
|
||||
# define XXH128 XXH3_128bits_withSeed_dispatch
|
||||
# undef XXH3_128bits
|
||||
# define XXH3_128bits XXH3_128bits_dispatch
|
||||
# undef XXH3_128bits_withSeed
|
||||
# define XXH3_128bits_withSeed XXH3_128bits_withSeed_dispatch
|
||||
# undef XXH3_128bits_withSecret
|
||||
# define XXH3_128bits_withSecret XXH3_128bits_withSecret_dispatch
|
||||
# undef XXH3_128bits_update
|
||||
# define XXH3_128bits_update XXH3_128bits_update_dispatch
|
||||
|
||||
#endif /* XXH_DISPATCH_DISABLE_REPLACE */
|
||||
|
||||
#endif /* XXH_X86DISPATCH_H_13563687684 */
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* xxHash - Extremely Fast Hash algorithm
|
||||
* Copyright (C) 2012-2021 Yann Collet
|
||||
*
|
||||
* BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* You can contact the author at:
|
||||
* - xxHash homepage: https://www.xxhash.com
|
||||
* - xxHash source repository: https://github.com/Cyan4973/xxHash
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* xxhash.c instantiates functions defined in xxhash.h
|
||||
*/
|
||||
|
||||
#define XXH_STATIC_LINKING_ONLY /* access advanced declarations */
|
||||
#define XXH_IMPLEMENTATION /* access definitions */
|
||||
|
||||
#include "xxhash.h"
|
File diff suppressed because it is too large
Load Diff
|
@ -5,9 +5,6 @@
|
|||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
//#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
|
||||
#include <xxhash/xxhash.h>
|
||||
|
||||
#include "hecl.hpp"
|
||||
|
||||
namespace hecl::Backend {
|
||||
|
|
|
@ -44,7 +44,7 @@ extern "C" int rep_closefrom(int lower);
|
|||
#include "FourCC.hpp"
|
||||
#include "athena/Global.hpp"
|
||||
#include "logvisor/logvisor.hpp"
|
||||
#include "xxhash/xxhash.h"
|
||||
#include "xxhash.h"
|
||||
|
||||
|
||||
#if defined(__has_feature)
|
||||
|
|
|
@ -68,7 +68,7 @@ add_library(hecl-full
|
|||
${FIND_BLENDER_SOURCES})
|
||||
target_include_directories(hecl-full PUBLIC ../include)
|
||||
target_link_libraries(hecl-full PUBLIC ${HECL_APPLICATION_REPS_TARGETS_LIST}
|
||||
hecl-blender-addon boo athena-core logvisor)
|
||||
hecl-blender-addon boo athena-core logvisor xxhash)
|
||||
target_atdna(hecl-full atdna_HMDLMeta_full.cpp ../include/hecl/HMDLMeta.hpp)
|
||||
target_atdna(hecl-full atdna_CVar_full.cpp ../include/hecl/CVar.hpp)
|
||||
target_atdna(hecl-full atdna_SDNARead_full.cpp ../include/hecl/Blender/SDNARead.hpp)
|
||||
|
@ -80,7 +80,7 @@ add_library(hecl-light
|
|||
${PLAT_SRCS}
|
||||
${FIND_BLENDER_SOURCES})
|
||||
target_include_directories(hecl-light PUBLIC ../include)
|
||||
target_link_libraries(hecl-light PUBLIC ${HECL_APPLICATION_REPS_TARGETS_LIST} boo athena-core logvisor aurora)
|
||||
target_link_libraries(hecl-light PUBLIC ${HECL_APPLICATION_REPS_TARGETS_LIST} boo athena-core logvisor aurora xxhash)
|
||||
if (WIN32)
|
||||
# For FindBlender
|
||||
target_link_libraries(hecl-light PUBLIC Version)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "VISIRenderer.hpp"
|
||||
#include "zeus/CAABox.hpp"
|
||||
#include "xxhash/xxhash.h"
|
||||
#include "xxhash.h"
|
||||
#include "athena/MemoryWriter.hpp"
|
||||
#include <unordered_map>
|
||||
|
||||
|
|
Loading…
Reference in New Issue