Use uint8_t* instead of void* for texture data

NOTE: In texture_setimage, I had to move variables to the top of the
scope because microsoft's C compiler will give the legacy C90 error of:
'illegal use of this type as an expression'.

To sum it up, microsoft's C compiler is still utter garbage.
This commit is contained in:
jp9000
2014-06-27 21:29:06 -07:00
parent 9478624b22
commit 7b12133af3
15 changed files with 55 additions and 53 deletions

View File

@@ -508,7 +508,7 @@ uint32_t device_getheight(device_t device)
texture_t device_create_texture(device_t device, uint32_t width,
uint32_t height, enum gs_color_format color_format,
uint32_t levels, const void **data, uint32_t flags)
uint32_t levels, const uint8_t **data, uint32_t flags)
{
gs_texture *texture = NULL;
try {
@@ -527,7 +527,7 @@ texture_t device_create_texture(device_t device, uint32_t width,
texture_t device_create_cubetexture(device_t device, uint32_t size,
enum gs_color_format color_format, uint32_t levels,
const void **data, uint32_t flags)
const uint8_t **data, uint32_t flags)
{
gs_texture *texture = NULL;
try {
@@ -549,7 +549,7 @@ texture_t device_create_cubetexture(device_t device, uint32_t size,
texture_t device_create_volumetexture(device_t device, uint32_t width,
uint32_t height, uint32_t depth,
enum gs_color_format color_format, uint32_t levels,
const void **data, uint32_t flags)
const uint8_t **data, uint32_t flags)
{
/* TODO */
UNUSED_PARAMETER(device);
@@ -1502,7 +1502,7 @@ enum gs_color_format texture_getcolorformat(texture_t tex)
return static_cast<gs_texture_2d*>(tex)->format;
}
bool texture_map(texture_t tex, void **ptr, uint32_t *linesize)
bool texture_map(texture_t tex, uint8_t **ptr, uint32_t *linesize)
{
HRESULT hr;
@@ -1517,7 +1517,7 @@ bool texture_map(texture_t tex, void **ptr, uint32_t *linesize)
if (FAILED(hr))
return false;
*ptr = map.pData;
*ptr = (uint8_t*)map.pData;
*linesize = map.RowPitch;
return true;
}

View File

@@ -259,8 +259,8 @@ struct gs_texture_2d : gs_texture {
bool genMipmaps;
HANDLE sharedHandle;
void InitSRD(vector<D3D11_SUBRESOURCE_DATA> &srd, const void **data);
void InitTexture(const void **data);
void InitSRD(vector<D3D11_SUBRESOURCE_DATA> &srd, const uint8_t **data);
void InitTexture(const uint8_t **data);
void InitResourceView();
void InitRenderTargets();
@@ -280,8 +280,8 @@ struct gs_texture_2d : gs_texture {
gs_texture_2d(device_t device, uint32_t width, uint32_t height,
gs_color_format colorFormat, uint32_t levels,
const void **data, uint32_t flags, gs_texture_type type,
bool gdiCompatible, bool shared);
const uint8_t **data, uint32_t flags,
gs_texture_type type, bool gdiCompatible, bool shared);
};
struct gs_zstencil_buffer {

View File

@@ -19,7 +19,7 @@
#include "d3d11-subsystem.hpp"
void gs_texture_2d::InitSRD(vector<D3D11_SUBRESOURCE_DATA> &srd,
const void **data)
const uint8_t **data)
{
uint32_t rowSizeBytes = width * gs_get_format_bpp(format);
uint32_t texSizeBytes = height * rowSizeBytes / 8;
@@ -49,7 +49,7 @@ void gs_texture_2d::InitSRD(vector<D3D11_SUBRESOURCE_DATA> &srd,
}
}
void gs_texture_2d::InitTexture(const void **data)
void gs_texture_2d::InitTexture(const uint8_t **data)
{
vector<D3D11_SUBRESOURCE_DATA> srd;
D3D11_TEXTURE2D_DESC td;
@@ -142,9 +142,9 @@ void gs_texture_2d::InitRenderTargets()
}
gs_texture_2d::gs_texture_2d(device_t device, uint32_t width, uint32_t height,
gs_color_format colorFormat, uint32_t levels, const void **data,
uint32_t flags, gs_texture_type type, bool gdiCompatible,
bool shared)
gs_color_format colorFormat, uint32_t levels,
const uint8_t **data, uint32_t flags, gs_texture_type type,
bool gdiCompatible, bool shared)
: gs_texture (device, type, levels, colorFormat),
width (width),
height (height),