From 31580f42b16753791025e236e155fea3e64c2b70 Mon Sep 17 00:00:00 2001 From: Amit Feller Date: Mon, 27 Jun 2011 12:04:07 +0300 Subject: [PATCH] opengl renderer: windows runtime fix Need to initialize networking by calling WSAStartup in the renderer process. --- tools/emulator/opengl/host/renderer/Android.mk | 4 ++++ tools/emulator/opengl/host/renderer/main.cpp | 10 ++++++++++ .../opengl/tests/emulator_test_renderer/Android.mk | 4 ++++ .../opengl/tests/emulator_test_renderer/main.cpp | 10 +++++++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/tools/emulator/opengl/host/renderer/Android.mk b/tools/emulator/opengl/host/renderer/Android.mk index 553525087..7354edad0 100644 --- a/tools/emulator/opengl/host/renderer/Android.mk +++ b/tools/emulator/opengl/host/renderer/Android.mk @@ -21,6 +21,10 @@ LOCAL_C_INCLUDES := $(emulatorOpengl)/host/include \ $(emulatorOpengl)/shared/OpenglCodecCommon \ $(emulatorOpengl)/host/libs/libOpenglRender +ifeq ($(HOST_OS),windows) +LOCAL_LDLIBS += -lws2_32 +endif + LOCAL_SHARED_LIBRARIES := libOpenglRender \ libGLESv1_dec \ libGLESv2_dec \ diff --git a/tools/emulator/opengl/host/renderer/main.cpp b/tools/emulator/opengl/host/renderer/main.cpp index 73efe5953..128f96df3 100644 --- a/tools/emulator/opengl/host/renderer/main.cpp +++ b/tools/emulator/opengl/host/renderer/main.cpp @@ -22,6 +22,9 @@ #include #include #include +#ifdef _WIN32 +#include +#endif static void printUsage(const char *progName) @@ -92,6 +95,13 @@ int main(int argc, char *argv[]) printf("renderer pid %d , press any key to continue...\n", getpid()); getchar(); +#ifdef _WIN32 + WSADATA wsaData; + int rc = WSAStartup( MAKEWORD(2,2), &wsaData); + if (rc != 0) { + printf( "could not initialize Winsock\n" ); + } +#endif // // initialize Framebuffer // diff --git a/tools/emulator/opengl/tests/emulator_test_renderer/Android.mk b/tools/emulator/opengl/tests/emulator_test_renderer/Android.mk index 8ec1b9f85..7f5d4f5e4 100644 --- a/tools/emulator/opengl/tests/emulator_test_renderer/Android.mk +++ b/tools/emulator/opengl/tests/emulator_test_renderer/Android.mk @@ -16,6 +16,10 @@ SDL_LDLIBS := $(filter-out %.a %.lib,$(shell $(SDL_CONFIG) --static-libs)) LOCAL_CFLAGS += $(SDL_CFLAGS) -g -O0 LOCAL_LDLIBS += $(SDL_LDLIBS) +ifeq ($(HOST_OS),windows) +LOCAL_LDLIBS += -lws2_32 +endif + LOCAL_STATIC_LIBRARIES += libSDL libSDLmain $(call emugl-end-module) diff --git a/tools/emulator/opengl/tests/emulator_test_renderer/main.cpp b/tools/emulator/opengl/tests/emulator_test_renderer/main.cpp index 898cbd734..b0e49cdb8 100644 --- a/tools/emulator/opengl/tests/emulator_test_renderer/main.cpp +++ b/tools/emulator/opengl/tests/emulator_test_renderer/main.cpp @@ -21,6 +21,7 @@ #include "libOpenglRender/render_api.h" #ifdef _WIN32 +#include int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) #else int main(int argc, char *argv[]) @@ -50,8 +51,15 @@ int main(int argc, char *argv[]) SDL_GetWMInfo(&wminfo); #ifdef _WIN32 windowId = wminfo.window; -#else + WSADATA wsaData; + int rc = WSAStartup( MAKEWORD(2,2), &wsaData); + if (rc != 0) { + printf( "could not initialize Winsock\n" ); + } +#elif __linux__ windowId = wminfo.info.x11.window; +#elif __APPLE__ + windowId = wminfo.nsWindowPtr; #endif printf("initializing renderer process\n");