diff options
author | Jesse Talavera <jesse@jesse.tg> | 2023-12-12 05:07:22 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-12 11:07:22 +0100 |
commit | 9bfc9c08ffe88de4b54734d6fd03182c0a51e181 (patch) | |
tree | 28a9177f377f6ab85f9aabc54c3a523fd7d610ff /src/GPU3D_Soft.h | |
parent | 2cba2e783a2ef3a83b7d8bf0cb6e42a6298edbf6 (diff) |
Sprinkle `const` around where appropriate (#1909)
* Sprinkle `const` around where appropriate
- This will make it easier to use `NDS` objects in `const` contexts (e.g. `const` parameters or methods)
* Remove the `const` qualifier on `DSi_DSP::DSPRead16`
- MMIO reads can be non-pure, so this may not be `const` in the future
Diffstat (limited to 'src/GPU3D_Soft.h')
-rw-r--r-- | src/GPU3D_Soft.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/GPU3D_Soft.h b/src/GPU3D_Soft.h index 2f5664e..f405b2d 100644 --- a/src/GPU3D_Soft.h +++ b/src/GPU3D_Soft.h @@ -429,16 +429,16 @@ private: }; template <typename T> - inline T ReadVRAM_Texture(u32 addr) + inline T ReadVRAM_Texture(u32 addr) const { return *(T*)&GPU.VRAMFlat_Texture[addr & 0x7FFFF]; } template <typename T> - inline T ReadVRAM_TexPal(u32 addr) + inline T ReadVRAM_TexPal(u32 addr) const { return *(T*)&GPU.VRAMFlat_TexPal[addr & 0x1FFFF]; } - u32 AlphaBlend(u32 srccolor, u32 dstcolor, u32 alpha) noexcept; + u32 AlphaBlend(u32 srccolor, u32 dstcolor, u32 alpha) const noexcept; struct RendererPolygon { @@ -454,16 +454,16 @@ private: melonDS::GPU& GPU; RendererPolygon PolygonList[2048]; - void TextureLookup(u32 texparam, u32 texpal, s16 s, s16 t, u16* color, u8* alpha); - u32 RenderPixel(Polygon* polygon, u8 vr, u8 vg, u8 vb, s16 s, s16 t); + void TextureLookup(u32 texparam, u32 texpal, s16 s, s16 t, u16* color, u8* alpha) const; + u32 RenderPixel(const Polygon* polygon, u8 vr, u8 vg, u8 vb, s16 s, s16 t) const; void PlotTranslucentPixel(u32 pixeladdr, u32 color, u32 z, u32 polyattr, u32 shadow); - void SetupPolygonLeftEdge(RendererPolygon* rp, s32 y); - void SetupPolygonRightEdge(RendererPolygon* rp, s32 y); - void SetupPolygon(RendererPolygon* rp, Polygon* polygon); + void SetupPolygonLeftEdge(RendererPolygon* rp, s32 y) const; + void SetupPolygonRightEdge(RendererPolygon* rp, s32 y) const; + void SetupPolygon(RendererPolygon* rp, Polygon* polygon) const; void RenderShadowMaskScanline(RendererPolygon* rp, s32 y); void RenderPolygonScanline(RendererPolygon* rp, s32 y); void RenderScanline(s32 y, int npolys); - u32 CalculateFogDensity(u32 pixeladdr); + u32 CalculateFogDensity(u32 pixeladdr) const; void ScanlineFinalPass(s32 y); void ClearBuffers(); void RenderPolygons(bool threaded, Polygon** polygons, int npolys); |