Browse Source

build: allow to build the Direct3D 9 driver with the mingw compiler.

legacy
Sam Hocevar sam 12 years ago
parent
commit
88f10fe54b
5 changed files with 38 additions and 46 deletions
  1. +11
    -1
      configure.ac
  2. +3
    -0
      src/gpu/shader.cpp
  3. +2
    -2
      src/platform/sdl/sdlapp.cpp
  4. +4
    -1
      src/platform/xbox/xboxapp.cpp
  5. +18
    -42
      src/scene.cpp

+ 11
- 1
configure.ac View File

@@ -111,6 +111,16 @@ AC_CHECK_LIB(sysmodule_stub, cellSysmoduleLoadModule,
AM_CONDITIONAL(USE_MAKE_FSELF, test "${MAKE_FSELF}" != "no")


dnl Are we on a Direct3D 9 platform?
ac_cv_my_have_d3d9="no"
AC_CHECK_HEADERS(d3d9.h, [ac_cv_my_have_d3d9="yes"])
if test "${ac_cv_my_have_d3d9}" != "no"; then
D3D_LIBS="${D3D_LIBS} -ld3d9 -ld3dx9"
AC_DEFINE(USE_D3D9, 1, Define to 1 to use DirectX 9)
fi
AM_CONDITIONAL(USE_D3D9, test "${ac_cv_my_have_d3d9}" != "no")


LIBS_save="$LIBS"
LIBS="$LIBS -Wl,-framework -Wl,OpenGL"
AC_MSG_CHECKING(for -framework OpenGL)
@@ -331,7 +341,7 @@ AM_CONDITIONAL(USE_GTKGL, test "${ac_cv_my_have_gtkgl}" != "no")
dnl How to use the Lol Engine inside this tree
LOL_CFLAGS="$LOL_CFLAGS -I \$(top_srcdir)/src"
LOL_CFLAGS="$LOL_CFLAGS $SDL_CFLAGS $GL_CFLAGS $EGL_CFLAGS $LIBPNG_CFLAGS"
LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS"
LOL_LIBS="$LOL_LIBS $SDL_LIBS $GL_LIBS $EGL_LIBS $LIBPNG_LIBS $D3D_LIBS"

AC_SUBST(MATH_LIBS)
AC_SUBST(LOL_CFLAGS)


+ 3
- 0
src/gpu/shader.cpp View File

@@ -20,6 +20,9 @@
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# if defined USE_D3D9
# include <algorithm>
using std::min;
using std::max;
# include <d3d9.h>
# include <d3dx9shader.h>
# endif


+ 2
- 2
src/platform/sdl/sdlapp.cpp View File

@@ -25,8 +25,9 @@
#include "platform/sdl/sdlapp.h"
#include "platform/sdl/sdlinput.h"

#if defined USE_D3D9
#if defined USE_SDL && defined USE_D3D9
HWND g_hwnd = NULL;
extern IDirect3DDevice9 *g_d3ddevice;
#endif

namespace lol
@@ -101,7 +102,6 @@ void SdlApp::Run()
while (!Ticker::Finished())
{
#if defined USE_SDL && defined USE_D3D9
extern IDirect3DDevice9 *g_d3ddevice;
g_d3ddevice->BeginScene();
#endif
/* Tick the renderer, show the frame and clamp to desired framerate. */


+ 4
- 1
src/platform/xbox/xboxapp.cpp View File

@@ -20,6 +20,10 @@
#include "lolgl.h"
#include "xboxapp.h"

#if defined _XBOX
extern D3DDevice *g_d3ddevice;
#endif

namespace lol
{

@@ -62,7 +66,6 @@ void XboxApp::Run()
Ticker::TickDraw();

#if defined _XBOX
extern D3DDevice *g_d3ddevice;
g_d3ddevice->Present(NULL, NULL, NULL, NULL);
#endif
}


+ 18
- 42
src/scene.cpp View File

@@ -61,11 +61,15 @@ private:
float angle;

#if defined USE_D3D9 || defined _XBOX
# define STR0(x) #x
# define STR(x) STR0(x)
# pragma message(__FILE__ "(" STR(__LINE__) "): warning: Scene not implemented")
# undef STR
# undef STR0
# if defined __GNUC__
# warning Scene not implemented
# else
# define STR0(x) #x
# define STR(x) STR0(x)
# pragma message(__FILE__ "(" STR(__LINE__) "): warning: Scene not implemented")
# undef STR
# undef STR0
# endif
#else
#if defined HAVE_GL_2X && !defined __APPLE__
GLuint vao;
@@ -91,29 +95,21 @@ Scene::Scene(float angle)
data->angle = angle;

#if defined USE_D3D9 || defined _XBOX
# define STR0(x) #x
# define STR(x) STR0(x)
# pragma message(__FILE__ "(" STR(__LINE__) "): warning: Scene::Scene() not implemented")
# undef STR
# undef STR0
/* TODO */
#else
data->bufs = 0;
data->nbufs = 0;
#endif

#if defined HAVE_GL_2X && !defined __APPLE__
# if defined HAVE_GL_2X && !defined __APPLE__
glGenVertexArrays(1, &data->vao);
# endif
#endif
}

Scene::~Scene()
{
#if defined USE_D3D9 || defined _XBOX
# define STR0(x) #x
# define STR(x) STR0(x)
# pragma message(__FILE__ "(" STR(__LINE__) "): warning: Scene::~Scene() not implemented")
# undef STR
# undef STR0
/* TODO */
#else
/* FIXME: this must be done while the GL context is still active.
* Change the code architecture to make sure of that. */
@@ -344,11 +340,7 @@ void Scene::Render() // XXX: rename to Blit()
stdshader->SetUniform(uni_mat, data->model_matrix);

#if defined USE_D3D9 || defined _XBOX
# define STR0(x) #x
# define STR(x) STR0(x)
# pragma message(__FILE__ "(" STR(__LINE__) "): warning: Scene::Render() not implemented")
# undef STR
# undef STR0
/* TODO */
#elif !defined __CELLOS_LV2__
uni_tex = stdshader->GetUniformLocation("in_Texture");
glUniform1i(uni_tex, 0);
@@ -359,11 +351,7 @@ void Scene::Render() // XXX: rename to Blit()
#endif

#if defined USE_D3D9 || defined _XBOX
# define STR0(x) #x
# define STR(x) STR0(x)
# pragma message(__FILE__ "(" STR(__LINE__) "): warning: Scene::Render() not implemented")
# undef STR
# undef STR0
/* TODO */
#else
#if !defined HAVE_GLES_2X
glEnable(GL_TEXTURE_2D);
@@ -381,11 +369,7 @@ void Scene::Render() // XXX: rename to Blit()
for (int buf = 0, i = 0, n; i < data->ntiles; i = n, buf += 2)
{
#if defined USE_D3D9 || defined _XBOX
# define STR0(x) #x
# define STR(x) STR0(x)
# pragma message(__FILE__ "(" STR(__LINE__) "): warning: Scene::Render() not implemented")
# undef STR
# undef STR0
/* TODO */
#else
/* Generate new vertex / texture coord buffers if necessary */
if (buf + 2 > data->nbufs)
@@ -423,11 +407,7 @@ void Scene::Render() // XXX: rename to Blit()
glBindVertexArray(data->vao);
#endif
#if defined USE_D3D9 || defined _XBOX
# define STR0(x) #x
# define STR(x) STR0(x)
# pragma message(__FILE__ "(" STR(__LINE__) "): warning: Scene::Render() not implemented")
# undef STR
# undef STR0
/* TODO */
#else
#if !defined __CELLOS_LV2__ // Use cgGLEnableClientState etc.
glEnableVertexAttribArray(attr_pos);
@@ -474,11 +454,7 @@ void Scene::Render() // XXX: rename to Blit()
data->ntiles = 0;

#if defined USE_D3D9 || defined _XBOX
# define STR0(x) #x
# define STR(x) STR0(x)
# pragma message(__FILE__ "(" STR(__LINE__) "): warning: Scene::Render() not implemented")
# undef STR
# undef STR0
/* TODO */
#else
#if !defined HAVE_GLES_2X
glDisable(GL_TEXTURE_2D);


Loading…
Cancel
Save