summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-19 22:15:21 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-19 22:15:21 +0000
commit6907f19accbde6269c3737b0ac17ff7d5686858a (patch)
treee679a054b5349448f20cf43a441ffacabf500e1f
parentfcdc18a51a39aa9f9a8961306eb583d17ee26289 (diff)
downloadchromium_src-6907f19accbde6269c3737b0ac17ff7d5686858a.zip
chromium_src-6907f19accbde6269c3737b0ac17ff7d5686858a.tar.gz
chromium_src-6907f19accbde6269c3737b0ac17ff7d5686858a.tar.bz2
Fixed gles2 demo by switching it from a console application to a windowed one. The HINSTANCE it was getting from the console was invalid for some reason.
TEST=none BUG=none Review URL: http://codereview.chromium.org/542119 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36558 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--gpu/command_buffer/client/gles2_demo.cc29
-rw-r--r--gpu/gpu.gyp8
2 files changed, 26 insertions, 11 deletions
diff --git a/gpu/command_buffer/client/gles2_demo.cc b/gpu/command_buffer/client/gles2_demo.cc
index 5b99f01..2b96ba8 100644
--- a/gpu/command_buffer/client/gles2_demo.cc
+++ b/gpu/command_buffer/client/gles2_demo.cc
@@ -31,6 +31,10 @@ using gpu::CommandBufferService;
using gpu::gles2::GLES2CmdHelper;
using gpu::gles2::GLES2Implementation;
+#if defined(OS_WIN)
+HINSTANCE g_instance;
+#endif
+
class GLES2Demo {
public:
GLES2Demo();
@@ -104,11 +108,6 @@ LRESULT CALLBACK WindowProc(
return 0;
}
-HINSTANCE GetInstance(void) {
- HWND hwnd = GetConsoleWindow();
- return reinterpret_cast<HINSTANCE>(GetWindowLong(hwnd, GWL_HINSTANCE));
-}
-
void ProcessMessages(void* in_hwnd) {
HWND hwnd = reinterpret_cast<HWND>(in_hwnd);
MSG msg;
@@ -133,7 +132,6 @@ void ProcessMessages(void* in_hwnd) {
void* SetupWindow() {
#if defined(OS_WIN)
- HINSTANCE instance = GetInstance();
WNDCLASSEX wc = {0};
wc.lpszClassName = L"MY_WINDOWS_CLASS";
wc.cbSize = sizeof(WNDCLASSEX);
@@ -141,10 +139,10 @@ void* SetupWindow() {
wc.lpfnWndProc = ::WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
- wc.hInstance = instance;
- wc.hIcon = ::LoadIcon(instance, IDI_APPLICATION);
+ wc.hInstance = g_instance;
+ wc.hIcon = ::LoadIcon(g_instance, IDI_APPLICATION);
wc.hIconSm = NULL;
- wc.hCursor = ::LoadCursor(instance, IDC_ARROW);
+ wc.hCursor = ::LoadCursor(g_instance, IDC_ARROW);
wc.hbrBackground = static_cast<HBRUSH>(::GetStockObject(BLACK_BRUSH));
wc.lpszMenuName = NULL;
@@ -165,7 +163,7 @@ void* SetupWindow() {
512,
0,
0,
- instance,
+ g_instance,
0);
if (hwnd == NULL) {
@@ -181,7 +179,16 @@ void* SetupWindow() {
#endif
}
-int main(int argc, const char** argv) {
+#if defined(OS_WIN)
+int WINAPI WinMain(HINSTANCE instance,
+ HINSTANCE prev_instance,
+ LPSTR command_line,
+ int command_show) {
+ g_instance = instance;
+#else
+int main(int argc, char** argv) {
+#endif
+
const int32 kCommandBufferSize = 1024 * 1024;
base::AtExitManager at_exit_manager;
diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp
index 3185f5b..38e8059 100644
--- a/gpu/gpu.gyp
+++ b/gpu/gpu.gyp
@@ -400,6 +400,14 @@
'sources': [
'command_buffer/client/gles2_demo.cc',
],
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ # 0 == not set
+ # 1 == /SUBSYSTEM:CONSOLE
+ # 2 == /SUBSYSTEM:WINDOWS
+ 'SubSystem': '2',
+ },
+ },
},
],
},