mirror of
https://github.com/dolphin-emu/hwtests.git
synced 2026-01-31 01:05:17 +01:00
Add wrappers for GX_PeekARGB/Z and GX_PokeARGB/Z to CGX
Currently these are direct wrappers, but we may need to replace them with something more complicated in the future (and this also avoids directly calling GX functions in tests, since not all GX functions are state-free (though these are)).
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "gxtest/BPMemory.h"
|
||||
#include "gxtest/CPMemory.h"
|
||||
#include "gxtest/XFMemory.h"
|
||||
#include "gxtest/util.h"
|
||||
|
||||
#include "cgx.h"
|
||||
|
||||
@@ -242,3 +243,60 @@ void CGX_WaitForGpuToFinish()
|
||||
|
||||
_CPU_ISR_Restore(level);
|
||||
}
|
||||
|
||||
void CGX_PEPokeAlphaMode(CompareMode func, u8 threshold)
|
||||
{
|
||||
GX_PokeAlphaMode(static_cast<u8>(func), threshold);
|
||||
}
|
||||
void CGX_PEPokeAlphaUpdate(bool enable)
|
||||
{
|
||||
GX_PokeAlphaUpdate(enable);
|
||||
}
|
||||
void CGX_PEPokeColorUpdate(bool enable)
|
||||
{
|
||||
GX_PokeColorUpdate(enable);
|
||||
}
|
||||
void CGX_PEPokeDither(bool dither)
|
||||
{
|
||||
GX_PokeDither(dither);
|
||||
}
|
||||
void CGX_PEPokeBlendMode(u8 type, SrcBlendFactor src_fact, DstBlendFactor dst_fact, LogicOp op)
|
||||
{
|
||||
GX_PokeBlendMode(type, static_cast<u8>(src_fact), static_cast<u8>(dst_fact), static_cast<u8>(op));
|
||||
}
|
||||
void CGX_PEPokeAlphaRead(u8 mode)
|
||||
{
|
||||
GX_PokeAlphaRead(mode);
|
||||
}
|
||||
void CGX_PEPokeDstAlpha(bool enable, u8 a)
|
||||
{
|
||||
GX_PokeDstAlpha(enable, a);
|
||||
}
|
||||
void CGX_PEPokeZMode(bool comp_enable, CompareMode func, bool update_enable)
|
||||
{
|
||||
GX_PokeZMode(comp_enable, static_cast<u8>(func), update_enable);
|
||||
}
|
||||
|
||||
// The pixel_fmt arg is unused currently but exists for future compatibility
|
||||
// if we need to do different types of reads for different formats
|
||||
GXTest::Vec4<u8> CGX_PeekARGB(u16 x, u16 y, [[maybe_unused]] PixelFormat pixel_fmt)
|
||||
{
|
||||
GXColor gx_color;
|
||||
GX_PeekARGB(x, y, &gx_color);
|
||||
return {.r = gx_color.r, .g = gx_color.g, .b = gx_color.b, .a = gx_color.a};
|
||||
}
|
||||
u32 CGX_PeekZ(u16 x, u16 y, [[maybe_unused]] PixelFormat pixel_fmt)
|
||||
{
|
||||
u32 z;
|
||||
GX_PeekZ(x, y, &z);
|
||||
return z;
|
||||
}
|
||||
void CGX_PokeARGB(u16 x, u16 y, const GXTest::Vec4<u8>& color, [[maybe_unused]] PixelFormat pixel_fmt)
|
||||
{
|
||||
GXColor gx_color{.r = color.r, .g = color.g, .b = color.b, .a = color.a};
|
||||
GX_PokeARGB(x, y, gx_color);
|
||||
}
|
||||
void CGX_PokeZ(u16 x, u16 y, u32 z, [[maybe_unused]] PixelFormat pixel_fmt)
|
||||
{
|
||||
GX_PokeZ(x, y, z);
|
||||
}
|
||||
|
||||
22
gxtest/cgx.h
22
gxtest/cgx.h
@@ -14,10 +14,16 @@
|
||||
#include <ogc/gx.h>
|
||||
|
||||
#include "common/CommonTypes.h"
|
||||
#include "BPMemory.h"
|
||||
#include "gxtest/BPMemory.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace GXTest
|
||||
{
|
||||
template <typename T>
|
||||
union Vec4;
|
||||
} // namespace
|
||||
|
||||
/*typedef float f32;
|
||||
|
||||
typedef union
|
||||
@@ -90,3 +96,17 @@ void CGX_DoEfbCopyXfb(u16 left, u16 top, u16 width, u16 src_height, u16 dst_heig
|
||||
void CGX_ForcePipelineFlush();
|
||||
|
||||
void CGX_WaitForGpuToFinish();
|
||||
|
||||
void CGX_PEPokeAlphaMode(CompareMode func, u8 threshold);
|
||||
void CGX_PEPokeAlphaUpdate(bool enable);
|
||||
void CGX_PEPokeColorUpdate(bool enable);
|
||||
void CGX_PEPokeDither(bool dither);
|
||||
void CGX_PEPokeBlendMode(u8 type, SrcBlendFactor src_fact, DstBlendFactor dst_fact, LogicOp op);
|
||||
void CGX_PEPokeAlphaRead(u8 mode);
|
||||
void CGX_PEPokeDstAlpha(bool enable, u8 a);
|
||||
void CGX_PEPokeZMode(bool comp_enable, CompareMode func, bool update_enable);
|
||||
|
||||
GXTest::Vec4<u8> CGX_PeekARGB(u16 x, u16 y, PixelFormat pixel_fmt);
|
||||
u32 CGX_PeekZ(u16 x, u16 y, PixelFormat pixel_fmt);
|
||||
void CGX_PokeARGB(u16 x, u16 y, const GXTest::Vec4<u8>& color, PixelFormat pixel_fmt);
|
||||
void CGX_PokeZ(u16 x, u16 y, u32 z, PixelFormat pixel_fmt);
|
||||
|
||||
Reference in New Issue
Block a user