gl_rasterizer: Get rid of pointer casts
This commit is contained in:
parent
248b2993e8
commit
9689dc423f
1 changed files with 12 additions and 4 deletions
|
@ -901,8 +901,12 @@ void RasterizerOpenGL::ReloadDepthBuffer() {
|
||||||
u32 gl_pixel_index = (x + y * fb_depth_texture.width);
|
u32 gl_pixel_index = (x + y * fb_depth_texture.width);
|
||||||
|
|
||||||
u8* pixel = depth_buffer + dst_offset;
|
u8* pixel = depth_buffer + dst_offset;
|
||||||
u32 depth_stencil = *(u32*)pixel;
|
|
||||||
((u32*)temp_fb_depth_data)[gl_pixel_index] = (depth_stencil << 8) | (depth_stencil >> 24);
|
u32 depth_stencil;
|
||||||
|
std::memcpy(&depth_stencil, pixel, sizeof(u32));
|
||||||
|
|
||||||
|
u32 pixel_value = (depth_stencil << 8) | (depth_stencil >> 24);
|
||||||
|
std::memcpy(&temp_fb_depth_data[gl_pixel_index], &pixel_value, sizeof(u32));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1010,8 +1014,12 @@ void RasterizerOpenGL::CommitDepthBuffer() {
|
||||||
u32 gl_pixel_index = (x + y * fb_depth_texture.width);
|
u32 gl_pixel_index = (x + y * fb_depth_texture.width);
|
||||||
|
|
||||||
u8* pixel = depth_buffer + dst_offset;
|
u8* pixel = depth_buffer + dst_offset;
|
||||||
u32 depth_stencil = ((u32*)temp_gl_depth_data)[gl_pixel_index];
|
|
||||||
*(u32*)pixel = (depth_stencil >> 8) | (depth_stencil << 24);
|
u32 depth_stencil;
|
||||||
|
std::memcpy(&depth_stencil, &temp_gl_depth_data[gl_pixel_index], sizeof(u32));
|
||||||
|
|
||||||
|
u32 pixel_value = (depth_stencil >> 8) | (depth_stencil << 24);
|
||||||
|
std::memcpy(pixel, &pixel_value, sizeof(u32));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue