d3d1x: CRLF -> LF in progs
authorLuca Barbieri <luca@luca-barbieri.com>
Fri, 24 Sep 2010 13:08:57 +0000 (15:08 +0200)
committerLuca Barbieri <luca@luca-barbieri.com>
Fri, 24 Sep 2010 13:12:20 +0000 (15:12 +0200)
26 files changed:
src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10app.h
src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10winmain.cpp
src/gallium/state_trackers/d3d1x/progs/d3d10app/d3d10x11main.cpp
src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.cpp
src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.ps.h
src/gallium/state_trackers/d3d1x/progs/d3d10tri/d3d10tri.hlsl.vs.h
src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11app.h
src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.ps.h
src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11blit.hlsl.vs.h
src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11u.h
src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11winmain.cpp
src/gallium/state_trackers/d3d1x/progs/d3d11app/d3d11x11main.cpp
src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.cpp
src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.ps.h
src/gallium/state_trackers/d3d1x/progs/d3d11gears/d3d11gears.hlsl.vs.h
src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.cpp
src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ds.h
src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.hs.h
src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.ps.h
src/gallium/state_trackers/d3d1x/progs/d3d11spikysphere/d3d11spikysphere.hlsl.vs.h
src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.cpp
src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.ps.h
src/gallium/state_trackers/d3d1x/progs/d3d11tex/d3d11tex.hlsl.vs.h
src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.cpp
src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.ps.h
src/gallium/state_trackers/d3d1x/progs/d3d11tri/d3d11tri.hlsl.vs.h

index c27e66e..59fe338 100755 (executable)
@@ -1,51 +1,51 @@
-/**************************************************************************\r
- *\r
- * Copyright 2010 Luca Barbieri\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining\r
- * a copy of this software and associated documentation files (the\r
- * "Software"), to deal in the Software without restriction, including\r
- * without limitation the rights to use, copy, modify, merge, publish,\r
- * distribute, sublicense, and/or sell copies of the Software, and to\r
- * permit persons to whom the Software is furnished to do so, subject to\r
- * the following conditions:\r
- *\r
- * The above copyright notice and this permission notice (including the\r
- * next paragraph) shall be included in all copies or substantial\r
- * portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE\r
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- **************************************************************************/\r
-\r
-#ifndef D3D10APP_H\r
-#define D3D10APP_H\r
-\r
-#define WIN32_LEAN_AND_MEAN\r
-#include <windows.h>\r
-#include <objbase.h>\r
-#include <d3d10_1.h>\r
-#include <assert.h>\r
-#include <stdio.h>\r
-#include <float.h>\r
-\r
-#define ensure(x) do {HRESULT __hr = (x); if(!SUCCEEDED(__hr)) {fprintf(stderr, "COM error %08x\n", __hr); abort();}} while(0)\r
-\r
-struct d3d10_application\r
-{\r
-       virtual ~d3d10_application() {}\r
-\r
-       virtual void draw(ID3D10Device* ctx, ID3D10RenderTargetView* rtv, unsigned width, unsigned height, double time) = 0;\r
-       virtual bool init(ID3D10Device* dev, int argc, char** argv) = 0;\r
-};\r
-\r
-/* this is the entry point you must provide */\r
-extern "C" d3d10_application* d3d10_application_create();\r
-\r
-#endif\r
+/**************************************************************************
+ *
+ * Copyright 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef D3D10APP_H
+#define D3D10APP_H
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <objbase.h>
+#include <d3d10_1.h>
+#include <assert.h>
+#include <stdio.h>
+#include <float.h>
+
+#define ensure(x) do {HRESULT __hr = (x); if(!SUCCEEDED(__hr)) {fprintf(stderr, "COM error %08x\n", __hr); abort();}} while(0)
+
+struct d3d10_application
+{
+       virtual ~d3d10_application() {}
+
+       virtual void draw(ID3D10Device* ctx, ID3D10RenderTargetView* rtv, unsigned width, unsigned height, double time) = 0;
+       virtual bool init(ID3D10Device* dev, int argc, char** argv) = 0;
+};
+
+/* this is the entry point you must provide */
+extern "C" d3d10_application* d3d10_application_create();
+
+#endif
index ac4798a..9468097 100755 (executable)
-/**************************************************************************\r
- *\r
- * Copyright 2010 Luca Barbieri\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining\r
- * a copy of this software and associated documentation files (the\r
- * "Software"), to deal in the Software without restriction, including\r
- * without limitation the rights to use, copy, modify, merge, publish,\r
- * distribute, sublicense, and/or sell copies of the Software, and to\r
- * permit persons to whom the Software is furnished to do so, subject to\r
- * the following conditions:\r
- *\r
- * The above copyright notice and this permission notice (including the\r
- * next paragraph) shall be included in all copies or substantial\r
- * portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE\r
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- **************************************************************************/\r
-\r
-#define INITGUID\r
-#include "d3d10app.h"\r
-#include "stdio.h"\r
-\r
-static d3d10_application* app;\r
-static IDXGISwapChain* swap_chain;\r
-static unsigned width, height;\r
-static DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM;\r
-static ID3D10Device* dev;\r
-static ID3D10Device* ctx;\r
-static int frames = 0;\r
-static int buffer_count = 1;\r
-\r
-LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)\r
-{\r
-       switch (message)\r
-       {\r
-       case WM_SIZE:\r
-               width = lParam & 0xffff;\r
-               height = lParam >> 16;\r
-               \r
-               swap_chain->ResizeBuffers(buffer_count, width, height, format, 0);\r
-               frames = 0;\r
-               break;\r
-       case WM_DESTROY:\r
-               PostQuitMessage(0);\r
-               break;\r
-       default:\r
-               return DefWindowProc(hwnd, message, wParam, lParam);\r
-       }\r
-       return 0;\r
-}\r
-\r
-int main(int argc, char** argv)\r
-{\r
-       HINSTANCE hInstance = GetModuleHandle(NULL);\r
-       WNDCLASSEXA wcex;\r
-\r
-       wcex.cbSize = sizeof(WNDCLASSEX);\r
-\r
-       wcex.style              = CS_HREDRAW | CS_VREDRAW;\r
-       wcex.lpfnWndProc        = WndProc;\r
-       wcex.cbClsExtra         = 0;\r
-       wcex.cbWndExtra         = 0;\r
-       wcex.hInstance          = hInstance;\r
-       wcex.hIcon              = 0;\r
-       wcex.hCursor            = LoadCursor(NULL, IDC_ARROW);\r
-       wcex.hbrBackground      = (HBRUSH)(COLOR_WINDOW+1);\r
-       wcex.lpszMenuName       = 0;\r
-       wcex.lpszClassName      = "d3d10";\r
-       wcex.hIconSm            = 0;\r
-\r
-       RegisterClassExA(&wcex);\r
-\r
-       HWND hwnd = CreateWindowA("d3d10", "d3d10", WS_OVERLAPPEDWINDOW,\r
-               CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);\r
-\r
-       if(!hwnd)\r
-               return FALSE;\r
-\r
-       RECT rc;\r
-       GetClientRect(hwnd, &rc );\r
-       width = rc.right - rc.left;\r
-       height = rc.bottom - rc.top;\r
-\r
-       DXGI_SWAP_CHAIN_DESC swap_chain_desc;\r
-       memset(&swap_chain_desc, 0, sizeof(swap_chain_desc));\r
-       swap_chain_desc.BufferDesc.Width = width;\r
-       swap_chain_desc.BufferDesc.Height = height;\r
-       swap_chain_desc.BufferDesc.Format = format;\r
-       swap_chain_desc.SampleDesc.Count = 1;\r
-       swap_chain_desc.SampleDesc.Quality = 0;\r
-       swap_chain_desc.OutputWindow = hwnd;\r
-       swap_chain_desc.Windowed = TRUE;\r
-       swap_chain_desc.BufferCount = buffer_count;\r
-       swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;\r
-       swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;\r
-       swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;\r
-\r
-       D3D10_FEATURE_LEVEL1 feature_level = D3D10_FEATURE_LEVEL_10_0;\r
-\r
-       HRESULT hr;\r
-       if(1)\r
-       {\r
-               hr = D3D10CreateDeviceAndSwapChain(\r
-                       NULL,\r
-                       D3D10_DRIVER_TYPE_HARDWARE,\r
-                       NULL,\r
-                       D3D10_CREATE_DEVICE_SINGLETHREADED, // | D3D10_CREATE_DEVICE_DEBUG,\r
-                       D3D10_SDK_VERSION,\r
-                       &swap_chain_desc,\r
-                       &swap_chain,\r
-                       &dev);\r
-       }\r
-       else\r
-       {\r
-               hr = D3D10CreateDeviceAndSwapChain1(\r
-                       NULL,\r
-                       D3D10_DRIVER_TYPE_HARDWARE,\r
-                       NULL,\r
-                       D3D10_CREATE_DEVICE_SINGLETHREADED, // | D3D10_CREATE_DEVICE_DEBUG,\r
-                       feature_level,\r
-                       D3D10_SDK_VERSION,\r
-                       &swap_chain_desc,\r
-                       &swap_chain,\r
-                       (ID3D10Device1**)&dev);\r
-       }\r
-\r
-       if(!SUCCEEDED(hr))\r
-       {\r
-               fprintf(stderr, "Failed to create D3D10 device (hresult %08x)\n", hr);\r
-               return 1;\r
-       }\r
-\r
-       ctx = dev;\r
-\r
-       app = d3d10_application_create();\r
-       if(!app->init(dev, argc, argv))\r
-               return 1;\r
-\r
-       ShowWindow(hwnd, SW_SHOWDEFAULT);\r
-       UpdateWindow(hwnd);\r
-\r
-       LARGE_INTEGER freq;\r
-       QueryPerformanceFrequency(&freq);\r
-       double period = 1.0 / (double)freq.QuadPart;\r
-       LARGE_INTEGER ctime_li;\r
-       QueryPerformanceCounter(&ctime_li);\r
-       double start_time = ctime_li.QuadPart * period;\r
-\r
-       MSG msg;\r
-       for(;;)\r
-       {\r
-               if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))\r
-               {\r
-                       if(msg.message == WM_QUIT)\r
-                               break;\r
-                       TranslateMessage(&msg);\r
-                       DispatchMessage(&msg);\r
-               }\r
-               else if(width && height)\r
-               {\r
-                       ID3D10Texture2D* tex;\r
-                       static ID3D10RenderTargetView* rtv;\r
-                       ensure(swap_chain->GetBuffer(0, __uuidof(tex), (void**)&tex));\r
-                       ensure(dev->CreateRenderTargetView(tex, NULL, &rtv));\r
-\r
-                       QueryPerformanceCounter(&ctime_li);\r
-                       double ctime = (double)ctime_li.QuadPart * period - start_time;\r
-\r
-                       app->draw(ctx, rtv, width, height, ctime);\r
-                       ctx->OMSetRenderTargets(0, 0, 0);\r
-\r
-                       swap_chain->Present(0, 0);\r
-                       rtv->Release();\r
-                       tex->Release();\r
-               }\r
-               else\r
-                       WaitMessage();\r
-       }\r
-       return (int) msg.wParam;\r
-}\r
+/**************************************************************************
+ *
+ * Copyright 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#define INITGUID
+#include "d3d10app.h"
+#include "stdio.h"
+
+static d3d10_application* app;
+static IDXGISwapChain* swap_chain;
+static unsigned width, height;
+static DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM;
+static ID3D10Device* dev;
+static ID3D10Device* ctx;
+static int frames = 0;
+static int buffer_count = 1;
+
+LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+       switch (message)
+       {
+       case WM_SIZE:
+               width = lParam & 0xffff;
+               height = lParam >> 16;
+               
+               swap_chain->ResizeBuffers(buffer_count, width, height, format, 0);
+               frames = 0;
+               break;
+       case WM_DESTROY:
+               PostQuitMessage(0);
+               break;
+       default:
+               return DefWindowProc(hwnd, message, wParam, lParam);
+       }
+       return 0;
+}
+
+int main(int argc, char** argv)
+{
+       HINSTANCE hInstance = GetModuleHandle(NULL);
+       WNDCLASSEXA wcex;
+
+       wcex.cbSize = sizeof(WNDCLASSEX);
+
+       wcex.style              = CS_HREDRAW | CS_VREDRAW;
+       wcex.lpfnWndProc        = WndProc;
+       wcex.cbClsExtra         = 0;
+       wcex.cbWndExtra         = 0;
+       wcex.hInstance          = hInstance;
+       wcex.hIcon              = 0;
+       wcex.hCursor            = LoadCursor(NULL, IDC_ARROW);
+       wcex.hbrBackground      = (HBRUSH)(COLOR_WINDOW+1);
+       wcex.lpszMenuName       = 0;
+       wcex.lpszClassName      = "d3d10";
+       wcex.hIconSm            = 0;
+
+       RegisterClassExA(&wcex);
+
+       HWND hwnd = CreateWindowA("d3d10", "d3d10", WS_OVERLAPPEDWINDOW,
+               CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
+
+       if(!hwnd)
+               return FALSE;
+
+       RECT rc;
+       GetClientRect(hwnd, &rc );
+       width = rc.right - rc.left;
+       height = rc.bottom - rc.top;
+
+       DXGI_SWAP_CHAIN_DESC swap_chain_desc;
+       memset(&swap_chain_desc, 0, sizeof(swap_chain_desc));
+       swap_chain_desc.BufferDesc.Width = width;
+       swap_chain_desc.BufferDesc.Height = height;
+       swap_chain_desc.BufferDesc.Format = format;
+       swap_chain_desc.SampleDesc.Count = 1;
+       swap_chain_desc.SampleDesc.Quality = 0;
+       swap_chain_desc.OutputWindow = hwnd;
+       swap_chain_desc.Windowed = TRUE;
+       swap_chain_desc.BufferCount = buffer_count;
+       swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
+       swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+       swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
+
+       D3D10_FEATURE_LEVEL1 feature_level = D3D10_FEATURE_LEVEL_10_0;
+
+       HRESULT hr;
+       if(1)
+       {
+               hr = D3D10CreateDeviceAndSwapChain(
+                       NULL,
+                       D3D10_DRIVER_TYPE_HARDWARE,
+                       NULL,
+                       D3D10_CREATE_DEVICE_SINGLETHREADED, // | D3D10_CREATE_DEVICE_DEBUG,
+                       D3D10_SDK_VERSION,
+                       &swap_chain_desc,
+                       &swap_chain,
+                       &dev);
+       }
+       else
+       {
+               hr = D3D10CreateDeviceAndSwapChain1(
+                       NULL,
+                       D3D10_DRIVER_TYPE_HARDWARE,
+                       NULL,
+                       D3D10_CREATE_DEVICE_SINGLETHREADED, // | D3D10_CREATE_DEVICE_DEBUG,
+                       feature_level,
+                       D3D10_SDK_VERSION,
+                       &swap_chain_desc,
+                       &swap_chain,
+                       (ID3D10Device1**)&dev);
+       }
+
+       if(!SUCCEEDED(hr))
+       {
+               fprintf(stderr, "Failed to create D3D10 device (hresult %08x)\n", hr);
+               return 1;
+       }
+
+       ctx = dev;
+
+       app = d3d10_application_create();
+       if(!app->init(dev, argc, argv))
+               return 1;
+
+       ShowWindow(hwnd, SW_SHOWDEFAULT);
+       UpdateWindow(hwnd);
+
+       LARGE_INTEGER freq;
+       QueryPerformanceFrequency(&freq);
+       double period = 1.0 / (double)freq.QuadPart;
+       LARGE_INTEGER ctime_li;
+       QueryPerformanceCounter(&ctime_li);
+       double start_time = ctime_li.QuadPart * period;
+
+       MSG msg;
+       for(;;)
+       {
+               if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+               {
+                       if(msg.message == WM_QUIT)
+                               break;
+                       TranslateMessage(&msg);
+                       DispatchMessage(&msg);
+               }
+               else if(width && height)
+               {
+                       ID3D10Texture2D* tex;
+                       static ID3D10RenderTargetView* rtv;
+                       ensure(swap_chain->GetBuffer(0, __uuidof(tex), (void**)&tex));
+                       ensure(dev->CreateRenderTargetView(tex, NULL, &rtv));
+
+                       QueryPerformanceCounter(&ctime_li);
+                       double ctime = (double)ctime_li.QuadPart * period - start_time;
+
+                       app->draw(ctx, rtv, width, height, ctime);
+                       ctx->OMSetRenderTargets(0, 0, 0);
+
+                       swap_chain->Present(0, 0);
+                       rtv->Release();
+                       tex->Release();
+               }
+               else
+                       WaitMessage();
+       }
+       return (int) msg.wParam;
+}
index efbe322..8f07380 100755 (executable)
-/**************************************************************************\r
- *\r
- * Copyright 2010 Luca Barbieri\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining\r
- * a copy of this software and associated documentation files (the\r
- * "Software"), to deal in the Software without restriction, including\r
- * without limitation the rights to use, copy, modify, merge, publish,\r
- * distribute, sublicense, and/or sell copies of the Software, and to\r
- * permit persons to whom the Software is furnished to do so, subject to\r
- * the following conditions:\r
- *\r
- * The above copyright notice and this permission notice (including the\r
- * next paragraph) shall be included in all copies or substantial\r
- * portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE\r
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- **************************************************************************/\r
-\r
-#include "d3d10app.h"\r
-#include <X11/Xlib.h>\r
-#include <galliumdxgi.h>\r
-#include <sys/time.h>\r
-\r
-static d3d10_application* app;\r
-static IDXGISwapChain* swap_chain;\r
-unsigned width, height;\r
-DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM;\r
-static ID3D10Device* dev;\r
-static ID3D10Device* ctx;\r
-\r
-double get_time()\r
-{\r
-       struct timeval tv;\r
-       gettimeofday(&tv, 0);\r
-       return (double)tv.tv_sec + (double)tv.tv_usec * 0.000001;\r
-}\r
-\r
-int main(int argc, char** argv)\r
-{\r
-       Display* dpy = XOpenDisplay(0);\r
-       Visual* visual = DefaultVisual(dpy, DefaultScreen(dpy));\r
-       Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, DefaultScreen(dpy)), visual, AllocNone);\r
-       XSetWindowAttributes swa;\r
-       swa.colormap = cmap;\r
-       swa.border_pixel = 0;\r
-       swa.event_mask = StructureNotifyMask;\r
-       width = 512;\r
-       height = 512;\r
-       Window win = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, width, height, 0, CopyFromParent, InputOutput, visual, CWBorderPixel | CWColormap| CWEventMask, &swa);\r
-       XMapWindow(dpy, win);\r
-\r
-       GalliumDXGIUseX11Display(dpy, 0);\r
-\r
-       DXGI_SWAP_CHAIN_DESC swap_chain_desc;\r
-       memset(&swap_chain_desc, 0, sizeof(swap_chain_desc));\r
-       swap_chain_desc.BufferDesc.Width = width;\r
-       swap_chain_desc.BufferDesc.Height = height;\r
-       swap_chain_desc.BufferDesc.Format = format;\r
-       swap_chain_desc.SampleDesc.Count = 1;\r
-       swap_chain_desc.SampleDesc.Quality = 0;\r
-       swap_chain_desc.OutputWindow = (HWND)win;\r
-       swap_chain_desc.Windowed = TRUE;\r
-       swap_chain_desc.BufferCount = 3;\r
-       swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;\r
-       swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;\r
-\r
-       D3D10_FEATURE_LEVEL1 feature_level = D3D10_FEATURE_LEVEL_10_0;\r
-\r
-       HRESULT hr;\r
-       if(0)\r
-       {\r
-               hr = D3D10CreateDeviceAndSwapChain(\r
-                       NULL,\r
-                       D3D10_DRIVER_TYPE_HARDWARE,\r
-                       NULL,\r
-                       D3D10_CREATE_DEVICE_SINGLETHREADED,\r
-                       D3D10_SDK_VERSION,\r
-                       &swap_chain_desc,\r
-                       &swap_chain,\r
-                       &dev);\r
-       }\r
-       else\r
-       {\r
-               hr = D3D10CreateDeviceAndSwapChain1(\r
-                       NULL,\r
-                       D3D10_DRIVER_TYPE_HARDWARE,\r
-                       NULL,\r
-                       D3D10_CREATE_DEVICE_SINGLETHREADED,\r
-                       feature_level,\r
-                       D3D10_SDK_VERSION,\r
-                       &swap_chain_desc,\r
-                       &swap_chain,\r
-                       (ID3D10Device1**)&dev);\r
-       }\r
-       if(!SUCCEEDED(hr))\r
-       {\r
-               fprintf(stderr, "Failed to create D3D10 device (hresult %08x)\n", hr);\r
-               return 1;\r
-       }\r
-       ctx = dev;\r
-\r
-       app = d3d10_application_create();\r
-       if(!app->init(dev, argc, argv))\r
-               return 1;\r
-\r
-       double start_time = get_time();\r
-\r
-       MSG msg;\r
-       for(;;)\r
-       {\r
-               XEvent event;\r
-               if(XPending(dpy))\r
-               {\r
-                       XNextEvent(dpy, &event);\r
-                       if(event.type == DestroyNotify)\r
-                               break;\r
-                       switch(event.type)\r
-                       {\r
-                       case ConfigureNotify:\r
-                               width = event.xconfigure.width;\r
-                               height = event.xconfigure.height;\r
-                               swap_chain->ResizeBuffers(3, width, height, format, 0);\r
-                               break;\r
-                       }\r
-               }\r
-               else if(width && height)\r
-               {\r
-                       ID3D10Texture2D* tex;\r
-                       ID3D10RenderTargetView* rtv;\r
-                       ensure(swap_chain->GetBuffer(0, IID_ID3D10Texture2D, (void**)&tex));\r
-                       ensure(dev->CreateRenderTargetView(tex, NULL, &rtv));\r
-\r
-                       double ctime = get_time() - start_time;\r
-\r
-                       app->draw(ctx, rtv, width, height, ctime);\r
-                       ctx->OMSetRenderTargets(0, 0, 0);\r
-\r
-                       tex->Release();\r
-                       rtv->Release();\r
-                       swap_chain->Present(0, 0);\r
-               }\r
-               else\r
-                       XPeekEvent(dpy, &event);\r
-       }\r
-       return (int) msg.wParam;\r
-}\r
+/**************************************************************************
+ *
+ * Copyright 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "d3d10app.h"
+#include <X11/Xlib.h>
+#include <galliumdxgi.h>
+#include <sys/time.h>
+
+static d3d10_application* app;
+static IDXGISwapChain* swap_chain;
+unsigned width, height;
+DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM;
+static ID3D10Device* dev;
+static ID3D10Device* ctx;
+
+double get_time()
+{
+       struct timeval tv;
+       gettimeofday(&tv, 0);
+       return (double)tv.tv_sec + (double)tv.tv_usec * 0.000001;
+}
+
+int main(int argc, char** argv)
+{
+       Display* dpy = XOpenDisplay(0);
+       Visual* visual = DefaultVisual(dpy, DefaultScreen(dpy));
+       Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, DefaultScreen(dpy)), visual, AllocNone);
+       XSetWindowAttributes swa;
+       swa.colormap = cmap;
+       swa.border_pixel = 0;
+       swa.event_mask = StructureNotifyMask;
+       width = 512;
+       height = 512;
+       Window win = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, width, height, 0, CopyFromParent, InputOutput, visual, CWBorderPixel | CWColormap| CWEventMask, &swa);
+       XMapWindow(dpy, win);
+
+       GalliumDXGIUseX11Display(dpy, 0);
+
+       DXGI_SWAP_CHAIN_DESC swap_chain_desc;
+       memset(&swap_chain_desc, 0, sizeof(swap_chain_desc));
+       swap_chain_desc.BufferDesc.Width = width;
+       swap_chain_desc.BufferDesc.Height = height;
+       swap_chain_desc.BufferDesc.Format = format;
+       swap_chain_desc.SampleDesc.Count = 1;
+       swap_chain_desc.SampleDesc.Quality = 0;
+       swap_chain_desc.OutputWindow = (HWND)win;
+       swap_chain_desc.Windowed = TRUE;
+       swap_chain_desc.BufferCount = 3;
+       swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
+       swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+
+       D3D10_FEATURE_LEVEL1 feature_level = D3D10_FEATURE_LEVEL_10_0;
+
+       HRESULT hr;
+       if(0)
+       {
+               hr = D3D10CreateDeviceAndSwapChain(
+                       NULL,
+                       D3D10_DRIVER_TYPE_HARDWARE,
+                       NULL,
+                       D3D10_CREATE_DEVICE_SINGLETHREADED,
+                       D3D10_SDK_VERSION,
+                       &swap_chain_desc,
+                       &swap_chain,
+                       &dev);
+       }
+       else
+       {
+               hr = D3D10CreateDeviceAndSwapChain1(
+                       NULL,
+                       D3D10_DRIVER_TYPE_HARDWARE,
+                       NULL,
+                       D3D10_CREATE_DEVICE_SINGLETHREADED,
+                       feature_level,
+                       D3D10_SDK_VERSION,
+                       &swap_chain_desc,
+                       &swap_chain,
+                       (ID3D10Device1**)&dev);
+       }
+       if(!SUCCEEDED(hr))
+       {
+               fprintf(stderr, "Failed to create D3D10 device (hresult %08x)\n", hr);
+               return 1;
+       }
+       ctx = dev;
+
+       app = d3d10_application_create();
+       if(!app->init(dev, argc, argv))
+               return 1;
+
+       double start_time = get_time();
+
+       MSG msg;
+       for(;;)
+       {
+               XEvent event;
+               if(XPending(dpy))
+               {
+                       XNextEvent(dpy, &event);
+                       if(event.type == DestroyNotify)
+                               break;
+                       switch(event.type)
+                       {
+                       case ConfigureNotify:
+                               width = event.xconfigure.width;
+                               height = event.xconfigure.height;
+                               swap_chain->ResizeBuffers(3, width, height, format, 0);
+                               break;
+                       }
+               }
+               else if(width && height)
+               {
+                       ID3D10Texture2D* tex;
+                       ID3D10RenderTargetView* rtv;
+                       ensure(swap_chain->GetBuffer(0, IID_ID3D10Texture2D, (void**)&tex));
+                       ensure(dev->CreateRenderTargetView(tex, NULL, &rtv));
+
+                       double ctime = get_time() - start_time;
+
+                       app->draw(ctx, rtv, width, height, ctime);
+                       ctx->OMSetRenderTargets(0, 0, 0);
+
+                       tex->Release();
+                       rtv->Release();
+                       swap_chain->Present(0, 0);
+               }
+               else
+                       XPeekEvent(dpy, &event);
+       }
+       return (int) msg.wParam;
+}
index 06ad811..90b97f8 100755 (executable)
-/**************************************************************************\r
- *\r
- * Copyright 2010 Luca Barbieri\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining\r
- * a copy of this software and associated documentation files (the\r
- * "Software"), to deal in the Software without restriction, including\r
- * without limitation the rights to use, copy, modify, merge, publish,\r
- * distribute, sublicense, and/or sell copies of the Software, and to\r
- * permit persons to whom the Software is furnished to do so, subject to\r
- * the following conditions:\r
- *\r
- * The above copyright notice and this permission notice (including the\r
- * next paragraph) shall be included in all copies or substantial\r
- * portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE\r
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- **************************************************************************/\r
-\r
-#include "d3d10app.h"\r
-#include "d3d10tri.hlsl.ps.h"\r
-#include "d3d10tri.hlsl.vs.h"\r
-\r
-struct vertex {\r
- float position[4];\r
- float color[4];\r
-};\r
-\r
-static struct vertex vertices[3] =\r
-{\r
- {\r
-        { 0.0f, 0.9f, 0.5f, 1.0f },\r
-        { 1.0f, 0.0f, 0.0f, 1.0f }\r
- },\r
- {\r
-        { 0.9f, -0.9f, 0.5f, 1.0f },\r
-        { 0.0f, 0.0f, 1.0f, 1.0f }\r
- },\r
- {\r
-        { -0.9f, -0.9f, 0.5f, 1.0f },\r
-        { 0.0f, 1.0f, 0.0f, 1.0f }\r
- },\r
-};\r
-\r
-struct d3d10tri : public d3d10_application\r
-{\r
-       ID3D10PixelShader* ps;\r
-       ID3D10VertexShader* vs;\r
-       ID3D10InputLayout* layout;\r
-       ID3D10Buffer* vb;\r
-\r
-       virtual bool init(ID3D10Device* dev, int argc, char** argv)\r
-       {\r
-               ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), &ps));\r
-               ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), &vs));\r
-\r
-               D3D10_INPUT_ELEMENT_DESC elements[] =\r
-               {\r
-                       {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0},\r
-                       {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D10_INPUT_PER_VERTEX_DATA, 0},\r
-               };\r
-\r
-               ensure(dev->CreateInputLayout(elements, sizeof(elements) / sizeof(elements[0]), g_vs, sizeof(g_vs), &layout));\r
-               D3D10_BUFFER_DESC bufferd;\r
-               bufferd.ByteWidth = sizeof(vertices);\r
-               bufferd.Usage = D3D10_USAGE_IMMUTABLE;\r
-               bufferd.BindFlags = D3D10_BIND_VERTEX_BUFFER;\r
-               bufferd.CPUAccessFlags = 0;\r
-               bufferd.MiscFlags = 0;\r
-\r
-               D3D10_SUBRESOURCE_DATA buffersd;\r
-               buffersd.pSysMem = vertices;\r
-               buffersd.SysMemPitch = sizeof(vertices);\r
-               buffersd.SysMemSlicePitch = sizeof(vertices);\r
-\r
-               ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb));\r
-\r
-               return true;\r
-       }\r
-\r
-       virtual void draw(ID3D10Device* ctx, ID3D10RenderTargetView* rtv, unsigned width, unsigned height, double time)\r
-       {\r
-               float clear_color[4] = {1, 0, 1, 1};\r
-               D3D10_VIEWPORT vp;\r
-               memset(&vp, 0, sizeof(vp));\r
-               vp.Width = (unsigned)width;\r
-               vp.Height = (unsigned)height;\r
-               vp.MaxDepth = 1.0f;\r
-\r
-               ctx->OMSetRenderTargets(1, &rtv, 0);\r
-               ctx->RSSetViewports(1, &vp);\r
-\r
-               ctx->ClearRenderTargetView(rtv, clear_color);\r
-\r
-               ctx->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);\r
-               ctx->IASetInputLayout(layout);\r
-               unsigned stride = 2 * 4 * 4;\r
-               unsigned offset = 0;\r
-               ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset);\r
-\r
-               ctx->VSSetShader(vs);\r
-               ctx->PSSetShader(ps);   \r
-\r
-               ctx->Draw(3, 0);\r
-       }\r
-};\r
-\r
-d3d10_application* d3d10_application_create()\r
-{\r
-       return new d3d10tri();\r
-}\r
+/**************************************************************************
+ *
+ * Copyright 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "d3d10app.h"
+#include "d3d10tri.hlsl.ps.h"
+#include "d3d10tri.hlsl.vs.h"
+
+struct vertex {
+ float position[4];
+ float color[4];
+};
+
+static struct vertex vertices[3] =
+{
+ {
+        { 0.0f, 0.9f, 0.5f, 1.0f },
+        { 1.0f, 0.0f, 0.0f, 1.0f }
+ },
+ {
+        { 0.9f, -0.9f, 0.5f, 1.0f },
+        { 0.0f, 0.0f, 1.0f, 1.0f }
+ },
+ {
+        { -0.9f, -0.9f, 0.5f, 1.0f },
+        { 0.0f, 1.0f, 0.0f, 1.0f }
+ },
+};
+
+struct d3d10tri : public d3d10_application
+{
+       ID3D10PixelShader* ps;
+       ID3D10VertexShader* vs;
+       ID3D10InputLayout* layout;
+       ID3D10Buffer* vb;
+
+       virtual bool init(ID3D10Device* dev, int argc, char** argv)
+       {
+               ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), &ps));
+               ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), &vs));
+
+               D3D10_INPUT_ELEMENT_DESC elements[] =
+               {
+                       {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0},
+                       {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D10_INPUT_PER_VERTEX_DATA, 0},
+               };
+
+               ensure(dev->CreateInputLayout(elements, sizeof(elements) / sizeof(elements[0]), g_vs, sizeof(g_vs), &layout));
+               D3D10_BUFFER_DESC bufferd;
+               bufferd.ByteWidth = sizeof(vertices);
+               bufferd.Usage = D3D10_USAGE_IMMUTABLE;
+               bufferd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
+               bufferd.CPUAccessFlags = 0;
+               bufferd.MiscFlags = 0;
+
+               D3D10_SUBRESOURCE_DATA buffersd;
+               buffersd.pSysMem = vertices;
+               buffersd.SysMemPitch = sizeof(vertices);
+               buffersd.SysMemSlicePitch = sizeof(vertices);
+
+               ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb));
+
+               return true;
+       }
+
+       virtual void draw(ID3D10Device* ctx, ID3D10RenderTargetView* rtv, unsigned width, unsigned height, double time)
+       {
+               float clear_color[4] = {1, 0, 1, 1};
+               D3D10_VIEWPORT vp;
+               memset(&vp, 0, sizeof(vp));
+               vp.Width = (unsigned)width;
+               vp.Height = (unsigned)height;
+               vp.MaxDepth = 1.0f;
+
+               ctx->OMSetRenderTargets(1, &rtv, 0);
+               ctx->RSSetViewports(1, &vp);
+
+               ctx->ClearRenderTargetView(rtv, clear_color);
+
+               ctx->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+               ctx->IASetInputLayout(layout);
+               unsigned stride = 2 * 4 * 4;
+               unsigned offset = 0;
+               ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset);
+
+               ctx->VSSetShader(vs);
+               ctx->PSSetShader(ps);   
+
+               ctx->Draw(3, 0);
+       }
+};
+
+d3d10_application* d3d10_application_create()
+{
+       return new d3d10tri();
+}
index 3502d9f..bc55cf8 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d10tri.hlsl.ps.h /Eps /Tps_4_0 d3d10tri.hlsl\r
-//\r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_POSITION              0   xyzw        0      POS  float       \r
-// COLOR                    0   xyzw        1     NONE  float   xyzw\r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_TARGET                0   xyzw        0   TARGET  float   xyzw\r
-//\r
-ps_4_0\r
-dcl_input_ps linear v1.xyzw\r
-dcl_output o0.xyzw\r
-mov o0.xyzw, v1.xyzw\r
-ret \r
-// Approximately 2 instruction slots used\r
-#endif\r
-\r
-const BYTE g_ps[] =\r
-{\r
-     68,  88,  66,  67, 206, 120, \r
-    117, 238, 118, 127,  10,  87, \r
-     80,  75, 114, 198,  95,   2, \r
-    120, 102,   1,   0,   0,   0, \r
-    208,   1,   0,   0,   5,   0, \r
-      0,   0,  52,   0,   0,   0, \r
-    140,   0,   0,   0, 224,   0, \r
-      0,   0,  20,   1,   0,   0, \r
-     84,   1,   0,   0,  82,  68, \r
-     69,  70,  80,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     28,   0,   0,   0,   0,   4, \r
-    255, 255,   0,   1,   0,   0, \r
-     28,   0,   0,   0,  77, 105, \r
-     99, 114, 111, 115, 111, 102, \r
-    116,  32,  40,  82,  41,  32, \r
-     72,  76,  83,  76,  32,  83, \r
-    104,  97, 100, 101, 114,  32, \r
-     67, 111, 109, 112, 105, 108, \r
-    101, 114,  32,  57,  46,  50, \r
-     57,  46,  57,  53,  50,  46, \r
-     51,  49,  49,  49,   0, 171, \r
-    171, 171,  73,  83,  71,  78, \r
-     76,   0,   0,   0,   2,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     56,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,   0,   0,   0, \r
-     68,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   1,   0, \r
-      0,   0,  15,  15,   0,   0, \r
-     83,  86,  95,  80,  79,  83, \r
-     73,  84,  73,  79,  78,   0, \r
-     67,  79,  76,  79,  82,   0, \r
-    171, 171,  79,  83,  71,  78, \r
-     44,   0,   0,   0,   1,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     32,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,   0,   0,   0, \r
-     83,  86,  95,  84,  65,  82, \r
-     71,  69,  84,   0, 171, 171, \r
-     83,  72,  68,  82,  56,   0, \r
-      0,   0,  64,   0,   0,   0, \r
-     14,   0,   0,   0,  98,  16, \r
-      0,   3, 242,  16,  16,   0, \r
-      1,   0,   0,   0, 101,   0, \r
-      0,   3, 242,  32,  16,   0, \r
-      0,   0,   0,   0,  54,   0, \r
-      0,   5, 242,  32,  16,   0, \r
-      0,   0,   0,   0,  70,  30, \r
-     16,   0,   1,   0,   0,   0, \r
-     62,   0,   0,   1,  83,  84, \r
-     65,  84, 116,   0,   0,   0, \r
-      2,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      2,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d10tri.hlsl.ps.h /Eps /Tps_4_0 d3d10tri.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION              0   xyzw        0      POS  float       
+// COLOR                    0   xyzw        1     NONE  float   xyzw
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET                0   xyzw        0   TARGET  float   xyzw
+//
+ps_4_0
+dcl_input_ps linear v1.xyzw
+dcl_output o0.xyzw
+mov o0.xyzw, v1.xyzw
+ret 
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_ps[] =
+{
+     68,  88,  66,  67, 206, 120, 
+    117, 238, 118, 127,  10,  87, 
+     80,  75, 114, 198,  95,   2, 
+    120, 102,   1,   0,   0,   0, 
+    208,   1,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 224,   0, 
+      0,   0,  20,   1,   0,   0, 
+     84,   1,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  57,  46,  50, 
+     57,  46,  57,  53,  50,  46, 
+     51,  49,  49,  49,   0, 171, 
+    171, 171,  73,  83,  71,  78, 
+     76,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,  15,  15,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     67,  79,  76,  79,  82,   0, 
+    171, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82,  56,   0, 
+      0,   0,  64,   0,   0,   0, 
+     14,   0,   0,   0,  98,  16, 
+      0,   3, 242,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      0,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
index 5c941d8..7204281 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d10tri.hlsl.vs.h /Evs /Tvs_4_0 d3d10tri.hlsl\r
-//\r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// POSITION                 0   xyzw        0     NONE  float   xyzw\r
-// COLOR                    0   xyzw        1     NONE  float   xyzw\r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_POSITION              0   xyzw        0      POS  float   xyzw\r
-// COLOR                    0   xyzw        1     NONE  float   xyzw\r
-//\r
-vs_4_0\r
-dcl_input v0.xyzw\r
-dcl_input v1.xyzw\r
-dcl_output_siv o0.xyzw, position\r
-dcl_output o1.xyzw\r
-mov o0.xyzw, v0.xyzw\r
-mov o1.xyzw, v1.xyzw\r
-ret \r
-// Approximately 3 instruction slots used\r
-#endif\r
-\r
-const BYTE g_vs[] =\r
-{\r
-     68,  88,  66,  67, 190, 171, \r
-    186,  20,  44, 105,  95, 129, \r
-    137, 204, 223,  72, 251, 159, \r
-    126, 176,   1,   0,   0,   0, \r
-     28,   2,   0,   0,   5,   0, \r
-      0,   0,  52,   0,   0,   0, \r
-    140,   0,   0,   0, 220,   0, \r
-      0,   0,  48,   1,   0,   0, \r
-    160,   1,   0,   0,  82,  68, \r
-     69,  70,  80,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     28,   0,   0,   0,   0,   4, \r
-    254, 255,   0,   1,   0,   0, \r
-     28,   0,   0,   0,  77, 105, \r
-     99, 114, 111, 115, 111, 102, \r
-    116,  32,  40,  82,  41,  32, \r
-     72,  76,  83,  76,  32,  83, \r
-    104,  97, 100, 101, 114,  32, \r
-     67, 111, 109, 112, 105, 108, \r
-    101, 114,  32,  57,  46,  50, \r
-     57,  46,  57,  53,  50,  46, \r
-     51,  49,  49,  49,   0, 171, \r
-    171, 171,  73,  83,  71,  78, \r
-     72,   0,   0,   0,   2,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     56,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,  15,   0,   0, \r
-     65,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   1,   0, \r
-      0,   0,  15,  15,   0,   0, \r
-     80,  79,  83,  73,  84,  73, \r
-     79,  78,   0,  67,  79,  76, \r
-     79,  82,   0, 171,  79,  83, \r
-     71,  78,  76,   0,   0,   0, \r
-      2,   0,   0,   0,   8,   0, \r
-      0,   0,  56,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      0,   0,   0,   0,  15,   0, \r
-      0,   0,  68,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      1,   0,   0,   0,  15,   0, \r
-      0,   0,  83,  86,  95,  80, \r
-     79,  83,  73,  84,  73,  79, \r
-     78,   0,  67,  79,  76,  79, \r
-     82,   0, 171, 171,  83,  72, \r
-     68,  82, 104,   0,   0,   0, \r
-     64,   0,   1,   0,  26,   0, \r
-      0,   0,  95,   0,   0,   3, \r
-    242,  16,  16,   0,   0,   0, \r
-      0,   0,  95,   0,   0,   3, \r
-    242,  16,  16,   0,   1,   0, \r
-      0,   0, 103,   0,   0,   4, \r
-    242,  32,  16,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-    101,   0,   0,   3, 242,  32, \r
-     16,   0,   1,   0,   0,   0, \r
-     54,   0,   0,   5, 242,  32, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  30,  16,   0,   0,   0, \r
-      0,   0,  54,   0,   0,   5, \r
-    242,  32,  16,   0,   1,   0, \r
-      0,   0,  70,  30,  16,   0, \r
-      1,   0,   0,   0,  62,   0, \r
-      0,   1,  83,  84,  65,  84, \r
-    116,   0,   0,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   4,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   2,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d10tri.hlsl.vs.h /Evs /Tvs_4_0 d3d10tri.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION                 0   xyzw        0     NONE  float   xyzw
+// COLOR                    0   xyzw        1     NONE  float   xyzw
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION              0   xyzw        0      POS  float   xyzw
+// COLOR                    0   xyzw        1     NONE  float   xyzw
+//
+vs_4_0
+dcl_input v0.xyzw
+dcl_input v1.xyzw
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyzw
+mov o0.xyzw, v0.xyzw
+mov o1.xyzw, v1.xyzw
+ret 
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_vs[] =
+{
+     68,  88,  66,  67, 190, 171, 
+    186,  20,  44, 105,  95, 129, 
+    137, 204, 223,  72, 251, 159, 
+    126, 176,   1,   0,   0,   0, 
+     28,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 220,   0, 
+      0,   0,  48,   1,   0,   0, 
+    160,   1,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    254, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  57,  46,  50, 
+     57,  46,  57,  53,  50,  46, 
+     51,  49,  49,  49,   0, 171, 
+    171, 171,  73,  83,  71,  78, 
+     72,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,  15,   0,   0, 
+     65,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,  15,  15,   0,   0, 
+     80,  79,  83,  73,  84,  73, 
+     79,  78,   0,  67,  79,  76, 
+     79,  82,   0, 171,  79,  83, 
+     71,  78,  76,   0,   0,   0, 
+      2,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  68,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  67,  79,  76,  79, 
+     82,   0, 171, 171,  83,  72, 
+     68,  82, 104,   0,   0,   0, 
+     64,   0,   1,   0,  26,   0, 
+      0,   0,  95,   0,   0,   3, 
+    242,  16,  16,   0,   0,   0, 
+      0,   0,  95,   0,   0,   3, 
+    242,  16,  16,   0,   1,   0, 
+      0,   0, 103,   0,   0,   4, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,  30,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    242,  32,  16,   0,   1,   0, 
+      0,   0,  70,  30,  16,   0, 
+      1,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
index 9eb69d6..53de10a 100755 (executable)
@@ -1,51 +1,51 @@
-/**************************************************************************\r
- *\r
- * Copyright 2010 Luca Barbieri\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining\r
- * a copy of this software and associated documentation files (the\r
- * "Software"), to deal in the Software without restriction, including\r
- * without limitation the rights to use, copy, modify, merge, publish,\r
- * distribute, sublicense, and/or sell copies of the Software, and to\r
- * permit persons to whom the Software is furnished to do so, subject to\r
- * the following conditions:\r
- *\r
- * The above copyright notice and this permission notice (including the\r
- * next paragraph) shall be included in all copies or substantial\r
- * portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE\r
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- **************************************************************************/\r
-\r
-#ifndef D3D11APP_H\r
-#define D3D11APP_H\r
-\r
-#define WIN32_LEAN_AND_MEAN\r
-#include <windows.h>\r
-#include <objbase.h>\r
-#include <d3d11.h>\r
-#include <assert.h>\r
-#include <stdio.h>\r
-#include <float.h>\r
-\r
-#define ensure(x) do {HRESULT __hr = (x); if(!SUCCEEDED(__hr)) {fprintf(stderr, "COM error %08x\n", __hr); abort();}} while(0)\r
-\r
-struct d3d11_application\r
-{\r
-       virtual ~d3d11_application() {}\r
-\r
-       virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) = 0;\r
-       virtual bool init(ID3D11Device* dev, int argc, char** argv) = 0;\r
-};\r
-\r
-/* this is the entry point you must provide */\r
-extern "C" d3d11_application* d3d11_application_create();\r
-\r
-#endif\r
+/**************************************************************************
+ *
+ * Copyright 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef D3D11APP_H
+#define D3D11APP_H
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <objbase.h>
+#include <d3d11.h>
+#include <assert.h>
+#include <stdio.h>
+#include <float.h>
+
+#define ensure(x) do {HRESULT __hr = (x); if(!SUCCEEDED(__hr)) {fprintf(stderr, "COM error %08x\n", __hr); abort();}} while(0)
+
+struct d3d11_application
+{
+       virtual ~d3d11_application() {}
+
+       virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time) = 0;
+       virtual bool init(ID3D11Device* dev, int argc, char** argv) = 0;
+};
+
+/* this is the entry point you must provide */
+extern "C" d3d11_application* d3d11_application_create();
+
+#endif
index d034c87..5823b4c 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d11blit.hlsl.ps.h /Eps_blit /Tps_4_0 d3d11blit.hlsl\r
-//\r
-//\r
-// Resource Bindings:\r
-//\r
-// Name                                 Type  Format         Dim Slot Elements\r
-// ------------------------------ ---------- ------- ----------- ---- --------\r
-// samp                              sampler      NA          NA    0        1\r
-// tex                               texture  float4          2d    0        1\r
-//\r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_POSITION              0   xyzw        0      POS  float       \r
-// TEXCOORD                 0   xy          1     NONE  float   xy  \r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_TARGET                0   xyzw        0   TARGET  float   xyzw\r
-//\r
-ps_4_0\r
-dcl_sampler s0, mode_default\r
-dcl_resource_texture2d (float,float,float,float) t0\r
-dcl_input_ps linear v1.xy\r
-dcl_output o0.xyzw\r
-sample o0.xyzw, v1.xyxx, t0.xyzw, s0\r
-ret \r
-// Approximately 2 instruction slots used\r
-#endif\r
-\r
-const BYTE g_ps_blit[] =\r
-{\r
-     68,  88,  66,  67, 183, 100, \r
-     39,  89, 244,  20, 241,  39, \r
-     36, 169, 159, 230, 234, 214, \r
-    114,  11,   1,   0,   0,   0, \r
-     72,   2,   0,   0,   5,   0, \r
-      0,   0,  52,   0,   0,   0, \r
-    212,   0,   0,   0,  44,   1, \r
-      0,   0,  96,   1,   0,   0, \r
-    204,   1,   0,   0,  82,  68, \r
-     69,  70, 152,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   2,   0,   0,   0, \r
-     28,   0,   0,   0,   0,   4, \r
-    255, 255,   0,   1,   0,   0, \r
-    101,   0,   0,   0,  92,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     97,   0,   0,   0,   2,   0, \r
-      0,   0,   5,   0,   0,   0, \r
-      4,   0,   0,   0, 255, 255, \r
-    255, 255,   0,   0,   0,   0, \r
-      1,   0,   0,   0,  12,   0, \r
-      0,   0, 115,  97, 109, 112, \r
-      0, 116, 101, 120,   0,  77, \r
-    105,  99, 114, 111, 115, 111, \r
-    102, 116,  32,  40,  82,  41, \r
-     32,  72,  76,  83,  76,  32, \r
-     83, 104,  97, 100, 101, 114, \r
-     32,  67, 111, 109, 112, 105, \r
-    108, 101, 114,  32,  57,  46, \r
-     50,  57,  46,  57,  53,  50, \r
-     46,  51,  49,  49,  49,   0, \r
-    171, 171,  73,  83,  71,  78, \r
-     80,   0,   0,   0,   2,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     56,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,   0,   0,   0, \r
-     68,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   1,   0, \r
-      0,   0,   3,   3,   0,   0, \r
-     83,  86,  95,  80,  79,  83, \r
-     73,  84,  73,  79,  78,   0, \r
-     84,  69,  88,  67,  79,  79, \r
-     82,  68,   0, 171, 171, 171, \r
-     79,  83,  71,  78,  44,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      8,   0,   0,   0,  32,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     15,   0,   0,   0,  83,  86, \r
-     95,  84,  65,  82,  71,  69, \r
-     84,   0, 171, 171,  83,  72, \r
-     68,  82, 100,   0,   0,   0, \r
-     64,   0,   0,   0,  25,   0, \r
-      0,   0,  90,   0,   0,   3, \r
-      0,  96,  16,   0,   0,   0, \r
-      0,   0,  88,  24,   0,   4, \r
-      0, 112,  16,   0,   0,   0, \r
-      0,   0,  85,  85,   0,   0, \r
-     98,  16,   0,   3,  50,  16, \r
-     16,   0,   1,   0,   0,   0, \r
-    101,   0,   0,   3, 242,  32, \r
-     16,   0,   0,   0,   0,   0, \r
-     69,   0,   0,   9, 242,  32, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  16,  16,   0,   1,   0, \r
-      0,   0,  70, 126,  16,   0, \r
-      0,   0,   0,   0,   0,  96, \r
-     16,   0,   0,   0,   0,   0, \r
-     62,   0,   0,   1,  83,  84, \r
-     65,  84, 116,   0,   0,   0, \r
-      2,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      2,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d11blit.hlsl.ps.h /Eps_blit /Tps_4_0 d3d11blit.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// samp                              sampler      NA          NA    0        1
+// tex                               texture  float4          2d    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION              0   xyzw        0      POS  float       
+// TEXCOORD                 0   xy          1     NONE  float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET                0   xyzw        0   TARGET  float   xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_input_ps linear v1.xy
+dcl_output o0.xyzw
+sample o0.xyzw, v1.xyxx, t0.xyzw, s0
+ret 
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_ps_blit[] =
+{
+     68,  88,  66,  67, 183, 100, 
+     39,  89, 244,  20, 241,  39, 
+     36, 169, 159, 230, 234, 214, 
+    114,  11,   1,   0,   0,   0, 
+     72,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    212,   0,   0,   0,  44,   1, 
+      0,   0,  96,   1,   0,   0, 
+    204,   1,   0,   0,  82,  68, 
+     69,  70, 152,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    101,   0,   0,   0,  92,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+     97,   0,   0,   0,   2,   0, 
+      0,   0,   5,   0,   0,   0, 
+      4,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+      1,   0,   0,   0,  12,   0, 
+      0,   0, 115,  97, 109, 112, 
+      0, 116, 101, 120,   0,  77, 
+    105,  99, 114, 111, 115, 111, 
+    102, 116,  32,  40,  82,  41, 
+     32,  72,  76,  83,  76,  32, 
+     83, 104,  97, 100, 101, 114, 
+     32,  67, 111, 109, 112, 105, 
+    108, 101, 114,  32,  57,  46, 
+     50,  57,  46,  57,  53,  50, 
+     46,  51,  49,  49,  49,   0, 
+    171, 171,  73,  83,  71,  78, 
+     80,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   3,   3,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171, 171, 171, 
+     79,  83,  71,  78,  44,   0, 
+      0,   0,   1,   0,   0,   0, 
+      8,   0,   0,   0,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  83,  86, 
+     95,  84,  65,  82,  71,  69, 
+     84,   0, 171, 171,  83,  72, 
+     68,  82, 100,   0,   0,   0, 
+     64,   0,   0,   0,  25,   0, 
+      0,   0,  90,   0,   0,   3, 
+      0,  96,  16,   0,   0,   0, 
+      0,   0,  88,  24,   0,   4, 
+      0, 112,  16,   0,   0,   0, 
+      0,   0,  85,  85,   0,   0, 
+     98,  16,   0,   3,  50,  16, 
+     16,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+     69,   0,   0,   9, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,  16,  16,   0,   1,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,   0,  96, 
+     16,   0,   0,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
index 8e884d9..5d9acd2 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d11blit.hlsl.vs.h /Evs_blit /Tvs_4_0 d3d11blit.hlsl\r
-//\r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// POSITION                 0   xyzw        0     NONE  float   xyzw\r
-// TEXCOORD                 0   xy          1     NONE  float   xy  \r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_POSITION              0   xyzw        0      POS  float   xyzw\r
-// TEXCOORD                 0   xy          1     NONE  float   xy  \r
-//\r
-vs_4_0\r
-dcl_input v0.xyzw\r
-dcl_input v1.xy\r
-dcl_output_siv o0.xyzw, position\r
-dcl_output o1.xy\r
-mov o0.xyzw, v0.xyzw\r
-mov o1.xy, v1.xyxx\r
-ret \r
-// Approximately 3 instruction slots used\r
-#endif\r
-\r
-const BYTE g_vs_blit[] =\r
-{\r
-     68,  88,  66,  67, 142,  11, \r
-    173,  22,  73,  47, 224,  51, \r
-    147,  83, 148, 177,  56,  17, \r
-     72, 237,   1,   0,   0,   0, \r
-     36,   2,   0,   0,   5,   0, \r
-      0,   0,  52,   0,   0,   0, \r
-    140,   0,   0,   0, 224,   0, \r
-      0,   0,  56,   1,   0,   0, \r
-    168,   1,   0,   0,  82,  68, \r
-     69,  70,  80,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     28,   0,   0,   0,   0,   4, \r
-    254, 255,   0,   1,   0,   0, \r
-     28,   0,   0,   0,  77, 105, \r
-     99, 114, 111, 115, 111, 102, \r
-    116,  32,  40,  82,  41,  32, \r
-     72,  76,  83,  76,  32,  83, \r
-    104,  97, 100, 101, 114,  32, \r
-     67, 111, 109, 112, 105, 108, \r
-    101, 114,  32,  57,  46,  50, \r
-     57,  46,  57,  53,  50,  46, \r
-     51,  49,  49,  49,   0, 171, \r
-    171, 171,  73,  83,  71,  78, \r
-     76,   0,   0,   0,   2,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     56,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,  15,   0,   0, \r
-     65,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   1,   0, \r
-      0,   0,   3,   3,   0,   0, \r
-     80,  79,  83,  73,  84,  73, \r
-     79,  78,   0,  84,  69,  88, \r
-     67,  79,  79,  82,  68,   0, \r
-    171, 171,  79,  83,  71,  78, \r
-     80,   0,   0,   0,   2,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     56,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,   0,   0,   0, \r
-     68,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   1,   0, \r
-      0,   0,   3,  12,   0,   0, \r
-     83,  86,  95,  80,  79,  83, \r
-     73,  84,  73,  79,  78,   0, \r
-     84,  69,  88,  67,  79,  79, \r
-     82,  68,   0, 171, 171, 171, \r
-     83,  72,  68,  82, 104,   0, \r
-      0,   0,  64,   0,   1,   0, \r
-     26,   0,   0,   0,  95,   0, \r
-      0,   3, 242,  16,  16,   0, \r
-      0,   0,   0,   0,  95,   0, \r
-      0,   3,  50,  16,  16,   0, \r
-      1,   0,   0,   0, 103,   0, \r
-      0,   4, 242,  32,  16,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0, 101,   0,   0,   3, \r
-     50,  32,  16,   0,   1,   0, \r
-      0,   0,  54,   0,   0,   5, \r
-    242,  32,  16,   0,   0,   0, \r
-      0,   0,  70,  30,  16,   0, \r
-      0,   0,   0,   0,  54,   0, \r
-      0,   5,  50,  32,  16,   0, \r
-      1,   0,   0,   0,  70,  16, \r
-     16,   0,   1,   0,   0,   0, \r
-     62,   0,   0,   1,  83,  84, \r
-     65,  84, 116,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      4,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   2,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d11blit.hlsl.vs.h /Evs_blit /Tvs_4_0 d3d11blit.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION                 0   xyzw        0     NONE  float   xyzw
+// TEXCOORD                 0   xy          1     NONE  float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION              0   xyzw        0      POS  float   xyzw
+// TEXCOORD                 0   xy          1     NONE  float   xy  
+//
+vs_4_0
+dcl_input v0.xyzw
+dcl_input v1.xy
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xy
+mov o0.xyzw, v0.xyzw
+mov o1.xy, v1.xyxx
+ret 
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_vs_blit[] =
+{
+     68,  88,  66,  67, 142,  11, 
+    173,  22,  73,  47, 224,  51, 
+    147,  83, 148, 177,  56,  17, 
+     72, 237,   1,   0,   0,   0, 
+     36,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 224,   0, 
+      0,   0,  56,   1,   0,   0, 
+    168,   1,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    254, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  57,  46,  50, 
+     57,  46,  57,  53,  50,  46, 
+     51,  49,  49,  49,   0, 171, 
+    171, 171,  73,  83,  71,  78, 
+     76,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,  15,   0,   0, 
+     65,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   3,   3,   0,   0, 
+     80,  79,  83,  73,  84,  73, 
+     79,  78,   0,  84,  69,  88, 
+     67,  79,  79,  82,  68,   0, 
+    171, 171,  79,  83,  71,  78, 
+     80,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   3,  12,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0, 171, 171, 171, 
+     83,  72,  68,  82, 104,   0, 
+      0,   0,  64,   0,   1,   0, 
+     26,   0,   0,   0,  95,   0, 
+      0,   3, 242,  16,  16,   0, 
+      0,   0,   0,   0,  95,   0, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0, 103,   0, 
+      0,   4, 242,  32,  16,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0, 101,   0,   0,   3, 
+     50,  32,  16,   0,   1,   0, 
+      0,   0,  54,   0,   0,   5, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,  70,  30,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   5,  50,  32,  16,   0, 
+      1,   0,   0,   0,  70,  16, 
+     16,   0,   1,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
index e67fa09..1e0ce04 100755 (executable)
-/**************************************************************************\r
- *\r
- * Copyright 2010 Luca Barbieri\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining\r
- * a copy of this software and associated documentation files (the\r
- * "Software"), to deal in the Software without restriction, including\r
- * without limitation the rights to use, copy, modify, merge, publish,\r
- * distribute, sublicense, and/or sell copies of the Software, and to\r
- * permit persons to whom the Software is furnished to do so, subject to\r
- * the following conditions:\r
- *\r
- * The above copyright notice and this permission notice (including the\r
- * next paragraph) shall be included in all copies or substantial\r
- * portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE\r
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- **************************************************************************/\r
-\r
-#include <vector>\r
-\r
-#include "d3d11blit.hlsl.ps.h"\r
-#include "d3d11blit.hlsl.vs.h"\r
-\r
-template<typename index_type = unsigned>\r
-struct triangle_list_indices : public std::vector<index_type>\r
-{\r
-       unsigned base;\r
-       bool flip;\r
-\r
-       triangle_list_indices()\r
-       : base(0), flip(false)\r
-       {}\r
-\r
-       void poly(unsigned a, unsigned b, unsigned c)\r
-       {\r
-               this->push_back(base + a);\r
-               this->push_back(base + (flip ? c : b));\r
-               this->push_back(base + (flip ? b : c));\r
-       }\r
-\r
-       void poly(unsigned a, unsigned b, unsigned c, unsigned d)\r
-       {\r
-               poly(a, b, c);\r
-               poly(a, c, d);\r
-       }\r
-\r
-       void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e)\r
-       {\r
-               poly(a, b, c, d);\r
-               poly(a, d, e);\r
-       }\r
-\r
-       void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f)\r
-       {\r
-               poly(a, b, c, d, e);\r
-               poly(a, e, f);\r
-       }\r
-\r
-       void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f, unsigned g)\r
-       {\r
-               poly(a, b, c, d, e, f);\r
-               poly(a, f, g);\r
-       }\r
-\r
-       void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f, unsigned g, unsigned h)\r
-       {\r
-               poly(a, b, c, d, e, f, g);\r
-               poly(a, g, h);\r
-       }\r
-};\r
-\r
-struct mesh\r
-{\r
-       ID3D11InputLayout* layout;\r
-       ID3D11Buffer* buffer;\r
-       D3D11_PRIMITIVE_TOPOLOGY topology;\r
-       unsigned vertex_size;\r
-       unsigned draw_count;\r
-       DXGI_FORMAT index_format;\r
-       unsigned index_offset;\r
-\r
-       mesh(ID3D11Device* dev, D3D11_PRIMITIVE_TOPOLOGY topology,\r
-               const D3D11_INPUT_ELEMENT_DESC *elements, unsigned num_elements,\r
-               const void* vs, unsigned vs_size,\r
-               const void* vertices, unsigned vertex_size, unsigned num_vertices,\r
-               const void* indices = 0, unsigned index_size = 0, unsigned num_indices = 0)\r
-               : topology(topology), vertex_size(vertex_size), draw_count(index_size ? num_indices : num_vertices)\r
-       {\r
-               dev->CreateInputLayout(elements, num_elements, vs, vs_size, &layout);\r
-               if(index_size == 2)\r
-                       index_format = DXGI_FORMAT_R16_UINT;\r
-               else if(index_size == 4)\r
-                       index_format = DXGI_FORMAT_R32_UINT;\r
-               else\r
-                       index_format = DXGI_FORMAT_UNKNOWN;\r
-               this->vertex_size = vertex_size;\r
-               index_offset = vertex_size * num_vertices;\r
-\r
-               D3D11_BUFFER_DESC bufferd;\r
-               memset(&bufferd, 0, sizeof(bufferd));\r
-               bufferd.Usage = D3D11_USAGE_IMMUTABLE;\r
-               bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER;\r
-               if(index_format)\r
-                       bufferd.BindFlags |= D3D11_BIND_INDEX_BUFFER;\r
-               bufferd.ByteWidth = index_offset + index_format * num_indices;\r
-\r
-               char* data = (char*)malloc(bufferd.ByteWidth);\r
-               memcpy(data, vertices, vertex_size * num_vertices);\r
-               memcpy(data + index_offset, indices, index_size * num_indices);\r
-\r
-               D3D11_SUBRESOURCE_DATA buffersd;\r
-               buffersd.pSysMem = data;\r
-\r
-               ensure(dev->CreateBuffer(&bufferd, &buffersd, &buffer));\r
-               free(data);\r
-       }\r
-\r
-       ~mesh()\r
-       {\r
-               layout->Release();\r
-               buffer->Release();\r
-       }\r
-\r
-       void bind(ID3D11DeviceContext* ctx)\r
-       {\r
-               unsigned offset = 0;\r
-               ctx->IASetPrimitiveTopology(topology);\r
-               ctx->IASetInputLayout(layout);\r
-               if(index_format)\r
-                       ctx->IASetIndexBuffer(buffer, index_format, index_offset);\r
-               ctx->IASetVertexBuffers(0, 1, &buffer, &vertex_size, &offset);\r
-       }\r
-\r
-       void draw_bound(ID3D11DeviceContext* ctx)\r
-       {\r
-               if(index_format)\r
-                       ctx->DrawIndexed(draw_count, 0, 0);\r
-               else\r
-                       ctx->Draw(draw_count, 0);\r
-       }\r
-\r
-       void bind_and_draw(ID3D11DeviceContext* ctx)\r
-       {\r
-               bind(ctx);\r
-               draw_bound(ctx);\r
-       }\r
-};\r
-\r
-mesh* create_tex_quad(ID3D11Device* dev, const BYTE* vs, unsigned vs_size)\r
-{\r
-       float quad_data[] = {\r
-               -1, -1, 0, 1,\r
-               -1, 1, 0, 0,\r
-               1, -1, 1, 1,\r
-               1, 1, 1, 0,\r
-       };\r
-\r
-       D3D11_INPUT_ELEMENT_DESC elements[2] =\r
-       {\r
-               {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},\r
-               {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0},\r
-       };\r
-\r
-       return new mesh(dev, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,\r
-               elements, 2,\r
-               vs, vs_size,\r
-               quad_data, 4 * sizeof(float), 4,\r
-               0, 0, 0);\r
-}\r
-\r
-struct d3d11_blitter\r
-{\r
-       mesh* quad;\r
-       ID3D11VertexShader* vs;\r
-       ID3D11PixelShader* ps;\r
-       ID3D11SamplerState* sampler[2];\r
-\r
-       d3d11_blitter(ID3D11Device* dev)\r
-       {\r
-               quad = create_tex_quad(dev, g_vs_blit, sizeof(g_vs_blit));\r
-\r
-               dev->CreateVertexShader(g_vs_blit, sizeof(g_vs_blit), 0, &vs);\r
-               dev->CreatePixelShader(g_ps_blit, sizeof(g_ps_blit), 0, &ps);\r
-\r
-               for(unsigned i = 0; i < 2; ++i)\r
-               {\r
-                       D3D11_SAMPLER_DESC samplerd;\r
-                       memset(&samplerd, 0, sizeof(samplerd));\r
-                       samplerd.Filter = i ? D3D11_FILTER_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_LINEAR;\r
-                       samplerd.AddressU = samplerd.AddressV = samplerd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;\r
-                       dev->CreateSamplerState(&samplerd, &sampler[i]);\r
-               }\r
-       }\r
-\r
-       void bind(ID3D11DeviceContext* ctx, ID3D11ShaderResourceView* srv, ID3D11RenderTargetView* rtv, float x, float y, float width, float height, bool linear)\r
-       {\r
-               D3D11_VIEWPORT vp;\r
-               vp.TopLeftX = x;\r
-               vp.TopLeftY = y;\r
-               vp.Width = width;\r
-               vp.Height = height;\r
-               vp.MinDepth = 0;\r
-               vp.MaxDepth = 1;\r
-               ctx->RSSetViewports(1, &vp);\r
-               ctx->RSSetState(0);\r
-               ctx->OMSetBlendState(0, 0, ~0);\r
-               ctx->OMSetDepthStencilState(0, 0);\r
-               ctx->OMSetRenderTargets(1, &rtv, 0);\r
-               ctx->VSSetShader(vs, 0, 0);\r
-               ctx->PSSetShader(ps, 0, 0);\r
-               ctx->PSSetShaderResources(0, 1, &srv);\r
-               ctx->PSSetSamplers(0, 1, &sampler[!!linear]);\r
-               quad->bind(ctx);\r
-       }\r
-\r
-       void draw_bound(ID3D11DeviceContext* ctx)\r
-       {\r
-               quad->draw_bound(ctx);\r
-       }\r
-\r
-       void bind_draw_and_unbind(ID3D11DeviceContext* ctx, ID3D11ShaderResourceView* srv, ID3D11RenderTargetView* rtv, float x, float y, float width, float height, bool linear)\r
-       {\r
-               bind(ctx, srv, rtv, x, y, width, height, linear);\r
-               draw_bound(ctx);\r
-               unbind(ctx);\r
-       }\r
-\r
-       void unbind(ID3D11DeviceContext* ctx)\r
-       {\r
-               void* null = 0;\r
-               ctx->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&null);\r
-               ctx->PSSetSamplers(0, 1, (ID3D11SamplerState**)&null);\r
-       }\r
-};\r
-\r
-template<typename T, unsigned n>\r
-struct vec_t\r
-{\r
-       T v[n];\r
-\r
-       T& operator [](unsigned i)\r
-       {\r
-               return v[i];\r
-       }\r
-\r
-       const T& operator [](unsigned i) const\r
-       {\r
-               return v[i];\r
-       }\r
-};\r
-\r
-template<typename T, unsigned n>\r
-vec_t<T, n> operator -(const vec_t<T, n> a)\r
-{\r
-       vec_t<T, n> r;\r
-       for(unsigned i = 0; i < n; ++i)\r
-               r[i] = -a[i];\r
-       return r;\r
-}\r
-\r
-template<typename T, unsigned n>\r
-vec_t<T, n> operator +(const vec_t<T, n>& a, const vec_t<T, n>& b)\r
-{\r
-       vec_t<T, n> r;\r
-       for(unsigned i = 0; i < n; ++i)\r
-               r[i] = a[i] + b[i];\r
-       return r;\r
-}\r
-\r
-template<typename T, unsigned n>\r
-vec_t<T, n>& operator +=(vec_t<T, n>& a, const vec_t<T, n>& b)\r
-{\r
-       for(unsigned i = 0; i < n; ++i)\r
-               a[i] += b[i];\r
-       return a;\r
-}\r
-\r
-template<typename T, unsigned r, unsigned c>\r
-struct mat_t : public vec_t<vec_t<T, r>, c>\r
-{};\r
-\r
-template<typename T, unsigned n>\r
-vec_t<T, n> operator *(const vec_t<T, n>& a, const T& b)\r
-{\r
-       vec_t<T, n> r;\r
-       for(unsigned i = 0; i < n; ++i)\r
-               r[i] = a[i] * b;\r
-       return r;\r
-}\r
-\r
-template<typename T, unsigned n>\r
-vec_t<T, n> operator *(const T& b, const vec_t<T, n>& a)\r
-{\r
-       vec_t<T, n> r;\r
-       for(unsigned i = 0; i < n; ++i)\r
-               r[i] = a[i] * b;\r
-       return r;\r
-}\r
-\r
-template<typename T, unsigned d, unsigned e>\r
-vec_t<T, e> operator *(const mat_t<T, e, d>& m, const vec_t<T, d>& b)\r
-{\r
-       vec_t<T, e> r;\r
-       r = m[0] * b[0];\r
-       for(unsigned i = 1; i < d; ++i)\r
-               r += m[i] * b[i];\r
-       return r;\r
-}\r
-\r
-template<typename T, unsigned d, unsigned e, unsigned f>\r
-mat_t<T, e, f> operator *(const mat_t<T, e, d>& m, const mat_t<T, d, f>& b)\r
-{\r
-       mat_t<T, e, f> r;\r
-       for(unsigned i = 0; i < d; ++i)\r
-               r[i] = m * b[i];\r
-       return r;\r
-}\r
-\r
-template<typename T>\r
-vec_t<T, 3> vec(T a, T b, T c)\r
-{\r
-       vec_t<T, 4> v;\r
-       v[0] = a;\r
-       v[1] = b;\r
-       v[2] = c;\r
-       return v;\r
-}\r
-\r
-template<typename T>\r
-vec_t<T, 4> vec(T a, T b, T c, T d)\r
-{\r
-       vec_t<T, 4> v;\r
-       v[0] = a;\r
-       v[1] = b;\r
-       v[2] = c;\r
-       v[3] = d;\r
-       return v;\r
-}\r
-\r
-typedef mat_t<float, 4, 4> float4x4;\r
-typedef mat_t<float, 4, 3> float4x3;\r
-typedef mat_t<float, 3, 4> float3x4;\r
-typedef mat_t<float, 3, 3> float3x3;\r
-\r
-typedef vec_t<float, 3> float3;\r
-typedef vec_t<float, 4> float4;\r
-\r
-template<typename T>\r
-mat_t<T, 4, 4> mat4x4_frustum(T left, T right, T bottom, T top, T nearval, T farval)\r
-{\r
-       T x = (2.0f * nearval) / (right - left);\r
-       T y = (2.0f * nearval) / (top - bottom);\r
-       T a = (right + left) / (right - left);\r
-       T b = (top + bottom) / (top - bottom);\r
-       T c = -(farval + nearval) / (farval - nearval);\r
-       T d = -(2.0f * farval * nearval) / (farval - nearval);\r
-       T _0 = (T)0;\r
-\r
-       mat_t<T, 4, 4> m;       \r
-       m[0] = vec(x, _0, _0, _0);\r
-       m[1] = vec(_0, y, _0, _0);\r
-       m[2] = vec(a, b, c, (T)-1);\r
-       m[3] = vec(_0, _0, d, _0);\r
-       return m;\r
-}\r
-\r
-template<typename T>\r
-mat_t<T, 3, 3> mat3x3_diag(T v)\r
-{\r
-       mat_t<T, 3, 3> m;\r
-       T _0 = (T)0;\r
-       m[0] = vec(v, _0, _0);\r
-       m[1] = vec(_0, v, _0);\r
-       m[2] = vec(_0, _0, v);\r
-       return m;\r
-}\r
-\r
-template<typename T>\r
-mat_t<T, 4, 4> mat4x4_diag(T v)\r
-{\r
-       mat_t<T, 4, 4> m;\r
-       T _0 = (T)0;\r
-       m[0] = vec(v, _0, _0, _0);\r
-       m[1] = vec(_0, v, _0, _0);\r
-       m[2] = vec(_0, _0, v, _0);\r
-       m[3] = vec(_0, _0, _0, v);\r
-       return m;\r
-}\r
-\r
-template<typename T, unsigned n>\r
-mat_t<T, n, n> mat_push_rotate(const mat_t<T, n, n>& m, unsigned axis, T angle)\r
-{\r
-       T s = (T)sin(angle);\r
-       T c = (T)cos(angle);\r
-\r
-       mat_t<T, n, n> r = m;\r
-       unsigned a = (axis + 1) % 3;\r
-       unsigned b = (axis + 2) % 3;\r
-       r[a] = (m[a] * c) + (m[b] * s);\r
-       r[b] = -(m[a] * s) + (m[b] * c);\r
-       return r;\r
-}\r
-\r
-template<typename T, unsigned n>\r
-mat_t<T, n, n> mat_push_translate(const mat_t<T, n, n>& m, float x, float y, float z)\r
-{\r
-       mat_t<T, n, n> r = m;\r
-       vec_t<T, n> v;\r
-       v[0] = x;\r
-       v[1] = y;\r
-       v[2] = z;\r
-       if(n >= 4)\r
-               v[3] = (T)0;\r
-       r[3] += m * v;\r
-       return r;\r
-}\r
+/**************************************************************************
+ *
+ * Copyright 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include <vector>
+
+#include "d3d11blit.hlsl.ps.h"
+#include "d3d11blit.hlsl.vs.h"
+
+template<typename index_type = unsigned>
+struct triangle_list_indices : public std::vector<index_type>
+{
+       unsigned base;
+       bool flip;
+
+       triangle_list_indices()
+       : base(0), flip(false)
+       {}
+
+       void poly(unsigned a, unsigned b, unsigned c)
+       {
+               this->push_back(base + a);
+               this->push_back(base + (flip ? c : b));
+               this->push_back(base + (flip ? b : c));
+       }
+
+       void poly(unsigned a, unsigned b, unsigned c, unsigned d)
+       {
+               poly(a, b, c);
+               poly(a, c, d);
+       }
+
+       void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e)
+       {
+               poly(a, b, c, d);
+               poly(a, d, e);
+       }
+
+       void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f)
+       {
+               poly(a, b, c, d, e);
+               poly(a, e, f);
+       }
+
+       void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f, unsigned g)
+       {
+               poly(a, b, c, d, e, f);
+               poly(a, f, g);
+       }
+
+       void poly(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f, unsigned g, unsigned h)
+       {
+               poly(a, b, c, d, e, f, g);
+               poly(a, g, h);
+       }
+};
+
+struct mesh
+{
+       ID3D11InputLayout* layout;
+       ID3D11Buffer* buffer;
+       D3D11_PRIMITIVE_TOPOLOGY topology;
+       unsigned vertex_size;
+       unsigned draw_count;
+       DXGI_FORMAT index_format;
+       unsigned index_offset;
+
+       mesh(ID3D11Device* dev, D3D11_PRIMITIVE_TOPOLOGY topology,
+               const D3D11_INPUT_ELEMENT_DESC *elements, unsigned num_elements,
+               const void* vs, unsigned vs_size,
+               const void* vertices, unsigned vertex_size, unsigned num_vertices,
+               const void* indices = 0, unsigned index_size = 0, unsigned num_indices = 0)
+               : topology(topology), vertex_size(vertex_size), draw_count(index_size ? num_indices : num_vertices)
+       {
+               dev->CreateInputLayout(elements, num_elements, vs, vs_size, &layout);
+               if(index_size == 2)
+                       index_format = DXGI_FORMAT_R16_UINT;
+               else if(index_size == 4)
+                       index_format = DXGI_FORMAT_R32_UINT;
+               else
+                       index_format = DXGI_FORMAT_UNKNOWN;
+               this->vertex_size = vertex_size;
+               index_offset = vertex_size * num_vertices;
+
+               D3D11_BUFFER_DESC bufferd;
+               memset(&bufferd, 0, sizeof(bufferd));
+               bufferd.Usage = D3D11_USAGE_IMMUTABLE;
+               bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+               if(index_format)
+                       bufferd.BindFlags |= D3D11_BIND_INDEX_BUFFER;
+               bufferd.ByteWidth = index_offset + index_format * num_indices;
+
+               char* data = (char*)malloc(bufferd.ByteWidth);
+               memcpy(data, vertices, vertex_size * num_vertices);
+               memcpy(data + index_offset, indices, index_size * num_indices);
+
+               D3D11_SUBRESOURCE_DATA buffersd;
+               buffersd.pSysMem = data;
+
+               ensure(dev->CreateBuffer(&bufferd, &buffersd, &buffer));
+               free(data);
+       }
+
+       ~mesh()
+       {
+               layout->Release();
+               buffer->Release();
+       }
+
+       void bind(ID3D11DeviceContext* ctx)
+       {
+               unsigned offset = 0;
+               ctx->IASetPrimitiveTopology(topology);
+               ctx->IASetInputLayout(layout);
+               if(index_format)
+                       ctx->IASetIndexBuffer(buffer, index_format, index_offset);
+               ctx->IASetVertexBuffers(0, 1, &buffer, &vertex_size, &offset);
+       }
+
+       void draw_bound(ID3D11DeviceContext* ctx)
+       {
+               if(index_format)
+                       ctx->DrawIndexed(draw_count, 0, 0);
+               else
+                       ctx->Draw(draw_count, 0);
+       }
+
+       void bind_and_draw(ID3D11DeviceContext* ctx)
+       {
+               bind(ctx);
+               draw_bound(ctx);
+       }
+};
+
+mesh* create_tex_quad(ID3D11Device* dev, const BYTE* vs, unsigned vs_size)
+{
+       float quad_data[] = {
+               -1, -1, 0, 1,
+               -1, 1, 0, 0,
+               1, -1, 1, 1,
+               1, 1, 1, 0,
+       };
+
+       D3D11_INPUT_ELEMENT_DESC elements[2] =
+       {
+               {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
+               {"TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 8, D3D11_INPUT_PER_VERTEX_DATA, 0},
+       };
+
+       return new mesh(dev, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
+               elements, 2,
+               vs, vs_size,
+               quad_data, 4 * sizeof(float), 4,
+               0, 0, 0);
+}
+
+struct d3d11_blitter
+{
+       mesh* quad;
+       ID3D11VertexShader* vs;
+       ID3D11PixelShader* ps;
+       ID3D11SamplerState* sampler[2];
+
+       d3d11_blitter(ID3D11Device* dev)
+       {
+               quad = create_tex_quad(dev, g_vs_blit, sizeof(g_vs_blit));
+
+               dev->CreateVertexShader(g_vs_blit, sizeof(g_vs_blit), 0, &vs);
+               dev->CreatePixelShader(g_ps_blit, sizeof(g_ps_blit), 0, &ps);
+
+               for(unsigned i = 0; i < 2; ++i)
+               {
+                       D3D11_SAMPLER_DESC samplerd;
+                       memset(&samplerd, 0, sizeof(samplerd));
+                       samplerd.Filter = i ? D3D11_FILTER_MIN_MAG_MIP_LINEAR : D3D11_FILTER_MIN_MAG_MIP_LINEAR;
+                       samplerd.AddressU = samplerd.AddressV = samplerd.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
+                       dev->CreateSamplerState(&samplerd, &sampler[i]);
+               }
+       }
+
+       void bind(ID3D11DeviceContext* ctx, ID3D11ShaderResourceView* srv, ID3D11RenderTargetView* rtv, float x, float y, float width, float height, bool linear)
+       {
+               D3D11_VIEWPORT vp;
+               vp.TopLeftX = x;
+               vp.TopLeftY = y;
+               vp.Width = width;
+               vp.Height = height;
+               vp.MinDepth = 0;
+               vp.MaxDepth = 1;
+               ctx->RSSetViewports(1, &vp);
+               ctx->RSSetState(0);
+               ctx->OMSetBlendState(0, 0, ~0);
+               ctx->OMSetDepthStencilState(0, 0);
+               ctx->OMSetRenderTargets(1, &rtv, 0);
+               ctx->VSSetShader(vs, 0, 0);
+               ctx->PSSetShader(ps, 0, 0);
+               ctx->PSSetShaderResources(0, 1, &srv);
+               ctx->PSSetSamplers(0, 1, &sampler[!!linear]);
+               quad->bind(ctx);
+       }
+
+       void draw_bound(ID3D11DeviceContext* ctx)
+       {
+               quad->draw_bound(ctx);
+       }
+
+       void bind_draw_and_unbind(ID3D11DeviceContext* ctx, ID3D11ShaderResourceView* srv, ID3D11RenderTargetView* rtv, float x, float y, float width, float height, bool linear)
+       {
+               bind(ctx, srv, rtv, x, y, width, height, linear);
+               draw_bound(ctx);
+               unbind(ctx);
+       }
+
+       void unbind(ID3D11DeviceContext* ctx)
+       {
+               void* null = 0;
+               ctx->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&null);
+               ctx->PSSetSamplers(0, 1, (ID3D11SamplerState**)&null);
+       }
+};
+
+template<typename T, unsigned n>
+struct vec_t
+{
+       T v[n];
+
+       T& operator [](unsigned i)
+       {
+               return v[i];
+       }
+
+       const T& operator [](unsigned i) const
+       {
+               return v[i];
+       }
+};
+
+template<typename T, unsigned n>
+vec_t<T, n> operator -(const vec_t<T, n> a)
+{
+       vec_t<T, n> r;
+       for(unsigned i = 0; i < n; ++i)
+               r[i] = -a[i];
+       return r;
+}
+
+template<typename T, unsigned n>
+vec_t<T, n> operator +(const vec_t<T, n>& a, const vec_t<T, n>& b)
+{
+       vec_t<T, n> r;
+       for(unsigned i = 0; i < n; ++i)
+               r[i] = a[i] + b[i];
+       return r;
+}
+
+template<typename T, unsigned n>
+vec_t<T, n>& operator +=(vec_t<T, n>& a, const vec_t<T, n>& b)
+{
+       for(unsigned i = 0; i < n; ++i)
+               a[i] += b[i];
+       return a;
+}
+
+template<typename T, unsigned r, unsigned c>
+struct mat_t : public vec_t<vec_t<T, r>, c>
+{};
+
+template<typename T, unsigned n>
+vec_t<T, n> operator *(const vec_t<T, n>& a, const T& b)
+{
+       vec_t<T, n> r;
+       for(unsigned i = 0; i < n; ++i)
+               r[i] = a[i] * b;
+       return r;
+}
+
+template<typename T, unsigned n>
+vec_t<T, n> operator *(const T& b, const vec_t<T, n>& a)
+{
+       vec_t<T, n> r;
+       for(unsigned i = 0; i < n; ++i)
+               r[i] = a[i] * b;
+       return r;
+}
+
+template<typename T, unsigned d, unsigned e>
+vec_t<T, e> operator *(const mat_t<T, e, d>& m, const vec_t<T, d>& b)
+{
+       vec_t<T, e> r;
+       r = m[0] * b[0];
+       for(unsigned i = 1; i < d; ++i)
+               r += m[i] * b[i];
+       return r;
+}
+
+template<typename T, unsigned d, unsigned e, unsigned f>
+mat_t<T, e, f> operator *(const mat_t<T, e, d>& m, const mat_t<T, d, f>& b)
+{
+       mat_t<T, e, f> r;
+       for(unsigned i = 0; i < d; ++i)
+               r[i] = m * b[i];
+       return r;
+}
+
+template<typename T>
+vec_t<T, 3> vec(T a, T b, T c)
+{
+       vec_t<T, 4> v;
+       v[0] = a;
+       v[1] = b;
+       v[2] = c;
+       return v;
+}
+
+template<typename T>
+vec_t<T, 4> vec(T a, T b, T c, T d)
+{
+       vec_t<T, 4> v;
+       v[0] = a;
+       v[1] = b;
+       v[2] = c;
+       v[3] = d;
+       return v;
+}
+
+typedef mat_t<float, 4, 4> float4x4;
+typedef mat_t<float, 4, 3> float4x3;
+typedef mat_t<float, 3, 4> float3x4;
+typedef mat_t<float, 3, 3> float3x3;
+
+typedef vec_t<float, 3> float3;
+typedef vec_t<float, 4> float4;
+
+template<typename T>
+mat_t<T, 4, 4> mat4x4_frustum(T left, T right, T bottom, T top, T nearval, T farval)
+{
+       T x = (2.0f * nearval) / (right - left);
+       T y = (2.0f * nearval) / (top - bottom);
+       T a = (right + left) / (right - left);
+       T b = (top + bottom) / (top - bottom);
+       T c = -(farval + nearval) / (farval - nearval);
+       T d = -(2.0f * farval * nearval) / (farval - nearval);
+       T _0 = (T)0;
+
+       mat_t<T, 4, 4> m;       
+       m[0] = vec(x, _0, _0, _0);
+       m[1] = vec(_0, y, _0, _0);
+       m[2] = vec(a, b, c, (T)-1);
+       m[3] = vec(_0, _0, d, _0);
+       return m;
+}
+
+template<typename T>
+mat_t<T, 3, 3> mat3x3_diag(T v)
+{
+       mat_t<T, 3, 3> m;
+       T _0 = (T)0;
+       m[0] = vec(v, _0, _0);
+       m[1] = vec(_0, v, _0);
+       m[2] = vec(_0, _0, v);
+       return m;
+}
+
+template<typename T>
+mat_t<T, 4, 4> mat4x4_diag(T v)
+{
+       mat_t<T, 4, 4> m;
+       T _0 = (T)0;
+       m[0] = vec(v, _0, _0, _0);
+       m[1] = vec(_0, v, _0, _0);
+       m[2] = vec(_0, _0, v, _0);
+       m[3] = vec(_0, _0, _0, v);
+       return m;
+}
+
+template<typename T, unsigned n>
+mat_t<T, n, n> mat_push_rotate(const mat_t<T, n, n>& m, unsigned axis, T angle)
+{
+       T s = (T)sin(angle);
+       T c = (T)cos(angle);
+
+       mat_t<T, n, n> r = m;
+       unsigned a = (axis + 1) % 3;
+       unsigned b = (axis + 2) % 3;
+       r[a] = (m[a] * c) + (m[b] * s);
+       r[b] = -(m[a] * s) + (m[b] * c);
+       return r;
+}
+
+template<typename T, unsigned n>
+mat_t<T, n, n> mat_push_translate(const mat_t<T, n, n>& m, float x, float y, float z)
+{
+       mat_t<T, n, n> r = m;
+       vec_t<T, n> v;
+       v[0] = x;
+       v[1] = y;
+       v[2] = z;
+       if(n >= 4)
+               v[3] = (T)0;
+       r[3] += m * v;
+       return r;
+}
index 76903e5..8e71ec3 100755 (executable)
-/**************************************************************************\r
- *\r
- * Copyright 2010 Luca Barbieri\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining\r
- * a copy of this software and associated documentation files (the\r
- * "Software"), to deal in the Software without restriction, including\r
- * without limitation the rights to use, copy, modify, merge, publish,\r
- * distribute, sublicense, and/or sell copies of the Software, and to\r
- * permit persons to whom the Software is furnished to do so, subject to\r
- * the following conditions:\r
- *\r
- * The above copyright notice and this permission notice (including the\r
- * next paragraph) shall be included in all copies or substantial\r
- * portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE\r
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- **************************************************************************/\r
-\r
-#define INITGUID\r
-#include "d3d11app.h"\r
-#include "stdio.h"\r
-\r
-static d3d11_application* app;\r
-static IDXGISwapChain* swap_chain;\r
-static unsigned width, height;\r
-static DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM;\r
-static ID3D11Device* dev;\r
-static ID3D11DeviceContext* ctx;\r
-static int frames = 0;\r
-static int buffer_count = 1;\r
-\r
-LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)\r
-{\r
-       switch (message)\r
-       {\r
-       case WM_SIZE:\r
-               width = lParam & 0xffff;\r
-               height = lParam >> 16;\r
-               \r
-               swap_chain->ResizeBuffers(buffer_count, width, height, format, 0);\r
-               frames = 0;\r
-               break;\r
-       case WM_DESTROY:\r
-               PostQuitMessage(0);\r
-               break;\r
-       default:\r
-               return DefWindowProc(hwnd, message, wParam, lParam);\r
-       }\r
-       return 0;\r
-}\r
-\r
-int main(int argc, char** argv)\r
-{\r
-       HINSTANCE hInstance = GetModuleHandle(NULL);\r
-       WNDCLASSEXA wcex;\r
-\r
-       wcex.cbSize = sizeof(WNDCLASSEX);\r
-\r
-       wcex.style              = CS_HREDRAW | CS_VREDRAW;\r
-       wcex.lpfnWndProc        = WndProc;\r
-       wcex.cbClsExtra         = 0;\r
-       wcex.cbWndExtra         = 0;\r
-       wcex.hInstance          = hInstance;\r
-       wcex.hIcon              = 0;\r
-       wcex.hCursor            = LoadCursor(NULL, IDC_ARROW);\r
-       wcex.hbrBackground      = (HBRUSH)(COLOR_WINDOW+1);\r
-       wcex.lpszMenuName       = 0;\r
-       wcex.lpszClassName      = "d3d11";\r
-       wcex.hIconSm            = 0;\r
-\r
-       RegisterClassExA(&wcex);\r
-\r
-       HWND hwnd = CreateWindowA("d3d11", "d3d11", WS_OVERLAPPEDWINDOW,\r
-               CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);\r
-\r
-       if(!hwnd)\r
-               return FALSE;\r
-\r
-       RECT rc;\r
-       GetClientRect(hwnd, &rc );\r
-       width = rc.right - rc.left;\r
-       height = rc.bottom - rc.top;\r
-\r
-       DXGI_SWAP_CHAIN_DESC swap_chain_desc;\r
-       memset(&swap_chain_desc, 0, sizeof(swap_chain_desc));\r
-       swap_chain_desc.BufferDesc.Width = width;\r
-       swap_chain_desc.BufferDesc.Height = height;\r
-       swap_chain_desc.BufferDesc.Format = format;\r
-       swap_chain_desc.SampleDesc.Count = 1;\r
-       swap_chain_desc.SampleDesc.Quality = 0;\r
-       swap_chain_desc.OutputWindow = hwnd;\r
-       swap_chain_desc.Windowed = TRUE;\r
-       swap_chain_desc.BufferCount = buffer_count;\r
-       swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;\r
-       swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;\r
-       swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;\r
-\r
-       D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0;\r
-\r
-       HRESULT hr = D3D11CreateDeviceAndSwapChain(\r
-               NULL,\r
-               D3D_DRIVER_TYPE_HARDWARE,\r
-               NULL,\r
-               D3D11_CREATE_DEVICE_SINGLETHREADED, // | D3D11_CREATE_DEVICE_DEBUG,\r
-               NULL,\r
-               0,\r
-               D3D11_SDK_VERSION,\r
-               &swap_chain_desc,\r
-               &swap_chain,\r
-               &dev,\r
-               &feature_level,\r
-               &ctx);\r
-       if(!SUCCEEDED(hr))\r
-       {\r
-               fprintf(stderr, "Failed to create D3D11 device (hresult %08x)\n", hr);\r
-               return 1;\r
-       }\r
-\r
-       app = d3d11_application_create();\r
-       if(!app->init(dev, argc, argv))\r
-               return 1;\r
-\r
-       ShowWindow(hwnd, SW_SHOWDEFAULT);\r
-       UpdateWindow(hwnd);\r
-\r
-       LARGE_INTEGER freq;\r
-       QueryPerformanceFrequency(&freq);\r
-       double period = 1.0 / (double)freq.QuadPart;\r
-       LARGE_INTEGER ctime_li;\r
-       QueryPerformanceCounter(&ctime_li);\r
-       double start_time = ctime_li.QuadPart * period;\r
-\r
-       MSG msg;\r
-       for(;;)\r
-       {\r
-               if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))\r
-               {\r
-                       if(msg.message == WM_QUIT)\r
-                               break;\r
-                       TranslateMessage(&msg);\r
-                       DispatchMessage(&msg);\r
-               }\r
-               else if(width && height)\r
-               {\r
-                       ID3D11Texture2D* tex;\r
-                       static ID3D11RenderTargetView* rtv;\r
-                       ensure(swap_chain->GetBuffer(0, __uuidof(tex), (void**)&tex));\r
-                       ensure(dev->CreateRenderTargetView(tex, NULL, &rtv));\r
-\r
-                       QueryPerformanceCounter(&ctime_li);\r
-                       double ctime = (double)ctime_li.QuadPart * period - start_time;\r
-\r
-                       app->draw(ctx, rtv, width, height, ctime);\r
-                       ctx->OMSetRenderTargets(0, 0, 0);\r
-\r
-                       swap_chain->Present(0, 0);\r
-                       rtv->Release();\r
-                       tex->Release();\r
-               }\r
-               else\r
-                       WaitMessage();\r
-       }\r
-       return (int) msg.wParam;\r
-}\r
+/**************************************************************************
+ *
+ * Copyright 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#define INITGUID
+#include "d3d11app.h"
+#include "stdio.h"
+
+static d3d11_application* app;
+static IDXGISwapChain* swap_chain;
+static unsigned width, height;
+static DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM;
+static ID3D11Device* dev;
+static ID3D11DeviceContext* ctx;
+static int frames = 0;
+static int buffer_count = 1;
+
+LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+       switch (message)
+       {
+       case WM_SIZE:
+               width = lParam & 0xffff;
+               height = lParam >> 16;
+               
+               swap_chain->ResizeBuffers(buffer_count, width, height, format, 0);
+               frames = 0;
+               break;
+       case WM_DESTROY:
+               PostQuitMessage(0);
+               break;
+       default:
+               return DefWindowProc(hwnd, message, wParam, lParam);
+       }
+       return 0;
+}
+
+int main(int argc, char** argv)
+{
+       HINSTANCE hInstance = GetModuleHandle(NULL);
+       WNDCLASSEXA wcex;
+
+       wcex.cbSize = sizeof(WNDCLASSEX);
+
+       wcex.style              = CS_HREDRAW | CS_VREDRAW;
+       wcex.lpfnWndProc        = WndProc;
+       wcex.cbClsExtra         = 0;
+       wcex.cbWndExtra         = 0;
+       wcex.hInstance          = hInstance;
+       wcex.hIcon              = 0;
+       wcex.hCursor            = LoadCursor(NULL, IDC_ARROW);
+       wcex.hbrBackground      = (HBRUSH)(COLOR_WINDOW+1);
+       wcex.lpszMenuName       = 0;
+       wcex.lpszClassName      = "d3d11";
+       wcex.hIconSm            = 0;
+
+       RegisterClassExA(&wcex);
+
+       HWND hwnd = CreateWindowA("d3d11", "d3d11", WS_OVERLAPPEDWINDOW,
+               CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
+
+       if(!hwnd)
+               return FALSE;
+
+       RECT rc;
+       GetClientRect(hwnd, &rc );
+       width = rc.right - rc.left;
+       height = rc.bottom - rc.top;
+
+       DXGI_SWAP_CHAIN_DESC swap_chain_desc;
+       memset(&swap_chain_desc, 0, sizeof(swap_chain_desc));
+       swap_chain_desc.BufferDesc.Width = width;
+       swap_chain_desc.BufferDesc.Height = height;
+       swap_chain_desc.BufferDesc.Format = format;
+       swap_chain_desc.SampleDesc.Count = 1;
+       swap_chain_desc.SampleDesc.Quality = 0;
+       swap_chain_desc.OutputWindow = hwnd;
+       swap_chain_desc.Windowed = TRUE;
+       swap_chain_desc.BufferCount = buffer_count;
+       swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
+       swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+       swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
+
+       D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0;
+
+       HRESULT hr = D3D11CreateDeviceAndSwapChain(
+               NULL,
+               D3D_DRIVER_TYPE_HARDWARE,
+               NULL,
+               D3D11_CREATE_DEVICE_SINGLETHREADED, // | D3D11_CREATE_DEVICE_DEBUG,
+               NULL,
+               0,
+               D3D11_SDK_VERSION,
+               &swap_chain_desc,
+               &swap_chain,
+               &dev,
+               &feature_level,
+               &ctx);
+       if(!SUCCEEDED(hr))
+       {
+               fprintf(stderr, "Failed to create D3D11 device (hresult %08x)\n", hr);
+               return 1;
+       }
+
+       app = d3d11_application_create();
+       if(!app->init(dev, argc, argv))
+               return 1;
+
+       ShowWindow(hwnd, SW_SHOWDEFAULT);
+       UpdateWindow(hwnd);
+
+       LARGE_INTEGER freq;
+       QueryPerformanceFrequency(&freq);
+       double period = 1.0 / (double)freq.QuadPart;
+       LARGE_INTEGER ctime_li;
+       QueryPerformanceCounter(&ctime_li);
+       double start_time = ctime_li.QuadPart * period;
+
+       MSG msg;
+       for(;;)
+       {
+               if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+               {
+                       if(msg.message == WM_QUIT)
+                               break;
+                       TranslateMessage(&msg);
+                       DispatchMessage(&msg);
+               }
+               else if(width && height)
+               {
+                       ID3D11Texture2D* tex;
+                       static ID3D11RenderTargetView* rtv;
+                       ensure(swap_chain->GetBuffer(0, __uuidof(tex), (void**)&tex));
+                       ensure(dev->CreateRenderTargetView(tex, NULL, &rtv));
+
+                       QueryPerformanceCounter(&ctime_li);
+                       double ctime = (double)ctime_li.QuadPart * period - start_time;
+
+                       app->draw(ctx, rtv, width, height, ctime);
+                       ctx->OMSetRenderTargets(0, 0, 0);
+
+                       swap_chain->Present(0, 0);
+                       rtv->Release();
+                       tex->Release();
+               }
+               else
+                       WaitMessage();
+       }
+       return (int) msg.wParam;
+}
index 1271499..2fadf4e 100755 (executable)
-#include "d3d11app.h"\r
-#include <X11/Xlib.h>\r
-#include <galliumdxgi.h>\r
-#include <sys/time.h>\r
-\r
-static d3d11_application* app;\r
-static IDXGISwapChain* swap_chain;\r
-unsigned width, height;\r
-DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM;\r
-static ID3D11Device* dev;\r
-static ID3D11DeviceContext* ctx;\r
-\r
-double get_time()\r
-{\r
-       struct timeval tv;\r
-       gettimeofday(&tv, 0);\r
-       return (double)tv.tv_sec + (double)tv.tv_usec * 0.000001;\r
-}\r
-\r
-int main(int argc, char** argv)\r
-{\r
-       Display* dpy = XOpenDisplay(0);\r
-       Visual* visual = DefaultVisual(dpy, DefaultScreen(dpy));\r
-       Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, DefaultScreen(dpy)), visual, AllocNone);\r
-       XSetWindowAttributes swa;\r
-       swa.colormap = cmap;\r
-       swa.border_pixel = 0;\r
-       swa.event_mask = StructureNotifyMask;\r
-       width = 512;\r
-       height = 512;\r
-       Window win = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, width, height, 0, CopyFromParent, InputOutput, visual, CWBorderPixel | CWColormap| CWEventMask, &swa);\r
-       XMapWindow(dpy, win);\r
-\r
-       GalliumDXGIUseX11Display(dpy, 0);\r
-\r
-       DXGI_SWAP_CHAIN_DESC swap_chain_desc;\r
-       memset(&swap_chain_desc, 0, sizeof(swap_chain_desc));\r
-       swap_chain_desc.BufferDesc.Width = width;\r
-       swap_chain_desc.BufferDesc.Height = height;\r
-       swap_chain_desc.BufferDesc.Format = format;\r
-       swap_chain_desc.SampleDesc.Count = 1;\r
-       swap_chain_desc.SampleDesc.Quality = 0;\r
-       swap_chain_desc.OutputWindow = (HWND)win;\r
-       swap_chain_desc.Windowed = TRUE;\r
-       swap_chain_desc.BufferCount = 3;\r
-       swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;\r
-       swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;\r
-\r
-       D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0;\r
-\r
-       HRESULT hr =D3D11CreateDeviceAndSwapChain(\r
-               NULL,\r
-               D3D_DRIVER_TYPE_HARDWARE,\r
-               NULL,\r
-               D3D11_CREATE_DEVICE_SINGLETHREADED,\r
-               NULL,\r
-               0,\r
-               D3D11_SDK_VERSION,\r
-               &swap_chain_desc,\r
-               &swap_chain,\r
-               &dev,\r
-               &feature_level,\r
-               &ctx);\r
-       if(!SUCCEEDED(hr))\r
-       {\r
-               fprintf(stderr, "Failed to create D3D11 device (hresult %08x)\n", hr);\r
-               return 1;\r
-       }\r
-\r
-       app = d3d11_application_create();\r
-       if(!app->init(dev, argc, argv))\r
-               return 1;\r
-\r
-       double start_time = get_time();\r
-\r
-       MSG msg;\r
-       for(;;)\r
-       {\r
-               XEvent event;\r
-               if(XPending(dpy))\r
-               {\r
-                       XNextEvent(dpy, &event);\r
-                       if(event.type == DestroyNotify)\r
-                               break;\r
-                       switch(event.type)\r
-                       {\r
-                       case ConfigureNotify:\r
-                               width = event.xconfigure.width;\r
-                               height = event.xconfigure.height;\r
-                               swap_chain->ResizeBuffers(3, width, height, format, 0);\r
-                               break;\r
-                       }\r
-               }\r
-               else if(width && height)\r
-               {\r
-                       ID3D11Texture2D* tex;\r
-                       ID3D11RenderTargetView* rtv;\r
-                       ensure(swap_chain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&tex));\r
-                       ensure(dev->CreateRenderTargetView(tex, NULL, &rtv));\r
-\r
-                       double ctime = get_time() - start_time;\r
-\r
-                       app->draw(ctx, rtv, width, height, ctime);\r
-                       ctx->OMSetRenderTargets(0, 0, 0);\r
-\r
-                       tex->Release();\r
-                       rtv->Release();\r
-                       swap_chain->Present(0, 0);\r
-               }\r
-               else\r
-                       XPeekEvent(dpy, &event);\r
-       }\r
-       return (int) msg.wParam;\r
-}\r
+#include "d3d11app.h"
+#include <X11/Xlib.h>
+#include <galliumdxgi.h>
+#include <sys/time.h>
+
+static d3d11_application* app;
+static IDXGISwapChain* swap_chain;
+unsigned width, height;
+DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM;
+static ID3D11Device* dev;
+static ID3D11DeviceContext* ctx;
+
+double get_time()
+{
+       struct timeval tv;
+       gettimeofday(&tv, 0);
+       return (double)tv.tv_sec + (double)tv.tv_usec * 0.000001;
+}
+
+int main(int argc, char** argv)
+{
+       Display* dpy = XOpenDisplay(0);
+       Visual* visual = DefaultVisual(dpy, DefaultScreen(dpy));
+       Colormap cmap = XCreateColormap(dpy, RootWindow(dpy, DefaultScreen(dpy)), visual, AllocNone);
+       XSetWindowAttributes swa;
+       swa.colormap = cmap;
+       swa.border_pixel = 0;
+       swa.event_mask = StructureNotifyMask;
+       width = 512;
+       height = 512;
+       Window win = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)), 0, 0, width, height, 0, CopyFromParent, InputOutput, visual, CWBorderPixel | CWColormap| CWEventMask, &swa);
+       XMapWindow(dpy, win);
+
+       GalliumDXGIUseX11Display(dpy, 0);
+
+       DXGI_SWAP_CHAIN_DESC swap_chain_desc;
+       memset(&swap_chain_desc, 0, sizeof(swap_chain_desc));
+       swap_chain_desc.BufferDesc.Width = width;
+       swap_chain_desc.BufferDesc.Height = height;
+       swap_chain_desc.BufferDesc.Format = format;
+       swap_chain_desc.SampleDesc.Count = 1;
+       swap_chain_desc.SampleDesc.Quality = 0;
+       swap_chain_desc.OutputWindow = (HWND)win;
+       swap_chain_desc.Windowed = TRUE;
+       swap_chain_desc.BufferCount = 3;
+       swap_chain_desc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
+       swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
+
+       D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0;
+
+       HRESULT hr =D3D11CreateDeviceAndSwapChain(
+               NULL,
+               D3D_DRIVER_TYPE_HARDWARE,
+               NULL,
+               D3D11_CREATE_DEVICE_SINGLETHREADED,
+               NULL,
+               0,
+               D3D11_SDK_VERSION,
+               &swap_chain_desc,
+               &swap_chain,
+               &dev,
+               &feature_level,
+               &ctx);
+       if(!SUCCEEDED(hr))
+       {
+               fprintf(stderr, "Failed to create D3D11 device (hresult %08x)\n", hr);
+               return 1;
+       }
+
+       app = d3d11_application_create();
+       if(!app->init(dev, argc, argv))
+               return 1;
+
+       double start_time = get_time();
+
+       MSG msg;
+       for(;;)
+       {
+               XEvent event;
+               if(XPending(dpy))
+               {
+                       XNextEvent(dpy, &event);
+                       if(event.type == DestroyNotify)
+                               break;
+                       switch(event.type)
+                       {
+                       case ConfigureNotify:
+                               width = event.xconfigure.width;
+                               height = event.xconfigure.height;
+                               swap_chain->ResizeBuffers(3, width, height, format, 0);
+                               break;
+                       }
+               }
+               else if(width && height)
+               {
+                       ID3D11Texture2D* tex;
+                       ID3D11RenderTargetView* rtv;
+                       ensure(swap_chain->GetBuffer(0, IID_ID3D11Texture2D, (void**)&tex));
+                       ensure(dev->CreateRenderTargetView(tex, NULL, &rtv));
+
+                       double ctime = get_time() - start_time;
+
+                       app->draw(ctx, rtv, width, height, ctime);
+                       ctx->OMSetRenderTargets(0, 0, 0);
+
+                       tex->Release();
+                       rtv->Release();
+                       swap_chain->Present(0, 0);
+               }
+               else
+                       XPeekEvent(dpy, &event);
+       }
+       return (int) msg.wParam;
+}
index de9946c..0edf1f2 100755 (executable)
-/*\r
-* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.\r
-* Copyright (C) 2009-2010 Luca Barbieri All Rights Reserved.\r
-*\r
-* Permission is hereby granted, free of charge, to any person obtaining a\r
-* copy of this software and associated documentation files (the "Software"),\r
-* to deal in the Software without restriction, including without limitation\r
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
-* and/or sell copies of the Software, and to permit persons to whom the\r
-* Software is furnished to do so, subject to the following conditions:\r
-*.\r
-* The above copyright notice and this permission notice shall be included\r
-* in all copies or substantial portions of the Software.\r
-*\r
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r
-* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r
-* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
-* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
-*/\r
-\r
-/*\r
-* This is a port of the infamous "glxgears" demo to straight EGL\r
-* Port by Dane Rushton 10 July 2005\r
-*\r
-* This a rewrite of the 'eglgears' demo in straight Gallium\r
-* Port by Luca Barbieri\r
-*\r
-* This a port of the 'galliumgears' demo to Direct3D 11\r
-* Port by Luca Barbieri\r
-*/\r
-\r
-#define _USE_MATH_DEFINES\r
-#include "d3d11app.h"\r
-#include "d3d11u.h"\r
-#include "d3d11gears.hlsl.ps.h"\r
-#include "d3d11gears.hlsl.vs.h"\r
-\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include <math.h>\r
-#include <float.h>\r
-\r
-struct gear\r
-{\r
-       struct mesh* mesh;\r
-       float x;\r
-       float y;\r
-       float t0;\r
-       float wmul;\r
-       float4 color;\r
-};\r
-\r
-struct cbuf_t\r
-{\r
-       float4x4 projection;\r
-       float4x4 modelview;\r
-       float4 light;\r
-       float4 diffuse;\r
-       float4 specular;\r
-       float specular_power;\r
-       float padding[3];\r
-};\r
-\r
-struct gear gears[3];\r
-\r
-struct vertex\r
-{\r
-       float position[3];\r
-       float normal[3];\r
-\r
-       vertex(float x, float y, float z, float nx, float ny, float nz)\r
-       {\r
-               position[0] = x;\r
-               position[1] = y;\r
-               position[2] = z;\r
-               normal[0] = nx;\r
-               normal[1] = ny;\r
-               normal[2] = nz;\r
-       }\r
-};\r
-\r
-#define VERT(x, y, z) vertices.push_back(vertex((x), (y), (z), (nx), (ny), (nz)))\r
-\r
-static mesh* build_gear(ID3D11Device* dev, int triangle_budget, float inner_radius, float outer_radius, float width, int teeth, float tooth_depth)\r
-{\r
-       int i, j, k;\r
-       float r0, r1, r2;\r
-       float da;\r
-       float nx, ny, nz;\r
-       int face;\r
-       int segs = 4;\r
-       int base_triangles = teeth * segs * 2 * 2;\r
-       int divs0 = (triangle_budget / base_triangles) - 1;\r
-       int divs = (divs0 > 0) ? divs0 : 1;\r
-       float* c = (float*)malloc(teeth * segs * sizeof(float));\r
-       float* s = (float*)malloc(teeth * segs * sizeof(float));\r
-       float* dc = (float*)malloc(teeth * segs * divs * sizeof(float));\r
-       float* ds = (float*)malloc(teeth * segs * divs * sizeof(float));\r
-       int num_vertices = teeth * segs * 2 * (3 + 2 * divs);\r
-       int num_triangles = base_triangles * (1 + divs);\r
-       printf("Creating gear with %i teeth using %i vertices used in %i triangles\n", teeth, num_vertices, num_triangles);\r
-       triangle_list_indices<> indices;\r
-       std::vector<vertex> vertices;\r
-\r
-       r0 = inner_radius;\r
-       r1 = outer_radius - tooth_depth / 2.0f;\r
-       r2 = outer_radius + tooth_depth / 2.0f;\r
-\r
-       da = (float)(2.0 * M_PI / (teeth * segs * divs));\r
-       for(i = 0; i < teeth * segs * divs; ++i) {\r
-               float angle = da * i;\r
-               ds[i] = sin(angle);\r
-               dc[i] = cos(angle);\r
-       }\r
-\r
-       for(i = 0; i < teeth * segs; ++i) {\r
-               s[i] = ds[i * divs];\r
-               c[i] = dc[i * divs];\r
-       }\r
-\r
-       /* faces */\r
-       for(face = -1; face <= 1; face += 2) {\r
-               float z = width * face * 0.5f;\r
-               nx = 0.0f;\r
-               ny = 0.0f;\r
-               nz = (float)face;\r
-\r
-               indices.flip = face > 0;\r
-\r
-               assert(segs == 4);\r
-               for(i = 0; i < teeth; ++i) {\r
-                       VERT(r1 * c[segs * i], r1 * s[segs * i], z);\r
-                       VERT(r2 * c[segs * i + 1], r2 * s[segs * i + 1], z);\r
-                       VERT(r2 * c[segs * i + 2], r2 * s[segs * i + 2], z);\r
-                       VERT(r1 * c[segs * i + 3], r1 * s[segs * i + 3], z);\r
-               }\r
-\r
-               for(i = 0; i < teeth * segs * divs; ++i) {\r
-                       VERT(r0 * dc[i], r0 * ds[i], z);\r
-               }\r
-\r
-               for(i = 0; i < teeth; ++i) {\r
-                       for(j = i * segs; j < (i + 1) * segs; ++j) {\r
-                               int nextj = j + 1;\r
-                               if(nextj == teeth * segs)\r
-                                       nextj = 0;\r
-\r
-                               for(k = j * divs; k < (j + 1) * divs; ++k) {\r
-                                       int nextk = k + 1;\r
-                                       if(nextk == teeth * segs * divs)\r
-                                               nextk = 0;\r
-                                       indices.poly(teeth * segs + k, j, teeth * segs + nextk);\r
-                               }\r
-\r
-                               indices.poly(teeth * segs + nextj * divs, j, nextj);\r
-                       }\r
-               }\r
-\r
-               indices.base += teeth * segs * (1 + divs);\r
-       }\r
-\r
-       /* teeth faces */\r
-       indices.flip = true;\r
-       float z = width * 0.5f;\r
-\r
-       float* coords = (float*)malloc((segs + 1) * 2 * sizeof(float));\r
-       nz = 0;\r
-       for(i = 0; i < teeth; i++) {\r
-               int next = i + 1;\r
-               if(next == teeth)\r
-                       next = 0;\r
-\r
-               coords[0] = r1 * c[segs * i];\r
-               coords[1] = r1 * s[segs * i];\r
-               coords[2] = r2 * c[segs * i + 1];\r
-               coords[3] = r2 * s[segs * i + 1];\r
-               coords[4] = r2 * c[segs * i + 2];\r
-               coords[5] = r2 * s[segs * i + 2];\r
-               coords[6] = r1 * c[segs * i + 3];\r
-               coords[7] = r1 * s[segs * i + 3];\r
-               coords[8] = r1 * c[segs * next];\r
-               coords[9] = r1 * s[segs * next];\r
-\r
-               for(int j = 0; j < segs; ++j) {\r
-                       float dx = coords[j * 2] - coords[j * 2 + 2];\r
-                       float dy = coords[j * 2 + 1] - coords[j * 2 + 3];\r
-                       float len = hypotf(dx, dy);\r
-                       nx = -dy / len;\r
-                       ny = dx / len;\r
-                       VERT(coords[j * 2], coords[j * 2 + 1], z);\r
-                       VERT(coords[j * 2], coords[j * 2 + 1], -z);\r
-                       VERT(coords[j * 2 + 2], coords[j * 2 + 3], z);\r
-                       VERT(coords[j * 2 + 2], coords[j * 2 + 3], -z);\r
-\r
-                       indices.poly(0, 1, 3, 2);\r
-                       indices.base += 4;\r
-               }\r
-       }\r
-       free(coords);\r
-\r
-       /* inner part - simulate a cylinder */\r
-       indices.flip = true;\r
-       for(i = 0; i < teeth * segs * divs; i++) {\r
-               int next = i + 1;\r
-               if(next == teeth * segs * divs)\r
-                       next = 0;\r
-\r
-               nx = -dc[i];\r
-               ny = -ds[i];\r
-               VERT(r0 * dc[i], r0 * ds[i], -width * 0.5f);\r
-               VERT(r0 * dc[i], r0 * ds[i], width * 0.5f);\r
-\r
-               indices.poly(i * 2, i * 2 + 1, next * 2 + 1, next * 2);\r
-       }\r
-\r
-       indices.base += teeth * segs * divs * 2;\r
-       free(c);\r
-       free(s);\r
-       free(dc);\r
-       free(ds);\r
-\r
-       D3D11_INPUT_ELEMENT_DESC elements[2] =\r
-       {\r
-               {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},\r
-               {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},\r
-       };\r
-\r
-       return new mesh(dev, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST,\r
-               elements, 2,\r
-               g_vs, sizeof(g_vs),\r
-               &vertices[0], sizeof(vertices[0]), vertices.size(),\r
-               &indices[0], sizeof(indices[0]), indices.size());\r
-}\r
-\r
-struct d3d11gears : public d3d11_application\r
-{\r
-       float view_rotx;\r
-       float view_roty;\r
-       float view_rotz;\r
-       int wireframe;\r
-       int triangles;\r
-       float speed;\r
-       float period;\r
-       unsigned impressions;\r
-       bool blue_only;\r
-\r
-       float last_time;\r
-       \r
-       int cur_width;\r
-       int cur_height;\r
-\r
-       ID3D11DepthStencilView* zsv;\r
-       ID3D11RenderTargetView* offscreen_rtv;\r
-       ID3D11ShaderResourceView* offscreen_srv;\r
-       \r
-       ID3D11Device* dev;\r
-       ID3D11BlendState* blend;\r
-       ID3D11DepthStencilState* zsa;\r
-\r
-       ID3D11PixelShader* ps;\r
-       ID3D11VertexShader* vs;\r
-       ID3D11Buffer* cb;\r
-\r
-       d3d11_blitter* blitter;\r
-\r
-       d3d11gears()\r
-               : cur_width(-1), cur_height(-1), zsv(0), offscreen_rtv(0), offscreen_srv(0)\r
-       {\r
-               view_rotx = (float)(M_PI / 9.0);\r
-               view_roty = (float)(M_PI / 6.0);\r
-               view_rotz = 0.0f;\r
-               wireframe = 0;\r
-               triangles = 3200;\r
-               speed = 1.0f;\r
-               period = -1.0f;\r
-               impressions = 1;\r
-               blue_only = false;\r
-       }\r
-\r
-       void draw_one(ID3D11DeviceContext* ctx, cbuf_t& cbd, const float4x4& modelview, float angle)\r
-       {\r
-               for(unsigned i = blue_only ? 2 : 0; i < 3; ++i)\r
-               {\r
-                       float4x4 m2 = modelview;\r
-                       m2 = mat_push_translate(m2, gears[i].x, gears[i].y, 0.0f);\r
-                       m2 = mat_push_rotate(m2, 2, angle * gears[i].wmul + gears[i].t0);\r
-\r
-                       cbd.modelview = m2;\r
-                       cbd.diffuse = gears[i].color;\r
-                       cbd.specular = gears[i].color;\r
-                       cbd.specular_power = 5.0f;\r
-\r
-                       ctx->UpdateSubresource(cb, 0, 0, &cbd, 0, 0);\r
-\r
-                       gears[i].mesh->bind_and_draw(ctx);\r
-               }\r
-       }\r
-\r
-       float get_angle(double time)\r
-       {\r
-               // designed so that 1 = original glxgears speed\r
-               float mod_speed = M_PI * 70.0f / 180.0f * speed;\r
-               if(period < 0)\r
-                       return (float)(time * mod_speed);\r
-               else\r
-                       return (float)(cos(time / period) * period * mod_speed);\r
-       }\r
-\r
-       void init_for_dimensions(unsigned width, unsigned height)\r
-       {\r
-               if(zsv)\r
-                       zsv->Release();\r
-               ID3D11Texture2D* zsbuf;\r
-               D3D11_TEXTURE2D_DESC zsbufd;\r
-               memset(&zsbufd, 0, sizeof(zsbufd));\r
-               zsbufd.Width = width;\r
-               zsbufd.Height = height;\r
-               zsbufd.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;\r
-               zsbufd.ArraySize = 1;\r
-               zsbufd.MipLevels = 1;\r
-               zsbufd.SampleDesc.Count = 1;\r
-               zsbufd.BindFlags = D3D11_BIND_DEPTH_STENCIL;\r
-               ensure(dev->CreateTexture2D(&zsbufd, 0, &zsbuf));\r
-               ensure(dev->CreateDepthStencilView(zsbuf, 0, &zsv));\r
-               zsbuf->Release();\r
-\r
-               ID3D11Texture2D* offscreen;\r
-               if(offscreen_rtv)\r
-               {\r
-                       offscreen_rtv->Release();\r
-                       offscreen_srv->Release();\r
-                       offscreen_rtv = 0;\r
-                       offscreen_srv = 0;\r
-               }\r
-\r
-               if(impressions > 1)\r
-               {\r
-                       DXGI_FORMAT formats[] = {\r
-                               DXGI_FORMAT_R32G32B32A32_FLOAT,\r
-                               DXGI_FORMAT_R16G16B16A16_UNORM,\r
-                               DXGI_FORMAT_R16G16B16A16_FLOAT,\r
-                               DXGI_FORMAT_R10G10B10A2_UNORM,\r
-                       };\r
-                       DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; // this won't work well at all\r
-                       unsigned needed_support = D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_BLENDABLE | D3D11_FORMAT_SUPPORT_SHADER_SAMPLE;\r
-                       for(unsigned i = 0; i < sizeof(formats); ++i)\r
-                       {       \r
-                               unsigned support;\r
-                               dev->CheckFormatSupport(DXGI_FORMAT_R32G32B32A32_FLOAT, &support);\r
-                               if((support & needed_support) == needed_support)\r
-                               {\r
-                                       format = formats[i];\r
-                                       break;\r
-                               }\r
-                       }\r
-                               \r
-\r
-                       D3D11_TEXTURE2D_DESC offscreend;\r
-                       memset(&offscreend, 0, sizeof(offscreend));\r
-                       offscreend.Width = width;\r
-                       offscreend.Height = height;\r
-                               \r
-                       offscreend.Format = format;\r
-                       offscreend.MipLevels = 1;\r
-                       offscreend.ArraySize = 1;\r
-                       offscreend.SampleDesc.Count = 1;\r
-                       offscreend.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;\r
-                       ensure(dev->CreateTexture2D(&offscreend, 0, &offscreen));\r
-                       ensure(dev->CreateRenderTargetView(offscreen, 0, &offscreen_rtv));\r
-                       ensure(dev->CreateShaderResourceView(offscreen, 0, &offscreen_srv));\r
-                       offscreen->Release();\r
-               }\r
-\r
-               cur_width = width;\r
-               cur_height = height;\r
-       }\r
-\r
-       void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time)\r
-       {\r
-               D3D11_VIEWPORT vp;\r
-               memset(&vp, 0, sizeof(vp));\r
-               vp.Width = (float)width;\r
-               vp.Height = (float)height;\r
-               vp.MaxDepth = 1.0f;\r
-\r
-               if((int)width != cur_width || (int)height != cur_height)\r
-                       init_for_dimensions(width, height);\r
-\r
-               float4 lightpos = vec(5.0f, 5.0f, 10.0f, 0.0f);\r
-               float black[4] = {0.0, 0.0, 0.0, 0};\r
-\r
-               float4x4 proj;\r
-               float4x4 m;\r
-\r
-               float xr = (float)width / (float)height;\r
-               float yr = 1.0f;\r
-               if(xr < 1.0f) {\r
-                       yr /= xr;\r
-                       xr = 1.0f;\r
-               }\r
-               proj = mat4x4_frustum(-xr, xr, -yr, yr, 5.0f, 60.0f);\r
-\r
-               m = mat4x4_diag(1.0f);\r
-               m = mat_push_translate(m, 0.0f, 0.0f, -40.0f);\r
-               m = mat_push_rotate(m, 0, view_rotx);\r
-               m = mat_push_rotate(m, 1, view_roty);\r
-               m = mat_push_rotate(m, 2, view_rotz);\r
-\r
-               cbuf_t cbd;\r
-\r
-               cbd.projection = proj;\r
-               cbd.light = lightpos;\r
-\r
-               float blend_factor[4] = {1.0f / (float)impressions, 1.0f / (float)impressions, 1.0f / (float)impressions, 1.0f / (float)impressions};\r
-\r
-               ID3D11RenderTargetView* render_rtv;\r
-               if(impressions == 1)\r
-                       render_rtv = rtv;\r
-               else\r
-                       render_rtv = offscreen_rtv;\r
-\r
-               ctx->RSSetViewports(1, &vp);\r
-               ctx->ClearRenderTargetView(render_rtv, black);\r
-               \r
-               ctx->PSSetShader(ps, 0, 0);\r
-               ctx->VSSetShader(vs, 0, 0);\r
-\r
-               ctx->PSSetConstantBuffers(0, 1, &cb);\r
-               ctx->VSSetConstantBuffers(0, 1, &cb);\r
-\r
-               if(impressions == 1)\r
-               {\r
-                       ctx->OMSetBlendState(0, 0, ~0);\r
-                       ctx->OMSetDepthStencilState(0, 0);\r
-                       ctx->OMSetRenderTargets(1, &rtv, zsv);\r
-                       ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0, 0);\r
-                       draw_one(ctx, cbd, m, get_angle(time));\r
-               }\r
-               else\r
-               {\r
-                       ctx->OMSetBlendState(blend, blend_factor, ~0);\r
-\r
-                       float time_delta = (float)time - last_time;\r
-                       float time_delta_per_impression = time_delta / impressions;\r
-                       float base_time = last_time + time_delta_per_impression / 2;\r
-                       for(unsigned impression = 0; impression < impressions; ++impression)\r
-                       {\r
-                               float impression_time = base_time + time_delta_per_impression * impression;\r
-\r
-                               ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0, 0);\r
-\r
-                               // do early z-pass since we must not write any pixel more than once due to blending\r
-                               for(unsigned pass = 0; pass < 2; ++pass)\r
-                               {\r
-                                       if(pass == 0)\r
-                                       {\r
-                                               ctx->OMSetRenderTargets(0, 0, zsv);\r
-                                               ctx->OMSetDepthStencilState(0, 0);\r
-                                       }\r
-                                       else\r
-                                       {\r
-                                               ctx->OMSetRenderTargets(1, &render_rtv, zsv);\r
-                                               ctx->OMSetDepthStencilState(zsa, 0);\r
-                                       }\r
-\r
-                                       draw_one(ctx, cbd, m, get_angle(impression_time));\r
-                               }\r
-                       }\r
-\r
-                       blitter->bind_draw_and_unbind(ctx, offscreen_srv, rtv, 0, 0, (float)width, (float)height, false);\r
-               }\r
-               last_time = (float)time;\r
-       }\r
-\r
-       bool init(ID3D11Device* dev, int argc, char** argv)\r
-       {\r
-               this->dev = dev;\r
-\r
-               for(char** p = argv + 1; *p; ++p) {\r
-                       if(!strcmp(*p, "-w"))\r
-                               wireframe = 1;\r
-                       else if(!strcmp(*p, "-b"))\r
-                               blue_only = true;\r
-                       else if(!strcmp(*p, "-t"))\r
-                               triangles = atoi(*++p);\r
-                       else if(!strcmp(*p, "-m"))\r
-                               impressions = (float)atof(*++p);\r
-                       else if(!strcmp(*p, "-p"))\r
-                               period = (float)atof(*++p);\r
-                       else if(!strcmp(*p, "-s"))\r
-                               speed = (float)atof(*++p);\r
-                       else {\r
-                               fprintf(stderr, "Usage: d3d11gears [-v|-w] [-t TRIANGLES]\n");\r
-                               fprintf(stderr, "d3d11gears is an enhanced port of glxgears to Direct3D 11\n");\r
-                               fprintf(stderr, "\n");\r
-                               //fprintf(stderr, "-v\t\tuse per-vertex diffuse-only lighting (classic glxgears look)\n");\r
-                               fprintf(stderr, "-w\t\twireframe mode\n");\r
-                               fprintf(stderr, "-t TRIANGLES\ttriangle budget (default is 3200)\n");\r
-                               fprintf(stderr, "-m IMPRESSIONS\tmotion blur impressions (default is 1)\n");\r
-                               fprintf(stderr, "-p PERIOD\tspeed reversal period (default is infinite)\n");\r
-                               fprintf(stderr, "-s SPEED\tgear speed (default is 1.0)\n");\r
-                               fprintf(stderr, "-b\tonly show blue gear (for faster motion blur)\n");\r
-                               return false;\r
-                       }\r
-               }\r
-\r
-               ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps));\r
-               ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs));\r
-\r
-               gears[0].color = vec(0.8f, 0.1f, 0.0f, 1.0f);\r
-               gears[1].color = vec(0.0f, 0.8f, 0.2f, 1.0f);\r
-               gears[2].color = vec(0.2f, 0.2f, 1.0f, 1.0f);\r
-\r
-               gears[0].mesh = build_gear(dev, triangles / 2, 1.0f, 4.0f, 1.0f, 20, 0.7f);\r
-               gears[1].mesh = build_gear(dev, triangles / 4, 0.5f, 2.0f, 2.0f, 10, 0.7f);\r
-               gears[2].mesh = build_gear(dev, triangles / 4, 1.3f, 2.0f, 0.5f, 10, 0.7f);\r
-\r
-               gears[0].x = -3.0f;\r
-               gears[0].y = -2.0f;\r
-               gears[0].wmul = 1.0f;\r
-               gears[0].t0 = 0.0 * M_PI / 180.0f;\r
-\r
-               gears[1].x = 3.1f;\r
-               gears[1].y = -2.0f;\r
-               gears[1].wmul = -2.0f;\r
-               gears[1].t0 = -9.0f * (float)M_PI / 180.0f;\r
-\r
-               gears[2].x = -3.1f;\r
-               gears[2].y = 4.2f;\r
-               gears[2].wmul = -2.0f;\r
-               gears[2].t0 = -25.0f * (float)M_PI / 180.0f;\r
-\r
-               D3D11_BUFFER_DESC bufferd;\r
-               memset(&bufferd, 0, sizeof(bufferd));\r
-               bufferd.ByteWidth = sizeof(cbuf_t);\r
-               bufferd.Usage = D3D11_USAGE_DEFAULT;\r
-               bufferd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;\r
-               ensure(dev->CreateBuffer(&bufferd, 0, &cb));\r
-\r
-               if(impressions > 1)\r
-               {\r
-                       D3D11_BLEND_DESC blendd;\r
-                       memset(&blendd, 0, sizeof(blendd));\r
-                       blendd.RenderTarget[0].BlendEnable = TRUE;\r
-                       blendd.RenderTarget[0].BlendOp = blendd.RenderTarget[0].BlendOpAlpha\r
-                               = D3D11_BLEND_OP_ADD;\r
-                       blendd.RenderTarget[0].SrcBlend = blendd.RenderTarget[0].SrcBlendAlpha\r
-                               = D3D11_BLEND_BLEND_FACTOR;\r
-                       blendd.RenderTarget[0].DestBlend = blendd.RenderTarget[0].DestBlendAlpha\r
-                               = D3D11_BLEND_ONE;\r
-                       blendd.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;\r
-                       ensure(dev->CreateBlendState(&blendd, &blend));\r
-\r
-                       D3D11_DEPTH_STENCIL_DESC zsad;\r
-                       memset(&zsad, 0, sizeof(zsad));\r
-                       zsad.DepthEnable = TRUE;\r
-                       zsad.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;\r
-                       zsad.DepthFunc = D3D11_COMPARISON_EQUAL;\r
-                       ensure(dev->CreateDepthStencilState(&zsad, &zsa));\r
-\r
-                       blitter = new d3d11_blitter(dev);\r
-               }\r
-                       \r
-               return true;\r
-       }\r
-};\r
-\r
-d3d11_application* d3d11_application_create()\r
-{\r
-       return new d3d11gears();\r
-}\r
+/*
+* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+* Copyright (C) 2009-2010 Luca Barbieri All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*.
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+/*
+* This is a port of the infamous "glxgears" demo to straight EGL
+* Port by Dane Rushton 10 July 2005
+*
+* This a rewrite of the 'eglgears' demo in straight Gallium
+* Port by Luca Barbieri
+*
+* This a port of the 'galliumgears' demo to Direct3D 11
+* Port by Luca Barbieri
+*/
+
+#define _USE_MATH_DEFINES
+#include "d3d11app.h"
+#include "d3d11u.h"
+#include "d3d11gears.hlsl.ps.h"
+#include "d3d11gears.hlsl.vs.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <float.h>
+
+struct gear
+{
+       struct mesh* mesh;
+       float x;
+       float y;
+       float t0;
+       float wmul;
+       float4 color;
+};
+
+struct cbuf_t
+{
+       float4x4 projection;
+       float4x4 modelview;
+       float4 light;
+       float4 diffuse;
+       float4 specular;
+       float specular_power;
+       float padding[3];
+};
+
+struct gear gears[3];
+
+struct vertex
+{
+       float position[3];
+       float normal[3];
+
+       vertex(float x, float y, float z, float nx, float ny, float nz)
+       {
+               position[0] = x;
+               position[1] = y;
+               position[2] = z;
+               normal[0] = nx;
+               normal[1] = ny;
+               normal[2] = nz;
+       }
+};
+
+#define VERT(x, y, z) vertices.push_back(vertex((x), (y), (z), (nx), (ny), (nz)))
+
+static mesh* build_gear(ID3D11Device* dev, int triangle_budget, float inner_radius, float outer_radius, float width, int teeth, float tooth_depth)
+{
+       int i, j, k;
+       float r0, r1, r2;
+       float da;
+       float nx, ny, nz;
+       int face;
+       int segs = 4;
+       int base_triangles = teeth * segs * 2 * 2;
+       int divs0 = (triangle_budget / base_triangles) - 1;
+       int divs = (divs0 > 0) ? divs0 : 1;
+       float* c = (float*)malloc(teeth * segs * sizeof(float));
+       float* s = (float*)malloc(teeth * segs * sizeof(float));
+       float* dc = (float*)malloc(teeth * segs * divs * sizeof(float));
+       float* ds = (float*)malloc(teeth * segs * divs * sizeof(float));
+       int num_vertices = teeth * segs * 2 * (3 + 2 * divs);
+       int num_triangles = base_triangles * (1 + divs);
+       printf("Creating gear with %i teeth using %i vertices used in %i triangles\n", teeth, num_vertices, num_triangles);
+       triangle_list_indices<> indices;
+       std::vector<vertex> vertices;
+
+       r0 = inner_radius;
+       r1 = outer_radius - tooth_depth / 2.0f;
+       r2 = outer_radius + tooth_depth / 2.0f;
+
+       da = (float)(2.0 * M_PI / (teeth * segs * divs));
+       for(i = 0; i < teeth * segs * divs; ++i) {
+               float angle = da * i;
+               ds[i] = sin(angle);
+               dc[i] = cos(angle);
+       }
+
+       for(i = 0; i < teeth * segs; ++i) {
+               s[i] = ds[i * divs];
+               c[i] = dc[i * divs];
+       }
+
+       /* faces */
+       for(face = -1; face <= 1; face += 2) {
+               float z = width * face * 0.5f;
+               nx = 0.0f;
+               ny = 0.0f;
+               nz = (float)face;
+
+               indices.flip = face > 0;
+
+               assert(segs == 4);
+               for(i = 0; i < teeth; ++i) {
+                       VERT(r1 * c[segs * i], r1 * s[segs * i], z);
+                       VERT(r2 * c[segs * i + 1], r2 * s[segs * i + 1], z);
+                       VERT(r2 * c[segs * i + 2], r2 * s[segs * i + 2], z);
+                       VERT(r1 * c[segs * i + 3], r1 * s[segs * i + 3], z);
+               }
+
+               for(i = 0; i < teeth * segs * divs; ++i) {
+                       VERT(r0 * dc[i], r0 * ds[i], z);
+               }
+
+               for(i = 0; i < teeth; ++i) {
+                       for(j = i * segs; j < (i + 1) * segs; ++j) {
+                               int nextj = j + 1;
+                               if(nextj == teeth * segs)
+                                       nextj = 0;
+
+                               for(k = j * divs; k < (j + 1) * divs; ++k) {
+                                       int nextk = k + 1;
+                                       if(nextk == teeth * segs * divs)
+                                               nextk = 0;
+                                       indices.poly(teeth * segs + k, j, teeth * segs + nextk);
+                               }
+
+                               indices.poly(teeth * segs + nextj * divs, j, nextj);
+                       }
+               }
+
+               indices.base += teeth * segs * (1 + divs);
+       }
+
+       /* teeth faces */
+       indices.flip = true;
+       float z = width * 0.5f;
+
+       float* coords = (float*)malloc((segs + 1) * 2 * sizeof(float));
+       nz = 0;
+       for(i = 0; i < teeth; i++) {
+               int next = i + 1;
+               if(next == teeth)
+                       next = 0;
+
+               coords[0] = r1 * c[segs * i];
+               coords[1] = r1 * s[segs * i];
+               coords[2] = r2 * c[segs * i + 1];
+               coords[3] = r2 * s[segs * i + 1];
+               coords[4] = r2 * c[segs * i + 2];
+               coords[5] = r2 * s[segs * i + 2];
+               coords[6] = r1 * c[segs * i + 3];
+               coords[7] = r1 * s[segs * i + 3];
+               coords[8] = r1 * c[segs * next];
+               coords[9] = r1 * s[segs * next];
+
+               for(int j = 0; j < segs; ++j) {
+                       float dx = coords[j * 2] - coords[j * 2 + 2];
+                       float dy = coords[j * 2 + 1] - coords[j * 2 + 3];
+                       float len = hypotf(dx, dy);
+                       nx = -dy / len;
+                       ny = dx / len;
+                       VERT(coords[j * 2], coords[j * 2 + 1], z);
+                       VERT(coords[j * 2], coords[j * 2 + 1], -z);
+                       VERT(coords[j * 2 + 2], coords[j * 2 + 3], z);
+                       VERT(coords[j * 2 + 2], coords[j * 2 + 3], -z);
+
+                       indices.poly(0, 1, 3, 2);
+                       indices.base += 4;
+               }
+       }
+       free(coords);
+
+       /* inner part - simulate a cylinder */
+       indices.flip = true;
+       for(i = 0; i < teeth * segs * divs; i++) {
+               int next = i + 1;
+               if(next == teeth * segs * divs)
+                       next = 0;
+
+               nx = -dc[i];
+               ny = -ds[i];
+               VERT(r0 * dc[i], r0 * ds[i], -width * 0.5f);
+               VERT(r0 * dc[i], r0 * ds[i], width * 0.5f);
+
+               indices.poly(i * 2, i * 2 + 1, next * 2 + 1, next * 2);
+       }
+
+       indices.base += teeth * segs * divs * 2;
+       free(c);
+       free(s);
+       free(dc);
+       free(ds);
+
+       D3D11_INPUT_ELEMENT_DESC elements[2] =
+       {
+               {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
+               {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
+       };
+
+       return new mesh(dev, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
+               elements, 2,
+               g_vs, sizeof(g_vs),
+               &vertices[0], sizeof(vertices[0]), vertices.size(),
+               &indices[0], sizeof(indices[0]), indices.size());
+}
+
+struct d3d11gears : public d3d11_application
+{
+       float view_rotx;
+       float view_roty;
+       float view_rotz;
+       int wireframe;
+       int triangles;
+       float speed;
+       float period;
+       unsigned impressions;
+       bool blue_only;
+
+       float last_time;
+       
+       int cur_width;
+       int cur_height;
+
+       ID3D11DepthStencilView* zsv;
+       ID3D11RenderTargetView* offscreen_rtv;
+       ID3D11ShaderResourceView* offscreen_srv;
+       
+       ID3D11Device* dev;
+       ID3D11BlendState* blend;
+       ID3D11DepthStencilState* zsa;
+
+       ID3D11PixelShader* ps;
+       ID3D11VertexShader* vs;
+       ID3D11Buffer* cb;
+
+       d3d11_blitter* blitter;
+
+       d3d11gears()
+               : cur_width(-1), cur_height(-1), zsv(0), offscreen_rtv(0), offscreen_srv(0)
+       {
+               view_rotx = (float)(M_PI / 9.0);
+               view_roty = (float)(M_PI / 6.0);
+               view_rotz = 0.0f;
+               wireframe = 0;
+               triangles = 3200;
+               speed = 1.0f;
+               period = -1.0f;
+               impressions = 1;
+               blue_only = false;
+       }
+
+       void draw_one(ID3D11DeviceContext* ctx, cbuf_t& cbd, const float4x4& modelview, float angle)
+       {
+               for(unsigned i = blue_only ? 2 : 0; i < 3; ++i)
+               {
+                       float4x4 m2 = modelview;
+                       m2 = mat_push_translate(m2, gears[i].x, gears[i].y, 0.0f);
+                       m2 = mat_push_rotate(m2, 2, angle * gears[i].wmul + gears[i].t0);
+
+                       cbd.modelview = m2;
+                       cbd.diffuse = gears[i].color;
+                       cbd.specular = gears[i].color;
+                       cbd.specular_power = 5.0f;
+
+                       ctx->UpdateSubresource(cb, 0, 0, &cbd, 0, 0);
+
+                       gears[i].mesh->bind_and_draw(ctx);
+               }
+       }
+
+       float get_angle(double time)
+       {
+               // designed so that 1 = original glxgears speed
+               float mod_speed = M_PI * 70.0f / 180.0f * speed;
+               if(period < 0)
+                       return (float)(time * mod_speed);
+               else
+                       return (float)(cos(time / period) * period * mod_speed);
+       }
+
+       void init_for_dimensions(unsigned width, unsigned height)
+       {
+               if(zsv)
+                       zsv->Release();
+               ID3D11Texture2D* zsbuf;
+               D3D11_TEXTURE2D_DESC zsbufd;
+               memset(&zsbufd, 0, sizeof(zsbufd));
+               zsbufd.Width = width;
+               zsbufd.Height = height;
+               zsbufd.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
+               zsbufd.ArraySize = 1;
+               zsbufd.MipLevels = 1;
+               zsbufd.SampleDesc.Count = 1;
+               zsbufd.BindFlags = D3D11_BIND_DEPTH_STENCIL;
+               ensure(dev->CreateTexture2D(&zsbufd, 0, &zsbuf));
+               ensure(dev->CreateDepthStencilView(zsbuf, 0, &zsv));
+               zsbuf->Release();
+
+               ID3D11Texture2D* offscreen;
+               if(offscreen_rtv)
+               {
+                       offscreen_rtv->Release();
+                       offscreen_srv->Release();
+                       offscreen_rtv = 0;
+                       offscreen_srv = 0;
+               }
+
+               if(impressions > 1)
+               {
+                       DXGI_FORMAT formats[] = {
+                               DXGI_FORMAT_R32G32B32A32_FLOAT,
+                               DXGI_FORMAT_R16G16B16A16_UNORM,
+                               DXGI_FORMAT_R16G16B16A16_FLOAT,
+                               DXGI_FORMAT_R10G10B10A2_UNORM,
+                       };
+                       DXGI_FORMAT format = DXGI_FORMAT_R8G8B8A8_UNORM; // this won't work well at all
+                       unsigned needed_support = D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_BLENDABLE | D3D11_FORMAT_SUPPORT_SHADER_SAMPLE;
+                       for(unsigned i = 0; i < sizeof(formats); ++i)
+                       {       
+                               unsigned support;
+                               dev->CheckFormatSupport(DXGI_FORMAT_R32G32B32A32_FLOAT, &support);
+                               if((support & needed_support) == needed_support)
+                               {
+                                       format = formats[i];
+                                       break;
+                               }
+                       }
+                               
+
+                       D3D11_TEXTURE2D_DESC offscreend;
+                       memset(&offscreend, 0, sizeof(offscreend));
+                       offscreend.Width = width;
+                       offscreend.Height = height;
+                               
+                       offscreend.Format = format;
+                       offscreend.MipLevels = 1;
+                       offscreend.ArraySize = 1;
+                       offscreend.SampleDesc.Count = 1;
+                       offscreend.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
+                       ensure(dev->CreateTexture2D(&offscreend, 0, &offscreen));
+                       ensure(dev->CreateRenderTargetView(offscreen, 0, &offscreen_rtv));
+                       ensure(dev->CreateShaderResourceView(offscreen, 0, &offscreen_srv));
+                       offscreen->Release();
+               }
+
+               cur_width = width;
+               cur_height = height;
+       }
+
+       void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time)
+       {
+               D3D11_VIEWPORT vp;
+               memset(&vp, 0, sizeof(vp));
+               vp.Width = (float)width;
+               vp.Height = (float)height;
+               vp.MaxDepth = 1.0f;
+
+               if((int)width != cur_width || (int)height != cur_height)
+                       init_for_dimensions(width, height);
+
+               float4 lightpos = vec(5.0f, 5.0f, 10.0f, 0.0f);
+               float black[4] = {0.0, 0.0, 0.0, 0};
+
+               float4x4 proj;
+               float4x4 m;
+
+               float xr = (float)width / (float)height;
+               float yr = 1.0f;
+               if(xr < 1.0f) {
+                       yr /= xr;
+                       xr = 1.0f;
+               }
+               proj = mat4x4_frustum(-xr, xr, -yr, yr, 5.0f, 60.0f);
+
+               m = mat4x4_diag(1.0f);
+               m = mat_push_translate(m, 0.0f, 0.0f, -40.0f);
+               m = mat_push_rotate(m, 0, view_rotx);
+               m = mat_push_rotate(m, 1, view_roty);
+               m = mat_push_rotate(m, 2, view_rotz);
+
+               cbuf_t cbd;
+
+               cbd.projection = proj;
+               cbd.light = lightpos;
+
+               float blend_factor[4] = {1.0f / (float)impressions, 1.0f / (float)impressions, 1.0f / (float)impressions, 1.0f / (float)impressions};
+
+               ID3D11RenderTargetView* render_rtv;
+               if(impressions == 1)
+                       render_rtv = rtv;
+               else
+                       render_rtv = offscreen_rtv;
+
+               ctx->RSSetViewports(1, &vp);
+               ctx->ClearRenderTargetView(render_rtv, black);
+               
+               ctx->PSSetShader(ps, 0, 0);
+               ctx->VSSetShader(vs, 0, 0);
+
+               ctx->PSSetConstantBuffers(0, 1, &cb);
+               ctx->VSSetConstantBuffers(0, 1, &cb);
+
+               if(impressions == 1)
+               {
+                       ctx->OMSetBlendState(0, 0, ~0);
+                       ctx->OMSetDepthStencilState(0, 0);
+                       ctx->OMSetRenderTargets(1, &rtv, zsv);
+                       ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0, 0);
+                       draw_one(ctx, cbd, m, get_angle(time));
+               }
+               else
+               {
+                       ctx->OMSetBlendState(blend, blend_factor, ~0);
+
+                       float time_delta = (float)time - last_time;
+                       float time_delta_per_impression = time_delta / impressions;
+                       float base_time = last_time + time_delta_per_impression / 2;
+                       for(unsigned impression = 0; impression < impressions; ++impression)
+                       {
+                               float impression_time = base_time + time_delta_per_impression * impression;
+
+                               ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0, 0);
+
+                               // do early z-pass since we must not write any pixel more than once due to blending
+                               for(unsigned pass = 0; pass < 2; ++pass)
+                               {
+                                       if(pass == 0)
+                                       {
+                                               ctx->OMSetRenderTargets(0, 0, zsv);
+                                               ctx->OMSetDepthStencilState(0, 0);
+                                       }
+                                       else
+                                       {
+                                               ctx->OMSetRenderTargets(1, &render_rtv, zsv);
+                                               ctx->OMSetDepthStencilState(zsa, 0);
+                                       }
+
+                                       draw_one(ctx, cbd, m, get_angle(impression_time));
+                               }
+                       }
+
+                       blitter->bind_draw_and_unbind(ctx, offscreen_srv, rtv, 0, 0, (float)width, (float)height, false);
+               }
+               last_time = (float)time;
+       }
+
+       bool init(ID3D11Device* dev, int argc, char** argv)
+       {
+               this->dev = dev;
+
+               for(char** p = argv + 1; *p; ++p) {
+                       if(!strcmp(*p, "-w"))
+                               wireframe = 1;
+                       else if(!strcmp(*p, "-b"))
+                               blue_only = true;
+                       else if(!strcmp(*p, "-t"))
+                               triangles = atoi(*++p);
+                       else if(!strcmp(*p, "-m"))
+                               impressions = (float)atof(*++p);
+                       else if(!strcmp(*p, "-p"))
+                               period = (float)atof(*++p);
+                       else if(!strcmp(*p, "-s"))
+                               speed = (float)atof(*++p);
+                       else {
+                               fprintf(stderr, "Usage: d3d11gears [-v|-w] [-t TRIANGLES]\n");
+                               fprintf(stderr, "d3d11gears is an enhanced port of glxgears to Direct3D 11\n");
+                               fprintf(stderr, "\n");
+                               //fprintf(stderr, "-v\t\tuse per-vertex diffuse-only lighting (classic glxgears look)\n");
+                               fprintf(stderr, "-w\t\twireframe mode\n");
+                               fprintf(stderr, "-t TRIANGLES\ttriangle budget (default is 3200)\n");
+                               fprintf(stderr, "-m IMPRESSIONS\tmotion blur impressions (default is 1)\n");
+                               fprintf(stderr, "-p PERIOD\tspeed reversal period (default is infinite)\n");
+                               fprintf(stderr, "-s SPEED\tgear speed (default is 1.0)\n");
+                               fprintf(stderr, "-b\tonly show blue gear (for faster motion blur)\n");
+                               return false;
+                       }
+               }
+
+               ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps));
+               ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs));
+
+               gears[0].color = vec(0.8f, 0.1f, 0.0f, 1.0f);
+               gears[1].color = vec(0.0f, 0.8f, 0.2f, 1.0f);
+               gears[2].color = vec(0.2f, 0.2f, 1.0f, 1.0f);
+
+               gears[0].mesh = build_gear(dev, triangles / 2, 1.0f, 4.0f, 1.0f, 20, 0.7f);
+               gears[1].mesh = build_gear(dev, triangles / 4, 0.5f, 2.0f, 2.0f, 10, 0.7f);
+               gears[2].mesh = build_gear(dev, triangles / 4, 1.3f, 2.0f, 0.5f, 10, 0.7f);
+
+               gears[0].x = -3.0f;
+               gears[0].y = -2.0f;
+               gears[0].wmul = 1.0f;
+               gears[0].t0 = 0.0 * M_PI / 180.0f;
+
+               gears[1].x = 3.1f;
+               gears[1].y = -2.0f;
+               gears[1].wmul = -2.0f;
+               gears[1].t0 = -9.0f * (float)M_PI / 180.0f;
+
+               gears[2].x = -3.1f;
+               gears[2].y = 4.2f;
+               gears[2].wmul = -2.0f;
+               gears[2].t0 = -25.0f * (float)M_PI / 180.0f;
+
+               D3D11_BUFFER_DESC bufferd;
+               memset(&bufferd, 0, sizeof(bufferd));
+               bufferd.ByteWidth = sizeof(cbuf_t);
+               bufferd.Usage = D3D11_USAGE_DEFAULT;
+               bufferd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+               ensure(dev->CreateBuffer(&bufferd, 0, &cb));
+
+               if(impressions > 1)
+               {
+                       D3D11_BLEND_DESC blendd;
+                       memset(&blendd, 0, sizeof(blendd));
+                       blendd.RenderTarget[0].BlendEnable = TRUE;
+                       blendd.RenderTarget[0].BlendOp = blendd.RenderTarget[0].BlendOpAlpha
+                               = D3D11_BLEND_OP_ADD;
+                       blendd.RenderTarget[0].SrcBlend = blendd.RenderTarget[0].SrcBlendAlpha
+                               = D3D11_BLEND_BLEND_FACTOR;
+                       blendd.RenderTarget[0].DestBlend = blendd.RenderTarget[0].DestBlendAlpha
+                               = D3D11_BLEND_ONE;
+                       blendd.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
+                       ensure(dev->CreateBlendState(&blendd, &blend));
+
+                       D3D11_DEPTH_STENCIL_DESC zsad;
+                       memset(&zsad, 0, sizeof(zsad));
+                       zsad.DepthEnable = TRUE;
+                       zsad.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
+                       zsad.DepthFunc = D3D11_COMPARISON_EQUAL;
+                       ensure(dev->CreateDepthStencilState(&zsad, &zsa));
+
+                       blitter = new d3d11_blitter(dev);
+               }
+                       
+               return true;
+       }
+};
+
+d3d11_application* d3d11_application_create()
+{
+       return new d3d11gears();
+}
index 890b1af..e83b5bb 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d11gears.hlsl.ps.h /Eps /Tps_4_0 d3d11gears.hlsl\r
-//\r
-//\r
-// Buffer Definitions: \r
-//\r
-// cbuffer cb\r
-// {\r
-//\r
-//   float4x4 proj;                     // Offset:    0 Size:    64 [unused]\r
-//   float4x4 modelview;                // Offset:   64 Size:    64 [unused]\r
-//   float4 light;                      // Offset:  128 Size:    16 [unused]\r
-//   float4 diffuse;                    // Offset:  144 Size:    16\r
-//   float4 specular;                   // Offset:  160 Size:    16\r
-//   float specular_power;              // Offset:  176 Size:     4\r
-//\r
-// }\r
-//\r
-//\r
-// Resource Bindings:\r
-//\r
-// Name                                 Type  Format         Dim Slot Elements\r
-// ------------------------------ ---------- ------- ----------- ---- --------\r
-// cb                                cbuffer      NA          NA    0        1\r
-//\r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_POSITION              0   xyzw        0      POS  float       \r
-// NORMAL                   0   xyz         1     NONE  float   xyz \r
-// EYE                      0   xyz         2     NONE  float   xyz \r
-// LIGHT                    0   xyz         3     NONE  float   xyz \r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_TARGET                0   xyzw        0   TARGET  float   xyzw\r
-//\r
-ps_4_0\r
-dcl_constantbuffer cb0[12], immediateIndexed\r
-dcl_input_ps linear v1.xyz\r
-dcl_input_ps linear v2.xyz\r
-dcl_input_ps linear v3.xyz\r
-dcl_output o0.xyzw\r
-dcl_temps 3\r
-dp3 r0.x, v2.xyzx, v2.xyzx\r
-rsq r0.x, r0.x\r
-dp3 r0.y, v3.xyzx, v3.xyzx\r
-rsq r0.y, r0.y\r
-mul r0.yzw, r0.yyyy, v3.xxyz\r
-mad r1.xyz, v2.xyzx, r0.xxxx, r0.yzwy\r
-dp3 r0.x, r1.xyzx, r1.xyzx\r
-rsq r0.x, r0.x\r
-mul r1.xyz, r0.xxxx, r1.xyzx\r
-dp3 r0.x, v1.xyzx, v1.xyzx\r
-rsq r0.x, r0.x\r
-mul r2.xyz, r0.xxxx, v1.xyzx\r
-dp3_sat r0.x, r2.xyzx, r1.xyzx\r
-dp3_sat r0.y, r2.xyzx, r0.yzwy\r
-log r0.x, r0.x\r
-mul r0.x, r0.x, cb0[11].x\r
-exp r0.x, r0.x\r
-mul r1.xyzw, r0.xxxx, cb0[10].xyzw\r
-mad o0.xyzw, cb0[9].xyzw, r0.yyyy, r1.xyzw\r
-ret \r
-// Approximately 20 instruction slots used\r
-#endif\r
-\r
-const BYTE g_ps[] =\r
-{\r
-     68,  88,  66,  67,  91,  23, \r
-    206, 102,  23,  38, 122,  59, \r
-     55, 123, 215,  57,  98, 213, \r
-    215, 191,   1,   0,   0,   0, \r
-     92,   5,   0,   0,   5,   0, \r
-      0,   0,  52,   0,   0,   0, \r
-    192,   1,   0,   0,  80,   2, \r
-      0,   0, 132,   2,   0,   0, \r
-    224,   4,   0,   0,  82,  68, \r
-     69,  70, 132,   1,   0,   0, \r
-      1,   0,   0,   0,  64,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-     28,   0,   0,   0,   0,   4, \r
-    255, 255,   0,   1,   0,   0, \r
-     80,   1,   0,   0,  60,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     99,  98,   0, 171,  60,   0, \r
-      0,   0,   6,   0,   0,   0, \r
-     88,   0,   0,   0, 192,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0, 232,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     64,   0,   0,   0,   0,   0, \r
-      0,   0, 240,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   1, \r
-      0,   0,  64,   0,   0,   0, \r
-     64,   0,   0,   0,   0,   0, \r
-      0,   0, 240,   0,   0,   0, \r
-      0,   0,   0,   0,  10,   1, \r
-      0,   0, 128,   0,   0,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-      0,   0,  16,   1,   0,   0, \r
-      0,   0,   0,   0,  32,   1, \r
-      0,   0, 144,   0,   0,   0, \r
-     16,   0,   0,   0,   2,   0, \r
-      0,   0,  16,   1,   0,   0, \r
-      0,   0,   0,   0,  40,   1, \r
-      0,   0, 160,   0,   0,   0, \r
-     16,   0,   0,   0,   2,   0, \r
-      0,   0,  16,   1,   0,   0, \r
-      0,   0,   0,   0,  49,   1, \r
-      0,   0, 176,   0,   0,   0, \r
-      4,   0,   0,   0,   2,   0, \r
-      0,   0,  64,   1,   0,   0, \r
-      0,   0,   0,   0, 112, 114, \r
-    111, 106,   0, 171, 171, 171, \r
-      3,   0,   3,   0,   4,   0, \r
-      4,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0, 109, 111, \r
-    100, 101, 108, 118, 105, 101, \r
-    119,   0, 108, 105, 103, 104, \r
-    116,   0,   1,   0,   3,   0, \r
-      1,   0,   4,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-    100, 105, 102, 102, 117, 115, \r
-    101,   0, 115, 112, 101,  99, \r
-    117, 108,  97, 114,   0, 115, \r
-    112, 101,  99, 117, 108,  97, \r
-    114,  95, 112, 111, 119, 101, \r
-    114,   0,   0,   0,   3,   0, \r
-      1,   0,   1,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     77, 105,  99, 114, 111, 115, \r
-    111, 102, 116,  32,  40,  82, \r
-     41,  32,  72,  76,  83,  76, \r
-     32,  83, 104,  97, 100, 101, \r
-    114,  32,  67, 111, 109, 112, \r
-    105, 108, 101, 114,  32,  57, \r
-     46,  50,  57,  46,  57,  53, \r
-     50,  46,  51,  49,  49,  49, \r
-      0, 171, 171, 171,  73,  83, \r
-     71,  78, 136,   0,   0,   0, \r
-      4,   0,   0,   0,   8,   0, \r
-      0,   0, 104,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      0,   0,   0,   0,  15,   0, \r
-      0,   0, 116,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      1,   0,   0,   0,   7,   7, \r
-      0,   0, 123,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      2,   0,   0,   0,   7,   7, \r
-      0,   0, 127,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      3,   0,   0,   0,   7,   7, \r
-      0,   0,  83,  86,  95,  80, \r
-     79,  83,  73,  84,  73,  79, \r
-     78,   0,  78,  79,  82,  77, \r
-     65,  76,   0,  69,  89,  69, \r
-      0,  76,  73,  71,  72,  84, \r
-      0, 171, 171, 171,  79,  83, \r
-     71,  78,  44,   0,   0,   0, \r
-      1,   0,   0,   0,   8,   0, \r
-      0,   0,  32,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      0,   0,   0,   0,  15,   0, \r
-      0,   0,  83,  86,  95,  84, \r
-     65,  82,  71,  69,  84,   0, \r
-    171, 171,  83,  72,  68,  82, \r
-     84,   2,   0,   0,  64,   0, \r
-      0,   0, 149,   0,   0,   0, \r
-     89,   0,   0,   4,  70, 142, \r
-     32,   0,   0,   0,   0,   0, \r
-     12,   0,   0,   0,  98,  16, \r
-      0,   3, 114,  16,  16,   0, \r
-      1,   0,   0,   0,  98,  16, \r
-      0,   3, 114,  16,  16,   0, \r
-      2,   0,   0,   0,  98,  16, \r
-      0,   3, 114,  16,  16,   0, \r
-      3,   0,   0,   0, 101,   0, \r
-      0,   3, 242,  32,  16,   0, \r
-      0,   0,   0,   0, 104,   0, \r
-      0,   2,   3,   0,   0,   0, \r
-     16,   0,   0,   7,  18,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  18,  16,   0,   2,   0, \r
-      0,   0,  70,  18,  16,   0, \r
-      2,   0,   0,   0,  68,   0, \r
-      0,   5,  18,   0,  16,   0, \r
-      0,   0,   0,   0,  10,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     16,   0,   0,   7,  34,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  18,  16,   0,   3,   0, \r
-      0,   0,  70,  18,  16,   0, \r
-      3,   0,   0,   0,  68,   0, \r
-      0,   5,  34,   0,  16,   0, \r
-      0,   0,   0,   0,  26,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     56,   0,   0,   7, 226,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     86,   5,  16,   0,   0,   0, \r
-      0,   0,   6,  25,  16,   0, \r
-      3,   0,   0,   0,  50,   0, \r
-      0,   9, 114,   0,  16,   0, \r
-      1,   0,   0,   0,  70,  18, \r
-     16,   0,   2,   0,   0,   0, \r
-      6,   0,  16,   0,   0,   0, \r
-      0,   0, 150,   7,  16,   0, \r
-      0,   0,   0,   0,  16,   0, \r
-      0,   7,  18,   0,  16,   0, \r
-      0,   0,   0,   0,  70,   2, \r
-     16,   0,   1,   0,   0,   0, \r
-     70,   2,  16,   0,   1,   0, \r
-      0,   0,  68,   0,   0,   5, \r
-     18,   0,  16,   0,   0,   0, \r
-      0,   0,  10,   0,  16,   0, \r
-      0,   0,   0,   0,  56,   0, \r
-      0,   7, 114,   0,  16,   0, \r
-      1,   0,   0,   0,   6,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,   2,  16,   0,   1,   0, \r
-      0,   0,  16,   0,   0,   7, \r
-     18,   0,  16,   0,   0,   0, \r
-      0,   0,  70,  18,  16,   0, \r
-      1,   0,   0,   0,  70,  18, \r
-     16,   0,   1,   0,   0,   0, \r
-     68,   0,   0,   5,  18,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     10,   0,  16,   0,   0,   0, \r
-      0,   0,  56,   0,   0,   7, \r
-    114,   0,  16,   0,   2,   0, \r
-      0,   0,   6,   0,  16,   0, \r
-      0,   0,   0,   0,  70,  18, \r
-     16,   0,   1,   0,   0,   0, \r
-     16,  32,   0,   7,  18,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,   2,  16,   0,   2,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      1,   0,   0,   0,  16,  32, \r
-      0,   7,  34,   0,  16,   0, \r
-      0,   0,   0,   0,  70,   2, \r
-     16,   0,   2,   0,   0,   0, \r
-    150,   7,  16,   0,   0,   0, \r
-      0,   0,  47,   0,   0,   5, \r
-     18,   0,  16,   0,   0,   0, \r
-      0,   0,  10,   0,  16,   0, \r
-      0,   0,   0,   0,  56,   0, \r
-      0,   8,  18,   0,  16,   0, \r
-      0,   0,   0,   0,  10,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     10, 128,  32,   0,   0,   0, \r
-      0,   0,  11,   0,   0,   0, \r
-     25,   0,   0,   5,  18,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     10,   0,  16,   0,   0,   0, \r
-      0,   0,  56,   0,   0,   8, \r
-    242,   0,  16,   0,   1,   0, \r
-      0,   0,   6,   0,  16,   0, \r
-      0,   0,   0,   0,  70, 142, \r
-     32,   0,   0,   0,   0,   0, \r
-     10,   0,   0,   0,  50,   0, \r
-      0,  10, 242,  32,  16,   0, \r
-      0,   0,   0,   0,  70, 142, \r
-     32,   0,   0,   0,   0,   0, \r
-      9,   0,   0,   0,  86,   5, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  14,  16,   0,   1,   0, \r
-      0,   0,  62,   0,   0,   1, \r
-     83,  84,  65,  84, 116,   0, \r
-      0,   0,  20,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-     17,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      1,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d11gears.hlsl.ps.h /Eps /Tps_4_0 d3d11gears.hlsl
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer cb
+// {
+//
+//   float4x4 proj;                     // Offset:    0 Size:    64 [unused]
+//   float4x4 modelview;                // Offset:   64 Size:    64 [unused]
+//   float4 light;                      // Offset:  128 Size:    16 [unused]
+//   float4 diffuse;                    // Offset:  144 Size:    16
+//   float4 specular;                   // Offset:  160 Size:    16
+//   float specular_power;              // Offset:  176 Size:     4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// cb                                cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION              0   xyzw        0      POS  float       
+// NORMAL                   0   xyz         1     NONE  float   xyz 
+// EYE                      0   xyz         2     NONE  float   xyz 
+// LIGHT                    0   xyz         3     NONE  float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET                0   xyzw        0   TARGET  float   xyzw
+//
+ps_4_0
+dcl_constantbuffer cb0[12], immediateIndexed
+dcl_input_ps linear v1.xyz
+dcl_input_ps linear v2.xyz
+dcl_input_ps linear v3.xyz
+dcl_output o0.xyzw
+dcl_temps 3
+dp3 r0.x, v2.xyzx, v2.xyzx
+rsq r0.x, r0.x
+dp3 r0.y, v3.xyzx, v3.xyzx
+rsq r0.y, r0.y
+mul r0.yzw, r0.yyyy, v3.xxyz
+mad r1.xyz, v2.xyzx, r0.xxxx, r0.yzwy
+dp3 r0.x, r1.xyzx, r1.xyzx
+rsq r0.x, r0.x
+mul r1.xyz, r0.xxxx, r1.xyzx
+dp3 r0.x, v1.xyzx, v1.xyzx
+rsq r0.x, r0.x
+mul r2.xyz, r0.xxxx, v1.xyzx
+dp3_sat r0.x, r2.xyzx, r1.xyzx
+dp3_sat r0.y, r2.xyzx, r0.yzwy
+log r0.x, r0.x
+mul r0.x, r0.x, cb0[11].x
+exp r0.x, r0.x
+mul r1.xyzw, r0.xxxx, cb0[10].xyzw
+mad o0.xyzw, cb0[9].xyzw, r0.yyyy, r1.xyzw
+ret 
+// Approximately 20 instruction slots used
+#endif
+
+const BYTE g_ps[] =
+{
+     68,  88,  66,  67,  91,  23, 
+    206, 102,  23,  38, 122,  59, 
+     55, 123, 215,  57,  98, 213, 
+    215, 191,   1,   0,   0,   0, 
+     92,   5,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    192,   1,   0,   0,  80,   2, 
+      0,   0, 132,   2,   0,   0, 
+    224,   4,   0,   0,  82,  68, 
+     69,  70, 132,   1,   0,   0, 
+      1,   0,   0,   0,  64,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     80,   1,   0,   0,  60,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+     99,  98,   0, 171,  60,   0, 
+      0,   0,   6,   0,   0,   0, 
+     88,   0,   0,   0, 192,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0, 232,   0, 
+      0,   0,   0,   0,   0,   0, 
+     64,   0,   0,   0,   0,   0, 
+      0,   0, 240,   0,   0,   0, 
+      0,   0,   0,   0,   0,   1, 
+      0,   0,  64,   0,   0,   0, 
+     64,   0,   0,   0,   0,   0, 
+      0,   0, 240,   0,   0,   0, 
+      0,   0,   0,   0,  10,   1, 
+      0,   0, 128,   0,   0,   0, 
+     16,   0,   0,   0,   0,   0, 
+      0,   0,  16,   1,   0,   0, 
+      0,   0,   0,   0,  32,   1, 
+      0,   0, 144,   0,   0,   0, 
+     16,   0,   0,   0,   2,   0, 
+      0,   0,  16,   1,   0,   0, 
+      0,   0,   0,   0,  40,   1, 
+      0,   0, 160,   0,   0,   0, 
+     16,   0,   0,   0,   2,   0, 
+      0,   0,  16,   1,   0,   0, 
+      0,   0,   0,   0,  49,   1, 
+      0,   0, 176,   0,   0,   0, 
+      4,   0,   0,   0,   2,   0, 
+      0,   0,  64,   1,   0,   0, 
+      0,   0,   0,   0, 112, 114, 
+    111, 106,   0, 171, 171, 171, 
+      3,   0,   3,   0,   4,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0, 109, 111, 
+    100, 101, 108, 118, 105, 101, 
+    119,   0, 108, 105, 103, 104, 
+    116,   0,   1,   0,   3,   0, 
+      1,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    100, 105, 102, 102, 117, 115, 
+    101,   0, 115, 112, 101,  99, 
+    117, 108,  97, 114,   0, 115, 
+    112, 101,  99, 117, 108,  97, 
+    114,  95, 112, 111, 119, 101, 
+    114,   0,   0,   0,   3,   0, 
+      1,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     77, 105,  99, 114, 111, 115, 
+    111, 102, 116,  32,  40,  82, 
+     41,  32,  72,  76,  83,  76, 
+     32,  83, 104,  97, 100, 101, 
+    114,  32,  67, 111, 109, 112, 
+    105, 108, 101, 114,  32,  57, 
+     46,  50,  57,  46,  57,  53, 
+     50,  46,  51,  49,  49,  49, 
+      0, 171, 171, 171,  73,  83, 
+     71,  78, 136,   0,   0,   0, 
+      4,   0,   0,   0,   8,   0, 
+      0,   0, 104,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0, 116,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,   7,   7, 
+      0,   0, 123,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      2,   0,   0,   0,   7,   7, 
+      0,   0, 127,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      3,   0,   0,   0,   7,   7, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  78,  79,  82,  77, 
+     65,  76,   0,  69,  89,  69, 
+      0,  76,  73,  71,  72,  84, 
+      0, 171, 171, 171,  79,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  84, 
+     65,  82,  71,  69,  84,   0, 
+    171, 171,  83,  72,  68,  82, 
+     84,   2,   0,   0,  64,   0, 
+      0,   0, 149,   0,   0,   0, 
+     89,   0,   0,   4,  70, 142, 
+     32,   0,   0,   0,   0,   0, 
+     12,   0,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      1,   0,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      2,   0,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      3,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   3,   0,   0,   0, 
+     16,   0,   0,   7,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,  18,  16,   0,   2,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  68,   0, 
+      0,   5,  18,   0,  16,   0, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     16,   0,   0,   7,  34,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,  18,  16,   0,   3,   0, 
+      0,   0,  70,  18,  16,   0, 
+      3,   0,   0,   0,  68,   0, 
+      0,   5,  34,   0,  16,   0, 
+      0,   0,   0,   0,  26,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 226,   0, 
+     16,   0,   0,   0,   0,   0, 
+     86,   5,  16,   0,   0,   0, 
+      0,   0,   6,  25,  16,   0, 
+      3,   0,   0,   0,  50,   0, 
+      0,   9, 114,   0,  16,   0, 
+      1,   0,   0,   0,  70,  18, 
+     16,   0,   2,   0,   0,   0, 
+      6,   0,  16,   0,   0,   0, 
+      0,   0, 150,   7,  16,   0, 
+      0,   0,   0,   0,  16,   0, 
+      0,   7,  18,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   1,   0,   0,   0, 
+     70,   2,  16,   0,   1,   0, 
+      0,   0,  68,   0,   0,   5, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  56,   0, 
+      0,   7, 114,   0,  16,   0, 
+      1,   0,   0,   0,   6,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   1,   0, 
+      0,   0,  16,   0,   0,   7, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      1,   0,   0,   0,  70,  18, 
+     16,   0,   1,   0,   0,   0, 
+     68,   0,   0,   5,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  56,   0,   0,   7, 
+    114,   0,  16,   0,   2,   0, 
+      0,   0,   6,   0,  16,   0, 
+      0,   0,   0,   0,  70,  18, 
+     16,   0,   1,   0,   0,   0, 
+     16,  32,   0,   7,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   2,   0, 
+      0,   0,  70,   2,  16,   0, 
+      1,   0,   0,   0,  16,  32, 
+      0,   7,  34,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   2,   0,   0,   0, 
+    150,   7,  16,   0,   0,   0, 
+      0,   0,  47,   0,   0,   5, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  10,   0,  16,   0, 
+      0,   0,   0,   0,  56,   0, 
+      0,   8,  18,   0,  16,   0, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     10, 128,  32,   0,   0,   0, 
+      0,   0,  11,   0,   0,   0, 
+     25,   0,   0,   5,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  56,   0,   0,   8, 
+    242,   0,  16,   0,   1,   0, 
+      0,   0,   6,   0,  16,   0, 
+      0,   0,   0,   0,  70, 142, 
+     32,   0,   0,   0,   0,   0, 
+     10,   0,   0,   0,  50,   0, 
+      0,  10, 242,  32,  16,   0, 
+      0,   0,   0,   0,  70, 142, 
+     32,   0,   0,   0,   0,   0, 
+      9,   0,   0,   0,  86,   5, 
+     16,   0,   0,   0,   0,   0, 
+     70,  14,  16,   0,   1,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,  20,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,   4,   0,   0,   0, 
+     17,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
index 3170d3a..ee93109 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d11gears.hlsl.vs.h /Evs /Tvs_4_0 d3d11gears.hlsl\r
-//\r
-//\r
-// Buffer Definitions: \r
-//\r
-// cbuffer cb\r
-// {\r
-//\r
-//   float4x4 proj;                     // Offset:    0 Size:    64\r
-//   float4x4 modelview;                // Offset:   64 Size:    64\r
-//   float4 light;                      // Offset:  128 Size:    16\r
-//   float4 diffuse;                    // Offset:  144 Size:    16 [unused]\r
-//   float4 specular;                   // Offset:  160 Size:    16 [unused]\r
-//   float specular_power;              // Offset:  176 Size:     4 [unused]\r
-//\r
-// }\r
-//\r
-//\r
-// Resource Bindings:\r
-//\r
-// Name                                 Type  Format         Dim Slot Elements\r
-// ------------------------------ ---------- ------- ----------- ---- --------\r
-// cb                                cbuffer      NA          NA    0        1\r
-//\r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// POSITION                 0   xyzw        0     NONE  float   xyzw\r
-// NORMAL                   0   xyz         1     NONE  float   xyz \r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_POSITION              0   xyzw        0      POS  float   xyzw\r
-// NORMAL                   0   xyz         1     NONE  float   xyz \r
-// EYE                      0   xyz         2     NONE  float   xyz \r
-// LIGHT                    0   xyz         3     NONE  float   xyz \r
-//\r
-vs_4_0\r
-dcl_constantbuffer cb0[9], immediateIndexed\r
-dcl_input v0.xyzw\r
-dcl_input v1.xyz\r
-dcl_output_siv o0.xyzw, position\r
-dcl_output o1.xyz\r
-dcl_output o2.xyz\r
-dcl_output o3.xyz\r
-dcl_temps 2\r
-mul r0.xyz, v0.yyyy, cb0[5].xyzx\r
-mad r0.xyz, cb0[4].xyzx, v0.xxxx, r0.xyzx\r
-mad r0.xyz, cb0[6].xyzx, v0.zzzz, r0.xyzx\r
-mad r0.xyz, cb0[7].xyzx, v0.wwww, r0.xyzx\r
-mul r1.xyzw, r0.yyyy, cb0[1].xyzw\r
-mad r1.xyzw, cb0[0].xyzw, r0.xxxx, r1.xyzw\r
-mad r1.xyzw, cb0[2].xyzw, r0.zzzz, r1.xyzw\r
-add o0.xyzw, r1.xyzw, cb0[3].xyzw\r
-mul r1.xyz, v1.yyyy, cb0[5].xyzx\r
-mad r1.xyz, cb0[4].xyzx, v1.xxxx, r1.xyzx\r
-mad o1.xyz, cb0[6].xyzx, v1.zzzz, r1.xyzx\r
-mov o2.xyz, -r0.xyzx\r
-add o3.xyz, -r0.xyzx, cb0[8].xyzx\r
-ret \r
-// Approximately 14 instruction slots used\r
-#endif\r
-\r
-const BYTE g_vs[] =\r
-{\r
-     68,  88,  66,  67, 251,  82, \r
-     65, 114, 135,  66, 139,  83, \r
-      7,  10,  20, 121, 102,  38, \r
-     44,  36,   1,   0,   0,   0, \r
-    104,   5,   0,   0,   5,   0, \r
-      0,   0,  52,   0,   0,   0, \r
-    192,   1,   0,   0,  16,   2, \r
-      0,   0, 160,   2,   0,   0, \r
-    236,   4,   0,   0,  82,  68, \r
-     69,  70, 132,   1,   0,   0, \r
-      1,   0,   0,   0,  64,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-     28,   0,   0,   0,   0,   4, \r
-    254, 255,   0,   1,   0,   0, \r
-     80,   1,   0,   0,  60,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     99,  98,   0, 171,  60,   0, \r
-      0,   0,   6,   0,   0,   0, \r
-     88,   0,   0,   0, 192,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0, 232,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     64,   0,   0,   0,   2,   0, \r
-      0,   0, 240,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   1, \r
-      0,   0,  64,   0,   0,   0, \r
-     64,   0,   0,   0,   2,   0, \r
-      0,   0, 240,   0,   0,   0, \r
-      0,   0,   0,   0,  10,   1, \r
-      0,   0, 128,   0,   0,   0, \r
-     16,   0,   0,   0,   2,   0, \r
-      0,   0,  16,   1,   0,   0, \r
-      0,   0,   0,   0,  32,   1, \r
-      0,   0, 144,   0,   0,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-      0,   0,  16,   1,   0,   0, \r
-      0,   0,   0,   0,  40,   1, \r
-      0,   0, 160,   0,   0,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-      0,   0,  16,   1,   0,   0, \r
-      0,   0,   0,   0,  49,   1, \r
-      0,   0, 176,   0,   0,   0, \r
-      4,   0,   0,   0,   0,   0, \r
-      0,   0,  64,   1,   0,   0, \r
-      0,   0,   0,   0, 112, 114, \r
-    111, 106,   0, 171, 171, 171, \r
-      3,   0,   3,   0,   4,   0, \r
-      4,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0, 109, 111, \r
-    100, 101, 108, 118, 105, 101, \r
-    119,   0, 108, 105, 103, 104, \r
-    116,   0,   1,   0,   3,   0, \r
-      1,   0,   4,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-    100, 105, 102, 102, 117, 115, \r
-    101,   0, 115, 112, 101,  99, \r
-    117, 108,  97, 114,   0, 115, \r
-    112, 101,  99, 117, 108,  97, \r
-    114,  95, 112, 111, 119, 101, \r
-    114,   0,   0,   0,   3,   0, \r
-      1,   0,   1,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     77, 105,  99, 114, 111, 115, \r
-    111, 102, 116,  32,  40,  82, \r
-     41,  32,  72,  76,  83,  76, \r
-     32,  83, 104,  97, 100, 101, \r
-    114,  32,  67, 111, 109, 112, \r
-    105, 108, 101, 114,  32,  57, \r
-     46,  50,  57,  46,  57,  53, \r
-     50,  46,  51,  49,  49,  49, \r
-      0, 171, 171, 171,  73,  83, \r
-     71,  78,  72,   0,   0,   0, \r
-      2,   0,   0,   0,   8,   0, \r
-      0,   0,  56,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      0,   0,   0,   0,  15,  15, \r
-      0,   0,  65,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      1,   0,   0,   0,   7,   7, \r
-      0,   0,  80,  79,  83,  73, \r
-     84,  73,  79,  78,   0,  78, \r
-     79,  82,  77,  65,  76,   0, \r
-     79,  83,  71,  78, 136,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-      8,   0,   0,   0, 104,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      1,   0,   0,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     15,   0,   0,   0, 116,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   3,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      7,   8,   0,   0, 123,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   3,   0, \r
-      0,   0,   2,   0,   0,   0, \r
-      7,   8,   0,   0, 127,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   3,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      7,   8,   0,   0,  83,  86, \r
-     95,  80,  79,  83,  73,  84, \r
-     73,  79,  78,   0,  78,  79, \r
-     82,  77,  65,  76,   0,  69, \r
-     89,  69,   0,  76,  73,  71, \r
-     72,  84,   0, 171, 171, 171, \r
-     83,  72,  68,  82,  68,   2, \r
-      0,   0,  64,   0,   1,   0, \r
-    145,   0,   0,   0,  89,   0, \r
-      0,   4,  70, 142,  32,   0, \r
-      0,   0,   0,   0,   9,   0, \r
-      0,   0,  95,   0,   0,   3, \r
-    242,  16,  16,   0,   0,   0, \r
-      0,   0,  95,   0,   0,   3, \r
-    114,  16,  16,   0,   1,   0, \r
-      0,   0, 103,   0,   0,   4, \r
-    242,  32,  16,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-    101,   0,   0,   3, 114,  32, \r
-     16,   0,   1,   0,   0,   0, \r
-    101,   0,   0,   3, 114,  32, \r
-     16,   0,   2,   0,   0,   0, \r
-    101,   0,   0,   3, 114,  32, \r
-     16,   0,   3,   0,   0,   0, \r
-    104,   0,   0,   2,   2,   0, \r
-      0,   0,  56,   0,   0,   8, \r
-    114,   0,  16,   0,   0,   0, \r
-      0,   0,  86,  21,  16,   0, \r
-      0,   0,   0,   0,  70, 130, \r
-     32,   0,   0,   0,   0,   0, \r
-      5,   0,   0,   0,  50,   0, \r
-      0,  10, 114,   0,  16,   0, \r
-      0,   0,   0,   0,  70, 130, \r
-     32,   0,   0,   0,   0,   0, \r
-      4,   0,   0,   0,   6,  16, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,   2,  16,   0,   0,   0, \r
-      0,   0,  50,   0,   0,  10, \r
-    114,   0,  16,   0,   0,   0, \r
-      0,   0,  70, 130,  32,   0, \r
-      0,   0,   0,   0,   6,   0, \r
-      0,   0, 166,  26,  16,   0, \r
-      0,   0,   0,   0,  70,   2, \r
-     16,   0,   0,   0,   0,   0, \r
-     50,   0,   0,  10, 114,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70, 130,  32,   0,   0,   0, \r
-      0,   0,   7,   0,   0,   0, \r
-    246,  31,  16,   0,   0,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      0,   0,   0,   0,  56,   0, \r
-      0,   8, 242,   0,  16,   0, \r
-      1,   0,   0,   0,  86,   5, \r
-     16,   0,   0,   0,   0,   0, \r
-     70, 142,  32,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-     50,   0,   0,  10, 242,   0, \r
-     16,   0,   1,   0,   0,   0, \r
-     70, 142,  32,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      6,   0,  16,   0,   0,   0, \r
-      0,   0,  70,  14,  16,   0, \r
-      1,   0,   0,   0,  50,   0, \r
-      0,  10, 242,   0,  16,   0, \r
-      1,   0,   0,   0,  70, 142, \r
-     32,   0,   0,   0,   0,   0, \r
-      2,   0,   0,   0, 166,  10, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  14,  16,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   8, \r
-    242,  32,  16,   0,   0,   0, \r
-      0,   0,  70,  14,  16,   0, \r
-      1,   0,   0,   0,  70, 142, \r
-     32,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,  56,   0, \r
-      0,   8, 114,   0,  16,   0, \r
-      1,   0,   0,   0,  86,  21, \r
-     16,   0,   1,   0,   0,   0, \r
-     70, 130,  32,   0,   0,   0, \r
-      0,   0,   5,   0,   0,   0, \r
-     50,   0,   0,  10, 114,   0, \r
-     16,   0,   1,   0,   0,   0, \r
-     70, 130,  32,   0,   0,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-      6,  16,  16,   0,   1,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      1,   0,   0,   0,  50,   0, \r
-      0,  10, 114,  32,  16,   0, \r
-      1,   0,   0,   0,  70, 130, \r
-     32,   0,   0,   0,   0,   0, \r
-      6,   0,   0,   0, 166,  26, \r
-     16,   0,   1,   0,   0,   0, \r
-     70,   2,  16,   0,   1,   0, \r
-      0,   0,  54,   0,   0,   6, \r
-    114,  32,  16,   0,   2,   0, \r
-      0,   0,  70,   2,  16, 128, \r
-     65,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   9, \r
-    114,  32,  16,   0,   3,   0, \r
-      0,   0,  70,   2,  16, 128, \r
-     65,   0,   0,   0,   0,   0, \r
-      0,   0,  70, 130,  32,   0, \r
-      0,   0,   0,   0,   8,   0, \r
-      0,   0,  62,   0,   0,   1, \r
-     83,  84,  65,  84, 116,   0, \r
-      0,   0,  14,   0,   0,   0, \r
-      2,   0,   0,   0,   0,   0, \r
-      0,   0,   6,   0,   0,   0, \r
-      5,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      1,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      1,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d11gears.hlsl.vs.h /Evs /Tvs_4_0 d3d11gears.hlsl
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer cb
+// {
+//
+//   float4x4 proj;                     // Offset:    0 Size:    64
+//   float4x4 modelview;                // Offset:   64 Size:    64
+//   float4 light;                      // Offset:  128 Size:    16
+//   float4 diffuse;                    // Offset:  144 Size:    16 [unused]
+//   float4 specular;                   // Offset:  160 Size:    16 [unused]
+//   float specular_power;              // Offset:  176 Size:     4 [unused]
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// cb                                cbuffer      NA          NA    0        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION                 0   xyzw        0     NONE  float   xyzw
+// NORMAL                   0   xyz         1     NONE  float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION              0   xyzw        0      POS  float   xyzw
+// NORMAL                   0   xyz         1     NONE  float   xyz 
+// EYE                      0   xyz         2     NONE  float   xyz 
+// LIGHT                    0   xyz         3     NONE  float   xyz 
+//
+vs_4_0
+dcl_constantbuffer cb0[9], immediateIndexed
+dcl_input v0.xyzw
+dcl_input v1.xyz
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyz
+dcl_output o2.xyz
+dcl_output o3.xyz
+dcl_temps 2
+mul r0.xyz, v0.yyyy, cb0[5].xyzx
+mad r0.xyz, cb0[4].xyzx, v0.xxxx, r0.xyzx
+mad r0.xyz, cb0[6].xyzx, v0.zzzz, r0.xyzx
+mad r0.xyz, cb0[7].xyzx, v0.wwww, r0.xyzx
+mul r1.xyzw, r0.yyyy, cb0[1].xyzw
+mad r1.xyzw, cb0[0].xyzw, r0.xxxx, r1.xyzw
+mad r1.xyzw, cb0[2].xyzw, r0.zzzz, r1.xyzw
+add o0.xyzw, r1.xyzw, cb0[3].xyzw
+mul r1.xyz, v1.yyyy, cb0[5].xyzx
+mad r1.xyz, cb0[4].xyzx, v1.xxxx, r1.xyzx
+mad o1.xyz, cb0[6].xyzx, v1.zzzz, r1.xyzx
+mov o2.xyz, -r0.xyzx
+add o3.xyz, -r0.xyzx, cb0[8].xyzx
+ret 
+// Approximately 14 instruction slots used
+#endif
+
+const BYTE g_vs[] =
+{
+     68,  88,  66,  67, 251,  82, 
+     65, 114, 135,  66, 139,  83, 
+      7,  10,  20, 121, 102,  38, 
+     44,  36,   1,   0,   0,   0, 
+    104,   5,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    192,   1,   0,   0,  16,   2, 
+      0,   0, 160,   2,   0,   0, 
+    236,   4,   0,   0,  82,  68, 
+     69,  70, 132,   1,   0,   0, 
+      1,   0,   0,   0,  64,   0, 
+      0,   0,   1,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    254, 255,   0,   1,   0,   0, 
+     80,   1,   0,   0,  60,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+     99,  98,   0, 171,  60,   0, 
+      0,   0,   6,   0,   0,   0, 
+     88,   0,   0,   0, 192,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0, 232,   0, 
+      0,   0,   0,   0,   0,   0, 
+     64,   0,   0,   0,   2,   0, 
+      0,   0, 240,   0,   0,   0, 
+      0,   0,   0,   0,   0,   1, 
+      0,   0,  64,   0,   0,   0, 
+     64,   0,   0,   0,   2,   0, 
+      0,   0, 240,   0,   0,   0, 
+      0,   0,   0,   0,  10,   1, 
+      0,   0, 128,   0,   0,   0, 
+     16,   0,   0,   0,   2,   0, 
+      0,   0,  16,   1,   0,   0, 
+      0,   0,   0,   0,  32,   1, 
+      0,   0, 144,   0,   0,   0, 
+     16,   0,   0,   0,   0,   0, 
+      0,   0,  16,   1,   0,   0, 
+      0,   0,   0,   0,  40,   1, 
+      0,   0, 160,   0,   0,   0, 
+     16,   0,   0,   0,   0,   0, 
+      0,   0,  16,   1,   0,   0, 
+      0,   0,   0,   0,  49,   1, 
+      0,   0, 176,   0,   0,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,  64,   1,   0,   0, 
+      0,   0,   0,   0, 112, 114, 
+    111, 106,   0, 171, 171, 171, 
+      3,   0,   3,   0,   4,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0, 109, 111, 
+    100, 101, 108, 118, 105, 101, 
+    119,   0, 108, 105, 103, 104, 
+    116,   0,   1,   0,   3,   0, 
+      1,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    100, 105, 102, 102, 117, 115, 
+    101,   0, 115, 112, 101,  99, 
+    117, 108,  97, 114,   0, 115, 
+    112, 101,  99, 117, 108,  97, 
+    114,  95, 112, 111, 119, 101, 
+    114,   0,   0,   0,   3,   0, 
+      1,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     77, 105,  99, 114, 111, 115, 
+    111, 102, 116,  32,  40,  82, 
+     41,  32,  72,  76,  83,  76, 
+     32,  83, 104,  97, 100, 101, 
+    114,  32,  67, 111, 109, 112, 
+    105, 108, 101, 114,  32,  57, 
+     46,  50,  57,  46,  57,  53, 
+     50,  46,  51,  49,  49,  49, 
+      0, 171, 171, 171,  73,  83, 
+     71,  78,  72,   0,   0,   0, 
+      2,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,  15, 
+      0,   0,  65,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,   7,   7, 
+      0,   0,  80,  79,  83,  73, 
+     84,  73,  79,  78,   0,  78, 
+     79,  82,  77,  65,  76,   0, 
+     79,  83,  71,  78, 136,   0, 
+      0,   0,   4,   0,   0,   0, 
+      8,   0,   0,   0, 104,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0, 116,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      7,   8,   0,   0, 123,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      7,   8,   0,   0, 127,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   3,   0,   0,   0, 
+      7,   8,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  78,  79, 
+     82,  77,  65,  76,   0,  69, 
+     89,  69,   0,  76,  73,  71, 
+     72,  84,   0, 171, 171, 171, 
+     83,  72,  68,  82,  68,   2, 
+      0,   0,  64,   0,   1,   0, 
+    145,   0,   0,   0,  89,   0, 
+      0,   4,  70, 142,  32,   0, 
+      0,   0,   0,   0,   9,   0, 
+      0,   0,  95,   0,   0,   3, 
+    242,  16,  16,   0,   0,   0, 
+      0,   0,  95,   0,   0,   3, 
+    114,  16,  16,   0,   1,   0, 
+      0,   0, 103,   0,   0,   4, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 114,  32, 
+     16,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 114,  32, 
+     16,   0,   2,   0,   0,   0, 
+    101,   0,   0,   3, 114,  32, 
+     16,   0,   3,   0,   0,   0, 
+    104,   0,   0,   2,   2,   0, 
+      0,   0,  56,   0,   0,   8, 
+    114,   0,  16,   0,   0,   0, 
+      0,   0,  86,  21,  16,   0, 
+      0,   0,   0,   0,  70, 130, 
+     32,   0,   0,   0,   0,   0, 
+      5,   0,   0,   0,  50,   0, 
+      0,  10, 114,   0,  16,   0, 
+      0,   0,   0,   0,  70, 130, 
+     32,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   6,  16, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  50,   0,   0,  10, 
+    114,   0,  16,   0,   0,   0, 
+      0,   0,  70, 130,  32,   0, 
+      0,   0,   0,   0,   6,   0, 
+      0,   0, 166,  26,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     50,   0,   0,  10, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70, 130,  32,   0,   0,   0, 
+      0,   0,   7,   0,   0,   0, 
+    246,  31,  16,   0,   0,   0, 
+      0,   0,  70,   2,  16,   0, 
+      0,   0,   0,   0,  56,   0, 
+      0,   8, 242,   0,  16,   0, 
+      1,   0,   0,   0,  86,   5, 
+     16,   0,   0,   0,   0,   0, 
+     70, 142,  32,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     50,   0,   0,  10, 242,   0, 
+     16,   0,   1,   0,   0,   0, 
+     70, 142,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      6,   0,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      1,   0,   0,   0,  50,   0, 
+      0,  10, 242,   0,  16,   0, 
+      1,   0,   0,   0,  70, 142, 
+     32,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0, 166,  10, 
+     16,   0,   0,   0,   0,   0, 
+     70,  14,  16,   0,   1,   0, 
+      0,   0,   0,   0,   0,   8, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      1,   0,   0,   0,  70, 142, 
+     32,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,  56,   0, 
+      0,   8, 114,   0,  16,   0, 
+      1,   0,   0,   0,  86,  21, 
+     16,   0,   1,   0,   0,   0, 
+     70, 130,  32,   0,   0,   0, 
+      0,   0,   5,   0,   0,   0, 
+     50,   0,   0,  10, 114,   0, 
+     16,   0,   1,   0,   0,   0, 
+     70, 130,  32,   0,   0,   0, 
+      0,   0,   4,   0,   0,   0, 
+      6,  16,  16,   0,   1,   0, 
+      0,   0,  70,   2,  16,   0, 
+      1,   0,   0,   0,  50,   0, 
+      0,  10, 114,  32,  16,   0, 
+      1,   0,   0,   0,  70, 130, 
+     32,   0,   0,   0,   0,   0, 
+      6,   0,   0,   0, 166,  26, 
+     16,   0,   1,   0,   0,   0, 
+     70,   2,  16,   0,   1,   0, 
+      0,   0,  54,   0,   0,   6, 
+    114,  32,  16,   0,   2,   0, 
+      0,   0,  70,   2,  16, 128, 
+     65,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   9, 
+    114,  32,  16,   0,   3,   0, 
+      0,   0,  70,   2,  16, 128, 
+     65,   0,   0,   0,   0,   0, 
+      0,   0,  70, 130,  32,   0, 
+      0,   0,   0,   0,   8,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,  14,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   6,   0,   0,   0, 
+      5,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
index 31af95c..54ca08f 100755 (executable)
-/**************************************************************************\r
- *\r
- * Copyright 2010 Luca Barbieri\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining\r
- * a copy of this software and associated documentation files (the\r
- * "Software"), to deal in the Software without restriction, including\r
- * without limitation the rights to use, copy, modify, merge, publish,\r
- * distribute, sublicense, and/or sell copies of the Software, and to\r
- * permit persons to whom the Software is furnished to do so, subject to\r
- * the following conditions:\r
- *\r
- * The above copyright notice and this permission notice (including the\r
- * next paragraph) shall be included in all copies or substantial\r
- * portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE\r
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- **************************************************************************/\r
-\r
-#define _USE_MATH_DEFINES\r
-#include "d3d11app.h"\r
-#include "d3d11spikysphere.hlsl.vs.h"\r
-#include "d3d11spikysphere.hlsl.hs.h"\r
-#include "d3d11spikysphere.hlsl.ds.h"\r
-#include "d3d11spikysphere.hlsl.ps.h"\r
-\r
-#include <stdlib.h>\r
-#include <stdio.h>\r
-#include <math.h>\r
-#include <float.h>\r
-#include <D3DX10math.h>\r
-\r
-struct cb_frame_t\r
-{\r
-       D3DXMATRIX model;\r
-       D3DXMATRIX view_proj;\r
-       float disp_scale;\r
-       float disp_freq;\r
-       float tess_factor;\r
-};\r
-\r
-static float vertex_data[] =\r
-{\r
-       1.0, 0.0, 0.0,\r
-       0.0, 1.0, 0.0,\r
-       0.0, 0.0, 1.0,\r
-\r
-       0.0, 1.0, 0.0,\r
-       -1.0, 0.0, 0.0,\r
-       0.0, 0.0, 1.0,\r
-                       \r
-       0.0, -1.0, 0.0,\r
-       1.0, 0.0, 0.0,\r
-       0.0, 0.0, 1.0,\r
-                       \r
-       -1.0, 0.0, 0.0,\r
-       0.0, -1.0, 0.0,\r
-       0.0, 0.0, 1.0,\r
-                       \r
-       0.0, 1.0, 0.0,\r
-       1.0, 0.0, 0.0,\r
-       0.0, 0.0, -1.0,\r
-\r
-       -1.0, 0.0, 0.0,\r
-       0.0, 1.0, 0.0,\r
-       0.0, 0.0, -1.0,\r
-                       \r
-       1.0, 0.0, 0.0,\r
-       0.0, -1.0, 0.0,\r
-       0.0, 0.0, -1.0,\r
-\r
-       0.0, -1.0, 0.0,\r
-       -1.0, 0.0, 0.0,\r
-       0.0, 0.0, -1.0,\r
-};\r
-\r
-struct d3d11spikysphere : public d3d11_application\r
-{\r
-       ID3D11Device* dev;\r
-       ID3D11PixelShader* ps;\r
-       ID3D11DomainShader* ds;\r
-       ID3D11HullShader* hs;\r
-       ID3D11VertexShader* vs;\r
-       ID3D11InputLayout* layout;\r
-       ID3D11Buffer* vb;\r
-       ID3D11RenderTargetView* rtv;\r
-       ID3D11DepthStencilView* zsv;\r
-       ID3D11Buffer* cb_frame;\r
-\r
-       int cur_width;\r
-       int cur_height;\r
-\r
-       d3d11spikysphere()\r
-       : cur_width(-1), cur_height(-1), zsv(0)\r
-       {}\r
-\r
-       bool init(ID3D11Device* dev, int argc, char** argv)\r
-       {\r
-               this->dev = dev;\r
-               ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs));\r
-               ensure(dev->CreateHullShader(g_hs, sizeof(g_hs), NULL, &hs));\r
-               ensure(dev->CreateDomainShader(g_ds, sizeof(g_ds), NULL, &ds));\r
-               ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps));\r
-               \r
-               D3D11_INPUT_ELEMENT_DESC elements[1] =\r
-               {\r
-                       {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,\r
-                       0, D3D11_INPUT_PER_VERTEX_DATA, 0},\r
-               };\r
-\r
-               ensure(dev->CreateInputLayout(elements, 1, g_vs, sizeof(g_vs), &layout));\r
-\r
-               D3D11_BUFFER_DESC bufferd;\r
-               bufferd.ByteWidth = sizeof(vertex_data);\r
-               bufferd.Usage = D3D11_USAGE_IMMUTABLE;\r
-               bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER;\r
-               bufferd.CPUAccessFlags = 0;\r
-               bufferd.MiscFlags = 0;\r
-               bufferd.StructureByteStride = 0;\r
-\r
-               D3D11_SUBRESOURCE_DATA buffersd;\r
-               buffersd.pSysMem = vertex_data;\r
-\r
-               ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb));\r
-\r
-               D3D11_BUFFER_DESC cbd;\r
-               cbd.ByteWidth = (sizeof(cb_frame_t) + 15) & ~15;\r
-               cbd.Usage = D3D11_USAGE_DYNAMIC;\r
-               cbd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;\r
-               cbd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;\r
-               cbd.MiscFlags = 0;\r
-               cbd.StructureByteStride = 0;\r
-\r
-               ensure(dev->CreateBuffer(&cbd, NULL, &cb_frame));\r
-               return true;\r
-       }\r
-\r
-       void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time)\r
-       {\r
-               D3D11_VIEWPORT vp;\r
-               memset(&vp, 0, sizeof(vp));\r
-               vp.Width = (float)width;\r
-               vp.Height = (float)height;\r
-               vp.MaxDepth = 1.0f;\r
-\r
-               if(width != cur_width || height != cur_height)\r
-               {\r
-                       if(zsv)\r
-                               zsv->Release();\r
-                       ID3D11Texture2D* zsbuf;\r
-                       D3D11_TEXTURE2D_DESC zsbufd;\r
-                       memset(&zsbufd, 0, sizeof(zsbufd));\r
-                       zsbufd.Width = width;\r
-                       zsbufd.Height = height;\r
-                       zsbufd.Format = DXGI_FORMAT_D32_FLOAT;\r
-                       zsbufd.ArraySize = 1;\r
-                       zsbufd.MipLevels = 1;\r
-                       zsbufd.SampleDesc.Count = 1;\r
-                       zsbufd.BindFlags = D3D11_BIND_DEPTH_STENCIL;\r
-                       ensure(dev->CreateTexture2D(&zsbufd, 0, &zsbuf));\r
-                       ensure(dev->CreateDepthStencilView(zsbuf, 0, &zsv));\r
-                       zsbuf->Release();\r
-               }\r
-\r
-               float black[4] = {0, 0, 0, 0};\r
-\r
-               D3D11_MAPPED_SUBRESOURCE map;\r
-               ensure(ctx->Map(cb_frame, 0, D3D11_MAP_WRITE_DISCARD, 0, &map));\r
-               cb_frame_t* cb_frame_data = (cb_frame_t*)map.pData;\r
-               D3DXMatrixIdentity(&cb_frame_data->model);\r
-\r
-               D3DXMATRIX view;\r
-               D3DXVECTOR3 eye(2.0f * (float)sin(time), 0.0f, 2.0f * (float)cos(time));\r
-               D3DXVECTOR3 at(0, 0, 0);\r
-               D3DXVECTOR3 up(0, 1, 0);\r
-               D3DXMatrixLookAtLH(&view, &eye, &at, &up);\r
-               D3DXMATRIX proj;\r
-               D3DXMatrixPerspectiveLH(&proj, 1.1f, 1.1f, 1.0f, 3.0f);\r
-\r
-               cb_frame_data->view_proj = view * proj;\r
-               float min_tess_factor = 1.0f;\r
-               cb_frame_data->tess_factor = (1.0f - (float)cos(time)) * ((64.0f - min_tess_factor) / 2.0f) + min_tess_factor;\r
-               cb_frame_data->disp_scale = 0.9f;\r
-               //cb_frame_data->disp_scale = (sin(time) + 1.0) / 2.0;\r
-               cb_frame_data->disp_freq = 5.0f * (float)M_PI;\r
-               //cb_frame_data->disp_freq = (4.0 + 4.0 * cos(time / 5.0)) * PI;\r
-               ctx->Unmap(cb_frame, 0);\r
-\r
-               ctx->HSSetConstantBuffers(0, 1, &cb_frame);\r
-               ctx->DSSetConstantBuffers(0, 1, &cb_frame);\r
-               \r
-               //ctx->OMSetBlendState(bs, black, ~0);\r
-               //ctx->OMSetDepthStencilState(dss, 0);\r
-               ctx->OMSetRenderTargets(1, &rtv, zsv);\r
-               //ctx->RSSetState(rs);\r
-               ctx->RSSetViewports(1, &vp);\r
-\r
-               ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST);\r
-               ctx->IASetInputLayout(layout);\r
-               unsigned stride = 3 * 4;\r
-               unsigned offset = 0;\r
-               ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset);\r
-\r
-               ctx->VSSetShader(vs, NULL, 0);\r
-               ctx->HSSetShader(hs, NULL, 0);\r
-               ctx->DSSetShader(ds, NULL, 0);\r
-               ctx->GSSetShader(NULL, NULL, 0);\r
-               ctx->PSSetShader(ps, NULL, 0);  \r
-\r
-               ctx->ClearRenderTargetView(rtv, black);\r
-               ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH, 1.0f, 0);\r
-\r
-               ctx->Draw(3 * 8, 0);\r
-       }\r
-};\r
-\r
-d3d11_application* d3d11_application_create()\r
-{\r
-       return new d3d11spikysphere();\r
-}\r
+/**************************************************************************
+ *
+ * Copyright 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#define _USE_MATH_DEFINES
+#include "d3d11app.h"
+#include "d3d11spikysphere.hlsl.vs.h"
+#include "d3d11spikysphere.hlsl.hs.h"
+#include "d3d11spikysphere.hlsl.ds.h"
+#include "d3d11spikysphere.hlsl.ps.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <float.h>
+#include <D3DX10math.h>
+
+struct cb_frame_t
+{
+       D3DXMATRIX model;
+       D3DXMATRIX view_proj;
+       float disp_scale;
+       float disp_freq;
+       float tess_factor;
+};
+
+static float vertex_data[] =
+{
+       1.0, 0.0, 0.0,
+       0.0, 1.0, 0.0,
+       0.0, 0.0, 1.0,
+
+       0.0, 1.0, 0.0,
+       -1.0, 0.0, 0.0,
+       0.0, 0.0, 1.0,
+                       
+       0.0, -1.0, 0.0,
+       1.0, 0.0, 0.0,
+       0.0, 0.0, 1.0,
+                       
+       -1.0, 0.0, 0.0,
+       0.0, -1.0, 0.0,
+       0.0, 0.0, 1.0,
+                       
+       0.0, 1.0, 0.0,
+       1.0, 0.0, 0.0,
+       0.0, 0.0, -1.0,
+
+       -1.0, 0.0, 0.0,
+       0.0, 1.0, 0.0,
+       0.0, 0.0, -1.0,
+                       
+       1.0, 0.0, 0.0,
+       0.0, -1.0, 0.0,
+       0.0, 0.0, -1.0,
+
+       0.0, -1.0, 0.0,
+       -1.0, 0.0, 0.0,
+       0.0, 0.0, -1.0,
+};
+
+struct d3d11spikysphere : public d3d11_application
+{
+       ID3D11Device* dev;
+       ID3D11PixelShader* ps;
+       ID3D11DomainShader* ds;
+       ID3D11HullShader* hs;
+       ID3D11VertexShader* vs;
+       ID3D11InputLayout* layout;
+       ID3D11Buffer* vb;
+       ID3D11RenderTargetView* rtv;
+       ID3D11DepthStencilView* zsv;
+       ID3D11Buffer* cb_frame;
+
+       int cur_width;
+       int cur_height;
+
+       d3d11spikysphere()
+       : cur_width(-1), cur_height(-1), zsv(0)
+       {}
+
+       bool init(ID3D11Device* dev, int argc, char** argv)
+       {
+               this->dev = dev;
+               ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs));
+               ensure(dev->CreateHullShader(g_hs, sizeof(g_hs), NULL, &hs));
+               ensure(dev->CreateDomainShader(g_ds, sizeof(g_ds), NULL, &ds));
+               ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps));
+               
+               D3D11_INPUT_ELEMENT_DESC elements[1] =
+               {
+                       {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0,
+                       0, D3D11_INPUT_PER_VERTEX_DATA, 0},
+               };
+
+               ensure(dev->CreateInputLayout(elements, 1, g_vs, sizeof(g_vs), &layout));
+
+               D3D11_BUFFER_DESC bufferd;
+               bufferd.ByteWidth = sizeof(vertex_data);
+               bufferd.Usage = D3D11_USAGE_IMMUTABLE;
+               bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+               bufferd.CPUAccessFlags = 0;
+               bufferd.MiscFlags = 0;
+               bufferd.StructureByteStride = 0;
+
+               D3D11_SUBRESOURCE_DATA buffersd;
+               buffersd.pSysMem = vertex_data;
+
+               ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb));
+
+               D3D11_BUFFER_DESC cbd;
+               cbd.ByteWidth = (sizeof(cb_frame_t) + 15) & ~15;
+               cbd.Usage = D3D11_USAGE_DYNAMIC;
+               cbd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
+               cbd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+               cbd.MiscFlags = 0;
+               cbd.StructureByteStride = 0;
+
+               ensure(dev->CreateBuffer(&cbd, NULL, &cb_frame));
+               return true;
+       }
+
+       void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time)
+       {
+               D3D11_VIEWPORT vp;
+               memset(&vp, 0, sizeof(vp));
+               vp.Width = (float)width;
+               vp.Height = (float)height;
+               vp.MaxDepth = 1.0f;
+
+               if(width != cur_width || height != cur_height)
+               {
+                       if(zsv)
+                               zsv->Release();
+                       ID3D11Texture2D* zsbuf;
+                       D3D11_TEXTURE2D_DESC zsbufd;
+                       memset(&zsbufd, 0, sizeof(zsbufd));
+                       zsbufd.Width = width;
+                       zsbufd.Height = height;
+                       zsbufd.Format = DXGI_FORMAT_D32_FLOAT;
+                       zsbufd.ArraySize = 1;
+                       zsbufd.MipLevels = 1;
+                       zsbufd.SampleDesc.Count = 1;
+                       zsbufd.BindFlags = D3D11_BIND_DEPTH_STENCIL;
+                       ensure(dev->CreateTexture2D(&zsbufd, 0, &zsbuf));
+                       ensure(dev->CreateDepthStencilView(zsbuf, 0, &zsv));
+                       zsbuf->Release();
+               }
+
+               float black[4] = {0, 0, 0, 0};
+
+               D3D11_MAPPED_SUBRESOURCE map;
+               ensure(ctx->Map(cb_frame, 0, D3D11_MAP_WRITE_DISCARD, 0, &map));
+               cb_frame_t* cb_frame_data = (cb_frame_t*)map.pData;
+               D3DXMatrixIdentity(&cb_frame_data->model);
+
+               D3DXMATRIX view;
+               D3DXVECTOR3 eye(2.0f * (float)sin(time), 0.0f, 2.0f * (float)cos(time));
+               D3DXVECTOR3 at(0, 0, 0);
+               D3DXVECTOR3 up(0, 1, 0);
+               D3DXMatrixLookAtLH(&view, &eye, &at, &up);
+               D3DXMATRIX proj;
+               D3DXMatrixPerspectiveLH(&proj, 1.1f, 1.1f, 1.0f, 3.0f);
+
+               cb_frame_data->view_proj = view * proj;
+               float min_tess_factor = 1.0f;
+               cb_frame_data->tess_factor = (1.0f - (float)cos(time)) * ((64.0f - min_tess_factor) / 2.0f) + min_tess_factor;
+               cb_frame_data->disp_scale = 0.9f;
+               //cb_frame_data->disp_scale = (sin(time) + 1.0) / 2.0;
+               cb_frame_data->disp_freq = 5.0f * (float)M_PI;
+               //cb_frame_data->disp_freq = (4.0 + 4.0 * cos(time / 5.0)) * PI;
+               ctx->Unmap(cb_frame, 0);
+
+               ctx->HSSetConstantBuffers(0, 1, &cb_frame);
+               ctx->DSSetConstantBuffers(0, 1, &cb_frame);
+               
+               //ctx->OMSetBlendState(bs, black, ~0);
+               //ctx->OMSetDepthStencilState(dss, 0);
+               ctx->OMSetRenderTargets(1, &rtv, zsv);
+               //ctx->RSSetState(rs);
+               ctx->RSSetViewports(1, &vp);
+
+               ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST);
+               ctx->IASetInputLayout(layout);
+               unsigned stride = 3 * 4;
+               unsigned offset = 0;
+               ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset);
+
+               ctx->VSSetShader(vs, NULL, 0);
+               ctx->HSSetShader(hs, NULL, 0);
+               ctx->DSSetShader(ds, NULL, 0);
+               ctx->GSSetShader(NULL, NULL, 0);
+               ctx->PSSetShader(ps, NULL, 0);  
+
+               ctx->ClearRenderTargetView(rtv, black);
+               ctx->ClearDepthStencilView(zsv, D3D11_CLEAR_DEPTH, 1.0f, 0);
+
+               ctx->Draw(3 * 8, 0);
+       }
+};
+
+d3d11_application* d3d11_application_create()
+{
+       return new d3d11spikysphere();
+}
index 4ec1f6b..45045e5 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d11spikysphere.hlsl.ds.h /Eds /Tds_5_0 d3d11spikysphere.hlsl\r
-//\r
-//\r
-// Buffer Definitions: \r
-//\r
-// cbuffer cb_frame\r
-// {\r
-//\r
-//   float4x4 model;                    // Offset:    0 Size:    64\r
-//   float4x4 view_proj;                // Offset:   64 Size:    64\r
-//   float disp_scale;                  // Offset:  128 Size:     4\r
-//   float disp_freq;                   // Offset:  132 Size:     4\r
-//   float tess_factor;                 // Offset:  136 Size:     4 [unused]\r
-//\r
-// }\r
-//\r
-//\r
-// Resource Bindings:\r
-//\r
-// Name                                 Type  Format         Dim Slot Elements\r
-// ------------------------------ ---------- ------- ----------- ---- --------\r
-// cb_frame                          cbuffer      NA          NA    0        1\r
-//\r
-//\r
-//\r
-// Patch Constant signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_TessFactor            0   x           0  TRIEDGE  float       \r
-// SV_TessFactor            1   x           1  TRIEDGE  float       \r
-// SV_TessFactor            2   x           2  TRIEDGE  float       \r
-// SV_InsideTessFactor      0   x           3   TRIINT  float       \r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// POSITION                 0   xyz         0     NONE  float   xyz \r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_POSITION              0   xyzw        0      POS  float   xyzw\r
-// OBJPOS                   0   xyz         1     NONE  float   xyz \r
-// OBJNORMAL                0   xyz         2     NONE  float   xyz \r
-// WORLDNORMAL              0   xyz         3     NONE  float   xyz \r
-//\r
-// Tessellation Domain   # of control points\r
-// -------------------- --------------------\r
-// Triangle                                3\r
-//\r
-ds_5_0\r
-dcl_input_control_point_count 3\r
-dcl_tessellator_domain domain_tri\r
-dcl_globalFlags refactoringAllowed\r
-dcl_constantbuffer cb0[9], immediateIndexed\r
-dcl_input vDomain.xyz\r
-dcl_input vicp[3][0].xyz\r
-dcl_output_siv o0.xyzw, position\r
-dcl_output o1.xyz\r
-dcl_output o2.xyz\r
-dcl_output o3.xyz\r
-dcl_temps 5\r
-add r0.x, cb0[8].x, l(1.000000)\r
-mul r0.yzw, vDomain.yyyy, vicp[1][0].yyzx\r
-mad r0.yzw, vicp[0][0].yyzx, vDomain.xxxx, r0.yyzw\r
-mad r0.yzw, vicp[2][0].yyzx, vDomain.zzzz, r0.yyzw\r
-dp3 r1.x, r0.yzwy, r0.yzwy\r
-rsq r1.x, r1.x\r
-mul r0.yzw, r0.yyzw, r1.xxxx\r
-mul r1.xyz, r0.wyzw, cb0[8].yyyy\r
-sincos null, r2.xyz, r1.zxyz\r
-sincos r1.xyz, null, -r1.xyzx\r
-mul r1.xyz, r1.xyzx, cb0[8].yyyy\r
-mul r1.xyz, r2.zxyz, r1.xyzx\r
-mul r1.xyz, r2.xyzx, r1.xyzx\r
-mul r1.xyz, r1.xyzx, cb0[8].xxxx\r
-mul r1.w, r2.z, r2.y\r
-mul r1.w, r2.x, r1.w\r
-mad r1.w, r1.w, cb0[8].x, l(1.000000)\r
-mul r2.xyz, r0.wyzw, r1.wwww\r
-div r2.xyz, r2.xyzx, r0.xxxx\r
-mul r3.xyz, r2.yyyy, cb0[1].xyzx\r
-mad r3.xyz, cb0[0].xyzx, r2.xxxx, r3.xyzx\r
-mad r3.xyz, cb0[2].xyzx, r2.zzzz, r3.xyzx\r
-mov o1.xyz, r2.xyzx\r
-add r2.xyz, r3.xyzx, cb0[3].xyzx\r
-mul r3.xyzw, r2.yyyy, cb0[5].xyzw\r
-mad r3.xyzw, cb0[4].xyzw, r2.xxxx, r3.xyzw\r
-mad r2.xyzw, cb0[6].xyzw, r2.zzzz, r3.xyzw\r
-add o0.xyzw, r2.xyzw, cb0[7].xyzw\r
-mov r2.y, l(0)\r
-lt r0.x, |r0.y|, |r0.w|\r
-mul r2.xz, r0.zzwz, l(-1.000000, 0.000000, 1.000000, 0.000000)\r
-mov r2.w, r0.y\r
-movc r2.xyz, r0.xxxx, r2.zxyz, r2.wyxw\r
-dp3 r0.x, r2.xyzx, r2.xyzx\r
-rsq r0.x, r0.x\r
-mul r2.xyz, r0.xxxx, r2.xyzx\r
-mul r3.xyz, r0.wyzw, r2.xyzx\r
-mad r3.xyz, r0.zwyz, r2.yzxy, -r3.xyzx\r
-dp3 r0.x, r3.xyzx, r3.xyzx\r
-rsq r0.x, r0.x\r
-mul r3.xyz, r0.xxxx, r3.xyzx\r
-dp3 r0.x, r1.yzxy, r3.xyzx\r
-mul r3.xyz, r1.wwww, r3.xyzx\r
-mul r4.xyz, r1.wwww, r2.xyzx\r
-dp3 r1.x, r1.zxyz, r2.xyzx\r
-mad r1.xyz, r0.zwyz, r1.xxxx, r4.xyzx\r
-mad r0.xyz, r0.yzwy, r0.xxxx, r3.xyzx\r
-mul r2.xyz, r0.xyzx, r1.xyzx\r
-mad r0.xyz, r1.zxyz, r0.yzxy, -r2.xyzx\r
-dp3 r0.w, r0.xyzx, r0.xyzx\r
-rsq r0.w, r0.w\r
-mul r0.xyz, r0.wwww, r0.xyzx\r
-mov o2.xyz, r0.xyzx\r
-mul r1.xyz, r0.yyyy, cb0[1].xyzx\r
-mad r0.xyw, cb0[0].xyxz, r0.xxxx, r1.xyxz\r
-mad o3.xyz, cb0[2].xyzx, r0.zzzz, r0.xywx\r
-ret \r
-// Approximately 57 instruction slots used\r
-#endif\r
-\r
-const BYTE g_ds[] =\r
-{\r
-     68,  88,  66,  67,   0, 128, \r
-    111,   5, 170,  61, 238,  30, \r
-    169, 104, 139, 245, 182, 233, \r
-    180, 255,   1,   0,   0,   0, \r
-    112,  11,   0,   0,   6,   0, \r
-      0,   0,  56,   0,   0,   0, \r
-     68,   2,   0,   0, 120,   2, \r
-      0,   0,  12,   3,   0,   0, \r
-    168,   3,   0,   0, 212,  10, \r
-      0,   0,  82,  68,  69,  70, \r
-      4,   2,   0,   0,   1,   0, \r
-      0,   0, 104,   0,   0,   0, \r
-      1,   0,   0,   0,  60,   0, \r
-      0,   0,   0,   5,  83,  68, \r
-      0,   1,   0,   0, 210,   1, \r
-      0,   0,  82,  68,  49,  49, \r
-     60,   0,   0,   0,  24,   0, \r
-      0,   0,  32,   0,   0,   0, \r
-     40,   0,   0,   0,  36,   0, \r
-      0,   0,  12,   0,   0,   0, \r
-      0,   0,   0,   0,  92,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     99,  98,  95, 102, 114,  97, \r
-    109, 101,   0, 171, 171, 171, \r
-     92,   0,   0,   0,   5,   0, \r
-      0,   0, 128,   0,   0,   0, \r
-    144,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     72,   1,   0,   0,   0,   0, \r
-      0,   0,  64,   0,   0,   0, \r
-      2,   0,   0,   0,  88,   1, \r
-      0,   0,   0,   0,   0,   0, \r
-    255, 255, 255, 255,   0,   0, \r
-      0,   0, 255, 255, 255, 255, \r
-      0,   0,   0,   0, 124,   1, \r
-      0,   0,  64,   0,   0,   0, \r
-     64,   0,   0,   0,   2,   0, \r
-      0,   0,  88,   1,   0,   0, \r
-      0,   0,   0,   0, 255, 255, \r
-    255, 255,   0,   0,   0,   0, \r
-    255, 255, 255, 255,   0,   0, \r
-      0,   0, 134,   1,   0,   0, \r
-    128,   0,   0,   0,   4,   0, \r
-      0,   0,   2,   0,   0,   0, \r
-    152,   1,   0,   0,   0,   0, \r
-      0,   0, 255, 255, 255, 255, \r
-      0,   0,   0,   0, 255, 255, \r
-    255, 255,   0,   0,   0,   0, \r
-    188,   1,   0,   0, 132,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-      2,   0,   0,   0, 152,   1, \r
-      0,   0,   0,   0,   0,   0, \r
-    255, 255, 255, 255,   0,   0, \r
-      0,   0, 255, 255, 255, 255, \r
-      0,   0,   0,   0, 198,   1, \r
-      0,   0, 136,   0,   0,   0, \r
-      4,   0,   0,   0,   0,   0, \r
-      0,   0, 152,   1,   0,   0, \r
-      0,   0,   0,   0, 255, 255, \r
-    255, 255,   0,   0,   0,   0, \r
-    255, 255, 255, 255,   0,   0, \r
-      0,   0, 109, 111, 100, 101, \r
-    108,   0, 102, 108, 111,  97, \r
-    116,  52, 120,  52,   0, 171, \r
-      3,   0,   3,   0,   4,   0, \r
-      4,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,  78,   1,   0,   0, \r
-    118, 105, 101, 119,  95, 112, \r
-    114, 111, 106,   0, 100, 105, \r
-    115, 112,  95, 115,  99,  97, \r
-    108, 101,   0, 102, 108, 111, \r
-     97, 116,   0, 171,   0,   0, \r
-      3,   0,   1,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-    145,   1,   0,   0, 100, 105, \r
-    115, 112,  95, 102, 114, 101, \r
-    113,   0, 116, 101, 115, 115, \r
-     95, 102,  97,  99, 116, 111, \r
-    114,   0,  77, 105,  99, 114, \r
-    111, 115, 111, 102, 116,  32, \r
-     40,  82,  41,  32,  72,  76, \r
-     83,  76,  32,  83, 104,  97, \r
-    100, 101, 114,  32,  67, 111, \r
-    109, 112, 105, 108, 101, 114, \r
-     32,  57,  46,  50,  57,  46, \r
-     57,  53,  50,  46,  51,  49, \r
-     49,  49,   0, 171,  73,  83, \r
-     71,  78,  44,   0,   0,   0, \r
-      1,   0,   0,   0,   8,   0, \r
-      0,   0,  32,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      0,   0,   0,   0,   7,   7, \r
-      0,   0,  80,  79,  83,  73, \r
-     84,  73,  79,  78,   0, 171, \r
-    171, 171,  80,  67,  83,  71, \r
-    140,   0,   0,   0,   4,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-    104,   0,   0,   0,   0,   0, \r
-      0,   0,  13,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-    104,   0,   0,   0,   1,   0, \r
-      0,   0,  13,   0,   0,   0, \r
-      3,   0,   0,   0,   1,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-    104,   0,   0,   0,   2,   0, \r
-      0,   0,  13,   0,   0,   0, \r
-      3,   0,   0,   0,   2,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-    118,   0,   0,   0,   0,   0, \r
-      0,   0,  14,   0,   0,   0, \r
-      3,   0,   0,   0,   3,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-     83,  86,  95,  84, 101, 115, \r
-    115,  70,  97,  99, 116, 111, \r
-    114,   0,  83,  86,  95,  73, \r
-    110, 115, 105, 100, 101,  84, \r
-    101, 115, 115,  70,  97,  99, \r
-    116, 111, 114,   0, 171, 171, \r
-     79,  83,  71,  78, 148,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-      8,   0,   0,   0, 104,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      1,   0,   0,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     15,   0,   0,   0, 116,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   3,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      7,   8,   0,   0, 123,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   3,   0, \r
-      0,   0,   2,   0,   0,   0, \r
-      7,   8,   0,   0, 133,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   3,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      7,   8,   0,   0,  83,  86, \r
-     95,  80,  79,  83,  73,  84, \r
-     73,  79,  78,   0,  79,  66, \r
-     74,  80,  79,  83,   0,  79, \r
-     66,  74,  78,  79,  82,  77, \r
-     65,  76,   0,  87,  79,  82, \r
-     76,  68,  78,  79,  82,  77, \r
-     65,  76,   0, 171, 171, 171, \r
-     83,  72,  69,  88,  36,   7, \r
-      0,   0,  80,   0,   4,   0, \r
-    201,   1,   0,   0, 147,  24, \r
-      0,   1, 149,  16,   0,   1, \r
-    106,   8,   0,   1,  89,   0, \r
-      0,   4,  70, 142,  32,   0, \r
-      0,   0,   0,   0,   9,   0, \r
-      0,   0,  95,   0,   0,   2, \r
-    114, 192,   1,   0,  95,   0, \r
-      0,   4, 114, 144,  33,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0, 103,   0,   0,   4, \r
-    242,  32,  16,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-    101,   0,   0,   3, 114,  32, \r
-     16,   0,   1,   0,   0,   0, \r
-    101,   0,   0,   3, 114,  32, \r
-     16,   0,   2,   0,   0,   0, \r
-    101,   0,   0,   3, 114,  32, \r
-     16,   0,   3,   0,   0,   0, \r
-    104,   0,   0,   2,   5,   0, \r
-      0,   0,   0,   0,   0,   8, \r
-     18,   0,  16,   0,   0,   0, \r
-      0,   0,  10, 128,  32,   0, \r
-      0,   0,   0,   0,   8,   0, \r
-      0,   0,   1,  64,   0,   0, \r
-      0,   0, 128,  63,  56,   0, \r
-      0,   7, 226,   0,  16,   0, \r
-      0,   0,   0,   0,  86, 197, \r
-      1,   0,  86, 146,  33,   0, \r
-      1,   0,   0,   0,   0,   0, \r
-      0,   0,  50,   0,   0,   9, \r
-    226,   0,  16,   0,   0,   0, \r
-      0,   0,  86, 146,  33,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   6, 192,   1,   0, \r
-     86,  14,  16,   0,   0,   0, \r
-      0,   0,  50,   0,   0,   9, \r
-    226,   0,  16,   0,   0,   0, \r
-      0,   0,  86, 146,  33,   0, \r
-      2,   0,   0,   0,   0,   0, \r
-      0,   0, 166, 202,   1,   0, \r
-     86,  14,  16,   0,   0,   0, \r
-      0,   0,  16,   0,   0,   7, \r
-     18,   0,  16,   0,   1,   0, \r
-      0,   0, 150,   7,  16,   0, \r
-      0,   0,   0,   0, 150,   7, \r
-     16,   0,   0,   0,   0,   0, \r
-     68,   0,   0,   5,  18,   0, \r
-     16,   0,   1,   0,   0,   0, \r
-     10,   0,  16,   0,   1,   0, \r
-      0,   0,  56,   0,   0,   7, \r
-    226,   0,  16,   0,   0,   0, \r
-      0,   0,  86,  14,  16,   0, \r
-      0,   0,   0,   0,   6,   0, \r
-     16,   0,   1,   0,   0,   0, \r
-     56,   0,   0,   8, 114,   0, \r
-     16,   0,   1,   0,   0,   0, \r
-    118,  14,  16,   0,   0,   0, \r
-      0,   0,  86, 133,  32,   0, \r
-      0,   0,   0,   0,   8,   0, \r
-      0,   0,  77,   0,   0,   6, \r
-      0, 208,   0,   0, 114,   0, \r
-     16,   0,   2,   0,   0,   0, \r
-     38,   9,  16,   0,   1,   0, \r
-      0,   0,  77,   0,   0,   7, \r
-    114,   0,  16,   0,   1,   0, \r
-      0,   0,   0, 208,   0,   0, \r
-     70,   2,  16, 128,  65,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-     56,   0,   0,   8, 114,   0, \r
-     16,   0,   1,   0,   0,   0, \r
-     70,   2,  16,   0,   1,   0, \r
-      0,   0,  86, 133,  32,   0, \r
-      0,   0,   0,   0,   8,   0, \r
-      0,   0,  56,   0,   0,   7, \r
-    114,   0,  16,   0,   1,   0, \r
-      0,   0,  38,   9,  16,   0, \r
-      2,   0,   0,   0,  70,   2, \r
-     16,   0,   1,   0,   0,   0, \r
-     56,   0,   0,   7, 114,   0, \r
-     16,   0,   1,   0,   0,   0, \r
-     70,   2,  16,   0,   2,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      1,   0,   0,   0,  56,   0, \r
-      0,   8, 114,   0,  16,   0, \r
-      1,   0,   0,   0,  70,   2, \r
-     16,   0,   1,   0,   0,   0, \r
-      6, 128,  32,   0,   0,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     56,   0,   0,   7, 130,   0, \r
-     16,   0,   1,   0,   0,   0, \r
-     42,   0,  16,   0,   2,   0, \r
-      0,   0,  26,   0,  16,   0, \r
-      2,   0,   0,   0,  56,   0, \r
-      0,   7, 130,   0,  16,   0, \r
-      1,   0,   0,   0,  10,   0, \r
-     16,   0,   2,   0,   0,   0, \r
-     58,   0,  16,   0,   1,   0, \r
-      0,   0,  50,   0,   0,  10, \r
-    130,   0,  16,   0,   1,   0, \r
-      0,   0,  58,   0,  16,   0, \r
-      1,   0,   0,   0,  10, 128, \r
-     32,   0,   0,   0,   0,   0, \r
-      8,   0,   0,   0,   1,  64, \r
-      0,   0,   0,   0, 128,  63, \r
-     56,   0,   0,   7, 114,   0, \r
-     16,   0,   2,   0,   0,   0, \r
-    118,  14,  16,   0,   0,   0, \r
-      0,   0, 246,  15,  16,   0, \r
-      1,   0,   0,   0,  14,   0, \r
-      0,   7, 114,   0,  16,   0, \r
-      2,   0,   0,   0,  70,   2, \r
-     16,   0,   2,   0,   0,   0, \r
-      6,   0,  16,   0,   0,   0, \r
-      0,   0,  56,   0,   0,   8, \r
-    114,   0,  16,   0,   3,   0, \r
-      0,   0,  86,   5,  16,   0, \r
-      2,   0,   0,   0,  70, 130, \r
-     32,   0,   0,   0,   0,   0, \r
-      1,   0,   0,   0,  50,   0, \r
-      0,  10, 114,   0,  16,   0, \r
-      3,   0,   0,   0,  70, 130, \r
-     32,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   6,   0, \r
-     16,   0,   2,   0,   0,   0, \r
-     70,   2,  16,   0,   3,   0, \r
-      0,   0,  50,   0,   0,  10, \r
-    114,   0,  16,   0,   3,   0, \r
-      0,   0,  70, 130,  32,   0, \r
-      0,   0,   0,   0,   2,   0, \r
-      0,   0, 166,  10,  16,   0, \r
-      2,   0,   0,   0,  70,   2, \r
-     16,   0,   3,   0,   0,   0, \r
-     54,   0,   0,   5, 114,  32, \r
-     16,   0,   1,   0,   0,   0, \r
-     70,   2,  16,   0,   2,   0, \r
-      0,   0,   0,   0,   0,   8, \r
-    114,   0,  16,   0,   2,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      3,   0,   0,   0,  70, 130, \r
-     32,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,  56,   0, \r
-      0,   8, 242,   0,  16,   0, \r
-      3,   0,   0,   0,  86,   5, \r
-     16,   0,   2,   0,   0,   0, \r
-     70, 142,  32,   0,   0,   0, \r
-      0,   0,   5,   0,   0,   0, \r
-     50,   0,   0,  10, 242,   0, \r
-     16,   0,   3,   0,   0,   0, \r
-     70, 142,  32,   0,   0,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-      6,   0,  16,   0,   2,   0, \r
-      0,   0,  70,  14,  16,   0, \r
-      3,   0,   0,   0,  50,   0, \r
-      0,  10, 242,   0,  16,   0, \r
-      2,   0,   0,   0,  70, 142, \r
-     32,   0,   0,   0,   0,   0, \r
-      6,   0,   0,   0, 166,  10, \r
-     16,   0,   2,   0,   0,   0, \r
-     70,  14,  16,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   8, \r
-    242,  32,  16,   0,   0,   0, \r
-      0,   0,  70,  14,  16,   0, \r
-      2,   0,   0,   0,  70, 142, \r
-     32,   0,   0,   0,   0,   0, \r
-      7,   0,   0,   0,  54,   0, \r
-      0,   5,  34,   0,  16,   0, \r
-      2,   0,   0,   0,   1,  64, \r
-      0,   0,   0,   0,   0,   0, \r
-     49,   0,   0,   9,  18,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     26,   0,  16, 128, 129,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     58,   0,  16, 128, 129,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     56,   0,   0,  10,  82,   0, \r
-     16,   0,   2,   0,   0,   0, \r
-    166,  11,  16,   0,   0,   0, \r
-      0,   0,   2,  64,   0,   0, \r
-      0,   0, 128, 191,   0,   0, \r
-      0,   0,   0,   0, 128,  63, \r
-      0,   0,   0,   0,  54,   0, \r
-      0,   5, 130,   0,  16,   0, \r
-      2,   0,   0,   0,  26,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     55,   0,   0,   9, 114,   0, \r
-     16,   0,   2,   0,   0,   0, \r
-      6,   0,  16,   0,   0,   0, \r
-      0,   0,  38,   9,  16,   0, \r
-      2,   0,   0,   0, 118,  12, \r
-     16,   0,   2,   0,   0,   0, \r
-     16,   0,   0,   7,  18,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,   2,  16,   0,   2,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      2,   0,   0,   0,  68,   0, \r
-      0,   5,  18,   0,  16,   0, \r
-      0,   0,   0,   0,  10,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     56,   0,   0,   7, 114,   0, \r
-     16,   0,   2,   0,   0,   0, \r
-      6,   0,  16,   0,   0,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      2,   0,   0,   0,  56,   0, \r
-      0,   7, 114,   0,  16,   0, \r
-      3,   0,   0,   0, 118,  14, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,   2,  16,   0,   2,   0, \r
-      0,   0,  50,   0,   0,  10, \r
-    114,   0,  16,   0,   3,   0, \r
-      0,   0, 230,   9,  16,   0, \r
-      0,   0,   0,   0, 150,   4, \r
-     16,   0,   2,   0,   0,   0, \r
-     70,   2,  16, 128,  65,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-     16,   0,   0,   7,  18,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,   2,  16,   0,   3,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      3,   0,   0,   0,  68,   0, \r
-      0,   5,  18,   0,  16,   0, \r
-      0,   0,   0,   0,  10,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     56,   0,   0,   7, 114,   0, \r
-     16,   0,   3,   0,   0,   0, \r
-      6,   0,  16,   0,   0,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      3,   0,   0,   0,  16,   0, \r
-      0,   7,  18,   0,  16,   0, \r
-      0,   0,   0,   0, 150,   4, \r
-     16,   0,   1,   0,   0,   0, \r
-     70,   2,  16,   0,   3,   0, \r
-      0,   0,  56,   0,   0,   7, \r
-    114,   0,  16,   0,   3,   0, \r
-      0,   0, 246,  15,  16,   0, \r
-      1,   0,   0,   0,  70,   2, \r
-     16,   0,   3,   0,   0,   0, \r
-     56,   0,   0,   7, 114,   0, \r
-     16,   0,   4,   0,   0,   0, \r
-    246,  15,  16,   0,   1,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      2,   0,   0,   0,  16,   0, \r
-      0,   7,  18,   0,  16,   0, \r
-      1,   0,   0,   0,  38,   9, \r
-     16,   0,   1,   0,   0,   0, \r
-     70,   2,  16,   0,   2,   0, \r
-      0,   0,  50,   0,   0,   9, \r
-    114,   0,  16,   0,   1,   0, \r
-      0,   0, 230,   9,  16,   0, \r
-      0,   0,   0,   0,   6,   0, \r
-     16,   0,   1,   0,   0,   0, \r
-     70,   2,  16,   0,   4,   0, \r
-      0,   0,  50,   0,   0,   9, \r
-    114,   0,  16,   0,   0,   0, \r
-      0,   0, 150,   7,  16,   0, \r
-      0,   0,   0,   0,   6,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,   2,  16,   0,   3,   0, \r
-      0,   0,  56,   0,   0,   7, \r
-    114,   0,  16,   0,   2,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      0,   0,   0,   0,  70,   2, \r
-     16,   0,   1,   0,   0,   0, \r
-     50,   0,   0,  10, 114,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     38,   9,  16,   0,   1,   0, \r
-      0,   0, 150,   4,  16,   0, \r
-      0,   0,   0,   0,  70,   2, \r
-     16, 128,  65,   0,   0,   0, \r
-      2,   0,   0,   0,  16,   0, \r
-      0,   7, 130,   0,  16,   0, \r
-      0,   0,   0,   0,  70,   2, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,   2,  16,   0,   0,   0, \r
-      0,   0,  68,   0,   0,   5, \r
-    130,   0,  16,   0,   0,   0, \r
-      0,   0,  58,   0,  16,   0, \r
-      0,   0,   0,   0,  56,   0, \r
-      0,   7, 114,   0,  16,   0, \r
-      0,   0,   0,   0, 246,  15, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,   2,  16,   0,   0,   0, \r
-      0,   0,  54,   0,   0,   5, \r
-    114,  32,  16,   0,   2,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      0,   0,   0,   0,  56,   0, \r
-      0,   8, 114,   0,  16,   0, \r
-      1,   0,   0,   0,  86,   5, \r
-     16,   0,   0,   0,   0,   0, \r
-     70, 130,  32,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-     50,   0,   0,  10, 178,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70, 136,  32,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      6,   0,  16,   0,   0,   0, \r
-      0,   0,  70,   8,  16,   0, \r
-      1,   0,   0,   0,  50,   0, \r
-      0,  10, 114,  32,  16,   0, \r
-      3,   0,   0,   0,  70, 130, \r
-     32,   0,   0,   0,   0,   0, \r
-      2,   0,   0,   0, 166,  10, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,   3,  16,   0,   0,   0, \r
-      0,   0,  62,   0,   0,   1, \r
-     83,  84,  65,  84, 148,   0, \r
-      0,   0,  57,   0,   0,   0, \r
-      5,   0,   0,   0,   0,   0, \r
-      0,   0,   6,   0,   0,   0, \r
-     38,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      1,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      4,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   2,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d11spikysphere.hlsl.ds.h /Eds /Tds_5_0 d3d11spikysphere.hlsl
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer cb_frame
+// {
+//
+//   float4x4 model;                    // Offset:    0 Size:    64
+//   float4x4 view_proj;                // Offset:   64 Size:    64
+//   float disp_scale;                  // Offset:  128 Size:     4
+//   float disp_freq;                   // Offset:  132 Size:     4
+//   float tess_factor;                 // Offset:  136 Size:     4 [unused]
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// cb_frame                          cbuffer      NA          NA    0        1
+//
+//
+//
+// Patch Constant signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TessFactor            0   x           0  TRIEDGE  float       
+// SV_TessFactor            1   x           1  TRIEDGE  float       
+// SV_TessFactor            2   x           2  TRIEDGE  float       
+// SV_InsideTessFactor      0   x           3   TRIINT  float       
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION                 0   xyz         0     NONE  float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION              0   xyzw        0      POS  float   xyzw
+// OBJPOS                   0   xyz         1     NONE  float   xyz 
+// OBJNORMAL                0   xyz         2     NONE  float   xyz 
+// WORLDNORMAL              0   xyz         3     NONE  float   xyz 
+//
+// Tessellation Domain   # of control points
+// -------------------- --------------------
+// Triangle                                3
+//
+ds_5_0
+dcl_input_control_point_count 3
+dcl_tessellator_domain domain_tri
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[9], immediateIndexed
+dcl_input vDomain.xyz
+dcl_input vicp[3][0].xyz
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyz
+dcl_output o2.xyz
+dcl_output o3.xyz
+dcl_temps 5
+add r0.x, cb0[8].x, l(1.000000)
+mul r0.yzw, vDomain.yyyy, vicp[1][0].yyzx
+mad r0.yzw, vicp[0][0].yyzx, vDomain.xxxx, r0.yyzw
+mad r0.yzw, vicp[2][0].yyzx, vDomain.zzzz, r0.yyzw
+dp3 r1.x, r0.yzwy, r0.yzwy
+rsq r1.x, r1.x
+mul r0.yzw, r0.yyzw, r1.xxxx
+mul r1.xyz, r0.wyzw, cb0[8].yyyy
+sincos null, r2.xyz, r1.zxyz
+sincos r1.xyz, null, -r1.xyzx
+mul r1.xyz, r1.xyzx, cb0[8].yyyy
+mul r1.xyz, r2.zxyz, r1.xyzx
+mul r1.xyz, r2.xyzx, r1.xyzx
+mul r1.xyz, r1.xyzx, cb0[8].xxxx
+mul r1.w, r2.z, r2.y
+mul r1.w, r2.x, r1.w
+mad r1.w, r1.w, cb0[8].x, l(1.000000)
+mul r2.xyz, r0.wyzw, r1.wwww
+div r2.xyz, r2.xyzx, r0.xxxx
+mul r3.xyz, r2.yyyy, cb0[1].xyzx
+mad r3.xyz, cb0[0].xyzx, r2.xxxx, r3.xyzx
+mad r3.xyz, cb0[2].xyzx, r2.zzzz, r3.xyzx
+mov o1.xyz, r2.xyzx
+add r2.xyz, r3.xyzx, cb0[3].xyzx
+mul r3.xyzw, r2.yyyy, cb0[5].xyzw
+mad r3.xyzw, cb0[4].xyzw, r2.xxxx, r3.xyzw
+mad r2.xyzw, cb0[6].xyzw, r2.zzzz, r3.xyzw
+add o0.xyzw, r2.xyzw, cb0[7].xyzw
+mov r2.y, l(0)
+lt r0.x, |r0.y|, |r0.w|
+mul r2.xz, r0.zzwz, l(-1.000000, 0.000000, 1.000000, 0.000000)
+mov r2.w, r0.y
+movc r2.xyz, r0.xxxx, r2.zxyz, r2.wyxw
+dp3 r0.x, r2.xyzx, r2.xyzx
+rsq r0.x, r0.x
+mul r2.xyz, r0.xxxx, r2.xyzx
+mul r3.xyz, r0.wyzw, r2.xyzx
+mad r3.xyz, r0.zwyz, r2.yzxy, -r3.xyzx
+dp3 r0.x, r3.xyzx, r3.xyzx
+rsq r0.x, r0.x
+mul r3.xyz, r0.xxxx, r3.xyzx
+dp3 r0.x, r1.yzxy, r3.xyzx
+mul r3.xyz, r1.wwww, r3.xyzx
+mul r4.xyz, r1.wwww, r2.xyzx
+dp3 r1.x, r1.zxyz, r2.xyzx
+mad r1.xyz, r0.zwyz, r1.xxxx, r4.xyzx
+mad r0.xyz, r0.yzwy, r0.xxxx, r3.xyzx
+mul r2.xyz, r0.xyzx, r1.xyzx
+mad r0.xyz, r1.zxyz, r0.yzxy, -r2.xyzx
+dp3 r0.w, r0.xyzx, r0.xyzx
+rsq r0.w, r0.w
+mul r0.xyz, r0.wwww, r0.xyzx
+mov o2.xyz, r0.xyzx
+mul r1.xyz, r0.yyyy, cb0[1].xyzx
+mad r0.xyw, cb0[0].xyxz, r0.xxxx, r1.xyxz
+mad o3.xyz, cb0[2].xyzx, r0.zzzz, r0.xywx
+ret 
+// Approximately 57 instruction slots used
+#endif
+
+const BYTE g_ds[] =
+{
+     68,  88,  66,  67,   0, 128, 
+    111,   5, 170,  61, 238,  30, 
+    169, 104, 139, 245, 182, 233, 
+    180, 255,   1,   0,   0,   0, 
+    112,  11,   0,   0,   6,   0, 
+      0,   0,  56,   0,   0,   0, 
+     68,   2,   0,   0, 120,   2, 
+      0,   0,  12,   3,   0,   0, 
+    168,   3,   0,   0, 212,  10, 
+      0,   0,  82,  68,  69,  70, 
+      4,   2,   0,   0,   1,   0, 
+      0,   0, 104,   0,   0,   0, 
+      1,   0,   0,   0,  60,   0, 
+      0,   0,   0,   5,  83,  68, 
+      0,   1,   0,   0, 210,   1, 
+      0,   0,  82,  68,  49,  49, 
+     60,   0,   0,   0,  24,   0, 
+      0,   0,  32,   0,   0,   0, 
+     40,   0,   0,   0,  36,   0, 
+      0,   0,  12,   0,   0,   0, 
+      0,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+     99,  98,  95, 102, 114,  97, 
+    109, 101,   0, 171, 171, 171, 
+     92,   0,   0,   0,   5,   0, 
+      0,   0, 128,   0,   0,   0, 
+    144,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     72,   1,   0,   0,   0,   0, 
+      0,   0,  64,   0,   0,   0, 
+      2,   0,   0,   0,  88,   1, 
+      0,   0,   0,   0,   0,   0, 
+    255, 255, 255, 255,   0,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0, 124,   1, 
+      0,   0,  64,   0,   0,   0, 
+     64,   0,   0,   0,   2,   0, 
+      0,   0,  88,   1,   0,   0, 
+      0,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+    255, 255, 255, 255,   0,   0, 
+      0,   0, 134,   1,   0,   0, 
+    128,   0,   0,   0,   4,   0, 
+      0,   0,   2,   0,   0,   0, 
+    152,   1,   0,   0,   0,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+    188,   1,   0,   0, 132,   0, 
+      0,   0,   4,   0,   0,   0, 
+      2,   0,   0,   0, 152,   1, 
+      0,   0,   0,   0,   0,   0, 
+    255, 255, 255, 255,   0,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0, 198,   1, 
+      0,   0, 136,   0,   0,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0, 152,   1,   0,   0, 
+      0,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+    255, 255, 255, 255,   0,   0, 
+      0,   0, 109, 111, 100, 101, 
+    108,   0, 102, 108, 111,  97, 
+    116,  52, 120,  52,   0, 171, 
+      3,   0,   3,   0,   4,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  78,   1,   0,   0, 
+    118, 105, 101, 119,  95, 112, 
+    114, 111, 106,   0, 100, 105, 
+    115, 112,  95, 115,  99,  97, 
+    108, 101,   0, 102, 108, 111, 
+     97, 116,   0, 171,   0,   0, 
+      3,   0,   1,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    145,   1,   0,   0, 100, 105, 
+    115, 112,  95, 102, 114, 101, 
+    113,   0, 116, 101, 115, 115, 
+     95, 102,  97,  99, 116, 111, 
+    114,   0,  77, 105,  99, 114, 
+    111, 115, 111, 102, 116,  32, 
+     40,  82,  41,  32,  72,  76, 
+     83,  76,  32,  83, 104,  97, 
+    100, 101, 114,  32,  67, 111, 
+    109, 112, 105, 108, 101, 114, 
+     32,  57,  46,  50,  57,  46, 
+     57,  53,  50,  46,  51,  49, 
+     49,  49,   0, 171,  73,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   7,   7, 
+      0,   0,  80,  79,  83,  73, 
+     84,  73,  79,  78,   0, 171, 
+    171, 171,  80,  67,  83,  71, 
+    140,   0,   0,   0,   4,   0, 
+      0,   0,   8,   0,   0,   0, 
+    104,   0,   0,   0,   0,   0, 
+      0,   0,  13,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+    104,   0,   0,   0,   1,   0, 
+      0,   0,  13,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   1,   0,   0,   0, 
+    104,   0,   0,   0,   2,   0, 
+      0,   0,  13,   0,   0,   0, 
+      3,   0,   0,   0,   2,   0, 
+      0,   0,   1,   0,   0,   0, 
+    118,   0,   0,   0,   0,   0, 
+      0,   0,  14,   0,   0,   0, 
+      3,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+     83,  86,  95,  84, 101, 115, 
+    115,  70,  97,  99, 116, 111, 
+    114,   0,  83,  86,  95,  73, 
+    110, 115, 105, 100, 101,  84, 
+    101, 115, 115,  70,  97,  99, 
+    116, 111, 114,   0, 171, 171, 
+     79,  83,  71,  78, 148,   0, 
+      0,   0,   4,   0,   0,   0, 
+      8,   0,   0,   0, 104,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0, 116,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      7,   8,   0,   0, 123,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      7,   8,   0,   0, 133,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   3,   0,   0,   0, 
+      7,   8,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  79,  66, 
+     74,  80,  79,  83,   0,  79, 
+     66,  74,  78,  79,  82,  77, 
+     65,  76,   0,  87,  79,  82, 
+     76,  68,  78,  79,  82,  77, 
+     65,  76,   0, 171, 171, 171, 
+     83,  72,  69,  88,  36,   7, 
+      0,   0,  80,   0,   4,   0, 
+    201,   1,   0,   0, 147,  24, 
+      0,   1, 149,  16,   0,   1, 
+    106,   8,   0,   1,  89,   0, 
+      0,   4,  70, 142,  32,   0, 
+      0,   0,   0,   0,   9,   0, 
+      0,   0,  95,   0,   0,   2, 
+    114, 192,   1,   0,  95,   0, 
+      0,   4, 114, 144,  33,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0, 103,   0,   0,   4, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 114,  32, 
+     16,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 114,  32, 
+     16,   0,   2,   0,   0,   0, 
+    101,   0,   0,   3, 114,  32, 
+     16,   0,   3,   0,   0,   0, 
+    104,   0,   0,   2,   5,   0, 
+      0,   0,   0,   0,   0,   8, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  10, 128,  32,   0, 
+      0,   0,   0,   0,   8,   0, 
+      0,   0,   1,  64,   0,   0, 
+      0,   0, 128,  63,  56,   0, 
+      0,   7, 226,   0,  16,   0, 
+      0,   0,   0,   0,  86, 197, 
+      1,   0,  86, 146,  33,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,  50,   0,   0,   9, 
+    226,   0,  16,   0,   0,   0, 
+      0,   0,  86, 146,  33,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   6, 192,   1,   0, 
+     86,  14,  16,   0,   0,   0, 
+      0,   0,  50,   0,   0,   9, 
+    226,   0,  16,   0,   0,   0, 
+      0,   0,  86, 146,  33,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0, 166, 202,   1,   0, 
+     86,  14,  16,   0,   0,   0, 
+      0,   0,  16,   0,   0,   7, 
+     18,   0,  16,   0,   1,   0, 
+      0,   0, 150,   7,  16,   0, 
+      0,   0,   0,   0, 150,   7, 
+     16,   0,   0,   0,   0,   0, 
+     68,   0,   0,   5,  18,   0, 
+     16,   0,   1,   0,   0,   0, 
+     10,   0,  16,   0,   1,   0, 
+      0,   0,  56,   0,   0,   7, 
+    226,   0,  16,   0,   0,   0, 
+      0,   0,  86,  14,  16,   0, 
+      0,   0,   0,   0,   6,   0, 
+     16,   0,   1,   0,   0,   0, 
+     56,   0,   0,   8, 114,   0, 
+     16,   0,   1,   0,   0,   0, 
+    118,  14,  16,   0,   0,   0, 
+      0,   0,  86, 133,  32,   0, 
+      0,   0,   0,   0,   8,   0, 
+      0,   0,  77,   0,   0,   6, 
+      0, 208,   0,   0, 114,   0, 
+     16,   0,   2,   0,   0,   0, 
+     38,   9,  16,   0,   1,   0, 
+      0,   0,  77,   0,   0,   7, 
+    114,   0,  16,   0,   1,   0, 
+      0,   0,   0, 208,   0,   0, 
+     70,   2,  16, 128,  65,   0, 
+      0,   0,   1,   0,   0,   0, 
+     56,   0,   0,   8, 114,   0, 
+     16,   0,   1,   0,   0,   0, 
+     70,   2,  16,   0,   1,   0, 
+      0,   0,  86, 133,  32,   0, 
+      0,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   7, 
+    114,   0,  16,   0,   1,   0, 
+      0,   0,  38,   9,  16,   0, 
+      2,   0,   0,   0,  70,   2, 
+     16,   0,   1,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   1,   0,   0,   0, 
+     70,   2,  16,   0,   2,   0, 
+      0,   0,  70,   2,  16,   0, 
+      1,   0,   0,   0,  56,   0, 
+      0,   8, 114,   0,  16,   0, 
+      1,   0,   0,   0,  70,   2, 
+     16,   0,   1,   0,   0,   0, 
+      6, 128,  32,   0,   0,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   7, 130,   0, 
+     16,   0,   1,   0,   0,   0, 
+     42,   0,  16,   0,   2,   0, 
+      0,   0,  26,   0,  16,   0, 
+      2,   0,   0,   0,  56,   0, 
+      0,   7, 130,   0,  16,   0, 
+      1,   0,   0,   0,  10,   0, 
+     16,   0,   2,   0,   0,   0, 
+     58,   0,  16,   0,   1,   0, 
+      0,   0,  50,   0,   0,  10, 
+    130,   0,  16,   0,   1,   0, 
+      0,   0,  58,   0,  16,   0, 
+      1,   0,   0,   0,  10, 128, 
+     32,   0,   0,   0,   0,   0, 
+      8,   0,   0,   0,   1,  64, 
+      0,   0,   0,   0, 128,  63, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   2,   0,   0,   0, 
+    118,  14,  16,   0,   0,   0, 
+      0,   0, 246,  15,  16,   0, 
+      1,   0,   0,   0,  14,   0, 
+      0,   7, 114,   0,  16,   0, 
+      2,   0,   0,   0,  70,   2, 
+     16,   0,   2,   0,   0,   0, 
+      6,   0,  16,   0,   0,   0, 
+      0,   0,  56,   0,   0,   8, 
+    114,   0,  16,   0,   3,   0, 
+      0,   0,  86,   5,  16,   0, 
+      2,   0,   0,   0,  70, 130, 
+     32,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,  50,   0, 
+      0,  10, 114,   0,  16,   0, 
+      3,   0,   0,   0,  70, 130, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   6,   0, 
+     16,   0,   2,   0,   0,   0, 
+     70,   2,  16,   0,   3,   0, 
+      0,   0,  50,   0,   0,  10, 
+    114,   0,  16,   0,   3,   0, 
+      0,   0,  70, 130,  32,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0, 166,  10,  16,   0, 
+      2,   0,   0,   0,  70,   2, 
+     16,   0,   3,   0,   0,   0, 
+     54,   0,   0,   5, 114,  32, 
+     16,   0,   1,   0,   0,   0, 
+     70,   2,  16,   0,   2,   0, 
+      0,   0,   0,   0,   0,   8, 
+    114,   0,  16,   0,   2,   0, 
+      0,   0,  70,   2,  16,   0, 
+      3,   0,   0,   0,  70, 130, 
+     32,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,  56,   0, 
+      0,   8, 242,   0,  16,   0, 
+      3,   0,   0,   0,  86,   5, 
+     16,   0,   2,   0,   0,   0, 
+     70, 142,  32,   0,   0,   0, 
+      0,   0,   5,   0,   0,   0, 
+     50,   0,   0,  10, 242,   0, 
+     16,   0,   3,   0,   0,   0, 
+     70, 142,  32,   0,   0,   0, 
+      0,   0,   4,   0,   0,   0, 
+      6,   0,  16,   0,   2,   0, 
+      0,   0,  70,  14,  16,   0, 
+      3,   0,   0,   0,  50,   0, 
+      0,  10, 242,   0,  16,   0, 
+      2,   0,   0,   0,  70, 142, 
+     32,   0,   0,   0,   0,   0, 
+      6,   0,   0,   0, 166,  10, 
+     16,   0,   2,   0,   0,   0, 
+     70,  14,  16,   0,   3,   0, 
+      0,   0,   0,   0,   0,   8, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,  70,  14,  16,   0, 
+      2,   0,   0,   0,  70, 142, 
+     32,   0,   0,   0,   0,   0, 
+      7,   0,   0,   0,  54,   0, 
+      0,   5,  34,   0,  16,   0, 
+      2,   0,   0,   0,   1,  64, 
+      0,   0,   0,   0,   0,   0, 
+     49,   0,   0,   9,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     26,   0,  16, 128, 129,   0, 
+      0,   0,   0,   0,   0,   0, 
+     58,   0,  16, 128, 129,   0, 
+      0,   0,   0,   0,   0,   0, 
+     56,   0,   0,  10,  82,   0, 
+     16,   0,   2,   0,   0,   0, 
+    166,  11,  16,   0,   0,   0, 
+      0,   0,   2,  64,   0,   0, 
+      0,   0, 128, 191,   0,   0, 
+      0,   0,   0,   0, 128,  63, 
+      0,   0,   0,   0,  54,   0, 
+      0,   5, 130,   0,  16,   0, 
+      2,   0,   0,   0,  26,   0, 
+     16,   0,   0,   0,   0,   0, 
+     55,   0,   0,   9, 114,   0, 
+     16,   0,   2,   0,   0,   0, 
+      6,   0,  16,   0,   0,   0, 
+      0,   0,  38,   9,  16,   0, 
+      2,   0,   0,   0, 118,  12, 
+     16,   0,   2,   0,   0,   0, 
+     16,   0,   0,   7,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   2,   0, 
+      0,   0,  70,   2,  16,   0, 
+      2,   0,   0,   0,  68,   0, 
+      0,   5,  18,   0,  16,   0, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   2,   0,   0,   0, 
+      6,   0,  16,   0,   0,   0, 
+      0,   0,  70,   2,  16,   0, 
+      2,   0,   0,   0,  56,   0, 
+      0,   7, 114,   0,  16,   0, 
+      3,   0,   0,   0, 118,  14, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   2,   0, 
+      0,   0,  50,   0,   0,  10, 
+    114,   0,  16,   0,   3,   0, 
+      0,   0, 230,   9,  16,   0, 
+      0,   0,   0,   0, 150,   4, 
+     16,   0,   2,   0,   0,   0, 
+     70,   2,  16, 128,  65,   0, 
+      0,   0,   3,   0,   0,   0, 
+     16,   0,   0,   7,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   3,   0, 
+      0,   0,  70,   2,  16,   0, 
+      3,   0,   0,   0,  68,   0, 
+      0,   5,  18,   0,  16,   0, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   3,   0,   0,   0, 
+      6,   0,  16,   0,   0,   0, 
+      0,   0,  70,   2,  16,   0, 
+      3,   0,   0,   0,  16,   0, 
+      0,   7,  18,   0,  16,   0, 
+      0,   0,   0,   0, 150,   4, 
+     16,   0,   1,   0,   0,   0, 
+     70,   2,  16,   0,   3,   0, 
+      0,   0,  56,   0,   0,   7, 
+    114,   0,  16,   0,   3,   0, 
+      0,   0, 246,  15,  16,   0, 
+      1,   0,   0,   0,  70,   2, 
+     16,   0,   3,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   4,   0,   0,   0, 
+    246,  15,  16,   0,   1,   0, 
+      0,   0,  70,   2,  16,   0, 
+      2,   0,   0,   0,  16,   0, 
+      0,   7,  18,   0,  16,   0, 
+      1,   0,   0,   0,  38,   9, 
+     16,   0,   1,   0,   0,   0, 
+     70,   2,  16,   0,   2,   0, 
+      0,   0,  50,   0,   0,   9, 
+    114,   0,  16,   0,   1,   0, 
+      0,   0, 230,   9,  16,   0, 
+      0,   0,   0,   0,   6,   0, 
+     16,   0,   1,   0,   0,   0, 
+     70,   2,  16,   0,   4,   0, 
+      0,   0,  50,   0,   0,   9, 
+    114,   0,  16,   0,   0,   0, 
+      0,   0, 150,   7,  16,   0, 
+      0,   0,   0,   0,   6,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   3,   0, 
+      0,   0,  56,   0,   0,   7, 
+    114,   0,  16,   0,   2,   0, 
+      0,   0,  70,   2,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   1,   0,   0,   0, 
+     50,   0,   0,  10, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+     38,   9,  16,   0,   1,   0, 
+      0,   0, 150,   4,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16, 128,  65,   0,   0,   0, 
+      2,   0,   0,   0,  16,   0, 
+      0,   7, 130,   0,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  68,   0,   0,   5, 
+    130,   0,  16,   0,   0,   0, 
+      0,   0,  58,   0,  16,   0, 
+      0,   0,   0,   0,  56,   0, 
+      0,   7, 114,   0,  16,   0, 
+      0,   0,   0,   0, 246,  15, 
+     16,   0,   0,   0,   0,   0, 
+     70,   2,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    114,  32,  16,   0,   2,   0, 
+      0,   0,  70,   2,  16,   0, 
+      0,   0,   0,   0,  56,   0, 
+      0,   8, 114,   0,  16,   0, 
+      1,   0,   0,   0,  86,   5, 
+     16,   0,   0,   0,   0,   0, 
+     70, 130,  32,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     50,   0,   0,  10, 178,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70, 136,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      6,   0,  16,   0,   0,   0, 
+      0,   0,  70,   8,  16,   0, 
+      1,   0,   0,   0,  50,   0, 
+      0,  10, 114,  32,  16,   0, 
+      3,   0,   0,   0,  70, 130, 
+     32,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0, 166,  10, 
+     16,   0,   0,   0,   0,   0, 
+     70,   3,  16,   0,   0,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 148,   0, 
+      0,   0,  57,   0,   0,   0, 
+      5,   0,   0,   0,   0,   0, 
+      0,   0,   6,   0,   0,   0, 
+     38,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      4,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
index 316bcdf..d37502a 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d11spikysphere.hlsl.hs.h /Ehs /Ths_5_0 d3d11spikysphere.hlsl\r
-//\r
-//\r
-// Buffer Definitions: \r
-//\r
-// cbuffer cb_frame\r
-// {\r
-//\r
-//   float4x4 model;                    // Offset:    0 Size:    64 [unused]\r
-//   float4x4 view_proj;                // Offset:   64 Size:    64 [unused]\r
-//   float disp_scale;                  // Offset:  128 Size:     4 [unused]\r
-//   float disp_freq;                   // Offset:  132 Size:     4 [unused]\r
-//   float tess_factor;                 // Offset:  136 Size:     4\r
-//\r
-// }\r
-//\r
-//\r
-// Resource Bindings:\r
-//\r
-// Name                                 Type  Format         Dim Slot Elements\r
-// ------------------------------ ---------- ------- ----------- ---- --------\r
-// cb_frame                          cbuffer      NA          NA    0        1\r
-//\r
-//\r
-//\r
-// Patch Constant signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_TessFactor            0   x           0  TRIEDGE  float   x   \r
-// SV_TessFactor            1   x           1  TRIEDGE  float   x   \r
-// SV_TessFactor            2   x           2  TRIEDGE  float   x   \r
-// SV_InsideTessFactor      0   x           3   TRIINT  float   x   \r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// POSITION                 0   xyz         0     NONE  float   xyz \r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// POSITION                 0   xyz         0     NONE  float   xyz \r
-//\r
-// Tessellation Domain   # of control points\r
-// -------------------- --------------------\r
-// Triangle                                3\r
-//\r
-// Tessellation Output Primitive  Partitioning Type \r
-// ------------------------------ ------------------\r
-// Clockwise Triangles            Even Fractional   \r
-//\r
-hs_5_0\r
-hs_decls \r
-dcl_input_control_point_count 3\r
-dcl_output_control_point_count 3\r
-dcl_tessellator_domain domain_tri\r
-dcl_tessellator_partitioning partitioning_fractional_even\r
-dcl_tessellator_output_primitive output_triangle_cw\r
-dcl_globalFlags refactoringAllowed\r
-dcl_constantbuffer cb0[9], immediateIndexed\r
-hs_fork_phase \r
-dcl_hs_fork_phase_instance_count 3\r
-dcl_input vForkInstanceID\r
-dcl_output_siv o0.x, finalTriUeq0EdgeTessFactor\r
-dcl_output_siv o1.x, finalTriVeq0EdgeTessFactor\r
-dcl_output_siv o2.x, finalTriWeq0EdgeTessFactor\r
-dcl_temps 1\r
-dcl_indexrange o0.x 3\r
-mov r0.x, vForkInstanceID.x\r
-mov o[r0.x + 0].x, cb0[8].z\r
-ret \r
-hs_fork_phase \r
-dcl_output_siv o3.x, finalTriInsideTessFactor\r
-mov o3.x, cb0[8].z\r
-ret \r
-// Approximately 5 instruction slots used\r
-#endif\r
-\r
-const BYTE g_hs[] =\r
-{\r
-     68,  88,  66,  67, 174,  23, \r
-    253, 184, 171, 234, 181, 122, \r
-    114,  17,  23, 172,  69, 130, \r
-     17,  19,   1,   0,   0,   0, \r
-    212,   4,   0,   0,   6,   0, \r
-      0,   0,  56,   0,   0,   0, \r
-     68,   2,   0,   0, 120,   2, \r
-      0,   0, 172,   2,   0,   0, \r
-     64,   3,   0,   0,  56,   4, \r
-      0,   0,  82,  68,  69,  70, \r
-      4,   2,   0,   0,   1,   0, \r
-      0,   0, 104,   0,   0,   0, \r
-      1,   0,   0,   0,  60,   0, \r
-      0,   0,   0,   5,  83,  72, \r
-      0,   1,   0,   0, 210,   1, \r
-      0,   0,  82,  68,  49,  49, \r
-     60,   0,   0,   0,  24,   0, \r
-      0,   0,  32,   0,   0,   0, \r
-     40,   0,   0,   0,  36,   0, \r
-      0,   0,  12,   0,   0,   0, \r
-      0,   0,   0,   0,  92,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     99,  98,  95, 102, 114,  97, \r
-    109, 101,   0, 171, 171, 171, \r
-     92,   0,   0,   0,   5,   0, \r
-      0,   0, 128,   0,   0,   0, \r
-    144,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     72,   1,   0,   0,   0,   0, \r
-      0,   0,  64,   0,   0,   0, \r
-      0,   0,   0,   0,  88,   1, \r
-      0,   0,   0,   0,   0,   0, \r
-    255, 255, 255, 255,   0,   0, \r
-      0,   0, 255, 255, 255, 255, \r
-      0,   0,   0,   0, 124,   1, \r
-      0,   0,  64,   0,   0,   0, \r
-     64,   0,   0,   0,   0,   0, \r
-      0,   0,  88,   1,   0,   0, \r
-      0,   0,   0,   0, 255, 255, \r
-    255, 255,   0,   0,   0,   0, \r
-    255, 255, 255, 255,   0,   0, \r
-      0,   0, 134,   1,   0,   0, \r
-    128,   0,   0,   0,   4,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-    152,   1,   0,   0,   0,   0, \r
-      0,   0, 255, 255, 255, 255, \r
-      0,   0,   0,   0, 255, 255, \r
-    255, 255,   0,   0,   0,   0, \r
-    188,   1,   0,   0, 132,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-      0,   0,   0,   0, 152,   1, \r
-      0,   0,   0,   0,   0,   0, \r
-    255, 255, 255, 255,   0,   0, \r
-      0,   0, 255, 255, 255, 255, \r
-      0,   0,   0,   0, 198,   1, \r
-      0,   0, 136,   0,   0,   0, \r
-      4,   0,   0,   0,   2,   0, \r
-      0,   0, 152,   1,   0,   0, \r
-      0,   0,   0,   0, 255, 255, \r
-    255, 255,   0,   0,   0,   0, \r
-    255, 255, 255, 255,   0,   0, \r
-      0,   0, 109, 111, 100, 101, \r
-    108,   0, 102, 108, 111,  97, \r
-    116,  52, 120,  52,   0, 171, \r
-      3,   0,   3,   0,   4,   0, \r
-      4,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,  78,   1,   0,   0, \r
-    118, 105, 101, 119,  95, 112, \r
-    114, 111, 106,   0, 100, 105, \r
-    115, 112,  95, 115,  99,  97, \r
-    108, 101,   0, 102, 108, 111, \r
-     97, 116,   0, 171,   0,   0, \r
-      3,   0,   1,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-    145,   1,   0,   0, 100, 105, \r
-    115, 112,  95, 102, 114, 101, \r
-    113,   0, 116, 101, 115, 115, \r
-     95, 102,  97,  99, 116, 111, \r
-    114,   0,  77, 105,  99, 114, \r
-    111, 115, 111, 102, 116,  32, \r
-     40,  82,  41,  32,  72,  76, \r
-     83,  76,  32,  83, 104,  97, \r
-    100, 101, 114,  32,  67, 111, \r
-    109, 112, 105, 108, 101, 114, \r
-     32,  57,  46,  50,  57,  46, \r
-     57,  53,  50,  46,  51,  49, \r
-     49,  49,   0, 171,  73,  83, \r
-     71,  78,  44,   0,   0,   0, \r
-      1,   0,   0,   0,   8,   0, \r
-      0,   0,  32,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      0,   0,   0,   0,   7,   7, \r
-      0,   0,  80,  79,  83,  73, \r
-     84,  73,  79,  78,   0, 171, \r
-    171, 171,  79,  83,  71,  78, \r
-     44,   0,   0,   0,   1,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     32,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,   7,   8,   0,   0, \r
-     80,  79,  83,  73,  84,  73, \r
-     79,  78,   0, 171, 171, 171, \r
-     80,  67,  83,  71, 140,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-      8,   0,   0,   0, 104,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     13,   0,   0,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      1,  14,   0,   0, 104,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-     13,   0,   0,   0,   3,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      1,  14,   0,   0, 104,   0, \r
-      0,   0,   2,   0,   0,   0, \r
-     13,   0,   0,   0,   3,   0, \r
-      0,   0,   2,   0,   0,   0, \r
-      1,  14,   0,   0, 118,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     14,   0,   0,   0,   3,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      1,  14,   0,   0,  83,  86, \r
-     95,  84, 101, 115, 115,  70, \r
-     97,  99, 116, 111, 114,   0, \r
-     83,  86,  95,  73, 110, 115, \r
-    105, 100, 101,  84, 101, 115, \r
-    115,  70,  97,  99, 116, 111, \r
-    114,   0, 171, 171,  83,  72, \r
-     69,  88, 240,   0,   0,   0, \r
-     80,   0,   3,   0,  60,   0, \r
-      0,   0, 113,   0,   0,   1, \r
-    147,  24,   0,   1, 148,  24, \r
-      0,   1, 149,  16,   0,   1, \r
-    150,  32,   0,   1, 151,  24, \r
-      0,   1, 106,   8,   0,   1, \r
-     89,   0,   0,   4,  70, 142, \r
-     32,   0,   0,   0,   0,   0, \r
-      9,   0,   0,   0, 115,   0, \r
-      0,   1, 153,   0,   0,   2, \r
-      3,   0,   0,   0,  95,   0, \r
-      0,   2,   0, 112,   1,   0, \r
-    103,   0,   0,   4,  18,  32, \r
-     16,   0,   0,   0,   0,   0, \r
-     17,   0,   0,   0, 103,   0, \r
-      0,   4,  18,  32,  16,   0, \r
-      1,   0,   0,   0,  18,   0, \r
-      0,   0, 103,   0,   0,   4, \r
-     18,  32,  16,   0,   2,   0, \r
-      0,   0,  19,   0,   0,   0, \r
-    104,   0,   0,   2,   1,   0, \r
-      0,   0,  91,   0,   0,   4, \r
-     18,  32,  16,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-     54,   0,   0,   4,  18,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     10, 112,   1,   0,  54,   0, \r
-      0,   7,  18,  32, 144,   0, \r
-     10,   0,  16,   0,   0,   0, \r
-      0,   0,  42, 128,  32,   0, \r
-      0,   0,   0,   0,   8,   0, \r
-      0,   0,  62,   0,   0,   1, \r
-    115,   0,   0,   1, 103,   0, \r
-      0,   4,  18,  32,  16,   0, \r
-      3,   0,   0,   0,  20,   0, \r
-      0,   0,  54,   0,   0,   6, \r
-     18,  32,  16,   0,   3,   0, \r
-      0,   0,  42, 128,  32,   0, \r
-      0,   0,   0,   0,   8,   0, \r
-      0,   0,  62,   0,   0,   1, \r
-     83,  84,  65,  84, 148,   0, \r
-      0,   0,   5,   0,   0,   0, \r
-      1,   0,   0,   0,   0,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,  10,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      3,   0,   0,   0,   4,   0, \r
-      0,   0,   2,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d11spikysphere.hlsl.hs.h /Ehs /Ths_5_0 d3d11spikysphere.hlsl
+//
+//
+// Buffer Definitions: 
+//
+// cbuffer cb_frame
+// {
+//
+//   float4x4 model;                    // Offset:    0 Size:    64 [unused]
+//   float4x4 view_proj;                // Offset:   64 Size:    64 [unused]
+//   float disp_scale;                  // Offset:  128 Size:     4 [unused]
+//   float disp_freq;                   // Offset:  132 Size:     4 [unused]
+//   float tess_factor;                 // Offset:  136 Size:     4
+//
+// }
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// cb_frame                          cbuffer      NA          NA    0        1
+//
+//
+//
+// Patch Constant signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TessFactor            0   x           0  TRIEDGE  float   x   
+// SV_TessFactor            1   x           1  TRIEDGE  float   x   
+// SV_TessFactor            2   x           2  TRIEDGE  float   x   
+// SV_InsideTessFactor      0   x           3   TRIINT  float   x   
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION                 0   xyz         0     NONE  float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION                 0   xyz         0     NONE  float   xyz 
+//
+// Tessellation Domain   # of control points
+// -------------------- --------------------
+// Triangle                                3
+//
+// Tessellation Output Primitive  Partitioning Type 
+// ------------------------------ ------------------
+// Clockwise Triangles            Even Fractional   
+//
+hs_5_0
+hs_decls 
+dcl_input_control_point_count 3
+dcl_output_control_point_count 3
+dcl_tessellator_domain domain_tri
+dcl_tessellator_partitioning partitioning_fractional_even
+dcl_tessellator_output_primitive output_triangle_cw
+dcl_globalFlags refactoringAllowed
+dcl_constantbuffer cb0[9], immediateIndexed
+hs_fork_phase 
+dcl_hs_fork_phase_instance_count 3
+dcl_input vForkInstanceID
+dcl_output_siv o0.x, finalTriUeq0EdgeTessFactor
+dcl_output_siv o1.x, finalTriVeq0EdgeTessFactor
+dcl_output_siv o2.x, finalTriWeq0EdgeTessFactor
+dcl_temps 1
+dcl_indexrange o0.x 3
+mov r0.x, vForkInstanceID.x
+mov o[r0.x + 0].x, cb0[8].z
+ret 
+hs_fork_phase 
+dcl_output_siv o3.x, finalTriInsideTessFactor
+mov o3.x, cb0[8].z
+ret 
+// Approximately 5 instruction slots used
+#endif
+
+const BYTE g_hs[] =
+{
+     68,  88,  66,  67, 174,  23, 
+    253, 184, 171, 234, 181, 122, 
+    114,  17,  23, 172,  69, 130, 
+     17,  19,   1,   0,   0,   0, 
+    212,   4,   0,   0,   6,   0, 
+      0,   0,  56,   0,   0,   0, 
+     68,   2,   0,   0, 120,   2, 
+      0,   0, 172,   2,   0,   0, 
+     64,   3,   0,   0,  56,   4, 
+      0,   0,  82,  68,  69,  70, 
+      4,   2,   0,   0,   1,   0, 
+      0,   0, 104,   0,   0,   0, 
+      1,   0,   0,   0,  60,   0, 
+      0,   0,   0,   5,  83,  72, 
+      0,   1,   0,   0, 210,   1, 
+      0,   0,  82,  68,  49,  49, 
+     60,   0,   0,   0,  24,   0, 
+      0,   0,  32,   0,   0,   0, 
+     40,   0,   0,   0,  36,   0, 
+      0,   0,  12,   0,   0,   0, 
+      0,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+     99,  98,  95, 102, 114,  97, 
+    109, 101,   0, 171, 171, 171, 
+     92,   0,   0,   0,   5,   0, 
+      0,   0, 128,   0,   0,   0, 
+    144,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     72,   1,   0,   0,   0,   0, 
+      0,   0,  64,   0,   0,   0, 
+      0,   0,   0,   0,  88,   1, 
+      0,   0,   0,   0,   0,   0, 
+    255, 255, 255, 255,   0,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0, 124,   1, 
+      0,   0,  64,   0,   0,   0, 
+     64,   0,   0,   0,   0,   0, 
+      0,   0,  88,   1,   0,   0, 
+      0,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+    255, 255, 255, 255,   0,   0, 
+      0,   0, 134,   1,   0,   0, 
+    128,   0,   0,   0,   4,   0, 
+      0,   0,   0,   0,   0,   0, 
+    152,   1,   0,   0,   0,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+    188,   1,   0,   0, 132,   0, 
+      0,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0, 152,   1, 
+      0,   0,   0,   0,   0,   0, 
+    255, 255, 255, 255,   0,   0, 
+      0,   0, 255, 255, 255, 255, 
+      0,   0,   0,   0, 198,   1, 
+      0,   0, 136,   0,   0,   0, 
+      4,   0,   0,   0,   2,   0, 
+      0,   0, 152,   1,   0,   0, 
+      0,   0,   0,   0, 255, 255, 
+    255, 255,   0,   0,   0,   0, 
+    255, 255, 255, 255,   0,   0, 
+      0,   0, 109, 111, 100, 101, 
+    108,   0, 102, 108, 111,  97, 
+    116,  52, 120,  52,   0, 171, 
+      3,   0,   3,   0,   4,   0, 
+      4,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,  78,   1,   0,   0, 
+    118, 105, 101, 119,  95, 112, 
+    114, 111, 106,   0, 100, 105, 
+    115, 112,  95, 115,  99,  97, 
+    108, 101,   0, 102, 108, 111, 
+     97, 116,   0, 171,   0,   0, 
+      3,   0,   1,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    145,   1,   0,   0, 100, 105, 
+    115, 112,  95, 102, 114, 101, 
+    113,   0, 116, 101, 115, 115, 
+     95, 102,  97,  99, 116, 111, 
+    114,   0,  77, 105,  99, 114, 
+    111, 115, 111, 102, 116,  32, 
+     40,  82,  41,  32,  72,  76, 
+     83,  76,  32,  83, 104,  97, 
+    100, 101, 114,  32,  67, 111, 
+    109, 112, 105, 108, 101, 114, 
+     32,  57,  46,  50,  57,  46, 
+     57,  53,  50,  46,  51,  49, 
+     49,  49,   0, 171,  73,  83, 
+     71,  78,  44,   0,   0,   0, 
+      1,   0,   0,   0,   8,   0, 
+      0,   0,  32,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   7,   7, 
+      0,   0,  80,  79,  83,  73, 
+     84,  73,  79,  78,   0, 171, 
+    171, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,   7,   8,   0,   0, 
+     80,  79,  83,  73,  84,  73, 
+     79,  78,   0, 171, 171, 171, 
+     80,  67,  83,  71, 140,   0, 
+      0,   0,   4,   0,   0,   0, 
+      8,   0,   0,   0, 104,   0, 
+      0,   0,   0,   0,   0,   0, 
+     13,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,  14,   0,   0, 104,   0, 
+      0,   0,   1,   0,   0,   0, 
+     13,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,  14,   0,   0, 104,   0, 
+      0,   0,   2,   0,   0,   0, 
+     13,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+      1,  14,   0,   0, 118,   0, 
+      0,   0,   0,   0,   0,   0, 
+     14,   0,   0,   0,   3,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,  14,   0,   0,  83,  86, 
+     95,  84, 101, 115, 115,  70, 
+     97,  99, 116, 111, 114,   0, 
+     83,  86,  95,  73, 110, 115, 
+    105, 100, 101,  84, 101, 115, 
+    115,  70,  97,  99, 116, 111, 
+    114,   0, 171, 171,  83,  72, 
+     69,  88, 240,   0,   0,   0, 
+     80,   0,   3,   0,  60,   0, 
+      0,   0, 113,   0,   0,   1, 
+    147,  24,   0,   1, 148,  24, 
+      0,   1, 149,  16,   0,   1, 
+    150,  32,   0,   1, 151,  24, 
+      0,   1, 106,   8,   0,   1, 
+     89,   0,   0,   4,  70, 142, 
+     32,   0,   0,   0,   0,   0, 
+      9,   0,   0,   0, 115,   0, 
+      0,   1, 153,   0,   0,   2, 
+      3,   0,   0,   0,  95,   0, 
+      0,   2,   0, 112,   1,   0, 
+    103,   0,   0,   4,  18,  32, 
+     16,   0,   0,   0,   0,   0, 
+     17,   0,   0,   0, 103,   0, 
+      0,   4,  18,  32,  16,   0, 
+      1,   0,   0,   0,  18,   0, 
+      0,   0, 103,   0,   0,   4, 
+     18,  32,  16,   0,   2,   0, 
+      0,   0,  19,   0,   0,   0, 
+    104,   0,   0,   2,   1,   0, 
+      0,   0,  91,   0,   0,   4, 
+     18,  32,  16,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+     54,   0,   0,   4,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     10, 112,   1,   0,  54,   0, 
+      0,   7,  18,  32, 144,   0, 
+     10,   0,  16,   0,   0,   0, 
+      0,   0,  42, 128,  32,   0, 
+      0,   0,   0,   0,   8,   0, 
+      0,   0,  62,   0,   0,   1, 
+    115,   0,   0,   1, 103,   0, 
+      0,   4,  18,  32,  16,   0, 
+      3,   0,   0,   0,  20,   0, 
+      0,   0,  54,   0,   0,   6, 
+     18,  32,  16,   0,   3,   0, 
+      0,   0,  42, 128,  32,   0, 
+      0,   0,   0,   0,   8,   0, 
+      0,   0,  62,   0,   0,   1, 
+     83,  84,  65,  84, 148,   0, 
+      0,   0,   5,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,  10,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      3,   0,   0,   0,   4,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
index df0ad05..9af2071 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d11spikysphere.hlsl.ps.h /Eps /Tps_4_0 d3d11spikysphere.hlsl\r
-//\r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_POSITION              0   xyzw        0      POS  float       \r
-// OBJPOS                   0   xyz         1     NONE  float   xyz \r
-// OBJNORMAL                0   xyz         2     NONE  float   xyz \r
-// WORLDNORMAL              0   xyz         3     NONE  float   xyz \r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_TARGET                0   xyzw        0   TARGET  float   xyzw\r
-//\r
-ps_4_0\r
-dcl_input_ps linear v1.xyz\r
-dcl_input_ps linear v2.xyz\r
-dcl_input_ps linear v3.xyz\r
-dcl_output o0.xyzw\r
-dcl_temps 2\r
-dp3 r0.x, v2.xyzx, v2.xyzx\r
-rsq r0.x, r0.x\r
-mul r0.xyz, r0.xxxx, v2.xyzx\r
-dp3 r0.w, v1.xyzx, v1.xyzx\r
-rsq r0.w, r0.w\r
-mul r1.xyz, r0.wwww, v1.xyzx\r
-dp3_sat r0.x, r0.xyzx, r1.xyzx\r
-dp3 r0.y, v3.xyzx, v3.xyzx\r
-rsq r0.y, r0.y\r
-mul r0.yz, r0.yyyy, v3.yyzy\r
-dp2_sat r0.y, l(0.707107, -0.707107, 0.000000, 0.000000), r0.yzyy\r
-mul r0.yzw, r0.yyyy, l(0.000000, 0.600000, 0.600000, 0.400000)\r
-mad o0.xyz, r0.xxxx, l(0.400000, 0.400000, 0.600000, 0.000000), r0.yzwy\r
-mov o0.w, l(1.000000)\r
-ret \r
-// Approximately 15 instruction slots used\r
-#endif\r
-\r
-const BYTE g_ps[] =\r
-{\r
-     68,  88,  66,  67, 211, 117, \r
-    143,  38, 226,  40, 181,  77, \r
-     39, 255,  33, 137,  74, 241, \r
-     40, 100,   1,   0,   0,   0, \r
-    184,   3,   0,   0,   5,   0, \r
-      0,   0,  52,   0,   0,   0, \r
-    140,   0,   0,   0,  40,   1, \r
-      0,   0,  92,   1,   0,   0, \r
-     60,   3,   0,   0,  82,  68, \r
-     69,  70,  80,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     28,   0,   0,   0,   0,   4, \r
-    255, 255,   0,   1,   0,   0, \r
-     28,   0,   0,   0,  77, 105, \r
-     99, 114, 111, 115, 111, 102, \r
-    116,  32,  40,  82,  41,  32, \r
-     72,  76,  83,  76,  32,  83, \r
-    104,  97, 100, 101, 114,  32, \r
-     67, 111, 109, 112, 105, 108, \r
-    101, 114,  32,  57,  46,  50, \r
-     57,  46,  57,  53,  50,  46, \r
-     51,  49,  49,  49,   0, 171, \r
-    171, 171,  73,  83,  71,  78, \r
-    148,   0,   0,   0,   4,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-    104,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,   0,   0,   0, \r
-    116,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   1,   0, \r
-      0,   0,   7,   7,   0,   0, \r
-    123,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   2,   0, \r
-      0,   0,   7,   7,   0,   0, \r
-    133,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   3,   0, \r
-      0,   0,   7,   7,   0,   0, \r
-     83,  86,  95,  80,  79,  83, \r
-     73,  84,  73,  79,  78,   0, \r
-     79,  66,  74,  80,  79,  83, \r
-      0,  79,  66,  74,  78,  79, \r
-     82,  77,  65,  76,   0,  87, \r
-     79,  82,  76,  68,  78,  79, \r
-     82,  77,  65,  76,   0, 171, \r
-    171, 171,  79,  83,  71,  78, \r
-     44,   0,   0,   0,   1,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     32,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,   0,   0,   0, \r
-     83,  86,  95,  84,  65,  82, \r
-     71,  69,  84,   0, 171, 171, \r
-     83,  72,  68,  82, 216,   1, \r
-      0,   0,  64,   0,   0,   0, \r
-    118,   0,   0,   0,  98,  16, \r
-      0,   3, 114,  16,  16,   0, \r
-      1,   0,   0,   0,  98,  16, \r
-      0,   3, 114,  16,  16,   0, \r
-      2,   0,   0,   0,  98,  16, \r
-      0,   3, 114,  16,  16,   0, \r
-      3,   0,   0,   0, 101,   0, \r
-      0,   3, 242,  32,  16,   0, \r
-      0,   0,   0,   0, 104,   0, \r
-      0,   2,   2,   0,   0,   0, \r
-     16,   0,   0,   7,  18,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  18,  16,   0,   2,   0, \r
-      0,   0,  70,  18,  16,   0, \r
-      2,   0,   0,   0,  68,   0, \r
-      0,   5,  18,   0,  16,   0, \r
-      0,   0,   0,   0,  10,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     56,   0,   0,   7, 114,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-      6,   0,  16,   0,   0,   0, \r
-      0,   0,  70,  18,  16,   0, \r
-      2,   0,   0,   0,  16,   0, \r
-      0,   7, 130,   0,  16,   0, \r
-      0,   0,   0,   0,  70,  18, \r
-     16,   0,   1,   0,   0,   0, \r
-     70,  18,  16,   0,   1,   0, \r
-      0,   0,  68,   0,   0,   5, \r
-    130,   0,  16,   0,   0,   0, \r
-      0,   0,  58,   0,  16,   0, \r
-      0,   0,   0,   0,  56,   0, \r
-      0,   7, 114,   0,  16,   0, \r
-      1,   0,   0,   0, 246,  15, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  18,  16,   0,   1,   0, \r
-      0,   0,  16,  32,   0,   7, \r
-     18,   0,  16,   0,   0,   0, \r
-      0,   0,  70,   2,  16,   0, \r
-      0,   0,   0,   0,  70,   2, \r
-     16,   0,   1,   0,   0,   0, \r
-     16,   0,   0,   7,  34,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  18,  16,   0,   3,   0, \r
-      0,   0,  70,  18,  16,   0, \r
-      3,   0,   0,   0,  68,   0, \r
-      0,   5,  34,   0,  16,   0, \r
-      0,   0,   0,   0,  26,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     56,   0,   0,   7,  98,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     86,   5,  16,   0,   0,   0, \r
-      0,   0,  86,  22,  16,   0, \r
-      3,   0,   0,   0,  15,  32, \r
-      0,  10,  34,   0,  16,   0, \r
-      0,   0,   0,   0,   2,  64, \r
-      0,   0, 243,   4,  53,  63, \r
-    243,   4,  53, 191,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-    150,   5,  16,   0,   0,   0, \r
-      0,   0,  56,   0,   0,  10, \r
-    226,   0,  16,   0,   0,   0, \r
-      0,   0,  86,   5,  16,   0, \r
-      0,   0,   0,   0,   2,  64, \r
-      0,   0,   0,   0,   0,   0, \r
-    154, 153,  25,  63, 154, 153, \r
-     25,  63, 205, 204, 204,  62, \r
-     50,   0,   0,  12, 114,  32, \r
-     16,   0,   0,   0,   0,   0, \r
-      6,   0,  16,   0,   0,   0, \r
-      0,   0,   2,  64,   0,   0, \r
-    205, 204, 204,  62, 205, 204, \r
-    204,  62, 154, 153,  25,  63, \r
-      0,   0,   0,   0, 150,   7, \r
-     16,   0,   0,   0,   0,   0, \r
-     54,   0,   0,   5, 130,  32, \r
-     16,   0,   0,   0,   0,   0, \r
-      1,  64,   0,   0,   0,   0, \r
-    128,  63,  62,   0,   0,   1, \r
-     83,  84,  65,  84, 116,   0, \r
-      0,   0,  15,   0,   0,   0, \r
-      2,   0,   0,   0,   0,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-     12,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      1,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      1,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d11spikysphere.hlsl.ps.h /Eps /Tps_4_0 d3d11spikysphere.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION              0   xyzw        0      POS  float       
+// OBJPOS                   0   xyz         1     NONE  float   xyz 
+// OBJNORMAL                0   xyz         2     NONE  float   xyz 
+// WORLDNORMAL              0   xyz         3     NONE  float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET                0   xyzw        0   TARGET  float   xyzw
+//
+ps_4_0
+dcl_input_ps linear v1.xyz
+dcl_input_ps linear v2.xyz
+dcl_input_ps linear v3.xyz
+dcl_output o0.xyzw
+dcl_temps 2
+dp3 r0.x, v2.xyzx, v2.xyzx
+rsq r0.x, r0.x
+mul r0.xyz, r0.xxxx, v2.xyzx
+dp3 r0.w, v1.xyzx, v1.xyzx
+rsq r0.w, r0.w
+mul r1.xyz, r0.wwww, v1.xyzx
+dp3_sat r0.x, r0.xyzx, r1.xyzx
+dp3 r0.y, v3.xyzx, v3.xyzx
+rsq r0.y, r0.y
+mul r0.yz, r0.yyyy, v3.yyzy
+dp2_sat r0.y, l(0.707107, -0.707107, 0.000000, 0.000000), r0.yzyy
+mul r0.yzw, r0.yyyy, l(0.000000, 0.600000, 0.600000, 0.400000)
+mad o0.xyz, r0.xxxx, l(0.400000, 0.400000, 0.600000, 0.000000), r0.yzwy
+mov o0.w, l(1.000000)
+ret 
+// Approximately 15 instruction slots used
+#endif
+
+const BYTE g_ps[] =
+{
+     68,  88,  66,  67, 211, 117, 
+    143,  38, 226,  40, 181,  77, 
+     39, 255,  33, 137,  74, 241, 
+     40, 100,   1,   0,   0,   0, 
+    184,   3,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0,  40,   1, 
+      0,   0,  92,   1,   0,   0, 
+     60,   3,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  57,  46,  50, 
+     57,  46,  57,  53,  50,  46, 
+     51,  49,  49,  49,   0, 171, 
+    171, 171,  73,  83,  71,  78, 
+    148,   0,   0,   0,   4,   0, 
+      0,   0,   8,   0,   0,   0, 
+    104,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+    116,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   7,   7,   0,   0, 
+    123,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   2,   0, 
+      0,   0,   7,   7,   0,   0, 
+    133,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   3,   0, 
+      0,   0,   7,   7,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     79,  66,  74,  80,  79,  83, 
+      0,  79,  66,  74,  78,  79, 
+     82,  77,  65,  76,   0,  87, 
+     79,  82,  76,  68,  78,  79, 
+     82,  77,  65,  76,   0, 171, 
+    171, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82, 216,   1, 
+      0,   0,  64,   0,   0,   0, 
+    118,   0,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      1,   0,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      2,   0,   0,   0,  98,  16, 
+      0,   3, 114,  16,  16,   0, 
+      3,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   2,   0,   0,   0, 
+     16,   0,   0,   7,  18,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,  18,  16,   0,   2,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  68,   0, 
+      0,   5,  18,   0,  16,   0, 
+      0,   0,   0,   0,  10,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7, 114,   0, 
+     16,   0,   0,   0,   0,   0, 
+      6,   0,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      2,   0,   0,   0,  16,   0, 
+      0,   7, 130,   0,  16,   0, 
+      0,   0,   0,   0,  70,  18, 
+     16,   0,   1,   0,   0,   0, 
+     70,  18,  16,   0,   1,   0, 
+      0,   0,  68,   0,   0,   5, 
+    130,   0,  16,   0,   0,   0, 
+      0,   0,  58,   0,  16,   0, 
+      0,   0,   0,   0,  56,   0, 
+      0,   7, 114,   0,  16,   0, 
+      1,   0,   0,   0, 246,  15, 
+     16,   0,   0,   0,   0,   0, 
+     70,  18,  16,   0,   1,   0, 
+      0,   0,  16,  32,   0,   7, 
+     18,   0,  16,   0,   0,   0, 
+      0,   0,  70,   2,  16,   0, 
+      0,   0,   0,   0,  70,   2, 
+     16,   0,   1,   0,   0,   0, 
+     16,   0,   0,   7,  34,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,  18,  16,   0,   3,   0, 
+      0,   0,  70,  18,  16,   0, 
+      3,   0,   0,   0,  68,   0, 
+      0,   5,  34,   0,  16,   0, 
+      0,   0,   0,   0,  26,   0, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,   7,  98,   0, 
+     16,   0,   0,   0,   0,   0, 
+     86,   5,  16,   0,   0,   0, 
+      0,   0,  86,  22,  16,   0, 
+      3,   0,   0,   0,  15,  32, 
+      0,  10,  34,   0,  16,   0, 
+      0,   0,   0,   0,   2,  64, 
+      0,   0, 243,   4,  53,  63, 
+    243,   4,  53, 191,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+    150,   5,  16,   0,   0,   0, 
+      0,   0,  56,   0,   0,  10, 
+    226,   0,  16,   0,   0,   0, 
+      0,   0,  86,   5,  16,   0, 
+      0,   0,   0,   0,   2,  64, 
+      0,   0,   0,   0,   0,   0, 
+    154, 153,  25,  63, 154, 153, 
+     25,  63, 205, 204, 204,  62, 
+     50,   0,   0,  12, 114,  32, 
+     16,   0,   0,   0,   0,   0, 
+      6,   0,  16,   0,   0,   0, 
+      0,   0,   2,  64,   0,   0, 
+    205, 204, 204,  62, 205, 204, 
+    204,  62, 154, 153,  25,  63, 
+      0,   0,   0,   0, 150,   7, 
+     16,   0,   0,   0,   0,   0, 
+     54,   0,   0,   5, 130,  32, 
+     16,   0,   0,   0,   0,   0, 
+      1,  64,   0,   0,   0,   0, 
+    128,  63,  62,   0,   0,   1, 
+     83,  84,  65,  84, 116,   0, 
+      0,   0,  15,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   4,   0,   0,   0, 
+     12,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0
+};
index 15a4663..c71b0c3 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d11spikysphere.hlsl.vs.h /Evs /Tvs_4_0 d3d11spikysphere.hlsl\r
-//\r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// POSITION                 0   xyz         0     NONE  float   xyz \r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// POSITION                 0   xyz         0     NONE  float   xyz \r
-//\r
-vs_4_0\r
-dcl_input v0.xyz\r
-dcl_output o0.xyz\r
-mov o0.xyz, v0.xyzx\r
-ret \r
-// Approximately 2 instruction slots used\r
-#endif\r
-\r
-const BYTE g_vs[] =\r
-{\r
-     68,  88,  66,  67,  71, 140, \r
-    219, 201, 207,  71, 236,   3, \r
-    158, 208, 157, 229,  54, 227, \r
-    221, 132,   1,   0,   0,   0, \r
-    176,   1,   0,   0,   5,   0, \r
-      0,   0,  52,   0,   0,   0, \r
-    140,   0,   0,   0, 192,   0, \r
-      0,   0, 244,   0,   0,   0, \r
-     52,   1,   0,   0,  82,  68, \r
-     69,  70,  80,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     28,   0,   0,   0,   0,   4, \r
-    254, 255,   0,   1,   0,   0, \r
-     28,   0,   0,   0,  77, 105, \r
-     99, 114, 111, 115, 111, 102, \r
-    116,  32,  40,  82,  41,  32, \r
-     72,  76,  83,  76,  32,  83, \r
-    104,  97, 100, 101, 114,  32, \r
-     67, 111, 109, 112, 105, 108, \r
-    101, 114,  32,  57,  46,  50, \r
-     57,  46,  57,  53,  50,  46, \r
-     51,  49,  49,  49,   0, 171, \r
-    171, 171,  73,  83,  71,  78, \r
-     44,   0,   0,   0,   1,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     32,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,   7,   7,   0,   0, \r
-     80,  79,  83,  73,  84,  73, \r
-     79,  78,   0, 171, 171, 171, \r
-     79,  83,  71,  78,  44,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      8,   0,   0,   0,  32,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      7,   8,   0,   0,  80,  79, \r
-     83,  73,  84,  73,  79,  78, \r
-      0, 171, 171, 171,  83,  72, \r
-     68,  82,  56,   0,   0,   0, \r
-     64,   0,   1,   0,  14,   0, \r
-      0,   0,  95,   0,   0,   3, \r
-    114,  16,  16,   0,   0,   0, \r
-      0,   0, 101,   0,   0,   3, \r
-    114,  32,  16,   0,   0,   0, \r
-      0,   0,  54,   0,   0,   5, \r
-    114,  32,  16,   0,   0,   0, \r
-      0,   0,  70,  18,  16,   0, \r
-      0,   0,   0,   0,  62,   0, \r
-      0,   1,  83,  84,  65,  84, \r
-    116,   0,   0,   0,   2,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   2,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d11spikysphere.hlsl.vs.h /Evs /Tvs_4_0 d3d11spikysphere.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION                 0   xyz         0     NONE  float   xyz 
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION                 0   xyz         0     NONE  float   xyz 
+//
+vs_4_0
+dcl_input v0.xyz
+dcl_output o0.xyz
+mov o0.xyz, v0.xyzx
+ret 
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_vs[] =
+{
+     68,  88,  66,  67,  71, 140, 
+    219, 201, 207,  71, 236,   3, 
+    158, 208, 157, 229,  54, 227, 
+    221, 132,   1,   0,   0,   0, 
+    176,   1,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 192,   0, 
+      0,   0, 244,   0,   0,   0, 
+     52,   1,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    254, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  57,  46,  50, 
+     57,  46,  57,  53,  50,  46, 
+     51,  49,  49,  49,   0, 171, 
+    171, 171,  73,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,   7,   7,   0,   0, 
+     80,  79,  83,  73,  84,  73, 
+     79,  78,   0, 171, 171, 171, 
+     79,  83,  71,  78,  44,   0, 
+      0,   0,   1,   0,   0,   0, 
+      8,   0,   0,   0,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      7,   8,   0,   0,  80,  79, 
+     83,  73,  84,  73,  79,  78, 
+      0, 171, 171, 171,  83,  72, 
+     68,  82,  56,   0,   0,   0, 
+     64,   0,   1,   0,  14,   0, 
+      0,   0,  95,   0,   0,   3, 
+    114,  16,  16,   0,   0,   0, 
+      0,   0, 101,   0,   0,   3, 
+    114,  32,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    114,  32,  16,   0,   0,   0, 
+      0,   0,  70,  18,  16,   0, 
+      0,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   2,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
index db3742e..19c669b 100755 (executable)
-/**************************************************************************\r
- *\r
- * Copyright 2010 Luca Barbieri\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining\r
- * a copy of this software and associated documentation files (the\r
- * "Software"), to deal in the Software without restriction, including\r
- * without limitation the rights to use, copy, modify, merge, publish,\r
- * distribute, sublicense, and/or sell copies of the Software, and to\r
- * permit persons to whom the Software is furnished to do so, subject to\r
- * the following conditions:\r
- *\r
- * The above copyright notice and this permission notice (including the\r
- * next paragraph) shall be included in all copies or substantial\r
- * portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE\r
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- **************************************************************************/\r
-\r
-#include "d3d11app.h"\r
-#include "d3d11u.h"\r
-#include "d3d11tex.hlsl.ps.h"\r
-#include "d3d11tex.hlsl.vs.h"\r
-#include "../data/cornell_box_image.h"\r
-#include "../data/tux_image.h"\r
-\r
-struct d3d11tex : public d3d11_application\r
-{\r
-       ID3D11PixelShader* ps;\r
-       ID3D11VertexShader* vs;\r
-       mesh* quad;\r
-       ID3D11ShaderResourceView* srv[2];\r
-       ID3D11SamplerState* samp[2];\r
-\r
-       virtual bool init(ID3D11Device* dev, int argc, char** argv)\r
-       {\r
-               ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps));\r
-               ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs));\r
-\r
-               quad = create_tex_quad(dev, g_vs, sizeof(g_vs));\r
-\r
-               D3D11_TEXTURE2D_DESC texd;\r
-               memset(&texd, 0, sizeof(texd));\r
-               texd.BindFlags = D3D11_BIND_SHADER_RESOURCE;\r
-               texd.Usage = D3D11_USAGE_IMMUTABLE;\r
-               texd.SampleDesc.Count = 1;\r
-               texd.Format = DXGI_FORMAT_R8G8B8A8_UNORM;\r
-               texd.Width = 32;\r
-               texd.Height = 32;\r
-               texd.ArraySize = 1;\r
-               texd.MipLevels = 1;\r
-\r
-               D3D11_SUBRESOURCE_DATA texsd;\r
-               texsd.SysMemPitch = 32 * 4;\r
-               texsd.SysMemSlicePitch = 32 * 32 * 4;\r
-\r
-               ID3D11Texture2D* tex;\r
-\r
-               texsd.pSysMem = g_cornell_box_image;\r
-               ensure(dev->CreateTexture2D(&texd, &texsd, &tex));\r
-               ensure(dev->CreateShaderResourceView(tex, 0, &srv[0]));\r
-               tex->Release();\r
-\r
-               texsd.pSysMem = g_tux_image;\r
-               ensure(dev->CreateTexture2D(&texd, &texsd, &tex));\r
-               ensure(dev->CreateShaderResourceView(tex, 0, &srv[1]));\r
-               tex->Release();\r
-\r
-               D3D11_SAMPLER_DESC sampd;\r
-               memset(&sampd, 0, sizeof(sampd));\r
-               sampd.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;\r
-               sampd.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;\r
-               sampd.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;\r
-               sampd.MinLOD = -FLT_MAX;\r
-               sampd.MaxLOD = FLT_MAX;\r
-\r
-               sampd.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;\r
-               dev->CreateSamplerState(&sampd, &samp[0]);\r
-\r
-               sampd.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;\r
-               dev->CreateSamplerState(&sampd, &samp[1]);\r
-               return true;\r
-       }\r
-\r
-       virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time)\r
-       {\r
-               D3D11_VIEWPORT vp;\r
-               memset(&vp, 0, sizeof(vp));\r
-               vp.Width = (float)width;\r
-               vp.Height = (float)height;\r
-               vp.MaxDepth = 1.0f;\r
-\r
-               ctx->OMSetRenderTargets(1, &rtv, 0);\r
-               ctx->RSSetViewports(1, &vp);\r
-\r
-               ctx->VSSetShader(vs, NULL, 0);\r
-               ctx->PSSetShader(ps, NULL, 0);  \r
-\r
-               ctx->PSSetShaderResources(0, 2, srv);\r
-               ctx->PSSetSamplers(0, 2, samp);\r
-\r
-               quad->bind_and_draw(ctx);\r
-       }\r
-};\r
-\r
-d3d11_application* d3d11_application_create()\r
-{\r
-       return new d3d11tex();\r
-}\r
+/**************************************************************************
+ *
+ * Copyright 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "d3d11app.h"
+#include "d3d11u.h"
+#include "d3d11tex.hlsl.ps.h"
+#include "d3d11tex.hlsl.vs.h"
+#include "../data/cornell_box_image.h"
+#include "../data/tux_image.h"
+
+struct d3d11tex : public d3d11_application
+{
+       ID3D11PixelShader* ps;
+       ID3D11VertexShader* vs;
+       mesh* quad;
+       ID3D11ShaderResourceView* srv[2];
+       ID3D11SamplerState* samp[2];
+
+       virtual bool init(ID3D11Device* dev, int argc, char** argv)
+       {
+               ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps));
+               ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs));
+
+               quad = create_tex_quad(dev, g_vs, sizeof(g_vs));
+
+               D3D11_TEXTURE2D_DESC texd;
+               memset(&texd, 0, sizeof(texd));
+               texd.BindFlags = D3D11_BIND_SHADER_RESOURCE;
+               texd.Usage = D3D11_USAGE_IMMUTABLE;
+               texd.SampleDesc.Count = 1;
+               texd.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+               texd.Width = 32;
+               texd.Height = 32;
+               texd.ArraySize = 1;
+               texd.MipLevels = 1;
+
+               D3D11_SUBRESOURCE_DATA texsd;
+               texsd.SysMemPitch = 32 * 4;
+               texsd.SysMemSlicePitch = 32 * 32 * 4;
+
+               ID3D11Texture2D* tex;
+
+               texsd.pSysMem = g_cornell_box_image;
+               ensure(dev->CreateTexture2D(&texd, &texsd, &tex));
+               ensure(dev->CreateShaderResourceView(tex, 0, &srv[0]));
+               tex->Release();
+
+               texsd.pSysMem = g_tux_image;
+               ensure(dev->CreateTexture2D(&texd, &texsd, &tex));
+               ensure(dev->CreateShaderResourceView(tex, 0, &srv[1]));
+               tex->Release();
+
+               D3D11_SAMPLER_DESC sampd;
+               memset(&sampd, 0, sizeof(sampd));
+               sampd.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
+               sampd.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
+               sampd.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
+               sampd.MinLOD = -FLT_MAX;
+               sampd.MaxLOD = FLT_MAX;
+
+               sampd.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
+               dev->CreateSamplerState(&sampd, &samp[0]);
+
+               sampd.Filter = D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
+               dev->CreateSamplerState(&sampd, &samp[1]);
+               return true;
+       }
+
+       virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time)
+       {
+               D3D11_VIEWPORT vp;
+               memset(&vp, 0, sizeof(vp));
+               vp.Width = (float)width;
+               vp.Height = (float)height;
+               vp.MaxDepth = 1.0f;
+
+               ctx->OMSetRenderTargets(1, &rtv, 0);
+               ctx->RSSetViewports(1, &vp);
+
+               ctx->VSSetShader(vs, NULL, 0);
+               ctx->PSSetShader(ps, NULL, 0);  
+
+               ctx->PSSetShaderResources(0, 2, srv);
+               ctx->PSSetSamplers(0, 2, samp);
+
+               quad->bind_and_draw(ctx);
+       }
+};
+
+d3d11_application* d3d11_application_create()
+{
+       return new d3d11tex();
+}
index 722ed9a..29795a9 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d11tex.hlsl.ps.h /Eps /Tps_4_0 d3d11tex.hlsl\r
-//\r
-//\r
-// Resource Bindings:\r
-//\r
-// Name                                 Type  Format         Dim Slot Elements\r
-// ------------------------------ ---------- ------- ----------- ---- --------\r
-// samp0                             sampler      NA          NA    0        1\r
-// samp1                             sampler      NA          NA    1        1\r
-// tex0                              texture  float4          2d    0        1\r
-// tex1                              texture  float4          2d    1        1\r
-//\r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_POSITION              0   xyzw        0      POS  float       \r
-// TEXCOORD                 0   xy          1     NONE  float   xy  \r
-// FACTORS                  0   xyzw        2     NONE  float   xyzw\r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_TARGET                0   xyzw        0   TARGET  float   xyzw\r
-//\r
-ps_4_0\r
-dcl_sampler s0, mode_default\r
-dcl_sampler s1, mode_default\r
-dcl_resource_texture2d (float,float,float,float) t0\r
-dcl_resource_texture2d (float,float,float,float) t1\r
-dcl_input_ps linear v1.xy\r
-dcl_input_ps linear v2.xyzw\r
-dcl_output o0.xyzw\r
-dcl_temps 3\r
-sample r0.xyzw, v1.xyxx, t1.xyzw, s1\r
-mul r0.xyzw, r0.xyzw, v2.xxxx\r
-sample r1.xyzw, v1.xyxx, t1.xyzw, s0\r
-mad r0.xyzw, r1.xyzw, v2.zzzz, r0.xyzw\r
-mul r0.xyzw, r0.xyzw, v2.yyyy\r
-sample r1.xyzw, v1.xyxx, t0.xyzw, s1\r
-mul r1.xyzw, r1.xyzw, v2.xxxx\r
-sample r2.xyzw, v1.xyxx, t0.xyzw, s0\r
-mad r1.xyzw, r2.xyzw, v2.zzzz, r1.xyzw\r
-mad o0.xyzw, r1.xyzw, v2.wwww, r0.xyzw\r
-ret \r
-// Approximately 11 instruction slots used\r
-#endif\r
-\r
-const BYTE g_ps[] =\r
-{\r
-     68,  88,  66,  67, 139, 203, \r
-    114,  37, 104, 101, 201,  12, \r
-    197, 147, 116,  98,  80, 214, \r
-    173, 207,   1,   0,   0,   0, \r
-     16,   4,   0,   0,   5,   0, \r
-      0,   0,  52,   0,   0,   0, \r
-     32,   1,   0,   0, 152,   1, \r
-      0,   0, 204,   1,   0,   0, \r
-    148,   3,   0,   0,  82,  68, \r
-     69,  70, 228,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-     28,   0,   0,   0,   0,   4, \r
-    255, 255,   0,   1,   0,   0, \r
-    178,   0,   0,   0, 156,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-    162,   0,   0,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      1,   0,   0,   0,   0,   0, \r
-      0,   0, 168,   0,   0,   0, \r
-      2,   0,   0,   0,   5,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-    255, 255, 255, 255,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-     12,   0,   0,   0, 173,   0, \r
-      0,   0,   2,   0,   0,   0, \r
-      5,   0,   0,   0,   4,   0, \r
-      0,   0, 255, 255, 255, 255, \r
-      1,   0,   0,   0,   1,   0, \r
-      0,   0,  12,   0,   0,   0, \r
-    115,  97, 109, 112,  48,   0, \r
-    115,  97, 109, 112,  49,   0, \r
-    116, 101, 120,  48,   0, 116, \r
-    101, 120,  49,   0,  77, 105, \r
-     99, 114, 111, 115, 111, 102, \r
-    116,  32,  40,  82,  41,  32, \r
-     72,  76,  83,  76,  32,  83, \r
-    104,  97, 100, 101, 114,  32, \r
-     67, 111, 109, 112, 105, 108, \r
-    101, 114,  32,  57,  46,  50, \r
-     57,  46,  57,  53,  50,  46, \r
-     51,  49,  49,  49,   0, 171, \r
-     73,  83,  71,  78, 112,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      8,   0,   0,   0,  80,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      1,   0,   0,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     15,   0,   0,   0,  92,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   3,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      3,   3,   0,   0, 101,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   3,   0, \r
-      0,   0,   2,   0,   0,   0, \r
-     15,  15,   0,   0,  83,  86, \r
-     95,  80,  79,  83,  73,  84, \r
-     73,  79,  78,   0,  84,  69, \r
-     88,  67,  79,  79,  82,  68, \r
-      0,  70,  65,  67,  84,  79, \r
-     82,  83,   0, 171, 171, 171, \r
-     79,  83,  71,  78,  44,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      8,   0,   0,   0,  32,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     15,   0,   0,   0,  83,  86, \r
-     95,  84,  65,  82,  71,  69, \r
-     84,   0, 171, 171,  83,  72, \r
-     68,  82, 192,   1,   0,   0, \r
-     64,   0,   0,   0, 112,   0, \r
-      0,   0,  90,   0,   0,   3, \r
-      0,  96,  16,   0,   0,   0, \r
-      0,   0,  90,   0,   0,   3, \r
-      0,  96,  16,   0,   1,   0, \r
-      0,   0,  88,  24,   0,   4, \r
-      0, 112,  16,   0,   0,   0, \r
-      0,   0,  85,  85,   0,   0, \r
-     88,  24,   0,   4,   0, 112, \r
-     16,   0,   1,   0,   0,   0, \r
-     85,  85,   0,   0,  98,  16, \r
-      0,   3,  50,  16,  16,   0, \r
-      1,   0,   0,   0,  98,  16, \r
-      0,   3, 242,  16,  16,   0, \r
-      2,   0,   0,   0, 101,   0, \r
-      0,   3, 242,  32,  16,   0, \r
-      0,   0,   0,   0, 104,   0, \r
-      0,   2,   3,   0,   0,   0, \r
-     69,   0,   0,   9, 242,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  16,  16,   0,   1,   0, \r
-      0,   0,  70, 126,  16,   0, \r
-      1,   0,   0,   0,   0,  96, \r
-     16,   0,   1,   0,   0,   0, \r
-     56,   0,   0,   7, 242,   0, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  14,  16,   0,   0,   0, \r
-      0,   0,   6,  16,  16,   0, \r
-      2,   0,   0,   0,  69,   0, \r
-      0,   9, 242,   0,  16,   0, \r
-      1,   0,   0,   0,  70,  16, \r
-     16,   0,   1,   0,   0,   0, \r
-     70, 126,  16,   0,   1,   0, \r
-      0,   0,   0,  96,  16,   0, \r
-      0,   0,   0,   0,  50,   0, \r
-      0,   9, 242,   0,  16,   0, \r
-      0,   0,   0,   0,  70,  14, \r
-     16,   0,   1,   0,   0,   0, \r
-    166,  26,  16,   0,   2,   0, \r
-      0,   0,  70,  14,  16,   0, \r
-      0,   0,   0,   0,  56,   0, \r
-      0,   7, 242,   0,  16,   0, \r
-      0,   0,   0,   0,  70,  14, \r
-     16,   0,   0,   0,   0,   0, \r
-     86,  21,  16,   0,   2,   0, \r
-      0,   0,  69,   0,   0,   9, \r
-    242,   0,  16,   0,   1,   0, \r
-      0,   0,  70,  16,  16,   0, \r
-      1,   0,   0,   0,  70, 126, \r
-     16,   0,   0,   0,   0,   0, \r
-      0,  96,  16,   0,   1,   0, \r
-      0,   0,  56,   0,   0,   7, \r
-    242,   0,  16,   0,   1,   0, \r
-      0,   0,  70,  14,  16,   0, \r
-      1,   0,   0,   0,   6,  16, \r
-     16,   0,   2,   0,   0,   0, \r
-     69,   0,   0,   9, 242,   0, \r
-     16,   0,   2,   0,   0,   0, \r
-     70,  16,  16,   0,   1,   0, \r
-      0,   0,  70, 126,  16,   0, \r
-      0,   0,   0,   0,   0,  96, \r
-     16,   0,   0,   0,   0,   0, \r
-     50,   0,   0,   9, 242,   0, \r
-     16,   0,   1,   0,   0,   0, \r
-     70,  14,  16,   0,   2,   0, \r
-      0,   0, 166,  26,  16,   0, \r
-      2,   0,   0,   0,  70,  14, \r
-     16,   0,   1,   0,   0,   0, \r
-     50,   0,   0,   9, 242,  32, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  14,  16,   0,   1,   0, \r
-      0,   0, 246,  31,  16,   0, \r
-      2,   0,   0,   0,  70,  14, \r
-     16,   0,   0,   0,   0,   0, \r
-     62,   0,   0,   1,  83,  84, \r
-     65,  84, 116,   0,   0,   0, \r
-     11,   0,   0,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   4,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d11tex.hlsl.ps.h /Eps /Tps_4_0 d3d11tex.hlsl
+//
+//
+// Resource Bindings:
+//
+// Name                                 Type  Format         Dim Slot Elements
+// ------------------------------ ---------- ------- ----------- ---- --------
+// samp0                             sampler      NA          NA    0        1
+// samp1                             sampler      NA          NA    1        1
+// tex0                              texture  float4          2d    0        1
+// tex1                              texture  float4          2d    1        1
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION              0   xyzw        0      POS  float       
+// TEXCOORD                 0   xy          1     NONE  float   xy  
+// FACTORS                  0   xyzw        2     NONE  float   xyzw
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET                0   xyzw        0   TARGET  float   xyzw
+//
+ps_4_0
+dcl_sampler s0, mode_default
+dcl_sampler s1, mode_default
+dcl_resource_texture2d (float,float,float,float) t0
+dcl_resource_texture2d (float,float,float,float) t1
+dcl_input_ps linear v1.xy
+dcl_input_ps linear v2.xyzw
+dcl_output o0.xyzw
+dcl_temps 3
+sample r0.xyzw, v1.xyxx, t1.xyzw, s1
+mul r0.xyzw, r0.xyzw, v2.xxxx
+sample r1.xyzw, v1.xyxx, t1.xyzw, s0
+mad r0.xyzw, r1.xyzw, v2.zzzz, r0.xyzw
+mul r0.xyzw, r0.xyzw, v2.yyyy
+sample r1.xyzw, v1.xyxx, t0.xyzw, s1
+mul r1.xyzw, r1.xyzw, v2.xxxx
+sample r2.xyzw, v1.xyxx, t0.xyzw, s0
+mad r1.xyzw, r2.xyzw, v2.zzzz, r1.xyzw
+mad o0.xyzw, r1.xyzw, v2.wwww, r0.xyzw
+ret 
+// Approximately 11 instruction slots used
+#endif
+
+const BYTE g_ps[] =
+{
+     68,  88,  66,  67, 139, 203, 
+    114,  37, 104, 101, 201,  12, 
+    197, 147, 116,  98,  80, 214, 
+    173, 207,   1,   0,   0,   0, 
+     16,   4,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+     32,   1,   0,   0, 152,   1, 
+      0,   0, 204,   1,   0,   0, 
+    148,   3,   0,   0,  82,  68, 
+     69,  70, 228,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   4,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+    178,   0,   0,   0, 156,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+    162,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      1,   0,   0,   0,   0,   0, 
+      0,   0, 168,   0,   0,   0, 
+      2,   0,   0,   0,   5,   0, 
+      0,   0,   4,   0,   0,   0, 
+    255, 255, 255, 255,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+     12,   0,   0,   0, 173,   0, 
+      0,   0,   2,   0,   0,   0, 
+      5,   0,   0,   0,   4,   0, 
+      0,   0, 255, 255, 255, 255, 
+      1,   0,   0,   0,   1,   0, 
+      0,   0,  12,   0,   0,   0, 
+    115,  97, 109, 112,  48,   0, 
+    115,  97, 109, 112,  49,   0, 
+    116, 101, 120,  48,   0, 116, 
+    101, 120,  49,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  57,  46,  50, 
+     57,  46,  57,  53,  50,  46, 
+     51,  49,  49,  49,   0, 171, 
+     73,  83,  71,  78, 112,   0, 
+      0,   0,   3,   0,   0,   0, 
+      8,   0,   0,   0,  80,   0, 
+      0,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  92,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   3,   0,   0, 101,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   2,   0,   0,   0, 
+     15,  15,   0,   0,  83,  86, 
+     95,  80,  79,  83,  73,  84, 
+     73,  79,  78,   0,  84,  69, 
+     88,  67,  79,  79,  82,  68, 
+      0,  70,  65,  67,  84,  79, 
+     82,  83,   0, 171, 171, 171, 
+     79,  83,  71,  78,  44,   0, 
+      0,   0,   1,   0,   0,   0, 
+      8,   0,   0,   0,  32,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+     15,   0,   0,   0,  83,  86, 
+     95,  84,  65,  82,  71,  69, 
+     84,   0, 171, 171,  83,  72, 
+     68,  82, 192,   1,   0,   0, 
+     64,   0,   0,   0, 112,   0, 
+      0,   0,  90,   0,   0,   3, 
+      0,  96,  16,   0,   0,   0, 
+      0,   0,  90,   0,   0,   3, 
+      0,  96,  16,   0,   1,   0, 
+      0,   0,  88,  24,   0,   4, 
+      0, 112,  16,   0,   0,   0, 
+      0,   0,  85,  85,   0,   0, 
+     88,  24,   0,   4,   0, 112, 
+     16,   0,   1,   0,   0,   0, 
+     85,  85,   0,   0,  98,  16, 
+      0,   3,  50,  16,  16,   0, 
+      1,   0,   0,   0,  98,  16, 
+      0,   3, 242,  16,  16,   0, 
+      2,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0, 104,   0, 
+      0,   2,   3,   0,   0,   0, 
+     69,   0,   0,   9, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,  16,  16,   0,   1,   0, 
+      0,   0,  70, 126,  16,   0, 
+      1,   0,   0,   0,   0,  96, 
+     16,   0,   1,   0,   0,   0, 
+     56,   0,   0,   7, 242,   0, 
+     16,   0,   0,   0,   0,   0, 
+     70,  14,  16,   0,   0,   0, 
+      0,   0,   6,  16,  16,   0, 
+      2,   0,   0,   0,  69,   0, 
+      0,   9, 242,   0,  16,   0, 
+      1,   0,   0,   0,  70,  16, 
+     16,   0,   1,   0,   0,   0, 
+     70, 126,  16,   0,   1,   0, 
+      0,   0,   0,  96,  16,   0, 
+      0,   0,   0,   0,  50,   0, 
+      0,   9, 242,   0,  16,   0, 
+      0,   0,   0,   0,  70,  14, 
+     16,   0,   1,   0,   0,   0, 
+    166,  26,  16,   0,   2,   0, 
+      0,   0,  70,  14,  16,   0, 
+      0,   0,   0,   0,  56,   0, 
+      0,   7, 242,   0,  16,   0, 
+      0,   0,   0,   0,  70,  14, 
+     16,   0,   0,   0,   0,   0, 
+     86,  21,  16,   0,   2,   0, 
+      0,   0,  69,   0,   0,   9, 
+    242,   0,  16,   0,   1,   0, 
+      0,   0,  70,  16,  16,   0, 
+      1,   0,   0,   0,  70, 126, 
+     16,   0,   0,   0,   0,   0, 
+      0,  96,  16,   0,   1,   0, 
+      0,   0,  56,   0,   0,   7, 
+    242,   0,  16,   0,   1,   0, 
+      0,   0,  70,  14,  16,   0, 
+      1,   0,   0,   0,   6,  16, 
+     16,   0,   2,   0,   0,   0, 
+     69,   0,   0,   9, 242,   0, 
+     16,   0,   2,   0,   0,   0, 
+     70,  16,  16,   0,   1,   0, 
+      0,   0,  70, 126,  16,   0, 
+      0,   0,   0,   0,   0,  96, 
+     16,   0,   0,   0,   0,   0, 
+     50,   0,   0,   9, 242,   0, 
+     16,   0,   1,   0,   0,   0, 
+     70,  14,  16,   0,   2,   0, 
+      0,   0, 166,  26,  16,   0, 
+      2,   0,   0,   0,  70,  14, 
+     16,   0,   1,   0,   0,   0, 
+     50,   0,   0,   9, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,  14,  16,   0,   1,   0, 
+      0,   0, 246,  31,  16,   0, 
+      2,   0,   0,   0,  70,  14, 
+     16,   0,   0,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+     11,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   4,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
index 0e3ebcd..3aae794 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d11tex.hlsl.vs.h /Evs /Tvs_4_0 d3d11tex.hlsl\r
-//\r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// POSITION                 0   xyzw        0     NONE  float   xyzw\r
-// TEXCOORD                 0   xy          1     NONE  float   xy  \r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_POSITION              0   xyzw        0      POS  float   xyzw\r
-// TEXCOORD                 0   xy          1     NONE  float   xy  \r
-// FACTORS                  0   xyzw        2     NONE  float   xyzw\r
-//\r
-vs_4_0\r
-dcl_input v0.xyzw\r
-dcl_input v1.xy\r
-dcl_output_siv o0.xyzw, position\r
-dcl_output o1.xy\r
-dcl_output o2.xyzw\r
-mov o0.xyzw, v0.xyzw\r
-mul o1.xy, v1.xyxx, l(8.000000, 8.000000, 0.000000, 0.000000)\r
-mad o2.xyzw, v1.xyxy, l(1.000000, 1.000000, -1.000000, -1.000000), l(0.000000, 0.000000, 1.000000, 1.000000)\r
-ret \r
-// Approximately 4 instruction slots used\r
-#endif\r
-\r
-const BYTE g_vs[] =\r
-{\r
-     68,  88,  66,  67, 129, 141, \r
-     49,   0,  46, 132,  26,  20, \r
-     64,  38, 200,  86, 119, 202, \r
-    172, 121,   1,   0,   0,   0, \r
-    160,   2,   0,   0,   5,   0, \r
-      0,   0,  52,   0,   0,   0, \r
-    140,   0,   0,   0, 224,   0, \r
-      0,   0,  88,   1,   0,   0, \r
-     36,   2,   0,   0,  82,  68, \r
-     69,  70,  80,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     28,   0,   0,   0,   0,   4, \r
-    254, 255,   0,   1,   0,   0, \r
-     28,   0,   0,   0,  77, 105, \r
-     99, 114, 111, 115, 111, 102, \r
-    116,  32,  40,  82,  41,  32, \r
-     72,  76,  83,  76,  32,  83, \r
-    104,  97, 100, 101, 114,  32, \r
-     67, 111, 109, 112, 105, 108, \r
-    101, 114,  32,  57,  46,  50, \r
-     57,  46,  57,  53,  50,  46, \r
-     51,  49,  49,  49,   0, 171, \r
-    171, 171,  73,  83,  71,  78, \r
-     76,   0,   0,   0,   2,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     56,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,  15,   0,   0, \r
-     65,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   1,   0, \r
-      0,   0,   3,   3,   0,   0, \r
-     80,  79,  83,  73,  84,  73, \r
-     79,  78,   0,  84,  69,  88, \r
-     67,  79,  79,  82,  68,   0, \r
-    171, 171,  79,  83,  71,  78, \r
-    112,   0,   0,   0,   3,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     80,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,   0,   0,   0, \r
-     92,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   1,   0, \r
-      0,   0,   3,  12,   0,   0, \r
-    101,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   2,   0, \r
-      0,   0,  15,   0,   0,   0, \r
-     83,  86,  95,  80,  79,  83, \r
-     73,  84,  73,  79,  78,   0, \r
-     84,  69,  88,  67,  79,  79, \r
-     82,  68,   0,  70,  65,  67, \r
-     84,  79,  82,  83,   0, 171, \r
-    171, 171,  83,  72,  68,  82, \r
-    196,   0,   0,   0,  64,   0, \r
-      1,   0,  49,   0,   0,   0, \r
-     95,   0,   0,   3, 242,  16, \r
-     16,   0,   0,   0,   0,   0, \r
-     95,   0,   0,   3,  50,  16, \r
-     16,   0,   1,   0,   0,   0, \r
-    103,   0,   0,   4, 242,  32, \r
-     16,   0,   0,   0,   0,   0, \r
-      1,   0,   0,   0, 101,   0, \r
-      0,   3,  50,  32,  16,   0, \r
-      1,   0,   0,   0, 101,   0, \r
-      0,   3, 242,  32,  16,   0, \r
-      2,   0,   0,   0,  54,   0, \r
-      0,   5, 242,  32,  16,   0, \r
-      0,   0,   0,   0,  70,  30, \r
-     16,   0,   0,   0,   0,   0, \r
-     56,   0,   0,  10,  50,  32, \r
-     16,   0,   1,   0,   0,   0, \r
-     70,  16,  16,   0,   1,   0, \r
-      0,   0,   2,  64,   0,   0, \r
-      0,   0,   0,  65,   0,   0, \r
-      0,  65,   0,   0,   0,   0, \r
-      0,   0,   0,   0,  50,   0, \r
-      0,  15, 242,  32,  16,   0, \r
-      2,   0,   0,   0,  70,  20, \r
-     16,   0,   1,   0,   0,   0, \r
-      2,  64,   0,   0,   0,   0, \r
-    128,  63,   0,   0, 128,  63, \r
-      0,   0, 128, 191,   0,   0, \r
-    128, 191,   2,  64,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0, 128,  63, \r
-      0,   0, 128,  63,  62,   0, \r
-      0,   1,  83,  84,  65,  84, \r
-    116,   0,   0,   0,   4,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   5,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d11tex.hlsl.vs.h /Evs /Tvs_4_0 d3d11tex.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION                 0   xyzw        0     NONE  float   xyzw
+// TEXCOORD                 0   xy          1     NONE  float   xy  
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION              0   xyzw        0      POS  float   xyzw
+// TEXCOORD                 0   xy          1     NONE  float   xy  
+// FACTORS                  0   xyzw        2     NONE  float   xyzw
+//
+vs_4_0
+dcl_input v0.xyzw
+dcl_input v1.xy
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xy
+dcl_output o2.xyzw
+mov o0.xyzw, v0.xyzw
+mul o1.xy, v1.xyxx, l(8.000000, 8.000000, 0.000000, 0.000000)
+mad o2.xyzw, v1.xyxy, l(1.000000, 1.000000, -1.000000, -1.000000), l(0.000000, 0.000000, 1.000000, 1.000000)
+ret 
+// Approximately 4 instruction slots used
+#endif
+
+const BYTE g_vs[] =
+{
+     68,  88,  66,  67, 129, 141, 
+     49,   0,  46, 132,  26,  20, 
+     64,  38, 200,  86, 119, 202, 
+    172, 121,   1,   0,   0,   0, 
+    160,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 224,   0, 
+      0,   0,  88,   1,   0,   0, 
+     36,   2,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    254, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  57,  46,  50, 
+     57,  46,  57,  53,  50,  46, 
+     51,  49,  49,  49,   0, 171, 
+    171, 171,  73,  83,  71,  78, 
+     76,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,  15,   0,   0, 
+     65,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   3,   3,   0,   0, 
+     80,  79,  83,  73,  84,  73, 
+     79,  78,   0,  84,  69,  88, 
+     67,  79,  79,  82,  68,   0, 
+    171, 171,  79,  83,  71,  78, 
+    112,   0,   0,   0,   3,   0, 
+      0,   0,   8,   0,   0,   0, 
+     80,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     92,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,   3,  12,   0,   0, 
+    101,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   2,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     84,  69,  88,  67,  79,  79, 
+     82,  68,   0,  70,  65,  67, 
+     84,  79,  82,  83,   0, 171, 
+    171, 171,  83,  72,  68,  82, 
+    196,   0,   0,   0,  64,   0, 
+      1,   0,  49,   0,   0,   0, 
+     95,   0,   0,   3, 242,  16, 
+     16,   0,   0,   0,   0,   0, 
+     95,   0,   0,   3,  50,  16, 
+     16,   0,   1,   0,   0,   0, 
+    103,   0,   0,   4, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3,  50,  32,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      2,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      0,   0,   0,   0,  70,  30, 
+     16,   0,   0,   0,   0,   0, 
+     56,   0,   0,  10,  50,  32, 
+     16,   0,   1,   0,   0,   0, 
+     70,  16,  16,   0,   1,   0, 
+      0,   0,   2,  64,   0,   0, 
+      0,   0,   0,  65,   0,   0, 
+      0,  65,   0,   0,   0,   0, 
+      0,   0,   0,   0,  50,   0, 
+      0,  15, 242,  32,  16,   0, 
+      2,   0,   0,   0,  70,  20, 
+     16,   0,   1,   0,   0,   0, 
+      2,  64,   0,   0,   0,   0, 
+    128,  63,   0,   0, 128,  63, 
+      0,   0, 128, 191,   0,   0, 
+    128, 191,   2,  64,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0, 128,  63, 
+      0,   0, 128,  63,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   4,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   5,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};
index 30c2ffa..524b7d1 100755 (executable)
-/**************************************************************************\r
- *\r
- * Copyright 2010 Luca Barbieri\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining\r
- * a copy of this software and associated documentation files (the\r
- * "Software"), to deal in the Software without restriction, including\r
- * without limitation the rights to use, copy, modify, merge, publish,\r
- * distribute, sublicense, and/or sell copies of the Software, and to\r
- * permit persons to whom the Software is furnished to do so, subject to\r
- * the following conditions:\r
- *\r
- * The above copyright notice and this permission notice (including the\r
- * next paragraph) shall be included in all copies or substantial\r
- * portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE\r
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- *\r
- **************************************************************************/\r
-\r
-#include "d3d11app.h"\r
-#include "d3d11tri.hlsl.ps.h"\r
-#include "d3d11tri.hlsl.vs.h"\r
-\r
-struct vertex {\r
- float position[4];\r
- float color[4];\r
-};\r
-\r
-static struct vertex vertices[3] =\r
-{\r
- {\r
-        { 0.0f, 0.9f, 0.5f, 1.0f },\r
-        { 1.0f, 0.0f, 0.0f, 1.0f }\r
- },\r
- {\r
-        { 0.9f, -0.9f, 0.5f, 1.0f },\r
-        { 0.0f, 0.0f, 1.0f, 1.0f }\r
- },\r
- {\r
-        { -0.9f, -0.9f, 0.5f, 1.0f },\r
-        { 0.0f, 1.0f, 0.0f, 1.0f }\r
- },\r
-};\r
-\r
-struct d3d11tri : public d3d11_application\r
-{\r
-       ID3D11PixelShader* ps;\r
-       ID3D11VertexShader* vs;\r
-       ID3D11InputLayout* layout;\r
-       ID3D11Buffer* vb;\r
-\r
-       virtual bool init(ID3D11Device* dev, int argc, char** argv)\r
-       {\r
-               ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps));\r
-               ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs));\r
-\r
-               D3D11_INPUT_ELEMENT_DESC elements[] =\r
-               {\r
-                       // inverse order to make sure the implementation can properly parse the vertex shader signature\r
-                       {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D11_INPUT_PER_VERTEX_DATA, 0},\r
-                       {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},\r
-               };\r
-\r
-               ensure(dev->CreateInputLayout(elements, sizeof(elements) / sizeof(elements[0]), g_vs, sizeof(g_vs), &layout));\r
-               D3D11_BUFFER_DESC bufferd;\r
-               bufferd.ByteWidth = sizeof(vertices);\r
-               bufferd.Usage = D3D11_USAGE_IMMUTABLE;\r
-               bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER;\r
-               bufferd.CPUAccessFlags = 0;\r
-               bufferd.MiscFlags = 0;\r
-               bufferd.StructureByteStride = 0;\r
-\r
-               D3D11_SUBRESOURCE_DATA buffersd;\r
-               buffersd.pSysMem = vertices;\r
-               buffersd.SysMemPitch = sizeof(vertices);\r
-               buffersd.SysMemSlicePitch = sizeof(vertices);\r
-\r
-               ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb));\r
-\r
-               return true;\r
-       }\r
-\r
-       virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time)\r
-       {\r
-               float clear_color[4] = {1, 0, 1, 1};\r
-               D3D11_VIEWPORT vp;\r
-               memset(&vp, 0, sizeof(vp));\r
-               vp.Width = (float)width;\r
-               vp.Height = (float)height;\r
-               vp.MaxDepth = 1.0f;\r
-\r
-               ctx->OMSetRenderTargets(1, &rtv, 0);\r
-               ctx->RSSetViewports(1, &vp);\r
-\r
-               ctx->ClearRenderTargetView(rtv, clear_color);\r
-\r
-               ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);\r
-               ctx->IASetInputLayout(layout);\r
-               unsigned stride = 2 * 4 * 4;\r
-               unsigned offset = 0;\r
-               ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset);\r
-\r
-               ctx->VSSetShader(vs, NULL, 0);\r
-               ctx->PSSetShader(ps, NULL, 0);  \r
-\r
-               ctx->Draw(3, 0);\r
-       }\r
-};\r
-\r
-d3d11_application* d3d11_application_create()\r
-{\r
-       return new d3d11tri();\r
-}\r
+/**************************************************************************
+ *
+ * Copyright 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#include "d3d11app.h"
+#include "d3d11tri.hlsl.ps.h"
+#include "d3d11tri.hlsl.vs.h"
+
+struct vertex {
+ float position[4];
+ float color[4];
+};
+
+static struct vertex vertices[3] =
+{
+ {
+        { 0.0f, 0.9f, 0.5f, 1.0f },
+        { 1.0f, 0.0f, 0.0f, 1.0f }
+ },
+ {
+        { 0.9f, -0.9f, 0.5f, 1.0f },
+        { 0.0f, 0.0f, 1.0f, 1.0f }
+ },
+ {
+        { -0.9f, -0.9f, 0.5f, 1.0f },
+        { 0.0f, 1.0f, 0.0f, 1.0f }
+ },
+};
+
+struct d3d11tri : public d3d11_application
+{
+       ID3D11PixelShader* ps;
+       ID3D11VertexShader* vs;
+       ID3D11InputLayout* layout;
+       ID3D11Buffer* vb;
+
+       virtual bool init(ID3D11Device* dev, int argc, char** argv)
+       {
+               ensure(dev->CreatePixelShader(g_ps, sizeof(g_ps), NULL, &ps));
+               ensure(dev->CreateVertexShader(g_vs, sizeof(g_vs), NULL, &vs));
+
+               D3D11_INPUT_ELEMENT_DESC elements[] =
+               {
+                       // inverse order to make sure the implementation can properly parse the vertex shader signature
+                       {"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 16, D3D11_INPUT_PER_VERTEX_DATA, 0},
+                       {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
+               };
+
+               ensure(dev->CreateInputLayout(elements, sizeof(elements) / sizeof(elements[0]), g_vs, sizeof(g_vs), &layout));
+               D3D11_BUFFER_DESC bufferd;
+               bufferd.ByteWidth = sizeof(vertices);
+               bufferd.Usage = D3D11_USAGE_IMMUTABLE;
+               bufferd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+               bufferd.CPUAccessFlags = 0;
+               bufferd.MiscFlags = 0;
+               bufferd.StructureByteStride = 0;
+
+               D3D11_SUBRESOURCE_DATA buffersd;
+               buffersd.pSysMem = vertices;
+               buffersd.SysMemPitch = sizeof(vertices);
+               buffersd.SysMemSlicePitch = sizeof(vertices);
+
+               ensure(dev->CreateBuffer(&bufferd, &buffersd, &vb));
+
+               return true;
+       }
+
+       virtual void draw(ID3D11DeviceContext* ctx, ID3D11RenderTargetView* rtv, unsigned width, unsigned height, double time)
+       {
+               float clear_color[4] = {1, 0, 1, 1};
+               D3D11_VIEWPORT vp;
+               memset(&vp, 0, sizeof(vp));
+               vp.Width = (float)width;
+               vp.Height = (float)height;
+               vp.MaxDepth = 1.0f;
+
+               ctx->OMSetRenderTargets(1, &rtv, 0);
+               ctx->RSSetViewports(1, &vp);
+
+               ctx->ClearRenderTargetView(rtv, clear_color);
+
+               ctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
+               ctx->IASetInputLayout(layout);
+               unsigned stride = 2 * 4 * 4;
+               unsigned offset = 0;
+               ctx->IASetVertexBuffers(0, 1, &vb, &stride, &offset);
+
+               ctx->VSSetShader(vs, NULL, 0);
+               ctx->PSSetShader(ps, NULL, 0);  
+
+               ctx->Draw(3, 0);
+       }
+};
+
+d3d11_application* d3d11_application_create()
+{
+       return new d3d11tri();
+}
index 21f6141..68eaee5 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d11tri.hlsl.ps.h /Eps /Tps_4_0 d3d11tri.hlsl\r
-//\r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_POSITION              0   xyzw        0      POS  float       \r
-// COLOR                    0   xyzw        1     NONE  float   xyzw\r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_TARGET                0   xyzw        0   TARGET  float   xyzw\r
-//\r
-ps_4_0\r
-dcl_input_ps linear v1.xyzw\r
-dcl_output o0.xyzw\r
-mov o0.xyzw, v1.xyzw\r
-ret \r
-// Approximately 2 instruction slots used\r
-#endif\r
-\r
-const BYTE g_ps[] =\r
-{\r
-     68,  88,  66,  67, 206, 120, \r
-    117, 238, 118, 127,  10,  87, \r
-     80,  75, 114, 198,  95,   2, \r
-    120, 102,   1,   0,   0,   0, \r
-    208,   1,   0,   0,   5,   0, \r
-      0,   0,  52,   0,   0,   0, \r
-    140,   0,   0,   0, 224,   0, \r
-      0,   0,  20,   1,   0,   0, \r
-     84,   1,   0,   0,  82,  68, \r
-     69,  70,  80,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     28,   0,   0,   0,   0,   4, \r
-    255, 255,   0,   1,   0,   0, \r
-     28,   0,   0,   0,  77, 105, \r
-     99, 114, 111, 115, 111, 102, \r
-    116,  32,  40,  82,  41,  32, \r
-     72,  76,  83,  76,  32,  83, \r
-    104,  97, 100, 101, 114,  32, \r
-     67, 111, 109, 112, 105, 108, \r
-    101, 114,  32,  57,  46,  50, \r
-     57,  46,  57,  53,  50,  46, \r
-     51,  49,  49,  49,   0, 171, \r
-    171, 171,  73,  83,  71,  78, \r
-     76,   0,   0,   0,   2,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     56,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,   0,   0,   0, \r
-     68,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   1,   0, \r
-      0,   0,  15,  15,   0,   0, \r
-     83,  86,  95,  80,  79,  83, \r
-     73,  84,  73,  79,  78,   0, \r
-     67,  79,  76,  79,  82,   0, \r
-    171, 171,  79,  83,  71,  78, \r
-     44,   0,   0,   0,   1,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     32,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,   0,   0,   0, \r
-     83,  86,  95,  84,  65,  82, \r
-     71,  69,  84,   0, 171, 171, \r
-     83,  72,  68,  82,  56,   0, \r
-      0,   0,  64,   0,   0,   0, \r
-     14,   0,   0,   0,  98,  16, \r
-      0,   3, 242,  16,  16,   0, \r
-      1,   0,   0,   0, 101,   0, \r
-      0,   3, 242,  32,  16,   0, \r
-      0,   0,   0,   0,  54,   0, \r
-      0,   5, 242,  32,  16,   0, \r
-      0,   0,   0,   0,  70,  30, \r
-     16,   0,   1,   0,   0,   0, \r
-     62,   0,   0,   1,  83,  84, \r
-     65,  84, 116,   0,   0,   0, \r
-      2,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      2,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d11tri.hlsl.ps.h /Eps /Tps_4_0 d3d11tri.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION              0   xyzw        0      POS  float       
+// COLOR                    0   xyzw        1     NONE  float   xyzw
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_TARGET                0   xyzw        0   TARGET  float   xyzw
+//
+ps_4_0
+dcl_input_ps linear v1.xyzw
+dcl_output o0.xyzw
+mov o0.xyzw, v1.xyzw
+ret 
+// Approximately 2 instruction slots used
+#endif
+
+const BYTE g_ps[] =
+{
+     68,  88,  66,  67, 206, 120, 
+    117, 238, 118, 127,  10,  87, 
+     80,  75, 114, 198,  95,   2, 
+    120, 102,   1,   0,   0,   0, 
+    208,   1,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 224,   0, 
+      0,   0,  20,   1,   0,   0, 
+     84,   1,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    255, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  57,  46,  50, 
+     57,  46,  57,  53,  50,  46, 
+     51,  49,  49,  49,   0, 171, 
+    171, 171,  73,  83,  71,  78, 
+     76,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     68,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,  15,  15,   0,   0, 
+     83,  86,  95,  80,  79,  83, 
+     73,  84,  73,  79,  78,   0, 
+     67,  79,  76,  79,  82,   0, 
+    171, 171,  79,  83,  71,  78, 
+     44,   0,   0,   0,   1,   0, 
+      0,   0,   8,   0,   0,   0, 
+     32,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,   0,   0,   0, 
+     83,  86,  95,  84,  65,  82, 
+     71,  69,  84,   0, 171, 171, 
+     83,  72,  68,  82,  56,   0, 
+      0,   0,  64,   0,   0,   0, 
+     14,   0,   0,   0,  98,  16, 
+      0,   3, 242,  16,  16,   0, 
+      1,   0,   0,   0, 101,   0, 
+      0,   3, 242,  32,  16,   0, 
+      0,   0,   0,   0,  54,   0, 
+      0,   5, 242,  32,  16,   0, 
+      0,   0,   0,   0,  70,  30, 
+     16,   0,   1,   0,   0,   0, 
+     62,   0,   0,   1,  83,  84, 
+     65,  84, 116,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      2,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0
+};
index edf18e0..43e2a18 100755 (executable)
-#if 0\r
-//\r
-// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111\r
-//\r
-//\r
-//   fxc /Fhd3d11tri.hlsl.vs.h /Evs /Tvs_4_0 d3d11tri.hlsl\r
-//\r
-//\r
-//\r
-// Input signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// POSITION                 0   xyzw        0     NONE  float   xyzw\r
-// COLOR                    0   xyzw        1     NONE  float   xyzw\r
-//\r
-//\r
-// Output signature:\r
-//\r
-// Name                 Index   Mask Register SysValue Format   Used\r
-// -------------------- ----- ------ -------- -------- ------ ------\r
-// SV_POSITION              0   xyzw        0      POS  float   xyzw\r
-// COLOR                    0   xyzw        1     NONE  float   xyzw\r
-//\r
-vs_4_0\r
-dcl_input v0.xyzw\r
-dcl_input v1.xyzw\r
-dcl_output_siv o0.xyzw, position\r
-dcl_output o1.xyzw\r
-mov o0.xyzw, v0.xyzw\r
-mov o1.xyzw, v1.xyzw\r
-ret \r
-// Approximately 3 instruction slots used\r
-#endif\r
-\r
-const BYTE g_vs[] =\r
-{\r
-     68,  88,  66,  67, 190, 171, \r
-    186,  20,  44, 105,  95, 129, \r
-    137, 204, 223,  72, 251, 159, \r
-    126, 176,   1,   0,   0,   0, \r
-     28,   2,   0,   0,   5,   0, \r
-      0,   0,  52,   0,   0,   0, \r
-    140,   0,   0,   0, 220,   0, \r
-      0,   0,  48,   1,   0,   0, \r
-    160,   1,   0,   0,  82,  68, \r
-     69,  70,  80,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-     28,   0,   0,   0,   0,   4, \r
-    254, 255,   0,   1,   0,   0, \r
-     28,   0,   0,   0,  77, 105, \r
-     99, 114, 111, 115, 111, 102, \r
-    116,  32,  40,  82,  41,  32, \r
-     72,  76,  83,  76,  32,  83, \r
-    104,  97, 100, 101, 114,  32, \r
-     67, 111, 109, 112, 105, 108, \r
-    101, 114,  32,  57,  46,  50, \r
-     57,  46,  57,  53,  50,  46, \r
-     51,  49,  49,  49,   0, 171, \r
-    171, 171,  73,  83,  71,  78, \r
-     72,   0,   0,   0,   2,   0, \r
-      0,   0,   8,   0,   0,   0, \r
-     56,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   0,   0, \r
-      0,   0,  15,  15,   0,   0, \r
-     65,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      3,   0,   0,   0,   1,   0, \r
-      0,   0,  15,  15,   0,   0, \r
-     80,  79,  83,  73,  84,  73, \r
-     79,  78,   0,  67,  79,  76, \r
-     79,  82,   0, 171,  79,  83, \r
-     71,  78,  76,   0,   0,   0, \r
-      2,   0,   0,   0,   8,   0, \r
-      0,   0,  56,   0,   0,   0, \r
-      0,   0,   0,   0,   1,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      0,   0,   0,   0,  15,   0, \r
-      0,   0,  68,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   3,   0,   0,   0, \r
-      1,   0,   0,   0,  15,   0, \r
-      0,   0,  83,  86,  95,  80, \r
-     79,  83,  73,  84,  73,  79, \r
-     78,   0,  67,  79,  76,  79, \r
-     82,   0, 171, 171,  83,  72, \r
-     68,  82, 104,   0,   0,   0, \r
-     64,   0,   1,   0,  26,   0, \r
-      0,   0,  95,   0,   0,   3, \r
-    242,  16,  16,   0,   0,   0, \r
-      0,   0,  95,   0,   0,   3, \r
-    242,  16,  16,   0,   1,   0, \r
-      0,   0, 103,   0,   0,   4, \r
-    242,  32,  16,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-    101,   0,   0,   3, 242,  32, \r
-     16,   0,   1,   0,   0,   0, \r
-     54,   0,   0,   5, 242,  32, \r
-     16,   0,   0,   0,   0,   0, \r
-     70,  30,  16,   0,   0,   0, \r
-      0,   0,  54,   0,   0,   5, \r
-    242,  32,  16,   0,   1,   0, \r
-      0,   0,  70,  30,  16,   0, \r
-      1,   0,   0,   0,  62,   0, \r
-      0,   1,  83,  84,  65,  84, \r
-    116,   0,   0,   0,   3,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   4,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   1,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   2,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0, \r
-      0,   0,   0,   0,   0,   0\r
-};\r
+#if 0
+//
+// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
+//
+//
+//   fxc /Fhd3d11tri.hlsl.vs.h /Evs /Tvs_4_0 d3d11tri.hlsl
+//
+//
+//
+// Input signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// POSITION                 0   xyzw        0     NONE  float   xyzw
+// COLOR                    0   xyzw        1     NONE  float   xyzw
+//
+//
+// Output signature:
+//
+// Name                 Index   Mask Register SysValue Format   Used
+// -------------------- ----- ------ -------- -------- ------ ------
+// SV_POSITION              0   xyzw        0      POS  float   xyzw
+// COLOR                    0   xyzw        1     NONE  float   xyzw
+//
+vs_4_0
+dcl_input v0.xyzw
+dcl_input v1.xyzw
+dcl_output_siv o0.xyzw, position
+dcl_output o1.xyzw
+mov o0.xyzw, v0.xyzw
+mov o1.xyzw, v1.xyzw
+ret 
+// Approximately 3 instruction slots used
+#endif
+
+const BYTE g_vs[] =
+{
+     68,  88,  66,  67, 190, 171, 
+    186,  20,  44, 105,  95, 129, 
+    137, 204, 223,  72, 251, 159, 
+    126, 176,   1,   0,   0,   0, 
+     28,   2,   0,   0,   5,   0, 
+      0,   0,  52,   0,   0,   0, 
+    140,   0,   0,   0, 220,   0, 
+      0,   0,  48,   1,   0,   0, 
+    160,   1,   0,   0,  82,  68, 
+     69,  70,  80,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+     28,   0,   0,   0,   0,   4, 
+    254, 255,   0,   1,   0,   0, 
+     28,   0,   0,   0,  77, 105, 
+     99, 114, 111, 115, 111, 102, 
+    116,  32,  40,  82,  41,  32, 
+     72,  76,  83,  76,  32,  83, 
+    104,  97, 100, 101, 114,  32, 
+     67, 111, 109, 112, 105, 108, 
+    101, 114,  32,  57,  46,  50, 
+     57,  46,  57,  53,  50,  46, 
+     51,  49,  49,  49,   0, 171, 
+    171, 171,  73,  83,  71,  78, 
+     72,   0,   0,   0,   2,   0, 
+      0,   0,   8,   0,   0,   0, 
+     56,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   0,   0, 
+      0,   0,  15,  15,   0,   0, 
+     65,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      3,   0,   0,   0,   1,   0, 
+      0,   0,  15,  15,   0,   0, 
+     80,  79,  83,  73,  84,  73, 
+     79,  78,   0,  67,  79,  76, 
+     79,  82,   0, 171,  79,  83, 
+     71,  78,  76,   0,   0,   0, 
+      2,   0,   0,   0,   8,   0, 
+      0,   0,  56,   0,   0,   0, 
+      0,   0,   0,   0,   1,   0, 
+      0,   0,   3,   0,   0,   0, 
+      0,   0,   0,   0,  15,   0, 
+      0,   0,  68,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   3,   0,   0,   0, 
+      1,   0,   0,   0,  15,   0, 
+      0,   0,  83,  86,  95,  80, 
+     79,  83,  73,  84,  73,  79, 
+     78,   0,  67,  79,  76,  79, 
+     82,   0, 171, 171,  83,  72, 
+     68,  82, 104,   0,   0,   0, 
+     64,   0,   1,   0,  26,   0, 
+      0,   0,  95,   0,   0,   3, 
+    242,  16,  16,   0,   0,   0, 
+      0,   0,  95,   0,   0,   3, 
+    242,  16,  16,   0,   1,   0, 
+      0,   0, 103,   0,   0,   4, 
+    242,  32,  16,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+    101,   0,   0,   3, 242,  32, 
+     16,   0,   1,   0,   0,   0, 
+     54,   0,   0,   5, 242,  32, 
+     16,   0,   0,   0,   0,   0, 
+     70,  30,  16,   0,   0,   0, 
+      0,   0,  54,   0,   0,   5, 
+    242,  32,  16,   0,   1,   0, 
+      0,   0,  70,  30,  16,   0, 
+      1,   0,   0,   0,  62,   0, 
+      0,   1,  83,  84,  65,  84, 
+    116,   0,   0,   0,   3,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   4,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   1,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   2,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0, 
+      0,   0,   0,   0,   0,   0
+};