MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / ConvertRGBA32

Function ConvertRGBA32

Source/HLEGraphics/ConvertTile.cpp:129–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129static void ConvertRGBA32(const TileDestInfo & dsti, const TextureInfo & ti)
130{
131 u32 width {dsti.Width};
132 u32 height {dsti.Height};
133
134 u8 * dst {static_cast<u8*>(dsti.Data)};
135 u32 dst_row_stride {dsti.Pitch};
136 u32 dst_row_offset {};
137
138 const u8 * src {gTMEM};
139 u32 src_row_stride {ti.GetLine()<<3};
140 u32 src_row_offset {ti.GetTmemAddress()<<3};
141
142 // NB! RGBA/32 line needs to be doubled.
143 src_row_stride *= 2;
144
145 u32 row_swizzle {};
146 for (u32 y = 0; y < height; ++y)
147 {
148 u32 src_offset {src_row_offset};
149 u32 dst_offset {dst_row_offset};
150 for (u32 x {}; x < width; ++x)
151 {
152 u32 o {src_offset^row_swizzle};
153
154 dst[dst_offset+0] = src[o];
155 dst[dst_offset+1] = src[o+1];
156 dst[dst_offset+2] = src[o+2];
157 dst[dst_offset+3] = src[o+3];
158
159 src_offset += 4;
160 dst_offset += 4;
161 }
162 src_row_offset += src_row_stride;
163 dst_row_offset += dst_row_stride;
164
165 row_swizzle ^= 0x8; // Alternate lines are qword-swapped
166 }
167}
168
169static void ConvertRGBA16(const TileDestInfo & dsti, const TextureInfo & ti)
170{

Callers

nothing calls this directly

Calls 2

GetLineMethod · 0.80
GetTmemAddressMethod · 0.80

Tested by

no test coverage detected