From bf4dbede7aa8d60a70731d25f4a23c79c91fbc26 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 8 Jun 2014 04:20:49 +0200 Subject: [PATCH] (XDK) Change DrawVerticeFormat to Vertex --- gfx/d3d9/render_chain.cpp | 4 ---- gfx/image/image_xdk1.c | 11 +++-------- xdk/xdk_d3d.cpp | 14 +++++++------- xdk/xdk_d3d.h | 4 ++-- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/gfx/d3d9/render_chain.cpp b/gfx/d3d9/render_chain.cpp index 49da813ceb..9fe16cc25b 100644 --- a/gfx/d3d9/render_chain.cpp +++ b/gfx/d3d9/render_chain.cpp @@ -575,11 +575,7 @@ void renderchain_render_pass(void *data, Pass &pass, unsigned pass_index) #endif for (unsigned i = 0; i < 4; i++) { -#ifdef _XBOX - D3DDevice_SetStreamSources(d3dr, i, pass.vertex_buf, 0, sizeof(DrawVerticeFormats)); -#else D3DDevice_SetStreamSources(d3dr, i, pass.vertex_buf, 0, sizeof(Vertex)); -#endif } renderchain_bind_orig(chain, pass); diff --git a/gfx/image/image_xdk1.c b/gfx/image/image_xdk1.c index a16438c156..5350656671 100644 --- a/gfx/image/image_xdk1.c +++ b/gfx/image/image_xdk1.c @@ -27,22 +27,17 @@ bool texture_image_load(void *data, const char *path, void *image_data) out_img->pixels = NULL; out_img->vertex_buf = NULL; - HRESULT ret = D3DXCreateTextureFromFileExA(d3d->dev, + if(FAILED(D3DXCreateTextureFromFileExA(d3d->dev, path, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, &m_imageInfo, NULL, - &out_img->pixels); - - if(FAILED(ret)) + &out_img->pixels))) { RARCH_ERR("Error occurred during D3DXCreateTextureFromFileExA().\n"); return false; } // create a vertex buffer for the quad that will display the texture - ret = d3d->dev->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats), - D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED, &out_img->vertex_buf); - - if (FAILED(ret)) + if (FAILED(D3DDevice_CreateVertexBuffers(d3d->dev, 4 * sizeof(Vertex), D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED, &out_img->vertex_buf, NULL))) { RARCH_ERR("Error occurred during CreateVertexBuffer().\n"); out_img->pixels->Release(); diff --git a/xdk/xdk_d3d.cpp b/xdk/xdk_d3d.cpp index f20be64216..3a27e1c438 100644 --- a/xdk/xdk_d3d.cpp +++ b/xdk/xdk_d3d.cpp @@ -266,7 +266,7 @@ static bool renderchain_create_first_pass(void *data, const video_info_t *info) d3d_video_t *chain = (d3d_video_t*)data; LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)chain->dev; - ret = D3DDevice_CreateVertexBuffers(d3dr, 4 * sizeof(DrawVerticeFormats), + ret = D3DDevice_CreateVertexBuffers(d3dr, 4 * sizeof(Vertex), D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED, &chain->vertex_buf, NULL); if (FAILED(ret)) @@ -438,7 +438,7 @@ static bool texture_image_render(void *data, struct texture_image *out_img, float fY = static_cast(y); // create the new vertices - DrawVerticeFormats newVerts[] = + Vertex newVerts[] = { // x, y, z, color, u ,v {fX, fY, 0.0f, 0, 0, 0}, @@ -448,7 +448,7 @@ static bool texture_image_render(void *data, struct texture_image *out_img, }; // load the existing vertices - DrawVerticeFormats *pCurVerts; + Vertex *pCurVerts; HRESULT ret = out_img->vertex_buf->Lock(0, 0, (unsigned char**)&pCurVerts, 0); @@ -456,7 +456,7 @@ static bool texture_image_render(void *data, struct texture_image *out_img, return false; // copy the new verts over the old verts - memcpy(pCurVerts, newVerts, 4 * sizeof(DrawVerticeFormats)); + memcpy(pCurVerts, newVerts, 4 * sizeof(Vertex)); out_img->vertex_buf->Unlock(); d3d->dev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); @@ -470,7 +470,7 @@ static bool texture_image_render(void *data, struct texture_image *out_img, // draw the quad d3dr->SetTexture(0, out_img->pixels); - D3DDevice_SetStreamSources(d3dr, 0, out_img->vertex_buf, 0, sizeof(DrawVerticeFormats)); + D3DDevice_SetStreamSources(d3dr, 0, out_img->vertex_buf, 0, sizeof(Vertex)); d3dr->SetVertexShader(D3DFVF_CUSTOMVERTEX); if (force_fullscreen) @@ -549,7 +549,7 @@ static void set_vertices(void *data, unsigned pass, unsigned width, unsigned hei d3d->last_width = width; d3d->last_height = height; - DrawVerticeFormats vert[4]; + Vertex vert[4]; float tex_w = width; float tex_h = height; #ifdef _XBOX360 @@ -668,7 +668,7 @@ static void render_pass(void *data, const void *frame, unsigned width, unsigned #endif for (unsigned i = 0; i < 4; i++) { - D3DDevice_SetStreamSources(d3dr, i, d3d->vertex_buf, 0, sizeof(DrawVerticeFormats)); + D3DDevice_SetStreamSources(d3dr, i, d3d->vertex_buf, 0, sizeof(Vertex)); } D3DDevice_DrawPrimitive(d3dr, D3DPT_TRIANGLESTRIP, 0, 2); diff --git a/xdk/xdk_d3d.h b/xdk/xdk_d3d.h index a8439b3fb2..8548374fd6 100644 --- a/xdk/xdk_d3d.h +++ b/xdk/xdk_d3d.h @@ -52,7 +52,7 @@ typedef struct LPDIRECT3DVERTEXBUFFER vert_buf; } overlay_t; -typedef struct DrawVerticeFormats +typedef struct Vertex { float x, y; #if defined(_XBOX1) @@ -60,7 +60,7 @@ typedef struct DrawVerticeFormats float rhw; #endif float u, v; -} DrawVerticeFormats; +} Vertex; typedef struct gl_shader_backend gl_shader_backend_t;