(D3D) d3d_wrapper.c build fixes

This commit is contained in:
twinaphex 2014-09-12 00:00:20 +02:00
parent ee820298d1
commit fa46a2bf19
4 changed files with 18 additions and 18 deletions

View File

@ -14,7 +14,6 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "../context/win32_common.h"
#include "d3d_wrapper.h" #include "d3d_wrapper.h"
void d3d_swap(d3d_video_t *d3d, LPDIRECT3DDEVICE dev) void d3d_swap(d3d_video_t *d3d, LPDIRECT3DDEVICE dev)
@ -34,7 +33,7 @@ void d3d_swap(d3d_video_t *d3d, LPDIRECT3DDEVICE dev)
HRESULT d3d_create_vertex_buffer(LPDIRECT3DDEVICE dev, HRESULT d3d_create_vertex_buffer(LPDIRECT3DDEVICE dev,
unsigned length, unsigned usage, unsigned fvf, unsigned length, unsigned usage, unsigned fvf,
d3DPOOL pool, LPDIRECT3DVERTEXBUFFER vert_buf, void *handle) D3DPOOL pool, LPDIRECT3DVERTEXBUFFER vert_buf, void *handle)
{ {
#if defined(_XBOX1) #if defined(_XBOX1)
IDirect3DDevice8_CreateVertexBuffer(dev, length, usage, fvf, pool, IDirect3DDevice8_CreateVertexBuffer(dev, length, usage, fvf, pool,
@ -101,7 +100,7 @@ void d3d_set_sampler_minfilter(LPDIRECT3DDEVICE dev,
} }
void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev, void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev,
unsigned sampler, unsigned type) unsigned sampler, unsigned type, unsigned value)
{ {
#if defined(_XBOX1) #if defined(_XBOX1)
D3D__DirtyFlags |= (D3DDIRTYFLAG_TEXTURE_STATE_0 << sampler); D3D__DirtyFlags |= (D3DDIRTYFLAG_TEXTURE_STATE_0 << sampler);
@ -114,7 +113,7 @@ void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev,
} }
void d3d_draw_primitive(LPDIRECT3DDEVICE dev, void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
unsigned type, unsigned start, unsigned count) D3DPRIMITIVETYPE type, unsigned start, unsigned count)
{ {
#if defined(_XBOX1) #if defined(_XBOX1)
D3DDevice_DrawVertices(type, start, D3DVERTEXCOUNT(type, count)); D3DDevice_DrawVertices(type, start, D3DVERTEXCOUNT(type, count));
@ -135,12 +134,12 @@ void d3d_lockrectangle_clear(LPDIRECT3DTEXTURE tex,
unsigned flags) unsigned flags)
{ {
#if defined(_XBOX) #if defined(_XBOX)
D3DTexture_LockRect(tex, level, &lockedrect, rect, flags); D3DTexture_LockRect(tex, level, &lock_rect, &rect, flags);
memset(lockedrect.pBits, 0, tex_height * lockedrect.Pitch) memset(lock_rect.pBits, 0, tex_height * lock_rect.Pitch);
#else #else
if (SUCCEEDED(tex->LockRect(level, &lockedrect, rect, flags))) if (SUCCEEDED(tex->LockRect(level, &lock_rect, rect, flags)))
{ {
memset(lockedrect.pBits, level, tex_height * lockedrect.Pitch); memset(lock_rect.pBits, level, tex_height * lock_rect.Pitch);
tex->UnlockRect(0); tex->UnlockRect(0);
} }
#endif #endif
@ -148,16 +147,16 @@ void d3d_lockrectangle_clear(LPDIRECT3DTEXTURE tex,
void d3d_textureblit(d3d_video_t *d3d, void d3d_textureblit(d3d_video_t *d3d,
LPDIRECT3DTEXTURE tex, D3DSURFACE_DESC desc, LPDIRECT3DTEXTURE tex, D3DSURFACE_DESC desc,
D3DLOCKED_RECT rect, const void *frame, D3DLOCKED_RECT lr, const void *frame,
unsigned width, unsigned height, unsigned pitch) unsigned width, unsigned height, unsigned pitch)
{ {
#if 1 #if 1
if (SUCCEEDED(tex->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK))) if (SUCCEEDED(tex->LockRect(0, &lr, NULL, D3DLOCK_NOSYSLOCK)))
{ {
for (unsigned y = 0; y < height; y++) for (unsigned y = 0; y < height; y++)
{ {
const uint8_t *in = (const uint8_t*)frame + y * pitch; const uint8_t *in = (const uint8_t*)frame + y * pitch;
uint8_t *out = (uint8_t*)d3dlr.pBits + y * d3dlr.Pitch; uint8_t *out = (uint8_t*)lr.pBits + y * lr.Pitch;
memcpy(out, in, width * d3d->pixel_size); memcpy(out, in, width * d3d->pixel_size);
} }
tex->UnlockRect(0); tex->UnlockRect(0);

View File

@ -24,7 +24,7 @@ void d3d_swap(d3d_video_t *d3d, LPDIRECT3DDEVICE dev);
HRESULT d3d_create_vertex_buffer(LPDIRECT3DDEVICE dev, HRESULT d3d_create_vertex_buffer(LPDIRECT3DDEVICE dev,
unsigned length, unsigned usage, unsigned fvf, unsigned length, unsigned usage, unsigned fvf,
d3DPOOL pool, LPDIRECT3DVERTEXBUFFER vert_buf, void *handle); D3DPOOL pool, LPDIRECT3DVERTEXBUFFER vert_buf, void *handle);
void d3d_set_stream_source(LPDIRECT3DDEVICE dev, unsigned stream_no, void d3d_set_stream_source(LPDIRECT3DDEVICE dev, unsigned stream_no,
LPDIRECT3DVERTEXBUFFER stream_vertbuf, unsigned offset_bytes, LPDIRECT3DVERTEXBUFFER stream_vertbuf, unsigned offset_bytes,
@ -40,10 +40,10 @@ void d3d_set_sampler_minfilter(LPDIRECT3DDEVICE dev,
unsigned sampler, unsigned type, unsigned value); unsigned sampler, unsigned type, unsigned value);
void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev, void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev,
unsigned sampler, unsigned type); unsigned sampler, unsigned type, unsigned value);
void d3d_draw_primitive(LPDIRECT3DDEVICE dev, void d3d_draw_primitive(LPDIRECT3DDEVICE dev,
unsigned type, unsigned start, unsigned count); D3DPRIMITIVETYPE type, unsigned start, unsigned count);
void d3d_lockrectangle_clear(LPDIRECT3DTEXTURE tex, void d3d_lockrectangle_clear(LPDIRECT3DTEXTURE tex,
unsigned tex_width, unsigned tex_height, unsigned tex_width, unsigned tex_height,
@ -52,7 +52,7 @@ void d3d_lockrectangle_clear(LPDIRECT3DTEXTURE tex,
void d3d_textureblit(d3d_video_t *d3d, void d3d_textureblit(d3d_video_t *d3d,
LPDIRECT3DTEXTURE tex, D3DSURFACE_DESC desc, LPDIRECT3DTEXTURE tex, D3DSURFACE_DESC desc,
D3DLOCKED_RECT rect, const void *frame, D3DLOCKED_RECT lr, const void *frame,
unsigned width, unsigned height, unsigned pitch); unsigned width, unsigned height, unsigned pitch);
#endif #endif

View File

@ -15,7 +15,7 @@
*/ */
#include "image.h" #include "image.h"
#include "../d3d9/d3d_defines.h" #include "../d3d9/d3d_wrapper.h"
bool texture_image_load(struct texture_image *out_img, const char *path) bool texture_image_load(struct texture_image *out_img, const char *path)
{ {
@ -36,9 +36,9 @@ bool texture_image_load(struct texture_image *out_img, const char *path)
} }
/* create a vertex buffer for the quad that will display the texture */ /* create a vertex buffer for the quad that will display the texture */
if (FAILED(D3DDevice_CreateVertexBuffers(d3d->dev, 4 * sizeof(Vertex), if (FAILED(d3d_create_vertex_buffer(d3d->dev, 4 * sizeof(Vertex),
D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX,
D3DPOOL_MANAGED, &out_img->vertex_buf, NULL))) D3DPOOL_MANAGED, out_img->vertex_buf, NULL)))
{ {
RARCH_ERR("Error occurred during CreateVertexBuffer().\n"); RARCH_ERR("Error occurred during CreateVertexBuffer().\n");
out_img->pixels->Release(); out_img->pixels->Release();

View File

@ -219,6 +219,7 @@ VIDEO DRIVER
#endif #endif
#ifdef _XBOX #ifdef _XBOX
#include "../gfx/d3d9/d3d_wrapper.c"
#include "../gfx/d3d9/d3d.cpp" #include "../gfx/d3d9/d3d.cpp"
#endif #endif