diff options
| author | Miles Macklin <[email protected]> | 2017-06-09 13:41:15 +1200 |
|---|---|---|
| committer | Miles Macklin <[email protected]> | 2017-06-09 13:41:15 +1200 |
| commit | 688b5f42e9bfe498d7af7075d4d8f4429867f3a3 (patch) | |
| tree | 7e0d0e7c95298f0418723abd92f61ac6e16b055e /demo/d3d11 | |
| parent | Update README.md (diff) | |
| download | flex-1.2.0.beta.1.tar.xz flex-1.2.0.beta.1.zip | |
1.2.0.beta.11.2.0.beta.1
Diffstat (limited to 'demo/d3d11')
70 files changed, 2871 insertions, 16397 deletions
diff --git a/demo/d3d11/appD3D11Ctx.cpp b/demo/d3d11/appD3D11Ctx.cpp index 85129e5..2d6b721 100644 --- a/demo/d3d11/appD3D11Ctx.cpp +++ b/demo/d3d11/appD3D11Ctx.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. * * NVIDIA CORPORATION and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation @@ -25,45 +25,56 @@ #include <SDL_video.h> #include <SDL_syswm.h> -AppGraphProfiler* appGraphCreateProfiler(AppGraphCtx* ctx); -void appGraphProfilerFrameBegin(AppGraphProfiler* profiler); -void appGraphProfilerFrameEnd(AppGraphProfiler* profiler); -void appGraphProfilerEnable(AppGraphProfiler* profiler, bool enabled); -void appGraphProfilerBegin(AppGraphProfiler* profiler, const char* label); -void appGraphProfilerEnd(AppGraphProfiler* profiler, const char* label); -bool appGraphProfilerGet(AppGraphProfiler* profiler, const char** plabel, float* cpuTime, float* gpuTime, int index); -void appGraphReleaseProfiler(AppGraphProfiler* profiler); +namespace +{ + // COM object release utilities + template <class T> + void inline COMRelease(T& t) + { + if (t) t->Release(); + t = nullptr; + } + + template <class T> + void inline COMRelease(T& t, UINT arraySize) + { + for (UINT i = 0; i < arraySize; i++) + { + if (t[i]) t[i]->Release(); + t[i] = nullptr; + } + } +} -AppGraphCtx::AppGraphCtx() +AppGraphProfilerD3D11* appGraphCreateProfilerD3D11(AppGraphCtx* ctx); +void appGraphProfilerD3D11FrameBegin(AppGraphProfilerD3D11* profiler); +void appGraphProfilerD3D11FrameEnd(AppGraphProfilerD3D11* profiler); +void appGraphProfilerD3D11Enable(AppGraphProfilerD3D11* profiler, bool enabled); +void appGraphProfilerD3D11Begin(AppGraphProfilerD3D11* profiler, const char* label); +void appGraphProfilerD3D11End(AppGraphProfilerD3D11* profiler, const char* label); +bool appGraphProfilerD3D11Get(AppGraphProfilerD3D11* profiler, const char** plabel, float* cpuTime, float* gpuTime, int index); +void appGraphReleaseProfiler(AppGraphProfilerD3D11* profiler); + +AppGraphCtxD3D11::AppGraphCtxD3D11() { - m_profiler = appGraphCreateProfiler(this); - memset(&m_viewport, 0, sizeof(m_viewport)); + m_profiler = appGraphCreateProfilerD3D11(cast_from_AppGraphCtxD3D11(this)); } -AppGraphCtx::~AppGraphCtx() +AppGraphCtxD3D11::~AppGraphCtxD3D11() { - AppGraphCtxReleaseRenderTarget(this); - - COMRelease(m_swapChain); - COMRelease(m_backBuffer); - COMRelease(m_rtv); - COMRelease(m_depthStencil); - COMRelease(m_dsv); - COMRelease(m_depthSRV); - COMRelease(m_depthState); - COMRelease(m_blendState); - COMRelease(m_resolvedTarget); - COMRelease(m_resolvedTargetSRV); - COMRelease(m_deviceContext); + AppGraphCtxReleaseRenderTargetD3D11(cast_from_AppGraphCtxD3D11(this)); + COMRelease(m_device); + COMRelease(m_deviceContext); + COMRelease(m_depthState); appGraphReleaseProfiler(m_profiler); m_profiler = nullptr; } -AppGraphCtx* AppGraphCtxCreate(int deviceID) +AppGraphCtx* AppGraphCtxCreateD3D11(int deviceID) { - AppGraphCtx* context = new AppGraphCtx; + AppGraphCtxD3D11* context = new AppGraphCtxD3D11; HRESULT hr = S_OK; @@ -148,30 +159,71 @@ AppGraphCtx* AppGraphCtxCreate(int deviceID) return nullptr; } - // create blend state - D3D11_BLEND_DESC blendStateDesc = {}; - blendStateDesc.RenderTarget[0].BlendEnable = TRUE; - blendStateDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; - blendStateDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; - blendStateDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; - blendStateDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; - blendStateDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO; - blendStateDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; - blendStateDesc.RenderTarget[0].RenderTargetWriteMask = 0x0f; - - if (hr = context->m_device->CreateBlendState(&blendStateDesc, &context->m_blendState)) + return cast_from_AppGraphCtxD3D11(context); +} + +void AppGraphCtxInitRenderTargetD3D11(AppGraphCtx* context, SDL_Window* window, bool fullscreen, int numMSAASamples); + +bool AppGraphCtxUpdateSizeD3D11(AppGraphCtx* contextIn, SDL_Window* window, bool fullscreen, int numMSAASamples) +{ + auto context = cast_to_AppGraphCtxD3D11(contextIn); + + // TODO: fix iflip fullscreen support + fullscreen = false; + + bool sizeChanged = false; + int width, height; + SDL_GetWindowSize(window, &width, &height); + + // sync with window + { + HWND hWnd = nullptr; + // get Windows handle to this SDL window + SDL_SysWMinfo winInfo; + SDL_VERSION(&winInfo.version); + if (SDL_GetWindowWMInfo(window, &winInfo)) + { + if (winInfo.subsystem == SDL_SYSWM_WINDOWS) + { + hWnd = winInfo.info.win.window; + } + } + context->m_hWnd = hWnd; + context->m_fullscreen = fullscreen; + + HRESULT hr = S_OK; + + if (context->m_winW != width || context->m_winH != height) + { + context->m_winW = width; + context->m_winH = height; + sizeChanged = true; + context->m_valid = (context->m_winW != 0 && context->m_winH != 0); + } + } + + if (sizeChanged) { - delete context; - return nullptr; + const bool wasValid = context->m_valid; + // Release + AppGraphCtxReleaseRenderTargetD3D11(cast_from_AppGraphCtxD3D11(context)); + // If was valid recreate it + if (wasValid) + { + // Reset the size (the release sets it, to 0,0) + context->m_winW = width; + context->m_winH = height; + // + AppGraphCtxInitRenderTargetD3D11(cast_from_AppGraphCtxD3D11(context), window, fullscreen, numMSAASamples); + } } - return context; + return context->m_valid; } -void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool fullscreen, int samples) +void AppGraphCtxInitRenderTargetD3D11(AppGraphCtx* contextIn, SDL_Window* window, bool fullscreen, int numMSAASamples) { - // TODO: fix iflip fullscreen support - fullscreen = false; + auto context = cast_to_AppGraphCtxD3D11(contextIn); HWND hWnd = nullptr; // get Windows handle to this SDL window @@ -187,15 +239,11 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool context->m_hWnd = hWnd; context->m_fullscreen = fullscreen; - HRESULT hr = S_OK; - - RECT rc; - GetClientRect(context->m_hWnd, &rc); - UINT width = rc.right - rc.left; - UINT height = rc.bottom - rc.top; + // Desired size + int width, height; + SDL_GetWindowSize(window, &width, &height); - context->m_winW = width; - context->m_winH = height; + HRESULT hr = S_OK; // enumerate devices IDXGIFactory1* pFactory = NULL; @@ -207,15 +255,15 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool DXGI_SWAP_CHAIN_DESC desc; ZeroMemory(&desc, sizeof(desc)); desc.BufferCount = 1; - desc.BufferDesc.Width = context->m_winW; - desc.BufferDesc.Height = context->m_winH; + desc.BufferDesc.Width = width; + desc.BufferDesc.Height = height; desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; desc.BufferDesc.RefreshRate.Numerator = 0; desc.BufferDesc.RefreshRate.Denominator = 0; desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; // DXGI_SWAP_EFFECT_FLIP_DISCARD; desc.OutputWindow = context->m_hWnd; - desc.SampleDesc.Count = samples; + desc.SampleDesc.Count = numMSAASamples; desc.SampleDesc.Quality = 0; desc.Windowed = TRUE; // m_fullscreen ? FALSE : TRUE; desc.Flags = 0u; @@ -249,8 +297,8 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool // configure scissor and viewport { - context->m_viewport.Width = float(context->m_winW); - context->m_viewport.Height = float(context->m_winH); + context->m_viewport.Width = float(width); + context->m_viewport.Height = float(height); context->m_viewport.MaxDepth = 1.f; } @@ -282,7 +330,7 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool texDesc.MipLevels = 1; texDesc.ArraySize = 1; texDesc.Format = DXGI_FORMAT_R32_TYPELESS; // DXGI_FORMAT_R24G8_TYPELESS - texDesc.SampleDesc.Count = samples; + texDesc.SampleDesc.Count = numMSAASamples; texDesc.SampleDesc.Quality = 0u; texDesc.Usage = D3D11_USAGE_DEFAULT; texDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE; @@ -296,7 +344,7 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool D3D11_DEPTH_STENCIL_VIEW_DESC viewDesc = {}; viewDesc.Format = DXGI_FORMAT_D32_FLOAT; - viewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMS; + viewDesc.ViewDimension = (numMSAASamples > 1) ? D3D11_DSV_DIMENSION_TEXTURE2DMS : D3D11_DSV_DIMENSION_TEXTURE2D; viewDesc.Flags = 0u; viewDesc.Texture2D.MipSlice = 0; @@ -307,7 +355,7 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; srvDesc.Format = DXGI_FORMAT_R32_FLOAT; - srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS; + srvDesc.ViewDimension = (numMSAASamples > 1) ? D3D11_SRV_DIMENSION_TEXTURE2DMS : D3D11_SRV_DIMENSION_TEXTURE2D; srvDesc.Texture2D.MipLevels = 1; srvDesc.Texture2D.MostDetailedMip = 0; @@ -316,42 +364,12 @@ void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool return; } } - - // resolved texture target (for refraction / scene sampling) - { - D3D11_TEXTURE2D_DESC texDesc = {}; - texDesc.Width = width; - texDesc.Height = height; - texDesc.MipLevels = 1; - texDesc.ArraySize = 1; - texDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - texDesc.SampleDesc.Count = 1; - texDesc.SampleDesc.Quality = 0u; - texDesc.Usage = D3D11_USAGE_DEFAULT; - texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE; - texDesc.CPUAccessFlags = 0; - texDesc.MiscFlags = 0; - - if (hr = context->m_device->CreateTexture2D(&texDesc, nullptr, &context->m_resolvedTarget)) - { - return; - } - - D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; - srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; - srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; - srvDesc.Texture2D.MipLevels = 1; - srvDesc.Texture2D.MostDetailedMip = 0; - - if (hr = context->m_device->CreateShaderResourceView(context->m_resolvedTarget, &srvDesc, &context->m_resolvedTargetSRV)) - { - return; - } - } } -void AppGraphCtxReleaseRenderTarget(AppGraphCtx* context) +void AppGraphCtxReleaseRenderTargetD3D11(AppGraphCtx* contextIn) { + auto context = cast_to_AppGraphCtxD3D11(contextIn); + if (context->m_swapChain == nullptr) { return; @@ -361,68 +379,78 @@ void AppGraphCtxReleaseRenderTarget(AppGraphCtx* context) context->m_swapChain->GetFullscreenState(&bFullscreen, nullptr); if (bFullscreen == TRUE) context->m_swapChain->SetFullscreenState(FALSE, nullptr); - COMRelease(context->m_swapChain); COMRelease(context->m_backBuffer); + COMRelease(context->m_swapChain); COMRelease(context->m_rtv); COMRelease(context->m_depthStencil); COMRelease(context->m_dsv); COMRelease(context->m_depthSRV); - COMRelease(context->m_resolvedTarget); - COMRelease(context->m_resolvedTargetSRV); + + context->m_valid = false; + context->m_winW = 0u; + context->m_winH = 0u; } -void AppGraphCtxRelease(AppGraphCtx* context) +void AppGraphCtxReleaseD3D11(AppGraphCtx* context) { if (context == nullptr) return; - delete context; + delete cast_to_AppGraphCtxD3D11(context); } -void AppGraphCtxResolveFrame(AppGraphCtx* context) +void AppGraphCtxFrameStartD3D11(AppGraphCtx* contextIn, AppGraphColor clearColor) { - context->m_deviceContext->ResolveSubresource(context->m_resolvedTarget, 0, context->m_backBuffer, 0, DXGI_FORMAT_R8G8B8A8_UNORM); -} + auto context = cast_to_AppGraphCtxD3D11(contextIn); -void AppGraphCtxFrameStart(AppGraphCtx* context, float clearColor[4]) -{ - appGraphProfilerFrameBegin(context->m_profiler); + appGraphProfilerD3D11FrameBegin(context->m_profiler); context->m_deviceContext->RSSetViewports(1, &context->m_viewport); context->m_deviceContext->RSSetScissorRects(0, nullptr); context->m_deviceContext->OMSetRenderTargets(1, &context->m_rtv, context->m_dsv); - context->m_deviceContext->ClearRenderTargetView(context->m_rtv, clearColor); + context->m_deviceContext->ClearRenderTargetView(context->m_rtv, &clearColor.r); context->m_deviceContext->ClearDepthStencilView(context->m_dsv, D3D11_CLEAR_DEPTH, 1.f, 0u); context->m_deviceContext->OMSetDepthStencilState(context->m_depthState, 0u); } -void AppGraphCtxFramePresent(AppGraphCtx* context, bool fullsync) +void AppGraphCtxFramePresentD3D11(AppGraphCtx* contextIn, bool fullsync) { + auto context = cast_to_AppGraphCtxD3D11(contextIn); + context->m_swapChain->Present(fullsync, 0); - - appGraphProfilerFrameEnd(context->m_profiler); + + appGraphProfilerD3D11FrameEnd(context->m_profiler); } -void AppGraphCtxProfileEnable(AppGraphCtx* context, bool enabled) +void AppGraphCtxWaitForFramesD3D11(AppGraphCtx* context, unsigned int maxFramesInFlight) { - appGraphProfilerEnable(context->m_profiler, enabled); + // TODO: Implement } -void AppGraphCtxProfileBegin(AppGraphCtx* context, const char* label) +void AppGraphCtxProfileEnableD3D11(AppGraphCtx* contextIn, bool enabled) { - appGraphProfilerBegin(context->m_profiler, label); + auto context = cast_to_AppGraphCtxD3D11(contextIn); + appGraphProfilerD3D11Enable(context->m_profiler, enabled); } -void AppGraphCtxProfileEnd(AppGraphCtx* context, const char* label) +void AppGraphCtxProfileBeginD3D11(AppGraphCtx* contextIn, const char* label) { - appGraphProfilerEnd(context->m_profiler, label); + auto context = cast_to_AppGraphCtxD3D11(contextIn); + appGraphProfilerD3D11Begin(context->m_profiler, label); } -bool AppGraphCtxProfileGet(AppGraphCtx* context, const char** plabel, float* cpuTime, float* gpuTime, int index) +void AppGraphCtxProfileEndD3D11(AppGraphCtx* contextIn, const char* label) { - return appGraphProfilerGet(context->m_profiler, plabel, cpuTime, gpuTime, index); + auto context = cast_to_AppGraphCtxD3D11(contextIn); + appGraphProfilerD3D11End(context->m_profiler, label); +} + +bool AppGraphCtxProfileGetD3D11(AppGraphCtx* contextIn, const char** plabel, float* cpuTime, float* gpuTime, int index) +{ + auto context = cast_to_AppGraphCtxD3D11(contextIn); + return appGraphProfilerD3D11Get(context->m_profiler, plabel, cpuTime, gpuTime, index); } // ******************************* Profiler ********************************* @@ -544,9 +572,9 @@ namespace }; } -struct AppGraphProfiler +struct AppGraphProfilerD3D11 { - AppGraphCtx* m_context; + AppGraphCtxD3D11* m_context; int m_state = 0; bool m_enabled = false; @@ -563,30 +591,30 @@ struct AppGraphProfiler TimerValue m_timerValues[m_timersCap]; int m_timerValuesSize = 0; - AppGraphProfiler(AppGraphCtx* context); - ~AppGraphProfiler(); + AppGraphProfilerD3D11(AppGraphCtx* context); + ~AppGraphProfilerD3D11(); }; -AppGraphProfiler::AppGraphProfiler(AppGraphCtx* context) : m_context(context) +AppGraphProfilerD3D11::AppGraphProfilerD3D11(AppGraphCtx* context) : m_context(cast_to_AppGraphCtxD3D11(context)) { } -AppGraphProfiler::~AppGraphProfiler() +AppGraphProfilerD3D11::~AppGraphProfilerD3D11() { COMRelease(m_disjoint); } -AppGraphProfiler* appGraphCreateProfiler(AppGraphCtx* ctx) +AppGraphProfilerD3D11* appGraphCreateProfilerD3D11(AppGraphCtx* ctx) { - return new AppGraphProfiler(ctx); + return new AppGraphProfilerD3D11(ctx); } -void appGraphReleaseProfiler(AppGraphProfiler* profiler) +void appGraphReleaseProfiler(AppGraphProfilerD3D11* profiler) { delete profiler; } -void appGraphProfilerFrameBegin(AppGraphProfiler* p) +void appGraphProfilerD3D11FrameBegin(AppGraphProfilerD3D11* p) { p->m_frameTime = (float)p->m_frameTimer.getDeltaTime(); @@ -611,7 +639,7 @@ void appGraphProfilerFrameBegin(AppGraphProfiler* p) } } -void appGraphProfilerFrameEnd(AppGraphProfiler* p) +void appGraphProfilerD3D11FrameEnd(AppGraphProfilerD3D11* p) { if (p->m_state == 1) { @@ -623,12 +651,12 @@ void appGraphProfilerFrameEnd(AppGraphProfiler* p) } } -void appGraphProfilerEnable(AppGraphProfiler* p, bool enabled) +void appGraphProfilerD3D11Enable(AppGraphProfilerD3D11* p, bool enabled) { p->m_enabled = enabled; } -void appGraphProfilerBegin(AppGraphProfiler* p, const char* label) +void appGraphProfilerD3D11Begin(AppGraphProfilerD3D11* p, const char* label) { if (p->m_state == 1 && p->m_timersSize < p->m_timersCap) { @@ -652,7 +680,7 @@ void appGraphProfilerBegin(AppGraphProfiler* p, const char* label) } } -void appGraphProfilerEnd(AppGraphProfiler* p, const char* label) +void appGraphProfilerD3D11End(AppGraphProfilerD3D11* p, const char* label) { if (p->m_state == 1) { @@ -676,7 +704,7 @@ void appGraphProfilerEnd(AppGraphProfiler* p, const char* label) } } -bool appGraphProfilerFlush(AppGraphProfiler* p) +bool appGraphProfilerD3D11Flush(AppGraphProfilerD3D11* p) { if (p->m_state == 2) { @@ -735,9 +763,9 @@ bool appGraphProfilerFlush(AppGraphProfiler* p) return false; } -bool appGraphProfilerGet(AppGraphProfiler* p, const char** plabel, float* cpuTime, float* gpuTime, int index) +bool appGraphProfilerD3D11Get(AppGraphProfilerD3D11* p, const char** plabel, float* cpuTime, float* gpuTime, int index) { - appGraphProfilerFlush(p); + appGraphProfilerD3D11Flush(p); { if (index < p->m_timerValuesSize) { @@ -755,7 +783,8 @@ bool appGraphProfilerGet(AppGraphProfiler* p, const char** plabel, float* cpuTim return false; } -size_t AppGraphCtxDedicatedVideoMemory(AppGraphCtx* context) +size_t AppGraphCtxDedicatedVideoMemoryD3D11(AppGraphCtx* contextIn) { + auto context = cast_to_AppGraphCtxD3D11(contextIn); return context->m_dedicatedVideoMemory; -} +}
\ No newline at end of file diff --git a/demo/d3d11/appD3D11Ctx.h b/demo/d3d11/appD3D11Ctx.h index 071952e..80a71f8 100644 --- a/demo/d3d11/appD3D11Ctx.h +++ b/demo/d3d11/appD3D11Ctx.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. * * NVIDIA CORPORATION and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation @@ -10,44 +10,26 @@ #pragma once +#include "../d3d/appGraphCtx.h" + #include <windows.h> #include <d3d11.h> +struct AppGraphProfilerD3D11; -template <class T> -void inline COMRelease(T& t) -{ - if (t) t->Release(); - t = nullptr; -} - -template <class T> -void inline COMRelease(T& t, UINT arraySize) -{ - for (UINT i = 0; i < arraySize; i++) - { - if (t[i]) t[i]->Release(); - t[i] = nullptr; - } -} - - - -struct SDL_Window; -struct AppGraphProfiler; - -struct AppGraphCtx +struct AppGraphCtxD3D11 { HWND m_hWnd = nullptr; int m_winW = 0; int m_winH = 0; bool m_fullscreen = false; + bool m_valid = false; size_t m_dedicatedVideoMemory = 0u; // D3D11 objects - D3D11_VIEWPORT m_viewport; + D3D11_VIEWPORT m_viewport = {}; ID3D11Device* m_device = nullptr; ID3D11DeviceContext* m_deviceContext = nullptr; IDXGISwapChain* m_swapChain = nullptr; @@ -57,37 +39,43 @@ struct AppGraphCtx ID3D11DepthStencilView* m_dsv = nullptr; ID3D11ShaderResourceView* m_depthSRV = nullptr; ID3D11DepthStencilState* m_depthState = nullptr; - ID3D11BlendState* m_blendState = nullptr; + + AppGraphProfilerD3D11* m_profiler = nullptr; - ID3D11Texture2D* m_resolvedTarget = nullptr; - ID3D11ShaderResourceView* m_resolvedTargetSRV = nullptr; + AppGraphCtxD3D11(); + ~AppGraphCtxD3D11(); +}; - AppGraphProfiler* m_profiler = nullptr; +inline AppGraphCtxD3D11* cast_to_AppGraphCtxD3D11(AppGraphCtx* appctx) +{ + return (AppGraphCtxD3D11*)(appctx); +} - AppGraphCtx(); - ~AppGraphCtx(); -}; +inline AppGraphCtx* cast_from_AppGraphCtxD3D11(AppGraphCtxD3D11* appctx) +{ + return (AppGraphCtx*)(appctx); +} -AppGraphCtx* AppGraphCtxCreate(int deviceID); +APP_GRAPH_CTX_API AppGraphCtx* AppGraphCtxCreateD3D11(int deviceID); -void AppGraphCtxInitRenderTarget(AppGraphCtx* context, SDL_Window* window, bool fullscreen, int); +APP_GRAPH_CTX_API bool AppGraphCtxUpdateSizeD3D11(AppGraphCtx* context, SDL_Window* window, bool fullscreen, int numMSAASamples); -void AppGraphCtxReleaseRenderTarget(AppGraphCtx* context); +APP_GRAPH_CTX_API void AppGraphCtxReleaseRenderTargetD3D11(AppGraphCtx* context); -void AppGraphCtxRelease(AppGraphCtx* context); +APP_GRAPH_CTX_API void AppGraphCtxReleaseD3D11(AppGraphCtx* context); -void AppGraphCtxFrameStart(AppGraphCtx* context, float clearColor[4]); +APP_GRAPH_CTX_API void AppGraphCtxFrameStartD3D11(AppGraphCtx* context, AppGraphColor clearColor); -void AppGraphCtxFramePresent(AppGraphCtx* context, bool fullsync); +APP_GRAPH_CTX_API void AppGraphCtxFramePresentD3D11(AppGraphCtx* context, bool fullsync); -void AppGraphCtxResolveFrame(AppGraphCtx* context); +APP_GRAPH_CTX_API void AppGraphCtxWaitForFramesD3D11(AppGraphCtx* context, unsigned int maxFramesInFlight); -void AppGraphCtxProfileEnable(AppGraphCtx* context, bool enabled); +APP_GRAPH_CTX_API void AppGraphCtxProfileEnableD3D11(AppGraphCtx* context, bool enabled); -void AppGraphCtxProfileBegin(AppGraphCtx* context, const char* label); +APP_GRAPH_CTX_API void AppGraphCtxProfileBeginD3D11(AppGraphCtx* context, const char* label); -void AppGraphCtxProfileEnd(AppGraphCtx* context, const char* label); +APP_GRAPH_CTX_API void AppGraphCtxProfileEndD3D11(AppGraphCtx* context, const char* label); -bool AppGraphCtxProfileGet(AppGraphCtx* context, const char** plabel, float* cpuTime, float* gpuTime, int index); +APP_GRAPH_CTX_API bool AppGraphCtxProfileGetD3D11(AppGraphCtx* context, const char** plabel, float* cpuTime, float* gpuTime, int index); -size_t AppGraphCtxDedicatedVideoMemory(AppGraphCtx* context);
\ No newline at end of file +APP_GRAPH_CTX_API size_t AppGraphCtxDedicatedVideoMemoryD3D11(AppGraphCtx* context); diff --git a/demo/d3d11/debugLineRender.h b/demo/d3d11/debugLineRender.h deleted file mode 100644 index 6132935..0000000 --- a/demo/d3d11/debugLineRender.h +++ /dev/null @@ -1,199 +0,0 @@ -#pragma once - - -#include "shaders/debugLineVS.hlsl.h" -#include "shaders/debugLinePS.hlsl.h" - - -struct DebugVertex -{ - Vec3 position; - Vec4 color; -}; - -struct DebugLineRender -{ - - void Init(ID3D11Device* d, ID3D11DeviceContext* c) - { - device = d; - context = c; - - // create the rasterizer state - { - D3D11_RASTERIZER_DESC desc = {}; - desc.FillMode = D3D11_FILL_SOLID; - desc.CullMode = D3D11_CULL_BACK; - desc.FrontCounterClockwise = TRUE; // This is non-default - desc.DepthBias = 0; - desc.DepthBiasClamp = 0.f; - desc.SlopeScaledDepthBias = 0.f; - desc.DepthClipEnable = TRUE; - desc.ScissorEnable = FALSE; // This is non-default - desc.MultisampleEnable = TRUE; - desc.AntialiasedLineEnable = FALSE; - - device->CreateRasterizerState(&desc, &rasterizerState); - } - - { - D3D11_DEPTH_STENCIL_DESC depthStateDesc = {}; - depthStateDesc.DepthEnable = FALSE; // disable depth test - depthStateDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; - depthStateDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL; - - device->CreateDepthStencilState(&depthStateDesc, &depthStencilState); - } - - // create the input layout - { - D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - - device->CreateInputLayout(inputElementDescs, 2, g_debugLineVS, sizeof(g_debugLineVS), &inputLayout); - } - - // create the blend state - { - D3D11_BLEND_DESC blendDesc = {}; - - blendDesc.AlphaToCoverageEnable = false; - blendDesc.IndependentBlendEnable = false; - blendDesc.RenderTarget[0].BlendEnable = false; - blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; - blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; - blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; - blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA; - blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA; - blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; - blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; - - device->CreateBlendState(&blendDesc, &blendState); - } - - // create the shaders - device->CreateVertexShader(g_debugLineVS, sizeof(g_debugLineVS), nullptr, &vertexShader); - device->CreatePixelShader(g_debugLinePS, sizeof(g_debugLinePS), nullptr, &pixelShader); - - // create a constant buffer - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(Matrix44); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - - device->CreateBuffer(&bufDesc, NULL, &constantBuffer); - } - } - - void Destroy() - { - COMRelease(depthStencilState); - COMRelease(rasterizerState); - COMRelease(inputLayout); - COMRelease(blendState); - COMRelease(vertexShader); - COMRelease(pixelShader); - COMRelease(constantBuffer); - COMRelease(vertexBuffer); - } - - void AddLine(const Vec3& p, const Vec3& q, const Vec4& color) - { - DebugVertex v = { p, color }; - DebugVertex w = { q, color }; - - queued.push_back(v); - queued.push_back(w); - } - - void FlushLines(const Matrix44& viewProj) - { - if (queued.empty()) - return; - - // recreate vertex buffer if not big enough for queued lines - if (vertexBufferSize < int(queued.size())) - { - if (vertexBuffer) - vertexBuffer->Release(); - - D3D11_BUFFER_DESC bufferDesc; - bufferDesc.Usage = D3D11_USAGE_DYNAMIC; - bufferDesc.ByteWidth = UINT(sizeof(DebugVertex)*queued.size()); - bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufferDesc.MiscFlags = 0; - - device->CreateBuffer(&bufferDesc, 0, &vertexBuffer); - - vertexBufferSize = int(queued.size()); - } - - // update vertex buffer - D3D11_MAPPED_SUBRESOURCE res; - context->Map(vertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, &queued[0], sizeof(DebugVertex)*queued.size()); - context->Unmap(vertexBuffer, 0); - - // update constant buffer - { - D3D11_MAPPED_SUBRESOURCE mappedResource = {}; - if (S_OK == context->Map(constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) - { - memcpy(mappedResource.pData, &viewProj, sizeof(viewProj)); - - context->Unmap(constantBuffer, 0u); - } - } - - // configure for line renderering - context->VSSetShader(vertexShader, nullptr, 0u); - context->GSSetShader(nullptr, nullptr, 0u); - context->PSSetShader(pixelShader, nullptr, 0u); - - context->IASetInputLayout(inputLayout); - context->OMSetBlendState(blendState, nullptr, 0xFFFFFFFF); - - context->VSSetConstantBuffers(0, 1, &constantBuffer); - - context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST); - - context->RSSetState(rasterizerState); - - UINT vertexStride = sizeof(DebugVertex); - UINT offset = 0u; - context->IASetVertexBuffers(0, 1, &vertexBuffer, &vertexStride, &offset); - - - // kick - context->Draw(UINT(queued.size()), 0); - - // empty queue - queued.resize(0); - - } - - - std::vector<DebugVertex> queued; - - ID3D11Buffer* vertexBuffer = nullptr; - int vertexBufferSize = 0; - - ID3D11DepthStencilState* depthStencilState = nullptr; - ID3D11RasterizerState* rasterizerState = nullptr; - ID3D11InputLayout* inputLayout = nullptr; - ID3D11BlendState* blendState = nullptr; - ID3D11VertexShader* vertexShader = nullptr; - ID3D11PixelShader* pixelShader = nullptr; - ID3D11Buffer* constantBuffer = nullptr; - - ID3D11Device* device = nullptr; - ID3D11DeviceContext* context = nullptr; - -};
\ No newline at end of file diff --git a/demo/d3d11/debugLineRenderD3D11.cpp b/demo/d3d11/debugLineRenderD3D11.cpp new file mode 100644 index 0000000..2b0b432 --- /dev/null +++ b/demo/d3d11/debugLineRenderD3D11.cpp @@ -0,0 +1,170 @@ +/* +* Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +#define NOMINMAX +#include <d3d11.h> + +#include <math.h> + +#include "../d3d/shaders/debugLineVS.hlsl.h" +#include "../d3d/shaders/debugLinePS.hlsl.h" + +// this +#include "debugLineRenderD3D11.h" + +void DebugLineRenderD3D11::init(ID3D11Device* d, ID3D11DeviceContext* c) +{ + m_device = d; + m_context = c; + + // create the rasterizer state + { + D3D11_RASTERIZER_DESC desc = {}; + desc.FillMode = D3D11_FILL_SOLID; + desc.CullMode = D3D11_CULL_BACK; + desc.FrontCounterClockwise = TRUE; // This is non-default + desc.DepthBias = 0; + desc.DepthBiasClamp = 0.f; + desc.SlopeScaledDepthBias = 0.f; + desc.DepthClipEnable = TRUE; + desc.ScissorEnable = FALSE; // This is non-default + desc.MultisampleEnable = TRUE; + desc.AntialiasedLineEnable = FALSE; + + m_device->CreateRasterizerState(&desc, m_rasterizerState.GetAddressOf()); + } + + { + D3D11_DEPTH_STENCIL_DESC depthStateDesc = {}; + depthStateDesc.DepthEnable = FALSE; // disable depth test + depthStateDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; + depthStateDesc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL; + + m_device->CreateDepthStencilState(&depthStateDesc, m_depthStencilState.GetAddressOf()); + } + + // create the input layout + { + D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + + m_device->CreateInputLayout(inputElementDescs, 2, g_debugLineVS, sizeof(g_debugLineVS), m_inputLayout.GetAddressOf()); + } + + // create the blend state + { + D3D11_BLEND_DESC blendDesc = {}; + + blendDesc.AlphaToCoverageEnable = false; + blendDesc.IndependentBlendEnable = false; + blendDesc.RenderTarget[0].BlendEnable = false; + blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; + blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; + blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA; + blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA; + blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; + + m_device->CreateBlendState(&blendDesc, m_blendState.GetAddressOf()); + } + + // create the shaders + m_device->CreateVertexShader(g_debugLineVS, sizeof(g_debugLineVS), nullptr, m_vertexShader.GetAddressOf()); + m_device->CreatePixelShader(g_debugLinePS, sizeof(g_debugLinePS), nullptr, m_pixelShader.GetAddressOf()); + + // create a constant buffer + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = sizeof(Matrix44); + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + + m_device->CreateBuffer(&bufDesc, NULL, m_constantBuffer.GetAddressOf()); + } +} + +void DebugLineRenderD3D11::addLine(const Vec3& p, const Vec3& q, const Vec4& color) +{ + Vertex v = { p, color }; + Vertex w = { q, color }; + + m_queued.push_back(v); + m_queued.push_back(w); +} + +void DebugLineRenderD3D11::flush(const Matrix44& viewProj) +{ + if (m_queued.empty()) + return; + + // recreate vertex buffer if not big enough for queued lines + if (m_vertexBufferSize < int(m_queued.size())) + { + m_vertexBuffer = nullptr; + + D3D11_BUFFER_DESC bufferDesc; + bufferDesc.Usage = D3D11_USAGE_DYNAMIC; + bufferDesc.ByteWidth = UINT(sizeof(Vertex)*m_queued.size()); + bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufferDesc.MiscFlags = 0; + + m_device->CreateBuffer(&bufferDesc, 0, &m_vertexBuffer); + + m_vertexBufferSize = int(m_queued.size()); + } + + // update vertex buffer + D3D11_MAPPED_SUBRESOURCE res; + m_context->Map(m_vertexBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, &m_queued[0], sizeof(Vertex)*m_queued.size()); + m_context->Unmap(m_vertexBuffer.Get(), 0); + + // update constant buffer + { + D3D11_MAPPED_SUBRESOURCE mappedResource = {}; + if (SUCCEEDED(m_context->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) + { + memcpy(mappedResource.pData, &viewProj, sizeof(viewProj)); + m_context->Unmap(m_constantBuffer.Get(), 0u); + } + } + + // configure for line renderering + m_context->VSSetShader(m_vertexShader.Get(), nullptr, 0u); + m_context->GSSetShader(nullptr, nullptr, 0u); + m_context->PSSetShader(m_pixelShader.Get(), nullptr, 0u); + + m_context->IASetInputLayout(m_inputLayout.Get()); + m_context->OMSetBlendState(m_blendState.Get(), nullptr, 0xFFFFFFFF); + + m_context->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + + m_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST); + + m_context->RSSetState(m_rasterizerState.Get()); + + UINT vertexStride = sizeof(Vertex); + UINT offset = 0u; + m_context->IASetVertexBuffers(0, 1, m_vertexBuffer.GetAddressOf(), &vertexStride, &offset); + + // kick + m_context->Draw(UINT(m_queued.size()), 0); + + // empty queue + m_queued.resize(0); + +} diff --git a/demo/d3d11/debugLineRenderD3D11.h b/demo/d3d11/debugLineRenderD3D11.h new file mode 100644 index 0000000..1509065 --- /dev/null +++ b/demo/d3d11/debugLineRenderD3D11.h @@ -0,0 +1,42 @@ +#pragma once + +#include <vector> +#include "core/maths.h" + +#include <wrl.h> +using namespace Microsoft::WRL; + +struct DebugLineRenderD3D11 +{ + struct Vertex + { + Vec3 position; + Vec4 color; + }; + + void init(ID3D11Device* d, ID3D11DeviceContext* c); + void addLine(const Vec3& p, const Vec3& q, const Vec4& color); + void flush(const Matrix44& viewProj); + + DebugLineRenderD3D11(): + m_vertexBufferSize(0), + m_device(nullptr), + m_context(nullptr) + {} + + std::vector<Vertex> m_queued; + + ComPtr<ID3D11Buffer> m_vertexBuffer; + int m_vertexBufferSize; + + ComPtr<ID3D11DepthStencilState> m_depthStencilState; + ComPtr<ID3D11RasterizerState> m_rasterizerState; + ComPtr<ID3D11InputLayout> m_inputLayout; + ComPtr<ID3D11BlendState> m_blendState; + ComPtr<ID3D11VertexShader> m_vertexShader; + ComPtr<ID3D11PixelShader> m_pixelShader; + ComPtr<ID3D11Buffer> m_constantBuffer; + + ID3D11Device* m_device; + ID3D11DeviceContext* m_context; +};
\ No newline at end of file diff --git a/demo/d3d11/demoContextD3D11.cpp b/demo/d3d11/demoContextD3D11.cpp new file mode 100644 index 0000000..0eaf0f4 --- /dev/null +++ b/demo/d3d11/demoContextD3D11.cpp @@ -0,0 +1,1147 @@ +#include "core/maths.h" +#include "core/extrude.h" + +#include "shaders.h" + +#include "meshRenderD3D11.h" +#include "pointRenderD3D11.h" +#include "fluidRenderD3D11.h" +#include "diffuseRenderD3D11.h" +#include "debugLineRenderD3D11.h" + +#include "shadowMapD3D11.h" +#include "renderTargetD3D11.h" + +#include "imguiGraphD3D11.h" + +#include "appD3D11Ctx.h" + +#include "../d3d/demoContext.h" +#include "../d3d/loader.h" + +#include <d3d11.h> +#include <d3dcompiler.h> + +#include <cstdlib> + +// this +#include "demoContextD3D11.h" + +namespace +{ +// COM object release utilities +template <class T> +void inline COMRelease(T& t) +{ + if (t) t->Release(); + t = nullptr; +} + +template <class T> +void inline COMRelease(T& t, UINT arraySize) +{ + for (UINT i = 0; i < arraySize; i++) + { + if (t[i]) t[i]->Release(); + t[i] = nullptr; + } +} +} + +extern Colour g_colors[]; +static const int kShadowResolution = 2048; + +DemoContext* CreateDemoContextD3D11() +{ + return new DemoContextD3D11; +} + +DemoContextD3D11::DemoContextD3D11() +{ + m_appGraphCtx = nullptr; + m_appGraphCtxD3D11 = nullptr; + memset(&m_meshDrawParams, 0, sizeof(m_meshDrawParams)); + + m_spotMin = 0.5f; + m_spotMax = 1.0f; + m_shadowBias = 0.075f; + + m_shadowMap = nullptr; + m_immediateMesh = nullptr; + + m_window = nullptr; + + m_msaaSamples = 1; + + m_renderTimerDisjoint = nullptr; + m_renderTimerBegin = nullptr; + m_renderTimerEnd = nullptr; + m_renderCompletionFence = nullptr; + + m_compositeBlendState = nullptr; + + m_fluidResolvedTarget = nullptr; + m_fluidResolvedTargetSRV = nullptr; + + m_debugLineRender = new DebugLineRenderD3D11; + m_meshRenderer = new MeshRendererD3D11; + m_pointRenderer = new PointRendererD3D11; + m_diffuseRenderer = new DiffuseRendererD3D11; +} + +// convert an OpenGL style projection matrix to D3D (clip z range [0, 1]) +Matrix44 ConvertToD3DProjection(const Matrix44& proj) +{ + Matrix44 scale = Matrix44::kIdentity; + scale.columns[2][2] = 0.5f; + + Matrix44 bias = Matrix44::kIdentity; + bias.columns[3][2] = 1.0f; + + return scale*bias*proj; +} + +#define checkDxErrors(err) __checkDxErrors (err, __FILE__, __LINE__) + +inline void __checkDxErrors(HRESULT err, const char *file, const int line) +{ + if (FAILED(err)) + { + char* lpMsgBuf; + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + err, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR)&lpMsgBuf, + 0, NULL); + + fprintf(stdout, "DX Error = %04d \"%s\" from file <%s>, line %i.\n", + err, lpMsgBuf, file, line); + + exit(EXIT_FAILURE); + } +} + +DemoContextD3D11::~DemoContextD3D11() +{ + imguiGraphDestroy(); + + COMRelease(m_renderTimerBegin); + COMRelease(m_renderTimerEnd); + COMRelease(m_renderTimerDisjoint); + COMRelease(m_renderCompletionFence); + + COMRelease(m_compositeBlendState); + + COMRelease(m_fluidResolvedTarget); + COMRelease(m_fluidResolvedTargetSRV); + + delete m_immediateMesh; + delete m_debugLineRender; + delete m_meshRenderer; + delete m_pointRenderer; + delete m_diffuseRenderer; + + // do this first, since it flushes all GPU work + AppGraphCtxReleaseRenderTarget(m_appGraphCtx); + AppGraphCtxRelease(m_appGraphCtx); +} + +bool DemoContextD3D11::initialize(const RenderInitOptions& options) +{ + { + // Load external modules + loadModules(APP_CONTEXT_D3D11); + } + + // must always have at least one sample + m_msaaSamples = Max(1, options.numMsaaSamples); + // create app graph context + m_appGraphCtx = AppGraphCtxCreate(0); + m_appGraphCtxD3D11 = cast_to_AppGraphCtxD3D11(m_appGraphCtx); + + AppGraphCtxUpdateSize(m_appGraphCtx, options.window, options.fullscreen, m_msaaSamples); + _onWindowSizeChanged(m_appGraphCtxD3D11->m_winW, m_appGraphCtxD3D11->m_winH, false); + + //AppGraphCtxInitRenderTarget(m_appGraphCtx, options.window, options.fullscreen, m_msaaSamples); + //gScene = getScene(0); + + AppGraphColor clearVal = { 0.0f, 0.0f, 0.0f, 1.0f }; + AppGraphCtxFrameStart(m_appGraphCtx, clearVal); + + ID3D11Device* device = m_appGraphCtxD3D11->m_device; + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + { + // create imgui, connect to app graph context + ImguiGraphDescD3D11 desc; + desc.device = device; + desc.deviceContext = deviceContext; + desc.winW = m_appGraphCtxD3D11->m_winW; + desc.winH = m_appGraphCtxD3D11->m_winH; + + // Use Dx11 context + const int defaultFontHeight = (options.defaultFontHeight <= 0) ? 15 : options.defaultFontHeight; + + if (!imguiGraphInit("../../data/DroidSans.ttf", float(defaultFontHeight), (ImguiGraphDesc*)&desc)) + { + return false; + } + } + + AppGraphCtxFramePresent(m_appGraphCtx, true); + + m_pointRenderer->init(device, deviceContext); + m_meshRenderer->init(device, deviceContext, options.asyncComputeBenchmark); + m_debugLineRender->init(device, deviceContext); + m_diffuseRenderer->init(device, deviceContext); + + { + // create blend state - used for composite phase of water rendering + D3D11_BLEND_DESC blendStateDesc = {}; + blendStateDesc.RenderTarget[0].BlendEnable = TRUE; + blendStateDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA; + blendStateDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA; + blendStateDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; + blendStateDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; + blendStateDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO; + blendStateDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendStateDesc.RenderTarget[0].RenderTargetWriteMask = 0x0f; + + if (FAILED(device->CreateBlendState(&blendStateDesc, &m_compositeBlendState))) + { + return false; + } + } + + // create a mesh for immediate mode rendering + m_immediateMesh = new GpuMeshD3D11(device, deviceContext); + + m_window = options.window; + + D3D11_QUERY_DESC tdesc; + ZeroMemory(&tdesc, sizeof(tdesc)); + tdesc.Query = D3D11_QUERY_TIMESTAMP; + device->CreateQuery(&tdesc, &m_renderTimerBegin); + device->CreateQuery(&tdesc, &m_renderTimerEnd); + + tdesc.Query = D3D11_QUERY_EVENT; + device->CreateQuery(&tdesc, &m_renderCompletionFence); + + ZeroMemory(&tdesc, sizeof(tdesc)); + tdesc.Query = D3D11_QUERY_TIMESTAMP_DISJOINT; + device->CreateQuery(&tdesc, &m_renderTimerDisjoint); + + return true; +} + +void DemoContextD3D11::getRenderDevice(void** deviceOut, void** contextOut) +{ + *deviceOut = m_appGraphCtxD3D11->m_device; + *contextOut = m_appGraphCtxD3D11->m_deviceContext; +} + +void DemoContextD3D11::onSizeChanged(int width, int height, bool minimized) +{ + AppGraphCtxUpdateSize(m_appGraphCtx, m_window, false, m_msaaSamples); + _onWindowSizeChanged(m_appGraphCtxD3D11->m_winW, m_appGraphCtxD3D11->m_winH, false); +} + +void DemoContextD3D11::_onWindowSizeChanged(int width, int height, bool minimized) +{ + if (m_fluidResolvedTarget) + { + D3D11_TEXTURE2D_DESC desc; + m_fluidResolvedTarget->GetDesc(&desc); + if (desc.Width == width && desc.Height == height) + { + return; + } + + COMRelease(m_fluidResolvedTarget); + COMRelease(m_fluidResolvedTargetSRV); + } + + // Recreate... + + ID3D11Device* device = m_appGraphCtxD3D11->m_device; + + // resolved texture target (for refraction / scene sampling) + { + D3D11_TEXTURE2D_DESC texDesc = {}; + texDesc.Width = width; + texDesc.Height = height; + texDesc.MipLevels = 1; + texDesc.ArraySize = 1; + texDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + texDesc.SampleDesc.Count = 1; + texDesc.SampleDesc.Quality = 0u; + texDesc.Usage = D3D11_USAGE_DEFAULT; + texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE; + texDesc.CPUAccessFlags = 0; + texDesc.MiscFlags = 0; + + if (FAILED(device->CreateTexture2D(&texDesc, nullptr, &m_fluidResolvedTarget))) + { + return; + } + + D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {}; + srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; + srvDesc.Texture2D.MipLevels = 1; + srvDesc.Texture2D.MostDetailedMip = 0; + + if (FAILED(device->CreateShaderResourceView(m_fluidResolvedTarget, &srvDesc, &m_fluidResolvedTargetSRV))) + { + return; + } + } +} + +void DemoContextD3D11::startFrame(Vec4 clear) +{ + AppGraphColor clearColor = { clear.x, clear.y, clear.z, clear.w }; + AppGraphCtxFrameStart(m_appGraphCtx, clearColor); + + MeshDrawParamsD3D& meshDrawParams = m_meshDrawParams; + + memset(&meshDrawParams, 0, sizeof(MeshDrawParamsD3D)); + meshDrawParams.renderStage = MESH_DRAW_LIGHT; + meshDrawParams.renderMode = MESH_RENDER_SOLID; + meshDrawParams.cullMode = MESH_CULL_BACK; + meshDrawParams.projection = (XMMATRIX)Matrix44::kIdentity; + meshDrawParams.view = (XMMATRIX)Matrix44::kIdentity; + meshDrawParams.model = DirectX::XMMatrixMultiply( + DirectX::XMMatrixScaling(1.0f, 1.0f, 1.0f), + DirectX::XMMatrixTranslation(0.0f, 0.0f, 0.0f) + ); +} + +void DemoContextD3D11::_flushFrame() +{ + m_appGraphCtxD3D11->m_deviceContext->Flush(); +} + +void DemoContextD3D11::endFrame() +{ + _flushFrame(); + + ImguiGraphDescD3D11 desc; + + desc.device = m_appGraphCtxD3D11->m_device; + desc.deviceContext = m_appGraphCtxD3D11->m_deviceContext; + desc.winW = m_appGraphCtxD3D11->m_winW; + desc.winH = m_appGraphCtxD3D11->m_winH; + + imguiGraphUpdate((ImguiGraphDesc*)&desc); + //m_imguiGraphContext->update(&desc); +} + +void DemoContextD3D11::presentFrame(bool fullsync) +{ + AppGraphCtxFramePresent(m_appGraphCtx, fullsync); +} + +void DemoContextD3D11::getViewRay(int x, int y, Vec3& origin, Vec3& dir) +{ + using namespace DirectX; + + XMVECTOR nearVector = XMVector3Unproject(XMVectorSet(float(x), float(m_appGraphCtxD3D11->m_winH-y), 0.0f, 0.0f), 0.0f, 0.0f, (float)m_appGraphCtxD3D11->m_winW, (float)m_appGraphCtxD3D11->m_winH, 0.0f, 1.0f, (XMMATRIX)m_proj, XMMatrixIdentity(), (XMMATRIX)m_view); + XMVECTOR farVector = XMVector3Unproject(XMVectorSet(float(x), float(m_appGraphCtxD3D11->m_winH-y), 1.0f, 0.0f), 0.0f, 0.0f, (float)m_appGraphCtxD3D11->m_winW, (float)m_appGraphCtxD3D11->m_winH, 0.0f, 1.0f, (XMMATRIX)m_proj, XMMatrixIdentity(), (XMMATRIX)m_view); + + origin = Vec3(XMVectorGetX(nearVector), XMVectorGetY(nearVector), XMVectorGetZ(nearVector)); + XMVECTOR tmp = farVector - nearVector; + dir = Normalize(Vec3(XMVectorGetX(tmp), XMVectorGetY(tmp), XMVectorGetZ(tmp))); +} + +void DemoContextD3D11::setFillMode(bool wire) +{ + m_meshDrawParams.renderMode = wire ? MESH_RENDER_WIREFRAME : MESH_RENDER_SOLID; +} + +void DemoContextD3D11::setCullMode(bool enabled) +{ + m_meshDrawParams.cullMode = enabled ? MESH_CULL_BACK : MESH_CULL_NONE; +} + +void DemoContextD3D11::setView(Matrix44 view, Matrix44 projection) +{ + Matrix44 vp = projection*view; + + m_meshDrawParams.model = (XMMATRIX)Matrix44::kIdentity; + m_meshDrawParams.view = (XMMATRIX)view; + m_meshDrawParams.projection = (XMMATRIX)(ConvertToD3DProjection(projection)); + + m_view = view; + m_proj = ConvertToD3DProjection(projection); +} + +FluidRenderer* DemoContextD3D11::createFluidRenderer(uint32_t width, uint32_t height) +{ + FluidRendererD3D11* renderer = new(_aligned_malloc(sizeof(FluidRendererD3D11), 16)) FluidRendererD3D11; + renderer->init(m_appGraphCtxD3D11->m_device, m_appGraphCtxD3D11->m_deviceContext, width, height); + return (FluidRenderer*)renderer; +} + +void DemoContextD3D11::destroyFluidRenderer(FluidRenderer* rendererIn) +{ + FluidRendererD3D11* renderer = (FluidRendererD3D11*)rendererIn; + renderer->~FluidRendererD3D11(); + _aligned_free(renderer); +} + +FluidRenderBuffers* DemoContextD3D11::createFluidRenderBuffers(int numParticles, bool enableInterop) +{ + FluidRenderBuffersD3D11* buffers = new FluidRenderBuffersD3D11; + buffers->m_numParticles = numParticles; + + ID3D11Device* device = m_appGraphCtxD3D11->m_device; + + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = numParticles*sizeof(Vec4); + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + bufDesc.StructureByteStride = 0; + + device->CreateBuffer(&bufDesc, NULL, &buffers->m_positions); + + device->CreateBuffer(&bufDesc, NULL, &buffers->m_anisotropiesArr[0]); + device->CreateBuffer(&bufDesc, NULL, &buffers->m_anisotropiesArr[1]); + device->CreateBuffer(&bufDesc, NULL, &buffers->m_anisotropiesArr[2]); + + bufDesc.ByteWidth = numParticles*sizeof(float); + device->CreateBuffer(&bufDesc, NULL, &buffers->m_densities); + } + + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = numParticles * sizeof(int); + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + bufDesc.StructureByteStride = 0; + + device->CreateBuffer(&bufDesc, NULL, &buffers->m_indices); + } + + if (enableInterop) + { + extern NvFlexLibrary* g_flexLib; + + buffers->m_positionsBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_positions.Get(), numParticles, sizeof(Vec4)); + buffers->m_densitiesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_densities.Get(), numParticles, sizeof(float)); + buffers->m_indicesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_indices.Get(), numParticles, sizeof(int)); + + buffers->m_anisotropiesBufArr[0] = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_anisotropiesArr[0].Get(), numParticles, sizeof(Vec4)); + buffers->m_anisotropiesBufArr[1] = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_anisotropiesArr[1].Get(), numParticles, sizeof(Vec4)); + buffers->m_anisotropiesBufArr[2] = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_anisotropiesArr[2].Get(), numParticles, sizeof(Vec4)); + } + + return reinterpret_cast<FluidRenderBuffers*>(buffers); +} + +void DemoContextD3D11::updateFluidRenderBuffers(FluidRenderBuffers* buffersIn, NvFlexSolver* solver, bool anisotropy, bool density) +{ + FluidRenderBuffersD3D11& buffers = *reinterpret_cast<FluidRenderBuffersD3D11*>(buffersIn); + if (!anisotropy) + { + // regular particles + NvFlexGetParticles(solver, buffers.m_positionsBuf, NULL); + } + else + { + // fluid buffers + NvFlexGetSmoothParticles(solver, buffers.m_positionsBuf, NULL); + NvFlexGetAnisotropy(solver, buffers.m_anisotropiesBufArr[0], buffers.m_anisotropiesBufArr[1], buffers.m_anisotropiesBufArr[2], NULL); + } + + if (density) + { + NvFlexGetDensities(solver, buffers.m_densitiesBuf, NULL); + } + else + { + NvFlexGetPhases(solver, buffers.m_densitiesBuf, NULL); + } + + NvFlexGetActive(solver, buffers.m_indicesBuf, NULL); +} + +void DemoContextD3D11::updateFluidRenderBuffers(FluidRenderBuffers* buffersIn, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices) +{ + FluidRenderBuffersD3D11& buffers = *reinterpret_cast<FluidRenderBuffersD3D11*>(buffersIn); + D3D11_MAPPED_SUBRESOURCE res; + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + // vertices + if (particles) + { + deviceContext->Map(buffers.m_positions.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, particles, sizeof(Vec4)*numParticles); + deviceContext->Unmap(buffers.m_positions.Get(), 0); + } + + Vec4*const anisotropies[3] = + { + anisotropy1, + anisotropy2, + anisotropy3, + }; + + for (int i = 0; i < 3; i++) + { + const Vec4* anisotropy = anisotropies[i]; + if (anisotropy) + { + deviceContext->Map(buffers.m_anisotropiesArr[i].Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, anisotropy, sizeof(Vec4) * numParticles); + deviceContext->Unmap(buffers.m_anisotropiesArr[i].Get(), 0); + } + } + + if (densities) + { + deviceContext->Map(buffers.m_densities.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, densities, sizeof(float)*numParticles); + deviceContext->Unmap(buffers.m_densities.Get(), 0); + } + + // indices + if (indices) + { + deviceContext->Map(buffers.m_indices.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, indices, sizeof(int)*numIndices); + deviceContext->Unmap(buffers.m_indices.Get(), 0); + } +} + +void DemoContextD3D11::destroyFluidRenderBuffers(FluidRenderBuffers* buffers) +{ + delete reinterpret_cast<FluidRenderBuffersD3D11*>(buffers); +} + +ShadowMap* DemoContextD3D11::shadowCreate() +{ + ShadowMapD3D11* shadowMap = new(_aligned_malloc(sizeof(ShadowMapD3D11), 16)) ShadowMapD3D11; + shadowMap->init(m_appGraphCtxD3D11->m_device, kShadowResolution); + return (ShadowMap*)shadowMap; +} + +void DemoContextD3D11::shadowDestroy(ShadowMap* map) +{ + ShadowMapD3D11* shadowMap = (ShadowMapD3D11*)map; + shadowMap->~ShadowMapD3D11(); + _aligned_free(shadowMap); +} + +void DemoContextD3D11::shadowBegin(ShadowMap* map) +{ + ShadowMapD3D11* shadowMap = (ShadowMapD3D11*)map; + shadowMap->bindAndClear(m_appGraphCtxD3D11->m_deviceContext); + + m_meshDrawParams.renderStage = MESH_DRAW_SHADOW; + m_shadowMap = shadowMap; +} + +void DemoContextD3D11::shadowEnd() +{ + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + // reset to main frame buffer + deviceContext->RSSetViewports(1, &m_appGraphCtxD3D11->m_viewport); + deviceContext->OMSetRenderTargets(1, &m_appGraphCtxD3D11->m_rtv, m_appGraphCtxD3D11->m_dsv); + deviceContext->OMSetDepthStencilState(m_appGraphCtxD3D11->m_depthState, 0u); + deviceContext->ClearDepthStencilView(m_appGraphCtxD3D11->m_dsv, D3D11_CLEAR_DEPTH, 1.0, 0); + + m_meshDrawParams.renderStage = MESH_DRAW_NULL; +} + +void DemoContextD3D11::bindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float bias, Vec4 fogColor) +{ + m_meshDrawParams.renderStage = MESH_DRAW_LIGHT; + + m_meshDrawParams.grid = 0; + m_meshDrawParams.spotMin = m_spotMin; + m_meshDrawParams.spotMax = m_spotMax; + m_meshDrawParams.fogColor = (float4&)fogColor; + + m_meshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; + + ShadowParamsD3D shadow; + RenderParamsUtilD3D::calcShadowParams(lightPos, lightTarget, lightTransform, m_shadowBias, &shadow); + + m_meshDrawParams.lightTransform = shadow.lightTransform; + m_meshDrawParams.lightDir = shadow.lightDir; + m_meshDrawParams.lightPos = shadow.lightPos; + m_meshDrawParams.bias = shadow.bias; + memcpy(m_meshDrawParams.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); + + m_shadowMap = (ShadowMapD3D11*)shadowMap; +} + +void DemoContextD3D11::unbindSolidShader() +{ + m_meshDrawParams.renderStage = MESH_DRAW_NULL; +} + +void DemoContextD3D11::graphicsTimerBegin() +{ + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + deviceContext->Begin(m_renderTimerDisjoint); + deviceContext->End(m_renderTimerBegin); // yes End. +} + +void DemoContextD3D11::graphicsTimerEnd() +{ + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + deviceContext->End(m_renderTimerEnd); + deviceContext->End(m_renderTimerDisjoint); + m_timersSet = true; +} + +float DemoContextD3D11::rendererGetDeviceTimestamps(unsigned long long* begin, unsigned long long* end, unsigned long long* freq) +{ + float renderTime = 0.0f; + + if (m_timersSet) + { + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + D3D11_QUERY_DATA_TIMESTAMP_DISJOINT tsDisjoint; + uint64_t renderBegin = 0; + uint64_t renderEnd = 0; + + while (S_OK != deviceContext->GetData(m_renderTimerDisjoint, &tsDisjoint, sizeof(tsDisjoint), 0)); + while (S_OK != deviceContext->GetData(m_renderTimerBegin, &renderBegin, sizeof(UINT64), 0)); + while (S_OK != deviceContext->GetData(m_renderTimerEnd, &renderEnd, sizeof(UINT64), 0)); + + float renderTime = float(renderEnd - renderBegin) / float(tsDisjoint.Frequency); + + if (begin) *begin = renderBegin; + if (end) *end = renderEnd; + if (freq) *freq = tsDisjoint.Frequency; + } + + return renderTime; +} + +void DemoContextD3D11::drawMesh(const Mesh* m, Vec3 color) +{ + if (m) + { + if (m->m_colours.size()) + { + m_meshDrawParams.colorArray = 1; + m_immediateMesh->updateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, (Vec4*)&m->m_colours[0], (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces())); + } + else + { + m_meshDrawParams.colorArray = 0; + m_immediateMesh->updateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, NULL, (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces())); + } + + m_meshDrawParams.color = (float4&)color; + m_meshDrawParams.secondaryColor = (float4&)color; + m_meshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; + m_meshDrawParams.shadowMap = (ShadowMapD3D*)m_shadowMap; + + m_meshRenderer->draw(m_immediateMesh, &m_meshDrawParams); + + if (m->m_colours.size()) + m_meshDrawParams.colorArray = 0; + + } +} + +void DemoContextD3D11::drawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex, float expand, bool twosided, bool smooth) +{ + if (!numTris) + return; + + m_immediateMesh->updateData(positions, normals, NULL, NULL, indices, numPositions, numTris); + + if (twosided) + SetCullMode(false); + + m_meshDrawParams.bias = 0.0f; + m_meshDrawParams.expand = expand; + + m_meshDrawParams.color = (const float4&)(g_colors[colorIndex + 1] * 1.5f); + m_meshDrawParams.secondaryColor = (const float4&)(g_colors[colorIndex] * 1.5f); + m_meshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; + m_meshDrawParams.shadowMap = (ShadowMapD3D*)m_shadowMap; + + m_meshRenderer->draw(m_immediateMesh, &m_meshDrawParams); + + if (twosided) + setCullMode(true); + + m_meshDrawParams.bias = m_shadowBias; + m_meshDrawParams.expand = 0.0f; +} + +void DemoContextD3D11::drawRope(Vec4* positions, int* indices, int numIndices, float radius, int color) +{ + if (numIndices < 2) + return; + + std::vector<Vec3> vertices; + std::vector<Vec3> normals; + std::vector<int> triangles; + + // flatten curve + std::vector<Vec3> curve(numIndices); + for (int i = 0; i < numIndices; ++i) + curve[i] = Vec3(positions[indices[i]]); + + const int resolution = 8; + const int smoothing = 3; + + vertices.reserve(resolution*numIndices*smoothing); + normals.reserve(resolution*numIndices*smoothing); + triangles.reserve(numIndices*resolution * 6 * smoothing); + + Extrude(&curve[0], int(curve.size()), vertices, normals, triangles, radius, resolution, smoothing); + + m_immediateMesh->updateData(&vertices[0], &normals[0], NULL, NULL, &triangles[0], int(vertices.size()), int(triangles.size())/3); + + setCullMode(false); + + m_meshDrawParams.color = (const float4&)(g_colors[color % 8] * 1.5f); + m_meshDrawParams.secondaryColor = (const float4&)(g_colors[color % 8] * 1.5f); + m_meshDrawParams.objectTransform = (const float4x4&)Matrix44::kIdentity; + m_meshDrawParams.shadowMap = (ShadowMapD3D*)m_shadowMap; + + m_meshRenderer->draw(m_immediateMesh, &m_meshDrawParams); + + setCullMode(true); +} + +void DemoContextD3D11::drawPlane(const Vec4& p, bool color) +{ + std::vector<Vec3> vertices; + std::vector<Vec3> normals; + std::vector<int> indices; + + Vec3 u, v; + BasisFromVector(Vec3(p.x, p.y, p.z), &u, &v); + + Vec3 c = Vec3(p.x, p.y, p.z)*-p.w; + + m_meshDrawParams.shadowMap = (ShadowMapD3D*)m_shadowMap; + + if (color) + m_meshDrawParams.color = (const float4&)(p * 0.5f + Vec4(0.5f, 0.5f, 0.5f, 0.5f)); + + const float kSize = 200.0f; + const int kGrid = 3; + + // draw a grid of quads, otherwise z precision suffers + for (int x = -kGrid; x <= kGrid; ++x) + { + for (int y = -kGrid; y <= kGrid; ++y) + { + Vec3 coff = c + u*float(x)*kSize*2.0f + v*float(y)*kSize*2.0f; + + int indexStart = int(vertices.size()); + + vertices.push_back(Vec3(coff + u*kSize + v*kSize)); + vertices.push_back(Vec3(coff - u*kSize + v*kSize)); + vertices.push_back(Vec3(coff - u*kSize - v*kSize)); + vertices.push_back(Vec3(coff + u*kSize - v*kSize)); + + normals.push_back(Vec3(p.x, p.y, p.z)); + normals.push_back(Vec3(p.x, p.y, p.z)); + normals.push_back(Vec3(p.x, p.y, p.z)); + normals.push_back(Vec3(p.x, p.y, p.z)); + + + indices.push_back(indexStart+0); + indices.push_back(indexStart+1); + indices.push_back(indexStart+2); + + indices.push_back(indexStart+2); + indices.push_back(indexStart+3); + indices.push_back(indexStart+0); + } + } + + m_immediateMesh->updateData(&vertices[0], &normals[0], NULL, NULL, &indices[0], int(vertices.size()), int(indices.size())/3); + m_meshRenderer->draw(m_immediateMesh, &m_meshDrawParams); +} + +void DemoContextD3D11::drawPlanes(Vec4* planes, int n, float bias) +{ + m_meshDrawParams.color = (float4&)Vec4(0.9f, 0.9f, 0.9f, 1.0f); + + m_meshDrawParams.bias = 0.0f; + m_meshDrawParams.grid = 1; + m_meshDrawParams.expand = 0; + + for (int i = 0; i < n; ++i) + { + Vec4 p = planes[i]; + p.w -= bias; + + drawPlane(p, false); + } + + m_meshDrawParams.grid = 0; + m_meshDrawParams.bias = m_shadowBias; + +} + +GpuMesh* DemoContextD3D11::createGpuMesh(const Mesh* m) +{ + GpuMeshD3D11* mesh = new GpuMeshD3D11(m_appGraphCtxD3D11->m_device, m_appGraphCtxD3D11->m_deviceContext); + mesh->updateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, NULL, (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces())); + return (GpuMesh*)mesh; +} + +void DemoContextD3D11::destroyGpuMesh(GpuMesh* m) +{ + delete reinterpret_cast<GpuMeshD3D11*>(m); +} + +void DemoContextD3D11::drawGpuMesh(GpuMesh* meshIn, const Matrix44& xform, const Vec3& color) +{ + if (meshIn) + { + GpuMeshD3D11* mesh = (GpuMeshD3D11*)meshIn; + + MeshDrawParamsD3D params = m_meshDrawParams; + + params.color = (float4&)color; + params.secondaryColor = (float4&)color; + params.objectTransform = (float4x4&)xform; + params.shadowMap = (ShadowMapD3D*)m_shadowMap; + + m_meshRenderer->draw(mesh, ¶ms); + } +} + +void DemoContextD3D11::drawGpuMeshInstances(GpuMesh* meshIn, const Matrix44* xforms, int n, const Vec3& color) +{ + if (meshIn) + { + GpuMeshD3D11* mesh = (GpuMeshD3D11*)meshIn; + + m_meshDrawParams.color = (float4&)color; + m_meshDrawParams.secondaryColor = (float4&)color; + m_meshDrawParams.shadowMap = (ShadowMapD3D*)m_shadowMap; + + // copy params + MeshDrawParamsD3D params(m_meshDrawParams); + + for (int i = 0; i < n; ++i) + { + params.objectTransform = (const float4x4&)xforms[i]; + m_meshRenderer->draw(mesh, ¶ms); + } + } +} + +void DemoContextD3D11::drawPoints(FluidRenderBuffers* buffersIn, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, bool showDensity) +{ + FluidRenderBuffersD3D11& buffers = *reinterpret_cast<FluidRenderBuffersD3D11*>(buffersIn); + if (n == 0) + return; + + PointDrawParamsD3D params; + + params.renderMode = POINT_RENDER_SOLID; + params.cullMode = POINT_CULL_BACK; + params.model = (const XMMATRIX&)Matrix44::kIdentity; + params.view = (const XMMATRIX&)m_view; + params.projection = (const XMMATRIX&)m_proj; + + params.pointRadius = radius; + params.pointScale = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); + params.spotMin = m_spotMin; + params.spotMax = m_spotMax; + + int mode = 0; + if (showDensity) + mode = 1; + if (shadowTex == 0) + mode = 2; + params.mode = mode; + + for (int i = 0; i < 8; i++) + params.colors[i] = *((const float4*)&g_colors[i].r); + + // set shadow parameters + ShadowParamsD3D shadow; + RenderParamsUtilD3D::calcShadowParams(lightPos, lightTarget, lightTransform, m_shadowBias, &shadow); + params.lightTransform = shadow.lightTransform; + params.lightDir = shadow.lightDir; + params.lightPos = shadow.lightPos; + memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); + + if (m_meshDrawParams.renderStage == MESH_DRAW_SHADOW) + { + params.renderStage = POINT_DRAW_SHADOW; + params.mode = 2; + } + else + { + params.renderStage = POINT_DRAW_LIGHT; + } + + params.shadowMap = (ShadowMapD3D*)m_shadowMap; + + m_pointRenderer->draw(¶ms, buffers.m_positions.Get(), buffers.m_densities.Get(), buffers.m_indices.Get(), n, offset); +} + +void DemoContextD3D11::renderEllipsoids(FluidRenderer* rendererIn, FluidRenderBuffers* buffersIn, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, Vec4 color, float blur, float ior, bool debug) +{ + FluidRenderBuffersD3D11& buffers = *reinterpret_cast<FluidRenderBuffersD3D11*>(buffersIn); + FluidRendererD3D11& renderer = *(FluidRendererD3D11*)rendererIn; + if (n == 0) + return; + + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + FluidDrawParamsD3D params; + + params.renderMode = FLUID_RENDER_SOLID; + params.cullMode = FLUID_CULL_BACK; + params.model = (const XMMATRIX&)Matrix44::kIdentity; + params.view = (const XMMATRIX&)m_view; + params.projection = (XMMATRIX&)m_proj; + + params.offset = offset; + params.n = n; + params.renderStage = FLUID_DRAW_LIGHT; + + const float viewHeight = tanf(fov / 2.0f); + params.invViewport = float3(1.0f / screenWidth, screenAspect / screenWidth, 1.0f); + params.invProjection = float3(screenAspect * viewHeight, viewHeight, 1.0f); + + params.shadowMap = (ShadowMapD3D*)m_shadowMap; + + renderer.m_depthTexture.bindAndClear(m_appGraphCtxD3D11->m_deviceContext); + + // draw static shapes into depth buffer + //DrawShapes(); + + renderer.drawEllipsoids(¶ms, &buffers); + + + //--------------------------------------------------------------- + // build smooth depth + + renderer.m_depthSmoothTexture.bindAndClear(deviceContext); + + params.blurRadiusWorld = radius * 0.5f; + params.blurScale = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); + params.invTexScale = float4(1.0f / screenAspect, 1.0f, 0.0f, 0.0f); + params.blurFalloff = blur; + params.debug = debug; + + renderer.drawBlurDepth(¶ms); + + //--------------------------------------------------------------- + // composite + + { + deviceContext->RSSetViewports(1, &m_appGraphCtxD3D11->m_viewport); + deviceContext->RSSetScissorRects(0, nullptr); + + deviceContext->OMSetRenderTargets(1, &m_appGraphCtxD3D11->m_rtv, m_appGraphCtxD3D11->m_dsv); + deviceContext->OMSetDepthStencilState(m_appGraphCtxD3D11->m_depthState, 0u); + + float blendFactor[4] = { 1.0, 1.0, 1.0, 1.0 }; + deviceContext->OMSetBlendState(m_compositeBlendState, blendFactor, 0xffff); + } + + params.invTexScale = (float4&)Vec2(1.0f / screenWidth, screenAspect / screenWidth); + params.clipPosToEye = (float4&)Vec2(tanf(fov*0.5f)*screenAspect, tanf(fov*0.5f)); + params.color = (float4&)color; + params.ior = ior; + params.spotMin = m_spotMin; + params.spotMax = m_spotMax; + params.debug = debug; + + params.lightPos = (const float3&)lightPos; + params.lightDir = (const float3&)-Normalize(lightTarget - lightPos); + params.lightTransform = (const XMMATRIX&)(ConvertToD3DProjection(lightTransform)); + + // Resolve MS back buffer/copy + if (m_msaaSamples > 1) + { + deviceContext->ResolveSubresource(m_fluidResolvedTarget, 0, m_appGraphCtxD3D11->m_backBuffer, 0, DXGI_FORMAT_R8G8B8A8_UNORM); + } + else + { + deviceContext->CopyResource(m_fluidResolvedTarget, m_appGraphCtxD3D11->m_backBuffer); + } + + renderer.drawComposite(¶ms, m_fluidResolvedTargetSRV); + + deviceContext->OMSetBlendState(nullptr, 0, 0xffff); +} + +DiffuseRenderBuffers* DemoContextD3D11::createDiffuseRenderBuffers(int numParticles, bool& enableInterop) +{ + ID3D11Device* device = m_appGraphCtxD3D11->m_device; + DiffuseRenderBuffersD3D11* buffers = new DiffuseRenderBuffersD3D11; + + buffers->m_numParticles = numParticles; + if (numParticles > 0) + { + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = numParticles * sizeof(Vec4); + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + if (enableInterop) + { + bufDesc.CPUAccessFlags = 0; + bufDesc.Usage = D3D11_USAGE_DEFAULT; + bufDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; + } + + device->CreateBuffer(&bufDesc, NULL, buffers->m_positions.ReleaseAndGetAddressOf()); + device->CreateBuffer(&bufDesc, NULL, buffers->m_velocities.ReleaseAndGetAddressOf()); + } + + if (enableInterop) + { + extern NvFlexLibrary* g_flexLib; + + buffers->m_positionsBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_positions.Get(), numParticles, sizeof(Vec4)); + buffers->m_velocitiesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers->m_velocities.Get(), numParticles, sizeof(Vec4)); + + if (buffers->m_positionsBuf == nullptr || + buffers->m_velocitiesBuf == nullptr) + enableInterop = false; + } + } + + return reinterpret_cast<DiffuseRenderBuffers*>(buffers); +} + +void DemoContextD3D11::destroyDiffuseRenderBuffers(DiffuseRenderBuffers* buffers) +{ + delete reinterpret_cast<DiffuseRenderBuffersD3D11*>(buffers); +} + +void DemoContextD3D11::updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffersIn, NvFlexSolver* solver) +{ + DiffuseRenderBuffersD3D11* buffers = reinterpret_cast<DiffuseRenderBuffersD3D11*>(buffersIn); + // diffuse particles + if (buffers->m_numParticles) + { + NvFlexGetDiffuseParticles(solver, buffers->m_positionsBuf, buffers->m_velocitiesBuf, nullptr); + } +} + +void DemoContextD3D11::updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffersIn, Vec4* diffusePositions, Vec4* diffuseVelocities, int numDiffuseParticles) +{ + DiffuseRenderBuffersD3D11& buffers = *reinterpret_cast<DiffuseRenderBuffersD3D11*>(buffersIn); + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + D3D11_MAPPED_SUBRESOURCE res; + + // vertices + if (diffusePositions) + { + deviceContext->Map(buffers.m_positions.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, diffusePositions, sizeof(Vec4)*numDiffuseParticles); + deviceContext->Unmap(buffers.m_positions.Get(), 0); + } + + if (diffuseVelocities) + { + deviceContext->Map(buffers.m_velocities.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, diffuseVelocities, sizeof(Vec4)*numDiffuseParticles); + deviceContext->Unmap(buffers.m_velocities.Get(), 0); + } +} + +void DemoContextD3D11::drawDiffuse(FluidRenderer* renderIn, const DiffuseRenderBuffers* buffersIn, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadowEnabled, bool front) +{ + FluidRendererD3D11* render = (FluidRendererD3D11*)renderIn; + const DiffuseRenderBuffersD3D11& buffers = *reinterpret_cast<const DiffuseRenderBuffersD3D11*>(buffersIn); + if (n == 0) + return; + + DiffuseDrawParamsD3D params; + + params.model = (const XMMATRIX&)Matrix44::kIdentity; + params.view = (const XMMATRIX&)m_view; + params.projection = (const XMMATRIX&)m_proj; + params.diffuseRadius = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); + params.diffuseScale = radius; + params.spotMin = m_spotMin; + params.spotMax = m_spotMax; + params.color = float4(1.0f, 1.0f, 1.0f, 1.0f); + params.motionScale = motionBlur; + + // set shadow parameters + ShadowParamsD3D shadow; + RenderParamsUtilD3D::calcShadowParams(lightPos, lightTarget, lightTransform, m_shadowBias, &shadow); + params.lightTransform = shadow.lightTransform; + params.lightDir = shadow.lightDir; + params.lightPos = shadow.lightPos; + params.shadowMap = (ShadowMapD3D*)m_shadowMap; + + memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); + + m_diffuseRenderer->draw(¶ms, buffers.m_positions.Get(), buffers.m_velocities.Get(), n); + + // reset depth stencil state + m_appGraphCtxD3D11->m_deviceContext->OMSetDepthStencilState(m_appGraphCtxD3D11->m_depthState, 0u); +} + +int DemoContextD3D11::getNumDiffuseRenderParticles(DiffuseRenderBuffers* buffers) +{ + return reinterpret_cast<DiffuseRenderBuffersD3D11*>(buffers)->m_numParticles; +} + +void DemoContextD3D11::beginLines() +{ +} + +void DemoContextD3D11::drawLine(const Vec3& p, const Vec3& q, const Vec4& color) +{ + m_debugLineRender->addLine(p, q, color); +} + +void DemoContextD3D11::endLines() +{ + // draw + Matrix44 projectionViewWorld = ((Matrix44&)(m_meshDrawParams.projection))*((Matrix44&)(m_meshDrawParams.view)); + + m_debugLineRender->flush(projectionViewWorld); +} + +void DemoContextD3D11::startGpuWork() {} +void DemoContextD3D11::endGpuWork() {} + +void DemoContextD3D11::flushGraphicsAndWait() +{ + ID3D11DeviceContext* deviceContext = m_appGraphCtxD3D11->m_deviceContext; + + deviceContext->End(m_renderCompletionFence); + while (S_OK != deviceContext->GetData(m_renderCompletionFence, 0, 0, 0)); +} + +void* DemoContextD3D11::getGraphicsCommandQueue() { return NULL; } + +void DemoContextD3D11::drawImguiGraph() +{ + imguiGraphDraw(); +} diff --git a/demo/d3d11/demoContextD3D11.h b/demo/d3d11/demoContextD3D11.h new file mode 100644 index 0000000..e01dfe2 --- /dev/null +++ b/demo/d3d11/demoContextD3D11.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + + +struct DemoContextD3D11 : public DemoContext +{ +public: + + // DemoContext Impl + virtual bool initialize(const RenderInitOptions& options); + virtual void startFrame(Vec4 colorIn); + virtual void endFrame(); + virtual void presentFrame(bool fullsync); + virtual void getViewRay(int x, int y, Vec3& origin, Vec3& dir); + virtual void setView(Matrix44 view, Matrix44 projection); + virtual void renderEllipsoids(FluidRenderer* renderer, FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, Vec4 color, float blur, float ior, bool debug); + virtual void drawMesh(const Mesh* m, Vec3 color); + virtual void drawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex, float expand, bool twosided, bool smooth); + virtual void drawRope(Vec4* positions, int* indices, int numIndices, float radius, int color); + virtual void drawPlane(const Vec4& p, bool color); + virtual void drawPlanes(Vec4* planes, int n, float bias); + virtual void drawPoints(FluidRenderBuffers* buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowTex, bool showDensity); + virtual void graphicsTimerBegin(); + virtual void graphicsTimerEnd(); + virtual float rendererGetDeviceTimestamps(unsigned long long* begin, unsigned long long* end, unsigned long long* freq); + virtual void bindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, float bias, Vec4 fogColor); + virtual void unbindSolidShader(); + virtual ShadowMap* shadowCreate(); + virtual void shadowDestroy(ShadowMap* map); + virtual void shadowBegin(ShadowMap* map); + virtual void shadowEnd(); + virtual FluidRenderer* createFluidRenderer(uint32_t width, uint32_t height); + virtual void destroyFluidRenderer(FluidRenderer* renderer); + virtual FluidRenderBuffers* createFluidRenderBuffers(int numParticles, bool enableInterop); + virtual void updateFluidRenderBuffers(FluidRenderBuffers* buffers, NvFlexSolver* flex, bool anisotropy, bool density); + virtual void updateFluidRenderBuffers(FluidRenderBuffers* buffers, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices); + virtual void destroyFluidRenderBuffers(FluidRenderBuffers* buffers); + virtual GpuMesh* createGpuMesh(const Mesh* m); + virtual void destroyGpuMesh(GpuMesh* mesh); + virtual void drawGpuMesh(GpuMesh* m, const Matrix44& xform, const Vec3& color); + virtual void drawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const Vec3& color); + virtual DiffuseRenderBuffers* createDiffuseRenderBuffers(int numDiffuseParticles, bool& enableInterop); + virtual void destroyDiffuseRenderBuffers(DiffuseRenderBuffers* buffers); + virtual void updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, Vec4* diffusePositions, Vec4* diffuseVelocities, int numDiffuseParticles); + virtual void updateDiffuseRenderBuffers(DiffuseRenderBuffers* buffers, NvFlexSolver* solver); + virtual void drawDiffuse(FluidRenderer* render, const DiffuseRenderBuffers* buffers, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ::ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadowEnabled, bool front); + virtual int getNumDiffuseRenderParticles(DiffuseRenderBuffers* buffers); + virtual void beginLines(); + virtual void drawLine(const Vec3& p, const Vec3& q, const Vec4& color); + virtual void endLines(); + virtual void onSizeChanged(int width, int height, bool minimized); + virtual void startGpuWork(); + virtual void endGpuWork(); + virtual void flushGraphicsAndWait(); + virtual void setFillMode(bool wire); + virtual void setCullMode(bool enabled); + virtual void drawImguiGraph(); + virtual void* getGraphicsCommandQueue(); + virtual void getRenderDevice(void** device, void** context); + + DemoContextD3D11(); + virtual ~DemoContextD3D11(); + +protected: + void _flushFrame(); + void _onWindowSizeChanged(int width, int height, bool minimized); + + DebugLineRenderD3D11* m_debugLineRender; + MeshRendererD3D11* m_meshRenderer; + PointRendererD3D11* m_pointRenderer; + DiffuseRendererD3D11* m_diffuseRenderer; + + // Used when blending water in the final 'composite' phase + ID3D11BlendState* m_compositeBlendState; + + // Target texture resolved/copied to for combination rendering from for water surface + ID3D11Texture2D* m_fluidResolvedTarget; + ID3D11ShaderResourceView* m_fluidResolvedTargetSRV; + + AppGraphCtx* m_appGraphCtx; + AppGraphCtxD3D11* m_appGraphCtxD3D11; + + float m_spotMin; + float m_spotMax; + float m_shadowBias; + + MeshDrawParamsD3D m_meshDrawParams; + + Matrix44 m_view; + Matrix44 m_proj; + + ShadowMapD3D11* m_shadowMap; + GpuMeshD3D11* m_immediateMesh; + + SDL_Window* m_window; + + int m_msaaSamples; + + ID3D11Query* m_renderTimerDisjoint; + ID3D11Query* m_renderTimerBegin; + ID3D11Query* m_renderTimerEnd; + ID3D11Query* m_renderCompletionFence; + bool m_timersSet = false; +}; diff --git a/demo/d3d11/diffuseRender.h b/demo/d3d11/diffuseRender.h deleted file mode 100644 index 69517b2..0000000 --- a/demo/d3d11/diffuseRender.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -#pragma once - -#include <DirectXMath.h> - -#include "shadowMap.h" - - -typedef DirectX::XMFLOAT3 float3; -typedef DirectX::XMFLOAT4 float4; -typedef DirectX::XMFLOAT4X4 float4x4; - -struct DiffuseDrawParams -{ - DirectX::XMMATRIX projection; - DirectX::XMMATRIX view; - DirectX::XMMATRIX model; - - float diffuseRadius; // point size in world space - float diffuseScale; // scale to calculate size in pixels - float spotMin; - float spotMax; - float motionScale; - - DirectX::XMMATRIX lightTransform; - float3 lightPos; - float3 lightDir; - - float4 color; - - float4 shadowTaps[12]; - ShadowMap* shadowMap; - - int mode; -}; - - -struct DiffuseRenderer -{ - ID3D11Device* m_device = nullptr; - ID3D11DeviceContext* m_deviceContext = nullptr; - - ID3D11InputLayout* m_inputLayout = nullptr; - - ID3D11VertexShader* m_diffuseVS = nullptr; - ID3D11GeometryShader* m_diffuseGS = nullptr; - ID3D11PixelShader* m_diffusePS = nullptr; - - ID3D11Buffer* m_constantBuffer = nullptr; - ID3D11RasterizerState* m_rasterizerState = nullptr; - - ID3D11BlendState* m_blendState = nullptr; - ID3D11DepthStencilState* m_depthStencilState = nullptr; - - void Init(ID3D11Device* device, ID3D11DeviceContext* deviceContext); - void Destroy(); - - - void Draw(const DiffuseDrawParams* params, ID3D11Buffer* positions, ID3D11Buffer* velocities, ID3D11Buffer* indices, int numParticles); -}; diff --git a/demo/d3d11/diffuseRender.cpp b/demo/d3d11/diffuseRenderD3D11.cpp index 60ced59..846a8bf 100644 --- a/demo/d3d11/diffuseRender.cpp +++ b/demo/d3d11/diffuseRenderD3D11.cpp @@ -21,17 +21,15 @@ #include "appD3D11Ctx.h" -#include "diffuseRender.h" +#include "diffuseRenderD3D11.h" -#include "shaders/diffuseVS.hlsl.h" -#include "shaders/diffuseGS.hlsl.h" -#include "shaders/diffusePS.hlsl.h" +#include "../d3d/shaders/diffuseVS.hlsl.h" +#include "../d3d/shaders/diffuseGS.hlsl.h" +#include "../d3d/shaders/diffusePS.hlsl.h" -#define EXCLUDE_SHADER_STRUCTS 1 -#include "shaders/shaderCommon.h" +#include "../d3d/shaderCommonD3D.h" - -void DiffuseRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) +void DiffuseRendererD3D11::init(ID3D11Device* device, ID3D11DeviceContext* context) { m_device = device; m_deviceContext = context; @@ -48,9 +46,9 @@ void DiffuseRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) } // create the shaders - m_device->CreateVertexShader(g_diffuseVS, sizeof(g_diffuseVS), nullptr, &m_diffuseVS); - m_device->CreateGeometryShader(g_diffuseGS, sizeof(g_diffuseGS), nullptr, &m_diffuseGS); - m_device->CreatePixelShader(g_diffusePS, sizeof(g_diffusePS), nullptr, &m_diffusePS); + m_device->CreateVertexShader(g_diffuseVS, sizeof(g_diffuseVS), nullptr, &m_diffuseVs); + m_device->CreateGeometryShader(g_diffuseGS, sizeof(g_diffuseGS), nullptr, &m_diffuseGs); + m_device->CreatePixelShader(g_diffusePS, sizeof(g_diffusePS), nullptr, &m_diffusePs); { D3D11_BLEND_DESC blendDesc = {}; @@ -80,7 +78,7 @@ void DiffuseRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) // create a constant buffer { D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(DiffuseShaderConst); // 64 * sizeof(float); + bufDesc.ByteWidth = sizeof(Hlsl::DiffuseShaderConst); // 64 * sizeof(float); bufDesc.Usage = D3D11_USAGE_DYNAMIC; bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; @@ -107,77 +105,43 @@ void DiffuseRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) } } -void DiffuseRenderer::Destroy() -{ - COMRelease(m_inputLayout); - COMRelease(m_diffuseVS); - COMRelease(m_diffuseGS); - COMRelease(m_diffusePS); - COMRelease(m_constantBuffer); - COMRelease(m_rasterizerState); - COMRelease(m_blendState); - COMRelease(m_depthStencilState); -} - - - -void DiffuseRenderer::Draw(const DiffuseDrawParams* params, ID3D11Buffer* positions, ID3D11Buffer* velocities, ID3D11Buffer* indices, int numParticles) +void DiffuseRendererD3D11::draw(const DiffuseDrawParamsD3D* params, ID3D11Buffer* positions, ID3D11Buffer* velocities, int numParticles) { using namespace DirectX; - ID3D11DeviceContext* deviceContext = m_deviceContext; // update constant buffer { D3D11_MAPPED_SUBRESOURCE mappedResource = { 0 }; - if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) + if (SUCCEEDED(deviceContext->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) { - DiffuseShaderConst cParams; - - cParams.modelViewProjection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection)); - cParams.modelView = (float4x4&)XMMatrixMultiply(params->model, params->view); - cParams.projection = (float4x4&)params->projection; - - cParams.motionBlurScale = params->motionScale; - cParams.diffuseRadius = params->diffuseRadius; - cParams.diffuseScale = params->diffuseScale; - cParams.spotMin = params->spotMin; - cParams.spotMax = params->spotMax; - - cParams.lightTransform = (float4x4&)params->lightTransform; - cParams.lightPos = params->lightPos; - cParams.lightDir = params->lightDir; - cParams.color = params->color; - - - memcpy(cParams.shadowTaps, params->shadowTaps, sizeof(cParams.shadowTaps)); - - memcpy(mappedResource.pData, &cParams, sizeof(DiffuseShaderConst)); - - deviceContext->Unmap(m_constantBuffer, 0u); + Hlsl::DiffuseShaderConst constBuf; + RenderParamsUtilD3D::calcDiffuseConstantBuffer(*params, constBuf); + memcpy(mappedResource.pData, &constBuf, sizeof(Hlsl::DiffuseShaderConst)); + deviceContext->Unmap(m_constantBuffer.Get(), 0u); } } - deviceContext->VSSetShader(m_diffuseVS, nullptr, 0u); - deviceContext->GSSetShader(m_diffuseGS, nullptr, 0u); - deviceContext->PSSetShader(m_diffusePS, nullptr, 0u); + deviceContext->VSSetShader(m_diffuseVs.Get(), nullptr, 0u); + deviceContext->GSSetShader(m_diffuseGs.Get(), nullptr, 0u); + deviceContext->PSSetShader(m_diffusePs.Get(), nullptr, 0u); if (params->shadowMap) { - ShadowMap* shadowMap = (ShadowMap*)params->shadowMap; + ShadowMapD3D11* shadowMap = (ShadowMapD3D11*)params->shadowMap; - ID3D11ShaderResourceView* ppSRV[1] = { shadowMap->m_depthSrv.Get() }; - deviceContext->PSSetShaderResources(0, 1, ppSRV); - ID3D11SamplerState* ppSS[1] = { shadowMap->m_linearSampler.Get() }; - deviceContext->PSSetSamplers(0, 1, ppSS); + ID3D11ShaderResourceView* srvs[1] = { shadowMap->m_depthSrv.Get() }; + deviceContext->PSSetShaderResources(0, 1, srvs); + ID3D11SamplerState* samps[1] = { shadowMap->m_linearSampler.Get() }; + deviceContext->PSSetSamplers(0, 1, samps); } - deviceContext->IASetInputLayout(m_inputLayout); + deviceContext->IASetInputLayout(m_inputLayout.Get()); deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); - deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->GSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer); + deviceContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->GSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->PSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); ID3D11Buffer* vertexBuffers[2] = { @@ -194,24 +158,25 @@ void DiffuseRenderer::Draw(const DiffuseDrawParams* params, ID3D11Buffer* positi unsigned int vertexBufferOffsets[2] = { 0 }; deviceContext->IASetVertexBuffers(0, 2, vertexBuffers, vertexBufferStrides, vertexBufferOffsets); - deviceContext->IASetIndexBuffer(indices, DXGI_FORMAT_R32_UINT, 0u); + deviceContext->IASetIndexBuffer(NV_NULL, DXGI_FORMAT_R32_UINT, 0u); - deviceContext->OMSetBlendState(m_blendState, nullptr, 0xFFFFFFFF); - deviceContext->OMSetDepthStencilState(m_depthStencilState, 0u); + deviceContext->OMSetBlendState(m_blendState.Get(), nullptr, 0xFFFFFFFF); + deviceContext->OMSetDepthStencilState(m_depthStencilState.Get(), 0u); float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); if (depthSign < 0.f) { - deviceContext->RSSetState(m_rasterizerState); + deviceContext->RSSetState(m_rasterizerState.Get()); } - deviceContext->DrawIndexed(numParticles, 0, 0); + deviceContext->Draw(numParticles, 0); if (depthSign < 0.f) { deviceContext->RSSetState(nullptr); } + deviceContext->GSSetShader(nullptr, nullptr, 0u); deviceContext->OMSetDepthStencilState(nullptr, 0u); deviceContext->OMSetBlendState(nullptr, nullptr, 0xFFFFFFFF); } diff --git a/demo/d3d11/diffuseRenderD3D11.h b/demo/d3d11/diffuseRenderD3D11.h new file mode 100644 index 0000000..cf4231e --- /dev/null +++ b/demo/d3d11/diffuseRenderD3D11.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#include <DirectXMath.h> + +#include "shadowMapD3D11.h" +#include "../include/NvFlex.h" +#include "../d3d/renderParamsD3D.h" +#include "shaders.h" + +#include <wrl.h> +using namespace Microsoft::WRL; + +// vertex buffers for diffuse particles +struct DiffuseRenderBuffersD3D11 +{ + DiffuseRenderBuffersD3D11() : + m_positionsBuf(nullptr), + m_velocitiesBuf(nullptr) + { + m_numParticles = 0; + } + + ~DiffuseRenderBuffersD3D11() + { + if (m_numParticles > 0) + { + NvFlexUnregisterD3DBuffer(m_positionsBuf); + NvFlexUnregisterD3DBuffer(m_velocitiesBuf); + } + } + + int m_numParticles; + + ComPtr<ID3D11Buffer> m_positions; + ComPtr<ID3D11Buffer> m_velocities; + + NvFlexBuffer* m_positionsBuf; + NvFlexBuffer* m_velocitiesBuf; +}; + +struct DiffuseRendererD3D11 +{ + void init(ID3D11Device* device, ID3D11DeviceContext* deviceContext); + + void draw(const DiffuseDrawParamsD3D* params, ID3D11Buffer* positions, ID3D11Buffer* velocities, int numParticles); + + DiffuseRendererD3D11(): + m_device(nullptr), + m_deviceContext(nullptr) + {} + + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceContext; + + ComPtr<ID3D11InputLayout> m_inputLayout; + + ComPtr<ID3D11VertexShader> m_diffuseVs; + ComPtr<ID3D11GeometryShader> m_diffuseGs; + ComPtr<ID3D11PixelShader> m_diffusePs; + + ComPtr<ID3D11Buffer> m_constantBuffer; + ComPtr<ID3D11RasterizerState> m_rasterizerState; + + ComPtr<ID3D11BlendState> m_blendState; + ComPtr<ID3D11DepthStencilState> m_depthStencilState; +}; diff --git a/demo/d3d11/fluidRender.cpp b/demo/d3d11/fluidRender.cpp deleted file mode 100644 index f9dd767..0000000 --- a/demo/d3d11/fluidRender.cpp +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -//direct3d headers - -#define NOMINMAX - -#include <d3d11.h> - -// include the Direct3D Library file -#pragma comment (lib, "d3d11.lib") - -#include <math.h> - -#include "appD3D11Ctx.h" - -#include "fluidRender.h" - -#include "shaders/ellipsoidDepthVS.hlsl.h" -#include "shaders/ellipsoidDepthGS.hlsl.h" -#include "shaders/ellipsoidDepthPS.hlsl.h" -#include "shaders/passThroughVS.hlsl.h" -#include "shaders/blurDepthPS.hlsl.h" -#include "shaders/compositePS.hlsl.h" - -#define EXCLUDE_SHADER_STRUCTS 1 -#include "shaders/shaderCommon.h" - -#include "renderTarget.h" -#include "shadowMap.h" - -#include "shaders.h" - -typedef DirectX::XMFLOAT2 float2; - -using namespace DirectX; - - -struct PassthroughVertex -{ - float x, y; - float u, v; -}; - -void FluidRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context, int width, int height) -{ - mSceneWidth = width; - mSceneHeight = height; - - mDepthTex.Init(device, width, height); - mDepthSmoothTex.Init(device, width, height, false); - - m_device = device; - m_deviceContext = context; - - // create the input layout - { - D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "U", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "V", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 2, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "W", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 3, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - - m_device->CreateInputLayout(inputElementDescs, 4, g_ellipsoidDepthVS, sizeof(g_ellipsoidDepthVS), &m_ellipsoidDepthLayout); - } - - // create the shaders - m_device->CreateVertexShader(g_ellipsoidDepthVS, sizeof(g_ellipsoidDepthVS), nullptr, &m_ellipsoidDepthVS); - m_device->CreateGeometryShader(g_ellipsoidDepthGS, sizeof(g_ellipsoidDepthGS), nullptr, &m_ellipsoidDepthGS); - m_device->CreatePixelShader(g_ellipsoidDepthPS, sizeof(g_ellipsoidDepthPS), nullptr, &m_ellipsoidDepthPS); - - // create the input layout - { - D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - - m_device->CreateInputLayout(inputElementDescs, 2, g_passThroughVS, sizeof(g_passThroughVS), &m_passThroughLayout); - } - - // pass through shader - m_device->CreateVertexShader(g_passThroughVS, sizeof(g_passThroughVS), nullptr, &m_passThroughVS); - - // full screen pixel shaders - m_device->CreatePixelShader(g_blurDepthPS, sizeof(g_blurDepthPS), nullptr, &m_blurDepthPS); - m_device->CreatePixelShader(g_compositePS, sizeof(g_compositePS), nullptr, &m_compositePS); - - // create a constant buffer - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(FluidShaderConst); // 64 * sizeof(float); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - - m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer); - } - - // create the rastersizer state - for (int i = 0; i < NUM_FLUID_RENDER_MODES; i++) - { - for (int j = 0; j < NUM_FLUID_CULL_MODES; j++) - - { - D3D11_RASTERIZER_DESC desc = {}; - desc.FillMode = (D3D11_FILL_MODE)(D3D11_FILL_WIREFRAME + i); - desc.CullMode = (D3D11_CULL_MODE)(D3D11_CULL_NONE + j); - desc.FrontCounterClockwise = TRUE; // This is non-default - desc.DepthBias = 0; - desc.DepthBiasClamp = 0.f; - desc.SlopeScaledDepthBias = 0.f; - desc.DepthClipEnable = TRUE; - desc.ScissorEnable = FALSE; - desc.MultisampleEnable = FALSE; - desc.AntialiasedLineEnable = FALSE; - - m_device->CreateRasterizerState(&desc, &m_rasterizerStateRH[i][j]); - } - } - - CreateScreenQuad(); -} - -void FluidRenderer::Destroy() -{ - COMRelease(m_ellipsoidDepthLayout); - COMRelease(m_ellipsoidDepthVS); - COMRelease(m_ellipsoidDepthGS); - COMRelease(m_ellipsoidDepthPS); - - COMRelease(m_passThroughLayout); - COMRelease(m_passThroughVS); - - COMRelease(m_blurDepthPS); - COMRelease(m_compositePS); - - COMRelease(m_constantBuffer); - - for (int i = 0; i < NUM_FLUID_RENDER_MODES; i++) - for (int j = 0; j < NUM_FLUID_CULL_MODES; j++) - COMRelease(m_rasterizerStateRH[i][j]); - - COMRelease(m_quadVertexBuffer); - COMRelease(m_quadIndexBuffer); -} - -void FluidRenderer::CreateScreenQuad() -{ - // create an index buffer - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = 4*sizeof(UINT); - bufDesc.Usage = D3D11_USAGE_IMMUTABLE; - bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; - bufDesc.CPUAccessFlags = DXGI_CPU_ACCESS_NONE; - bufDesc.MiscFlags = 0; - - unsigned int quad_indices[4] = { 0, 1, 3, 2 }; - - D3D11_SUBRESOURCE_DATA data = { 0 }; - data.pSysMem = quad_indices; - - m_device->CreateBuffer(&bufDesc, &data, &m_quadIndexBuffer); - } - - // create a vertex buffer - { - - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = 4*sizeof(PassthroughVertex); - bufDesc.Usage = D3D11_USAGE_IMMUTABLE; - bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bufDesc.CPUAccessFlags = DXGI_CPU_ACCESS_NONE; - bufDesc.MiscFlags = 0; - - D3D11_SUBRESOURCE_DATA data = { 0 }; - - - float4 vertices[4] = - { - float4(-1.0f, -1.0f, 0.0f, 0.0f), - float4(1.0f, -1.0f, 1.0f, 0.0f), - float4(1.0f, 1.0f, 1.0f, 1.0f), - float4(-1.0f, 1.0f, 0.0f, 1.0f), - }; - - data.pSysMem = vertices; - - m_device->CreateBuffer(&bufDesc, &data, &m_quadVertexBuffer); - } -} - -void FluidRenderer::DrawEllipsoids(const FluidDrawParams* params, const FluidRenderBuffers* buffers) -{ - ID3D11DeviceContext* deviceContext = m_deviceContext; - - // update constant buffer - { - - D3D11_BUFFER_DESC desc; - m_constantBuffer->GetDesc(&desc); - - D3D11_MAPPED_SUBRESOURCE mappedResource = {}; - if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) - { - FluidShaderConst cParams; - - cParams.modelviewprojection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection)); - cParams.projection = (float4x4&)params->projection; - cParams.modelview_inverse = (float4x4&)XMMatrixInverse(nullptr, XMMatrixMultiply(params->model, params->view)); - cParams.projection_inverse = (float4x4&)XMMatrixInverse(nullptr, params->projection); - - //cParams.invTexScale = invTexScale; - //cParams.invProjection = invProjection; - cParams.invViewport = params->invViewport; - - - cParams.blurRadiusWorld = params->blurRadiusWorld; - cParams.blurScale = params->blurScale; - cParams.blurFalloff = params->blurFalloff; - cParams.debug = params->debug; - - memcpy(mappedResource.pData, &cParams, sizeof(FluidShaderConst)); - - deviceContext->Unmap(m_constantBuffer, 0u); - } - } - - deviceContext->VSSetShader(m_ellipsoidDepthVS, nullptr, 0u); - deviceContext->GSSetShader(m_ellipsoidDepthGS, nullptr, 0u); - deviceContext->PSSetShader(m_ellipsoidDepthPS, nullptr, 0u); - - deviceContext->IASetInputLayout(m_ellipsoidDepthLayout); - deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); - - deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->GSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer); - - ID3D11Buffer* vertexBuffers[4] = - { - buffers->mPositionVBO, - buffers->mAnisotropyVBO[0], - buffers->mAnisotropyVBO[1], - buffers->mAnisotropyVBO[2] - }; - - unsigned int vertexBufferStrides[4] = - { - sizeof(float4), - sizeof(float4), - sizeof(float4), - sizeof(float4) - }; - - unsigned int vertexBufferOffsets[4] = { 0 }; - - deviceContext->IASetVertexBuffers(0, 4, vertexBuffers, vertexBufferStrides, vertexBufferOffsets); - deviceContext->IASetIndexBuffer(buffers->mIndices, DXGI_FORMAT_R32_UINT, 0u); - - float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); - if (depthSign < 0.f) - { - deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]); - } - - deviceContext->DrawIndexed(params->n, params->offset, 0); - - if (depthSign < 0.f) - { - deviceContext->RSSetState(nullptr); - } -} - -void FluidRenderer::DrawBlurDepth(const FluidDrawParams* params) -{ - ID3D11DeviceContext* deviceContext = m_deviceContext; - - // update constant buffer - { - D3D11_MAPPED_SUBRESOURCE mappedResource = {}; - if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) - { - FluidShaderConst cParams; - - cParams.modelviewprojection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection)); - cParams.projection = (float4x4&)params->projection; - cParams.modelview_inverse = (float4x4&)XMMatrixInverse(nullptr, XMMatrixMultiply(params->model, params->view)); - cParams.projection_inverse = (float4x4&)XMMatrixInverse(nullptr, params->projection); - - //cParams.invTexScale = params->invTexScale; - //cParams.invViewport = params->invViewport; - //cParams.invProjection = params->invProjection; - - cParams.blurRadiusWorld = params->blurRadiusWorld; - cParams.blurScale = params->blurScale; - cParams.blurFalloff = params->blurFalloff; - cParams.debug = params->debug; - - memcpy(mappedResource.pData, &cParams, sizeof(FluidShaderConst)); - - deviceContext->Unmap(m_constantBuffer, 0u); - } - } - - deviceContext->VSSetShader(m_passThroughVS, nullptr, 0u); - deviceContext->GSSetShader(nullptr, nullptr, 0u); - deviceContext->PSSetShader(m_blurDepthPS, nullptr, 0u); - - ID3D11ShaderResourceView* ppSRV[1] = { mDepthTex.m_backSrv.Get() }; - deviceContext->PSSetShaderResources(0, 1, ppSRV); - - deviceContext->IASetInputLayout(m_passThroughLayout); - deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); - - deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer); - - UINT vertexStride = sizeof(PassthroughVertex); - UINT offset = 0u; - deviceContext->IASetVertexBuffers(0, 1, &m_quadVertexBuffer, &vertexStride, &offset); - deviceContext->IASetIndexBuffer(m_quadIndexBuffer, DXGI_FORMAT_R32_UINT, 0u); - - float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); - if (depthSign < 0.f) - { - deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]); - } - - deviceContext->DrawIndexed((UINT)4, 0, 0); - - if (depthSign < 0.f) - { - deviceContext->RSSetState(nullptr); - } -} - -void FluidRenderer::DrawComposite(const FluidDrawParams* params, ID3D11ShaderResourceView* sceneMap) -{ - ID3D11DeviceContext* deviceContext = m_deviceContext; - - // update constant buffer - { - D3D11_MAPPED_SUBRESOURCE mappedResource = {}; - if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) - { - FluidShaderConst cParams; - - cParams.modelviewprojection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection)); - cParams.modelview = (float4x4&)XMMatrixMultiply(params->model, params->view); - cParams.projection = (float4x4&)params->projection; - cParams.modelview_inverse = (float4x4&)XMMatrixInverse(nullptr, XMMatrixMultiply(params->model, params->view)); - cParams.projection_inverse = (float4x4&)XMMatrixInverse(nullptr, params->projection); - - cParams.lightTransform = (float4x4&)params->lightTransform; - - cParams.invTexScale = params->invTexScale; - - //cParams.invViewport = params->invViewport; - //cParams.invProjection = params->invProjection; - - cParams.blurRadiusWorld = params->blurRadiusWorld; - cParams.blurScale = params->blurScale; - cParams.blurFalloff = params->blurFalloff; - cParams.debug = params->debug; - - cParams.clipPosToEye = params->clipPosToEye; - cParams.color = params->color; - cParams.ior = params->ior; - cParams.spotMin = params->spotMin; - cParams.spotMax = params->spotMax; - - cParams.lightPos = params->lightPos; - cParams.lightDir = params->lightDir; - - memcpy(mappedResource.pData, &cParams, sizeof(FluidShaderConst)); - - deviceContext->Unmap(m_constantBuffer, 0u); - - const float2 taps[] = - { - float2(-0.326212f,-0.40581f), float2(-0.840144f,-0.07358f), - float2(-0.695914f,0.457137f), float2(-0.203345f,0.620716f), - float2(0.96234f,-0.194983f), float2(0.473434f,-0.480026f), - float2(0.519456f,0.767022f), float2(0.185461f,-0.893124f), - float2(0.507431f,0.064425f), float2(0.89642f,0.412458f), - float2(-0.32194f,-0.932615f), float2(-0.791559f,-0.59771f) - }; - memcpy(cParams.shadowTaps, taps, sizeof(taps)); - } - } - - deviceContext->VSSetShader(m_passThroughVS, nullptr, 0u); - deviceContext->GSSetShader(nullptr, nullptr, 0u); - deviceContext->PSSetShader(m_compositePS, nullptr, 0u); - - - RenderTarget* depthMap = &mDepthSmoothTex; - ShadowMap* shadowMap = (ShadowMap*)params->shadowMap; - - ID3D11ShaderResourceView* ppSRV[3] = - { - depthMap->m_backSrv.Get(), - sceneMap, - shadowMap->m_depthSrv.Get() - - }; - deviceContext->PSSetShaderResources(0, 3, ppSRV); - - ID3D11SamplerState* ppSS[2] = - { - depthMap->m_linearSampler.Get() , - shadowMap->m_linearSampler.Get() - }; - deviceContext->PSSetSamplers(0, 2, ppSS); - - - deviceContext->IASetInputLayout(m_passThroughLayout); - deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); - - deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer); - - UINT vertexStride = sizeof(PassthroughVertex); - UINT offset = 0u; - deviceContext->IASetVertexBuffers(0, 1, &m_quadVertexBuffer, &vertexStride, &offset); - deviceContext->IASetIndexBuffer(m_quadIndexBuffer, DXGI_FORMAT_R32_UINT, 0u); - - float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); - if (depthSign < 0.f) - { - deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]); - } - - deviceContext->DrawIndexed((UINT)4, 0, 0); - - if (depthSign < 0.f) - { - deviceContext->RSSetState(nullptr); - } - - // reset srvs - ID3D11ShaderResourceView* zero[3] = { NULL, NULL, NULL }; - deviceContext->PSSetShaderResources(0, 3, zero); -} - diff --git a/demo/d3d11/fluidRender.h b/demo/d3d11/fluidRender.h deleted file mode 100644 index 43fee4b..0000000 --- a/demo/d3d11/fluidRender.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -#pragma once - -#include <DirectXMath.h> - -#include <d3d11.h> - -#include "renderTarget.h" -#include "shadowMap.h" - -struct FluidRenderBuffers; - -enum FluidRenderMode -{ - FLUID_RENDER_WIREFRAME, - FLUID_RENDER_SOLID, - NUM_FLUID_RENDER_MODES -}; - -enum FluidCullMode -{ - FLUID_CULL_NONE, - FLUID_CULL_FRONT, - FLUID_CULL_BACK, - NUM_FLUID_CULL_MODES -}; - -enum FluidDrawStage -{ - FLUID_DRAW_NULL, - FLUID_DRAW_SHADOW, - FLUID_DRAW_REFLECTION, - FLUID_DRAW_LIGHT -}; - -typedef DirectX::XMFLOAT3 float3; -typedef DirectX::XMFLOAT4 float4; -typedef DirectX::XMFLOAT4X4 float4x4; - -struct FluidDrawParams -{ - FluidRenderMode renderMode; - FluidCullMode cullMode; - FluidDrawStage renderStage; - - int offset; - int n; - - DirectX::XMMATRIX projection; - DirectX::XMMATRIX view; - DirectX::XMMATRIX model; - - float4 invTexScale; - - float3 invViewport; - float3 invProjection; - - float blurRadiusWorld; - float blurScale; - float blurFalloff; - int debug; - - float3 lightPos; - float3 lightDir; - DirectX::XMMATRIX lightTransform; - - float4 color; - float4 clipPosToEye; - - float spotMin; - float spotMax; - float ior; - - ShadowMap* shadowMap; -}; - - -struct FluidRenderer -{ - ID3D11Device* m_device = nullptr; - ID3D11DeviceContext* m_deviceContext = nullptr; - - ID3D11InputLayout* m_ellipsoidDepthLayout = nullptr; - ID3D11VertexShader* m_ellipsoidDepthVS = nullptr; - ID3D11GeometryShader* m_ellipsoidDepthGS = nullptr; - ID3D11PixelShader* m_ellipsoidDepthPS = nullptr; - - ID3D11InputLayout* m_passThroughLayout = nullptr; - ID3D11VertexShader* m_passThroughVS = nullptr; - - ID3D11PixelShader* m_blurDepthPS = nullptr; - ID3D11PixelShader* m_compositePS = nullptr; - - ID3D11Buffer* m_constantBuffer = nullptr; - ID3D11RasterizerState* m_rasterizerStateRH[NUM_FLUID_RENDER_MODES][NUM_FLUID_CULL_MODES]; - - ID3D11Buffer* m_quadVertexBuffer; - ID3D11Buffer* m_quadIndexBuffer; - - RenderTarget mDepthTex; - RenderTarget mDepthSmoothTex; - RenderTarget mThicknessTex; - - int mSceneWidth; - int mSceneHeight; - - void Init(ID3D11Device* device, ID3D11DeviceContext* context, int width, int height); - void Destroy(); - - void DrawEllipsoids(const FluidDrawParams* params, const FluidRenderBuffers* buffers); - void DrawBlurDepth(const FluidDrawParams* params); - void DrawComposite(const FluidDrawParams* params, ID3D11ShaderResourceView* sceneMap); - - void CreateScreenQuad(); -}; - - diff --git a/demo/d3d11/fluidRenderD3D11.cpp b/demo/d3d11/fluidRenderD3D11.cpp new file mode 100644 index 0000000..fa36f9b --- /dev/null +++ b/demo/d3d11/fluidRenderD3D11.cpp @@ -0,0 +1,365 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +//direct3d headers + +#define NOMINMAX + +#include <d3d11.h> + +// include the Direct3D Library file +#pragma comment (lib, "d3d11.lib") + +#include <math.h> + +#include "appD3D11Ctx.h" + +#include "fluidRenderD3D11.h" + +#include "../d3d/shaders/ellipsoidDepthVS.hlsl.h" +#include "../d3d/shaders/ellipsoidDepthGS.hlsl.h" +#include "../d3d/shaders/ellipsoidDepthPS.hlsl.h" +#include "../d3d/shaders/passThroughVS.hlsl.h" +#include "../d3d/shaders/blurDepthPS.hlsl.h" +#include "../d3d/shaders/compositePS.hlsl.h" + +#include "../d3d/shaderCommonD3D.h" + +#include "renderTargetD3D11.h" +#include "shadowMapD3D11.h" + +#include "shaders.h" + +typedef DirectX::XMFLOAT2 float2; + +using namespace DirectX; + +struct PassthroughVertex +{ + float3 position; + float3 normal; + float2 texcoords; + float4 color; +}; + +void FluidRendererD3D11::init(ID3D11Device* device, ID3D11DeviceContext* context, int width, int height) +{ + m_sceneWidth = width; + m_sceneHeight = height; + + m_depthTexture.init(device, width, height); + m_depthSmoothTexture.init(device, width, height, false); + + m_device = device; + m_deviceContext = context; + + // create the input layout + { + D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "U", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "V", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 2, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "W", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 3, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + + m_device->CreateInputLayout(inputElementDescs, 4, g_ellipsoidDepthVS, sizeof(g_ellipsoidDepthVS), &m_ellipsoidDepthLayout); + } + + // create the shaders + m_device->CreateVertexShader(g_ellipsoidDepthVS, sizeof(g_ellipsoidDepthVS), nullptr, &m_ellipsoidDepthVs); + m_device->CreateGeometryShader(g_ellipsoidDepthGS, sizeof(g_ellipsoidDepthGS), nullptr, &m_ellipsoidDepthGs); + m_device->CreatePixelShader(g_ellipsoidDepthPS, sizeof(g_ellipsoidDepthPS), nullptr, &m_ellipsoidDepthPs); + + // create the input layout + { + D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 } + }; + + m_device->CreateInputLayout(inputElementDescs, 4, g_passThroughVS, sizeof(g_passThroughVS), &m_passThroughLayout); + } + + // pass through shader + m_device->CreateVertexShader(g_passThroughVS, sizeof(g_passThroughVS), nullptr, &m_passThroughVs); + + // full screen pixel shaders + m_device->CreatePixelShader(g_blurDepthPS, sizeof(g_blurDepthPS), nullptr, &m_blurDepthPs); + m_device->CreatePixelShader(g_compositePS, sizeof(g_compositePS), nullptr, &m_compositePs); + + // create a constant buffer + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = sizeof(Hlsl::FluidShaderConst); // 64 * sizeof(float); + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + + m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer); + } + + // create the rastersizer state + for (int i = 0; i < NUM_FLUID_RENDER_MODES; i++) + { + for (int j = 0; j < NUM_FLUID_CULL_MODES; j++) + { + D3D11_RASTERIZER_DESC desc = {}; + desc.FillMode = (D3D11_FILL_MODE)(D3D11_FILL_WIREFRAME + i); + desc.CullMode = (D3D11_CULL_MODE)(D3D11_CULL_NONE + j); + desc.FrontCounterClockwise = TRUE; // This is non-default + desc.DepthBias = 0; + desc.DepthBiasClamp = 0.f; + desc.SlopeScaledDepthBias = 0.f; + desc.DepthClipEnable = TRUE; + desc.ScissorEnable = FALSE; + desc.MultisampleEnable = FALSE; + desc.AntialiasedLineEnable = FALSE; + + m_device->CreateRasterizerState(&desc, &m_rasterizerState[i][j]); + } + } + + _createScreenQuad(); +} + +void FluidRendererD3D11::_createScreenQuad() +{ + // create an index buffer + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = 4*sizeof(UINT); + bufDesc.Usage = D3D11_USAGE_IMMUTABLE; + bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; + bufDesc.CPUAccessFlags = DXGI_CPU_ACCESS_NONE; + bufDesc.MiscFlags = 0; + + unsigned int quad_indices[4] = { 0, 1, 3, 2 }; + + D3D11_SUBRESOURCE_DATA data = { 0 }; + data.pSysMem = quad_indices; + + m_device->CreateBuffer(&bufDesc, &data, &m_quadIndexBuffer); + } + + // create a vertex buffer + { + + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = 4*sizeof(PassthroughVertex); + bufDesc.Usage = D3D11_USAGE_IMMUTABLE; + bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufDesc.CPUAccessFlags = DXGI_CPU_ACCESS_NONE; + bufDesc.MiscFlags = 0; + + D3D11_SUBRESOURCE_DATA data = { 0 }; + + + PassthroughVertex vertices[4] = + { + { {-1.0f, -1.0f, 0.0f}, {0, 1, 0}, {0.0f, 0.0f}, {1, 1, 1, 1}}, + { { 1.0f, -1.0f, 0.0f}, {0, 1, 0}, {1.0f, 0.0f}, {1, 1, 1, 1}}, + { { 1.0f, 1.0f, 0.0f}, {0, 1, 0}, {1.0f, 1.0f}, {1, 1, 1, 1}}, + { {-1.0f, 1.0f, 0.0f}, {0, 1, 0}, {0.0f, 1.0f}, {1, 1, 1, 1}}, + }; + + data.pSysMem = vertices; + + m_device->CreateBuffer(&bufDesc, &data, &m_quadVertexBuffer); + } +} + +void FluidRendererD3D11::drawEllipsoids(const FluidDrawParamsD3D* params, const FluidRenderBuffersD3D11* buffers) +{ + ID3D11DeviceContext* deviceContext = m_deviceContext; + + // update constant buffer + { + + D3D11_BUFFER_DESC desc; + m_constantBuffer->GetDesc(&desc); + + D3D11_MAPPED_SUBRESOURCE mappedResource = {}; + if (SUCCEEDED(deviceContext->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) + { + Hlsl::FluidShaderConst constBuf; + RenderParamsUtilD3D::calcFluidConstantBuffer(*params, constBuf); + memcpy(mappedResource.pData, &constBuf, sizeof(Hlsl::FluidShaderConst)); + deviceContext->Unmap(m_constantBuffer.Get(), 0u); + } + } + + deviceContext->VSSetShader(m_ellipsoidDepthVs.Get(), nullptr, 0u); + deviceContext->GSSetShader(m_ellipsoidDepthGs.Get(), nullptr, 0u); + deviceContext->PSSetShader(m_ellipsoidDepthPs.Get(), nullptr, 0u); + + deviceContext->IASetInputLayout(m_ellipsoidDepthLayout.Get()); + deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); + + deviceContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->GSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->PSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + + ID3D11Buffer* vertexBuffers[4] = + { + buffers->m_positions.Get(), + buffers->m_anisotropiesArr[0].Get(), + buffers->m_anisotropiesArr[1].Get(), + buffers->m_anisotropiesArr[2].Get() + }; + + unsigned int vertexBufferStrides[4] = + { + sizeof(float4), + sizeof(float4), + sizeof(float4), + sizeof(float4) + }; + + unsigned int vertexBufferOffsets[4] = { 0 }; + + deviceContext->IASetVertexBuffers(0, 4, vertexBuffers, vertexBufferStrides, vertexBufferOffsets); + deviceContext->IASetIndexBuffer(buffers->m_indices.Get(), DXGI_FORMAT_R32_UINT, 0u); + + float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); + if (depthSign < 0.f) + { + deviceContext->RSSetState(m_rasterizerState[params->renderMode][params->cullMode].Get()); + } + + deviceContext->DrawIndexed(params->n, params->offset, 0); + + if (depthSign < 0.f) + { + deviceContext->RSSetState(nullptr); + } +} + +void FluidRendererD3D11::drawBlurDepth(const FluidDrawParamsD3D* params) +{ + ID3D11DeviceContext* deviceContext = m_deviceContext; + + // update constant buffer + { + D3D11_MAPPED_SUBRESOURCE mappedResource = {}; + if (SUCCEEDED(deviceContext->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) + { + Hlsl::FluidShaderConst constBuf; + RenderParamsUtilD3D::calcFluidConstantBuffer(*params, constBuf); + memcpy(mappedResource.pData, &constBuf, sizeof(Hlsl::FluidShaderConst)); + deviceContext->Unmap(m_constantBuffer.Get(), 0u); + } + } + + deviceContext->VSSetShader(m_passThroughVs.Get(), nullptr, 0u); + deviceContext->GSSetShader(nullptr, nullptr, 0u); + deviceContext->PSSetShader(m_blurDepthPs.Get(), nullptr, 0u); + + ID3D11ShaderResourceView* srvs[1] = { m_depthTexture.m_backSrv.Get() }; + deviceContext->PSSetShaderResources(0, 1, srvs); + + deviceContext->IASetInputLayout(m_passThroughLayout.Get()); + deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + + deviceContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->PSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + + UINT vertexStride = sizeof(PassthroughVertex); + UINT offset = 0u; + deviceContext->IASetVertexBuffers(0, 1, m_quadVertexBuffer.GetAddressOf(), &vertexStride, &offset); + deviceContext->IASetIndexBuffer(m_quadIndexBuffer.Get(), DXGI_FORMAT_R32_UINT, 0u); + + float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); + if (depthSign < 0.f) + { + deviceContext->RSSetState(m_rasterizerState[params->renderMode][params->cullMode].Get()); + } + + deviceContext->DrawIndexed((UINT)4, 0, 0); + + if (depthSign < 0.f) + { + deviceContext->RSSetState(nullptr); + } +} + +void FluidRendererD3D11::drawComposite(const FluidDrawParamsD3D* params, ID3D11ShaderResourceView* sceneMap) +{ + ID3D11DeviceContext* deviceContext = m_deviceContext; + + // update constant buffer + { + D3D11_MAPPED_SUBRESOURCE mappedResource = {}; + if (SUCCEEDED(deviceContext->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) + { + Hlsl::FluidShaderConst constBuf; + RenderParamsUtilD3D::calcFluidCompositeConstantBuffer(*params, constBuf); + memcpy(mappedResource.pData, &constBuf, sizeof(Hlsl::FluidShaderConst)); + deviceContext->Unmap(m_constantBuffer.Get(), 0u); + } + } + + deviceContext->VSSetShader(m_passThroughVs.Get(), nullptr, 0u); + deviceContext->GSSetShader(nullptr, nullptr, 0u); + deviceContext->PSSetShader(m_compositePs.Get(), nullptr, 0u); + + RenderTargetD3D11* depthMap = &m_depthSmoothTexture; + ShadowMapD3D11* shadowMap = (ShadowMapD3D11*)params->shadowMap; + + ID3D11ShaderResourceView* srvs[3] = + { + depthMap->m_backSrv.Get(), + sceneMap, + shadowMap->m_depthSrv.Get() + + }; + deviceContext->PSSetShaderResources(0, 3, srvs); + + ID3D11SamplerState* samps[2] = + { + depthMap->m_linearSampler.Get() , + shadowMap->m_linearSampler.Get() + }; + deviceContext->PSSetSamplers(0, 2, samps); + + + deviceContext->IASetInputLayout(m_passThroughLayout.Get()); + deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + + deviceContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->PSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + + UINT vertexStride = sizeof(PassthroughVertex); + UINT offset = 0u; + deviceContext->IASetVertexBuffers(0, 1, m_quadVertexBuffer.GetAddressOf(), &vertexStride, &offset); + deviceContext->IASetIndexBuffer(m_quadIndexBuffer.Get(), DXGI_FORMAT_R32_UINT, 0u); + + float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); + if (depthSign < 0.f) + { + deviceContext->RSSetState(m_rasterizerState[params->renderMode][params->cullMode].Get()); + } + + deviceContext->DrawIndexed((UINT)4, 0, 0); + + if (depthSign < 0.f) + { + deviceContext->RSSetState(nullptr); + } + + // reset srvs + ID3D11ShaderResourceView* zero[3] = { NULL, NULL, NULL }; + deviceContext->PSSetShaderResources(0, 3, zero); +} + diff --git a/demo/d3d11/fluidRenderD3D11.h b/demo/d3d11/fluidRenderD3D11.h new file mode 100644 index 0000000..ad59534 --- /dev/null +++ b/demo/d3d11/fluidRenderD3D11.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#include <DirectXMath.h> + +#include <d3d11.h> + +#include "renderTargetD3D11.h" +#include "shadowMapD3D11.h" +#include "../include/NvFlex.h" +#include "../d3d/renderParamsD3D.h" +#include "shaders.h" + + +struct FluidRenderBuffersD3D11 +{ + FluidRenderBuffersD3D11(): + m_positionsBuf(nullptr), + m_densitiesBuf(nullptr), + m_indicesBuf(nullptr) + { + for (int i = 0; i < 3; i++) + { + m_anisotropiesBufArr[i] = nullptr; + } + m_numParticles = 0; + } + ~FluidRenderBuffersD3D11() + { + NvFlexUnregisterD3DBuffer(m_positionsBuf); + NvFlexUnregisterD3DBuffer(m_densitiesBuf); + NvFlexUnregisterD3DBuffer(m_indicesBuf); + + for (int i = 0; i < 3; i++) + { + NvFlexUnregisterD3DBuffer(m_anisotropiesBufArr[i]); + } + } + + int m_numParticles; + ComPtr<ID3D11Buffer> m_positions; + ComPtr<ID3D11Buffer> m_densities; + ComPtr<ID3D11Buffer> m_anisotropiesArr[3]; + ComPtr<ID3D11Buffer> m_indices; + + ComPtr<ID3D11Buffer> m_fluid; // to be removed + + // wrapper buffers that allow Flex to write directly to VBOs + NvFlexBuffer* m_positionsBuf; + NvFlexBuffer* m_densitiesBuf; + NvFlexBuffer* m_anisotropiesBufArr[3]; + NvFlexBuffer* m_indicesBuf; +}; + +struct FluidRendererD3D11 +{ + void init(ID3D11Device* device, ID3D11DeviceContext* context, int width, int height); + + void drawEllipsoids(const FluidDrawParamsD3D* params, const FluidRenderBuffersD3D11* buffers); + void drawBlurDepth(const FluidDrawParamsD3D* params); + void drawComposite(const FluidDrawParamsD3D* params, ID3D11ShaderResourceView* sceneMap); + + FluidRendererD3D11(): + m_device(nullptr), + m_deviceContext(nullptr) + {} + + void _createScreenQuad(); + + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceContext; + + ComPtr<ID3D11InputLayout> m_ellipsoidDepthLayout; + ComPtr<ID3D11VertexShader> m_ellipsoidDepthVs; + ComPtr<ID3D11GeometryShader> m_ellipsoidDepthGs; + ComPtr<ID3D11PixelShader> m_ellipsoidDepthPs; + + ComPtr<ID3D11InputLayout> m_passThroughLayout; + ComPtr<ID3D11VertexShader> m_passThroughVs; + + ComPtr<ID3D11PixelShader> m_blurDepthPs; + ComPtr<ID3D11PixelShader> m_compositePs; + + ComPtr<ID3D11Buffer> m_constantBuffer; + + // Right handed rasterizer state + ComPtr<ID3D11RasterizerState> m_rasterizerState[NUM_FLUID_RENDER_MODES][NUM_FLUID_CULL_MODES]; + + ComPtr<ID3D11Buffer> m_quadVertexBuffer; + ComPtr<ID3D11Buffer> m_quadIndexBuffer; + + RenderTargetD3D11 m_depthTexture; + RenderTargetD3D11 m_depthSmoothTexture; + RenderTargetD3D11 m_thicknessTexture; + + int m_sceneWidth; + int m_sceneHeight; +}; + + diff --git a/demo/d3d11/imguiGraph.cpp b/demo/d3d11/imguiGraph.cpp deleted file mode 100644 index 011e71b..0000000 --- a/demo/d3d11/imguiGraph.cpp +++ /dev/null @@ -1,472 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -#define _USE_MATH_DEFINES -#include <math.h> -#include "imgui.h" - -#include <stdio.h> -#include <stdint.h> - -#include "imguiGraph.h" -#include "imguiGraphD3D11.h" - -// Some math headers don't have PI defined. -static const float PI = 3.14159265f; - -void imguifree(void* ptr, void* userptr); -void* imguimalloc(size_t size, void* userptr); - -#define STBTT_malloc(x,y) imguimalloc(x,y) -#define STBTT_free(x,y) imguifree(x,y) -#define STB_TRUETYPE_IMPLEMENTATION -#include "stb_truetype.h" - -void imguifree(void* ptr, void* /*userptr*/) -{ - free(ptr); -} - -void* imguimalloc(size_t size, void* /*userptr*/) -{ - return malloc(size); -} - -static const unsigned TEMP_COORD_COUNT = 100; -static float g_tempCoords[TEMP_COORD_COUNT * 2]; -static float g_tempNormals[TEMP_COORD_COUNT * 2]; - -static const int CIRCLE_VERTS = 8 * 4; -static float g_circleVerts[CIRCLE_VERTS * 2]; - -static stbtt_bakedchar g_cdata[96]; // ASCII 32..126 is 95 glyphs - -inline unsigned int RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) -{ - return (r) | (g << 8) | (b << 16) | (a << 24); -} - -static void drawPolygon(const float* coords, unsigned numCoords, float r, unsigned int col) -{ - if (numCoords > TEMP_COORD_COUNT) numCoords = TEMP_COORD_COUNT; - - for (unsigned i = 0, j = numCoords - 1; i < numCoords; j = i++) - { - const float* v0 = &coords[j * 2]; - const float* v1 = &coords[i * 2]; - float dx = v1[0] - v0[0]; - float dy = v1[1] - v0[1]; - float d = sqrtf(dx*dx + dy*dy); - if (d > 0) - { - d = 1.0f / d; - dx *= d; - dy *= d; - } - g_tempNormals[j * 2 + 0] = dy; - g_tempNormals[j * 2 + 1] = -dx; - } - - for (unsigned i = 0, j = numCoords - 1; i < numCoords; j = i++) - { - float dlx0 = g_tempNormals[j * 2 + 0]; - float dly0 = g_tempNormals[j * 2 + 1]; - float dlx1 = g_tempNormals[i * 2 + 0]; - float dly1 = g_tempNormals[i * 2 + 1]; - float dmx = (dlx0 + dlx1) * 0.5f; - float dmy = (dly0 + dly1) * 0.5f; - float dmr2 = dmx*dmx + dmy*dmy; - if (dmr2 > 0.000001f) - { - float scale = 1.0f / dmr2; - if (scale > 10.0f) scale = 10.0f; - dmx *= scale; - dmy *= scale; - } - g_tempCoords[i * 2 + 0] = coords[i * 2 + 0] + dmx*r; - g_tempCoords[i * 2 + 1] = coords[i * 2 + 1] + dmy*r; - } - - unsigned int colTrans = RGBA(col & 0xff, (col >> 8) & 0xff, (col >> 16) & 0xff, 0); - - imguiGraphColor4ubv((uint8_t*)&col); - - for (unsigned i = 0, j = numCoords - 1; i < numCoords; j = i++) - { - imguiGraphVertex2fv(&coords[i * 2]); - imguiGraphVertex2fv(&coords[j * 2]); - imguiGraphColor4ubv((uint8_t*)&colTrans); - imguiGraphVertex2fv(&g_tempCoords[j * 2]); - - imguiGraphVertex2fv(&g_tempCoords[j * 2]); - imguiGraphVertex2fv(&g_tempCoords[i * 2]); - - imguiGraphColor4ubv((uint8_t*)&col); - imguiGraphVertex2fv(&coords[i * 2]); - } - - imguiGraphColor4ubv((uint8_t*)&col); - for (unsigned i = 2; i < numCoords; ++i) - { - imguiGraphVertex2fv(&coords[0]); - imguiGraphVertex2fv(&coords[(i - 1) * 2]); - imguiGraphVertex2fv(&coords[i * 2]); - } -} - -static void drawRect(float x, float y, float w, float h, float fth, unsigned int col) -{ - float verts[4 * 2] = - { - x + 0.5f, y + 0.5f, - x + w - 0.5f, y + 0.5f, - x + w - 0.5f, y + h - 0.5f, - x + 0.5f, y + h - 0.5f, - }; - drawPolygon(verts, 4, fth, col); -} - -/* -static void drawEllipse(float x, float y, float w, float h, float fth, unsigned int col) -{ -float verts[CIRCLE_VERTS*2]; -const float* cverts = g_circleVerts; -float* v = verts; - -for (int i = 0; i < CIRCLE_VERTS; ++i) -{ -*v++ = x + cverts[i*2]*w; -*v++ = y + cverts[i*2+1]*h; -} - -drawPolygon(verts, CIRCLE_VERTS, fth, col); -} -*/ - -static void drawRoundedRect(float x, float y, float w, float h, float r, float fth, unsigned int col) -{ - const unsigned n = CIRCLE_VERTS / 4; - float verts[(n + 1) * 4 * 2]; - const float* cverts = g_circleVerts; - float* v = verts; - - for (unsigned i = 0; i <= n; ++i) - { - *v++ = x + w - r + cverts[i * 2] * r; - *v++ = y + h - r + cverts[i * 2 + 1] * r; - } - - for (unsigned i = n; i <= n * 2; ++i) - { - *v++ = x + r + cverts[i * 2] * r; - *v++ = y + h - r + cverts[i * 2 + 1] * r; - } - - for (unsigned i = n * 2; i <= n * 3; ++i) - { - *v++ = x + r + cverts[i * 2] * r; - *v++ = y + r + cverts[i * 2 + 1] * r; - } - - for (unsigned i = n * 3; i < n * 4; ++i) - { - *v++ = x + w - r + cverts[i * 2] * r; - *v++ = y + r + cverts[i * 2 + 1] * r; - } - *v++ = x + w - r + cverts[0] * r; - *v++ = y + r + cverts[1] * r; - - drawPolygon(verts, (n + 1) * 4, fth, col); -} - - -static void drawLine(float x0, float y0, float x1, float y1, float r, float fth, unsigned int col) -{ - float dx = x1 - x0; - float dy = y1 - y0; - float d = sqrtf(dx*dx + dy*dy); - if (d > 0.0001f) - { - d = 1.0f / d; - dx *= d; - dy *= d; - } - float nx = dy; - float ny = -dx; - float verts[4 * 2]; - r -= fth; - r *= 0.5f; - if (r < 0.01f) r = 0.01f; - dx *= r; - dy *= r; - nx *= r; - ny *= r; - - verts[0] = x0 - dx - nx; - verts[1] = y0 - dy - ny; - - verts[2] = x0 - dx + nx; - verts[3] = y0 - dy + ny; - - verts[4] = x1 + dx + nx; - verts[5] = y1 + dy + ny; - - verts[6] = x1 + dx - nx; - verts[7] = y1 + dy - ny; - - drawPolygon(verts, 4, fth, col); -} - - -bool imguiGraphInit(const char* fontpath, const ImguiGraphDesc* desc) -{ - imguiGraphContextInit(desc); - - for (int i = 0; i < CIRCLE_VERTS; ++i) - { - float a = (float)i / (float)CIRCLE_VERTS * PI * 2; - g_circleVerts[i * 2 + 0] = cosf(a); - g_circleVerts[i * 2 + 1] = sinf(a); - } - - // Load font. - FILE* fp = fopen(fontpath, "rb"); - if (!fp) return false; - fseek(fp, 0, SEEK_END); - int size = ftell(fp); - fseek(fp, 0, SEEK_SET); - - unsigned char* ttfBuffer = (unsigned char*)malloc(size); - if (!ttfBuffer) - { - fclose(fp); - return false; - } - - size_t len = fread(ttfBuffer, 1, size, fp); - (void)len; - - fclose(fp); - fp = 0; - - unsigned char* bmap = (unsigned char*)malloc(512 * 512); - if (!bmap) - { - free(ttfBuffer); - return false; - } - - stbtt_BakeFontBitmap(ttfBuffer, 0, 15.0f, bmap, 512, 512, 32, 96, g_cdata); - - // can free ttf_buffer at this point - imguiGraphFontTextureInit(bmap); - - free(ttfBuffer); - free(bmap); - - return true; -} - -void imguiGraphUpdate(const ImguiGraphDesc* desc) -{ - imguiGraphContextUpdate(desc); -} - -void imguiGraphDestroy() -{ - imguiGraphFontTextureRelease(); - - imguiGraphContextDestroy(); -} - -static void getBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, int char_index, - float *xpos, float *ypos, stbtt_aligned_quad *q) -{ - stbtt_bakedchar *b = chardata + char_index; - int round_x = STBTT_ifloor(*xpos + b->xoff); - int round_y = STBTT_ifloor(*ypos - b->yoff); - - q->x0 = (float)round_x; - q->y0 = (float)round_y; - q->x1 = (float)round_x + b->x1 - b->x0; - q->y1 = (float)round_y - b->y1 + b->y0; - - q->s0 = b->x0 / (float)pw; - q->t0 = b->y0 / (float)pw; - q->s1 = b->x1 / (float)ph; - q->t1 = b->y1 / (float)ph; - - *xpos += b->xadvance; -} - -static const float g_tabStops[4] = { 150, 210, 270, 330 }; - -static float getTextLength(stbtt_bakedchar *chardata, const char* text) -{ - float xpos = 0; - float len = 0; - while (*text) - { - int c = (unsigned char)*text; - if (c == '\t') - { - for (int i = 0; i < 4; ++i) - { - if (xpos < g_tabStops[i]) - { - xpos = g_tabStops[i]; - break; - } - } - } - else if (c >= 32 && c < 128) - { - stbtt_bakedchar *b = chardata + c - 32; - int round_x = STBTT_ifloor((xpos + b->xoff) + 0.5); - len = round_x + b->x1 - b->x0 + 0.5f; - xpos += b->xadvance; - } - ++text; - } - return len; -} - -static void drawText(float x, float y, const char *text, int align, unsigned int col) -{ - if (!text) return; - - if (align == IMGUI_ALIGN_CENTER) - x -= getTextLength(g_cdata, text) / 2; - else if (align == IMGUI_ALIGN_RIGHT) - x -= getTextLength(g_cdata, text); - - imguiGraphColor4ub(col & 0xff, (col >> 8) & 0xff, (col >> 16) & 0xff, (col >> 24) & 0xff); - - imguiGraphFontTextureEnable(); - - // assume orthographic projection with units = screen pixels, origin at top left - const float ox = x; - - while (*text) - { - int c = (unsigned char)*text; - if (c == '\t') - { - for (int i = 0; i < 4; ++i) - { - if (x < g_tabStops[i] + ox) - { - x = g_tabStops[i] + ox; - break; - } - } - } - else if (c >= 32 && c < 128) - { - stbtt_aligned_quad q; - getBakedQuad(g_cdata, 512, 512, c - 32, &x, &y, &q); - - imguiGraphTexCoord2f(q.s0, q.t0); - imguiGraphVertex2f(q.x0, q.y0); - imguiGraphTexCoord2f(q.s1, q.t1); - imguiGraphVertex2f(q.x1, q.y1); - imguiGraphTexCoord2f(q.s1, q.t0); - imguiGraphVertex2f(q.x1, q.y0); - - imguiGraphTexCoord2f(q.s0, q.t0); - imguiGraphVertex2f(q.x0, q.y0); - imguiGraphTexCoord2f(q.s0, q.t1); - imguiGraphVertex2f(q.x0, q.y1); - imguiGraphTexCoord2f(q.s1, q.t1); - imguiGraphVertex2f(q.x1, q.y1); - } - ++text; - } - - imguiGraphFontTextureDisable(); -} - - -void imguiGraphDraw() -{ - const imguiGfxCmd* q = imguiGetRenderQueue(); - int nq = imguiGetRenderQueueSize(); - - const float s = 1.0f / 8.0f; - - imguiGraphRecordBegin(); - - imguiGraphDisableScissor(); - for (int i = 0; i < nq; ++i) - { - const imguiGfxCmd& cmd = q[i]; - if (cmd.type == IMGUI_GFXCMD_RECT) - { - if (cmd.rect.r == 0) - { - drawRect((float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f, - (float)cmd.rect.w*s - 1, (float)cmd.rect.h*s - 1, - 1.0f, cmd.col); - } - else - { - drawRoundedRect((float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f, - (float)cmd.rect.w*s - 1, (float)cmd.rect.h*s - 1, - (float)cmd.rect.r*s, 1.0f, cmd.col); - } - } - else if (cmd.type == IMGUI_GFXCMD_LINE) - { - drawLine(cmd.line.x0*s, cmd.line.y0*s, cmd.line.x1*s, cmd.line.y1*s, cmd.line.r*s, 1.0f, cmd.col); - } - else if (cmd.type == IMGUI_GFXCMD_TRIANGLE) - { - if (cmd.flags == 1) - { - const float verts[3 * 2] = - { - (float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f, - (float)cmd.rect.x*s + 0.5f + (float)cmd.rect.w*s - 1, (float)cmd.rect.y*s + 0.5f + (float)cmd.rect.h*s / 2 - 0.5f, - (float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f + (float)cmd.rect.h*s - 1, - }; - drawPolygon(verts, 3, 1.0f, cmd.col); - } - if (cmd.flags == 2) - { - const float verts[3 * 2] = - { - (float)cmd.rect.x*s + 0.5f, (float)cmd.rect.y*s + 0.5f + (float)cmd.rect.h*s - 1, - (float)cmd.rect.x*s + 0.5f + (float)cmd.rect.w*s / 2 - 0.5f, (float)cmd.rect.y*s + 0.5f, - (float)cmd.rect.x*s + 0.5f + (float)cmd.rect.w*s - 1, (float)cmd.rect.y*s + 0.5f + (float)cmd.rect.h*s - 1, - }; - drawPolygon(verts, 3, 1.0f, cmd.col); - } - } - else if (cmd.type == IMGUI_GFXCMD_TEXT) - { - drawText(cmd.text.x, cmd.text.y, cmd.text.text, cmd.text.align, cmd.col); - } - else if (cmd.type == IMGUI_GFXCMD_SCISSOR) - { - if (cmd.flags) - { - imguiGraphEnableScissor(cmd.rect.x, cmd.rect.y, cmd.rect.w, cmd.rect.h); - } - else - { - imguiGraphDisableScissor(); - } - } - } - imguiGraphDisableScissor(); - - imguiGraphRecordEnd(); -} - diff --git a/demo/d3d11/imguiGraph.h b/demo/d3d11/imguiGraph.h deleted file mode 100644 index e6e5eb4..0000000 --- a/demo/d3d11/imguiGraph.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -#pragma once - -#include <stdint.h> - -#define IMGUI_GRAPH_API extern "C" __declspec(dllexport) - -struct ImguiGraphDesc; - -typedef bool (*imguiGraphInit_t)(const char* fontpath, const ImguiGraphDesc* desc); - -typedef void (*imguiGraphUpdate_t)(const ImguiGraphDesc* desc); - -bool imguiGraphInit(const char* fontpath, const ImguiGraphDesc* desc); - -void imguiGraphUpdate(const ImguiGraphDesc* desc); - -void imguiGraphDestroy(); - -void imguiGraphDraw();
\ No newline at end of file diff --git a/demo/d3d11/imguiGraphD3D11.cpp b/demo/d3d11/imguiGraphD3D11.cpp index 89c8c91..2df555d 100644 --- a/demo/d3d11/imguiGraphD3D11.cpp +++ b/demo/d3d11/imguiGraphD3D11.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. * * NVIDIA CORPORATION and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation @@ -13,8 +13,8 @@ //direct3d headers #include <d3d11.h> -#include "shaders/imguiVS.hlsl.h" -#include "shaders/imguiPS.hlsl.h" +#include "../d3d/shaders/imguiVS.hlsl.h" +#include "../d3d/shaders/imguiPS.hlsl.h" namespace { @@ -77,7 +77,7 @@ namespace }; } -void imguiGraphContextDestroy() +void imguiGraphContextDestroyD3D11() { COMRelease(m_rasterizerState); COMRelease(m_samplerState); @@ -89,8 +89,10 @@ void imguiGraphContextDestroy() COMRelease(m_vertexBuffer); } -void imguiGraphContextInit(const ImguiGraphDesc* desc) +void imguiGraphContextInitD3D11(const ImguiGraphDesc* descIn) { + const auto desc = cast_to_imguiGraphDescD3D11(descIn); + m_device = desc->device; m_deviceContext = desc->deviceContext; m_winW = desc->winW; @@ -202,15 +204,17 @@ void imguiGraphContextInit(const ImguiGraphDesc* desc) } } -void imguiGraphContextUpdate(const ImguiGraphDesc* desc) +void imguiGraphContextUpdateD3D11(const ImguiGraphDesc* descIn) { + const auto desc = cast_to_imguiGraphDescD3D11(descIn); + m_device = desc->device; m_deviceContext = desc->deviceContext; m_winW = desc->winW; m_winH = desc->winH; } -void imguiGraphRecordBegin() +void imguiGraphRecordBeginD3D11() { Params params = { 2.f / float(m_winW), 0.f, 0.f, -1.f, @@ -319,7 +323,7 @@ static void imguiGraphFlush() } } -void imguiGraphRecordEnd() +void imguiGraphRecordEndD3D11() { ID3D11DeviceContext* context = m_deviceContext; @@ -341,7 +345,7 @@ void imguiGraphRecordEnd() context->RSSetState(nullptr); } -void imguiGraphEnableScissor(int x, int y, int width, int height) +void imguiGraphEnableScissorD3D11(int x, int y, int width, int height) { // mark end of last region m_stateScissor.stopIdx = m_stateVertIdx; @@ -356,7 +360,7 @@ void imguiGraphEnableScissor(int x, int y, int width, int height) m_stateScissor.height = height; } -void imguiGraphDisableScissor() +void imguiGraphDisableScissorD3D11() { if (m_stateVertIdx == 0) return; @@ -373,13 +377,13 @@ void imguiGraphDisableScissor() m_stateScissor.height = m_winH; } -void imguiGraphVertex2f(float x, float y) +void imguiGraphVertex2fD3D11(float x, float y) { float v[2] = { x,y }; - imguiGraphVertex2fv(v); + imguiGraphVertex2fvD3D11(v); } -void imguiGraphVertex2fv(const float* v) +void imguiGraphVertex2fvD3D11(const float* v) { // update state m_stateVert.x = v[0]; @@ -394,13 +398,13 @@ void imguiGraphVertex2fv(const float* v) } } -void imguiGraphTexCoord2f(float u, float v) +void imguiGraphTexCoord2fD3D11(float u, float v) { m_stateVert.u = u; m_stateVert.v = v; } -void imguiGraphColor4ub(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) +void imguiGraphColor4ubD3D11(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) { m_stateVert.rgba[0] = red; m_stateVert.rgba[1] = green; @@ -408,7 +412,7 @@ void imguiGraphColor4ub(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) m_stateVert.rgba[3] = alpha; } -void imguiGraphColor4ubv(const uint8_t* v) +void imguiGraphColor4ubvD3D11(const uint8_t* v) { m_stateVert.rgba[0] = v[0]; m_stateVert.rgba[1] = v[1]; @@ -416,18 +420,18 @@ void imguiGraphColor4ubv(const uint8_t* v) m_stateVert.rgba[3] = v[3]; } -void imguiGraphFontTextureEnable() +void imguiGraphFontTextureEnableD3D11() { } -void imguiGraphFontTextureDisable() +void imguiGraphFontTextureDisableD3D11() { m_stateVert.u = -1.f; m_stateVert.v = -1.f; } -void imguiGraphFontTextureInit(unsigned char* data) +void imguiGraphFontTextureInitD3D11(unsigned char* data) { ID3D11DeviceContext* context = m_deviceContext; @@ -466,7 +470,7 @@ void imguiGraphFontTextureInit(unsigned char* data) } -void imguiGraphFontTextureRelease() +void imguiGraphFontTextureReleaseD3D11() { COMRelease(m_texture); COMRelease(m_textureSRV); diff --git a/demo/d3d11/imguiGraphD3D11.h b/demo/d3d11/imguiGraphD3D11.h index be9c88b..8f521a9 100644 --- a/demo/d3d11/imguiGraphD3D11.h +++ b/demo/d3d11/imguiGraphD3D11.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. * * NVIDIA CORPORATION and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation @@ -13,12 +13,12 @@ #include <stdint.h> -#include "imguiGraph.h" +#include "../d3d/imguiGraph.h" struct ID3D11Device; struct ID3D11DeviceContext; -struct ImguiGraphDesc +struct ImguiGraphDescD3D11 { ID3D11Device* device = nullptr; ID3D11DeviceContext* deviceContext = nullptr; @@ -27,41 +27,49 @@ struct ImguiGraphDesc uint32_t maxVertices = 64 * 4096u; - ImguiGraphDesc() {} + ImguiGraphDescD3D11() {} }; -// Below are the functions that must be implemented per graphics API +inline const ImguiGraphDescD3D11* cast_to_imguiGraphDescD3D11(const ImguiGraphDesc* desc) +{ + return (const ImguiGraphDescD3D11*)(desc); +} + +inline ImguiGraphDesc* cast_from_imguiGraphDescD3D11(ImguiGraphDescD3D11* desc) +{ + return (ImguiGraphDesc*)(desc); +} -void imguiGraphContextInit(const ImguiGraphDesc* desc); +IMGUI_GRAPH_API void imguiGraphContextInitD3D11(const ImguiGraphDesc* desc); -void imguiGraphContextUpdate(const ImguiGraphDesc* desc); +IMGUI_GRAPH_API void imguiGraphContextUpdateD3D11(const ImguiGraphDesc* desc); -void imguiGraphContextDestroy(); +IMGUI_GRAPH_API void imguiGraphContextDestroyD3D11(); -void imguiGraphRecordBegin(); +IMGUI_GRAPH_API void imguiGraphRecordBeginD3D11(); -void imguiGraphRecordEnd(); +IMGUI_GRAPH_API void imguiGraphRecordEndD3D11(); -void imguiGraphVertex2f(float x, float y); +IMGUI_GRAPH_API void imguiGraphVertex2fD3D11(float x, float y); -void imguiGraphVertex2fv(const float* v); +IMGUI_GRAPH_API void imguiGraphVertex2fvD3D11(const float* v); -void imguiGraphTexCoord2f(float u, float v); +IMGUI_GRAPH_API void imguiGraphTexCoord2fD3D11(float u, float v); -void imguiGraphColor4ub(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha); +IMGUI_GRAPH_API void imguiGraphColor4ubD3D11(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha); -void imguiGraphColor4ubv(const uint8_t* v); +IMGUI_GRAPH_API void imguiGraphColor4ubvD3D11(const uint8_t* v); -void imguiGraphFontTextureEnable(); +IMGUI_GRAPH_API void imguiGraphFontTextureEnableD3D11(); -void imguiGraphFontTextureDisable(); +IMGUI_GRAPH_API void imguiGraphFontTextureDisableD3D11(); -void imguiGraphEnableScissor(int x, int y, int width, int height); +IMGUI_GRAPH_API void imguiGraphEnableScissorD3D11(int x, int y, int width, int height); -void imguiGraphDisableScissor(); +IMGUI_GRAPH_API void imguiGraphDisableScissorD3D11(); -void imguiGraphFontTextureInit(unsigned char* data); +IMGUI_GRAPH_API void imguiGraphFontTextureInitD3D11(unsigned char* data); -void imguiGraphFontTextureRelease(); +IMGUI_GRAPH_API void imguiGraphFontTextureReleaseD3D11(); #endif
\ No newline at end of file diff --git a/demo/d3d11/imguiInteropD3D11.cpp b/demo/d3d11/imguiInteropD3D11.cpp new file mode 100644 index 0000000..5d22d2e --- /dev/null +++ b/demo/d3d11/imguiInteropD3D11.cpp @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +//direct3d headers +#include <d3d11.h> + +#include "appD3D11Ctx.h" + +// include the Direct3D Library file +#pragma comment (lib, "d3d11.lib") + +#include "appD3D11Ctx.h" +#include "imguiGraphD3D11.h" + +IMGUI_GRAPH_API bool imguiInteropGraphInitD3D11(imguiGraphInit_t func, const char* fontpath, AppGraphCtx* appctx); + +IMGUI_GRAPH_API void imguiInteropGraphUpdateD3D11(imguiGraphUpdate_t func, AppGraphCtx* appctx); + +bool imguiInteropGraphInitD3D11(imguiGraphInit_t func, const char* fontpath, AppGraphCtx* appctxIn) +{ + ImguiGraphDescD3D11 desc; + + AppGraphCtxD3D11* appctx = cast_to_AppGraphCtxD3D11(appctxIn); + + desc.device = appctx->m_device; + desc.deviceContext = appctx->m_deviceContext; + desc.winW = appctx->m_winW; + desc.winH = appctx->m_winH; + + return func(fontpath, cast_from_imguiGraphDescD3D11(&desc)); +} + +void imguiInteropGraphUpdateD3D11(imguiGraphUpdate_t func, AppGraphCtx* appctxIn) +{ + ImguiGraphDescD3D11 desc; + AppGraphCtxD3D11* appctx = cast_to_AppGraphCtxD3D11(appctxIn); + + desc.device = appctx->m_device; + desc.deviceContext = appctx->m_deviceContext; + desc.winW = appctx->m_winW; + desc.winH = appctx->m_winH; + + return func(cast_from_imguiGraphDescD3D11(&desc)); +}
\ No newline at end of file diff --git a/demo/d3d11/meshRender.cpp b/demo/d3d11/meshRender.cpp deleted file mode 100644 index b07397b..0000000 --- a/demo/d3d11/meshRender.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -//direct3d headers - -#define NOMINMAX - -#include <d3d11.h> - -// include the Direct3D Library file -#pragma comment (lib, "d3d11.lib") - -#include <math.h> - -#include "meshRender.h" -#include "appD3d11Ctx.h" - - -#include "shaders/meshVS.hlsl.h" -#include "shaders/meshPS.hlsl.h" -#include "shaders/meshShadowPS.hlsl.h" - -#define EXCLUDE_SHADER_STRUCTS 1 -#include "shaders/shaderCommon.h" - -#include "shadowMap.h" - - -void MeshRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) -{ - for (int i = 0; i < NUM_MESH_RENDER_MODES; i++) - for (int j = 0; j < NUM_MESH_CULL_MODES; j++) - m_rasterizerStateRH[i][j] = nullptr; - - m_device = device; - m_deviceContext = context; - - // create the input layout - { - D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 2, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 3, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - - m_device->CreateInputLayout(inputElementDescs, 4, g_meshVS, sizeof(g_meshVS), &m_inputLayout); - } - - // create the shaders - m_device->CreateVertexShader(g_meshVS, sizeof(g_meshVS), nullptr, &m_meshVS); - m_device->CreatePixelShader(g_meshPS, sizeof(g_meshPS), nullptr, &m_meshPS); - m_device->CreatePixelShader(g_meshPS_Shadow, sizeof(g_meshPS_Shadow), nullptr, &m_meshPS_Shadow); - - // create a constant buffer - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(MeshShaderConst); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - - m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer); - } - - // create the rastersizer state - for (int i = 0; i < NUM_MESH_RENDER_MODES; i++) - { - for (int j = 0; j < NUM_MESH_CULL_MODES; j++) - - { - D3D11_RASTERIZER_DESC desc = {}; - desc.FillMode = (D3D11_FILL_MODE)(D3D11_FILL_WIREFRAME + i); - desc.CullMode = (D3D11_CULL_MODE)(D3D11_CULL_NONE + j); - desc.FrontCounterClockwise = TRUE; // This is non-default - desc.DepthBias = 0; - desc.DepthBiasClamp = 0.f; - desc.SlopeScaledDepthBias = 0.f; - desc.DepthClipEnable = TRUE; - desc.ScissorEnable = FALSE; - desc.MultisampleEnable = FALSE; - desc.AntialiasedLineEnable = FALSE; - - m_device->CreateRasterizerState(&desc, &m_rasterizerStateRH[i][j]); - } - } - -} - -void MeshRenderer::Destroy() -{ - COMRelease(m_inputLayout); - COMRelease(m_meshVS); - COMRelease(m_meshPS); - COMRelease(m_meshPS_Shadow); - COMRelease(m_constantBuffer); - - for (int i = 0; i < NUM_MESH_RENDER_MODES; i++) - for (int j = 0; j < NUM_MESH_CULL_MODES; j++) - COMRelease(m_rasterizerStateRH[i][j]); -} - - -void MeshRenderer::Draw(const GpuMesh* mesh, const MeshDrawParams* params) -{ - using namespace DirectX; - - // update constant buffer - { - D3D11_MAPPED_SUBRESOURCE mappedResource = {}; - if (S_OK == m_deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) - { - MeshShaderConst cParams; - - cParams.modelviewprojection = (float4x4&)(XMMatrixMultiply(XMMatrixMultiply(params->model, params->view), params->projection)); - - cParams.modelview = (float4x4&)XMMatrixMultiply(params->model, params->view); - - cParams.objectTransform = (float4x4&)params->objectTransform; - cParams.lightTransform = (float4x4&)params->lightTransform; - - cParams.clipPlane = params->clipPlane; - cParams.fogColor = params->fogColor; - cParams.color = params->color; - cParams.secondaryColor = params->secondaryColor; - - cParams.lightPos = params->lightPos; - cParams.lightDir = params->lightDir; - - cParams.bias = params->bias; - cParams.expand = params->expand; - cParams.spotMin = params->spotMin; - cParams.spotMax = params->spotMax; - - cParams.grid = params->grid; - cParams.tex = params->tex; - cParams.colorArray = params->colorArray; - - memcpy(cParams.shadowTaps, params->shadowTaps, sizeof(cParams.shadowTaps)); - - memcpy(mappedResource.pData, &cParams, sizeof(MeshShaderConst)); - - m_deviceContext->Unmap(m_constantBuffer, 0u); - } - } - - m_deviceContext->VSSetShader(m_meshVS, nullptr, 0u); - m_deviceContext->GSSetShader(nullptr, nullptr, 0u); - - switch (params->renderStage) - { - case MESH_DRAW_SHADOW: - { - m_deviceContext->PSSetShader(m_meshPS_Shadow, nullptr, 0u); - break; - } - case MESH_DRAW_LIGHT: - { - m_deviceContext->PSSetShader(m_meshPS, nullptr, 0u); - - ShadowMap* shadowMap = (ShadowMap*)params->shadowMap; - ID3D11ShaderResourceView* ppSRV[1] = { shadowMap->m_depthSrv.Get() }; - m_deviceContext->PSSetShaderResources(0, 1, ppSRV); - ID3D11SamplerState* ppSS[1] = { shadowMap->m_linearSampler.Get() }; - m_deviceContext->PSSetSamplers(0, 1, ppSS); - break; - } - default: - assert(false); - break; - } - - m_deviceContext->IASetInputLayout(m_inputLayout); - m_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); - - m_deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer); - m_deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer); - - ID3D11Buffer* vertexBuffers[4] = - { - mesh->positionBuffer, - mesh->normalBuffer, - mesh->texcoordBuffer, - mesh->colorBuffer, - }; - - unsigned int vertexBufferStrides[4] = - { - sizeof(Vec3), - sizeof(Vec3), - sizeof(Vec2), - sizeof(Vec4) - }; - - unsigned int vertexBufferOffsets[4] = { 0, 0, 0, 0 }; - - m_deviceContext->IASetVertexBuffers(0, 4, vertexBuffers, vertexBufferStrides, vertexBufferOffsets); - m_deviceContext->IASetIndexBuffer(mesh->indexBuffer, DXGI_FORMAT_R32_UINT, 0u); - - float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); - if (depthSign < 0.f) - { - m_deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]); - } - - m_deviceContext->DrawIndexed((UINT)mesh->mNumFaces*3, 0, 0); - - if (depthSign < 0.f) - { - m_deviceContext->RSSetState(nullptr); - } -} diff --git a/demo/d3d11/meshRender.h b/demo/d3d11/meshRender.h deleted file mode 100644 index 01ad181..0000000 --- a/demo/d3d11/meshRender.h +++ /dev/null @@ -1,297 +0,0 @@ - -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -#pragma once - -#include <DirectXMath.h> - -#include "appD3D11Ctx.h" - -#include "core/maths.h" - -struct ShadowMap; - -struct GpuMesh -{ - ID3D11Buffer* positionBuffer; - ID3D11Buffer* normalBuffer; - ID3D11Buffer* texcoordBuffer; - ID3D11Buffer* colorBuffer; - - ID3D11Buffer* indexBuffer; - - GpuMesh(ID3D11Device* device, ID3D11DeviceContext* deviceContext) - : positionBuffer(NULL) - , normalBuffer(NULL) - , texcoordBuffer(NULL) - , colorBuffer(NULL) - , indexBuffer(NULL) - , mDevice(device) - , mDeviceContext(deviceContext) - , mNumFaces(0) - , mNumVertices(0) - {} - - ~GpuMesh() - { - Release(); - } - - void Release() - { - COMRelease(positionBuffer); - COMRelease(normalBuffer); - COMRelease(texcoordBuffer); - COMRelease(colorBuffer); - COMRelease(indexBuffer); - } - - void Resize(int numVertices, int numFaces) - { - Release(); - - { - // vertex buffers - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(Vec3)*numVertices; - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - - mDevice->CreateBuffer(&bufDesc, NULL, &positionBuffer); - mDevice->CreateBuffer(&bufDesc, NULL, &normalBuffer); - - bufDesc.ByteWidth = sizeof(Vec2)*numVertices; - mDevice->CreateBuffer(&bufDesc, NULL, &texcoordBuffer); - - bufDesc.ByteWidth = sizeof(Vec4)*numVertices; - mDevice->CreateBuffer(&bufDesc, NULL, &colorBuffer); - } - - { - // index buffer - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(int)*numFaces*3; - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - - mDevice->CreateBuffer(&bufDesc, NULL, &indexBuffer); - } - - mMaxVertices = numVertices; - mMaxFaces = numFaces; - } - - void UpdateData(const Vec3* positions, const Vec3* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces) - { - if (numVertices > mMaxVertices || numFaces > mMaxFaces) - { - Resize(numVertices, numFaces); - } - - D3D11_MAPPED_SUBRESOURCE res; - - // vertices - if (positions) - { - mDeviceContext->Map(positionBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, positions, sizeof(Vec3)*numVertices); - mDeviceContext->Unmap(positionBuffer, 0); - } - - if (normals) - { - mDeviceContext->Map(normalBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, normals, sizeof(Vec3)*numVertices); - mDeviceContext->Unmap(normalBuffer, 0); - } - - if (texcoords) - { - mDeviceContext->Map(texcoordBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, texcoords, sizeof(Vec2)*numVertices); - mDeviceContext->Unmap(texcoordBuffer, 0); - } - - if (colors) - { - mDeviceContext->Map(colorBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, colors, sizeof(Vec4)*numVertices); - mDeviceContext->Unmap(colorBuffer, 0); - } - - // indices - if (indices) - { - mDeviceContext->Map(indexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, indices, sizeof(int)*numFaces*3); - mDeviceContext->Unmap(indexBuffer, 0); - } - - mNumVertices = numVertices; - mNumFaces = numFaces; - } - - // duplicate method to handle conversion from vec4 to vec3 positions / normals - void UpdateData(const Vec4* positions, const Vec4* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces) - { - if (numVertices > mMaxVertices || numFaces > mMaxFaces) - { - Resize(numVertices, numFaces); - } - - D3D11_MAPPED_SUBRESOURCE res; - - // vertices - if (positions) - { - mDeviceContext->Map(positionBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - for (int i=0; i < numVertices; ++i) - ((Vec3*)res.pData)[i] = Vec3(positions[i]); - mDeviceContext->Unmap(positionBuffer, 0); - } - - if (normals) - { - mDeviceContext->Map(normalBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - for (int i=0; i < numVertices; ++i) - ((Vec3*)res.pData)[i] = Vec3(normals[i]); - mDeviceContext->Unmap(normalBuffer, 0); - } - - if (texcoords) - { - mDeviceContext->Map(texcoordBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, texcoords, sizeof(Vec2)*numVertices); - mDeviceContext->Unmap(texcoordBuffer, 0); - } - - if (colors) - { - mDeviceContext->Map(colorBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, colors, sizeof(Vec4)*numVertices); - mDeviceContext->Unmap(colorBuffer, 0); - } - - // indices - if (indices) - { - mDeviceContext->Map(indexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, indices, sizeof(int)*numFaces*3); - mDeviceContext->Unmap(indexBuffer, 0); - } - - mNumVertices = numVertices; - mNumFaces = numFaces; - } - - int mNumVertices = 0; - int mNumFaces = 0; - - int mMaxVertices = 0; - int mMaxFaces = 0; - - ID3D11Device* mDevice; - ID3D11DeviceContext* mDeviceContext; -}; - - - -enum MeshRenderMode -{ - MESH_RENDER_WIREFRAME, - MESH_RENDER_SOLID, - NUM_MESH_RENDER_MODES -}; - -enum MeshCullMode -{ - MESH_CULL_NONE, - MESH_CULL_FRONT, - MESH_CULL_BACK, - NUM_MESH_CULL_MODES -}; - -enum MeshDrawStage -{ - MESH_DRAW_NULL, - MESH_DRAW_SHADOW, - MESH_DRAW_REFLECTION, - MESH_DRAW_LIGHT -}; - -typedef DirectX::XMFLOAT3 float3; -typedef DirectX::XMFLOAT4 float4; -typedef DirectX::XMFLOAT4X4 float4x4; - -struct MeshDrawParams -{ - MeshRenderMode renderMode; - MeshCullMode cullMode; - MeshDrawStage renderStage; - - DirectX::XMMATRIX projection; - DirectX::XMMATRIX view; - DirectX::XMMATRIX model; - - float4x4 objectTransform; - - DirectX::XMMATRIX lightTransform; - float3 lightPos; - float3 lightDir; - - float4 clipPlane; - float4 fogColor; - float4 color; - float4 secondaryColor; - - float bias; - float expand; - float spotMin; - float spotMax; - - int grid; - int tex; - int colorArray; - - float4 shadowTaps[12]; - ShadowMap* shadowMap; -}; - -struct MeshRenderer -{ - ID3D11Device* m_device = nullptr; - ID3D11DeviceContext* m_deviceContext = nullptr; - - ID3D11InputLayout* m_inputLayout = nullptr; - ID3D11VertexShader* m_meshVS = nullptr; - ID3D11PixelShader* m_meshPS = nullptr; - ID3D11PixelShader* m_meshPS_Shadow = nullptr; - ID3D11Buffer* m_constantBuffer = nullptr; - ID3D11RasterizerState* m_rasterizerStateRH[NUM_MESH_RENDER_MODES][NUM_MESH_CULL_MODES]; - - ~MeshRenderer() - { - Destroy(); - } - - void Init(ID3D11Device* device, ID3D11DeviceContext* context); - void Destroy(); - - void Draw(const GpuMesh* mesh, const MeshDrawParams* params); - -}; - - - diff --git a/demo/d3d11/meshRenderD3D11.cpp b/demo/d3d11/meshRenderD3D11.cpp new file mode 100644 index 0000000..8936f04 --- /dev/null +++ b/demo/d3d11/meshRenderD3D11.cpp @@ -0,0 +1,341 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +//direct3d headers + +#define NOMINMAX + +#include <d3d11.h> + +// include the Direct3D Library file +#pragma comment (lib, "d3d11.lib") + +#include <math.h> + +#include "meshRenderD3D11.h" +#include "appD3d11Ctx.h" + + +#include "../d3d/shaders/meshVS.hlsl.h" +#include "../d3d/shaders/meshPS.hlsl.h" +#include "../d3d/shaders/meshShadowPS.hlsl.h" + +#include "../d3d/shaderCommonD3D.h" + +#include "shadowMapD3D11.h" + +// Make async compute benchmark shader have a unique name +namespace AsyncComputeBench +{ +#include "../d3d/shaders/meshAsyncComputeBenchPS.hlsl.h" +} + +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GpuMeshD3D11 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + +GpuMeshD3D11::GpuMeshD3D11(ID3D11Device* device, ID3D11DeviceContext* deviceContext) + : m_device(device) + , m_deviceContext(deviceContext) + , m_numFaces(0) + , m_numVertices(0) + , m_maxVertices(0) + , m_maxFaces(0) +{ +} + +void GpuMeshD3D11::resize(int numVertices, int numFaces) +{ + { + // vertex buffers + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = sizeof(Vec3)*numVertices; + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + + m_device->CreateBuffer(&bufDesc, NULL, m_positionBuffer.ReleaseAndGetAddressOf()); + m_device->CreateBuffer(&bufDesc, NULL, m_normalBuffer.ReleaseAndGetAddressOf()); + + bufDesc.ByteWidth = sizeof(Vec2)*numVertices; + m_device->CreateBuffer(&bufDesc, NULL, m_texcoordBuffer.ReleaseAndGetAddressOf()); + + bufDesc.ByteWidth = sizeof(Vec4)*numVertices; + m_device->CreateBuffer(&bufDesc, NULL, m_colorBuffer.ReleaseAndGetAddressOf()); + } + + { + // index buffer + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = sizeof(int)*numFaces * 3; + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + + m_device->CreateBuffer(&bufDesc, NULL, &m_indexBuffer); + } + + m_maxVertices = numVertices; + m_maxFaces = numFaces; +} + +void GpuMeshD3D11::updateData(const Vec3* positions, const Vec3* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces) +{ + if (numVertices > m_maxVertices || numFaces > m_maxFaces) + { + resize(numVertices, numFaces); + } + + D3D11_MAPPED_SUBRESOURCE res; + + // vertices + if (positions) + { + m_deviceContext->Map(m_positionBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, positions, sizeof(Vec3)*numVertices); + m_deviceContext->Unmap(m_positionBuffer.Get(), 0); + } + + if (normals) + { + m_deviceContext->Map(m_normalBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, normals, sizeof(Vec3)*numVertices); + m_deviceContext->Unmap(m_normalBuffer.Get(), 0); + } + + if (texcoords) + { + m_deviceContext->Map(m_texcoordBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, texcoords, sizeof(Vec2)*numVertices); + m_deviceContext->Unmap(m_texcoordBuffer.Get(), 0); + } + + if (colors) + { + m_deviceContext->Map(m_colorBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, colors, sizeof(Vec4)*numVertices); + m_deviceContext->Unmap(m_colorBuffer.Get(), 0); + } + + // indices + if (indices) + { + m_deviceContext->Map(m_indexBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, indices, sizeof(int)*numFaces * 3); + m_deviceContext->Unmap(m_indexBuffer.Get(), 0); + } + + m_numVertices = numVertices; + m_numFaces = numFaces; +} + +void GpuMeshD3D11::updateData(const Vec4* positions, const Vec4* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces) +{ + if (numVertices > m_maxVertices || numFaces > m_maxFaces) + { + resize(numVertices, numFaces); + } + + D3D11_MAPPED_SUBRESOURCE res; + + // vertices + if (positions) + { + m_deviceContext->Map(m_positionBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + for (int i = 0; i < numVertices; ++i) + ((Vec3*)res.pData)[i] = Vec3(positions[i]); + m_deviceContext->Unmap(m_positionBuffer.Get(), 0); + } + + if (normals) + { + m_deviceContext->Map(m_normalBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + for (int i = 0; i < numVertices; ++i) + ((Vec3*)res.pData)[i] = Vec3(normals[i]); + m_deviceContext->Unmap(m_normalBuffer.Get(), 0); + } + + if (texcoords) + { + m_deviceContext->Map(m_texcoordBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, texcoords, sizeof(Vec2)*numVertices); + m_deviceContext->Unmap(m_texcoordBuffer.Get(), 0); + } + + if (colors) + { + m_deviceContext->Map(m_colorBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, colors, sizeof(Vec4)*numVertices); + m_deviceContext->Unmap(m_colorBuffer.Get(), 0); + } + + // indices + if (indices) + { + m_deviceContext->Map(m_indexBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &res); + memcpy(res.pData, indices, sizeof(int)*numFaces * 3); + m_deviceContext->Unmap(m_indexBuffer.Get(), 0); + } + + m_numVertices = numVertices; + m_numFaces = numFaces; +} + +/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! MeshRendererD3D11 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + +void MeshRendererD3D11::init(ID3D11Device* device, ID3D11DeviceContext* context, bool asyncComputeBenchmark) +{ + m_device = device; + m_deviceContext = context; + + // create the input layout + { + D3D11_INPUT_ELEMENT_DESC inputElementDescs[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 1, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 2, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 3, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + + m_device->CreateInputLayout(inputElementDescs, 4, g_meshVS, sizeof(g_meshVS), &m_inputLayout); + } + + // create the shaders + + if (asyncComputeBenchmark) + { + m_device->CreatePixelShader(AsyncComputeBench::g_meshPS, sizeof(AsyncComputeBench::g_meshPS), nullptr, &m_meshPs); + } + else + { + m_device->CreatePixelShader(g_meshPS, sizeof(g_meshPS), nullptr, &m_meshPs); + } + + m_device->CreateVertexShader(g_meshVS, sizeof(g_meshVS), nullptr, &m_meshVs); + m_device->CreatePixelShader(g_meshPS_Shadow, sizeof(g_meshPS_Shadow), nullptr, &m_meshShadowPs); + + // create a constant buffer + { + D3D11_BUFFER_DESC bufDesc; + bufDesc.ByteWidth = sizeof(Hlsl::MeshShaderConst); + bufDesc.Usage = D3D11_USAGE_DYNAMIC; + bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + bufDesc.MiscFlags = 0; + + m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer); + } + + // create the rastersizer state + for (int i = 0; i < NUM_MESH_RENDER_MODES; i++) + { + for (int j = 0; j < NUM_MESH_CULL_MODES; j++) + + { + D3D11_RASTERIZER_DESC desc = {}; + desc.FillMode = (D3D11_FILL_MODE)(D3D11_FILL_WIREFRAME + i); + desc.CullMode = (D3D11_CULL_MODE)(D3D11_CULL_NONE + j); + desc.FrontCounterClockwise = TRUE; // This is non-default + desc.DepthBias = 0; + desc.DepthBiasClamp = 0.f; + desc.SlopeScaledDepthBias = 0.f; + desc.DepthClipEnable = TRUE; + desc.ScissorEnable = FALSE; + desc.MultisampleEnable = FALSE; + desc.AntialiasedLineEnable = FALSE; + + m_device->CreateRasterizerState(&desc, &m_rasterizerState[i][j]); + } + } +} + +void MeshRendererD3D11::draw(const GpuMeshD3D11* mesh, const MeshDrawParamsD3D* params) +{ + using namespace DirectX; + + // update constant buffer + { + D3D11_MAPPED_SUBRESOURCE mappedResource = {}; + if (SUCCEEDED(m_deviceContext->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) + { + Hlsl::MeshShaderConst constBuf; + RenderParamsUtilD3D::calcMeshConstantBuffer(*params, constBuf); + memcpy(mappedResource.pData, &constBuf, sizeof(Hlsl::MeshShaderConst)); + m_deviceContext->Unmap(m_constantBuffer.Get(), 0u); + } + } + + m_deviceContext->VSSetShader(m_meshVs.Get(), nullptr, 0u); + m_deviceContext->GSSetShader(nullptr, nullptr, 0u); + + switch (params->renderStage) + { + case MESH_DRAW_SHADOW: + { + m_deviceContext->PSSetShader(m_meshShadowPs.Get(), nullptr, 0u); + break; + } + case MESH_DRAW_LIGHT: + { + m_deviceContext->PSSetShader(m_meshPs.Get(), nullptr, 0u); + + ShadowMapD3D11* shadowMap = (ShadowMapD3D11*)params->shadowMap; + ID3D11ShaderResourceView* srvs[1] = { shadowMap->m_depthSrv.Get() }; + m_deviceContext->PSSetShaderResources(0, 1, srvs); + ID3D11SamplerState* sampStates[1] = { shadowMap->m_linearSampler.Get() }; + m_deviceContext->PSSetSamplers(0, 1, sampStates); + break; + } + default: + assert(false); + break; + } + + m_deviceContext->IASetInputLayout(m_inputLayout.Get()); + m_deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + + m_deviceContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + m_deviceContext->PSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + + ID3D11Buffer* vertexBuffers[4] = + { + mesh->m_positionBuffer.Get(), + mesh->m_normalBuffer.Get(), + mesh->m_texcoordBuffer.Get(), + mesh->m_colorBuffer.Get(), + }; + + unsigned int vertexBufferStrides[4] = + { + sizeof(Vec3), + sizeof(Vec3), + sizeof(Vec2), + sizeof(Vec4) + }; + + unsigned int vertexBufferOffsets[4] = { 0, 0, 0, 0 }; + + m_deviceContext->IASetVertexBuffers(0, 4, vertexBuffers, vertexBufferStrides, vertexBufferOffsets); + m_deviceContext->IASetIndexBuffer(mesh->m_indexBuffer.Get(), DXGI_FORMAT_R32_UINT, 0u); + + float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); + if (depthSign < 0.f) + { + m_deviceContext->RSSetState(m_rasterizerState[params->renderMode][params->cullMode].Get()); + } + + m_deviceContext->DrawIndexed((UINT)mesh->m_numFaces*3, 0, 0); + + if (depthSign < 0.f) + { + m_deviceContext->RSSetState(nullptr); + } +} diff --git a/demo/d3d11/meshRenderD3D11.h b/demo/d3d11/meshRenderD3D11.h new file mode 100644 index 0000000..d7d6d1c --- /dev/null +++ b/demo/d3d11/meshRenderD3D11.h @@ -0,0 +1,74 @@ + +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#include <DirectXMath.h> + +#include "appD3D11Ctx.h" + +#include "core/maths.h" +#include "../d3d/renderParamsD3D.h" + +#include <wrl.h> +using namespace Microsoft::WRL; + +struct GpuMeshD3D11 +{ + GpuMeshD3D11(ID3D11Device* device, ID3D11DeviceContext* deviceContext) ; + + void resize(int numVertices, int numFaces); + + void updateData(const Vec3* positions, const Vec3* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces); + // duplicate method to handle conversion from vec4 to vec3 positions / normals + void updateData(const Vec4* positions, const Vec4* normals, const Vec2* texcoords, const Vec4* colors, const int* indices, int numVertices, int numFaces); + + ComPtr<ID3D11Buffer> m_positionBuffer; + ComPtr<ID3D11Buffer> m_normalBuffer; + ComPtr<ID3D11Buffer> m_texcoordBuffer; + ComPtr<ID3D11Buffer> m_colorBuffer; + + ComPtr<ID3D11Buffer> m_indexBuffer; + + int m_numVertices; + int m_numFaces; + + int m_maxVertices; + int m_maxFaces; + + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceContext; +}; + + +struct MeshRendererD3D11 +{ + void init(ID3D11Device* device, ID3D11DeviceContext* context, bool asyncComputeBenchmark); + void draw(const GpuMeshD3D11* mesh, const MeshDrawParamsD3D* params); + + MeshRendererD3D11(): + m_device(nullptr), + m_deviceContext(nullptr) + {} + + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceContext; + + ComPtr<ID3D11InputLayout> m_inputLayout; + ComPtr<ID3D11VertexShader> m_meshVs; + ComPtr<ID3D11PixelShader> m_meshPs; + ComPtr<ID3D11PixelShader> m_meshShadowPs; + ComPtr<ID3D11Buffer> m_constantBuffer; + ComPtr<ID3D11RasterizerState> m_rasterizerState[NUM_MESH_RENDER_MODES][NUM_MESH_CULL_MODES]; +}; + + + diff --git a/demo/d3d11/pointRender.h b/demo/d3d11/pointRender.h deleted file mode 100644 index 9631287..0000000 --- a/demo/d3d11/pointRender.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. - * - * NVIDIA CORPORATION and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA CORPORATION is strictly prohibited. - */ - -#pragma once - -#include <DirectXMath.h> - -#include "shadowMap.h" - -enum PointRenderMode -{ - POINT_RENDER_WIREFRAME, - POINT_RENDER_SOLID, - NUM_POINT_RENDER_MODES -}; - -enum PointCullMode -{ - POINT_CULL_NONE, - POINT_CULL_FRONT, - POINT_CULL_BACK, - NUM_POINT_CULL_MODES -}; - -enum PointDrawStage -{ - POINT_DRAW_NULL, - POINT_DRAW_SHADOW, - POINT_DRAW_REFLECTION, - POINT_DRAW_LIGHT -}; - -typedef DirectX::XMFLOAT3 float3; -typedef DirectX::XMFLOAT4 float4; -typedef DirectX::XMFLOAT4X4 float4x4; - -struct PointDrawParams -{ - PointRenderMode renderMode; - PointCullMode cullMode; - PointDrawStage renderStage; - - DirectX::XMMATRIX projection; - DirectX::XMMATRIX view; - DirectX::XMMATRIX model; - - float pointRadius; // point size in world space - float pointScale; // scale to calculate size in pixels - float spotMin; - float spotMax; - - DirectX::XMMATRIX lightTransform; - float3 lightPos; - float3 lightDir; - - float4 colors[8]; - - float4 shadowTaps[12]; - ShadowMap* shadowMap; - - int mode; -}; - - -struct PointRenderer -{ - ID3D11Device* m_device = nullptr; - ID3D11DeviceContext* m_deviceContext = nullptr; - - ID3D11InputLayout* m_inputLayout = nullptr; - ID3D11VertexShader* m_pointVS = nullptr; - ID3D11GeometryShader* m_pointGS = nullptr; - ID3D11PixelShader* m_pointPS = nullptr; - ID3D11Buffer* m_constantBuffer = nullptr; - ID3D11RasterizerState* m_rasterizerStateRH[NUM_POINT_RENDER_MODES][NUM_POINT_CULL_MODES]; - - void Init(ID3D11Device* device, ID3D11DeviceContext* deviceContext); - void Destroy(); - - void Draw(const PointDrawParams* params, ID3D11Buffer* positions, ID3D11Buffer* colors, ID3D11Buffer* indices, int numParticles, int offset); -}; diff --git a/demo/d3d11/pointRender.cpp b/demo/d3d11/pointRenderD3D11.cpp index 1d3a8b0..20dde46 100644 --- a/demo/d3d11/pointRender.cpp +++ b/demo/d3d11/pointRenderD3D11.cpp @@ -21,17 +21,18 @@ #include "appD3D11Ctx.h" -#include "pointRender.h" +#include "shadowMapD3D11.h" -#include "shaders/pointVS.hlsl.h" -#include "shaders/pointGS.hlsl.h" -#include "shaders/pointPS.hlsl.h" +#include "pointRenderD3D11.h" -#define EXCLUDE_SHADER_STRUCTS 1 -#include "shaders/shaderCommon.h" +#include "../d3d/shaders/pointVS.hlsl.h" +#include "../d3d/shaders/pointGS.hlsl.h" +#include "../d3d/shaders/pointPS.hlsl.h" +#include "../d3d/shaders/pointShadowPS.hlsl.h" +#include "../d3d/shaderCommonD3D.h" -void PointRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) +void PointRendererD3D11::init(ID3D11Device* device, ID3D11DeviceContext* context) { m_device = device; m_deviceContext = context; @@ -49,14 +50,15 @@ void PointRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) } // create the shaders - m_device->CreateVertexShader(g_pointVS, sizeof(g_pointVS), nullptr, &m_pointVS); - m_device->CreateGeometryShader(g_pointGS, sizeof(g_pointGS), nullptr, &m_pointGS); - m_device->CreatePixelShader(g_pointPS, sizeof(g_pointPS), nullptr, &m_pointPS); + m_device->CreateVertexShader(g_pointVS, sizeof(g_pointVS), nullptr, &m_pointVs); + m_device->CreateGeometryShader(g_pointGS, sizeof(g_pointGS), nullptr, &m_pointGs); + m_device->CreatePixelShader(g_pointPS, sizeof(g_pointPS), nullptr, &m_pointPs); + m_device->CreatePixelShader(g_pointShadowPS, sizeof(g_pointShadowPS), nullptr, &m_pointShadowPs); // create a constant buffer { D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = sizeof(PointShaderConst); // 64 * sizeof(float); + bufDesc.ByteWidth = sizeof(Hlsl::PointShaderConst); // 64 * sizeof(float); bufDesc.Usage = D3D11_USAGE_DYNAMIC; bufDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; @@ -65,7 +67,7 @@ void PointRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) m_device->CreateBuffer(&bufDesc, nullptr, &m_constantBuffer); } - // create the rastersizer state + // create the rasterizer state for (int i = 0; i < NUM_POINT_RENDER_MODES; i++) { for (int j = 0; j < NUM_POINT_CULL_MODES; j++) @@ -83,27 +85,12 @@ void PointRenderer::Init(ID3D11Device* device, ID3D11DeviceContext* context) desc.MultisampleEnable = FALSE; desc.AntialiasedLineEnable = FALSE; - m_device->CreateRasterizerState(&desc, &m_rasterizerStateRH[i][j]); + m_device->CreateRasterizerState(&desc, &m_rasterizerState[i][j]); } } } -void PointRenderer::Destroy() -{ - COMRelease(m_inputLayout); - COMRelease(m_pointVS); - COMRelease(m_pointGS); - COMRelease(m_pointPS); - COMRelease(m_constantBuffer); - - for (int i = 0; i < NUM_POINT_RENDER_MODES; i++) - for (int j = 0; j < NUM_POINT_CULL_MODES; j++) - COMRelease(m_rasterizerStateRH[i][j]); -} - - - -void PointRenderer::Draw(const PointDrawParams* params, ID3D11Buffer* positions, ID3D11Buffer* colors, ID3D11Buffer* indices, int numParticles, int offset) +void PointRendererD3D11::draw(const PointDrawParamsD3D* params, ID3D11Buffer* positions, ID3D11Buffer* colors, ID3D11Buffer* indices, int numParticles, int offset) { using namespace DirectX; @@ -112,64 +99,45 @@ void PointRenderer::Draw(const PointDrawParams* params, ID3D11Buffer* positions, // update constant buffer { D3D11_MAPPED_SUBRESOURCE mappedResource = {}; - if (S_OK == deviceContext->Map(m_constantBuffer, 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)) + if (SUCCEEDED(deviceContext->Map(m_constantBuffer.Get(), 0u, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource))) { - PointShaderConst cParams; - - cParams.modelview = (float4x4&)XMMatrixMultiply(params->model, params->view); - cParams.projection = (float4x4&)params->projection; - - cParams.pointRadius = params->pointRadius; - cParams.pointScale = params->pointScale; - cParams.spotMin = params->spotMin; - cParams.spotMax = params->spotMax; - - cParams.lightTransform = (float4x4&)params->lightTransform; - cParams.lightPos = params->lightPos; - cParams.lightDir = params->lightDir; - - for (int i = 0; i < 8; i++) - cParams.colors[i] = params->colors[i]; - - memcpy(cParams.shadowTaps, params->shadowTaps, sizeof(cParams.shadowTaps)); - - cParams.mode = params->mode; - - memcpy(mappedResource.pData, &cParams, sizeof(PointShaderConst)); - - deviceContext->Unmap(m_constantBuffer, 0u); + Hlsl::PointShaderConst constBuf; + RenderParamsUtilD3D::calcPointConstantBuffer(*params, constBuf); + memcpy(mappedResource.pData, &constBuf, sizeof(Hlsl::PointShaderConst)); + deviceContext->Unmap(m_constantBuffer.Get(), 0u); } } - deviceContext->VSSetShader(m_pointVS, nullptr, 0u); - deviceContext->GSSetShader(m_pointGS, nullptr, 0u); - deviceContext->PSSetShader(m_pointPS, nullptr, 0u); + deviceContext->VSSetShader(m_pointVs.Get(), nullptr, 0u); + deviceContext->GSSetShader(m_pointGs.Get(), nullptr, 0u); + deviceContext->PSSetShader(m_pointPs.Get(), nullptr, 0u); if (params->shadowMap) { - ShadowMap* shadowMap = (ShadowMap*)params->shadowMap; + ShadowMapD3D11* shadowMap = (ShadowMapD3D11*)params->shadowMap; if (params->renderStage == POINT_DRAW_SHADOW) { - ID3D11ShaderResourceView* ppSRV[1] = { nullptr }; - deviceContext->PSSetShaderResources(0, 1, ppSRV); - ID3D11SamplerState* ppSS[1] = { shadowMap->m_linearSampler.Get() }; - deviceContext->PSSetSamplers(0, 1, ppSS); + ID3D11ShaderResourceView* srvs[1] = { nullptr }; + deviceContext->PSSetShaderResources(0, 1, srvs); + ID3D11SamplerState* samps[1] = { shadowMap->m_linearSampler.Get() }; + deviceContext->PSSetSamplers(0, 1, samps); + deviceContext->PSSetShader(m_pointShadowPs.Get(), nullptr, 0u); } else { - ID3D11ShaderResourceView* ppSRV[1] = { shadowMap->m_depthSrv.Get() }; - deviceContext->PSSetShaderResources(0, 1, ppSRV); - ID3D11SamplerState* ppSS[1] = { shadowMap->m_linearSampler.Get() }; - deviceContext->PSSetSamplers(0, 1, ppSS); + ID3D11ShaderResourceView* srvs[1] = { shadowMap->m_depthSrv.Get() }; + deviceContext->PSSetShaderResources(0, 1, srvs); + ID3D11SamplerState* samps[1] = { shadowMap->m_linearSampler.Get() }; + deviceContext->PSSetSamplers(0, 1, samps); } } - deviceContext->IASetInputLayout(m_inputLayout); + deviceContext->IASetInputLayout(m_inputLayout.Get()); deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); - deviceContext->VSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->GSSetConstantBuffers(0, 1, &m_constantBuffer); - deviceContext->PSSetConstantBuffers(0, 1, &m_constantBuffer); + deviceContext->VSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->GSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); + deviceContext->PSSetConstantBuffers(0, 1, m_constantBuffer.GetAddressOf()); ID3D11Buffer* vertexBuffers[3] = { @@ -190,11 +158,10 @@ void PointRenderer::Draw(const PointDrawParams* params, ID3D11Buffer* positions, deviceContext->IASetVertexBuffers(0, 3, vertexBuffers, vertexBufferStrides, vertexBufferOffsets); deviceContext->IASetIndexBuffer(indices, DXGI_FORMAT_R32_UINT, 0u); - float depthSign = DirectX::XMVectorGetW(params->projection.r[2]); if (depthSign < 0.f) { - deviceContext->RSSetState(m_rasterizerStateRH[params->renderMode][params->cullMode]); + deviceContext->RSSetState(m_rasterizerState[params->renderMode][params->cullMode].Get()); } deviceContext->DrawIndexed(numParticles, offset, 0); diff --git a/demo/d3d11/pointRenderD3D11.h b/demo/d3d11/pointRenderD3D11.h new file mode 100644 index 0000000..71a6247 --- /dev/null +++ b/demo/d3d11/pointRenderD3D11.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2008-2017, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA CORPORATION and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA CORPORATION is strictly prohibited. + */ + +#pragma once + +#include "../d3d/renderParamsD3D.h" + +#include <DirectXMath.h> +#include <wrl.h> +using namespace Microsoft::WRL; + + +struct PointRendererD3D11 +{ + void init(ID3D11Device* device, ID3D11DeviceContext* deviceContext); + + void draw(const PointDrawParamsD3D* params, ID3D11Buffer* positions, ID3D11Buffer* colors, ID3D11Buffer* indices, int numParticles, int offset); + + PointRendererD3D11(): + m_device(nullptr), + m_deviceContext(nullptr) + {} + + ID3D11Device* m_device; + ID3D11DeviceContext* m_deviceContext; + + ComPtr<ID3D11InputLayout> m_inputLayout; + ComPtr<ID3D11VertexShader> m_pointVs; + ComPtr<ID3D11GeometryShader> m_pointGs; + ComPtr<ID3D11PixelShader> m_pointPs; + ComPtr<ID3D11PixelShader> m_pointShadowPs; + ComPtr<ID3D11Buffer> m_constantBuffer; + + // Assumes right handed + ComPtr<ID3D11RasterizerState> m_rasterizerState[NUM_POINT_RENDER_MODES][NUM_POINT_CULL_MODES]; +}; diff --git a/demo/d3d11/renderTarget.cpp b/demo/d3d11/renderTargetD3D11.cpp index da71e4f..4035039 100644 --- a/demo/d3d11/renderTarget.cpp +++ b/demo/d3d11/renderTargetD3D11.cpp @@ -8,9 +8,9 @@ * license agreement from NVIDIA CORPORATION is strictly prohibited. */ -#include "renderTarget.h" +#include "renderTargetD3D11.h" -RenderTarget::RenderTarget() +RenderTargetD3D11::RenderTargetD3D11() { } @@ -56,7 +56,7 @@ static D3D11_SHADER_RESOURCE_VIEW_DESC _getSrvDesc(DXGI_FORMAT format) return desc; } -HRESULT RenderTarget::Init(ID3D11Device* device, int width, int height, bool depthTest) +HRESULT RenderTargetD3D11::init(ID3D11Device* device, int width, int height, bool depthTest) { // set viewport { @@ -130,7 +130,7 @@ HRESULT RenderTarget::Init(ID3D11Device* device, int width, int height, bool dep return S_OK; } -void RenderTarget::BindAndClear(ID3D11DeviceContext* context) +void RenderTargetD3D11::bindAndClear(ID3D11DeviceContext* context) { ID3D11RenderTargetView* ppRtv[1] = { m_backRtv.Get() }; context->OMSetRenderTargets(1, ppRtv, m_depthDsv.Get()); diff --git a/demo/d3d11/renderTarget.h b/demo/d3d11/renderTargetD3D11.h index ae5ff40..b299bec 100644 --- a/demo/d3d11/renderTarget.h +++ b/demo/d3d11/renderTargetD3D11.h @@ -20,15 +20,15 @@ using namespace Microsoft::WRL; #define NV_NULL nullptr #define NV_RETURN_ON_FAIL(x) { HRESULT _res = (x); if (FAILED(_res)) { return _res; } } -struct RenderTarget +struct RenderTargetD3D11 { public: - RenderTarget(); + RenderTargetD3D11(); - HRESULT Init(ID3D11Device* device, int width, int height, bool depthTest = true); + HRESULT init(ID3D11Device* device, int width, int height, bool depthTest = true); - void BindAndClear(ID3D11DeviceContext* context); + void bindAndClear(ID3D11DeviceContext* context); XMMATRIX m_lightView; XMMATRIX m_lightProjection; diff --git a/demo/d3d11/shaders/blurDepthPS.hlsl b/demo/d3d11/shaders/blurDepthPS.hlsl deleted file mode 100644 index a2eee0a..0000000 --- a/demo/d3d11/shaders/blurDepthPS.hlsl +++ /dev/null @@ -1,91 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - FluidShaderConst gParams; -}; - -Texture2D<float> depthTex : register(t0); - -float sqr(float x) { return x*x; } - -float4 blurDepthPS(PassthroughVertexOut input) : SV_TARGET -{ - float4 gl_FragColor = float4(0.0, 0.0, 0.0, 0.0); - float4 gl_FragCoord = input.position; - - // debug: return the center depth sample - //float d = depthTex.Load(int3(gl_FragCoord.xy, 0)).x; - //return d; - - const float blurRadiusWorld = gParams.blurRadiusWorld; - const float blurScale = gParams.blurScale; - const float blurFalloff = gParams.blurFalloff; - - // eye-space depth of center sample - float depth = depthTex.Load(int3(gl_FragCoord.xy, 0)).x; - float thickness = 0.0f; //texture2D(thicknessTex, gl_TexCoord[0].xy).x; - - /* - // threshold on thickness to create nice smooth silhouettes - if (depth == 0.0) - { - gl_FragColor.x = 0.0; - return gl_FragColor; - } - */ - - float blurDepthFalloff = 5.5; - float maxBlurRadius = 5.0; - - //discontinuities between different tap counts are visible. to avoid this we - //use fractional contributions between #taps = ceil(radius) and floor(radius) - float radius = min(maxBlurRadius, blurScale * (blurRadiusWorld / -depth)); - float radiusInv = 1.0 / radius; - float taps = ceil(radius); - float frac = taps - radius; - - float sum = 0.0; - float wsum = 0.0; - float count = 0.0; - - for (float y = -taps; y <= taps; y += 1.0) - { - for (float x = -taps; x <= taps; x += 1.0) - { - float2 offset = float2(x, y); - - //float sample = texture2DRect(depthTex, gl_FragCoord.xy + offset).x; - float sample = depthTex.Load(int3(gl_FragCoord.xy + offset, 0)).x; - - //if (sample < -10000.0 * 0.5) - //continue; - - // spatial domain - float r1 = length(float2(x, y))*radiusInv; - float w = exp(-(r1*r1)); - - // range domain (based on depth difference) - float r2 = (sample - depth) * blurDepthFalloff; - float g = exp(-(r2*r2)); - - //fractional radius contributions - float wBoundary = step(radius, max(abs(x), abs(y))); - float wFrac = 1.0 - wBoundary*frac; - - sum += sample * w * g * wFrac; - wsum += w * g * wFrac; - count += g * wFrac; - } - } - - if (wsum > 0.0) - { - sum /= wsum; - } - - float blend = count / sqr(2.0 * radius + 1.0); - gl_FragColor.x = lerp(depth, sum, blend); - - return gl_FragColor; -} diff --git a/demo/d3d11/shaders/blurDepthPS.hlsl.h b/demo/d3d11/shaders/blurDepthPS.hlsl.h deleted file mode 100644 index ff191f8..0000000 --- a/demo/d3d11/shaders/blurDepthPS.hlsl.h +++ /dev/null @@ -1,664 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer constBuf -// { -// -// struct FluidShaderConst -// { -// -// float4x4 modelviewprojection; // Offset: 0 -// float4x4 modelview; // Offset: 64 -// float4x4 projection; // Offset: 128 -// float4x4 modelview_inverse; // Offset: 192 -// float4x4 projection_inverse; // Offset: 256 -// float4 invTexScale; // Offset: 320 -// float3 invViewport; // Offset: 336 -// float _pad0; // Offset: 348 -// float blurRadiusWorld; // Offset: 352 -// float blurScale; // Offset: 356 -// float blurFalloff; // Offset: 360 -// int debug; // Offset: 364 -// float3 lightPos; // Offset: 368 -// float _pad1; // Offset: 380 -// float3 lightDir; // Offset: 384 -// float _pad2; // Offset: 396 -// float4x4 lightTransform; // Offset: 400 -// float4 color; // Offset: 464 -// float4 clipPosToEye; // Offset: 480 -// float spotMin; // Offset: 496 -// float spotMax; // Offset: 500 -// float ior; // Offset: 504 -// float _pad3; // Offset: 508 -// float4 shadowTaps[12]; // Offset: 512 -// -// } gParams; // Offset: 0 Size: 704 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// depthTex texture float 2d 0 1 -// constBuf cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_POSITION 0 xyzw 0 POS float xy -// TEXCOORD 0 xy 1 NONE float -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// -ps_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[23], immediateIndexed -dcl_resource_texture2d (float,float,float,float) t0 -dcl_input_ps_siv linear noperspective v0.xy, position -dcl_output o0.xyzw -dcl_temps 5 -ftoi r0.xy, v0.xyxx -mov r0.zw, l(0,0,0,0) -ld_indexable(texture2d)(float,float,float,float) r0.x, r0.xyzw, t0.xyzw -div r0.y, cb0[22].x, -r0.x -mul r0.y, r0.y, cb0[22].y -min r0.y, r0.y, l(5.000000) -div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y -round_pi r0.w, r0.y -add r1.x, -r0.y, r0.w -mov r2.zw, l(0,0,0,0) -mov r1.yzw, l(0,0,0,0) -mov r3.y, -r0.w -loop - lt r3.z, r0.w, r3.y - breakc_nz r3.z - mov r4.xyz, r1.yzwy - mov r4.w, -r0.w - loop - lt r3.z, r0.w, r4.w - breakc_nz r3.z - mov r3.x, r4.w - add r3.zw, r3.xxxy, v0.xxxy - ftoi r2.xy, r3.zwzz - ld_indexable(texture2d)(float,float,float,float) r2.x, r2.xyzw, t0.xyzw - dp2 r2.y, r3.xyxx, r3.xyxx - sqrt r2.y, r2.y - mul r2.y, r0.z, r2.y - mul r2.y, r2.y, r2.y - mul r2.y, r2.y, l(-1.442695) - exp r2.y, r2.y - add r3.x, -r0.x, r2.x - mul r3.x, r3.x, l(5.500000) - mul r3.x, r3.x, r3.x - mul r3.x, r3.x, l(-1.442695) - exp r3.x, r3.x - max r3.z, |r3.y|, |r4.w| - ge r3.z, r3.z, r0.y - and r3.z, r3.z, l(0x3f800000) - mad r3.z, -r3.z, r1.x, l(1.000000) - mul r2.x, r2.y, r2.x - mul r2.x, r3.x, r2.x - mad r4.x, r2.x, r3.z, r4.x - mul r2.x, r2.y, r3.x - mad r4.y, r2.x, r3.z, r4.y - mad r4.z, r3.x, r3.z, r4.z - add r4.w, r4.w, l(1.000000) - endloop - mov r1.yzw, r4.xxyz - add r3.y, r3.y, l(1.000000) -endloop -lt r0.z, l(0.000000), r1.z -div r0.w, r1.y, r1.z -movc r0.z, r0.z, r0.w, r1.y -mad r0.y, r0.y, l(2.000000), l(1.000000) -mul r0.y, r0.y, r0.y -div r0.y, r1.w, r0.y -add r0.z, -r0.x, r0.z -mad o0.x, r0.y, r0.z, r0.x -mov o0.yzw, l(0,0,0,0) -ret -// Approximately 60 instruction slots used -#endif - -const BYTE g_blurDepthPS[] = -{ - 68, 88, 66, 67, 244, 233, - 190, 43, 161, 207, 241, 98, - 173, 248, 128, 15, 40, 190, - 66, 70, 1, 0, 0, 0, - 76, 12, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 156, 4, 0, 0, 244, 4, - 0, 0, 40, 5, 0, 0, - 176, 11, 0, 0, 82, 68, - 69, 70, 96, 4, 0, 0, - 1, 0, 0, 0, 144, 0, - 0, 0, 2, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 255, 255, 0, 1, 0, 0, - 44, 4, 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, - 124, 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, 1, 0, - 0, 0, 133, 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, - 1, 0, 0, 0, 100, 101, - 112, 116, 104, 84, 101, 120, - 0, 99, 111, 110, 115, 116, - 66, 117, 102, 0, 171, 171, - 133, 0, 0, 0, 1, 0, - 0, 0, 168, 0, 0, 0, - 192, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 208, 0, 0, 0, 0, 0, - 0, 0, 192, 2, 0, 0, - 2, 0, 0, 0, 8, 4, - 0, 0, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 103, 80, - 97, 114, 97, 109, 115, 0, - 70, 108, 117, 105, 100, 83, - 104, 97, 100, 101, 114, 67, - 111, 110, 115, 116, 0, 109, - 111, 100, 101, 108, 118, 105, - 101, 119, 112, 114, 111, 106, - 101, 99, 116, 105, 111, 110, - 0, 102, 108, 111, 97, 116, - 52, 120, 52, 0, 171, 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, 253, 0, 0, 0, - 109, 111, 100, 101, 108, 118, - 105, 101, 119, 0, 112, 114, - 111, 106, 101, 99, 116, 105, - 111, 110, 0, 109, 111, 100, - 101, 108, 118, 105, 101, 119, - 95, 105, 110, 118, 101, 114, - 115, 101, 0, 112, 114, 111, - 106, 101, 99, 116, 105, 111, - 110, 95, 105, 110, 118, 101, - 114, 115, 101, 0, 105, 110, - 118, 84, 101, 120, 83, 99, - 97, 108, 101, 0, 102, 108, - 111, 97, 116, 52, 0, 171, - 171, 171, 1, 0, 3, 0, - 1, 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, 114, 1, - 0, 0, 105, 110, 118, 86, - 105, 101, 119, 112, 111, 114, - 116, 0, 102, 108, 111, 97, - 116, 51, 0, 171, 1, 0, - 3, 0, 1, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 172, 1, 0, 0, 95, 112, - 97, 100, 48, 0, 102, 108, - 111, 97, 116, 0, 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, - 222, 1, 0, 0, 98, 108, - 117, 114, 82, 97, 100, 105, - 117, 115, 87, 111, 114, 108, - 100, 0, 98, 108, 117, 114, - 83, 99, 97, 108, 101, 0, - 98, 108, 117, 114, 70, 97, - 108, 108, 111, 102, 102, 0, - 100, 101, 98, 117, 103, 0, - 105, 110, 116, 0, 0, 0, - 2, 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, - 52, 2, 0, 0, 108, 105, - 103, 104, 116, 80, 111, 115, - 0, 95, 112, 97, 100, 49, - 0, 108, 105, 103, 104, 116, - 68, 105, 114, 0, 95, 112, - 97, 100, 50, 0, 108, 105, - 103, 104, 116, 84, 114, 97, - 110, 115, 102, 111, 114, 109, - 0, 99, 111, 108, 111, 114, - 0, 99, 108, 105, 112, 80, - 111, 115, 84, 111, 69, 121, - 101, 0, 115, 112, 111, 116, - 77, 105, 110, 0, 115, 112, - 111, 116, 77, 97, 120, 0, - 105, 111, 114, 0, 95, 112, - 97, 100, 51, 0, 115, 104, - 97, 100, 111, 119, 84, 97, - 112, 115, 0, 171, 171, 171, - 1, 0, 3, 0, 1, 0, - 4, 0, 12, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 114, 1, 0, 0, - 233, 0, 0, 0, 8, 1, - 0, 0, 0, 0, 0, 0, - 44, 1, 0, 0, 8, 1, - 0, 0, 64, 0, 0, 0, - 54, 1, 0, 0, 8, 1, - 0, 0, 128, 0, 0, 0, - 65, 1, 0, 0, 8, 1, - 0, 0, 192, 0, 0, 0, - 83, 1, 0, 0, 8, 1, - 0, 0, 0, 1, 0, 0, - 102, 1, 0, 0, 124, 1, - 0, 0, 64, 1, 0, 0, - 160, 1, 0, 0, 180, 1, - 0, 0, 80, 1, 0, 0, - 216, 1, 0, 0, 228, 1, - 0, 0, 92, 1, 0, 0, - 8, 2, 0, 0, 228, 1, - 0, 0, 96, 1, 0, 0, - 24, 2, 0, 0, 228, 1, - 0, 0, 100, 1, 0, 0, - 34, 2, 0, 0, 228, 1, - 0, 0, 104, 1, 0, 0, - 46, 2, 0, 0, 56, 2, - 0, 0, 108, 1, 0, 0, - 92, 2, 0, 0, 180, 1, - 0, 0, 112, 1, 0, 0, - 101, 2, 0, 0, 228, 1, - 0, 0, 124, 1, 0, 0, - 107, 2, 0, 0, 180, 1, - 0, 0, 128, 1, 0, 0, - 116, 2, 0, 0, 228, 1, - 0, 0, 140, 1, 0, 0, - 122, 2, 0, 0, 8, 1, - 0, 0, 144, 1, 0, 0, - 137, 2, 0, 0, 124, 1, - 0, 0, 208, 1, 0, 0, - 143, 2, 0, 0, 124, 1, - 0, 0, 224, 1, 0, 0, - 156, 2, 0, 0, 228, 1, - 0, 0, 240, 1, 0, 0, - 164, 2, 0, 0, 228, 1, - 0, 0, 244, 1, 0, 0, - 172, 2, 0, 0, 228, 1, - 0, 0, 248, 1, 0, 0, - 176, 2, 0, 0, 228, 1, - 0, 0, 252, 1, 0, 0, - 182, 2, 0, 0, 196, 2, - 0, 0, 0, 2, 0, 0, - 5, 0, 0, 0, 1, 0, - 176, 0, 0, 0, 24, 0, - 232, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 216, 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, 54, - 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, - 52, 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, 3, - 0, 0, 68, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 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, 69, 88, 128, 6, - 0, 0, 80, 0, 0, 0, - 160, 1, 0, 0, 106, 8, - 0, 1, 89, 0, 0, 4, - 70, 142, 32, 0, 0, 0, - 0, 0, 23, 0, 0, 0, - 88, 24, 0, 4, 0, 112, - 16, 0, 0, 0, 0, 0, - 85, 85, 0, 0, 100, 32, - 0, 4, 50, 16, 16, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 0, 0, - 0, 0, 104, 0, 0, 2, - 5, 0, 0, 0, 27, 0, - 0, 5, 50, 0, 16, 0, - 0, 0, 0, 0, 70, 16, - 16, 0, 0, 0, 0, 0, - 54, 0, 0, 8, 194, 0, - 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 45, 0, 0, 137, - 194, 0, 0, 128, 67, 85, - 21, 0, 18, 0, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 70, 126, 16, 0, 0, 0, - 0, 0, 14, 0, 0, 9, - 34, 0, 16, 0, 0, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 22, 0, - 0, 0, 10, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 56, 0, 0, 8, - 34, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 26, 128, - 32, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 51, 0, - 0, 7, 34, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 160, 64, 14, 0, 0, 10, - 66, 0, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 128, 63, 0, 0, - 128, 63, 0, 0, 128, 63, - 0, 0, 128, 63, 26, 0, - 16, 0, 0, 0, 0, 0, - 66, 0, 0, 5, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 8, - 18, 0, 16, 0, 1, 0, - 0, 0, 26, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 8, 194, 0, 16, 0, - 2, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 54, 0, 0, 8, 226, 0, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 54, 0, 0, 6, - 34, 0, 16, 0, 3, 0, - 0, 0, 58, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 48, 0, 0, 1, - 49, 0, 0, 7, 66, 0, - 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 3, 0, 0, 0, 3, 0, - 4, 3, 42, 0, 16, 0, - 3, 0, 0, 0, 54, 0, - 0, 5, 114, 0, 16, 0, - 4, 0, 0, 0, 150, 7, - 16, 0, 1, 0, 0, 0, - 54, 0, 0, 6, 130, 0, - 16, 0, 4, 0, 0, 0, - 58, 0, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 48, 0, 0, 1, 49, 0, - 0, 7, 66, 0, 16, 0, - 3, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 4, 0, - 0, 0, 3, 0, 4, 3, - 42, 0, 16, 0, 3, 0, - 0, 0, 54, 0, 0, 5, - 18, 0, 16, 0, 3, 0, - 0, 0, 58, 0, 16, 0, - 4, 0, 0, 0, 0, 0, - 0, 7, 194, 0, 16, 0, - 3, 0, 0, 0, 6, 4, - 16, 0, 3, 0, 0, 0, - 6, 20, 16, 0, 0, 0, - 0, 0, 27, 0, 0, 5, - 50, 0, 16, 0, 2, 0, - 0, 0, 230, 10, 16, 0, - 3, 0, 0, 0, 45, 0, - 0, 137, 194, 0, 0, 128, - 67, 85, 21, 0, 18, 0, - 16, 0, 2, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 70, 126, 16, 0, - 0, 0, 0, 0, 15, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 70, 0, - 16, 0, 3, 0, 0, 0, - 70, 0, 16, 0, 3, 0, - 0, 0, 75, 0, 0, 5, - 34, 0, 16, 0, 2, 0, - 0, 0, 26, 0, 16, 0, - 2, 0, 0, 0, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 2, 0, - 0, 0, 56, 0, 0, 7, - 34, 0, 16, 0, 2, 0, - 0, 0, 26, 0, 16, 0, - 2, 0, 0, 0, 26, 0, - 16, 0, 2, 0, 0, 0, - 56, 0, 0, 7, 34, 0, - 16, 0, 2, 0, 0, 0, - 26, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 59, 170, 184, 191, 25, 0, - 0, 5, 34, 0, 16, 0, - 2, 0, 0, 0, 26, 0, - 16, 0, 2, 0, 0, 0, - 0, 0, 0, 8, 18, 0, - 16, 0, 3, 0, 0, 0, - 10, 0, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 2, 0, - 0, 0, 56, 0, 0, 7, - 18, 0, 16, 0, 3, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 176, 64, - 56, 0, 0, 7, 18, 0, - 16, 0, 3, 0, 0, 0, - 10, 0, 16, 0, 3, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 56, 0, - 0, 7, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 0, - 16, 0, 3, 0, 0, 0, - 1, 64, 0, 0, 59, 170, - 184, 191, 25, 0, 0, 5, - 18, 0, 16, 0, 3, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 52, 0, - 0, 9, 66, 0, 16, 0, - 3, 0, 0, 0, 26, 0, - 16, 128, 129, 0, 0, 0, - 3, 0, 0, 0, 58, 0, - 16, 128, 129, 0, 0, 0, - 4, 0, 0, 0, 29, 0, - 0, 7, 66, 0, 16, 0, - 3, 0, 0, 0, 42, 0, - 16, 0, 3, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 1, 0, 0, 7, - 66, 0, 16, 0, 3, 0, - 0, 0, 42, 0, 16, 0, - 3, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 50, 0, 0, 10, 66, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 128, 65, 0, - 0, 0, 3, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 7, 18, 0, 16, 0, - 2, 0, 0, 0, 26, 0, - 16, 0, 2, 0, 0, 0, - 10, 0, 16, 0, 2, 0, - 0, 0, 56, 0, 0, 7, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 10, 0, - 16, 0, 2, 0, 0, 0, - 50, 0, 0, 9, 18, 0, - 16, 0, 4, 0, 0, 0, - 10, 0, 16, 0, 2, 0, - 0, 0, 42, 0, 16, 0, - 3, 0, 0, 0, 10, 0, - 16, 0, 4, 0, 0, 0, - 56, 0, 0, 7, 18, 0, - 16, 0, 2, 0, 0, 0, - 26, 0, 16, 0, 2, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 50, 0, - 0, 9, 34, 0, 16, 0, - 4, 0, 0, 0, 10, 0, - 16, 0, 2, 0, 0, 0, - 42, 0, 16, 0, 3, 0, - 0, 0, 26, 0, 16, 0, - 4, 0, 0, 0, 50, 0, - 0, 9, 66, 0, 16, 0, - 4, 0, 0, 0, 10, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 3, 0, - 0, 0, 42, 0, 16, 0, - 4, 0, 0, 0, 0, 0, - 0, 7, 130, 0, 16, 0, - 4, 0, 0, 0, 58, 0, - 16, 0, 4, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 22, 0, 0, 1, - 54, 0, 0, 5, 226, 0, - 16, 0, 1, 0, 0, 0, - 6, 9, 16, 0, 4, 0, - 0, 0, 0, 0, 0, 7, - 34, 0, 16, 0, 3, 0, - 0, 0, 26, 0, 16, 0, - 3, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 22, 0, 0, 1, 49, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 14, 0, 0, 7, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 1, 0, 0, 0, 42, 0, - 16, 0, 1, 0, 0, 0, - 55, 0, 0, 9, 66, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 1, 0, 0, 0, - 50, 0, 0, 9, 34, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 64, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 7, 34, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 14, 0, - 0, 7, 34, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 1, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 8, - 66, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 0, 0, 0, 0, 50, 0, - 0, 9, 18, 32, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 8, 226, 32, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 62, 0, 0, 1, 83, 84, - 65, 84, 148, 0, 0, 0, - 60, 0, 0, 0, 5, 0, - 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 38, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 1, 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, - 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 9, 0, - 0, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; diff --git a/demo/d3d11/shaders/compositePS.hlsl b/demo/d3d11/shaders/compositePS.hlsl deleted file mode 100644 index b082aa6..0000000 --- a/demo/d3d11/shaders/compositePS.hlsl +++ /dev/null @@ -1,194 +0,0 @@ -#include "shaderCommon.h" - -#define ENABLE_SIMPLE_FLUID 1 - -cbuffer constBuf : register(b0) -{ - FluidShaderConst gParams; -}; - -Texture2D<float> depthTex : register(t0); -Texture2D<float3> sceneTex : register(t1); -Texture2D<float> shadowTex : register(t2); // shadow map - -SamplerState texSampler : register(s0); -SamplerComparisonState shadowSampler : register(s1); // texture sample used to sample depth from shadow texture in this sample - -// sample shadow map -float shadowSample(float3 worldPos, out float attenuation) -{ -#if 0 - attenuation = 0.0f; - return 0.5; -#else - - float4 pos = mul(gParams.lightTransform, float4(worldPos + gParams.lightDir*0.15, 1.0)); - pos /= pos.w; - float3 uvw = (pos.xyz * float3(0.5, 0.5, 1.0)) + float3(0.5, 0.5, 0.0); - - attenuation = 1.0;//max(smoothstep(spotMax, spotMin, dot(pos.xy, pos.xy)), 0.05); - - // user clip - if (uvw.x < 0.0 || uvw.x > 1.0) - return 1.0; - if (uvw.y < 0.0 || uvw.y > 1.0) - return 1.0; - - float s = 0.0; - float radius = 0.002; - - uvw.y = 1.0f - uvw.y; - - [unroll] - for (int i = 0; i < 8; i++) - { - float2 shadowTaps = gParams.shadowTaps[i].xy; - shadowTaps.y = 1.0f - shadowTaps.y; - s += shadowTex.SampleCmpLevelZero(shadowSampler, uvw.xy + shadowTaps * radius, uvw.z); - - //s += shadow2D(shadowTex, vec3(uvw.xy + shadowTaps[i] * radius, uvw.z)).r; - } - - s /= 8.0; - return s; -#endif -} - -float3 viewportToEyeSpace(float2 coord, float eyeZ) -{ - float2 clipPosToEye = gParams.clipPosToEye.xy; - - // find position at z=1 plane - //float2 uv = (coord * 2.0 - float2(1.0, 1.0)) * clipPosToEye; - float2 uv = float2(coord.x*2.0f-1.0f, (1.0f-coord.y)*2.0f - 1.0f)*clipPosToEye; - - return float3(-uv * eyeZ, eyeZ); -} - -float3 srgbToLinear(float3 c) { const float v = 2.2; return pow(c, float3(v, v, v)); } -float3 linearToSrgb(float3 c) { const float v = 1.0 / 2.2; return pow(c, float3(v, v, v)); } - -float sqr(float x) { return x*x; } -float cube(float x) { return x*x*x; } - -float4 compositePS(PassthroughVertexOut input - , out float gl_FragDepth : SV_DEPTH -) : SV_TARGET -{ - - float4 gl_FragColor; - - const float4x4 gl_ProjectionMatrix = gParams.projection; - const float4x4 gl_ModelViewMatrix = gParams.modelview; - const float4x4 gl_ModelViewMatrixInverse = gParams.modelview_inverse; - - const float2 invTexScale = gParams.invTexScale.xy; - - const float3 lightDir = gParams.lightDir; - const float3 lightPos = gParams.lightPos; - const float spotMin = gParams.spotMin; - const float spotMax = gParams.spotMax; - const float ior = gParams.ior; - const float4 color = gParams.color; - - // flip uv y-coordinate - float2 uvCoord = float2(input.texCoord[0].x, 1.0f-input.texCoord[0].y); - - float eyeZ = depthTex.Sample(texSampler, uvCoord).x; - - if (eyeZ == 0.0) - discard; - - // reconstruct eye space pos from depth - float3 eyePos = viewportToEyeSpace(uvCoord, eyeZ); - - - // finite difference approx for normals, can't take dFdx because - // the one-sided difference is incorrect at shape boundaries - float3 zl = eyePos - viewportToEyeSpace(uvCoord - float2(invTexScale.x, 0.0), depthTex.Sample(texSampler, uvCoord - float2(invTexScale.x, 0.0)).x); - float3 zr = viewportToEyeSpace(uvCoord + float2(invTexScale.x, 0.0), depthTex.Sample(texSampler, uvCoord + float2(invTexScale.x, 0.0)).x) - eyePos; - float3 zt = viewportToEyeSpace(uvCoord + float2(0.0, invTexScale.y), depthTex.Sample(texSampler, uvCoord + float2(0.0, invTexScale.y)).x) - eyePos; - float3 zb = eyePos - viewportToEyeSpace(uvCoord - float2(0.0, invTexScale.y), depthTex.Sample(texSampler, uvCoord - float2(0.0, invTexScale.y)).x); - - float3 dx = zl; - float3 dy = zt; - - if (abs(zr.z) < abs(zl.z)) - dx = zr; - - if (abs(zb.z) < abs(zt.z)) - dy = zb; - - - //float3 dx = ddx(eyePos.xyz); - //float3 dy = -ddy(eyePos.xyz); - - float4 worldPos = mul(gl_ModelViewMatrixInverse, float4(eyePos, 1.0)); - - float attenuation; - float shadow = shadowSample(worldPos.xyz, attenuation); - - float3 l = mul(gl_ModelViewMatrix, float4(lightDir, 0.0)).xyz; - float3 v = -normalize(eyePos); - - float3 n = -normalize(cross(dx, dy)); // sign difference from texcoord coordinate difference between OpenGL - float3 h = normalize(v + l); - - float3 skyColor = float3(0.1, 0.2, 0.4)*1.2; - float3 groundColor = float3(0.1, 0.1, 0.2); - - float fresnel = 0.1 + (1.0 - 0.1)*cube(1.0 - max(dot(n, v), 0.0)); - - float3 lVec = normalize(worldPos.xyz - lightPos); - - float ln = dot(l, n)*attenuation; - - float3 rEye = reflect(-v, n).xyz; - float3 rWorld = mul(gl_ModelViewMatrixInverse, float4(rEye, 0.0)).xyz; - - float2 texScale = float2(0.75, 1.0); // to account for backbuffer aspect ratio (todo: pass in) - - float refractScale = ior*0.025; - float reflectScale = ior*0.1; - - // attenuate refraction near ground (hack) - refractScale *= smoothstep(0.1, 0.4, worldPos.y); - - float2 refractCoord = uvCoord + n.xy*refractScale*texScale; - - // read thickness from refracted coordinate otherwise we get halos around objectsw - float thickness = 0.8f;//max(texture2D(thicknessTex, refractCoord).x, 0.3); - - //vec3 transmission = exp(-(vec3(1.0)-color.xyz)*thickness); - float3 transmission = (1.0 - (1.0 - color.xyz)*thickness*0.8)*color.w; - float3 refract = sceneTex.Sample(texSampler, refractCoord).xyz*transmission; - - float2 sceneReflectCoord = uvCoord - rEye.xy*texScale*reflectScale / eyePos.z; - float3 sceneReflect = sceneTex.Sample(texSampler, sceneReflectCoord).xyz*shadow; - //vec3 planarReflect = texture2D(reflectTex, gl_TexCoord[0].xy).xyz; - float3 planarReflect = float3(0.0, 0.0, 0.0); - - // fade out planar reflections above the ground - //float3 reflect = lerp(planarReflect, sceneReflect, smoothstep(0.05, 0.3, worldPos.y)) + lerp(groundColor, skyColor, smoothstep(0.15, 0.25, rWorld.y)*shadow); - float3 reflect = sceneReflect + lerp(groundColor, skyColor, smoothstep(0.15, 0.25, rWorld.y)*shadow); - - // lighting - float3 diffuse = color.xyz * lerp(float3(0.29, 0.379, 0.59), float3(1.0, 1.0, 1.0), (ln*0.5 + 0.5)*max(shadow, 0.4))*(1.0 - color.w); - float specular = 1.2*pow(max(dot(h, n), 0.0), 400.0); - - gl_FragColor.xyz = diffuse + (lerp(refract, reflect, fresnel) + specular)*color.w; - gl_FragColor.w = 1.0; - - // visualize normals - //gl_FragColor = float4(n*0.5 + 0.5, 1.0); - //gl_FragColor.xyz = float3(fresnel, fresnel, fresnel); - //gl_FragColor.xyz = n; - - // write valid z - float4 clipPos = mul(gl_ProjectionMatrix, float4(0.0, 0.0, eyeZ, 1.0)); - clipPos.z /= clipPos.w; - gl_FragDepth = clipPos.z; - - return gl_FragColor; - -} diff --git a/demo/d3d11/shaders/compositePS.hlsl.h b/demo/d3d11/shaders/compositePS.hlsl.h deleted file mode 100644 index 77d3814..0000000 --- a/demo/d3d11/shaders/compositePS.hlsl.h +++ /dev/null @@ -1,1643 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer constBuf -// { -// -// struct FluidShaderConst -// { -// -// float4x4 modelviewprojection; // Offset: 0 -// float4x4 modelview; // Offset: 64 -// float4x4 projection; // Offset: 128 -// float4x4 modelview_inverse; // Offset: 192 -// float4x4 projection_inverse; // Offset: 256 -// float4 invTexScale; // Offset: 320 -// float3 invViewport; // Offset: 336 -// float _pad0; // Offset: 348 -// float blurRadiusWorld; // Offset: 352 -// float blurScale; // Offset: 356 -// float blurFalloff; // Offset: 360 -// int debug; // Offset: 364 -// float3 lightPos; // Offset: 368 -// float _pad1; // Offset: 380 -// float3 lightDir; // Offset: 384 -// float _pad2; // Offset: 396 -// float4x4 lightTransform; // Offset: 400 -// float4 color; // Offset: 464 -// float4 clipPosToEye; // Offset: 480 -// float spotMin; // Offset: 496 -// float spotMax; // Offset: 500 -// float ior; // Offset: 504 -// float _pad3; // Offset: 508 -// float4 shadowTaps[12]; // Offset: 512 -// -// } gParams; // Offset: 0 Size: 704 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// texSampler sampler NA NA 0 1 -// shadowSampler sampler_c NA NA 1 1 -// depthTex texture float 2d 0 1 -// sceneTex texture float3 2d 1 1 -// shadowTex texture float 2d 2 1 -// constBuf cbuffer NA NA 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 -// SV_DEPTH 0 N/A oDepth DEPTH float YES -// -ps_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[40], immediateIndexed -dcl_sampler s0, mode_default -dcl_sampler s1, mode_comparison -dcl_resource_texture2d (float,float,float,float) t0 -dcl_resource_texture2d (float,float,float,float) t1 -dcl_resource_texture2d (float,float,float,float) t2 -dcl_input_ps linear v1.xy -dcl_output o0.xyzw -dcl_output oDepth -dcl_temps 8 -mad r0.xy, v1.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000), l(0.000000, 1.000000, 0.000000, 0.000000) -sample_indexable(texture2d)(float,float,float,float) r1.z, r0.xyxx, t0.yzxw, s0 -eq r0.z, r1.z, l(0.000000) -discard_nz r0.z -mad r0.zw, v1.xxxy, l(0.000000, 0.000000, 2.000000, 2.000000), l(0.000000, 0.000000, -1.000000, -1.000000) -mul r0.zw, r0.zzzw, cb0[30].xxxy -mul r1.xy, r1.zzzz, -r0.zwzz -mov r2.y, cb0[20].x -mov r2.z, l(0) -add r0.zw, r0.xxxy, -r2.yyyz -sample_indexable(texture2d)(float,float,float,float) r2.x, r0.zwzz, t0.xyzw, s0 -mad r0.zw, r0.zzzw, l(0.000000, 0.000000, 2.000000, -2.000000), l(0.000000, 0.000000, -1.000000, 1.000000) -mul r0.zw, r0.zzzw, cb0[30].xxxy -mul r2.yz, r2.xxxx, -r0.zzwz -add r2.xyz, r1.zxyz, -r2.xyzx -mov r3.y, cb0[20].x -mov r3.z, l(1.000000) -mad r0.zw, v1.xxxy, l(0.000000, 0.000000, 1.000000, -1.000000), r3.yyyz -sample_indexable(texture2d)(float,float,float,float) r3.x, r0.zwzz, t0.xyzw, s0 -mad r0.zw, r0.zzzw, l(0.000000, 0.000000, 2.000000, -2.000000), l(0.000000, 0.000000, -1.000000, 1.000000) -mul r0.zw, r0.zzzw, cb0[30].xxxy -mul r3.yz, r3.xxxx, -r0.zzwz -add r3.xyz, -r1.zxyz, r3.xyzx -mov r4.z, l(0) -mov r4.x, cb0[20].y -add r0.zw, r0.yyyx, r4.xxxz -sample_indexable(texture2d)(float,float,float,float) r5.y, r0.wzww, t0.yxzw, s0 -mad r0.zw, r0.zzzw, l(0.000000, 0.000000, -2.000000, 2.000000), l(0.000000, 0.000000, 1.000000, -1.000000) -mul r0.zw, r0.zzzw, cb0[30].yyyx -mul r5.xz, r5.yyyy, -r0.zzwz -add r5.xyz, -r1.yzxy, r5.xyzx -add r0.zw, r0.yyyx, -r4.xxxz -sample_indexable(texture2d)(float,float,float,float) r4.y, r0.wzww, t0.yxzw, s0 -mad r0.zw, r0.zzzw, l(0.000000, 0.000000, -2.000000, 2.000000), l(0.000000, 0.000000, 1.000000, -1.000000) -mul r0.zw, r0.zzzw, cb0[30].yyyx -mul r4.xz, r4.yyyy, -r0.zzwz -add r4.xyz, r1.yzxy, -r4.xyzx -lt r0.z, |r3.x|, |r2.x| -movc r2.xyz, r0.zzzz, r3.xyzx, r2.xyzx -lt r0.z, |r4.y|, |r5.y| -movc r3.xyz, r0.zzzz, r4.xyzx, r5.xyzx -mul r4.xyz, r1.yyyy, cb0[13].xyzx -mad r4.xyz, cb0[12].xyzx, r1.xxxx, r4.xyzx -mad r4.xyz, cb0[14].xyzx, r1.zzzz, r4.xyzx -add r4.xyz, r4.xyzx, cb0[15].xyzx -mad r4.xzw, cb0[24].xxyz, l(0.150000, 0.000000, 0.150000, 0.150000), r4.xxyz -mul r5.xyzw, r4.zzzz, cb0[26].xyzw -mad r5.xyzw, cb0[25].xyzw, r4.xxxx, r5.xyzw -mad r5.xyzw, cb0[27].xyzw, r4.wwww, r5.xyzw -add r5.xyzw, r5.xyzw, cb0[28].xyzw -div r4.xzw, r5.xxyz, r5.wwww -mad r5.xyz, r4.xzwx, l(0.500000, 0.500000, 1.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000) -lt r0.z, r5.x, l(0.000000) -lt r0.w, l(1.000000), r5.x -or r0.z, r0.w, r0.z -if_z r0.z - lt r0.z, r5.y, l(0.000000) - lt r0.w, l(1.000000), r5.y - or r0.z, r0.w, r0.z - if_z r0.z - add r0.z, -cb0[32].y, l(1.000000) - mul r6.x, cb0[32].x, l(0.002000) - mul r6.y, r0.z, l(0.002000) - add r5.w, -r5.y, l(1.000000) - add r0.zw, r5.xxxw, r6.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.z, r0.zwzz, t2.xxxx, s1, r5.z - add r0.w, -cb0[33].y, l(1.000000) - mul r6.x, cb0[33].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[34].y, l(1.000000) - mul r6.x, cb0[34].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[35].y, l(1.000000) - mul r6.x, cb0[35].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[36].y, l(1.000000) - mul r6.x, cb0[36].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[37].y, l(1.000000) - mul r6.x, cb0[37].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[38].y, l(1.000000) - mul r6.x, cb0[38].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[39].y, l(1.000000) - mul r6.x, cb0[39].x, l(0.002000) - mul r6.y, r0.w, l(0.002000) - add r4.xz, r5.xxwx, r6.xxyx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r4.xzxx, t2.xxxx, s1, r5.z - add r0.z, r0.w, r0.z - mul r0.z, r0.z, l(0.125000) - else - mov r0.z, l(1.000000) - endif -else - mov r0.z, l(1.000000) -endif -mul r4.xzw, cb0[5].xxyz, cb0[24].yyyy -mad r4.xzw, cb0[4].xxyz, cb0[24].xxxx, r4.xxzw -mad r4.xzw, cb0[6].xxyz, cb0[24].zzzz, r4.xxzw -dp3 r0.w, r1.xyzx, r1.xyzx -rsq r0.w, r0.w -mul r5.xyz, r0.wwww, r1.xyzx -mul r6.xyz, r2.xyzx, r3.xyzx -mad r2.xyz, r2.zxyz, r3.yzxy, -r6.xyzx -dp3 r1.w, r2.xyzx, r2.xyzx -rsq r1.w, r1.w -mul r2.xyz, r1.wwww, r2.xyzx -mad r1.xyw, -r1.xyxz, r0.wwww, r4.xzxw -dp3 r0.w, r1.xywx, r1.xywx -rsq r0.w, r0.w -mul r1.xyw, r0.wwww, r1.xyxw -dp3 r0.w, -r2.xyzx, -r5.xyzx -max r0.w, r0.w, l(0.000000) -add r0.w, -r0.w, l(1.000000) -mul r2.w, r0.w, r0.w -mul r0.w, r0.w, r2.w -mad r0.w, r0.w, l(0.900000), l(0.100000) -dp3 r2.w, r4.xzwx, -r2.xyzx -dp3 r3.x, r5.xyzx, -r2.xyzx -add r3.x, r3.x, r3.x -mad r3.xyz, r2.xyzx, r3.xxxx, r5.xyzx -mul r3.w, r3.y, cb0[13].y -mad r3.w, cb0[12].y, r3.x, r3.w -mad r3.z, cb0[14].y, r3.z, r3.w -mul r5.xy, cb0[31].zzzz, l(0.025000, 0.100000, 0.000000, 0.000000) -add r3.w, r4.y, l(-0.100000) -mul_sat r3.w, r3.w, l(3.333333) -mad r4.x, r3.w, l(-2.000000), l(3.000000) -mul r3.w, r3.w, r3.w -mul r3.w, r3.w, r4.x -mul r3.w, r3.w, r5.x -mul r4.xy, -r2.xyxx, r3.wwww -mad r4.xy, r4.xyxx, l(0.750000, 1.000000, 0.000000, 0.000000), r0.xyxx -add r6.xyzw, -cb0[29].xyzw, l(1.000000, 1.000000, 1.000000, 1.000000) -mad r6.xyz, -r6.xyzx, l(0.640000, 0.640000, 0.640000, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000) -mul r6.xyz, r6.xyzx, cb0[29].wwww -sample_indexable(texture2d)(float,float,float,float) r4.xyz, r4.xyxx, t1.xyzw, s0 -mul r7.xyz, r6.xyzx, r4.xyzx -mov r5.xz, l(0.750000,0,1.000000,0) -mul r3.xy, r3.xyxx, r5.yzyy -mul r5.y, cb0[31].z, l(0.100000) -mul r3.xy, r3.xyxx, r5.xyxx -div r3.xy, r3.xyxx, r1.zzzz -add r0.xy, r0.xyxx, -r3.xyxx -sample_indexable(texture2d)(float,float,float,float) r3.xyw, r0.xyxx, t1.xywz, s0 -add r0.x, r3.z, l(-0.150000) -mul_sat r0.x, r0.x, l(10.000001) -mad r0.y, r0.x, l(-2.000000), l(3.000000) -mul r0.x, r0.x, r0.x -mul r0.x, r0.x, r0.y -mul r0.x, r0.z, r0.x -mul r5.xyz, r0.xxxx, l(0.020000, 0.140000, 0.280000, 0.000000) -mad r3.xyz, r3.xywx, r0.zzzz, r5.xyzx -add r3.xyz, r3.xyzx, l(0.100000, 0.100000, 0.200000, 0.000000) -mad r0.x, r2.w, l(0.500000), l(0.500000) -max r0.y, r0.z, l(0.400000) -mul r0.x, r0.y, r0.x -mad r0.xyz, r0.xxxx, l(0.710000, 0.621000, 0.410000, 0.000000), l(0.290000, 0.379000, 0.590000, 0.000000) -mul r0.xyz, r0.xyzx, cb0[29].xyzx -dp3 r1.x, r1.xywx, -r2.xyzx -max r1.x, r1.x, l(0.000000) -log r1.x, r1.x -mul r1.x, r1.x, l(400.000000) -exp r1.x, r1.x -mad r2.xyz, -r4.xyzx, r6.xyzx, r3.xyzx -mad r2.xyz, r0.wwww, r2.xyzx, r7.xyzx -mad r1.xyw, r1.xxxx, l(1.200000, 1.200000, 0.000000, 1.200000), r2.xyxz -mul r1.xyw, r1.xyxw, cb0[29].wwww -mad o0.xyz, r0.xyzx, r6.wwww, r1.xywx -mad r0.xy, cb0[10].zwzz, r1.zzzz, cb0[11].zwzz -div oDepth, r0.x, r0.y -mov o0.w, l(1.000000) -ret -// Approximately 192 instruction slots used -#endif - -const BYTE g_compositePS[] = -{ - 68, 88, 66, 67, 223, 79, - 142, 103, 26, 30, 227, 152, - 95, 75, 188, 26, 149, 14, - 233, 77, 1, 0, 0, 0, - 232, 31, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 72, 5, 0, 0, 160, 5, - 0, 0, 244, 5, 0, 0, - 76, 31, 0, 0, 82, 68, - 69, 70, 12, 5, 0, 0, - 1, 0, 0, 0, 60, 1, - 0, 0, 6, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 255, 255, 0, 1, 0, 0, - 216, 4, 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, - 252, 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, 1, 0, - 0, 0, 7, 1, 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, - 3, 0, 0, 0, 21, 1, - 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, 1, 0, 0, 0, - 30, 1, 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, 9, 0, - 0, 0, 39, 1, 0, 0, - 2, 0, 0, 0, 5, 0, - 0, 0, 4, 0, 0, 0, - 255, 255, 255, 255, 2, 0, - 0, 0, 1, 0, 0, 0, - 1, 0, 0, 0, 49, 1, - 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, 1, 0, 0, 0, - 116, 101, 120, 83, 97, 109, - 112, 108, 101, 114, 0, 115, - 104, 97, 100, 111, 119, 83, - 97, 109, 112, 108, 101, 114, - 0, 100, 101, 112, 116, 104, - 84, 101, 120, 0, 115, 99, - 101, 110, 101, 84, 101, 120, - 0, 115, 104, 97, 100, 111, - 119, 84, 101, 120, 0, 99, - 111, 110, 115, 116, 66, 117, - 102, 0, 171, 171, 49, 1, - 0, 0, 1, 0, 0, 0, - 84, 1, 0, 0, 192, 2, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 124, 1, - 0, 0, 0, 0, 0, 0, - 192, 2, 0, 0, 2, 0, - 0, 0, 180, 4, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 103, 80, 97, 114, - 97, 109, 115, 0, 70, 108, - 117, 105, 100, 83, 104, 97, - 100, 101, 114, 67, 111, 110, - 115, 116, 0, 109, 111, 100, - 101, 108, 118, 105, 101, 119, - 112, 114, 111, 106, 101, 99, - 116, 105, 111, 110, 0, 102, - 108, 111, 97, 116, 52, 120, - 52, 0, 171, 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, - 169, 1, 0, 0, 109, 111, - 100, 101, 108, 118, 105, 101, - 119, 0, 112, 114, 111, 106, - 101, 99, 116, 105, 111, 110, - 0, 109, 111, 100, 101, 108, - 118, 105, 101, 119, 95, 105, - 110, 118, 101, 114, 115, 101, - 0, 112, 114, 111, 106, 101, - 99, 116, 105, 111, 110, 95, - 105, 110, 118, 101, 114, 115, - 101, 0, 105, 110, 118, 84, - 101, 120, 83, 99, 97, 108, - 101, 0, 102, 108, 111, 97, - 116, 52, 0, 171, 171, 171, - 1, 0, 3, 0, 1, 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, 30, 2, 0, 0, - 105, 110, 118, 86, 105, 101, - 119, 112, 111, 114, 116, 0, - 102, 108, 111, 97, 116, 51, - 0, 171, 1, 0, 3, 0, - 1, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 88, 2, - 0, 0, 95, 112, 97, 100, - 48, 0, 102, 108, 111, 97, - 116, 0, 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, 138, 2, - 0, 0, 98, 108, 117, 114, - 82, 97, 100, 105, 117, 115, - 87, 111, 114, 108, 100, 0, - 98, 108, 117, 114, 83, 99, - 97, 108, 101, 0, 98, 108, - 117, 114, 70, 97, 108, 108, - 111, 102, 102, 0, 100, 101, - 98, 117, 103, 0, 105, 110, - 116, 0, 0, 0, 2, 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, 224, 2, - 0, 0, 108, 105, 103, 104, - 116, 80, 111, 115, 0, 95, - 112, 97, 100, 49, 0, 108, - 105, 103, 104, 116, 68, 105, - 114, 0, 95, 112, 97, 100, - 50, 0, 108, 105, 103, 104, - 116, 84, 114, 97, 110, 115, - 102, 111, 114, 109, 0, 99, - 111, 108, 111, 114, 0, 99, - 108, 105, 112, 80, 111, 115, - 84, 111, 69, 121, 101, 0, - 115, 112, 111, 116, 77, 105, - 110, 0, 115, 112, 111, 116, - 77, 97, 120, 0, 105, 111, - 114, 0, 95, 112, 97, 100, - 51, 0, 115, 104, 97, 100, - 111, 119, 84, 97, 112, 115, - 0, 171, 171, 171, 1, 0, - 3, 0, 1, 0, 4, 0, - 12, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 30, 2, 0, 0, 149, 1, - 0, 0, 180, 1, 0, 0, - 0, 0, 0, 0, 216, 1, - 0, 0, 180, 1, 0, 0, - 64, 0, 0, 0, 226, 1, - 0, 0, 180, 1, 0, 0, - 128, 0, 0, 0, 237, 1, - 0, 0, 180, 1, 0, 0, - 192, 0, 0, 0, 255, 1, - 0, 0, 180, 1, 0, 0, - 0, 1, 0, 0, 18, 2, - 0, 0, 40, 2, 0, 0, - 64, 1, 0, 0, 76, 2, - 0, 0, 96, 2, 0, 0, - 80, 1, 0, 0, 132, 2, - 0, 0, 144, 2, 0, 0, - 92, 1, 0, 0, 180, 2, - 0, 0, 144, 2, 0, 0, - 96, 1, 0, 0, 196, 2, - 0, 0, 144, 2, 0, 0, - 100, 1, 0, 0, 206, 2, - 0, 0, 144, 2, 0, 0, - 104, 1, 0, 0, 218, 2, - 0, 0, 228, 2, 0, 0, - 108, 1, 0, 0, 8, 3, - 0, 0, 96, 2, 0, 0, - 112, 1, 0, 0, 17, 3, - 0, 0, 144, 2, 0, 0, - 124, 1, 0, 0, 23, 3, - 0, 0, 96, 2, 0, 0, - 128, 1, 0, 0, 32, 3, - 0, 0, 144, 2, 0, 0, - 140, 1, 0, 0, 38, 3, - 0, 0, 180, 1, 0, 0, - 144, 1, 0, 0, 53, 3, - 0, 0, 40, 2, 0, 0, - 208, 1, 0, 0, 59, 3, - 0, 0, 40, 2, 0, 0, - 224, 1, 0, 0, 72, 3, - 0, 0, 144, 2, 0, 0, - 240, 1, 0, 0, 80, 3, - 0, 0, 144, 2, 0, 0, - 244, 1, 0, 0, 88, 3, - 0, 0, 144, 2, 0, 0, - 248, 1, 0, 0, 92, 3, - 0, 0, 144, 2, 0, 0, - 252, 1, 0, 0, 98, 3, - 0, 0, 112, 3, 0, 0, - 0, 2, 0, 0, 5, 0, - 0, 0, 1, 0, 176, 0, - 0, 0, 24, 0, 148, 3, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 132, 1, 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, 54, 46, 51, - 46, 57, 54, 48, 48, 46, - 49, 54, 51, 56, 52, 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, 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, 0, 0, 0, 66, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 255, 255, 255, 255, - 1, 14, 0, 0, 83, 86, - 95, 84, 65, 82, 71, 69, - 84, 0, 83, 86, 95, 68, - 69, 80, 84, 72, 0, 171, - 83, 72, 69, 88, 80, 25, - 0, 0, 80, 0, 0, 0, - 84, 6, 0, 0, 106, 8, - 0, 1, 89, 0, 0, 4, - 70, 142, 32, 0, 0, 0, - 0, 0, 40, 0, 0, 0, - 90, 0, 0, 3, 0, 96, - 16, 0, 0, 0, 0, 0, - 90, 8, 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, 88, 24, 0, 4, - 0, 112, 16, 0, 2, 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, - 101, 0, 0, 2, 1, 192, - 0, 0, 104, 0, 0, 2, - 8, 0, 0, 0, 50, 0, - 0, 15, 50, 0, 16, 0, - 0, 0, 0, 0, 70, 16, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 128, 63, 0, 0, 128, 191, - 0, 0, 0, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 128, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 69, 0, - 0, 139, 194, 0, 0, 128, - 67, 85, 21, 0, 66, 0, - 16, 0, 1, 0, 0, 0, - 70, 0, 16, 0, 0, 0, - 0, 0, 150, 124, 16, 0, - 0, 0, 0, 0, 0, 96, - 16, 0, 0, 0, 0, 0, - 24, 0, 0, 7, 66, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 13, 0, - 4, 3, 42, 0, 16, 0, - 0, 0, 0, 0, 50, 0, - 0, 15, 194, 0, 16, 0, - 0, 0, 0, 0, 6, 20, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 64, 0, 0, - 0, 64, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 191, - 0, 0, 128, 191, 56, 0, - 0, 8, 194, 0, 16, 0, - 0, 0, 0, 0, 166, 14, - 16, 0, 0, 0, 0, 0, - 6, 132, 32, 0, 0, 0, - 0, 0, 30, 0, 0, 0, - 56, 0, 0, 8, 50, 0, - 16, 0, 1, 0, 0, 0, - 166, 10, 16, 0, 1, 0, - 0, 0, 230, 10, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 54, 0, 0, 6, - 34, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 20, 0, - 0, 0, 54, 0, 0, 5, - 66, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 8, 194, 0, 16, 0, - 0, 0, 0, 0, 6, 4, - 16, 0, 0, 0, 0, 0, - 86, 9, 16, 128, 65, 0, - 0, 0, 2, 0, 0, 0, - 69, 0, 0, 139, 194, 0, - 0, 128, 67, 85, 21, 0, - 18, 0, 16, 0, 2, 0, - 0, 0, 230, 10, 16, 0, - 0, 0, 0, 0, 70, 126, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 15, - 194, 0, 16, 0, 0, 0, - 0, 0, 166, 14, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 64, 0, 0, 0, 192, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 128, 191, 0, 0, - 128, 63, 56, 0, 0, 8, - 194, 0, 16, 0, 0, 0, - 0, 0, 166, 14, 16, 0, - 0, 0, 0, 0, 6, 132, - 32, 0, 0, 0, 0, 0, - 30, 0, 0, 0, 56, 0, - 0, 8, 98, 0, 16, 0, - 2, 0, 0, 0, 6, 0, - 16, 0, 2, 0, 0, 0, - 166, 11, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 8, 114, 0, - 16, 0, 2, 0, 0, 0, - 38, 9, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 128, - 65, 0, 0, 0, 2, 0, - 0, 0, 54, 0, 0, 6, - 34, 0, 16, 0, 3, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 20, 0, - 0, 0, 54, 0, 0, 5, - 66, 0, 16, 0, 3, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 50, 0, - 0, 12, 194, 0, 16, 0, - 0, 0, 0, 0, 6, 20, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 128, 63, 0, 0, - 128, 191, 86, 9, 16, 0, - 3, 0, 0, 0, 69, 0, - 0, 139, 194, 0, 0, 128, - 67, 85, 21, 0, 18, 0, - 16, 0, 3, 0, 0, 0, - 230, 10, 16, 0, 0, 0, - 0, 0, 70, 126, 16, 0, - 0, 0, 0, 0, 0, 96, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 15, 194, 0, - 16, 0, 0, 0, 0, 0, - 166, 14, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 64, - 0, 0, 0, 192, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 128, 191, 0, 0, 128, 63, - 56, 0, 0, 8, 194, 0, - 16, 0, 0, 0, 0, 0, - 166, 14, 16, 0, 0, 0, - 0, 0, 6, 132, 32, 0, - 0, 0, 0, 0, 30, 0, - 0, 0, 56, 0, 0, 8, - 98, 0, 16, 0, 3, 0, - 0, 0, 6, 0, 16, 0, - 3, 0, 0, 0, 166, 11, - 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 8, 114, 0, 16, 0, - 3, 0, 0, 0, 38, 9, - 16, 128, 65, 0, 0, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 3, 0, 0, 0, - 54, 0, 0, 5, 66, 0, - 16, 0, 4, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 0, 54, 0, 0, 6, - 18, 0, 16, 0, 4, 0, - 0, 0, 26, 128, 32, 0, - 0, 0, 0, 0, 20, 0, - 0, 0, 0, 0, 0, 7, - 194, 0, 16, 0, 0, 0, - 0, 0, 86, 1, 16, 0, - 0, 0, 0, 0, 6, 8, - 16, 0, 4, 0, 0, 0, - 69, 0, 0, 139, 194, 0, - 0, 128, 67, 85, 21, 0, - 34, 0, 16, 0, 5, 0, - 0, 0, 182, 15, 16, 0, - 0, 0, 0, 0, 22, 126, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 15, - 194, 0, 16, 0, 0, 0, - 0, 0, 166, 14, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 192, 0, 0, 0, 64, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 128, 63, 0, 0, - 128, 191, 56, 0, 0, 8, - 194, 0, 16, 0, 0, 0, - 0, 0, 166, 14, 16, 0, - 0, 0, 0, 0, 86, 129, - 32, 0, 0, 0, 0, 0, - 30, 0, 0, 0, 56, 0, - 0, 8, 82, 0, 16, 0, - 5, 0, 0, 0, 86, 5, - 16, 0, 5, 0, 0, 0, - 166, 11, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 8, 114, 0, - 16, 0, 5, 0, 0, 0, - 150, 4, 16, 128, 65, 0, - 0, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 8, - 194, 0, 16, 0, 0, 0, - 0, 0, 86, 1, 16, 0, - 0, 0, 0, 0, 6, 8, - 16, 128, 65, 0, 0, 0, - 4, 0, 0, 0, 69, 0, - 0, 139, 194, 0, 0, 128, - 67, 85, 21, 0, 34, 0, - 16, 0, 4, 0, 0, 0, - 182, 15, 16, 0, 0, 0, - 0, 0, 22, 126, 16, 0, - 0, 0, 0, 0, 0, 96, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 15, 194, 0, - 16, 0, 0, 0, 0, 0, - 166, 14, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 192, - 0, 0, 0, 64, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 128, 63, 0, 0, 128, 191, - 56, 0, 0, 8, 194, 0, - 16, 0, 0, 0, 0, 0, - 166, 14, 16, 0, 0, 0, - 0, 0, 86, 129, 32, 0, - 0, 0, 0, 0, 30, 0, - 0, 0, 56, 0, 0, 8, - 82, 0, 16, 0, 4, 0, - 0, 0, 86, 5, 16, 0, - 4, 0, 0, 0, 166, 11, - 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 8, 114, 0, 16, 0, - 4, 0, 0, 0, 150, 4, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 128, 65, 0, - 0, 0, 4, 0, 0, 0, - 49, 0, 0, 9, 66, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 128, 129, 0, - 0, 0, 3, 0, 0, 0, - 10, 0, 16, 128, 129, 0, - 0, 0, 2, 0, 0, 0, - 55, 0, 0, 9, 114, 0, - 16, 0, 2, 0, 0, 0, - 166, 10, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 70, 2, - 16, 0, 2, 0, 0, 0, - 49, 0, 0, 9, 66, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 128, 129, 0, - 0, 0, 4, 0, 0, 0, - 26, 0, 16, 128, 129, 0, - 0, 0, 5, 0, 0, 0, - 55, 0, 0, 9, 114, 0, - 16, 0, 3, 0, 0, 0, - 166, 10, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 4, 0, 0, 0, 70, 2, - 16, 0, 5, 0, 0, 0, - 56, 0, 0, 8, 114, 0, - 16, 0, 4, 0, 0, 0, - 86, 5, 16, 0, 1, 0, - 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 13, 0, - 0, 0, 50, 0, 0, 10, - 114, 0, 16, 0, 4, 0, - 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 12, 0, - 0, 0, 6, 0, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 4, 0, 0, 0, - 50, 0, 0, 10, 114, 0, - 16, 0, 4, 0, 0, 0, - 70, 130, 32, 0, 0, 0, - 0, 0, 14, 0, 0, 0, - 166, 10, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 0, - 4, 0, 0, 0, 0, 0, - 0, 8, 114, 0, 16, 0, - 4, 0, 0, 0, 70, 2, - 16, 0, 4, 0, 0, 0, - 70, 130, 32, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 50, 0, 0, 13, 210, 0, - 16, 0, 4, 0, 0, 0, - 6, 137, 32, 0, 0, 0, - 0, 0, 24, 0, 0, 0, - 2, 64, 0, 0, 154, 153, - 25, 62, 0, 0, 0, 0, - 154, 153, 25, 62, 154, 153, - 25, 62, 6, 9, 16, 0, - 4, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 5, 0, 0, 0, 166, 10, - 16, 0, 4, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 26, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 5, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 25, 0, 0, 0, - 6, 0, 16, 0, 4, 0, - 0, 0, 70, 14, 16, 0, - 5, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 5, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 27, 0, 0, 0, 246, 15, - 16, 0, 4, 0, 0, 0, - 70, 14, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 8, - 242, 0, 16, 0, 5, 0, - 0, 0, 70, 14, 16, 0, - 5, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 14, 0, - 0, 7, 210, 0, 16, 0, - 4, 0, 0, 0, 6, 9, - 16, 0, 5, 0, 0, 0, - 246, 15, 16, 0, 5, 0, - 0, 0, 50, 0, 0, 15, - 114, 0, 16, 0, 5, 0, - 0, 0, 134, 3, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 128, 63, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 63, 0, 0, 0, 63, - 0, 0, 0, 0, 0, 0, - 0, 0, 49, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 5, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 49, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 10, 0, 16, 0, - 5, 0, 0, 0, 60, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 31, 0, 0, 3, - 42, 0, 16, 0, 0, 0, - 0, 0, 49, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 5, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 49, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 26, 0, 16, 0, - 5, 0, 0, 0, 60, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 31, 0, 0, 3, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 66, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 32, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 6, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 32, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 6, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 8, - 130, 0, 16, 0, 5, 0, - 0, 0, 26, 0, 16, 128, - 65, 0, 0, 0, 5, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 0, 0, - 0, 7, 194, 0, 16, 0, - 0, 0, 0, 0, 6, 12, - 16, 0, 5, 0, 0, 0, - 6, 4, 16, 0, 6, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 0, 0, 0, 0, 230, 10, - 16, 0, 0, 0, 0, 0, - 6, 112, 16, 0, 2, 0, - 0, 0, 0, 96, 16, 0, - 1, 0, 0, 0, 42, 0, - 16, 0, 5, 0, 0, 0, - 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 33, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 6, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 33, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 6, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 0, 0, 0, 7, 82, 0, - 16, 0, 4, 0, 0, 0, - 6, 3, 16, 0, 5, 0, - 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, - 134, 0, 16, 0, 4, 0, - 0, 0, 6, 112, 16, 0, - 2, 0, 0, 0, 0, 96, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 6, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 34, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 6, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 0, 0, 0, 7, 82, 0, - 16, 0, 4, 0, 0, 0, - 6, 3, 16, 0, 5, 0, - 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, - 134, 0, 16, 0, 4, 0, - 0, 0, 6, 112, 16, 0, - 2, 0, 0, 0, 0, 96, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 35, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 6, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 35, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 6, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 0, 0, 0, 7, 82, 0, - 16, 0, 4, 0, 0, 0, - 6, 3, 16, 0, 5, 0, - 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, - 134, 0, 16, 0, 4, 0, - 0, 0, 6, 112, 16, 0, - 2, 0, 0, 0, 0, 96, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 36, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 6, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 36, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 6, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 0, 0, 0, 7, 82, 0, - 16, 0, 4, 0, 0, 0, - 6, 3, 16, 0, 5, 0, - 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, - 134, 0, 16, 0, 4, 0, - 0, 0, 6, 112, 16, 0, - 2, 0, 0, 0, 0, 96, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 37, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 6, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 37, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 6, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 0, 0, 0, 7, 82, 0, - 16, 0, 4, 0, 0, 0, - 6, 3, 16, 0, 5, 0, - 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, - 134, 0, 16, 0, 4, 0, - 0, 0, 6, 112, 16, 0, - 2, 0, 0, 0, 0, 96, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 38, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 6, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 38, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 6, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 0, 0, 0, 7, 82, 0, - 16, 0, 4, 0, 0, 0, - 6, 3, 16, 0, 5, 0, - 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, - 134, 0, 16, 0, 4, 0, - 0, 0, 6, 112, 16, 0, - 2, 0, 0, 0, 0, 96, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 39, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 6, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 39, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 6, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 0, 0, 0, 7, 82, 0, - 16, 0, 4, 0, 0, 0, - 6, 3, 16, 0, 5, 0, - 0, 0, 6, 1, 16, 0, - 6, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 130, 0, - 16, 0, 0, 0, 0, 0, - 134, 0, 16, 0, 4, 0, - 0, 0, 6, 112, 16, 0, - 2, 0, 0, 0, 0, 96, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 66, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 62, 18, 0, - 0, 1, 54, 0, 0, 5, - 66, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 21, 0, - 0, 1, 18, 0, 0, 1, - 54, 0, 0, 5, 66, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 21, 0, 0, 1, - 56, 0, 0, 9, 210, 0, - 16, 0, 4, 0, 0, 0, - 6, 137, 32, 0, 0, 0, - 0, 0, 5, 0, 0, 0, - 86, 133, 32, 0, 0, 0, - 0, 0, 24, 0, 0, 0, - 50, 0, 0, 11, 210, 0, - 16, 0, 4, 0, 0, 0, - 6, 137, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 6, 128, 32, 0, 0, 0, - 0, 0, 24, 0, 0, 0, - 6, 14, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 11, - 210, 0, 16, 0, 4, 0, - 0, 0, 6, 137, 32, 0, - 0, 0, 0, 0, 6, 0, - 0, 0, 166, 138, 32, 0, - 0, 0, 0, 0, 24, 0, - 0, 0, 6, 14, 16, 0, - 4, 0, 0, 0, 16, 0, - 0, 7, 130, 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, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 7, 114, 0, 16, 0, - 5, 0, 0, 0, 246, 15, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 56, 0, 0, 7, - 114, 0, 16, 0, 6, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 70, 2, - 16, 0, 3, 0, 0, 0, - 50, 0, 0, 10, 114, 0, - 16, 0, 2, 0, 0, 0, - 38, 9, 16, 0, 2, 0, - 0, 0, 150, 4, 16, 0, - 3, 0, 0, 0, 70, 2, - 16, 128, 65, 0, 0, 0, - 6, 0, 0, 0, 16, 0, - 0, 7, 130, 0, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 2, 0, 0, 0, - 70, 2, 16, 0, 2, 0, - 0, 0, 68, 0, 0, 5, - 130, 0, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, - 1, 0, 0, 0, 56, 0, - 0, 7, 114, 0, 16, 0, - 2, 0, 0, 0, 246, 15, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 2, 0, - 0, 0, 50, 0, 0, 10, - 178, 0, 16, 0, 1, 0, - 0, 0, 70, 8, 16, 128, - 65, 0, 0, 0, 1, 0, - 0, 0, 246, 15, 16, 0, - 0, 0, 0, 0, 134, 12, - 16, 0, 4, 0, 0, 0, - 16, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 70, 3, 16, 0, 1, 0, - 0, 0, 70, 3, 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, 178, 0, - 16, 0, 1, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 70, 12, 16, 0, - 1, 0, 0, 0, 16, 0, - 0, 9, 130, 0, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 128, 65, 0, 0, 0, - 2, 0, 0, 0, 70, 2, - 16, 128, 65, 0, 0, 0, - 5, 0, 0, 0, 52, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 8, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 7, 130, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 2, 0, 0, 0, - 50, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 102, 102, 102, 63, 1, 64, - 0, 0, 205, 204, 204, 61, - 16, 0, 0, 8, 130, 0, - 16, 0, 2, 0, 0, 0, - 134, 3, 16, 0, 4, 0, - 0, 0, 70, 2, 16, 128, - 65, 0, 0, 0, 2, 0, - 0, 0, 16, 0, 0, 8, - 18, 0, 16, 0, 3, 0, - 0, 0, 70, 2, 16, 0, - 5, 0, 0, 0, 70, 2, - 16, 128, 65, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 7, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 0, - 16, 0, 3, 0, 0, 0, - 10, 0, 16, 0, 3, 0, - 0, 0, 50, 0, 0, 9, - 114, 0, 16, 0, 3, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 6, 0, - 16, 0, 3, 0, 0, 0, - 70, 2, 16, 0, 5, 0, - 0, 0, 56, 0, 0, 8, - 130, 0, 16, 0, 3, 0, - 0, 0, 26, 0, 16, 0, - 3, 0, 0, 0, 26, 128, - 32, 0, 0, 0, 0, 0, - 13, 0, 0, 0, 50, 0, - 0, 10, 130, 0, 16, 0, - 3, 0, 0, 0, 26, 128, - 32, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 10, 0, - 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 3, 0, - 0, 0, 50, 0, 0, 10, - 66, 0, 16, 0, 3, 0, - 0, 0, 26, 128, 32, 0, - 0, 0, 0, 0, 14, 0, - 0, 0, 42, 0, 16, 0, - 3, 0, 0, 0, 58, 0, - 16, 0, 3, 0, 0, 0, - 56, 0, 0, 11, 50, 0, - 16, 0, 5, 0, 0, 0, - 166, 138, 32, 0, 0, 0, - 0, 0, 31, 0, 0, 0, - 2, 64, 0, 0, 205, 204, - 204, 60, 205, 204, 204, 61, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, - 130, 0, 16, 0, 3, 0, - 0, 0, 26, 0, 16, 0, - 4, 0, 0, 0, 1, 64, - 0, 0, 205, 204, 204, 189, - 56, 32, 0, 7, 130, 0, - 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 3, 0, - 0, 0, 1, 64, 0, 0, - 85, 85, 85, 64, 50, 0, - 0, 9, 18, 0, 16, 0, - 4, 0, 0, 0, 58, 0, - 16, 0, 3, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 192, 1, 64, 0, 0, - 0, 0, 64, 64, 56, 0, - 0, 7, 130, 0, 16, 0, - 3, 0, 0, 0, 58, 0, - 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 3, 0, - 0, 0, 56, 0, 0, 7, - 130, 0, 16, 0, 3, 0, - 0, 0, 58, 0, 16, 0, - 3, 0, 0, 0, 10, 0, - 16, 0, 4, 0, 0, 0, - 56, 0, 0, 7, 130, 0, - 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 3, 0, - 0, 0, 10, 0, 16, 0, - 5, 0, 0, 0, 56, 0, - 0, 8, 50, 0, 16, 0, - 4, 0, 0, 0, 70, 0, - 16, 128, 65, 0, 0, 0, - 2, 0, 0, 0, 246, 15, - 16, 0, 3, 0, 0, 0, - 50, 0, 0, 12, 50, 0, - 16, 0, 4, 0, 0, 0, - 70, 0, 16, 0, 4, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 64, 63, 0, 0, - 128, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 70, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 12, 242, 0, - 16, 0, 6, 0, 0, 0, - 70, 142, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 29, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 63, 0, 0, - 128, 63, 0, 0, 128, 63, - 50, 0, 0, 16, 114, 0, - 16, 0, 6, 0, 0, 0, - 70, 2, 16, 128, 65, 0, - 0, 0, 6, 0, 0, 0, - 2, 64, 0, 0, 11, 215, - 35, 63, 11, 215, 35, 63, - 11, 215, 35, 63, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 128, 63, 0, 0, - 128, 63, 0, 0, 128, 63, - 0, 0, 0, 0, 56, 0, - 0, 8, 114, 0, 16, 0, - 6, 0, 0, 0, 70, 2, - 16, 0, 6, 0, 0, 0, - 246, 143, 32, 0, 0, 0, - 0, 0, 29, 0, 0, 0, - 69, 0, 0, 139, 194, 0, - 0, 128, 67, 85, 21, 0, - 114, 0, 16, 0, 4, 0, - 0, 0, 70, 0, 16, 0, - 4, 0, 0, 0, 70, 126, - 16, 0, 1, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 114, 0, 16, 0, 7, 0, - 0, 0, 70, 2, 16, 0, - 6, 0, 0, 0, 70, 2, - 16, 0, 4, 0, 0, 0, - 54, 0, 0, 8, 82, 0, - 16, 0, 5, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 64, 63, 0, 0, 0, 0, - 0, 0, 128, 63, 0, 0, - 0, 0, 56, 0, 0, 7, - 50, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 0, - 3, 0, 0, 0, 150, 5, - 16, 0, 5, 0, 0, 0, - 56, 0, 0, 8, 34, 0, - 16, 0, 5, 0, 0, 0, - 42, 128, 32, 0, 0, 0, - 0, 0, 31, 0, 0, 0, - 1, 64, 0, 0, 205, 204, - 204, 61, 56, 0, 0, 7, - 50, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 0, - 3, 0, 0, 0, 70, 0, - 16, 0, 5, 0, 0, 0, - 14, 0, 0, 7, 50, 0, - 16, 0, 3, 0, 0, 0, - 70, 0, 16, 0, 3, 0, - 0, 0, 166, 10, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 8, 50, 0, 16, 0, - 0, 0, 0, 0, 70, 0, - 16, 0, 0, 0, 0, 0, - 70, 0, 16, 128, 65, 0, - 0, 0, 3, 0, 0, 0, - 69, 0, 0, 139, 194, 0, - 0, 128, 67, 85, 21, 0, - 178, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 0, - 0, 0, 0, 0, 70, 123, - 16, 0, 1, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 3, 0, 0, 0, 1, 64, - 0, 0, 154, 153, 25, 190, - 56, 32, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 1, 0, 32, 65, 50, 0, - 0, 9, 34, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 192, 1, 64, 0, 0, - 0, 0, 64, 64, 56, 0, - 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 10, 114, 0, 16, 0, - 5, 0, 0, 0, 6, 0, - 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 8, 215, - 163, 60, 40, 92, 15, 62, - 40, 92, 143, 62, 0, 0, - 0, 0, 50, 0, 0, 9, - 114, 0, 16, 0, 3, 0, - 0, 0, 70, 3, 16, 0, - 3, 0, 0, 0, 166, 10, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 10, - 114, 0, 16, 0, 3, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 205, 204, 204, 61, - 205, 204, 204, 61, 205, 204, - 76, 62, 0, 0, 0, 0, - 50, 0, 0, 9, 18, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 63, 1, 64, - 0, 0, 0, 0, 0, 63, - 52, 0, 0, 7, 34, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 205, 204, 204, 62, 56, 0, - 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 15, - 114, 0, 16, 0, 0, 0, - 0, 0, 6, 0, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 144, 194, 53, 63, - 219, 249, 30, 63, 134, 235, - 209, 62, 0, 0, 0, 0, - 2, 64, 0, 0, 225, 122, - 148, 62, 74, 12, 194, 62, - 61, 10, 23, 63, 0, 0, - 0, 0, 56, 0, 0, 8, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 29, 0, 0, 0, 16, 0, - 0, 8, 18, 0, 16, 0, - 1, 0, 0, 0, 70, 3, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 128, 65, 0, - 0, 0, 2, 0, 0, 0, - 52, 0, 0, 7, 18, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 47, 0, - 0, 5, 18, 0, 16, 0, - 1, 0, 0, 0, 10, 0, - 16, 0, 1, 0, 0, 0, - 56, 0, 0, 7, 18, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 200, 67, 25, 0, - 0, 5, 18, 0, 16, 0, - 1, 0, 0, 0, 10, 0, - 16, 0, 1, 0, 0, 0, - 50, 0, 0, 10, 114, 0, - 16, 0, 2, 0, 0, 0, - 70, 2, 16, 128, 65, 0, - 0, 0, 4, 0, 0, 0, - 70, 2, 16, 0, 6, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 50, 0, - 0, 9, 114, 0, 16, 0, - 2, 0, 0, 0, 246, 15, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 0, - 7, 0, 0, 0, 50, 0, - 0, 12, 178, 0, 16, 0, - 1, 0, 0, 0, 6, 0, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 154, 153, - 153, 63, 154, 153, 153, 63, - 0, 0, 0, 0, 154, 153, - 153, 63, 70, 8, 16, 0, - 2, 0, 0, 0, 56, 0, - 0, 8, 178, 0, 16, 0, - 1, 0, 0, 0, 70, 12, - 16, 0, 1, 0, 0, 0, - 246, 143, 32, 0, 0, 0, - 0, 0, 29, 0, 0, 0, - 50, 0, 0, 9, 114, 32, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 0, 0, - 0, 0, 246, 15, 16, 0, - 6, 0, 0, 0, 70, 3, - 16, 0, 1, 0, 0, 0, - 50, 0, 0, 11, 50, 0, - 16, 0, 0, 0, 0, 0, - 230, 138, 32, 0, 0, 0, - 0, 0, 10, 0, 0, 0, - 166, 10, 16, 0, 1, 0, - 0, 0, 230, 138, 32, 0, - 0, 0, 0, 0, 11, 0, - 0, 0, 14, 0, 0, 6, - 1, 192, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 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, - 148, 0, 0, 0, 192, 0, - 0, 0, 8, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 155, 0, 0, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 3, 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, - 7, 0, 0, 0, 0, 0, - 0, 0, 8, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 10, 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, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0 -}; diff --git a/demo/d3d11/shaders/debugLinePS.hlsl b/demo/d3d11/shaders/debugLinePS.hlsl deleted file mode 100644 index d01847b..0000000 --- a/demo/d3d11/shaders/debugLinePS.hlsl +++ /dev/null @@ -1,10 +0,0 @@ -struct Input -{ - float4 position : SV_POSITION; - float4 color : COLOR; -}; - -float4 debugLinePS(Input input) : SV_TARGET -{ - return input.color; -} diff --git a/demo/d3d11/shaders/debugLinePS.hlsl.h b/demo/d3d11/shaders/debugLinePS.hlsl.h deleted file mode 100644 index 6243104..0000000 --- a/demo/d3d11/shaders/debugLinePS.hlsl.h +++ /dev/null @@ -1,121 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// -// 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_5_0 -dcl_globalFlags refactoringAllowed -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_debugLinePS[] = -{ - 68, 88, 66, 67, 51, 80, - 148, 24, 206, 189, 182, 148, - 220, 111, 88, 236, 138, 6, - 146, 179, 1, 0, 0, 0, - 20, 2, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 172, 0, 0, 0, 0, 1, - 0, 0, 52, 1, 0, 0, - 120, 1, 0, 0, 82, 68, - 69, 70, 112, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 255, 255, 0, 1, 0, 0, - 60, 0, 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, - 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, 54, - 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, - 52, 0, 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, 69, 88, - 60, 0, 0, 0, 80, 0, - 0, 0, 15, 0, 0, 0, - 106, 8, 0, 1, 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, 148, 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, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; diff --git a/demo/d3d11/shaders/debugLineVS.hlsl b/demo/d3d11/shaders/debugLineVS.hlsl deleted file mode 100644 index 1033b35..0000000 --- a/demo/d3d11/shaders/debugLineVS.hlsl +++ /dev/null @@ -1,26 +0,0 @@ - -cbuffer params : register(b0) -{ - float4x4 projectionViewWorld; -}; - -struct Input -{ - float3 position : POSITION; - float4 color : COLOR; -}; - -struct Output -{ - float4 position : SV_POSITION; - float4 color : COLOR; -}; - -Output debugLineVS(Input input) -{ - Output output; - output.position = mul(projectionViewWorld, float4(input.position, 1.0f)); - output.color = input.color; - - return output; -} diff --git a/demo/d3d11/shaders/debugLineVS.hlsl.h b/demo/d3d11/shaders/debugLineVS.hlsl.h deleted file mode 100644 index cdf7e4b..0000000 --- a/demo/d3d11/shaders/debugLineVS.hlsl.h +++ /dev/null @@ -1,213 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer params -// { -// -// float4x4 projectionViewWorld; // Offset: 0 Size: 64 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// params cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xyz 0 NONE float xyz -// 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_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[4], immediateIndexed -dcl_input v0.xyz -dcl_input v1.xyzw -dcl_output_siv o0.xyzw, position -dcl_output o1.xyzw -dcl_temps 1 -mul r0.xyzw, v0.yyyy, cb0[1].xyzw -mad r0.xyzw, cb0[0].xyzw, v0.xxxx, r0.xyzw -mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw -add o0.xyzw, r0.xyzw, cb0[3].xyzw -mov o1.xyzw, v1.xyzw -ret -// Approximately 6 instruction slots used -#endif - -const BYTE g_debugLineVS[] = -{ - 68, 88, 66, 67, 240, 24, - 40, 204, 192, 159, 63, 125, - 158, 223, 41, 237, 85, 39, - 230, 54, 1, 0, 0, 0, - 160, 3, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 88, 1, 0, 0, 168, 1, - 0, 0, 252, 1, 0, 0, - 4, 3, 0, 0, 82, 68, - 69, 70, 28, 1, 0, 0, - 1, 0, 0, 0, 100, 0, - 0, 0, 1, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 254, 255, 0, 1, 0, 0, - 232, 0, 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, 1, 0, - 0, 0, 112, 97, 114, 97, - 109, 115, 0, 171, 92, 0, - 0, 0, 1, 0, 0, 0, - 124, 0, 0, 0, 64, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 164, 0, - 0, 0, 0, 0, 0, 0, - 64, 0, 0, 0, 2, 0, - 0, 0, 196, 0, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 112, 114, 111, 106, - 101, 99, 116, 105, 111, 110, - 86, 105, 101, 119, 87, 111, - 114, 108, 100, 0, 102, 108, - 111, 97, 116, 52, 120, 52, - 0, 171, 171, 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, - 184, 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, 54, 46, 51, - 46, 57, 54, 48, 48, 46, - 49, 54, 51, 56, 52, 0, - 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, 7, 7, 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, - 69, 88, 0, 1, 0, 0, - 80, 0, 1, 0, 64, 0, - 0, 0, 106, 8, 0, 1, - 89, 0, 0, 4, 70, 142, - 32, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 95, 0, - 0, 3, 114, 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, 104, 0, 0, 2, - 1, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 0, 0, 0, 0, 86, 21, - 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, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 6, 16, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 166, 26, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 8, - 242, 32, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 3, 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, 148, 0, 0, 0, - 6, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 4, 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, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; diff --git a/demo/d3d11/shaders/diffuseGS.hlsl b/demo/d3d11/shaders/diffuseGS.hlsl deleted file mode 100644 index e7a92db..0000000 --- a/demo/d3d11/shaders/diffuseGS.hlsl +++ /dev/null @@ -1,176 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - DiffuseShaderConst gParams; -}; - -static const float2 corners[4] = -{ - float2(0.0, 1.0), - float2(0.0, 0.0), - float2(1.0, 1.0), - float2(1.0, 0.0) -}; - -[maxvertexcount(4)] -void diffuseGS(point DiffuseVertexOut input[1], inout TriangleStream<DiffuseGeometryOut> triStream) -{ - float4 ndcPos = input[0].ndcPos; - - // frustrum culling - const float ndcBound = 1.0; - if (ndcPos.x < -ndcBound) return; - if (ndcPos.x > ndcBound) return; - if (ndcPos.y < -ndcBound) return; - if (ndcPos.y > ndcBound) return; - - float pointScale = gParams.diffuseScale; - float velocityScale = 1.0; - - float3 v = input[0].viewVel.xyz; - float3 p = input[0].viewPos.xyz; - - // billboard in eye space - float3 u = float3(0.0, pointScale, 0.0); - float3 l = float3(pointScale, 0.0, 0.0); - - // increase size based on life - float lifeTime = input[0].worldPos.w; - - float lifeFade = lerp(1.0f + gParams.diffusion, 1.0, min(1.0, lifeTime*0.25f)); - u *= lifeFade; - l *= lifeFade; - - float fade = 1.0/(lifeFade*lifeFade); - float vlen = length(v)*gParams.motionBlurScale; - - if (vlen > 0.5) - { - float len = max(pointScale, vlen*0.016); - fade = min(1.0, 2.0/(len/pointScale)); - - u = normalize(v)*max(pointScale, vlen*0.016); // assume 60hz - l = normalize(cross(u, float3(0.0, 0.0, -1.0)))*pointScale; - } - - - { - - DiffuseGeometryOut output; - - output.worldPos = input[0].worldPos; // vertex world pos (life in w) - output.viewPos = input[0].viewPos; // vertex eye pos - output.viewVel.xyz = input[0].viewVel.xyz; // vertex velocity in view space - output.viewVel.w = fade; - output.lightDir = mul(gParams.modelView, float4(gParams.lightDir, 0.0)); - output.color = input[0].color; - - output.uv = float4(0.0, 1.0, 0.0, 0.0); - output.clipPos = mul(gParams.projection, float4(p + u - l, 1.0)); - triStream.Append(output); - - output.uv = float4(0.0, 0.0, 0.0, 0.0); - output.clipPos = mul(gParams.projection, float4(p - u - l, 1.0)); - triStream.Append(output); - - output.uv = float4(1.0, 1.0, 0.0, 0.0); - output.clipPos = mul(gParams.projection, float4(p + u + l, 1.0)); - triStream.Append(output); - - output.uv = float4(1.0, 0.0, 0.0, 0.0); - output.clipPos = mul(gParams.projection, float4(p - u + l, 1.0)); - triStream.Append(output); - } - -} - -#if 0 - - -const char *geometryDiffuseShader = -"#version 120\n" -"#extension GL_EXT_geometry_shader4 : enable\n" -STRINGIFY( - -uniform float pointScale; // point size in world space -uniform float motionBlurScale; -uniform float diffusion; -uniform vec3 lightDir; - -void main() -{ - vec4 ndcPos = gl_TexCoordIn[0][5]; - - // frustrum culling - const float ndcBound = 1.0; - if (ndcPos.x < -ndcBound) return; - if (ndcPos.x > ndcBound) return; - if (ndcPos.y < -ndcBound) return; - if (ndcPos.y > ndcBound) return; - - float velocityScale = 1.0; - - vec3 v = gl_TexCoordIn[0][3].xyz*velocityScale; - vec3 p = gl_TexCoordIn[0][2].xyz; - - // billboard in eye space - vec3 u = vec3(0.0, pointScale, 0.0); - vec3 l = vec3(pointScale, 0.0, 0.0); - - // increase size based on life - float lifeFade = mix(1.0f+diffusion, 1.0, min(1.0, gl_TexCoordIn[0][1].w*0.25f)); - u *= lifeFade; - l *= lifeFade; - - //lifeFade = 1.0; - - float fade = 1.0/(lifeFade*lifeFade); - float vlen = length(v)*motionBlurScale; - - if (vlen > 0.5) - { - float len = max(pointScale, vlen*0.016); - fade = min(1.0, 2.0/(len/pointScale)); - - u = normalize(v)*max(pointScale, vlen*0.016); // assume 60hz - l = normalize(cross(u, vec3(0.0, 0.0, -1.0)))*pointScale; - } - - { - - gl_TexCoord[1] = gl_TexCoordIn[0][1]; // vertex world pos (life in w) - gl_TexCoord[2] = gl_TexCoordIn[0][2]; // vertex eye pos - gl_TexCoord[3] = gl_TexCoordIn[0][3]; // vertex velocity in view space - gl_TexCoord[3].w = fade; - gl_TexCoord[4] = gl_ModelViewMatrix*vec4(lightDir, 0.0); - gl_TexCoord[4].w = gl_TexCoordIn[0][3].w; // attenuation - gl_TexCoord[5].xyzw = gl_TexCoordIn[0][4].xyzw; // color - - float zbias = 0.0f;//0.00125*2.0; - - gl_TexCoord[0] = vec4(0.0, 1.0, 0.0, 0.0); - gl_Position = gl_ProjectionMatrix * vec4(p + u - l, 1.0); - gl_Position.z -= zbias; - EmitVertex(); - - gl_TexCoord[0] = vec4(0.0, 0.0, 0.0, 0.0); - gl_Position = gl_ProjectionMatrix * vec4(p - u - l, 1.0); - gl_Position.z -= zbias; - EmitVertex(); - - gl_TexCoord[0] = vec4(1.0, 1.0, 0.0, 0.0); - gl_Position = gl_ProjectionMatrix * vec4(p + u + l, 1.0); - gl_Position.z -= zbias; - EmitVertex(); - - gl_TexCoord[0] = vec4(1.0, 0.0, 0.0, 0.0); - gl_Position = gl_ProjectionMatrix * vec4(p - u + l, 1.0); - gl_Position.z -= zbias; - EmitVertex(); - } -} -); - - -#endif
\ No newline at end of file diff --git a/demo/d3d11/shaders/diffuseGS.hlsl.h b/demo/d3d11/shaders/diffuseGS.hlsl.h deleted file mode 100644 index 1f71735..0000000 --- a/demo/d3d11/shaders/diffuseGS.hlsl.h +++ /dev/null @@ -1,973 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer constBuf -// { -// -// struct DiffuseShaderConst -// { -// -// float3 lightPos; // Offset: 0 -// float pad0; // Offset: 12 -// float3 lightDir; // Offset: 16 -// float pad1; // Offset: 28 -// float4x4 lightTransform; // Offset: 32 -// float4 color; // Offset: 96 -// float4x4 modelView; // Offset: 112 -// float4x4 modelViewProjection; // Offset: 176 -// float4x4 projection; // Offset: 240 -// float4 shadowTaps[12]; // Offset: 304 -// float diffusion; // Offset: 496 -// float diffuseRadius; // Offset: 500 -// float diffuseScale; // Offset: 504 -// float spotMin; // Offset: 508 -// float spotMax; // Offset: 512 -// float motionBlurScale; // Offset: 516 -// float pad3; // Offset: 520 -// float pad4; // Offset: 524 -// -// } gParams; // Offset: 0 Size: 528 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// constBuf cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xyzw 0 NONE float xyzw -// NCDPOS 0 xyzw 1 NONE float xy -// VIEWPOS 0 xyzw 2 NONE float xyzw -// VIEWVEL 0 xyzw 3 NONE float xyz -// COLOR 0 xyzw 4 NONE float xyzw -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_POSITION 0 xyzw 0 POS float xyzw -// POSITION 0 xyzw 1 NONE float xyzw -// VIEWPOS 0 xyzw 2 NONE float xyzw -// VIEWVEL 0 xyzw 3 NONE float xyzw -// LIGHTDIR 0 xyzw 4 NONE float xyzw -// COLOR 0 xyzw 5 NONE float xyzw -// UV 0 xyzw 6 NONE float xyzw -// -gs_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[33], immediateIndexed -dcl_input v[1][0].xyzw -dcl_input v[1][1].xyzw -dcl_input v[1][2].xyzw -dcl_input v[1][3].xyzw -dcl_input v[1][4].xyzw -dcl_temps 6 -dcl_inputprimitive point -dcl_stream m0 -dcl_outputtopology trianglestrip -dcl_output_siv o0.xyzw, position -dcl_output o1.xyzw -dcl_output o2.xyzw -dcl_output o3.xyzw -dcl_output o4.xyzw -dcl_output o5.xyzw -dcl_output o6.xyzw -dcl_maxout 4 -lt r0.x, v[0][1].x, l(-1.000000) -if_nz r0.x - ret -endif -lt r0.x, l(1.000000), v[0][1].x -if_nz r0.x - ret -endif -lt r0.x, v[0][1].y, l(-1.000000) -if_nz r0.x - ret -endif -lt r0.x, l(1.000000), v[0][1].y -if_nz r0.x - ret -endif -add r0.x, cb0[31].x, l(1.000000) -mul r0.y, l(0.250000), v[0][0].w -min r0.y, r0.y, l(1.000000) -add r0.z, -r0.x, l(1.000000) -mad r0.x, r0.y, r0.z, r0.x -mov r1.x, cb0[31].z -mov r1.yz, l(0,0,0,0) -mul r1.xyz, r0.xxxx, r1.xyzx -mul r0.x, r0.x, r0.x -div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x -dp3 r0.x, v[0][3].xyzx, v[0][3].xyzx -sqrt r0.y, r0.x -mul r0.y, r0.y, cb0[32].y -lt r0.z, l(0.500000), r0.y -mul r0.y, r0.y, l(0.016000) -max r0.y, r0.y, cb0[31].z -div r0.w, r0.y, cb0[31].z -div r0.w, l(2.000000), r0.w -min r2.w, r0.w, l(1.000000) -rsq r0.x, r0.x -mul r3.xyz, r0.xxxx, v[0][3].xyzx -mul r0.xyw, r0.yyyy, r3.xyxz -mul r3.xyz, r0.wxyw, l(0.000000, -1.000000, 0.000000, 0.000000) -mad r3.xyz, r0.ywxy, l(-1.000000, 0.000000, 0.000000, 0.000000), -r3.xyzx -dp2 r3.w, r3.xyxx, r3.xyxx -rsq r3.w, r3.w -mul r3.xyz, r3.wwww, r3.xyzx -mul r2.xyz, r3.xyzx, cb0[31].zzzz -movc r0.xyw, r0.zzzz, r0.xyxw, r1.zxzz -movc r1.xyzw, r0.zzzz, r2.xyzw, r1.xyzw -mul r2.xyzw, cb0[1].yyyy, cb0[8].xyzw -mad r2.xyzw, cb0[7].xyzw, cb0[1].xxxx, r2.xyzw -mad r2.xyzw, cb0[9].xyzw, cb0[1].zzzz, r2.xyzw -add r3.xyz, r0.xywx, v[0][2].xyzx -add r4.xyz, -r1.xyzx, r3.xyzx -mul r5.xyzw, r4.yyyy, cb0[16].xyzw -mad r5.xyzw, cb0[15].xyzw, r4.xxxx, r5.xyzw -mad r4.xyzw, cb0[17].xyzw, r4.zzzz, r5.xyzw -add r4.xyzw, r4.xyzw, cb0[18].xyzw -mov o0.xyzw, r4.xyzw -mov o1.xyzw, v[0][0].xyzw -mov o2.xyzw, v[0][2].xyzw -mov o3.xyz, v[0][3].xyzx -mov o3.w, r1.w -mov o4.xyzw, r2.xyzw -mov o5.xyzw, v[0][4].xyzw -mov o6.xyzw, l(0,1.000000,0,0) -emit_stream m0 -add r0.xyz, -r0.xywx, v[0][2].xyzx -add r4.xyz, -r1.xyzx, r0.xyzx -mul r5.xyzw, r4.yyyy, cb0[16].xyzw -mad r5.xyzw, cb0[15].xyzw, r4.xxxx, r5.xyzw -mad r4.xyzw, cb0[17].xyzw, r4.zzzz, r5.xyzw -add r4.xyzw, r4.xyzw, cb0[18].xyzw -mov o0.xyzw, r4.xyzw -mov o1.xyzw, v[0][0].xyzw -mov o2.xyzw, v[0][2].xyzw -mov o3.xyz, v[0][3].xyzx -mov o3.w, r1.w -mov o4.xyzw, r2.xyzw -mov o5.xyzw, v[0][4].xyzw -mov o6.xyzw, l(0,0,0,0) -emit_stream m0 -add r3.xyz, r1.xyzx, r3.xyzx -mul r4.xyzw, r3.yyyy, cb0[16].xyzw -mad r4.xyzw, cb0[15].xyzw, r3.xxxx, r4.xyzw -mad r3.xyzw, cb0[17].xyzw, r3.zzzz, r4.xyzw -add r3.xyzw, r3.xyzw, cb0[18].xyzw -mov o0.xyzw, r3.xyzw -mov o1.xyzw, v[0][0].xyzw -mov o2.xyzw, v[0][2].xyzw -mov o3.xyz, v[0][3].xyzx -mov o3.w, r1.w -mov o4.xyzw, r2.xyzw -mov o5.xyzw, v[0][4].xyzw -mov o6.xyzw, l(1.000000,1.000000,0,0) -emit_stream m0 -add r0.xyz, r1.xyzx, r0.xyzx -mul r3.xyzw, r0.yyyy, cb0[16].xyzw -mad r3.xyzw, cb0[15].xyzw, r0.xxxx, r3.xyzw -mad r0.xyzw, cb0[17].xyzw, r0.zzzz, r3.xyzw -add r0.xyzw, r0.xyzw, cb0[18].xyzw -mov o0.xyzw, r0.xyzw -mov o1.xyzw, v[0][0].xyzw -mov o2.xyzw, v[0][2].xyzw -mov o3.xyz, v[0][3].xyzx -mov o3.w, r1.w -mov o4.xyzw, r2.xyzw -mov o5.xyzw, v[0][4].xyzw -mov o6.xyzw, l(1.000000,0,0,0) -emit_stream m0 -ret -// Approximately 108 instruction slots used -#endif - -const BYTE g_diffuseGS[] = -{ - 68, 88, 66, 67, 206, 113, - 108, 237, 96, 228, 115, 111, - 205, 11, 177, 210, 155, 123, - 232, 125, 1, 0, 0, 0, - 16, 18, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 188, 3, 0, 0, 108, 4, - 0, 0, 120, 5, 0, 0, - 116, 17, 0, 0, 82, 68, - 69, 70, 128, 3, 0, 0, - 1, 0, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 83, 71, 0, 1, 0, 0, - 76, 3, 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, 1, 0, - 0, 0, 99, 111, 110, 115, - 116, 66, 117, 102, 0, 171, - 171, 171, 92, 0, 0, 0, - 1, 0, 0, 0, 128, 0, - 0, 0, 16, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 168, 0, 0, 0, - 0, 0, 0, 0, 16, 2, - 0, 0, 2, 0, 0, 0, - 40, 3, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 103, 80, 97, 114, 97, 109, - 115, 0, 68, 105, 102, 102, - 117, 115, 101, 83, 104, 97, - 100, 101, 114, 67, 111, 110, - 115, 116, 0, 108, 105, 103, - 104, 116, 80, 111, 115, 0, - 102, 108, 111, 97, 116, 51, - 0, 171, 1, 0, 3, 0, - 1, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 204, 0, - 0, 0, 112, 97, 100, 48, - 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, 253, 0, - 0, 0, 108, 105, 103, 104, - 116, 68, 105, 114, 0, 112, - 97, 100, 49, 0, 108, 105, - 103, 104, 116, 84, 114, 97, - 110, 115, 102, 111, 114, 109, - 0, 102, 108, 111, 97, 116, - 52, 120, 52, 0, 171, 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, 69, 1, 0, 0, - 99, 111, 108, 111, 114, 0, - 102, 108, 111, 97, 116, 52, - 0, 171, 171, 171, 1, 0, - 3, 0, 1, 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, - 122, 1, 0, 0, 109, 111, - 100, 101, 108, 86, 105, 101, - 119, 0, 109, 111, 100, 101, - 108, 86, 105, 101, 119, 80, - 114, 111, 106, 101, 99, 116, - 105, 111, 110, 0, 112, 114, - 111, 106, 101, 99, 116, 105, - 111, 110, 0, 115, 104, 97, - 100, 111, 119, 84, 97, 112, - 115, 0, 1, 0, 3, 0, - 1, 0, 4, 0, 12, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 122, 1, - 0, 0, 100, 105, 102, 102, - 117, 115, 105, 111, 110, 0, - 100, 105, 102, 102, 117, 115, - 101, 82, 97, 100, 105, 117, - 115, 0, 100, 105, 102, 102, - 117, 115, 101, 83, 99, 97, - 108, 101, 0, 115, 112, 111, - 116, 77, 105, 110, 0, 115, - 112, 111, 116, 77, 97, 120, - 0, 109, 111, 116, 105, 111, - 110, 66, 108, 117, 114, 83, - 99, 97, 108, 101, 0, 112, - 97, 100, 51, 0, 112, 97, - 100, 52, 0, 171, 195, 0, - 0, 0, 212, 0, 0, 0, - 0, 0, 0, 0, 248, 0, - 0, 0, 4, 1, 0, 0, - 12, 0, 0, 0, 40, 1, - 0, 0, 212, 0, 0, 0, - 16, 0, 0, 0, 49, 1, - 0, 0, 4, 1, 0, 0, - 28, 0, 0, 0, 54, 1, - 0, 0, 80, 1, 0, 0, - 32, 0, 0, 0, 116, 1, - 0, 0, 132, 1, 0, 0, - 96, 0, 0, 0, 168, 1, - 0, 0, 80, 1, 0, 0, - 112, 0, 0, 0, 178, 1, - 0, 0, 80, 1, 0, 0, - 176, 0, 0, 0, 198, 1, - 0, 0, 80, 1, 0, 0, - 240, 0, 0, 0, 209, 1, - 0, 0, 220, 1, 0, 0, - 48, 1, 0, 0, 0, 2, - 0, 0, 4, 1, 0, 0, - 240, 1, 0, 0, 10, 2, - 0, 0, 4, 1, 0, 0, - 244, 1, 0, 0, 24, 2, - 0, 0, 4, 1, 0, 0, - 248, 1, 0, 0, 37, 2, - 0, 0, 4, 1, 0, 0, - 252, 1, 0, 0, 45, 2, - 0, 0, 4, 1, 0, 0, - 0, 2, 0, 0, 53, 2, - 0, 0, 4, 1, 0, 0, - 4, 2, 0, 0, 69, 2, - 0, 0, 4, 1, 0, 0, - 8, 2, 0, 0, 74, 2, - 0, 0, 4, 1, 0, 0, - 12, 2, 0, 0, 5, 0, - 0, 0, 1, 0, 132, 0, - 0, 0, 18, 0, 80, 2, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 176, 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, 54, 46, 51, - 46, 57, 54, 48, 48, 46, - 49, 54, 51, 56, 52, 0, - 171, 171, 73, 83, 71, 78, - 168, 0, 0, 0, 5, 0, - 0, 0, 8, 0, 0, 0, - 128, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 15, 0, 0, - 137, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 15, 3, 0, 0, - 144, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 2, 0, - 0, 0, 15, 15, 0, 0, - 152, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 3, 0, - 0, 0, 15, 7, 0, 0, - 160, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 4, 0, - 0, 0, 15, 15, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 78, 67, 68, - 80, 79, 83, 0, 86, 73, - 69, 87, 80, 79, 83, 0, - 86, 73, 69, 87, 86, 69, - 76, 0, 67, 79, 76, 79, - 82, 0, 171, 171, 79, 83, - 71, 53, 4, 1, 0, 0, - 7, 0, 0, 0, 8, 0, - 0, 0, 0, 0, 0, 0, - 204, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 0, 0, 0, 0, 216, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 15, 0, 0, 0, 0, 0, - 0, 0, 225, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 15, 0, - 0, 0, 0, 0, 0, 0, - 233, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 3, 0, - 0, 0, 15, 0, 0, 0, - 0, 0, 0, 0, 241, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 4, 0, 0, 0, - 15, 0, 0, 0, 0, 0, - 0, 0, 250, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 5, 0, 0, 0, 15, 0, - 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 6, 0, - 0, 0, 15, 0, 0, 0, - 83, 86, 95, 80, 79, 83, - 73, 84, 73, 79, 78, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 86, 73, 69, - 87, 80, 79, 83, 0, 86, - 73, 69, 87, 86, 69, 76, - 0, 76, 73, 71, 72, 84, - 68, 73, 82, 0, 67, 79, - 76, 79, 82, 0, 85, 86, - 0, 171, 83, 72, 69, 88, - 244, 11, 0, 0, 80, 0, - 2, 0, 253, 2, 0, 0, - 106, 8, 0, 1, 89, 0, - 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 33, 0, - 0, 0, 95, 0, 0, 4, - 242, 16, 32, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 95, 0, 0, 4, 242, 16, - 32, 0, 1, 0, 0, 0, - 1, 0, 0, 0, 95, 0, - 0, 4, 242, 16, 32, 0, - 1, 0, 0, 0, 2, 0, - 0, 0, 95, 0, 0, 4, - 242, 16, 32, 0, 1, 0, - 0, 0, 3, 0, 0, 0, - 95, 0, 0, 4, 242, 16, - 32, 0, 1, 0, 0, 0, - 4, 0, 0, 0, 104, 0, - 0, 2, 6, 0, 0, 0, - 93, 8, 0, 1, 143, 0, - 0, 3, 0, 0, 17, 0, - 0, 0, 0, 0, 92, 40, - 0, 1, 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, - 101, 0, 0, 3, 242, 32, - 16, 0, 2, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 3, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 4, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 5, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 6, 0, 0, 0, - 94, 0, 0, 2, 4, 0, - 0, 0, 49, 0, 0, 8, - 18, 0, 16, 0, 0, 0, - 0, 0, 10, 16, 32, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 191, 31, 0, - 4, 3, 10, 0, 16, 0, - 0, 0, 0, 0, 62, 0, - 0, 1, 21, 0, 0, 1, - 49, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 10, 16, 32, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 31, 0, 4, 3, - 10, 0, 16, 0, 0, 0, - 0, 0, 62, 0, 0, 1, - 21, 0, 0, 1, 49, 0, - 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 26, 16, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 191, - 31, 0, 4, 3, 10, 0, - 16, 0, 0, 0, 0, 0, - 62, 0, 0, 1, 21, 0, - 0, 1, 49, 0, 0, 8, - 18, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 26, 16, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 31, 0, - 4, 3, 10, 0, 16, 0, - 0, 0, 0, 0, 62, 0, - 0, 1, 21, 0, 0, 1, - 0, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 31, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 34, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 62, 58, 16, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 51, 0, - 0, 7, 34, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 0, 0, 0, 8, - 66, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 50, 0, - 0, 9, 18, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 6, 18, 0, 16, 0, - 1, 0, 0, 0, 42, 128, - 32, 0, 0, 0, 0, 0, - 31, 0, 0, 0, 54, 0, - 0, 8, 98, 0, 16, 0, - 1, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 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, 56, 0, - 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 14, 0, 0, 10, - 130, 0, 16, 0, 1, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 128, 63, 0, 0, - 128, 63, 0, 0, 128, 63, - 0, 0, 128, 63, 10, 0, - 16, 0, 0, 0, 0, 0, - 16, 0, 0, 9, 18, 0, - 16, 0, 0, 0, 0, 0, - 70, 18, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 70, 18, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 75, 0, 0, 5, 34, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 8, - 34, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 26, 128, - 32, 0, 0, 0, 0, 0, - 32, 0, 0, 0, 49, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 63, - 26, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 34, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 131, 60, - 52, 0, 0, 8, 34, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 42, 128, 32, 0, - 0, 0, 0, 0, 31, 0, - 0, 0, 14, 0, 0, 8, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 42, 128, - 32, 0, 0, 0, 0, 0, - 31, 0, 0, 0, 14, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 64, - 58, 0, 16, 0, 0, 0, - 0, 0, 51, 0, 0, 7, - 130, 0, 16, 0, 2, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 68, 0, 0, 5, 18, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 8, - 114, 0, 16, 0, 3, 0, - 0, 0, 6, 0, 16, 0, - 0, 0, 0, 0, 70, 18, - 32, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 56, 0, - 0, 7, 178, 0, 16, 0, - 0, 0, 0, 0, 86, 5, - 16, 0, 0, 0, 0, 0, - 70, 8, 16, 0, 3, 0, - 0, 0, 56, 0, 0, 10, - 114, 0, 16, 0, 3, 0, - 0, 0, 54, 13, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 0, - 50, 0, 0, 13, 114, 0, - 16, 0, 3, 0, 0, 0, - 214, 4, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 70, 2, - 16, 128, 65, 0, 0, 0, - 3, 0, 0, 0, 15, 0, - 0, 7, 130, 0, 16, 0, - 3, 0, 0, 0, 70, 0, - 16, 0, 3, 0, 0, 0, - 70, 0, 16, 0, 3, 0, - 0, 0, 68, 0, 0, 5, - 130, 0, 16, 0, 3, 0, - 0, 0, 58, 0, 16, 0, - 3, 0, 0, 0, 56, 0, - 0, 7, 114, 0, 16, 0, - 3, 0, 0, 0, 246, 15, - 16, 0, 3, 0, 0, 0, - 70, 2, 16, 0, 3, 0, - 0, 0, 56, 0, 0, 8, - 114, 0, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 166, 138, - 32, 0, 0, 0, 0, 0, - 31, 0, 0, 0, 55, 0, - 0, 9, 178, 0, 16, 0, - 0, 0, 0, 0, 166, 10, - 16, 0, 0, 0, 0, 0, - 70, 12, 16, 0, 0, 0, - 0, 0, 38, 10, 16, 0, - 1, 0, 0, 0, 55, 0, - 0, 9, 242, 0, 16, 0, - 1, 0, 0, 0, 166, 10, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 56, 0, - 0, 9, 242, 0, 16, 0, - 2, 0, 0, 0, 86, 133, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 8, 0, 0, 0, 50, 0, - 0, 11, 242, 0, 16, 0, - 2, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 7, 0, 0, 0, 6, 128, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 70, 14, - 16, 0, 2, 0, 0, 0, - 50, 0, 0, 11, 242, 0, - 16, 0, 2, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 9, 0, 0, 0, - 166, 138, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 0, 0, 0, 8, - 114, 0, 16, 0, 3, 0, - 0, 0, 70, 3, 16, 0, - 0, 0, 0, 0, 70, 18, - 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 8, 114, 0, 16, 0, - 4, 0, 0, 0, 70, 2, - 16, 128, 65, 0, 0, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 3, 0, 0, 0, - 56, 0, 0, 8, 242, 0, - 16, 0, 5, 0, 0, 0, - 86, 5, 16, 0, 4, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 16, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 5, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 6, 0, 16, 0, - 4, 0, 0, 0, 70, 14, - 16, 0, 5, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 4, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 17, 0, 0, 0, - 166, 10, 16, 0, 4, 0, - 0, 0, 70, 14, 16, 0, - 5, 0, 0, 0, 0, 0, - 0, 8, 242, 0, 16, 0, - 4, 0, 0, 0, 70, 14, - 16, 0, 4, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 18, 0, 0, 0, - 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 4, 0, - 0, 0, 54, 0, 0, 6, - 242, 32, 16, 0, 1, 0, - 0, 0, 70, 30, 32, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 54, 0, 0, 6, - 242, 32, 16, 0, 2, 0, - 0, 0, 70, 30, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 54, 0, 0, 6, - 114, 32, 16, 0, 3, 0, - 0, 0, 70, 18, 32, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 54, 0, 0, 5, - 130, 32, 16, 0, 3, 0, - 0, 0, 58, 0, 16, 0, - 1, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, - 4, 0, 0, 0, 70, 14, - 16, 0, 2, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 5, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 54, 0, 0, 8, 242, 32, - 16, 0, 6, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, - 0, 0, 0, 0, 0, 0, - 0, 0, 117, 0, 0, 3, - 0, 0, 17, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 3, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 70, 18, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 8, - 114, 0, 16, 0, 4, 0, - 0, 0, 70, 2, 16, 128, - 65, 0, 0, 0, 1, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 5, 0, 0, 0, 86, 5, - 16, 0, 4, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 16, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 5, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 6, 0, 16, 0, 4, 0, - 0, 0, 70, 14, 16, 0, - 5, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 4, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 17, 0, 0, 0, 166, 10, - 16, 0, 4, 0, 0, 0, - 70, 14, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 8, - 242, 0, 16, 0, 4, 0, - 0, 0, 70, 14, 16, 0, - 4, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 18, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 4, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 1, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 2, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 2, 0, 0, 0, - 54, 0, 0, 6, 114, 32, - 16, 0, 3, 0, 0, 0, - 70, 18, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 54, 0, 0, 5, 130, 32, - 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 5, - 242, 32, 16, 0, 4, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 54, 0, - 0, 6, 242, 32, 16, 0, - 5, 0, 0, 0, 70, 30, - 32, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 54, 0, - 0, 8, 242, 32, 16, 0, - 6, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 117, 0, 0, 3, 0, 0, - 17, 0, 0, 0, 0, 0, - 0, 0, 0, 7, 114, 0, - 16, 0, 3, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 4, 0, 0, 0, 86, 5, - 16, 0, 3, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 16, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 4, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 6, 0, 16, 0, 3, 0, - 0, 0, 70, 14, 16, 0, - 4, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 3, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 17, 0, 0, 0, 166, 10, - 16, 0, 3, 0, 0, 0, - 70, 14, 16, 0, 4, 0, - 0, 0, 0, 0, 0, 8, - 242, 0, 16, 0, 3, 0, - 0, 0, 70, 14, 16, 0, - 3, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 18, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 3, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 1, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 2, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 2, 0, 0, 0, - 54, 0, 0, 6, 114, 32, - 16, 0, 3, 0, 0, 0, - 70, 18, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 54, 0, 0, 5, 130, 32, - 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 5, - 242, 32, 16, 0, 4, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 54, 0, - 0, 6, 242, 32, 16, 0, - 5, 0, 0, 0, 70, 30, - 32, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 54, 0, - 0, 8, 242, 32, 16, 0, - 6, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 117, 0, 0, 3, 0, 0, - 17, 0, 0, 0, 0, 0, - 0, 0, 0, 7, 114, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 3, 0, 0, 0, 86, 5, - 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 16, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 3, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 3, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 17, 0, 0, 0, 166, 10, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 3, 0, - 0, 0, 0, 0, 0, 8, - 242, 0, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 18, 0, 0, 0, 54, 0, - 0, 5, 242, 32, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 1, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 2, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 2, 0, 0, 0, - 54, 0, 0, 6, 114, 32, - 16, 0, 3, 0, 0, 0, - 70, 18, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 54, 0, 0, 5, 130, 32, - 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 5, - 242, 32, 16, 0, 4, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 54, 0, - 0, 6, 242, 32, 16, 0, - 5, 0, 0, 0, 70, 30, - 32, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 54, 0, - 0, 8, 242, 32, 16, 0, - 6, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 63, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 117, 0, 0, 3, 0, 0, - 17, 0, 0, 0, 0, 0, - 62, 0, 0, 1, 83, 84, - 65, 84, 148, 0, 0, 0, - 108, 0, 0, 0, 6, 0, - 0, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 55, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 5, 0, - 0, 0, 4, 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, 2, 0, - 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 5, 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 -}; diff --git a/demo/d3d11/shaders/diffusePS.hlsl b/demo/d3d11/shaders/diffusePS.hlsl deleted file mode 100644 index c6e474e..0000000 --- a/demo/d3d11/shaders/diffusePS.hlsl +++ /dev/null @@ -1,37 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - DiffuseShaderConst gParams; -}; - -float sqr(float x) { return x * x; } - - -float4 diffusePS(DiffuseGeometryOut input - //, out float gl_FragDepth : SV_DEPTH -) : SV_TARGET -{ - //return float4(1.0f, 0.0f, 0.0f, 1.0f); - - float attenuation = 1.0f; - float lifeTime = input.worldPos.w; - float lifeFade = min(1.0, lifeTime*0.125); - float velocityFade = input.viewVel.w; - - // calculate normal from texture coordinates - float3 normal; - normal.xy = input.uv.xy*float2(2.0, 2.0) + float2(-1.0, -1.0); - float mag = dot(normal.xy, normal.xy); - - // kill pixels outside circle - if (mag > 1.0) - discard; - - normal.z = 1.0-mag; - - float alpha = lifeFade*velocityFade*sqr(normal.z); - - return float4(alpha, alpha, alpha, alpha); - -} diff --git a/demo/d3d11/shaders/diffusePS.hlsl.h b/demo/d3d11/shaders/diffusePS.hlsl.h deleted file mode 100644 index b77dc1c..0000000 --- a/demo/d3d11/shaders/diffusePS.hlsl.h +++ /dev/null @@ -1,216 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_POSITION 0 xyzw 0 POS float -// POSITION 0 xyzw 1 NONE float w -// VIEWPOS 0 xyzw 2 NONE float -// VIEWVEL 0 xyzw 3 NONE float w -// LIGHTDIR 0 xyzw 4 NONE float -// COLOR 0 xyzw 5 NONE float -// UV 0 xyzw 6 NONE float xy -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// -ps_5_0 -dcl_globalFlags refactoringAllowed -dcl_input_ps linear v1.w -dcl_input_ps linear v3.w -dcl_input_ps linear v6.xy -dcl_output o0.xyzw -dcl_temps 1 -mad r0.xy, v6.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000) -dp2 r0.x, r0.xyxx, r0.xyxx -lt r0.y, l(1.000000), r0.x -discard_nz r0.y -mul r0.y, v1.w, l(0.125000) -min r0.y, r0.y, l(1.000000) -add r0.x, -r0.x, l(1.000000) -mul r0.y, r0.y, v3.w -mul r0.x, r0.x, r0.x -mul o0.xyzw, r0.xxxx, r0.yyyy -ret -// Approximately 11 instruction slots used -#endif - -const BYTE g_diffusePS[] = -{ - 68, 88, 66, 67, 142, 84, - 94, 27, 80, 231, 240, 136, - 237, 253, 148, 77, 42, 64, - 90, 183, 1, 0, 0, 0, - 232, 3, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 172, 0, 0, 0, 156, 1, - 0, 0, 208, 1, 0, 0, - 76, 3, 0, 0, 82, 68, - 69, 70, 112, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 255, 255, 0, 1, 0, 0, - 60, 0, 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, - 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, 54, - 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, - 52, 0, 171, 171, 73, 83, - 71, 78, 232, 0, 0, 0, - 7, 0, 0, 0, 8, 0, - 0, 0, 176, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 188, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 8, - 0, 0, 197, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 15, 0, - 0, 0, 205, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 8, - 0, 0, 213, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 4, 0, 0, 0, 15, 0, - 0, 0, 222, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 5, 0, 0, 0, 15, 0, - 0, 0, 228, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 6, 0, 0, 0, 15, 3, - 0, 0, 83, 86, 95, 80, - 79, 83, 73, 84, 73, 79, - 78, 0, 80, 79, 83, 73, - 84, 73, 79, 78, 0, 86, - 73, 69, 87, 80, 79, 83, - 0, 86, 73, 69, 87, 86, - 69, 76, 0, 76, 73, 71, - 72, 84, 68, 73, 82, 0, - 67, 79, 76, 79, 82, 0, - 85, 86, 0, 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, 69, 88, - 116, 1, 0, 0, 80, 0, - 0, 0, 93, 0, 0, 0, - 106, 8, 0, 1, 98, 16, - 0, 3, 130, 16, 16, 0, - 1, 0, 0, 0, 98, 16, - 0, 3, 130, 16, 16, 0, - 3, 0, 0, 0, 98, 16, - 0, 3, 50, 16, 16, 0, - 6, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 104, 0, - 0, 2, 1, 0, 0, 0, - 50, 0, 0, 15, 50, 0, - 16, 0, 0, 0, 0, 0, - 70, 16, 16, 0, 6, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 64, 0, 0, - 0, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 191, - 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, - 70, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 0, 0, 0, 0, 49, 0, - 0, 7, 34, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 10, 0, 16, 0, 0, 0, - 0, 0, 13, 0, 4, 3, - 26, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 34, 0, 16, 0, 0, 0, - 0, 0, 58, 16, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 62, - 51, 0, 0, 7, 34, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 0, 0, - 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 7, 34, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 58, 16, 16, 0, - 3, 0, 0, 0, 56, 0, - 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 242, 32, 16, 0, 0, 0, - 0, 0, 6, 0, 16, 0, - 0, 0, 0, 0, 86, 5, - 16, 0, 0, 0, 0, 0, - 62, 0, 0, 1, 83, 84, - 65, 84, 148, 0, 0, 0, - 11, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 9, 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, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; diff --git a/demo/d3d11/shaders/diffuseVS.hlsl b/demo/d3d11/shaders/diffuseVS.hlsl deleted file mode 100644 index afca738..0000000 --- a/demo/d3d11/shaders/diffuseVS.hlsl +++ /dev/null @@ -1,26 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - DiffuseShaderConst gParams; -}; - -DiffuseVertexOut diffuseVS(DiffuseVertexIn input) -{ - float3 worldPos = input.position.xyz; - float4 eyePos = mul(gParams.modelView, float4(worldPos, 1.0)); - - DiffuseVertexOut output; - - output.worldPos = input.position; // lifetime in w - output.viewPos = eyePos; - output.viewVel = mul(gParams.modelView, float4(input.velocity.xyz, 0.0)); - output.color = gParams.color; - - // compute ndc pos for frustrum culling in GS - float4 ndcPos = mul(gParams.modelViewProjection, float4(worldPos.xyz, 1.0)); - output.ndcPos = ndcPos / ndcPos.w; - - return output; - -} diff --git a/demo/d3d11/shaders/diffuseVS.hlsl.h b/demo/d3d11/shaders/diffuseVS.hlsl.h deleted file mode 100644 index 7db0a8c..0000000 --- a/demo/d3d11/shaders/diffuseVS.hlsl.h +++ /dev/null @@ -1,425 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer constBuf -// { -// -// struct DiffuseShaderConst -// { -// -// float3 lightPos; // Offset: 0 -// float pad0; // Offset: 12 -// float3 lightDir; // Offset: 16 -// float pad1; // Offset: 28 -// float4x4 lightTransform; // Offset: 32 -// float4 color; // Offset: 96 -// float4x4 modelView; // Offset: 112 -// float4x4 modelViewProjection; // Offset: 176 -// float4x4 projection; // Offset: 240 -// float4 shadowTaps[12]; // Offset: 304 -// float diffusion; // Offset: 496 -// float diffuseRadius; // Offset: 500 -// float diffuseScale; // Offset: 504 -// float spotMin; // Offset: 508 -// float spotMax; // Offset: 512 -// float motionBlurScale; // Offset: 516 -// float pad3; // Offset: 520 -// float pad4; // Offset: 524 -// -// } gParams; // Offset: 0 Size: 528 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// constBuf cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xyzw 0 NONE float xyzw -// VELOCITY 0 xyzw 1 NONE float xyz -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xyzw 0 NONE float xyzw -// NCDPOS 0 xyzw 1 NONE float xyzw -// VIEWPOS 0 xyzw 2 NONE float xyzw -// VIEWVEL 0 xyzw 3 NONE float xyzw -// COLOR 0 xyzw 4 NONE float xyzw -// -vs_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[15], immediateIndexed -dcl_input v0.xyzw -dcl_input v1.xyz -dcl_output o0.xyzw -dcl_output o1.xyzw -dcl_output o2.xyzw -dcl_output o3.xyzw -dcl_output o4.xyzw -dcl_temps 1 -mov o0.xyzw, v0.xyzw -mul r0.xyzw, v0.yyyy, cb0[12].xyzw -mad r0.xyzw, cb0[11].xyzw, v0.xxxx, r0.xyzw -mad r0.xyzw, cb0[13].xyzw, v0.zzzz, r0.xyzw -add r0.xyzw, r0.xyzw, cb0[14].xyzw -div o1.xyzw, r0.xyzw, r0.wwww -mul r0.xyzw, v0.yyyy, cb0[8].xyzw -mad r0.xyzw, cb0[7].xyzw, v0.xxxx, r0.xyzw -mad r0.xyzw, cb0[9].xyzw, v0.zzzz, r0.xyzw -add o2.xyzw, r0.xyzw, cb0[10].xyzw -mul r0.xyzw, v1.yyyy, cb0[8].xyzw -mad r0.xyzw, cb0[7].xyzw, v1.xxxx, r0.xyzw -mad o3.xyzw, cb0[9].xyzw, v1.zzzz, r0.xyzw -mov o4.xyzw, cb0[6].xyzw -ret -// Approximately 15 instruction slots used -#endif - -const BYTE g_diffuseVS[] = -{ - 68, 88, 66, 67, 169, 46, - 39, 192, 132, 15, 181, 233, - 181, 235, 144, 49, 232, 212, - 251, 135, 1, 0, 0, 0, - 184, 7, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 188, 3, 0, 0, 16, 4, - 0, 0, 192, 4, 0, 0, - 28, 7, 0, 0, 82, 68, - 69, 70, 128, 3, 0, 0, - 1, 0, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 254, 255, 0, 1, 0, 0, - 76, 3, 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, 1, 0, - 0, 0, 99, 111, 110, 115, - 116, 66, 117, 102, 0, 171, - 171, 171, 92, 0, 0, 0, - 1, 0, 0, 0, 128, 0, - 0, 0, 16, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 168, 0, 0, 0, - 0, 0, 0, 0, 16, 2, - 0, 0, 2, 0, 0, 0, - 40, 3, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 103, 80, 97, 114, 97, 109, - 115, 0, 68, 105, 102, 102, - 117, 115, 101, 83, 104, 97, - 100, 101, 114, 67, 111, 110, - 115, 116, 0, 108, 105, 103, - 104, 116, 80, 111, 115, 0, - 102, 108, 111, 97, 116, 51, - 0, 171, 1, 0, 3, 0, - 1, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 204, 0, - 0, 0, 112, 97, 100, 48, - 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, 253, 0, - 0, 0, 108, 105, 103, 104, - 116, 68, 105, 114, 0, 112, - 97, 100, 49, 0, 108, 105, - 103, 104, 116, 84, 114, 97, - 110, 115, 102, 111, 114, 109, - 0, 102, 108, 111, 97, 116, - 52, 120, 52, 0, 171, 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, 69, 1, 0, 0, - 99, 111, 108, 111, 114, 0, - 102, 108, 111, 97, 116, 52, - 0, 171, 171, 171, 1, 0, - 3, 0, 1, 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, - 122, 1, 0, 0, 109, 111, - 100, 101, 108, 86, 105, 101, - 119, 0, 109, 111, 100, 101, - 108, 86, 105, 101, 119, 80, - 114, 111, 106, 101, 99, 116, - 105, 111, 110, 0, 112, 114, - 111, 106, 101, 99, 116, 105, - 111, 110, 0, 115, 104, 97, - 100, 111, 119, 84, 97, 112, - 115, 0, 1, 0, 3, 0, - 1, 0, 4, 0, 12, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 122, 1, - 0, 0, 100, 105, 102, 102, - 117, 115, 105, 111, 110, 0, - 100, 105, 102, 102, 117, 115, - 101, 82, 97, 100, 105, 117, - 115, 0, 100, 105, 102, 102, - 117, 115, 101, 83, 99, 97, - 108, 101, 0, 115, 112, 111, - 116, 77, 105, 110, 0, 115, - 112, 111, 116, 77, 97, 120, - 0, 109, 111, 116, 105, 111, - 110, 66, 108, 117, 114, 83, - 99, 97, 108, 101, 0, 112, - 97, 100, 51, 0, 112, 97, - 100, 52, 0, 171, 195, 0, - 0, 0, 212, 0, 0, 0, - 0, 0, 0, 0, 248, 0, - 0, 0, 4, 1, 0, 0, - 12, 0, 0, 0, 40, 1, - 0, 0, 212, 0, 0, 0, - 16, 0, 0, 0, 49, 1, - 0, 0, 4, 1, 0, 0, - 28, 0, 0, 0, 54, 1, - 0, 0, 80, 1, 0, 0, - 32, 0, 0, 0, 116, 1, - 0, 0, 132, 1, 0, 0, - 96, 0, 0, 0, 168, 1, - 0, 0, 80, 1, 0, 0, - 112, 0, 0, 0, 178, 1, - 0, 0, 80, 1, 0, 0, - 176, 0, 0, 0, 198, 1, - 0, 0, 80, 1, 0, 0, - 240, 0, 0, 0, 209, 1, - 0, 0, 220, 1, 0, 0, - 48, 1, 0, 0, 0, 2, - 0, 0, 4, 1, 0, 0, - 240, 1, 0, 0, 10, 2, - 0, 0, 4, 1, 0, 0, - 244, 1, 0, 0, 24, 2, - 0, 0, 4, 1, 0, 0, - 248, 1, 0, 0, 37, 2, - 0, 0, 4, 1, 0, 0, - 252, 1, 0, 0, 45, 2, - 0, 0, 4, 1, 0, 0, - 0, 2, 0, 0, 53, 2, - 0, 0, 4, 1, 0, 0, - 4, 2, 0, 0, 69, 2, - 0, 0, 4, 1, 0, 0, - 8, 2, 0, 0, 74, 2, - 0, 0, 4, 1, 0, 0, - 12, 2, 0, 0, 5, 0, - 0, 0, 1, 0, 132, 0, - 0, 0, 18, 0, 80, 2, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 176, 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, 54, 46, 51, - 46, 57, 54, 48, 48, 46, - 49, 54, 51, 56, 52, 0, - 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, 15, 7, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 86, 69, 76, - 79, 67, 73, 84, 89, 0, - 171, 171, 79, 83, 71, 78, - 168, 0, 0, 0, 5, 0, - 0, 0, 8, 0, 0, 0, - 128, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 137, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 15, 0, 0, 0, - 144, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, - 152, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 3, 0, - 0, 0, 15, 0, 0, 0, - 160, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 4, 0, - 0, 0, 15, 0, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 78, 67, 68, - 80, 79, 83, 0, 86, 73, - 69, 87, 80, 79, 83, 0, - 86, 73, 69, 87, 86, 69, - 76, 0, 67, 79, 76, 79, - 82, 0, 171, 171, 83, 72, - 69, 88, 84, 2, 0, 0, - 80, 0, 1, 0, 149, 0, - 0, 0, 106, 8, 0, 1, - 89, 0, 0, 4, 70, 142, - 32, 0, 0, 0, 0, 0, - 15, 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, 101, 0, - 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 1, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 2, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 3, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 4, 0, 0, 0, 104, 0, - 0, 2, 1, 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, 8, - 242, 0, 16, 0, 0, 0, - 0, 0, 86, 21, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 11, 0, 0, 0, 6, 16, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 13, 0, - 0, 0, 166, 26, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 8, 242, 0, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 14, 0, - 0, 0, 14, 0, 0, 7, - 242, 32, 16, 0, 1, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 246, 15, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 8, 242, 0, - 16, 0, 0, 0, 0, 0, - 86, 21, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 7, 0, - 0, 0, 6, 16, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 9, 0, 0, 0, - 166, 26, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 0, 0, - 0, 8, 242, 32, 16, 0, - 2, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 10, 0, 0, 0, - 56, 0, 0, 8, 242, 0, - 16, 0, 0, 0, 0, 0, - 86, 21, 16, 0, 1, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 7, 0, - 0, 0, 6, 16, 16, 0, - 1, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 10, 242, 32, - 16, 0, 3, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 9, 0, 0, 0, - 166, 26, 16, 0, 1, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 6, 242, 32, 16, 0, - 4, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, - 148, 0, 0, 0, 15, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 7, 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, 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, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0 -}; diff --git a/demo/d3d11/shaders/ellipsoidDepthGS.hlsl b/demo/d3d11/shaders/ellipsoidDepthGS.hlsl deleted file mode 100644 index 8c892e4..0000000 --- a/demo/d3d11/shaders/ellipsoidDepthGS.hlsl +++ /dev/null @@ -1,127 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - FluidShaderConst gParams; -}; - -static const float2 corners[4] = -{ - float2(0.0, 1.0), float2(0.0, 0.0), float2(1.0, 1.0), float2(1.0, 0.0) -}; - -[maxvertexcount(4)] -void ellipsoidDepthGS(point FluidVertexOut input[1], inout TriangleStream<FluidGeoOut> triStream) -{ - float4 gl_Position; - float4 gl_TexCoord[6]; - - float4 gl_PositionIn[1]; - float4 gl_TexCoordIn[1][6]; - - gl_PositionIn[0] = input[0].position; - { - [unroll] - for (int i = 0; i < 6; i++) - gl_TexCoordIn[0][i] = input[0].texCoord[i]; - } - - float3 pos = gl_PositionIn[0].xyz; - float4 bounds = gl_TexCoordIn[0][0]; - float4 ndcPos = gl_TexCoordIn[0][5]; - - if (ndcPos.w < 0.0) - return; - - // frustrum culling - const float ndcBound = 1.0; - if (ndcPos.x < -ndcBound) return; - if (ndcPos.x > ndcBound) return; - if (ndcPos.y < -ndcBound) return; - if (ndcPos.y > ndcBound) return; - - float xmin = bounds.x; - float xmax = bounds.y; - float ymin = bounds.z; - float ymax = bounds.w; - - - // inv quadric transform - gl_TexCoord[0] = gl_TexCoordIn[0][1]; - gl_TexCoord[1] = gl_TexCoordIn[0][2]; - gl_TexCoord[2] = gl_TexCoordIn[0][3]; - gl_TexCoord[3] = gl_TexCoordIn[0][4]; - - FluidGeoOut output; - - gl_Position = float4(xmin, ymax, 0.5, 1.0); - output.position = gl_Position; - output.texCoord[0] = gl_TexCoord[0]; - output.texCoord[1] = gl_TexCoord[1]; - output.texCoord[2] = gl_TexCoord[2]; - output.texCoord[3] = gl_TexCoord[3]; - triStream.Append(output); - - gl_Position = float4(xmin, ymin, 0.5, 1.0); - output.position = gl_Position; - output.texCoord[0] = gl_TexCoord[0]; - output.texCoord[1] = gl_TexCoord[1]; - output.texCoord[2] = gl_TexCoord[2]; - output.texCoord[3] = gl_TexCoord[3]; - triStream.Append(output); - - gl_Position = float4(xmax, ymax, 0.5, 1.0); - output.position = gl_Position; - output.texCoord[0] = gl_TexCoord[0]; - output.texCoord[1] = gl_TexCoord[1]; - output.texCoord[2] = gl_TexCoord[2]; - output.texCoord[3] = gl_TexCoord[3]; - triStream.Append(output); - - gl_Position = float4(xmax, ymin, 0.5, 1.0); - output.position = gl_Position; - output.texCoord[0] = gl_TexCoord[0]; - output.texCoord[1] = gl_TexCoord[1]; - output.texCoord[2] = gl_TexCoord[2]; - output.texCoord[3] = gl_TexCoord[3]; - triStream.Append(output); - - /* - void main() - { - vec3 pos = gl_PositionIn[0].xyz; - vec4 bounds = gl_TexCoordIn[0][0]; - vec4 ndcPos = gl_TexCoordIn[0][5]; - - // frustrum culling - const float ndcBound = 1.0; - if (ndcPos.x < -ndcBound) return; - if (ndcPos.x > ndcBound) return; - if (ndcPos.y < -ndcBound) return; - if (ndcPos.y > ndcBound) return; - - float xmin = bounds.x; - float xmax = bounds.y; - float ymin = bounds.z; - float ymax = bounds.w; - - // inv quadric transform - gl_TexCoord[0] = gl_TexCoordIn[0][1]; - gl_TexCoord[1] = gl_TexCoordIn[0][2]; - gl_TexCoord[2] = gl_TexCoordIn[0][3]; - gl_TexCoord[3] = gl_TexCoordIn[0][4]; - - gl_Position = vec4(xmin, ymax, 0.0, 1.0); - EmitVertex(); - - gl_Position = vec4(xmin, ymin, 0.0, 1.0); - EmitVertex(); - - gl_Position = vec4(xmax, ymax, 0.0, 1.0); - EmitVertex(); - - gl_Position = vec4(xmax, ymin, 0.0, 1.0); - EmitVertex(); - } - */ -} diff --git a/demo/d3d11/shaders/ellipsoidDepthGS.hlsl.h b/demo/d3d11/shaders/ellipsoidDepthGS.hlsl.h deleted file mode 100644 index c82cc89..0000000 --- a/demo/d3d11/shaders/ellipsoidDepthGS.hlsl.h +++ /dev/null @@ -1,414 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xyzw 0 NONE float -// TEXCOORD 0 xyzw 1 NONE float xyzw -// TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float xyzw -// TEXCOORD 3 xyzw 4 NONE float xyzw -// TEXCOORD 4 xyzw 5 NONE float xyzw -// TEXCOORD 5 xyzw 6 NONE float xy w -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_POSITION 0 xyzw 0 POS float xyzw -// TEXCOORD 0 xyzw 1 NONE float xyzw -// TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float xyzw -// TEXCOORD 3 xyzw 4 NONE float xyzw -// -gs_5_0 -dcl_globalFlags refactoringAllowed -dcl_input v[1][0].xyzw -dcl_input v[1][1].xyzw -dcl_input v[1][2].xyzw -dcl_input v[1][3].xyzw -dcl_input v[1][4].xyzw -dcl_input v[1][5].xyzw -dcl_input v[1][6].xyzw -dcl_temps 1 -dcl_inputprimitive point -dcl_stream m0 -dcl_outputtopology trianglestrip -dcl_output_siv o0.xyzw, position -dcl_output o1.xyzw -dcl_output o2.xyzw -dcl_output o3.xyzw -dcl_output o4.xyzw -dcl_maxout 4 -lt r0.x, v[0][6].w, l(0.000000) -if_nz r0.x - ret -endif -lt r0.x, v[0][6].x, l(-1.000000) -if_nz r0.x - ret -endif -lt r0.x, l(1.000000), v[0][6].x -if_nz r0.x - ret -endif -lt r0.x, v[0][6].y, l(-1.000000) -if_nz r0.x - ret -endif -lt r0.x, l(1.000000), v[0][6].y -if_nz r0.x - ret -endif -mov o0.xy, v[0][1].xwxx -mov o0.zw, l(0,0,0.500000,1.000000) -mov o1.xyzw, v[0][2].xyzw -mov o2.xyzw, v[0][3].xyzw -mov o3.xyzw, v[0][4].xyzw -mov o4.xyzw, v[0][5].xyzw -emit_stream m0 -mov o0.xy, v[0][1].xzxx -mov o0.zw, l(0,0,0.500000,1.000000) -mov o1.xyzw, v[0][2].xyzw -mov o2.xyzw, v[0][3].xyzw -mov o3.xyzw, v[0][4].xyzw -mov o4.xyzw, v[0][5].xyzw -emit_stream m0 -mov o0.xy, v[0][1].ywyy -mov o0.zw, l(0,0,0.500000,1.000000) -mov o1.xyzw, v[0][2].xyzw -mov o2.xyzw, v[0][3].xyzw -mov o3.xyzw, v[0][4].xyzw -mov o4.xyzw, v[0][5].xyzw -emit_stream m0 -mov o0.xy, v[0][1].yzyy -mov o0.zw, l(0,0,0.500000,1.000000) -mov o1.xyzw, v[0][2].xyzw -mov o2.xyzw, v[0][3].xyzw -mov o3.xyzw, v[0][4].xyzw -mov o4.xyzw, v[0][5].xyzw -emit_stream m0 -ret -// Approximately 49 instruction slots used -#endif - -const BYTE g_ellipsoidDepthGS[] = -{ - 68, 88, 66, 67, 121, 233, - 112, 246, 66, 190, 203, 227, - 242, 237, 242, 197, 75, 158, - 125, 123, 1, 0, 0, 0, - 72, 7, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 172, 0, 0, 0, 120, 1, - 0, 0, 44, 2, 0, 0, - 172, 6, 0, 0, 82, 68, - 69, 70, 112, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 83, 71, 0, 1, 0, 0, - 60, 0, 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, - 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, 54, - 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, - 52, 0, 171, 171, 73, 83, - 71, 78, 196, 0, 0, 0, - 7, 0, 0, 0, 8, 0, - 0, 0, 176, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 185, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 15, - 0, 0, 185, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 15, 15, - 0, 0, 185, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 15, - 0, 0, 185, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 4, 0, 0, 0, 15, 15, - 0, 0, 185, 0, 0, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 5, 0, 0, 0, 15, 15, - 0, 0, 185, 0, 0, 0, - 5, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 6, 0, 0, 0, 15, 11, - 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, 53, 172, 0, 0, 0, - 5, 0, 0, 0, 8, 0, - 0, 0, 0, 0, 0, 0, - 148, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 0, 0, 0, 0, 160, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 15, 0, 0, 0, 0, 0, - 0, 0, 160, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 15, 0, - 0, 0, 0, 0, 0, 0, - 160, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 3, 0, - 0, 0, 15, 0, 0, 0, - 0, 0, 0, 0, 160, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 4, 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, 171, 171, 171, 83, 72, - 69, 88, 120, 4, 0, 0, - 80, 0, 2, 0, 30, 1, - 0, 0, 106, 8, 0, 1, - 95, 0, 0, 4, 242, 16, - 32, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 95, 0, - 0, 4, 242, 16, 32, 0, - 1, 0, 0, 0, 1, 0, - 0, 0, 95, 0, 0, 4, - 242, 16, 32, 0, 1, 0, - 0, 0, 2, 0, 0, 0, - 95, 0, 0, 4, 242, 16, - 32, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 95, 0, - 0, 4, 242, 16, 32, 0, - 1, 0, 0, 0, 4, 0, - 0, 0, 95, 0, 0, 4, - 242, 16, 32, 0, 1, 0, - 0, 0, 5, 0, 0, 0, - 95, 0, 0, 4, 242, 16, - 32, 0, 1, 0, 0, 0, - 6, 0, 0, 0, 104, 0, - 0, 2, 1, 0, 0, 0, - 93, 8, 0, 1, 143, 0, - 0, 3, 0, 0, 17, 0, - 0, 0, 0, 0, 92, 40, - 0, 1, 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, - 101, 0, 0, 3, 242, 32, - 16, 0, 2, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 3, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 4, 0, 0, 0, - 94, 0, 0, 2, 4, 0, - 0, 0, 49, 0, 0, 8, - 18, 0, 16, 0, 0, 0, - 0, 0, 58, 16, 32, 0, - 0, 0, 0, 0, 6, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 31, 0, - 4, 3, 10, 0, 16, 0, - 0, 0, 0, 0, 62, 0, - 0, 1, 21, 0, 0, 1, - 49, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, - 10, 16, 32, 0, 0, 0, - 0, 0, 6, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 191, 31, 0, 4, 3, - 10, 0, 16, 0, 0, 0, - 0, 0, 62, 0, 0, 1, - 21, 0, 0, 1, 49, 0, - 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 10, 16, 32, 0, 0, 0, - 0, 0, 6, 0, 0, 0, - 31, 0, 4, 3, 10, 0, - 16, 0, 0, 0, 0, 0, - 62, 0, 0, 1, 21, 0, - 0, 1, 49, 0, 0, 8, - 18, 0, 16, 0, 0, 0, - 0, 0, 26, 16, 32, 0, - 0, 0, 0, 0, 6, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 191, 31, 0, - 4, 3, 10, 0, 16, 0, - 0, 0, 0, 0, 62, 0, - 0, 1, 21, 0, 0, 1, - 49, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 26, 16, 32, 0, - 0, 0, 0, 0, 6, 0, - 0, 0, 31, 0, 4, 3, - 10, 0, 16, 0, 0, 0, - 0, 0, 62, 0, 0, 1, - 21, 0, 0, 1, 54, 0, - 0, 6, 50, 32, 16, 0, - 0, 0, 0, 0, 198, 16, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 54, 0, - 0, 8, 194, 32, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 63, 0, 0, 128, 63, - 54, 0, 0, 6, 242, 32, - 16, 0, 1, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 2, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 2, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 3, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 4, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 5, 0, 0, 0, - 117, 0, 0, 3, 0, 0, - 17, 0, 0, 0, 0, 0, - 54, 0, 0, 6, 50, 32, - 16, 0, 0, 0, 0, 0, - 134, 16, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 54, 0, 0, 8, 194, 32, - 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 63, 0, 0, - 128, 63, 54, 0, 0, 6, - 242, 32, 16, 0, 1, 0, - 0, 0, 70, 30, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 54, 0, 0, 6, - 242, 32, 16, 0, 2, 0, - 0, 0, 70, 30, 32, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 54, 0, 0, 6, - 242, 32, 16, 0, 3, 0, - 0, 0, 70, 30, 32, 0, - 0, 0, 0, 0, 4, 0, - 0, 0, 54, 0, 0, 6, - 242, 32, 16, 0, 4, 0, - 0, 0, 70, 30, 32, 0, - 0, 0, 0, 0, 5, 0, - 0, 0, 117, 0, 0, 3, - 0, 0, 17, 0, 0, 0, - 0, 0, 54, 0, 0, 6, - 50, 32, 16, 0, 0, 0, - 0, 0, 214, 21, 32, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 54, 0, 0, 8, - 194, 32, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 63, - 0, 0, 128, 63, 54, 0, - 0, 6, 242, 32, 16, 0, - 1, 0, 0, 0, 70, 30, - 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 54, 0, - 0, 6, 242, 32, 16, 0, - 2, 0, 0, 0, 70, 30, - 32, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 54, 0, - 0, 6, 242, 32, 16, 0, - 3, 0, 0, 0, 70, 30, - 32, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 54, 0, - 0, 6, 242, 32, 16, 0, - 4, 0, 0, 0, 70, 30, - 32, 0, 0, 0, 0, 0, - 5, 0, 0, 0, 117, 0, - 0, 3, 0, 0, 17, 0, - 0, 0, 0, 0, 54, 0, - 0, 6, 50, 32, 16, 0, - 0, 0, 0, 0, 150, 21, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 54, 0, - 0, 8, 194, 32, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 63, 0, 0, 128, 63, - 54, 0, 0, 6, 242, 32, - 16, 0, 1, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 2, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 2, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 3, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 54, 0, 0, 6, 242, 32, - 16, 0, 4, 0, 0, 0, - 70, 30, 32, 0, 0, 0, - 0, 0, 5, 0, 0, 0, - 117, 0, 0, 3, 0, 0, - 17, 0, 0, 0, 0, 0, - 62, 0, 0, 1, 83, 84, - 65, 84, 148, 0, 0, 0, - 49, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 5, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 0, - 0, 0, 5, 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, 1, 0, 0, 0, - 5, 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 -}; diff --git a/demo/d3d11/shaders/ellipsoidDepthPS.hlsl b/demo/d3d11/shaders/ellipsoidDepthPS.hlsl deleted file mode 100644 index b9a8287..0000000 --- a/demo/d3d11/shaders/ellipsoidDepthPS.hlsl +++ /dev/null @@ -1,108 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - FluidShaderConst gParams; -}; - -float Sign(float x) { return x < 0.0 ? -1.0 : 1.0; } - -bool solveQuadratic(float a, float b, float c, out float minT, out float maxT) -{ -#if 0 - minT = 0.0f; - maxT = 0.0f; -#endif - - if (a == 0.0 && b == 0.0) - { - minT = maxT = 0.0; - return true; - } - - float discriminant = b*b - 4.0*a*c; - - if (discriminant < 0.0) - { - return false; - } - - float t = -0.5*(b + Sign(b)*sqrt(discriminant)); - minT = t / a; - maxT = c / t; - - if (minT > maxT) - { - float tmp = minT; - minT = maxT; - maxT = tmp; - } - - return true; -} - -float sqr(float x) { return x * x; } - - -float4 ellipsoidDepthPS(FluidGeoOut input - , out float gl_FragDepth : SV_DEPTH -) : SV_TARGET -{ - const float4x4 gl_ProjectionMatrix = gParams.projection; - const float4x4 gl_ProjectionMatrixInverse = gParams.projection_inverse; - const float3 invViewport = gParams.invViewport; - - float4 gl_FragColor; - float4 gl_FragCoord; - float4 gl_TexCoord[6]; - - gl_FragCoord = input.position; - [unroll] - for (int i = 0; i < 4; i++) - gl_TexCoord[i] = input.texCoord[i]; - - // transform from view space to parameter space - //column_major - float4x4 invQuadric; - invQuadric._m00_m10_m20_m30 = gl_TexCoord[0]; - invQuadric._m01_m11_m21_m31 = gl_TexCoord[1]; - invQuadric._m02_m12_m22_m32 = gl_TexCoord[2]; - invQuadric._m03_m13_m23_m33 = gl_TexCoord[3]; - - //float4 ndcPos = float4(gl_FragCoord.xy * invViewport.xy * float2(2.0, 2.0) - float2(1.0, 1.0), -1.0, 1.0); - float4 ndcPos = float4(gl_FragCoord.x*invViewport.x*2.0f-1.0f, (1.0f-gl_FragCoord.y*invViewport.y)*2.0 - 1.0, 0.0f, 1.0); - float4 viewDir = mul(gl_ProjectionMatrixInverse, ndcPos); - - // ray to parameter space - float4 dir = mul(invQuadric, float4(viewDir.xyz, 0.0)); - float4 origin = invQuadric._m03_m13_m23_m33; - - // set up quadratric equation - float a = sqr(dir.x) + sqr(dir.y) + sqr(dir.z); - float b = dir.x*origin.x + dir.y*origin.y + dir.z*origin.z - dir.w*origin.w; - float c = sqr(origin.x) + sqr(origin.y) + sqr(origin.z) - sqr(origin.w); - - float minT; - float maxT; - - if (solveQuadratic(a, 2.0 * b, c, minT, maxT)) - { - float3 eyePos = viewDir.xyz*minT; - float4 ndcPos = mul(gl_ProjectionMatrix, float4(eyePos, 1.0)); - ndcPos.z /= ndcPos.w; - - gl_FragColor = float4(eyePos.z, 1.0, 1.0, 1.0); - gl_FragDepth = ndcPos.z; - - return gl_FragColor; - } - - // kill pixels outside of ellipsoid - discard; - - - gl_FragColor = 0.0f; - gl_FragDepth = 1.0f; - - return gl_FragColor; -} diff --git a/demo/d3d11/shaders/ellipsoidDepthPS.hlsl.h b/demo/d3d11/shaders/ellipsoidDepthPS.hlsl.h deleted file mode 100644 index d21d446..0000000 --- a/demo/d3d11/shaders/ellipsoidDepthPS.hlsl.h +++ /dev/null @@ -1,662 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer constBuf -// { -// -// struct FluidShaderConst -// { -// -// float4x4 modelviewprojection; // Offset: 0 -// float4x4 modelview; // Offset: 64 -// float4x4 projection; // Offset: 128 -// float4x4 modelview_inverse; // Offset: 192 -// float4x4 projection_inverse; // Offset: 256 -// float4 invTexScale; // Offset: 320 -// float3 invViewport; // Offset: 336 -// float _pad0; // Offset: 348 -// float blurRadiusWorld; // Offset: 352 -// float blurScale; // Offset: 356 -// float blurFalloff; // Offset: 360 -// int debug; // Offset: 364 -// float3 lightPos; // Offset: 368 -// float _pad1; // Offset: 380 -// float3 lightDir; // Offset: 384 -// float _pad2; // Offset: 396 -// float4x4 lightTransform; // Offset: 400 -// float4 color; // Offset: 464 -// float4 clipPosToEye; // Offset: 480 -// float spotMin; // Offset: 496 -// float spotMax; // Offset: 500 -// float ior; // Offset: 504 -// float _pad3; // Offset: 508 -// float4 shadowTaps[12]; // Offset: 512 -// -// } gParams; // Offset: 0 Size: 704 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// constBuf cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_POSITION 0 xyzw 0 POS float xy -// TEXCOORD 0 xyzw 1 NONE float xyzw -// TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float xyzw -// TEXCOORD 3 xyzw 4 NONE float xyzw -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// SV_DEPTH 0 N/A oDepth DEPTH float YES -// -ps_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[22], immediateIndexed -dcl_input_ps_siv linear noperspective v0.xy, position -dcl_input_ps linear v1.xyzw -dcl_input_ps linear v2.xyzw -dcl_input_ps linear v3.xyzw -dcl_input_ps linear v4.xyzw -dcl_output o0.xyzw -dcl_output oDepth -dcl_temps 4 -dp2 r0.x, v0.xxxx, cb0[21].xxxx -add r0.x, r0.x, l(-1.000000) -mad r0.y, -v0.y, cb0[21].y, l(1.000000) -mad r0.y, r0.y, l(2.000000), l(-1.000000) -mul r0.yzw, r0.yyyy, cb0[17].xxyz -mad r0.xyz, cb0[16].xyzx, r0.xxxx, r0.yzwy -add r0.xyz, r0.xyzx, cb0[19].xyzx -mul r1.xyzw, r0.yyyy, v2.xyzw -mad r1.xyzw, v1.xyzw, r0.xxxx, r1.xyzw -mad r1.xyzw, v3.xyzw, r0.zzzz, r1.xyzw -dp3 r0.w, r1.xyzx, r1.xyzx -dp3 r1.x, r1.xyzx, v4.xyzx -mad r1.x, -r1.w, v4.w, r1.x -dp3 r1.y, v4.xyzx, v4.xyzx -mad r1.y, -v4.w, v4.w, r1.y -add r1.z, r1.x, r1.x -eq r1.w, r0.w, l(0.000000) -eq r2.x, r1.x, l(0.000000) -and r1.w, r1.w, r2.x -mul r2.x, r0.w, r1.y -mul r2.x, r2.x, l(4.000000) -mad r2.x, r1.z, r1.z, -r2.x -lt r2.y, r2.x, l(0.000000) -not r3.y, r2.y -lt r1.x, r1.x, l(0.000000) -movc r1.x, r1.x, l(-1.000000), l(1.000000) -sqrt r2.x, r2.x -mad r1.x, r1.x, r2.x, r1.z -mul r1.x, r1.x, l(-0.500000) -div r0.w, r1.x, r0.w -div r1.x, r1.y, r1.x -lt r1.y, r1.x, r0.w -movc r3.z, r1.y, r1.x, r0.w -mov r3.xw, l(0,0,0,-1) -movc r1.xy, r2.yyyy, r3.xyxx, r3.zwzz -movc r1.xy, r1.wwww, l(0,-1,0,0), r1.xyxx -if_nz r1.y - mul r0.xyz, r0.xyzx, r1.xxxx - mul r0.yw, r0.yyyy, cb0[9].zzzw - mad r0.xy, cb0[8].zwzz, r0.xxxx, r0.ywyy - mad r0.xy, cb0[10].zwzz, r0.zzzz, r0.xyxx - add r0.xy, r0.xyxx, cb0[11].zwzz - div oDepth, r0.x, r0.y - mov o0.x, r0.z - mov o0.yzw, l(0,1.000000,1.000000,1.000000) - ret -endif -discard_nz l(-1) -mov o0.xyzw, l(0,0,0,0) -mov oDepth, l(1.000000) -ret -// Approximately 51 instruction slots used -#endif - -const BYTE g_ellipsoidDepthPS[] = -{ - 68, 88, 66, 67, 67, 187, - 249, 247, 27, 80, 204, 105, - 148, 238, 87, 239, 162, 120, - 35, 255, 1, 0, 0, 0, - 76, 12, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 116, 4, 0, 0, 20, 5, - 0, 0, 104, 5, 0, 0, - 176, 11, 0, 0, 82, 68, - 69, 70, 56, 4, 0, 0, - 1, 0, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 255, 255, 0, 1, 0, 0, - 4, 4, 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, 1, 0, - 0, 0, 99, 111, 110, 115, - 116, 66, 117, 102, 0, 171, - 171, 171, 92, 0, 0, 0, - 1, 0, 0, 0, 128, 0, - 0, 0, 192, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 168, 0, 0, 0, - 0, 0, 0, 0, 192, 2, - 0, 0, 2, 0, 0, 0, - 224, 3, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 103, 80, 97, 114, 97, 109, - 115, 0, 70, 108, 117, 105, - 100, 83, 104, 97, 100, 101, - 114, 67, 111, 110, 115, 116, - 0, 109, 111, 100, 101, 108, - 118, 105, 101, 119, 112, 114, - 111, 106, 101, 99, 116, 105, - 111, 110, 0, 102, 108, 111, - 97, 116, 52, 120, 52, 0, - 171, 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, 213, 0, - 0, 0, 109, 111, 100, 101, - 108, 118, 105, 101, 119, 0, - 112, 114, 111, 106, 101, 99, - 116, 105, 111, 110, 0, 109, - 111, 100, 101, 108, 118, 105, - 101, 119, 95, 105, 110, 118, - 101, 114, 115, 101, 0, 112, - 114, 111, 106, 101, 99, 116, - 105, 111, 110, 95, 105, 110, - 118, 101, 114, 115, 101, 0, - 105, 110, 118, 84, 101, 120, - 83, 99, 97, 108, 101, 0, - 102, 108, 111, 97, 116, 52, - 0, 171, 171, 171, 1, 0, - 3, 0, 1, 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, - 74, 1, 0, 0, 105, 110, - 118, 86, 105, 101, 119, 112, - 111, 114, 116, 0, 102, 108, - 111, 97, 116, 51, 0, 171, - 1, 0, 3, 0, 1, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 132, 1, 0, 0, - 95, 112, 97, 100, 48, 0, - 102, 108, 111, 97, 116, 0, - 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, 182, 1, 0, 0, - 98, 108, 117, 114, 82, 97, - 100, 105, 117, 115, 87, 111, - 114, 108, 100, 0, 98, 108, - 117, 114, 83, 99, 97, 108, - 101, 0, 98, 108, 117, 114, - 70, 97, 108, 108, 111, 102, - 102, 0, 100, 101, 98, 117, - 103, 0, 105, 110, 116, 0, - 0, 0, 2, 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, 12, 2, 0, 0, - 108, 105, 103, 104, 116, 80, - 111, 115, 0, 95, 112, 97, - 100, 49, 0, 108, 105, 103, - 104, 116, 68, 105, 114, 0, - 95, 112, 97, 100, 50, 0, - 108, 105, 103, 104, 116, 84, - 114, 97, 110, 115, 102, 111, - 114, 109, 0, 99, 111, 108, - 111, 114, 0, 99, 108, 105, - 112, 80, 111, 115, 84, 111, - 69, 121, 101, 0, 115, 112, - 111, 116, 77, 105, 110, 0, - 115, 112, 111, 116, 77, 97, - 120, 0, 105, 111, 114, 0, - 95, 112, 97, 100, 51, 0, - 115, 104, 97, 100, 111, 119, - 84, 97, 112, 115, 0, 171, - 171, 171, 1, 0, 3, 0, - 1, 0, 4, 0, 12, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 74, 1, - 0, 0, 193, 0, 0, 0, - 224, 0, 0, 0, 0, 0, - 0, 0, 4, 1, 0, 0, - 224, 0, 0, 0, 64, 0, - 0, 0, 14, 1, 0, 0, - 224, 0, 0, 0, 128, 0, - 0, 0, 25, 1, 0, 0, - 224, 0, 0, 0, 192, 0, - 0, 0, 43, 1, 0, 0, - 224, 0, 0, 0, 0, 1, - 0, 0, 62, 1, 0, 0, - 84, 1, 0, 0, 64, 1, - 0, 0, 120, 1, 0, 0, - 140, 1, 0, 0, 80, 1, - 0, 0, 176, 1, 0, 0, - 188, 1, 0, 0, 92, 1, - 0, 0, 224, 1, 0, 0, - 188, 1, 0, 0, 96, 1, - 0, 0, 240, 1, 0, 0, - 188, 1, 0, 0, 100, 1, - 0, 0, 250, 1, 0, 0, - 188, 1, 0, 0, 104, 1, - 0, 0, 6, 2, 0, 0, - 16, 2, 0, 0, 108, 1, - 0, 0, 52, 2, 0, 0, - 140, 1, 0, 0, 112, 1, - 0, 0, 61, 2, 0, 0, - 188, 1, 0, 0, 124, 1, - 0, 0, 67, 2, 0, 0, - 140, 1, 0, 0, 128, 1, - 0, 0, 76, 2, 0, 0, - 188, 1, 0, 0, 140, 1, - 0, 0, 82, 2, 0, 0, - 224, 0, 0, 0, 144, 1, - 0, 0, 97, 2, 0, 0, - 84, 1, 0, 0, 208, 1, - 0, 0, 103, 2, 0, 0, - 84, 1, 0, 0, 224, 1, - 0, 0, 116, 2, 0, 0, - 188, 1, 0, 0, 240, 1, - 0, 0, 124, 2, 0, 0, - 188, 1, 0, 0, 244, 1, - 0, 0, 132, 2, 0, 0, - 188, 1, 0, 0, 248, 1, - 0, 0, 136, 2, 0, 0, - 188, 1, 0, 0, 252, 1, - 0, 0, 142, 2, 0, 0, - 156, 2, 0, 0, 0, 2, - 0, 0, 5, 0, 0, 0, - 1, 0, 176, 0, 0, 0, - 24, 0, 192, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 176, 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, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, - 51, 56, 52, 0, 171, 171, - 73, 83, 71, 78, 152, 0, - 0, 0, 5, 0, 0, 0, - 8, 0, 0, 0, 128, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 3, 0, 0, 140, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 15, 15, 0, 0, 140, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, - 15, 15, 0, 0, 140, 0, - 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, - 15, 15, 0, 0, 140, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 4, 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, 171, 171, 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, 0, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 66, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 255, 255, 255, 255, 1, 14, - 0, 0, 83, 86, 95, 84, - 65, 82, 71, 69, 84, 0, - 83, 86, 95, 68, 69, 80, - 84, 72, 0, 171, 83, 72, - 69, 88, 64, 6, 0, 0, - 80, 0, 0, 0, 144, 1, - 0, 0, 106, 8, 0, 1, - 89, 0, 0, 4, 70, 142, - 32, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 100, 32, - 0, 4, 50, 16, 16, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 98, 16, 0, 3, - 242, 16, 16, 0, 1, 0, - 0, 0, 98, 16, 0, 3, - 242, 16, 16, 0, 2, 0, - 0, 0, 98, 16, 0, 3, - 242, 16, 16, 0, 3, 0, - 0, 0, 98, 16, 0, 3, - 242, 16, 16, 0, 4, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 0, 0, - 0, 0, 101, 0, 0, 2, - 1, 192, 0, 0, 104, 0, - 0, 2, 4, 0, 0, 0, - 15, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, - 6, 16, 16, 0, 0, 0, - 0, 0, 6, 128, 32, 0, - 0, 0, 0, 0, 21, 0, - 0, 0, 0, 0, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 191, - 50, 0, 0, 11, 34, 0, - 16, 0, 0, 0, 0, 0, - 26, 16, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 26, 128, 32, 0, 0, 0, - 0, 0, 21, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 50, 0, 0, 9, - 34, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 64, - 1, 64, 0, 0, 0, 0, - 128, 191, 56, 0, 0, 8, - 226, 0, 16, 0, 0, 0, - 0, 0, 86, 5, 16, 0, - 0, 0, 0, 0, 6, 137, - 32, 0, 0, 0, 0, 0, - 17, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 0, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 16, 0, 0, 0, 6, 0, - 16, 0, 0, 0, 0, 0, - 150, 7, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 8, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 19, 0, 0, 0, 56, 0, - 0, 7, 242, 0, 16, 0, - 1, 0, 0, 0, 86, 5, - 16, 0, 0, 0, 0, 0, - 70, 30, 16, 0, 2, 0, - 0, 0, 50, 0, 0, 9, - 242, 0, 16, 0, 1, 0, - 0, 0, 70, 30, 16, 0, - 1, 0, 0, 0, 6, 0, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 1, 0, - 0, 0, 50, 0, 0, 9, - 242, 0, 16, 0, 1, 0, - 0, 0, 70, 30, 16, 0, - 3, 0, 0, 0, 166, 10, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 1, 0, - 0, 0, 16, 0, 0, 7, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 1, 0, 0, 0, - 16, 0, 0, 7, 18, 0, - 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 70, 18, 16, 0, - 4, 0, 0, 0, 50, 0, - 0, 10, 18, 0, 16, 0, - 1, 0, 0, 0, 58, 0, - 16, 128, 65, 0, 0, 0, - 1, 0, 0, 0, 58, 16, - 16, 0, 4, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 16, 0, 0, 7, - 34, 0, 16, 0, 1, 0, - 0, 0, 70, 18, 16, 0, - 4, 0, 0, 0, 70, 18, - 16, 0, 4, 0, 0, 0, - 50, 0, 0, 10, 34, 0, - 16, 0, 1, 0, 0, 0, - 58, 16, 16, 128, 65, 0, - 0, 0, 4, 0, 0, 0, - 58, 16, 16, 0, 4, 0, - 0, 0, 26, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 1, 0, 0, 0, 10, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 24, 0, 0, 7, - 130, 0, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 24, 0, 0, 7, 18, 0, - 16, 0, 2, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 7, 130, 0, 16, 0, - 1, 0, 0, 0, 58, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 2, 0, - 0, 0, 56, 0, 0, 7, - 18, 0, 16, 0, 2, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 1, 0, 0, 0, - 56, 0, 0, 7, 18, 0, - 16, 0, 2, 0, 0, 0, - 10, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 64, 50, 0, - 0, 10, 18, 0, 16, 0, - 2, 0, 0, 0, 42, 0, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 128, - 65, 0, 0, 0, 2, 0, - 0, 0, 49, 0, 0, 7, - 34, 0, 16, 0, 2, 0, - 0, 0, 10, 0, 16, 0, - 2, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 59, 0, 0, 5, 34, 0, - 16, 0, 3, 0, 0, 0, - 26, 0, 16, 0, 2, 0, - 0, 0, 49, 0, 0, 7, - 18, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 55, 0, 0, 9, 18, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 191, 1, 64, - 0, 0, 0, 0, 128, 63, - 75, 0, 0, 5, 18, 0, - 16, 0, 2, 0, 0, 0, - 10, 0, 16, 0, 2, 0, - 0, 0, 50, 0, 0, 9, - 18, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 10, 0, - 16, 0, 2, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 56, 0, 0, 7, - 18, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 191, - 14, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 14, 0, - 0, 7, 18, 0, 16, 0, - 1, 0, 0, 0, 26, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 49, 0, 0, 7, - 34, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 55, 0, 0, 9, 66, 0, - 16, 0, 3, 0, 0, 0, - 26, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 54, 0, 0, 8, 146, 0, - 16, 0, 3, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 55, 0, 0, 9, - 50, 0, 16, 0, 1, 0, - 0, 0, 86, 5, 16, 0, - 2, 0, 0, 0, 70, 0, - 16, 0, 3, 0, 0, 0, - 230, 10, 16, 0, 3, 0, - 0, 0, 55, 0, 0, 12, - 50, 0, 16, 0, 1, 0, - 0, 0, 246, 15, 16, 0, - 1, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 0, 0, 0, 0, - 70, 0, 16, 0, 1, 0, - 0, 0, 31, 0, 4, 3, - 26, 0, 16, 0, 1, 0, - 0, 0, 56, 0, 0, 7, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 6, 0, - 16, 0, 1, 0, 0, 0, - 56, 0, 0, 8, 162, 0, - 16, 0, 0, 0, 0, 0, - 86, 5, 16, 0, 0, 0, - 0, 0, 166, 142, 32, 0, - 0, 0, 0, 0, 9, 0, - 0, 0, 50, 0, 0, 10, - 50, 0, 16, 0, 0, 0, - 0, 0, 230, 138, 32, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 6, 0, 16, 0, - 0, 0, 0, 0, 214, 5, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 10, 50, 0, - 16, 0, 0, 0, 0, 0, - 230, 138, 32, 0, 0, 0, - 0, 0, 10, 0, 0, 0, - 166, 10, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 0, 0, 0, 0, 0, 0, - 0, 8, 50, 0, 16, 0, - 0, 0, 0, 0, 70, 0, - 16, 0, 0, 0, 0, 0, - 230, 138, 32, 0, 0, 0, - 0, 0, 11, 0, 0, 0, - 14, 0, 0, 6, 1, 192, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 18, 32, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 8, - 226, 32, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 128, 63, 0, 0, 128, 63, - 0, 0, 128, 63, 62, 0, - 0, 1, 21, 0, 0, 1, - 13, 0, 4, 3, 1, 64, - 0, 0, 255, 255, 255, 255, - 54, 0, 0, 8, 242, 32, - 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 54, 0, 0, 4, - 1, 192, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 62, 0, 0, 1, 83, 84, - 65, 84, 148, 0, 0, 0, - 51, 0, 0, 0, 4, 0, - 0, 0, 0, 0, 0, 0, - 7, 0, 0, 0, 35, 0, - 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 2, 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, 5, 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 -}; diff --git a/demo/d3d11/shaders/ellipsoidDepthVS.hlsl b/demo/d3d11/shaders/ellipsoidDepthVS.hlsl deleted file mode 100644 index 03ef001..0000000 --- a/demo/d3d11/shaders/ellipsoidDepthVS.hlsl +++ /dev/null @@ -1,195 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - FluidShaderConst gParams; -}; - -// returns 1.0 for x==0.0 (unlike glsl) -float Sign(float x) { return x < 0.0 ? -1.0 : 1.0; } - -bool solveQuadratic(float a, float b, float c, out float minT, out float maxT) -{ -#if 0 - // for debugging - minT = -0.5; - maxT = 0.5; - return true; -#else - //minT = 0.0f; - //maxT = 0.0f; -#endif - - if (a == 0.0 && b == 0.0) - { - minT = maxT = 0.0; - return false; - } - - float discriminant = b*b - 4.0*a*c; - - if (discriminant < 0.0) - { - return false; - } - - float t = -0.5*(b + Sign(b)*sqrt(discriminant)); - minT = t / a; - maxT = c / t; - - if (minT > maxT) - { - float tmp = minT; - minT = maxT; - maxT = tmp; - } - - return true; -} - -float DotInvW(float4 a, float4 b) { return a.x*b.x + a.y*b.y + a.z*b.z - a.w*b.w; } - -FluidVertexOut ellipsoidDepthVS(FluidVertexIn input, uint instance : SV_VertexID) -{ - float4 gl_Position; - float4 gl_TexCoord[6]; - - const float4 gl_Vertex = input.position; - const float4 q1 = input.q1; - const float4 q2 = input.q2; - const float4 q3 = input.q3; - - const float4x4 gl_ModelViewProjectionMatrix = gParams.modelviewprojection; - const float4x4 gl_ModelViewMatrixInverse = gParams.modelview_inverse; - - float3 worldPos = gl_Vertex.xyz; - - // construct quadric matrix - float4x4 q; - q._m00_m10_m20_m30 = float4(q1.xyz*q1.w, 0.0); - q._m01_m11_m21_m31 = float4(q2.xyz*q2.w, 0.0); - q._m02_m12_m22_m32 = float4(q3.xyz*q3.w, 0.0); - q._m03_m13_m23_m33 = float4(worldPos, 1.0); - - // transforms a normal to parameter space (inverse transpose of (q*modelview)^-T) - float4x4 invClip = /*transpose*/(mul(gl_ModelViewProjectionMatrix, q)); - - // solve for the right hand bounds in homogenous clip space - float a1 = DotInvW(invClip[3], invClip[3]); - float b1 = -2.0f*DotInvW(invClip[0], invClip[3]); - float c1 = DotInvW(invClip[0], invClip[0]); - - float xmin; - float xmax; - solveQuadratic(a1, b1, c1, xmin, xmax); - - // solve for the right hand bounds in homogenous clip space - float a2 = DotInvW(invClip[3], invClip[3]); - float b2 = -2.0f*DotInvW(invClip[1], invClip[3]); - float c2 = DotInvW(invClip[1], invClip[1]); - - float ymin; - float ymax; - solveQuadratic(a2, b2, c2, ymin, ymax); - - gl_Position = float4(worldPos.xyz, 1.0); - gl_TexCoord[0] = float4(xmin, xmax, ymin, ymax); - - // construct inverse quadric matrix (used for ray-casting in parameter space) - float4x4 invq; - invq._m00_m10_m20_m30 = float4(q1.xyz / q1.w, 0.0); - invq._m01_m11_m21_m31 = float4(q2.xyz / q2.w, 0.0); - invq._m02_m12_m22_m32 = float4(q3.xyz / q3.w, 0.0); - invq._m03_m13_m23_m33 = float4(0.0, 0.0, 0.0, 1.0); - - invq = transpose(invq); - invq._m03_m13_m23_m33 = -(mul(invq, gl_Position)); - - // transform a point from view space to parameter space - invq = mul(invq, gl_ModelViewMatrixInverse); - - // pass down - gl_TexCoord[1] = invq._m00_m10_m20_m30; - gl_TexCoord[2] = invq._m01_m11_m21_m31; - gl_TexCoord[3] = invq._m02_m12_m22_m32; - gl_TexCoord[4] = invq._m03_m13_m23_m33; - - // compute ndc pos for frustrum culling in GS - float4 ndcPos = mul(gl_ModelViewProjectionMatrix, float4(worldPos.xyz, 1.0)); - gl_TexCoord[5].xyz = ndcPos.xyz / ndcPos.w; - gl_TexCoord[5].w = ndcPos.w; - - FluidVertexOut output; - output.position = gl_Position; - [unroll] - for (int j = 0; j < 6; j++) - output.texCoord[j] = gl_TexCoord[j]; - - return output; - - /* - // rotation matrix in xyz, scale in w - attribute vec4 q1; - attribute vec4 q2; - attribute vec4 q3; - - void main() - { - vec3 worldPos = gl_Vertex.xyz;// - vec3(0.0, 0.1*0.25, 0.0); // hack move towards ground to account for anisotropy - - // construct quadric matrix - mat4 q; - q[0] = vec4(q1.xyz*q1.w, 0.0); - q[1] = vec4(q2.xyz*q2.w, 0.0); - q[2] = vec4(q3.xyz*q3.w, 0.0); - q[3] = vec4(worldPos, 1.0); - - // transforms a normal to parameter space (inverse transpose of (q*modelview)^-T) - mat4 invClip = transpose(gl_ModelViewProjectionMatrix*q); - - // solve for the right hand bounds in homogenous clip space - float a1 = DotInvW(invClip[3], invClip[3]); - float b1 = -2.0f*DotInvW(invClip[0], invClip[3]); - float c1 = DotInvW(invClip[0], invClip[0]); - - float xmin; - float xmax; - solveQuadratic(a1, b1, c1, xmin, xmax); - - // solve for the right hand bounds in homogenous clip space - float a2 = DotInvW(invClip[3], invClip[3]); - float b2 = -2.0f*DotInvW(invClip[1], invClip[3]); - float c2 = DotInvW(invClip[1], invClip[1]); - - float ymin; - float ymax; - solveQuadratic(a2, b2, c2, ymin, ymax); - - gl_Position = vec4(worldPos.xyz, 1.0); - gl_TexCoord[0] = vec4(xmin, xmax, ymin, ymax); - - // construct inverse quadric matrix (used for ray-casting in parameter space) - mat4 invq; - invq[0] = vec4(q1.xyz / q1.w, 0.0); - invq[1] = vec4(q2.xyz / q2.w, 0.0); - invq[2] = vec4(q3.xyz / q3.w, 0.0); - invq[3] = vec4(0.0, 0.0, 0.0, 1.0); - - invq = transpose(invq); - invq[3] = -(invq*gl_Position); - - // transform a point from view space to parameter space - invq = invq*gl_ModelViewMatrixInverse; - - // pass down - gl_TexCoord[1] = invq[0]; - gl_TexCoord[2] = invq[1]; - gl_TexCoord[3] = invq[2]; - gl_TexCoord[4] = invq[3]; - - // compute ndc pos for frustrum culling in GS - vec4 ndcPos = gl_ModelViewProjectionMatrix * vec4(worldPos.xyz, 1.0); - gl_TexCoord[5] = ndcPos / ndcPos.w; - } - */ -} diff --git a/demo/d3d11/shaders/ellipsoidDepthVS.hlsl.h b/demo/d3d11/shaders/ellipsoidDepthVS.hlsl.h deleted file mode 100644 index d1dd741..0000000 --- a/demo/d3d11/shaders/ellipsoidDepthVS.hlsl.h +++ /dev/null @@ -1,940 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer constBuf -// { -// -// struct FluidShaderConst -// { -// -// float4x4 modelviewprojection; // Offset: 0 -// float4x4 modelview; // Offset: 64 -// float4x4 projection; // Offset: 128 -// float4x4 modelview_inverse; // Offset: 192 -// float4x4 projection_inverse; // Offset: 256 -// float4 invTexScale; // Offset: 320 -// float3 invViewport; // Offset: 336 -// float _pad0; // Offset: 348 -// float blurRadiusWorld; // Offset: 352 -// float blurScale; // Offset: 356 -// float blurFalloff; // Offset: 360 -// int debug; // Offset: 364 -// float3 lightPos; // Offset: 368 -// float _pad1; // Offset: 380 -// float3 lightDir; // Offset: 384 -// float _pad2; // Offset: 396 -// float4x4 lightTransform; // Offset: 400 -// float4 color; // Offset: 464 -// float4 clipPosToEye; // Offset: 480 -// float spotMin; // Offset: 496 -// float spotMax; // Offset: 500 -// float ior; // Offset: 504 -// float _pad3; // Offset: 508 -// float4 shadowTaps[12]; // Offset: 512 -// -// } gParams; // Offset: 0 Size: 704 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// constBuf cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xyzw 0 NONE float xyz -// U 0 xyzw 1 NONE float xyzw -// V 0 xyzw 2 NONE float xyzw -// W 0 xyzw 3 NONE float xyzw -// SV_VertexID 0 x 4 VERTID uint -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xyzw 0 NONE float xyzw -// TEXCOORD 0 xyzw 1 NONE float xyzw -// TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float xyzw -// TEXCOORD 3 xyzw 4 NONE float xyzw -// TEXCOORD 4 xyzw 5 NONE float xyzw -// TEXCOORD 5 xyzw 6 NONE float xyzw -// -vs_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[16], immediateIndexed -dcl_input v0.xyz -dcl_input v1.xyzw -dcl_input v2.xyzw -dcl_input v3.xyzw -dcl_output o0.xyzw -dcl_output o1.xyzw -dcl_output o2.xyzw -dcl_output o3.xyzw -dcl_output o4.xyzw -dcl_output o5.xyzw -dcl_output o6.xyzw -dcl_temps 4 -mov o0.xyz, v0.xyzx -mov o0.w, l(1.000000) -mul r0.xyz, v2.wwww, v2.xyzx -mul r1.xyzw, r0.yyyy, cb0[1].wxxy -mad r1.xyzw, cb0[0].wxxy, r0.xxxx, r1.xyzw -mad r0.xyzw, cb0[2].wxxy, r0.zzzz, r1.xyzw -mul r1.x, r0.w, r0.w -mul r0.xyzw, r0.xxzx, r0.xyzw -mul r1.yzw, v1.wwww, v1.xxyz -mul r2.xyzw, r1.zzzz, cb0[1].wxxy -mad r2.xyzw, cb0[0].wxxy, r1.yyyy, r2.xyzw -mad r2.xyzw, cb0[2].wxxy, r1.wwww, r2.xyzw -mad r1.x, r2.w, r2.w, r1.x -mad r0.xyzw, r2.xyzw, r2.xxzx, r0.xyzw -mul r1.yzw, v3.wwww, v3.xxyz -mul r2.xyzw, r1.zzzz, cb0[1].wxxy -mad r2.xyzw, cb0[0].wxxy, r1.yyyy, r2.xyzw -mad r2.xyzw, cb0[2].wxxy, r1.wwww, r2.xyzw -mad r1.x, r2.w, r2.w, r1.x -mad r0.xyzw, r2.xyzw, r2.xxzx, r0.xyzw -mul r2.xyzw, v0.yyyy, cb0[1].wxxy -mad r2.xyzw, cb0[0].wxxy, v0.xxxx, r2.xyzw -mad r2.xyzw, cb0[2].wxxy, v0.zzzz, r2.xyzw -add r2.xyzw, r2.xyzw, cb0[3].wxxy -mad r1.x, -r2.w, r2.w, r1.x -mad r0.xyzw, -r2.xyzw, r2.xxzx, r0.xyzw -mul r1.yzw, r0.yyxw, l(0.000000, -2.000000, 4.000000, -2.000000) -mul r2.xy, r1.ywyy, r1.ywyy -mad r2.y, -r1.z, r1.x, r2.y -mad r1.z, -r1.z, r0.z, r2.x -sqrt r2.x, r2.y -ge r2.y, r2.y, l(0.000000) -lt r2.zw, l(0.000000, 0.000000, -0.000000, -0.000000), r0.yyyw -movc r2.zw, r2.zzzw, l(0,0,-1.000000,-1.000000), l(0,0,1.000000,1.000000) -mad r1.w, r2.w, r2.x, r1.w -mul r1.w, r1.w, l(-0.500000) -div r3.w, r1.w, r0.x -div r3.z, r1.x, r1.w -lt r1.x, r3.z, r3.w -movc r1.xw, r1.xxxx, r3.zzzw, r3.wwwz -and r1.xw, r1.xxxw, r2.yyyy -eq r2.xyw, r0.xyxw, l(0.000000, -0.000000, 0.000000, -0.000000) -and r0.yw, r2.yyyw, r2.xxxx -movc o1.zw, r0.wwww, l(0,0,0,0), r1.xxxw -sqrt r0.w, r1.z -ge r1.x, r1.z, l(0.000000) -mad r0.w, r2.z, r0.w, r1.y -mul r0.w, r0.w, l(-0.500000) -div r2.xy, r0.zwzz, r0.wxww -lt r0.x, r2.x, r2.y -movc r0.xz, r0.xxxx, r2.xxyx, r2.yyxy -and r0.xz, r0.xxzx, r1.xxxx -movc o1.xy, r0.yyyy, l(0,0,0,0), r0.xzxx -mov o2.w, -cb0[12].w -div r0.xyz, v1.xyzx, v1.wwww -dp3 r0.w, r0.xyzx, v0.xyzx -mov r0.w, -r0.w -dp4 o2.x, r0.xyzw, cb0[12].xyzw -div r1.xyz, v2.xyzx, v2.wwww -dp3 r1.w, r1.xyzx, v0.xyzx -mov r1.w, -r1.w -dp4 o2.y, r1.xyzw, cb0[12].xyzw -div r2.xyz, v3.xyzx, v3.wwww -dp3 r2.w, r2.xyzx, v0.xyzx -mov r2.w, -r2.w -dp4 o2.z, r2.xyzw, cb0[12].xyzw -mov o3.w, -cb0[13].w -dp4 o3.x, r0.xyzw, cb0[13].xyzw -dp4 o3.y, r1.xyzw, cb0[13].xyzw -dp4 o3.z, r2.xyzw, cb0[13].xyzw -dp4 o4.x, r0.xyzw, cb0[14].xyzw -dp4 o5.x, r0.xyzw, cb0[15].xyzw -dp4 o4.y, r1.xyzw, cb0[14].xyzw -dp4 o5.y, r1.xyzw, cb0[15].xyzw -dp4 o4.z, r2.xyzw, cb0[14].xyzw -dp4 o5.z, r2.xyzw, cb0[15].xyzw -mov o4.w, -cb0[14].w -mov o5.w, -cb0[15].w -mul r0.xyzw, v0.yyyy, cb0[1].xyzw -mad r0.xyzw, cb0[0].xyzw, v0.xxxx, r0.xyzw -mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw -add r0.xyzw, r0.xyzw, cb0[3].xyzw -div o6.xyz, r0.xyzx, r0.wwww -mov o6.w, r0.w -ret -// Approximately 85 instruction slots used -#endif - -const BYTE g_ellipsoidDepthVS[] = -{ - 68, 88, 66, 67, 1, 86, - 214, 204, 57, 184, 18, 6, - 20, 42, 129, 16, 226, 241, - 71, 198, 1, 0, 0, 0, - 208, 17, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 116, 4, 0, 0, 24, 5, - 0, 0, 228, 5, 0, 0, - 52, 17, 0, 0, 82, 68, - 69, 70, 56, 4, 0, 0, - 1, 0, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 254, 255, 0, 1, 0, 0, - 4, 4, 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, 1, 0, - 0, 0, 99, 111, 110, 115, - 116, 66, 117, 102, 0, 171, - 171, 171, 92, 0, 0, 0, - 1, 0, 0, 0, 128, 0, - 0, 0, 192, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 168, 0, 0, 0, - 0, 0, 0, 0, 192, 2, - 0, 0, 2, 0, 0, 0, - 224, 3, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 103, 80, 97, 114, 97, 109, - 115, 0, 70, 108, 117, 105, - 100, 83, 104, 97, 100, 101, - 114, 67, 111, 110, 115, 116, - 0, 109, 111, 100, 101, 108, - 118, 105, 101, 119, 112, 114, - 111, 106, 101, 99, 116, 105, - 111, 110, 0, 102, 108, 111, - 97, 116, 52, 120, 52, 0, - 171, 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, 213, 0, - 0, 0, 109, 111, 100, 101, - 108, 118, 105, 101, 119, 0, - 112, 114, 111, 106, 101, 99, - 116, 105, 111, 110, 0, 109, - 111, 100, 101, 108, 118, 105, - 101, 119, 95, 105, 110, 118, - 101, 114, 115, 101, 0, 112, - 114, 111, 106, 101, 99, 116, - 105, 111, 110, 95, 105, 110, - 118, 101, 114, 115, 101, 0, - 105, 110, 118, 84, 101, 120, - 83, 99, 97, 108, 101, 0, - 102, 108, 111, 97, 116, 52, - 0, 171, 171, 171, 1, 0, - 3, 0, 1, 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, - 74, 1, 0, 0, 105, 110, - 118, 86, 105, 101, 119, 112, - 111, 114, 116, 0, 102, 108, - 111, 97, 116, 51, 0, 171, - 1, 0, 3, 0, 1, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 132, 1, 0, 0, - 95, 112, 97, 100, 48, 0, - 102, 108, 111, 97, 116, 0, - 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, 182, 1, 0, 0, - 98, 108, 117, 114, 82, 97, - 100, 105, 117, 115, 87, 111, - 114, 108, 100, 0, 98, 108, - 117, 114, 83, 99, 97, 108, - 101, 0, 98, 108, 117, 114, - 70, 97, 108, 108, 111, 102, - 102, 0, 100, 101, 98, 117, - 103, 0, 105, 110, 116, 0, - 0, 0, 2, 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, 12, 2, 0, 0, - 108, 105, 103, 104, 116, 80, - 111, 115, 0, 95, 112, 97, - 100, 49, 0, 108, 105, 103, - 104, 116, 68, 105, 114, 0, - 95, 112, 97, 100, 50, 0, - 108, 105, 103, 104, 116, 84, - 114, 97, 110, 115, 102, 111, - 114, 109, 0, 99, 111, 108, - 111, 114, 0, 99, 108, 105, - 112, 80, 111, 115, 84, 111, - 69, 121, 101, 0, 115, 112, - 111, 116, 77, 105, 110, 0, - 115, 112, 111, 116, 77, 97, - 120, 0, 105, 111, 114, 0, - 95, 112, 97, 100, 51, 0, - 115, 104, 97, 100, 111, 119, - 84, 97, 112, 115, 0, 171, - 171, 171, 1, 0, 3, 0, - 1, 0, 4, 0, 12, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 74, 1, - 0, 0, 193, 0, 0, 0, - 224, 0, 0, 0, 0, 0, - 0, 0, 4, 1, 0, 0, - 224, 0, 0, 0, 64, 0, - 0, 0, 14, 1, 0, 0, - 224, 0, 0, 0, 128, 0, - 0, 0, 25, 1, 0, 0, - 224, 0, 0, 0, 192, 0, - 0, 0, 43, 1, 0, 0, - 224, 0, 0, 0, 0, 1, - 0, 0, 62, 1, 0, 0, - 84, 1, 0, 0, 64, 1, - 0, 0, 120, 1, 0, 0, - 140, 1, 0, 0, 80, 1, - 0, 0, 176, 1, 0, 0, - 188, 1, 0, 0, 92, 1, - 0, 0, 224, 1, 0, 0, - 188, 1, 0, 0, 96, 1, - 0, 0, 240, 1, 0, 0, - 188, 1, 0, 0, 100, 1, - 0, 0, 250, 1, 0, 0, - 188, 1, 0, 0, 104, 1, - 0, 0, 6, 2, 0, 0, - 16, 2, 0, 0, 108, 1, - 0, 0, 52, 2, 0, 0, - 140, 1, 0, 0, 112, 1, - 0, 0, 61, 2, 0, 0, - 188, 1, 0, 0, 124, 1, - 0, 0, 67, 2, 0, 0, - 140, 1, 0, 0, 128, 1, - 0, 0, 76, 2, 0, 0, - 188, 1, 0, 0, 140, 1, - 0, 0, 82, 2, 0, 0, - 224, 0, 0, 0, 144, 1, - 0, 0, 97, 2, 0, 0, - 84, 1, 0, 0, 208, 1, - 0, 0, 103, 2, 0, 0, - 84, 1, 0, 0, 224, 1, - 0, 0, 116, 2, 0, 0, - 188, 1, 0, 0, 240, 1, - 0, 0, 124, 2, 0, 0, - 188, 1, 0, 0, 244, 1, - 0, 0, 132, 2, 0, 0, - 188, 1, 0, 0, 248, 1, - 0, 0, 136, 2, 0, 0, - 188, 1, 0, 0, 252, 1, - 0, 0, 142, 2, 0, 0, - 156, 2, 0, 0, 0, 2, - 0, 0, 5, 0, 0, 0, - 1, 0, 176, 0, 0, 0, - 24, 0, 192, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 176, 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, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, - 51, 56, 52, 0, 171, 171, - 73, 83, 71, 78, 156, 0, - 0, 0, 5, 0, 0, 0, - 8, 0, 0, 0, 128, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 7, 0, 0, 137, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 15, 15, 0, 0, 139, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, - 15, 15, 0, 0, 141, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, - 15, 15, 0, 0, 143, 0, - 0, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, - 1, 0, 0, 0, 80, 79, - 83, 73, 84, 73, 79, 78, - 0, 85, 0, 86, 0, 87, - 0, 83, 86, 95, 86, 101, - 114, 116, 101, 120, 73, 68, - 0, 171, 79, 83, 71, 78, - 196, 0, 0, 0, 7, 0, - 0, 0, 8, 0, 0, 0, - 176, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 185, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 15, 0, 0, 0, - 185, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, - 185, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 3, 0, - 0, 0, 15, 0, 0, 0, - 185, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 4, 0, - 0, 0, 15, 0, 0, 0, - 185, 0, 0, 0, 4, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 5, 0, - 0, 0, 15, 0, 0, 0, - 185, 0, 0, 0, 5, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 6, 0, - 0, 0, 15, 0, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 84, 69, 88, - 67, 79, 79, 82, 68, 0, - 171, 171, 83, 72, 69, 88, - 72, 11, 0, 0, 80, 0, - 1, 0, 210, 2, 0, 0, - 106, 8, 0, 1, 89, 0, - 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 16, 0, - 0, 0, 95, 0, 0, 3, - 114, 16, 16, 0, 0, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 1, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 2, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 3, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 0, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 1, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 2, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 3, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 4, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 5, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 6, 0, - 0, 0, 104, 0, 0, 2, - 4, 0, 0, 0, 54, 0, - 0, 5, 114, 32, 16, 0, - 0, 0, 0, 0, 70, 18, - 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, 56, 0, 0, 7, - 114, 0, 16, 0, 0, 0, - 0, 0, 246, 31, 16, 0, - 2, 0, 0, 0, 70, 18, - 16, 0, 2, 0, 0, 0, - 56, 0, 0, 8, 242, 0, - 16, 0, 1, 0, 0, 0, - 86, 5, 16, 0, 0, 0, - 0, 0, 54, 132, 32, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 1, 0, - 0, 0, 54, 132, 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, 0, 0, 0, 0, - 54, 132, 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, 56, 0, - 0, 7, 18, 0, 16, 0, - 1, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 242, 0, 16, 0, 0, 0, - 0, 0, 6, 2, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 7, 226, 0, - 16, 0, 1, 0, 0, 0, - 246, 31, 16, 0, 1, 0, - 0, 0, 6, 25, 16, 0, - 1, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 2, 0, 0, 0, 166, 10, - 16, 0, 1, 0, 0, 0, - 54, 132, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 2, 0, 0, 0, - 54, 132, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 86, 5, 16, 0, 1, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 2, 0, 0, 0, 54, 132, - 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 246, 15, - 16, 0, 1, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 50, 0, 0, 9, - 18, 0, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 2, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 50, 0, 0, 9, - 242, 0, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 6, 2, - 16, 0, 2, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 226, 0, 16, 0, 1, 0, - 0, 0, 246, 31, 16, 0, - 3, 0, 0, 0, 6, 25, - 16, 0, 3, 0, 0, 0, - 56, 0, 0, 8, 242, 0, - 16, 0, 2, 0, 0, 0, - 166, 10, 16, 0, 1, 0, - 0, 0, 54, 132, 32, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 2, 0, - 0, 0, 54, 132, 32, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 86, 5, 16, 0, - 1, 0, 0, 0, 70, 14, - 16, 0, 2, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 2, 0, 0, 0, - 54, 132, 32, 0, 0, 0, - 0, 0, 2, 0, 0, 0, - 246, 15, 16, 0, 1, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 50, 0, - 0, 9, 18, 0, 16, 0, - 1, 0, 0, 0, 58, 0, - 16, 0, 2, 0, 0, 0, - 58, 0, 16, 0, 2, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 50, 0, - 0, 9, 242, 0, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 2, 0, 0, 0, - 6, 2, 16, 0, 2, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 2, 0, 0, 0, 86, 21, - 16, 0, 0, 0, 0, 0, - 54, 132, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 2, 0, 0, 0, - 54, 132, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 6, 16, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 2, 0, 0, 0, 54, 132, - 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 166, 26, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 0, 0, 0, 8, - 242, 0, 16, 0, 2, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 54, 132, - 32, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 50, 0, - 0, 10, 18, 0, 16, 0, - 1, 0, 0, 0, 58, 0, - 16, 128, 65, 0, 0, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 2, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 128, - 65, 0, 0, 0, 2, 0, - 0, 0, 6, 2, 16, 0, - 2, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 56, 0, 0, 10, 226, 0, - 16, 0, 1, 0, 0, 0, - 86, 12, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 192, 0, 0, 128, 64, - 0, 0, 0, 192, 56, 0, - 0, 7, 50, 0, 16, 0, - 2, 0, 0, 0, 214, 5, - 16, 0, 1, 0, 0, 0, - 214, 5, 16, 0, 1, 0, - 0, 0, 50, 0, 0, 10, - 34, 0, 16, 0, 2, 0, - 0, 0, 42, 0, 16, 128, - 65, 0, 0, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 26, 0, - 16, 0, 2, 0, 0, 0, - 50, 0, 0, 10, 66, 0, - 16, 0, 1, 0, 0, 0, - 42, 0, 16, 128, 65, 0, - 0, 0, 1, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 2, 0, 0, 0, 75, 0, - 0, 5, 18, 0, 16, 0, - 2, 0, 0, 0, 26, 0, - 16, 0, 2, 0, 0, 0, - 29, 0, 0, 7, 34, 0, - 16, 0, 2, 0, 0, 0, - 26, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 49, 0, - 0, 10, 194, 0, 16, 0, - 2, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 128, 0, 0, 0, 128, - 86, 13, 16, 0, 0, 0, - 0, 0, 55, 0, 0, 15, - 194, 0, 16, 0, 2, 0, - 0, 0, 166, 14, 16, 0, - 2, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 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, 50, 0, 0, 9, - 130, 0, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, - 2, 0, 0, 0, 10, 0, - 16, 0, 2, 0, 0, 0, - 58, 0, 16, 0, 1, 0, - 0, 0, 56, 0, 0, 7, - 130, 0, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 191, - 14, 0, 0, 7, 130, 0, - 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 14, 0, - 0, 7, 66, 0, 16, 0, - 3, 0, 0, 0, 10, 0, - 16, 0, 1, 0, 0, 0, - 58, 0, 16, 0, 1, 0, - 0, 0, 49, 0, 0, 7, - 18, 0, 16, 0, 1, 0, - 0, 0, 42, 0, 16, 0, - 3, 0, 0, 0, 58, 0, - 16, 0, 3, 0, 0, 0, - 55, 0, 0, 9, 146, 0, - 16, 0, 1, 0, 0, 0, - 6, 0, 16, 0, 1, 0, - 0, 0, 166, 14, 16, 0, - 3, 0, 0, 0, 246, 11, - 16, 0, 3, 0, 0, 0, - 1, 0, 0, 7, 146, 0, - 16, 0, 1, 0, 0, 0, - 6, 12, 16, 0, 1, 0, - 0, 0, 86, 5, 16, 0, - 2, 0, 0, 0, 24, 0, - 0, 10, 178, 0, 16, 0, - 2, 0, 0, 0, 70, 12, - 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 128, - 0, 0, 0, 0, 0, 0, - 0, 128, 1, 0, 0, 7, - 162, 0, 16, 0, 0, 0, - 0, 0, 86, 13, 16, 0, - 2, 0, 0, 0, 6, 0, - 16, 0, 2, 0, 0, 0, - 55, 0, 0, 12, 194, 32, - 16, 0, 1, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 12, - 16, 0, 1, 0, 0, 0, - 75, 0, 0, 5, 130, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 29, 0, 0, 7, - 18, 0, 16, 0, 1, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 50, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 2, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 1, 0, 0, 0, - 56, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 191, 14, 0, - 0, 7, 50, 0, 16, 0, - 2, 0, 0, 0, 230, 10, - 16, 0, 0, 0, 0, 0, - 54, 15, 16, 0, 0, 0, - 0, 0, 49, 0, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 2, 0, 0, 0, 26, 0, - 16, 0, 2, 0, 0, 0, - 55, 0, 0, 9, 82, 0, - 16, 0, 0, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 6, 1, 16, 0, - 2, 0, 0, 0, 86, 4, - 16, 0, 2, 0, 0, 0, - 1, 0, 0, 7, 82, 0, - 16, 0, 0, 0, 0, 0, - 6, 2, 16, 0, 0, 0, - 0, 0, 6, 0, 16, 0, - 1, 0, 0, 0, 55, 0, - 0, 12, 50, 32, 16, 0, - 1, 0, 0, 0, 86, 5, - 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 134, 0, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 7, 130, 32, 16, 0, - 2, 0, 0, 0, 58, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 12, 0, - 0, 0, 14, 0, 0, 7, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 18, 16, 0, - 1, 0, 0, 0, 246, 31, - 16, 0, 1, 0, 0, 0, - 16, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 0, 0, - 0, 0, 70, 18, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 6, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 17, 0, - 0, 8, 18, 32, 16, 0, - 2, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 12, 0, 0, 0, - 14, 0, 0, 7, 114, 0, - 16, 0, 1, 0, 0, 0, - 70, 18, 16, 0, 2, 0, - 0, 0, 246, 31, 16, 0, - 2, 0, 0, 0, 16, 0, - 0, 7, 130, 0, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 1, 0, 0, 0, - 70, 18, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 6, - 130, 0, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 128, - 65, 0, 0, 0, 1, 0, - 0, 0, 17, 0, 0, 8, - 34, 32, 16, 0, 2, 0, - 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 14, 0, - 0, 7, 114, 0, 16, 0, - 2, 0, 0, 0, 70, 18, - 16, 0, 3, 0, 0, 0, - 246, 31, 16, 0, 3, 0, - 0, 0, 16, 0, 0, 7, - 130, 0, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 70, 18, - 16, 0, 0, 0, 0, 0, - 54, 0, 0, 6, 130, 0, - 16, 0, 2, 0, 0, 0, - 58, 0, 16, 128, 65, 0, - 0, 0, 2, 0, 0, 0, - 17, 0, 0, 8, 66, 32, - 16, 0, 2, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 12, 0, - 0, 0, 54, 0, 0, 7, - 130, 32, 16, 0, 3, 0, - 0, 0, 58, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 13, 0, 0, 0, - 17, 0, 0, 8, 18, 32, - 16, 0, 3, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 13, 0, - 0, 0, 17, 0, 0, 8, - 34, 32, 16, 0, 3, 0, - 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 13, 0, 0, 0, 17, 0, - 0, 8, 66, 32, 16, 0, - 3, 0, 0, 0, 70, 14, - 16, 0, 2, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 13, 0, 0, 0, - 17, 0, 0, 8, 18, 32, - 16, 0, 4, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 14, 0, - 0, 0, 17, 0, 0, 8, - 18, 32, 16, 0, 5, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 17, 0, - 0, 8, 34, 32, 16, 0, - 4, 0, 0, 0, 70, 14, - 16, 0, 1, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 14, 0, 0, 0, - 17, 0, 0, 8, 34, 32, - 16, 0, 5, 0, 0, 0, - 70, 14, 16, 0, 1, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 17, 0, 0, 8, - 66, 32, 16, 0, 4, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 14, 0, 0, 0, 17, 0, - 0, 8, 66, 32, 16, 0, - 5, 0, 0, 0, 70, 14, - 16, 0, 2, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 54, 0, 0, 7, 130, 32, - 16, 0, 4, 0, 0, 0, - 58, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 14, 0, 0, 0, 54, 0, - 0, 7, 130, 32, 16, 0, - 5, 0, 0, 0, 58, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 56, 0, 0, 8, - 242, 0, 16, 0, 0, 0, - 0, 0, 86, 21, 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, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 16, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 166, 26, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 8, 242, 0, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 14, 0, 0, 7, - 114, 32, 16, 0, 6, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 246, 15, - 16, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 130, 32, - 16, 0, 6, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 148, 0, - 0, 0, 85, 0, 0, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 11, 0, 0, 0, - 70, 0, 0, 0, 0, 0, - 0, 0, 3, 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, - 6, 0, 0, 0, 5, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 -}; diff --git a/demo/d3d11/shaders/imguiPS.hlsl b/demo/d3d11/shaders/imguiPS.hlsl deleted file mode 100644 index f51a21b..0000000 --- a/demo/d3d11/shaders/imguiPS.hlsl +++ /dev/null @@ -1,22 +0,0 @@ - -struct Input -{ - float4 position : SV_POSITION; - float2 texCoord : TEXCOORD; - float4 color : COLOR; -}; - -Texture2D<float> tex : register(t0); -SamplerState texSampler : register(s0); - -float4 imguiPS(Input input) : SV_TARGET -{ - float4 color = input.color; - - if (input.texCoord.x >= 0.f) - { - color.a *= tex.SampleLevel(texSampler, input.texCoord, 0.f); - } - - return color; -}
\ No newline at end of file diff --git a/demo/d3d11/shaders/imguiPS.hlsl.h b/demo/d3d11/shaders/imguiPS.hlsl.h deleted file mode 100644 index 92aa84a..0000000 --- a/demo/d3d11/shaders/imguiPS.hlsl.h +++ /dev/null @@ -1,197 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// texSampler sampler NA NA 0 1 -// tex texture float 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 -// COLOR 0 xyzw 2 NONE float xyzw -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// -ps_5_0 -dcl_globalFlags refactoringAllowed -dcl_sampler s0, mode_default -dcl_resource_texture2d (float,float,float,float) t0 -dcl_input_ps linear v1.xy -dcl_input_ps linear v2.xyzw -dcl_output o0.xyzw -dcl_temps 1 -ge r0.x, v1.x, l(0.000000) -if_nz r0.x - sample_l_indexable(texture2d)(float,float,float,float) r0.x, v1.xyxx, t0.xyzw, s0, l(0.000000) - mul r0.x, r0.x, v2.w -else - mov r0.x, v2.w -endif -mov r0.yzw, v2.xxyz -mov o0.xyzw, r0.yzwx -ret -// Approximately 10 instruction slots used -#endif - -const BYTE g_imguiPS[] = -{ - 68, 88, 66, 67, 214, 230, - 179, 60, 250, 108, 227, 78, - 125, 188, 145, 68, 25, 248, - 141, 62, 1, 0, 0, 0, - 92, 3, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 252, 0, 0, 0, 112, 1, - 0, 0, 164, 1, 0, 0, - 192, 2, 0, 0, 82, 68, - 69, 70, 192, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 255, 255, 0, 1, 0, 0, - 139, 0, 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, - 124, 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, 1, 0, - 0, 0, 135, 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, - 1, 0, 0, 0, 116, 101, - 120, 83, 97, 109, 112, 108, - 101, 114, 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, - 54, 46, 51, 46, 57, 54, - 48, 48, 46, 49, 54, 51, - 56, 52, 0, 171, 171, 171, - 73, 83, 71, 78, 108, 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, 67, 79, 76, 79, 82, - 0, 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, 69, 88, 20, 1, - 0, 0, 80, 0, 0, 0, - 69, 0, 0, 0, 106, 8, - 0, 1, 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, - 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, 1, 0, - 0, 0, 29, 0, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 10, 16, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 31, 0, 4, 3, 10, 0, - 16, 0, 0, 0, 0, 0, - 72, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 18, 0, 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, 1, 64, 0, 0, - 0, 0, 0, 0, 56, 0, - 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 58, 16, 16, 0, 2, 0, - 0, 0, 18, 0, 0, 1, - 54, 0, 0, 5, 18, 0, - 16, 0, 0, 0, 0, 0, - 58, 16, 16, 0, 2, 0, - 0, 0, 21, 0, 0, 1, - 54, 0, 0, 5, 226, 0, - 16, 0, 0, 0, 0, 0, - 6, 25, 16, 0, 2, 0, - 0, 0, 54, 0, 0, 5, - 242, 32, 16, 0, 0, 0, - 0, 0, 150, 3, 16, 0, - 0, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, - 148, 0, 0, 0, 10, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 2, 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, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0 -}; diff --git a/demo/d3d11/shaders/imguiVS.hlsl b/demo/d3d11/shaders/imguiVS.hlsl deleted file mode 100644 index 6116ee1..0000000 --- a/demo/d3d11/shaders/imguiVS.hlsl +++ /dev/null @@ -1,31 +0,0 @@ - -cbuffer params : register(b0) -{ - float4x4 transform; -}; - -struct Input -{ - float2 position : POSITION; - float2 texCoord : TEXCOORD; - float4 color : COLOR; -}; - -struct Output -{ - float4 position : SV_POSITION; - float2 texCoord : TEXCOORD; - float4 color : COLOR; -}; - -Output imguiVS(Input input, uint instance : SV_InstanceID) -{ - Output output; - - output.position = mul(float4(input.position, 0.f, 1.f), transform); - - output.texCoord = input.texCoord.xy; // float2(input.texCoord.x, 1.f - input.texCoord.y); - output.color = input.color; - - return output; -}
\ No newline at end of file diff --git a/demo/d3d11/shaders/imguiVS.hlsl.h b/demo/d3d11/shaders/imguiVS.hlsl.h deleted file mode 100644 index 7249cec..0000000 --- a/demo/d3d11/shaders/imguiVS.hlsl.h +++ /dev/null @@ -1,248 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer params -// { -// -// float4x4 transform; // Offset: 0 Size: 64 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// params cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xy 0 NONE float xy -// TEXCOORD 0 xy 1 NONE float xy -// COLOR 0 xyzw 2 NONE float xyzw -// SV_InstanceID 0 x 3 INSTID uint -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_POSITION 0 xyzw 0 POS float xyzw -// TEXCOORD 0 xy 1 NONE float xy -// COLOR 0 xyzw 2 NONE float xyzw -// -vs_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[4], immediateIndexed -dcl_input v0.xy -dcl_input v1.xy -dcl_input v2.xyzw -dcl_output_siv o0.xyzw, position -dcl_output o1.xy -dcl_output o2.xyzw -dcl_temps 1 -mov r0.xy, v0.xyxx -mov r0.z, l(1.000000) -dp3 o0.x, r0.xyzx, cb0[0].xywx -dp3 o0.y, r0.xyzx, cb0[1].xywx -dp3 o0.z, r0.xyzx, cb0[2].xywx -dp3 o0.w, r0.xyzx, cb0[3].xywx -mov o1.xy, v1.xyxx -mov o2.xyzw, v2.xyzw -ret -// Approximately 9 instruction slots used -#endif - -const BYTE g_imguiVS[] = -{ - 68, 88, 66, 67, 11, 92, - 70, 30, 32, 80, 66, 187, - 246, 56, 106, 189, 128, 201, - 215, 197, 1, 0, 0, 0, - 64, 4, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 76, 1, 0, 0, 228, 1, - 0, 0, 88, 2, 0, 0, - 164, 3, 0, 0, 82, 68, - 69, 70, 16, 1, 0, 0, - 1, 0, 0, 0, 100, 0, - 0, 0, 1, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 254, 255, 0, 1, 0, 0, - 220, 0, 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, 1, 0, - 0, 0, 112, 97, 114, 97, - 109, 115, 0, 171, 92, 0, - 0, 0, 1, 0, 0, 0, - 124, 0, 0, 0, 64, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 164, 0, - 0, 0, 0, 0, 0, 0, - 64, 0, 0, 0, 2, 0, - 0, 0, 184, 0, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 116, 114, 97, 110, - 115, 102, 111, 114, 109, 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, - 174, 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, 54, 46, 51, - 46, 57, 54, 48, 48, 46, - 49, 54, 51, 56, 52, 0, - 171, 171, 73, 83, 71, 78, - 144, 0, 0, 0, 4, 0, - 0, 0, 8, 0, 0, 0, - 104, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 3, 3, 0, 0, - 113, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 3, 3, 0, 0, - 122, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 2, 0, - 0, 0, 15, 15, 0, 0, - 128, 0, 0, 0, 0, 0, - 0, 0, 8, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 84, 69, 88, - 67, 79, 79, 82, 68, 0, - 67, 79, 76, 79, 82, 0, - 83, 86, 95, 73, 110, 115, - 116, 97, 110, 99, 101, 73, - 68, 0, 171, 171, 79, 83, - 71, 78, 108, 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, 67, - 79, 76, 79, 82, 0, 171, - 83, 72, 69, 88, 68, 1, - 0, 0, 80, 0, 1, 0, - 81, 0, 0, 0, 106, 8, - 0, 1, 89, 0, 0, 4, - 70, 142, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 95, 0, 0, 3, 50, 16, - 16, 0, 0, 0, 0, 0, - 95, 0, 0, 3, 50, 16, - 16, 0, 1, 0, 0, 0, - 95, 0, 0, 3, 242, 16, - 16, 0, 2, 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, 104, 0, - 0, 2, 1, 0, 0, 0, - 54, 0, 0, 5, 50, 0, - 16, 0, 0, 0, 0, 0, - 70, 16, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, - 66, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 16, 0, - 0, 8, 18, 32, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, - 70, 131, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 16, 0, 0, 8, 34, 32, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 0, 0, - 0, 0, 70, 131, 32, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 16, 0, 0, 8, - 66, 32, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 70, 131, - 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 16, 0, - 0, 8, 130, 32, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, - 70, 131, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 54, 0, 0, 5, 50, 32, - 16, 0, 1, 0, 0, 0, - 70, 16, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 5, - 242, 32, 16, 0, 2, 0, - 0, 0, 70, 30, 16, 0, - 2, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, - 148, 0, 0, 0, 9, 0, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 6, 0, - 0, 0, 4, 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, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0 -}; diff --git a/demo/d3d11/shaders/meshPS.hlsl b/demo/d3d11/shaders/meshPS.hlsl deleted file mode 100644 index db28d60..0000000 --- a/demo/d3d11/shaders/meshPS.hlsl +++ /dev/null @@ -1,130 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - MeshShaderConst gParams; -}; - -Texture2D<float> shadowTexture : register(t0); // shadow map - -SamplerComparisonState shadowSampler : register(s0); // texture sample used to sample depth from shadow texture in this sample - -// sample shadow map -float shadowSample(float4 gl_TexCoord[8]) -{ - float3 pos = float3(gl_TexCoord[1].xyz / gl_TexCoord[1].w); - float3 uvw = (pos.xyz * float3(0.5, 0.5, 1.0)) + float3(0.5, 0.5, 0.0); - - // user clip - if (uvw.x < 0.0 || uvw.x > 1.0) - return 1.0; - if (uvw.y < 0.0 || uvw.y > 1.0) - return 1.0; - - float s = 0.0; - float radius = 0.002; - - const int numTaps = 12; - - // flip uv y-coordinate - uvw.y = 1.0f - uvw.y; - - [unroll] - for (int i = 0; i < numTaps; i++) - { - float2 shadowTaps = gParams.shadowTaps[i].xy; - shadowTaps.y = 1.0f - shadowTaps.y; - s += shadowTexture.SampleCmpLevelZero(shadowSampler, uvw.xy + shadowTaps * radius, uvw.z); - } - s /= numTaps; - - return s; -} - -float filterwidth(float2 v) -{ - float2 fw = max(abs(ddx(v)), abs(ddy(v))); - return max(fw.x, fw.y); -} - -float2 bump(float2 x) -{ - return (floor((x) / 2) + 2.f * max(((x) / 2) - floor((x) / 2) - .5f, 0.f)); -} - -float checker(float2 uv) -{ - float width = filterwidth(uv); - float2 p0 = uv - 0.5 * width; - float2 p1 = uv + 0.5 * width; - - float2 i = (bump(p1) - bump(p0)) / width; - return i.x * i.y + (1 - i.x) * (1 - i.y); -} - -float4 meshPS(MeshVertexOut input, bool isFrontFace : SV_IsFrontFace) : SV_TARGET -{ - float4 gl_FragColor; - float4 gl_TexCoord[8]; - - [unroll] - for (int i = 0; i < 8; i++) - gl_TexCoord[i] = input.texCoord[i]; - - const float4 fogColor = gParams.fogColor; - const float3 lightDir = gParams.lightDir; - const float3 lightPos = gParams.lightPos; - const float spotMin = gParams.spotMin; - const float spotMax = gParams.spotMax; - const int grid = gParams.grid; - const int tex = gParams.tex; - - // calculate lighting - float shadow = max(shadowSample(gl_TexCoord), 0.5); - - float3 lVec = normalize(gl_TexCoord[3].xyz - (lightPos)); - float3 lPos = float3(gl_TexCoord[1].xyz / gl_TexCoord[1].w); - float attenuation = max(smoothstep(spotMax, spotMin, dot(lPos.xy, lPos.xy)), 0.05); - - float3 n = gl_TexCoord[0].xyz; - float3 color = gl_TexCoord[4].xyz; - - if (!isFrontFace) - { - color = gl_TexCoord[6].xyz; - n *= -1.0f; - } - - if (grid && (n.y > 0.995)) - { - color *= 1.0 - 0.25 * checker(float2(gl_TexCoord[3].x, gl_TexCoord[3].z)); - } - else if (grid && abs(n.z) > 0.995) - { - color *= 1.0 - 0.25 * checker(float2(gl_TexCoord[3].y, gl_TexCoord[3].x)); - } - - if (tex) - { - //color = texture2D(tex, gl_TexCoord[5].xy).xyz; - } - - // direct light term - float wrap = 0.0; - float3 diffuse = color * float3(1.0, 1.0, 1.0) * max(0.0, (-dot(lightDir, n) + wrap) / (1.0 + wrap) * shadow) * attenuation; - - // wrap ambient term aligned with light dir - float3 light = float3(0.03, 0.025, 0.025) * 1.5; - float3 dark = float3(0.025, 0.025, 0.03); - //float3 ambient = 4.0 * color * lerp(dark, light, -dot(lightDir, n) * 0.5 + 0.5) * attenuation; - float3 ambient = 4.0 * color * lerp(dark, light, -dot(lightDir, n) * float3(0.5, 0.5, 1.0) + float3(0.5, 0.5, 0.0)) * attenuation; - - float3 fog = lerp(fogColor.xyz, diffuse + ambient, exp(gl_TexCoord[7].z * fogColor.w)); - - //gl_FragColor = float4(pow(fog, float3(1.0 / 2.2)), 1.0); - const float tmp = 1.0 / 2.2; - gl_FragColor = float4(pow(abs(fog), float3(tmp, tmp, tmp)), 1.0); - - return gl_FragColor; - -} diff --git a/demo/d3d11/shaders/meshPS.hlsl.h b/demo/d3d11/shaders/meshPS.hlsl.h deleted file mode 100644 index 9bbb118..0000000 --- a/demo/d3d11/shaders/meshPS.hlsl.h +++ /dev/null @@ -1,1553 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer constBuf -// { -// -// struct MeshShaderConst -// { -// -// float4x4 modelviewprojection; // Offset: 0 -// float4x4 modelview; // Offset: 64 -// float4x4 objectTransform; // Offset: 128 -// float4x4 lightTransform; // Offset: 192 -// float4 clipPlane; // Offset: 256 -// float4 fogColor; // Offset: 272 -// float4 color; // Offset: 288 -// float4 secondaryColor; // Offset: 304 -// float4 shadowTaps[12]; // Offset: 320 -// float3 lightPos; // Offset: 512 -// float _pad0; // Offset: 524 -// float3 lightDir; // Offset: 528 -// float _pad1; // Offset: 540 -// float bias; // Offset: 544 -// float expand; // Offset: 548 -// float spotMin; // Offset: 552 -// float spotMax; // Offset: 556 -// int grid; // Offset: 560 -// int tex; // Offset: 564 -// int colorArray; // Offset: 568 -// int _pad2; // Offset: 572 -// -// } gParams; // Offset: 0 Size: 576 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// shadowSampler sampler_c NA NA 0 1 -// shadowTexture texture float 2d 0 1 -// constBuf cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_POSITION 0 xyzw 0 POS float -// TEXCOORD 0 xyzw 1 NONE float xyz -// TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float -// TEXCOORD 3 xyzw 4 NONE float xyz -// TEXCOORD 4 xyzw 5 NONE float xyz -// TEXCOORD 5 xyzw 6 NONE float -// TEXCOORD 6 xyzw 7 NONE float xyz -// TEXCOORD 7 xyzw 8 NONE float z -// SV_IsFrontFace 0 x 9 FFACE uint x -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// -ps_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[36], immediateIndexed -dcl_sampler s0, mode_comparison -dcl_resource_texture2d (float,float,float,float) t0 -dcl_input_ps linear v1.xyz -dcl_input_ps linear v2.xyzw -dcl_input_ps linear v4.xyz -dcl_input_ps linear v5.xyz -dcl_input_ps linear v7.xyz -dcl_input_ps linear v8.z -dcl_input_ps_sgv v9.x, is_front_face -dcl_output o0.xyzw -dcl_temps 6 -div r0.xyz, v2.xyzx, v2.wwww -mad r1.xyz, r0.xyzx, l(0.500000, 0.500000, 1.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000) -lt r0.z, r1.x, l(0.000000) -lt r0.w, l(1.000000), r1.x -or r0.z, r0.w, r0.z -if_z r0.z - lt r0.z, r1.y, l(0.000000) - lt r0.w, l(1.000000), r1.y - or r0.z, r0.w, r0.z - if_z r0.z - add r0.z, -cb0[20].y, l(1.000000) - mul r2.x, cb0[20].x, l(0.002000) - mul r2.y, r0.z, l(0.002000) - add r1.w, -r1.y, l(1.000000) - add r0.zw, r1.xxxw, r2.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.z, r0.zwzz, t0.xxxx, s0, r1.z - add r0.w, -cb0[21].y, l(1.000000) - mul r2.x, cb0[21].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[22].y, l(1.000000) - mul r2.x, cb0[22].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[23].y, l(1.000000) - mul r2.x, cb0[23].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[24].y, l(1.000000) - mul r2.x, cb0[24].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[25].y, l(1.000000) - mul r2.x, cb0[25].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[26].y, l(1.000000) - mul r2.x, cb0[26].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[27].y, l(1.000000) - mul r2.x, cb0[27].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[28].y, l(1.000000) - mul r2.x, cb0[28].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[29].y, l(1.000000) - mul r2.x, cb0[29].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[30].y, l(1.000000) - mul r2.x, cb0[30].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r2.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r2.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - add r0.w, -cb0[31].y, l(1.000000) - mul r2.x, cb0[31].x, l(0.002000) - mul r2.y, r0.w, l(0.002000) - add r1.xy, r1.xwxx, r2.xyxx - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r1.xyxx, t0.xxxx, s0, r1.z - add r0.z, r0.w, r0.z - mul r0.z, r0.z, l(0.083333) - else - mov r0.z, l(1.000000) - endif -else - mov r0.z, l(1.000000) -endif -dp2 r0.x, r0.xyxx, r0.xyxx -add r0.y, -cb0[34].w, cb0[34].z -add r0.x, r0.x, -cb0[34].w -div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y -mul_sat r0.x, r0.y, r0.x -mad r0.y, r0.x, l(-2.000000), l(3.000000) -mul r0.x, r0.x, r0.x -mul r0.x, r0.x, r0.y -max r0.xz, r0.xxzx, l(0.050000, 0.000000, 0.500000, 0.000000) -movc r1.xyz, v9.xxxx, v1.xyzx, -v1.xyzx -movc r2.xyz, v9.xxxx, v5.xyzx, v7.xyzx -ine r0.y, cb0[35].x, l(0) -lt r0.w, l(0.995000), r1.y -and r0.w, r0.w, r0.y -if_nz r0.w - deriv_rtx_coarse r3.xy, v4.xzxx - deriv_rty_coarse r3.zw, v4.xxxz - max r3.xy, |r3.zwzz|, |r3.xyxx| - max r0.w, r3.y, r3.x - mad r3.xy, -r0.wwww, l(0.500000, 0.500000, 0.000000, 0.000000), v4.xzxx - mad r3.zw, r0.wwww, l(0.000000, 0.000000, 0.500000, 0.500000), v4.xxxz - mul r4.xy, r3.zwzz, l(0.500000, 0.500000, 0.000000, 0.000000) - round_ni r4.xy, r4.xyxx - mad r3.zw, r3.zzzw, l(0.000000, 0.000000, 0.500000, 0.500000), -r4.xxxy - add r3.zw, r3.zzzw, l(0.000000, 0.000000, -0.500000, -0.500000) - max r3.zw, r3.zzzw, l(0.000000, 0.000000, 0.000000, 0.000000) - mad r3.zw, r3.zzzw, l(0.000000, 0.000000, 2.000000, 2.000000), r4.xxxy - mul r4.xy, r3.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000) - round_ni r4.xy, r4.xyxx - mad r3.xy, r3.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), -r4.xyxx - add r3.xy, r3.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000) - max r3.xy, r3.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000) - mad r3.xy, r3.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), r4.xyxx - add r3.xy, -r3.xyxx, r3.zwzz - div r3.xy, r3.xyxx, r0.wwww - add r3.zw, -r3.xxxy, l(0.000000, 0.000000, 1.000000, 1.000000) - mul r0.w, r3.w, r3.z - mad r0.w, r3.x, r3.y, r0.w - mad r0.w, -r0.w, l(0.250000), l(1.000000) - mul r3.xyz, r0.wwww, r2.xyzx -else - lt r0.w, l(0.995000), |r1.z| - and r0.y, r0.w, r0.y - deriv_rtx_coarse r4.xy, v4.yxyy - deriv_rty_coarse r4.zw, v4.yyyx - max r4.xy, |r4.zwzz|, |r4.xyxx| - max r0.w, r4.y, r4.x - mad r4.xy, -r0.wwww, l(0.500000, 0.500000, 0.000000, 0.000000), v4.yxyy - mad r4.zw, r0.wwww, l(0.000000, 0.000000, 0.500000, 0.500000), v4.yyyx - mul r5.xy, r4.zwzz, l(0.500000, 0.500000, 0.000000, 0.000000) - round_ni r5.xy, r5.xyxx - mad r4.zw, r4.zzzw, l(0.000000, 0.000000, 0.500000, 0.500000), -r5.xxxy - add r4.zw, r4.zzzw, l(0.000000, 0.000000, -0.500000, -0.500000) - max r4.zw, r4.zzzw, l(0.000000, 0.000000, 0.000000, 0.000000) - mad r4.zw, r4.zzzw, l(0.000000, 0.000000, 2.000000, 2.000000), r5.xxxy - mul r5.xy, r4.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000) - round_ni r5.xy, r5.xyxx - mad r4.xy, r4.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), -r5.xyxx - add r4.xy, r4.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000) - max r4.xy, r4.xyxx, l(0.000000, 0.000000, 0.000000, 0.000000) - mad r4.xy, r4.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), r5.xyxx - add r4.xy, -r4.xyxx, r4.zwzz - div r4.xy, r4.xyxx, r0.wwww - add r4.zw, -r4.xxxy, l(0.000000, 0.000000, 1.000000, 1.000000) - mul r0.w, r4.w, r4.z - mad r0.w, r4.x, r4.y, r0.w - mad r0.w, -r0.w, l(0.250000), l(1.000000) - mul r4.xyz, r0.wwww, r2.xyzx - movc r3.xyz, r0.yyyy, r4.xyzx, r2.xyzx -endif -dp3 r0.y, cb0[33].xyzx, r1.xyzx -mul r0.z, r0.z, -r0.y -max r0.z, r0.z, l(0.000000) -mul r1.xyz, r0.zzzz, r3.xyzx -mul r2.xyz, r3.xyzx, l(4.000000, 4.000000, 4.000000, 0.000000) -mad r0.yzw, r0.yyyy, l(0.000000, -0.500000, -0.500000, -1.000000), l(0.000000, 0.500000, 0.500000, 0.000000) -mad r0.yzw, r0.yyzw, l(0.000000, 0.020000, 0.012500, 0.007500), l(0.000000, 0.025000, 0.025000, 0.030000) -mul r0.yzw, r0.yyzw, r2.xxyz -mul r0.yzw, r0.xxxx, r0.yyzw -mad r0.xyz, r1.xyzx, r0.xxxx, r0.yzwy -mul r0.w, v8.z, cb0[17].w -mul r0.w, r0.w, l(1.442695) -exp r0.w, r0.w -add r0.xyz, r0.xyzx, -cb0[17].xyzx -mad r0.xyz, r0.wwww, r0.xyzx, cb0[17].xyzx -log r0.xyz, |r0.xyzx| -mul r0.xyz, r0.xyzx, l(0.454545, 0.454545, 0.454545, 0.000000) -exp o0.xyz, r0.xyzx -mov o0.w, l(1.000000) -ret -// Approximately 179 instruction slots used -#endif - -const BYTE g_meshPS[] = -{ - 68, 88, 66, 67, 162, 143, - 63, 83, 112, 221, 166, 253, - 12, 109, 97, 84, 15, 129, - 226, 222, 1, 0, 0, 0, - 8, 30, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 116, 4, 0, 0, 152, 5, - 0, 0, 204, 5, 0, 0, - 108, 29, 0, 0, 82, 68, - 69, 70, 56, 4, 0, 0, - 1, 0, 0, 0, 196, 0, - 0, 0, 3, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 255, 255, 0, 1, 0, 0, - 4, 4, 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, - 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, 3, 0, - 0, 0, 170, 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, - 1, 0, 0, 0, 184, 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, 1, 0, 0, 0, - 115, 104, 97, 100, 111, 119, - 83, 97, 109, 112, 108, 101, - 114, 0, 115, 104, 97, 100, - 111, 119, 84, 101, 120, 116, - 117, 114, 101, 0, 99, 111, - 110, 115, 116, 66, 117, 102, - 0, 171, 171, 171, 184, 0, - 0, 0, 1, 0, 0, 0, - 220, 0, 0, 0, 64, 2, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 1, - 0, 0, 0, 0, 0, 0, - 64, 2, 0, 0, 2, 0, - 0, 0, 224, 3, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 103, 80, 97, 114, - 97, 109, 115, 0, 77, 101, - 115, 104, 83, 104, 97, 100, - 101, 114, 67, 111, 110, 115, - 116, 0, 109, 111, 100, 101, - 108, 118, 105, 101, 119, 112, - 114, 111, 106, 101, 99, 116, - 105, 111, 110, 0, 102, 108, - 111, 97, 116, 52, 120, 52, - 0, 171, 171, 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, - 48, 1, 0, 0, 109, 111, - 100, 101, 108, 118, 105, 101, - 119, 0, 111, 98, 106, 101, - 99, 116, 84, 114, 97, 110, - 115, 102, 111, 114, 109, 0, - 108, 105, 103, 104, 116, 84, - 114, 97, 110, 115, 102, 111, - 114, 109, 0, 99, 108, 105, - 112, 80, 108, 97, 110, 101, - 0, 102, 108, 111, 97, 116, - 52, 0, 171, 171, 1, 0, - 3, 0, 1, 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, - 147, 1, 0, 0, 102, 111, - 103, 67, 111, 108, 111, 114, - 0, 99, 111, 108, 111, 114, - 0, 115, 101, 99, 111, 110, - 100, 97, 114, 121, 67, 111, - 108, 111, 114, 0, 115, 104, - 97, 100, 111, 119, 84, 97, - 112, 115, 0, 171, 171, 171, - 1, 0, 3, 0, 1, 0, - 4, 0, 12, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 147, 1, 0, 0, - 108, 105, 103, 104, 116, 80, - 111, 115, 0, 102, 108, 111, - 97, 116, 51, 0, 1, 0, - 3, 0, 1, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 25, 2, 0, 0, 95, 112, - 97, 100, 48, 0, 102, 108, - 111, 97, 116, 0, 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, - 74, 2, 0, 0, 108, 105, - 103, 104, 116, 68, 105, 114, - 0, 95, 112, 97, 100, 49, - 0, 98, 105, 97, 115, 0, - 101, 120, 112, 97, 110, 100, - 0, 115, 112, 111, 116, 77, - 105, 110, 0, 115, 112, 111, - 116, 77, 97, 120, 0, 103, - 114, 105, 100, 0, 105, 110, - 116, 0, 0, 0, 2, 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, 164, 2, - 0, 0, 116, 101, 120, 0, - 99, 111, 108, 111, 114, 65, - 114, 114, 97, 121, 0, 95, - 112, 97, 100, 50, 0, 171, - 171, 171, 28, 1, 0, 0, - 60, 1, 0, 0, 0, 0, - 0, 0, 96, 1, 0, 0, - 60, 1, 0, 0, 64, 0, - 0, 0, 106, 1, 0, 0, - 60, 1, 0, 0, 128, 0, - 0, 0, 122, 1, 0, 0, - 60, 1, 0, 0, 192, 0, - 0, 0, 137, 1, 0, 0, - 156, 1, 0, 0, 0, 1, - 0, 0, 192, 1, 0, 0, - 156, 1, 0, 0, 16, 1, - 0, 0, 201, 1, 0, 0, - 156, 1, 0, 0, 32, 1, - 0, 0, 207, 1, 0, 0, - 156, 1, 0, 0, 48, 1, - 0, 0, 222, 1, 0, 0, - 236, 1, 0, 0, 64, 1, - 0, 0, 16, 2, 0, 0, - 32, 2, 0, 0, 0, 2, - 0, 0, 68, 2, 0, 0, - 80, 2, 0, 0, 12, 2, - 0, 0, 116, 2, 0, 0, - 32, 2, 0, 0, 16, 2, - 0, 0, 125, 2, 0, 0, - 80, 2, 0, 0, 28, 2, - 0, 0, 131, 2, 0, 0, - 80, 2, 0, 0, 32, 2, - 0, 0, 136, 2, 0, 0, - 80, 2, 0, 0, 36, 2, - 0, 0, 143, 2, 0, 0, - 80, 2, 0, 0, 40, 2, - 0, 0, 151, 2, 0, 0, - 80, 2, 0, 0, 44, 2, - 0, 0, 159, 2, 0, 0, - 168, 2, 0, 0, 48, 2, - 0, 0, 204, 2, 0, 0, - 168, 2, 0, 0, 52, 2, - 0, 0, 208, 2, 0, 0, - 168, 2, 0, 0, 56, 2, - 0, 0, 219, 2, 0, 0, - 168, 2, 0, 0, 60, 2, - 0, 0, 5, 0, 0, 0, - 1, 0, 144, 0, 0, 0, - 21, 0, 228, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 12, 1, - 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, 54, 46, 51, 46, 57, - 54, 48, 48, 46, 49, 54, - 51, 56, 52, 0, 171, 171, - 73, 83, 71, 78, 28, 1, - 0, 0, 10, 0, 0, 0, - 8, 0, 0, 0, 248, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 4, 1, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 15, 7, 0, 0, 4, 1, - 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, - 15, 15, 0, 0, 4, 1, - 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, - 15, 0, 0, 0, 4, 1, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 4, 0, 0, 0, - 15, 7, 0, 0, 4, 1, - 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 5, 0, 0, 0, - 15, 7, 0, 0, 4, 1, - 0, 0, 5, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 6, 0, 0, 0, - 15, 0, 0, 0, 4, 1, - 0, 0, 6, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 7, 0, 0, 0, - 15, 7, 0, 0, 4, 1, - 0, 0, 7, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 8, 0, 0, 0, - 15, 4, 0, 0, 13, 1, - 0, 0, 0, 0, 0, 0, - 9, 0, 0, 0, 1, 0, - 0, 0, 9, 0, 0, 0, - 1, 1, 0, 0, 83, 86, - 95, 80, 79, 83, 73, 84, - 73, 79, 78, 0, 84, 69, - 88, 67, 79, 79, 82, 68, - 0, 83, 86, 95, 73, 115, - 70, 114, 111, 110, 116, 70, - 97, 99, 101, 0, 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, 69, 88, - 152, 23, 0, 0, 80, 0, - 0, 0, 230, 5, 0, 0, - 106, 8, 0, 1, 89, 0, - 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 36, 0, - 0, 0, 90, 8, 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, 114, 16, - 16, 0, 1, 0, 0, 0, - 98, 16, 0, 3, 242, 16, - 16, 0, 2, 0, 0, 0, - 98, 16, 0, 3, 114, 16, - 16, 0, 4, 0, 0, 0, - 98, 16, 0, 3, 114, 16, - 16, 0, 5, 0, 0, 0, - 98, 16, 0, 3, 114, 16, - 16, 0, 7, 0, 0, 0, - 98, 16, 0, 3, 66, 16, - 16, 0, 8, 0, 0, 0, - 99, 8, 0, 4, 18, 16, - 16, 0, 9, 0, 0, 0, - 9, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 104, 0, - 0, 2, 6, 0, 0, 0, - 14, 0, 0, 7, 114, 0, - 16, 0, 0, 0, 0, 0, - 70, 18, 16, 0, 2, 0, - 0, 0, 246, 31, 16, 0, - 2, 0, 0, 0, 50, 0, - 0, 15, 114, 0, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 63, 0, 0, 0, 63, - 0, 0, 128, 63, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 63, 0, 0, - 0, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 49, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 1, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 0, 49, 0, 0, 7, - 130, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 10, 0, - 16, 0, 1, 0, 0, 0, - 60, 0, 0, 7, 66, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 0, 0, 0, 0, 31, 0, - 0, 3, 42, 0, 16, 0, - 0, 0, 0, 0, 49, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 26, 0, - 16, 0, 1, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 0, 49, 0, 0, 7, - 130, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 26, 0, - 16, 0, 1, 0, 0, 0, - 60, 0, 0, 7, 66, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 0, 0, 0, 0, 31, 0, - 0, 3, 42, 0, 16, 0, - 0, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 0, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 20, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 2, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, - 16, 0, 2, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 8, 130, 0, 16, 0, - 1, 0, 0, 0, 26, 0, - 16, 128, 65, 0, 0, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 0, 0, 0, 7, 194, 0, - 16, 0, 0, 0, 0, 0, - 6, 12, 16, 0, 1, 0, - 0, 0, 6, 4, 16, 0, - 2, 0, 0, 0, 71, 0, - 0, 141, 194, 0, 0, 128, - 67, 85, 21, 0, 66, 0, - 16, 0, 0, 0, 0, 0, - 230, 10, 16, 0, 0, 0, - 0, 0, 6, 112, 16, 0, - 0, 0, 0, 0, 0, 96, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 21, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 21, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 22, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 22, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 23, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 23, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 24, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 24, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 25, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 25, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 26, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 26, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 27, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 27, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 28, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 28, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 29, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 29, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 30, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 30, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 2, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 2, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 26, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 31, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 56, 0, 0, 8, - 18, 0, 16, 0, 2, 0, - 0, 0, 10, 128, 32, 0, - 0, 0, 0, 0, 31, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 56, 0, - 0, 7, 34, 0, 16, 0, - 2, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 0, 0, 0, 7, - 50, 0, 16, 0, 1, 0, - 0, 0, 198, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 2, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 1, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 7, 66, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 66, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 171, 170, 170, 61, - 18, 0, 0, 1, 54, 0, - 0, 5, 66, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 21, 0, 0, 1, 18, 0, - 0, 1, 54, 0, 0, 5, - 66, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 21, 0, - 0, 1, 15, 0, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 0, 0, 0, 0, 70, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 10, 34, 0, - 16, 0, 0, 0, 0, 0, - 58, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 42, 128, - 32, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 0, 0, - 0, 9, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 58, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 14, 0, - 0, 10, 34, 0, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 63, 0, 0, - 128, 63, 0, 0, 128, 63, - 26, 0, 16, 0, 0, 0, - 0, 0, 56, 32, 0, 7, - 18, 0, 16, 0, 0, 0, - 0, 0, 26, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 9, 34, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 192, 1, 64, - 0, 0, 0, 0, 64, 64, - 56, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 0, 0, 0, 0, 56, 0, - 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 52, 0, 0, 10, - 82, 0, 16, 0, 0, 0, - 0, 0, 6, 2, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 205, 204, 76, 61, - 0, 0, 0, 0, 0, 0, - 0, 63, 0, 0, 0, 0, - 55, 0, 0, 10, 114, 0, - 16, 0, 1, 0, 0, 0, - 6, 16, 16, 0, 9, 0, - 0, 0, 70, 18, 16, 0, - 1, 0, 0, 0, 70, 18, - 16, 128, 65, 0, 0, 0, - 1, 0, 0, 0, 55, 0, - 0, 9, 114, 0, 16, 0, - 2, 0, 0, 0, 6, 16, - 16, 0, 9, 0, 0, 0, - 70, 18, 16, 0, 5, 0, - 0, 0, 70, 18, 16, 0, - 7, 0, 0, 0, 39, 0, - 0, 8, 34, 0, 16, 0, - 0, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 35, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 49, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 82, 184, - 126, 63, 26, 0, 16, 0, - 1, 0, 0, 0, 1, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 31, 0, 4, 3, - 58, 0, 16, 0, 0, 0, - 0, 0, 122, 0, 0, 5, - 50, 0, 16, 0, 3, 0, - 0, 0, 134, 16, 16, 0, - 4, 0, 0, 0, 124, 0, - 0, 5, 194, 0, 16, 0, - 3, 0, 0, 0, 6, 24, - 16, 0, 4, 0, 0, 0, - 52, 0, 0, 9, 50, 0, - 16, 0, 3, 0, 0, 0, - 230, 10, 16, 128, 129, 0, - 0, 0, 3, 0, 0, 0, - 70, 0, 16, 128, 129, 0, - 0, 0, 3, 0, 0, 0, - 52, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 3, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 50, 0, - 0, 13, 50, 0, 16, 0, - 3, 0, 0, 0, 246, 15, - 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 134, 16, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 12, - 194, 0, 16, 0, 3, 0, - 0, 0, 246, 15, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 63, 0, 0, 0, 63, - 6, 24, 16, 0, 4, 0, - 0, 0, 56, 0, 0, 10, - 50, 0, 16, 0, 4, 0, - 0, 0, 230, 10, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 65, 0, 0, 5, 50, 0, - 16, 0, 4, 0, 0, 0, - 70, 0, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 13, - 194, 0, 16, 0, 3, 0, - 0, 0, 166, 14, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 63, 0, 0, 0, 63, - 6, 4, 16, 128, 65, 0, - 0, 0, 4, 0, 0, 0, - 0, 0, 0, 10, 194, 0, - 16, 0, 3, 0, 0, 0, - 166, 14, 16, 0, 3, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 191, - 0, 0, 0, 191, 52, 0, - 0, 10, 194, 0, 16, 0, - 3, 0, 0, 0, 166, 14, - 16, 0, 3, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 50, 0, 0, 12, - 194, 0, 16, 0, 3, 0, - 0, 0, 166, 14, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 64, 0, 0, 0, 64, - 6, 4, 16, 0, 4, 0, - 0, 0, 56, 0, 0, 10, - 50, 0, 16, 0, 4, 0, - 0, 0, 70, 0, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 65, 0, 0, 5, 50, 0, - 16, 0, 4, 0, 0, 0, - 70, 0, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 13, - 50, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 70, 0, 16, 128, 65, 0, - 0, 0, 4, 0, 0, 0, - 0, 0, 0, 10, 50, 0, - 16, 0, 3, 0, 0, 0, - 70, 0, 16, 0, 3, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 191, 0, 0, - 0, 191, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 0, - 0, 10, 50, 0, 16, 0, - 3, 0, 0, 0, 70, 0, - 16, 0, 3, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 50, 0, 0, 12, - 50, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 64, - 0, 0, 0, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 70, 0, 16, 0, 4, 0, - 0, 0, 0, 0, 0, 8, - 50, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 128, - 65, 0, 0, 0, 3, 0, - 0, 0, 230, 10, 16, 0, - 3, 0, 0, 0, 14, 0, - 0, 7, 50, 0, 16, 0, - 3, 0, 0, 0, 70, 0, - 16, 0, 3, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 11, - 194, 0, 16, 0, 3, 0, - 0, 0, 6, 4, 16, 128, - 65, 0, 0, 0, 3, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 63, 56, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 3, 0, - 0, 0, 50, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 3, 0, 0, 0, 26, 0, - 16, 0, 3, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 10, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 62, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 7, 114, 0, - 16, 0, 3, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 18, 0, - 0, 1, 49, 0, 0, 8, - 130, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 82, 184, 126, 63, 42, 0, - 16, 128, 129, 0, 0, 0, - 1, 0, 0, 0, 1, 0, - 0, 7, 34, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 122, 0, 0, 5, - 50, 0, 16, 0, 4, 0, - 0, 0, 22, 21, 16, 0, - 4, 0, 0, 0, 124, 0, - 0, 5, 194, 0, 16, 0, - 4, 0, 0, 0, 86, 17, - 16, 0, 4, 0, 0, 0, - 52, 0, 0, 9, 50, 0, - 16, 0, 4, 0, 0, 0, - 230, 10, 16, 128, 129, 0, - 0, 0, 4, 0, 0, 0, - 70, 0, 16, 128, 129, 0, - 0, 0, 4, 0, 0, 0, - 52, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 4, 0, - 0, 0, 10, 0, 16, 0, - 4, 0, 0, 0, 50, 0, - 0, 13, 50, 0, 16, 0, - 4, 0, 0, 0, 246, 15, - 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 22, 21, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 12, - 194, 0, 16, 0, 4, 0, - 0, 0, 246, 15, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 63, 0, 0, 0, 63, - 86, 17, 16, 0, 4, 0, - 0, 0, 56, 0, 0, 10, - 50, 0, 16, 0, 5, 0, - 0, 0, 230, 10, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 65, 0, 0, 5, 50, 0, - 16, 0, 5, 0, 0, 0, - 70, 0, 16, 0, 5, 0, - 0, 0, 50, 0, 0, 13, - 194, 0, 16, 0, 4, 0, - 0, 0, 166, 14, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 63, 0, 0, 0, 63, - 6, 4, 16, 128, 65, 0, - 0, 0, 5, 0, 0, 0, - 0, 0, 0, 10, 194, 0, - 16, 0, 4, 0, 0, 0, - 166, 14, 16, 0, 4, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 191, - 0, 0, 0, 191, 52, 0, - 0, 10, 194, 0, 16, 0, - 4, 0, 0, 0, 166, 14, - 16, 0, 4, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 50, 0, 0, 12, - 194, 0, 16, 0, 4, 0, - 0, 0, 166, 14, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 64, 0, 0, 0, 64, - 6, 4, 16, 0, 5, 0, - 0, 0, 56, 0, 0, 10, - 50, 0, 16, 0, 5, 0, - 0, 0, 70, 0, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 65, 0, 0, 5, 50, 0, - 16, 0, 5, 0, 0, 0, - 70, 0, 16, 0, 5, 0, - 0, 0, 50, 0, 0, 13, - 50, 0, 16, 0, 4, 0, - 0, 0, 70, 0, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 70, 0, 16, 128, 65, 0, - 0, 0, 5, 0, 0, 0, - 0, 0, 0, 10, 50, 0, - 16, 0, 4, 0, 0, 0, - 70, 0, 16, 0, 4, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 191, 0, 0, - 0, 191, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 0, - 0, 10, 50, 0, 16, 0, - 4, 0, 0, 0, 70, 0, - 16, 0, 4, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 50, 0, 0, 12, - 50, 0, 16, 0, 4, 0, - 0, 0, 70, 0, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 64, - 0, 0, 0, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 70, 0, 16, 0, 5, 0, - 0, 0, 0, 0, 0, 8, - 50, 0, 16, 0, 4, 0, - 0, 0, 70, 0, 16, 128, - 65, 0, 0, 0, 4, 0, - 0, 0, 230, 10, 16, 0, - 4, 0, 0, 0, 14, 0, - 0, 7, 50, 0, 16, 0, - 4, 0, 0, 0, 70, 0, - 16, 0, 4, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 11, - 194, 0, 16, 0, 4, 0, - 0, 0, 6, 4, 16, 128, - 65, 0, 0, 0, 4, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 63, 56, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 4, 0, 0, 0, - 42, 0, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 9, - 130, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 0, - 4, 0, 0, 0, 26, 0, - 16, 0, 4, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 10, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 62, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 7, 114, 0, - 16, 0, 4, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 55, 0, - 0, 9, 114, 0, 16, 0, - 3, 0, 0, 0, 86, 5, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 4, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 21, 0, - 0, 1, 16, 0, 0, 8, - 34, 0, 16, 0, 0, 0, - 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 33, 0, - 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 56, 0, - 0, 8, 66, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 52, 0, 0, 7, 66, 0, - 16, 0, 0, 0, 0, 0, - 42, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 56, 0, - 0, 7, 114, 0, 16, 0, - 1, 0, 0, 0, 166, 10, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 3, 0, - 0, 0, 56, 0, 0, 10, - 114, 0, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 64, - 0, 0, 128, 64, 0, 0, - 128, 64, 0, 0, 0, 0, - 50, 0, 0, 15, 226, 0, - 16, 0, 0, 0, 0, 0, - 86, 5, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 191, 0, 0, 0, 191, - 0, 0, 128, 191, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 63, 0, 0, - 0, 63, 0, 0, 0, 0, - 50, 0, 0, 15, 226, 0, - 16, 0, 0, 0, 0, 0, - 86, 14, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 11, 215, - 163, 60, 206, 204, 76, 60, - 148, 194, 245, 59, 2, 64, - 0, 0, 0, 0, 0, 0, - 205, 204, 204, 60, 205, 204, - 204, 60, 143, 194, 245, 60, - 56, 0, 0, 7, 226, 0, - 16, 0, 0, 0, 0, 0, - 86, 14, 16, 0, 0, 0, - 0, 0, 6, 9, 16, 0, - 2, 0, 0, 0, 56, 0, - 0, 7, 226, 0, 16, 0, - 0, 0, 0, 0, 6, 0, - 16, 0, 0, 0, 0, 0, - 86, 14, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 9, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 6, 0, - 16, 0, 0, 0, 0, 0, - 150, 7, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 8, - 130, 0, 16, 0, 0, 0, - 0, 0, 42, 16, 16, 0, - 8, 0, 0, 0, 58, 128, - 32, 0, 0, 0, 0, 0, - 17, 0, 0, 0, 56, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 59, 170, - 184, 63, 25, 0, 0, 5, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 0, 0, - 0, 9, 114, 0, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, - 70, 130, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 17, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 0, 0, 0, 0, 246, 15, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 0, 0, - 0, 0, 70, 130, 32, 0, - 0, 0, 0, 0, 17, 0, - 0, 0, 47, 0, 0, 6, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 128, - 129, 0, 0, 0, 0, 0, - 0, 0, 56, 0, 0, 10, - 114, 0, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 47, 186, 232, 62, - 47, 186, 232, 62, 47, 186, - 232, 62, 0, 0, 0, 0, - 25, 0, 0, 5, 114, 32, - 16, 0, 0, 0, 0, 0, - 70, 2, 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, - 148, 0, 0, 0, 179, 0, - 0, 0, 6, 0, 0, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 146, 0, 0, 0, - 1, 0, 0, 0, 4, 0, - 0, 0, 4, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 12, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 3, 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 -}; diff --git a/demo/d3d11/shaders/meshShadowPS.hlsl b/demo/d3d11/shaders/meshShadowPS.hlsl deleted file mode 100644 index cb60c22..0000000 --- a/demo/d3d11/shaders/meshShadowPS.hlsl +++ /dev/null @@ -1,11 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - MeshShaderConst gParams; -}; - -float4 meshPS_Shadow(MeshVertexOut input) : SV_TARGET -{ - return float4(0.0, 0.0, 0.0, 1.0); -} diff --git a/demo/d3d11/shaders/meshShadowPS.hlsl.h b/demo/d3d11/shaders/meshShadowPS.hlsl.h deleted file mode 100644 index 3794f61..0000000 --- a/demo/d3d11/shaders/meshShadowPS.hlsl.h +++ /dev/null @@ -1,156 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_POSITION 0 xyzw 0 POS float -// TEXCOORD 0 xyzw 1 NONE float -// TEXCOORD 1 xyzw 2 NONE float -// TEXCOORD 2 xyzw 3 NONE float -// TEXCOORD 3 xyzw 4 NONE float -// TEXCOORD 4 xyzw 5 NONE float -// TEXCOORD 5 xyzw 6 NONE float -// TEXCOORD 6 xyzw 7 NONE float -// TEXCOORD 7 xyzw 8 NONE float -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// -ps_5_0 -dcl_globalFlags refactoringAllowed -dcl_output o0.xyzw -mov o0.xyzw, l(0,0,0,1.000000) -ret -// Approximately 2 instruction slots used -#endif - -const BYTE g_meshPS_Shadow[] = -{ - 68, 88, 66, 67, 106, 78, - 82, 142, 162, 137, 138, 82, - 3, 68, 165, 116, 56, 116, - 165, 11, 1, 0, 0, 0, - 192, 2, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 172, 0, 0, 0, 172, 1, - 0, 0, 224, 1, 0, 0, - 36, 2, 0, 0, 82, 68, - 69, 70, 112, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 255, 255, 0, 1, 0, 0, - 60, 0, 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, - 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, 54, - 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, - 52, 0, 171, 171, 73, 83, - 71, 78, 248, 0, 0, 0, - 9, 0, 0, 0, 8, 0, - 0, 0, 224, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 4, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 5, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 5, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 6, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 6, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 7, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 7, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 8, 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, 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, 69, 88, 60, 0, - 0, 0, 80, 0, 0, 0, - 15, 0, 0, 0, 106, 8, - 0, 1, 101, 0, 0, 3, - 242, 32, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 8, - 242, 32, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 128, 63, 62, 0, - 0, 1, 83, 84, 65, 84, - 148, 0, 0, 0, 2, 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, 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, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0 -}; diff --git a/demo/d3d11/shaders/meshVS.hlsl b/demo/d3d11/shaders/meshVS.hlsl deleted file mode 100644 index 09f78ec..0000000 --- a/demo/d3d11/shaders/meshVS.hlsl +++ /dev/null @@ -1,91 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - MeshShaderConst gParams; -}; - -MeshVertexOut meshVS(MeshVertexIn input) -{ - float4 gl_Position; - float4 gl_TexCoord[8]; - - { - [unroll] - for (int i = 0; i < 8; i++) - gl_TexCoord[i] = float4(0.0f, 0.0f, 0.0f, 0.0f); - } - - const float4x4 gl_ModelViewProjectionMatrix = gParams.modelviewprojection; - const float4x4 gl_ModelViewMatrix = gParams.modelview; - const float4x4 objectTransform = gParams.objectTransform; - const float4x4 lightTransform = gParams.lightTransform; - const float3 lightDir = gParams.lightDir; - const float bias = gParams.bias; - const float4 clipPlane = gParams.clipPlane; - const float expand = gParams.expand; - const float4 gl_Color = gParams.color; - const float4 gl_SecondaryColor = gParams.secondaryColor; - - const float3 gl_Vertex = input.position; - const float3 gl_Normal = input.normal; - const float2 gl_MultiTexCoord0 = input.texCoord; - - float3 n = normalize(mul(objectTransform, float4(gl_Normal, 0.0)).xyz); - float3 p = mul(objectTransform, float4(gl_Vertex.xyz, 1.0)).xyz; - - // calculate window-space point size - gl_Position = mul(gl_ModelViewProjectionMatrix, float4(p + expand * n, 1.0)); - - gl_TexCoord[0].xyz = n; - gl_TexCoord[1] = mul(lightTransform, float4(p + n * bias, 1.0)); - gl_TexCoord[2] = mul(gl_ModelViewMatrix, float4(lightDir, 0.0)); - gl_TexCoord[3].xyz = p; - if (gParams.colorArray) - gl_TexCoord[4] = input.color; - else - gl_TexCoord[4] = gl_Color; - gl_TexCoord[5].xy = gl_MultiTexCoord0; - gl_TexCoord[5].y = 1.0f - gl_TexCoord[5].y; // flip the y component of uv (glsl to hlsl conversion) - gl_TexCoord[6] = gl_SecondaryColor; - gl_TexCoord[7] = mul(gl_ModelViewMatrix, float4(gl_Vertex.xyz, 1.0)); - - MeshVertexOut output; - output.position = gl_Position; - { - [unroll] - for (int i = 0; i < 8; i++) - output.texCoord[i] = gl_TexCoord[i]; - } - - return output; - - /* - uniform mat4 lightTransform; - uniform vec3 lightDir; - uniform float bias; - uniform vec4 clipPlane; - uniform float expand; - - uniform mat4 objectTransform; - - void main() - { - vec3 n = normalize((objectTransform*vec4(gl_Normal, 0.0)).xyz); - vec3 p = (objectTransform*vec4(gl_Vertex.xyz, 1.0)).xyz; - - // calculate window-space point size - gl_Position = gl_ModelViewProjectionMatrix * vec4(p + expand*n, 1.0); - - gl_TexCoord[0].xyz = n; - gl_TexCoord[1] = lightTransform*vec4(p + n*bias, 1.0); - gl_TexCoord[2] = gl_ModelViewMatrix*vec4(lightDir, 0.0); - gl_TexCoord[3].xyz = p; - gl_TexCoord[4] = gl_Color; - gl_TexCoord[5] = gl_MultiTexCoord0; - gl_TexCoord[6] = gl_SecondaryColor; - gl_TexCoord[7] = gl_ModelViewMatrix*vec4(gl_Vertex.xyz, 1.0); - - gl_ClipDistance[0] = dot(clipPlane, vec4(gl_Vertex.xyz, 1.0)); - */ -} diff --git a/demo/d3d11/shaders/meshVS.hlsl.h b/demo/d3d11/shaders/meshVS.hlsl.h deleted file mode 100644 index cc314af..0000000 --- a/demo/d3d11/shaders/meshVS.hlsl.h +++ /dev/null @@ -1,635 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer constBuf -// { -// -// struct MeshShaderConst -// { -// -// float4x4 modelviewprojection; // Offset: 0 -// float4x4 modelview; // Offset: 64 -// float4x4 objectTransform; // Offset: 128 -// float4x4 lightTransform; // Offset: 192 -// float4 clipPlane; // Offset: 256 -// float4 fogColor; // Offset: 272 -// float4 color; // Offset: 288 -// float4 secondaryColor; // Offset: 304 -// float4 shadowTaps[12]; // Offset: 320 -// float3 lightPos; // Offset: 512 -// float _pad0; // Offset: 524 -// float3 lightDir; // Offset: 528 -// float _pad1; // Offset: 540 -// float bias; // Offset: 544 -// float expand; // Offset: 548 -// float spotMin; // Offset: 552 -// float spotMax; // Offset: 556 -// int grid; // Offset: 560 -// int tex; // Offset: 564 -// int colorArray; // Offset: 568 -// int _pad2; // Offset: 572 -// -// } gParams; // Offset: 0 Size: 576 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// constBuf cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xyz 0 NONE float xyz -// NORMAL 0 xyz 1 NONE float xyz -// TEXCOORD 0 xy 2 NONE float xy -// COLOR 0 xyzw 3 NONE float xyzw -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_POSITION 0 xyzw 0 POS float xyzw -// TEXCOORD 0 xyzw 1 NONE float xyzw -// TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float xyzw -// TEXCOORD 3 xyzw 4 NONE float xyzw -// TEXCOORD 4 xyzw 5 NONE float xyzw -// TEXCOORD 5 xyzw 6 NONE float xyzw -// TEXCOORD 6 xyzw 7 NONE float xyzw -// TEXCOORD 7 xyzw 8 NONE float xyzw -// -vs_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[36], immediateIndexed -dcl_input v0.xyz -dcl_input v1.xyz -dcl_input v2.xy -dcl_input v3.xyzw -dcl_output_siv o0.xyzw, position -dcl_output o1.xyzw -dcl_output o2.xyzw -dcl_output o3.xyzw -dcl_output o4.xyzw -dcl_output o5.xyzw -dcl_output o6.xyzw -dcl_output o7.xyzw -dcl_output o8.xyzw -dcl_temps 4 -mul r0.xyz, v1.yyyy, cb0[9].xyzx -mad r0.xyz, cb0[8].xyzx, v1.xxxx, r0.xyzx -mad r0.xyz, cb0[10].xyzx, v1.zzzz, r0.xyzx -dp3 r0.w, r0.xyzx, r0.xyzx -rsq r0.w, r0.w -mul r0.xyz, r0.wwww, r0.xyzx -mul r1.xyz, v0.yyyy, cb0[9].xyzx -mad r1.xyz, cb0[8].xyzx, v0.xxxx, r1.xyzx -mad r1.xyz, cb0[10].xyzx, v0.zzzz, r1.xyzx -add r1.xyz, r1.xyzx, cb0[11].xyzx -mad r2.xyz, cb0[34].yyyy, r0.xyzx, r1.xyzx -mul r3.xyzw, r2.yyyy, cb0[1].xyzw -mad r3.xyzw, cb0[0].xyzw, r2.xxxx, r3.xyzw -mad r2.xyzw, cb0[2].xyzw, r2.zzzz, r3.xyzw -add o0.xyzw, r2.xyzw, cb0[3].xyzw -mov o1.xyz, r0.xyzx -mad r0.xyz, r0.xyzx, cb0[34].xxxx, r1.xyzx -mov o4.xyz, r1.xyzx -mov o1.w, l(0) -mul r1.xyzw, r0.yyyy, cb0[13].xyzw -mad r1.xyzw, cb0[12].xyzw, r0.xxxx, r1.xyzw -mad r0.xyzw, cb0[14].xyzw, r0.zzzz, r1.xyzw -add o2.xyzw, r0.xyzw, cb0[15].xyzw -mul r0.xyzw, cb0[5].xyzw, cb0[33].yyyy -mad r0.xyzw, cb0[4].xyzw, cb0[33].xxxx, r0.xyzw -mad o3.xyzw, cb0[6].xyzw, cb0[33].zzzz, r0.xyzw -mov o4.w, l(0) -movc o5.xyzw, cb0[35].zzzz, v3.xyzw, cb0[18].xyzw -mad o6.xy, v2.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000), l(0.000000, 1.000000, 0.000000, 0.000000) -mov o6.zw, l(0,0,0,0) -mov o7.xyzw, cb0[19].xyzw -mul r0.xyzw, v0.yyyy, cb0[5].xyzw -mad r0.xyzw, cb0[4].xyzw, v0.xxxx, r0.xyzw -mad r0.xyzw, cb0[6].xyzw, v0.zzzz, r0.xyzw -add o8.xyzw, r0.xyzw, cb0[7].xyzw -ret -// Approximately 36 instruction slots used -#endif - -const BYTE g_meshVS[] = -{ - 68, 88, 66, 67, 128, 165, - 34, 49, 122, 47, 91, 168, - 78, 217, 246, 213, 221, 36, - 22, 221, 1, 0, 0, 0, - 204, 11, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 24, 4, 0, 0, 168, 4, - 0, 0, 168, 5, 0, 0, - 48, 11, 0, 0, 82, 68, - 69, 70, 220, 3, 0, 0, - 1, 0, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 254, 255, 0, 1, 0, 0, - 168, 3, 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, 1, 0, - 0, 0, 99, 111, 110, 115, - 116, 66, 117, 102, 0, 171, - 171, 171, 92, 0, 0, 0, - 1, 0, 0, 0, 128, 0, - 0, 0, 64, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 168, 0, 0, 0, - 0, 0, 0, 0, 64, 2, - 0, 0, 2, 0, 0, 0, - 132, 3, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 103, 80, 97, 114, 97, 109, - 115, 0, 77, 101, 115, 104, - 83, 104, 97, 100, 101, 114, - 67, 111, 110, 115, 116, 0, - 109, 111, 100, 101, 108, 118, - 105, 101, 119, 112, 114, 111, - 106, 101, 99, 116, 105, 111, - 110, 0, 102, 108, 111, 97, - 116, 52, 120, 52, 0, 171, - 171, 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, 212, 0, - 0, 0, 109, 111, 100, 101, - 108, 118, 105, 101, 119, 0, - 111, 98, 106, 101, 99, 116, - 84, 114, 97, 110, 115, 102, - 111, 114, 109, 0, 108, 105, - 103, 104, 116, 84, 114, 97, - 110, 115, 102, 111, 114, 109, - 0, 99, 108, 105, 112, 80, - 108, 97, 110, 101, 0, 102, - 108, 111, 97, 116, 52, 0, - 171, 171, 1, 0, 3, 0, - 1, 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, 55, 1, - 0, 0, 102, 111, 103, 67, - 111, 108, 111, 114, 0, 99, - 111, 108, 111, 114, 0, 115, - 101, 99, 111, 110, 100, 97, - 114, 121, 67, 111, 108, 111, - 114, 0, 115, 104, 97, 100, - 111, 119, 84, 97, 112, 115, - 0, 171, 171, 171, 1, 0, - 3, 0, 1, 0, 4, 0, - 12, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 55, 1, 0, 0, 108, 105, - 103, 104, 116, 80, 111, 115, - 0, 102, 108, 111, 97, 116, - 51, 0, 1, 0, 3, 0, - 1, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 189, 1, - 0, 0, 95, 112, 97, 100, - 48, 0, 102, 108, 111, 97, - 116, 0, 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, 238, 1, - 0, 0, 108, 105, 103, 104, - 116, 68, 105, 114, 0, 95, - 112, 97, 100, 49, 0, 98, - 105, 97, 115, 0, 101, 120, - 112, 97, 110, 100, 0, 115, - 112, 111, 116, 77, 105, 110, - 0, 115, 112, 111, 116, 77, - 97, 120, 0, 103, 114, 105, - 100, 0, 105, 110, 116, 0, - 0, 0, 2, 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, 72, 2, 0, 0, - 116, 101, 120, 0, 99, 111, - 108, 111, 114, 65, 114, 114, - 97, 121, 0, 95, 112, 97, - 100, 50, 0, 171, 171, 171, - 192, 0, 0, 0, 224, 0, - 0, 0, 0, 0, 0, 0, - 4, 1, 0, 0, 224, 0, - 0, 0, 64, 0, 0, 0, - 14, 1, 0, 0, 224, 0, - 0, 0, 128, 0, 0, 0, - 30, 1, 0, 0, 224, 0, - 0, 0, 192, 0, 0, 0, - 45, 1, 0, 0, 64, 1, - 0, 0, 0, 1, 0, 0, - 100, 1, 0, 0, 64, 1, - 0, 0, 16, 1, 0, 0, - 109, 1, 0, 0, 64, 1, - 0, 0, 32, 1, 0, 0, - 115, 1, 0, 0, 64, 1, - 0, 0, 48, 1, 0, 0, - 130, 1, 0, 0, 144, 1, - 0, 0, 64, 1, 0, 0, - 180, 1, 0, 0, 196, 1, - 0, 0, 0, 2, 0, 0, - 232, 1, 0, 0, 244, 1, - 0, 0, 12, 2, 0, 0, - 24, 2, 0, 0, 196, 1, - 0, 0, 16, 2, 0, 0, - 33, 2, 0, 0, 244, 1, - 0, 0, 28, 2, 0, 0, - 39, 2, 0, 0, 244, 1, - 0, 0, 32, 2, 0, 0, - 44, 2, 0, 0, 244, 1, - 0, 0, 36, 2, 0, 0, - 51, 2, 0, 0, 244, 1, - 0, 0, 40, 2, 0, 0, - 59, 2, 0, 0, 244, 1, - 0, 0, 44, 2, 0, 0, - 67, 2, 0, 0, 76, 2, - 0, 0, 48, 2, 0, 0, - 112, 2, 0, 0, 76, 2, - 0, 0, 52, 2, 0, 0, - 116, 2, 0, 0, 76, 2, - 0, 0, 56, 2, 0, 0, - 127, 2, 0, 0, 76, 2, - 0, 0, 60, 2, 0, 0, - 5, 0, 0, 0, 1, 0, - 144, 0, 0, 0, 21, 0, - 136, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 176, 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, 54, - 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, - 52, 0, 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, 0, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 7, 7, - 0, 0, 113, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 7, 7, - 0, 0, 120, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 3, 3, - 0, 0, 129, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 15, - 0, 0, 80, 79, 83, 73, - 84, 73, 79, 78, 0, 78, - 79, 82, 77, 65, 76, 0, - 84, 69, 88, 67, 79, 79, - 82, 68, 0, 67, 79, 76, - 79, 82, 0, 171, 79, 83, - 71, 78, 248, 0, 0, 0, - 9, 0, 0, 0, 8, 0, - 0, 0, 224, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 4, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 5, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 5, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 6, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 6, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 7, 0, 0, 0, 15, 0, - 0, 0, 236, 0, 0, 0, - 7, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 8, 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, 171, - 171, 171, 83, 72, 69, 88, - 128, 5, 0, 0, 80, 0, - 1, 0, 96, 1, 0, 0, - 106, 8, 0, 1, 89, 0, - 0, 4, 70, 142, 32, 0, - 0, 0, 0, 0, 36, 0, - 0, 0, 95, 0, 0, 3, - 114, 16, 16, 0, 0, 0, - 0, 0, 95, 0, 0, 3, - 114, 16, 16, 0, 1, 0, - 0, 0, 95, 0, 0, 3, - 50, 16, 16, 0, 2, 0, - 0, 0, 95, 0, 0, 3, - 242, 16, 16, 0, 3, 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, - 101, 0, 0, 3, 242, 32, - 16, 0, 2, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 3, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 4, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 5, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 6, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 7, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 8, 0, 0, 0, - 104, 0, 0, 2, 4, 0, - 0, 0, 56, 0, 0, 8, - 114, 0, 16, 0, 0, 0, - 0, 0, 86, 21, 16, 0, - 1, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 9, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 0, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 8, 0, 0, 0, 6, 16, - 16, 0, 1, 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, 10, 0, - 0, 0, 166, 26, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 0, 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, 56, 0, - 0, 8, 114, 0, 16, 0, - 1, 0, 0, 0, 86, 21, - 16, 0, 0, 0, 0, 0, - 70, 130, 32, 0, 0, 0, - 0, 0, 9, 0, 0, 0, - 50, 0, 0, 10, 114, 0, - 16, 0, 1, 0, 0, 0, - 70, 130, 32, 0, 0, 0, - 0, 0, 8, 0, 0, 0, - 6, 16, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 1, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 10, 0, 0, 0, 166, 26, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 0, 0, 0, 8, - 114, 0, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 70, 130, - 32, 0, 0, 0, 0, 0, - 11, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 2, 0, 0, 0, 86, 133, - 32, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 1, 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, - 1, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 3, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 0, 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, 2, 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, 3, 0, - 0, 0, 54, 0, 0, 5, - 114, 32, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 50, 0, - 0, 10, 114, 0, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, - 6, 128, 32, 0, 0, 0, - 0, 0, 34, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 5, - 114, 32, 16, 0, 4, 0, - 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 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, 13, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 1, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 12, 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, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 14, 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, - 2, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 56, 0, 0, 9, 242, 0, - 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 5, 0, 0, 0, - 86, 133, 32, 0, 0, 0, - 0, 0, 33, 0, 0, 0, - 50, 0, 0, 11, 242, 0, - 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 6, 128, 32, 0, 0, 0, - 0, 0, 33, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 11, - 242, 32, 16, 0, 3, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 6, 0, - 0, 0, 166, 138, 32, 0, - 0, 0, 0, 0, 33, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, - 4, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 55, 0, 0, 11, 242, 32, - 16, 0, 5, 0, 0, 0, - 166, 138, 32, 0, 0, 0, - 0, 0, 35, 0, 0, 0, - 70, 30, 16, 0, 3, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 18, 0, - 0, 0, 50, 0, 0, 15, - 50, 32, 16, 0, 6, 0, - 0, 0, 70, 16, 16, 0, - 2, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 191, 0, 0, - 0, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, - 0, 0, 0, 0, 0, 0, - 0, 0, 54, 0, 0, 8, - 194, 32, 16, 0, 6, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 54, 0, - 0, 6, 242, 32, 16, 0, - 7, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 19, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 0, 0, 0, 0, 86, 21, - 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 5, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 0, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 6, 16, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 50, 0, - 0, 10, 242, 0, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 166, 26, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 8, - 242, 32, 16, 0, 8, 0, - 0, 0, 70, 14, 16, 0, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 7, 0, 0, 0, 62, 0, - 0, 1, 83, 84, 65, 84, - 148, 0, 0, 0, 36, 0, - 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 13, 0, - 0, 0, 28, 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, 6, 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 -}; diff --git a/demo/d3d11/shaders/passThroughVS.hlsl b/demo/d3d11/shaders/passThroughVS.hlsl deleted file mode 100644 index 9b16afa..0000000 --- a/demo/d3d11/shaders/passThroughVS.hlsl +++ /dev/null @@ -1,26 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - FluidShaderConst gParams; -}; - -PassthroughVertexOut passThroughVS(PassthroughVertexIn input) -{ - float4 gl_Vertex = float4(input.position, 0.0f, 1.0f); - float2 gl_MultiTexCoord0 = input.texCoord; - - PassthroughVertexOut output; - output.position = gl_Vertex; - output.texCoord[0] = gl_MultiTexCoord0; - - return output; - - /* - void main() - { - gl_Position = vec4(gl_Vertex.xyz, 1.0); - gl_TexCoord[0] = gl_MultiTexCoord0; - } - */ -} diff --git a/demo/d3d11/shaders/passThroughVS.hlsl.h b/demo/d3d11/shaders/passThroughVS.hlsl.h deleted file mode 100644 index 4b1b2cf..0000000 --- a/demo/d3d11/shaders/passThroughVS.hlsl.h +++ /dev/null @@ -1,145 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xy 0 NONE float xy -// 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_5_0 -dcl_globalFlags refactoringAllowed -dcl_input v0.xy -dcl_input v1.xy -dcl_output_siv o0.xyzw, position -dcl_output o1.xy -mov o0.xy, v0.xyxx -mov o0.zw, l(0,0,0,1.000000) -mov o1.xy, v1.xyxx -ret -// Approximately 4 instruction slots used -#endif - -const BYTE g_passThroughVS[] = -{ - 68, 88, 66, 67, 187, 133, - 114, 171, 205, 36, 113, 9, - 245, 108, 33, 122, 172, 89, - 138, 214, 1, 0, 0, 0, - 136, 2, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 172, 0, 0, 0, 0, 1, - 0, 0, 88, 1, 0, 0, - 236, 1, 0, 0, 82, 68, - 69, 70, 112, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 254, 255, 0, 1, 0, 0, - 60, 0, 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, - 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, 54, - 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, - 52, 0, 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, 3, 3, - 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, 69, 88, - 140, 0, 0, 0, 80, 0, - 1, 0, 35, 0, 0, 0, - 106, 8, 0, 1, 95, 0, - 0, 3, 50, 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, - 50, 32, 16, 0, 0, 0, - 0, 0, 70, 16, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 8, 194, 32, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, - 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, 148, 0, - 0, 0, 4, 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, - 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 -}; diff --git a/demo/d3d11/shaders/pointGS.hlsl b/demo/d3d11/shaders/pointGS.hlsl deleted file mode 100644 index 2d8126e..0000000 --- a/demo/d3d11/shaders/pointGS.hlsl +++ /dev/null @@ -1,84 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - PointShaderConst gParams; -}; - -static const float2 corners[4] = -{ - float2(0.0, 1.0), float2(0.0, 0.0), float2(1.0, 1.0), float2(1.0, 0.0) -}; - -[maxvertexcount(4)] -void pointGS(point PointVertexOut input[1], inout TriangleStream<PointGeoOut> triStream) -{ - float4 gl_Position; - float4 gl_TexCoord[6]; - - { - [unroll] - for (int i = 0; i < 6; i++) - gl_TexCoord[i] = float4(0.0f, 0.0f, 0.0f, 0.0f); - } - - const float4x4 gl_ModelViewMatrix = gParams.modelview; - const float pointRadius = gParams.pointRadius; - const float pointScale = gParams.pointScale; - const float4x4 lightTransform = gParams.lightTransform; - const float3 lightDir = gParams.lightDir.xyz; - const int mode = gParams.mode; - - float4 viewPos = input[0].position; - float density = input[0].density; - unsigned int phase = input[0].phase; - float4 gl_Vertex = input[0].vertex; - - //float gl_PointSize = -pointScale * (pointRadius / viewPos.z); - //float spriteSize = (pointRadius / viewPos.z); - float spriteSize = pointRadius * 2; - - PointGeoOut output; - - for (int i = 0; i < 4; ++i) - { - - float4 eyePos = viewPos; // start with point position - eyePos.xy += spriteSize * (corners[i] - float2(0.5, 0.5)); // add corner position - gl_Position = mul(gParams.projection, eyePos); // complete transformation - - gl_TexCoord[0].xy = corners[i].xy; // use corner as texCoord - gl_TexCoord[0].y = 1.0f - gl_TexCoord[0].y; // flip the y component of uv (glsl to hlsl conversion) - gl_TexCoord[1] = mul(lightTransform, float4(gl_Vertex.xyz - lightDir * pointRadius * 2.0, 1.0)); - gl_TexCoord[2] = mul(gl_ModelViewMatrix, float4(lightDir, 0.0)); - - if (mode == 1) - { - // density visualization - if (density < 0.0f) - gl_TexCoord[3].xyz = lerp(float3(0.1, 0.1, 1.0), float3(0.1, 1.0, 1.0), -density); - else - gl_TexCoord[3].xyz = lerp(float3(1.0, 1.0, 1.0), float3(0.1, 0.2, 1.0), density); - } - else if (mode == 2) - { - //gl_PointSize *= clamp(gl_Vertex.w * 0.25, 0.0f, 1.0); - float tmp = clamp(gl_Vertex.w * 0.05, 0.0f, 1.0); - gl_TexCoord[3].xyzw = float4(tmp, tmp, tmp, tmp); - } - else - { - gl_TexCoord[3].xyz = lerp(gParams.colors[phase % 8].xyz * 2.0, float3(1.0, 1.0, 1.0), 0.1); - } - - gl_TexCoord[4].xyz = gl_Vertex.xyz; - gl_TexCoord[5].xyz = viewPos.xyz; - - output.position = gl_Position; - [unroll] - for (int j = 0; j < 6; j++) - output.texCoord[j] = gl_TexCoord[j]; - - triStream.Append(output); - } -} diff --git a/demo/d3d11/shaders/pointGS.hlsl.h b/demo/d3d11/shaders/pointGS.hlsl.h deleted file mode 100644 index afc1b76..0000000 --- a/demo/d3d11/shaders/pointGS.hlsl.h +++ /dev/null @@ -1,740 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer constBuf -// { -// -// struct PointShaderConst -// { -// -// float4x4 modelview; // Offset: 0 -// float4x4 projection; // Offset: 64 -// float4x4 lightTransform; // Offset: 128 -// float4 colors[8]; // Offset: 192 -// float4 shadowTaps[12]; // Offset: 320 -// float3 lightPos; // Offset: 512 -// float _pad0; // Offset: 524 -// float3 lightDir; // Offset: 528 -// float _pad1; // Offset: 540 -// float pointRadius; // Offset: 544 -// float pointScale; // Offset: 548 -// float spotMin; // Offset: 552 -// float spotMax; // Offset: 556 -// int mode; // Offset: 560 -// int _pad2[3]; // Offset: 576 -// -// } gParams; // Offset: 0 Size: 612 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// constBuf cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xyzw 0 NONE float xyzw -// DENSITY 0 x 1 NONE float x -// PHASE 0 x 2 NONE int x -// VERTEX 0 xyzw 3 NONE float xyzw -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_POSITION 0 xyzw 0 POS float xyzw -// TEXCOORD 0 xyzw 1 NONE float xyzw -// TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float xyzw -// TEXCOORD 3 xyzw 4 NONE float xyzw -// TEXCOORD 4 xyzw 5 NONE float xyzw -// TEXCOORD 5 xyzw 6 NONE float xyzw -// -gs_5_0 -dcl_globalFlags refactoringAllowed -dcl_immediateConstantBuffer { { 0, 1.000000, 0, 0}, - { 0, 0, 0, 0}, - { 1.000000, 1.000000, 0, 0}, - { 1.000000, 0, 0, 0} } -dcl_constantbuffer cb0[36], dynamicIndexed -dcl_input v[1][0].xyzw -dcl_input v[1][1].x -dcl_input v[1][2].x -dcl_input v[1][3].xyzw -dcl_temps 8 -dcl_indexableTemp x0[6], 4 -dcl_inputprimitive point -dcl_stream m0 -dcl_outputtopology trianglestrip -dcl_output_siv o0.xyzw, position -dcl_output o1.xyzw -dcl_output o2.xyzw -dcl_output o3.xyzw -dcl_output o4.xyzw -dcl_output o5.xyzw -dcl_output o6.xyzw -dcl_maxout 4 -mov x0[3].w, l(0) -add r0.x, cb0[34].x, cb0[34].x -mul r0.yzw, cb0[33].xxyz, cb0[34].xxxx -mad r0.yzw, -r0.yyzw, l(0.000000, 2.000000, 2.000000, 2.000000), v[0][3].xxyz -mul r1.xyzw, r0.zzzz, cb0[9].xyzw -mad r1.xyzw, cb0[8].xyzw, r0.yyyy, r1.xyzw -mad r1.xyzw, cb0[10].xyzw, r0.wwww, r1.xyzw -add r1.xyzw, r1.xyzw, cb0[11].xyzw -mul r2.xyzw, cb0[1].xyzw, cb0[33].yyyy -mad r2.xyzw, cb0[0].xyzw, cb0[33].xxxx, r2.xyzw -mad r2.xyzw, cb0[2].xyzw, cb0[33].zzzz, r2.xyzw -lt r0.y, v[0][1].x, l(0.000000) -mad r3.xyz, v[0][1].xxxx, l(0.000000, -0.900000, 0.000000, 0.000000), l(0.100000, 0.100000, 1.000000, 0.000000) -mad r4.xyz, v[0][1].xxxx, l(-0.900000, -0.800000, 0.000000, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000) -ieq r0.zw, l(0, 0, 1, 2), cb0[35].xxxx -mul r3.w, l(0.050000), v[0][3].w -mov_sat r5.xyz, r3.wwww -and r3.w, l(7), v[0][2].x -add r6.xyz, cb0[r3.w + 12].xyzx, cb0[r3.w + 12].xyzx -mad r7.xyz, -cb0[r3.w + 12].xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(1.000000, 1.000000, 1.000000, 0.000000) -mad r6.xyz, r7.xyzx, l(0.100000, 0.100000, 0.100000, 0.000000), r6.xyzx -movc r3.xyz, r0.yyyy, r3.xyzx, r4.xyzx -mov r0.y, l(0) -loop - ige r3.w, r0.y, l(4) - breakc_nz r3.w - add r4.xy, l(-0.500000, -0.500000, 0.000000, 0.000000), icb[r0.y + 0].xyxx - mad r4.xy, r0.xxxx, r4.xyxx, v[0][0].xyxx - mul r7.xyzw, r4.yyyy, cb0[5].xyzw - mad r4.xyzw, cb0[4].xyzw, r4.xxxx, r7.xyzw - mad r4.xyzw, cb0[6].xyzw, v[0][0].zzzz, r4.xyzw - mad r4.xyzw, cb0[7].xyzw, v[0][0].wwww, r4.xyzw - add r3.w, l(1.000000), -icb[r0.y + 0].y - if_nz r0.z - mov r7.xyz, r3.xyzx - else - if_nz r0.w - mov x0[3].w, r5.z - mov r7.xyz, r5.xyzx - else - mov r7.xyz, r6.xyzx - endif - endif - mov r5.w, x0[3].w - mov o0.xyzw, r4.xyzw - mov o1.x, icb[r0.y + 0].x - mov o1.y, r3.w - mov o1.zw, l(0,0,0,0) - mov o2.xyzw, r1.xyzw - mov o3.xyzw, r2.xyzw - mov o4.xyz, r7.xyzx - mov o4.w, r5.w - mov o5.xyz, v[0][3].xyzx - mov o5.w, l(0) - mov o6.xyz, v[0][0].xyzx - mov o6.w, l(0) - emit_stream m0 - iadd r0.y, r0.y, l(1) -endloop -ret -// Approximately 60 instruction slots used -#endif - -const BYTE g_pointGS[] = -{ - 68, 88, 66, 67, 83, 238, - 66, 156, 86, 118, 105, 62, - 85, 224, 176, 224, 229, 4, - 226, 151, 1, 0, 0, 0, - 188, 13, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 176, 3, 0, 0, 64, 4, - 0, 0, 44, 5, 0, 0, - 32, 13, 0, 0, 82, 68, - 69, 70, 116, 3, 0, 0, - 1, 0, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 83, 71, 0, 1, 0, 0, - 64, 3, 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, 1, 0, - 0, 0, 99, 111, 110, 115, - 116, 66, 117, 102, 0, 171, - 171, 171, 92, 0, 0, 0, - 1, 0, 0, 0, 128, 0, - 0, 0, 112, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 168, 0, 0, 0, - 0, 0, 0, 0, 100, 2, - 0, 0, 2, 0, 0, 0, - 28, 3, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 103, 80, 97, 114, 97, 109, - 115, 0, 80, 111, 105, 110, - 116, 83, 104, 97, 100, 101, - 114, 67, 111, 110, 115, 116, - 0, 109, 111, 100, 101, 108, - 118, 105, 101, 119, 0, 102, - 108, 111, 97, 116, 52, 120, - 52, 0, 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, 203, 0, - 0, 0, 112, 114, 111, 106, - 101, 99, 116, 105, 111, 110, - 0, 108, 105, 103, 104, 116, - 84, 114, 97, 110, 115, 102, - 111, 114, 109, 0, 99, 111, - 108, 111, 114, 115, 0, 102, - 108, 111, 97, 116, 52, 0, - 1, 0, 3, 0, 1, 0, - 4, 0, 8, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 25, 1, 0, 0, - 115, 104, 97, 100, 111, 119, - 84, 97, 112, 115, 0, 171, - 1, 0, 3, 0, 1, 0, - 4, 0, 12, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 25, 1, 0, 0, - 108, 105, 103, 104, 116, 80, - 111, 115, 0, 102, 108, 111, - 97, 116, 51, 0, 1, 0, - 3, 0, 1, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 125, 1, 0, 0, 95, 112, - 97, 100, 48, 0, 102, 108, - 111, 97, 116, 0, 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, - 174, 1, 0, 0, 108, 105, - 103, 104, 116, 68, 105, 114, - 0, 95, 112, 97, 100, 49, - 0, 112, 111, 105, 110, 116, - 82, 97, 100, 105, 117, 115, - 0, 112, 111, 105, 110, 116, - 83, 99, 97, 108, 101, 0, - 115, 112, 111, 116, 77, 105, - 110, 0, 115, 112, 111, 116, - 77, 97, 120, 0, 109, 111, - 100, 101, 0, 105, 110, 116, - 0, 171, 0, 0, 2, 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, 19, 2, - 0, 0, 95, 112, 97, 100, - 50, 0, 171, 171, 0, 0, - 2, 0, 1, 0, 1, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 19, 2, 0, 0, 193, 0, - 0, 0, 212, 0, 0, 0, - 0, 0, 0, 0, 248, 0, - 0, 0, 212, 0, 0, 0, - 64, 0, 0, 0, 3, 1, - 0, 0, 212, 0, 0, 0, - 128, 0, 0, 0, 18, 1, - 0, 0, 32, 1, 0, 0, - 192, 0, 0, 0, 68, 1, - 0, 0, 80, 1, 0, 0, - 64, 1, 0, 0, 116, 1, - 0, 0, 132, 1, 0, 0, - 0, 2, 0, 0, 168, 1, - 0, 0, 180, 1, 0, 0, - 12, 2, 0, 0, 216, 1, - 0, 0, 132, 1, 0, 0, - 16, 2, 0, 0, 225, 1, - 0, 0, 180, 1, 0, 0, - 28, 2, 0, 0, 231, 1, - 0, 0, 180, 1, 0, 0, - 32, 2, 0, 0, 243, 1, - 0, 0, 180, 1, 0, 0, - 36, 2, 0, 0, 254, 1, - 0, 0, 180, 1, 0, 0, - 40, 2, 0, 0, 6, 2, - 0, 0, 180, 1, 0, 0, - 44, 2, 0, 0, 14, 2, - 0, 0, 24, 2, 0, 0, - 48, 2, 0, 0, 60, 2, - 0, 0, 68, 2, 0, 0, - 64, 2, 0, 0, 5, 0, - 0, 0, 1, 0, 144, 0, - 0, 0, 15, 0, 104, 2, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 176, 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, 54, 46, 51, - 46, 57, 54, 48, 48, 46, - 49, 54, 51, 56, 52, 0, - 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, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 15, 0, 0, - 113, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 1, 1, 0, 0, - 121, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 2, 0, - 0, 0, 1, 1, 0, 0, - 127, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 3, 0, - 0, 0, 15, 15, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 68, 69, 78, - 83, 73, 84, 89, 0, 80, - 72, 65, 83, 69, 0, 86, - 69, 82, 84, 69, 88, 0, - 171, 171, 79, 83, 71, 53, - 228, 0, 0, 0, 7, 0, - 0, 0, 8, 0, 0, 0, - 0, 0, 0, 0, 204, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 0, 0, - 0, 0, 216, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 0, - 0, 0, 0, 0, 0, 0, - 216, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 2, 0, - 0, 0, 15, 0, 0, 0, - 0, 0, 0, 0, 216, 0, - 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, - 15, 0, 0, 0, 0, 0, - 0, 0, 216, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 4, 0, 0, 0, 15, 0, - 0, 0, 0, 0, 0, 0, - 216, 0, 0, 0, 4, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 5, 0, - 0, 0, 15, 0, 0, 0, - 0, 0, 0, 0, 216, 0, - 0, 0, 5, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 6, 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, 171, 171, 171, 83, 72, - 69, 88, 236, 7, 0, 0, - 80, 0, 2, 0, 251, 1, - 0, 0, 106, 8, 0, 1, - 53, 24, 0, 0, 18, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 128, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 128, 63, 0, 0, 128, 63, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 89, 8, 0, 4, 70, 142, - 32, 0, 0, 0, 0, 0, - 36, 0, 0, 0, 95, 0, - 0, 4, 242, 16, 32, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 95, 0, 0, 4, - 18, 16, 32, 0, 1, 0, - 0, 0, 1, 0, 0, 0, - 95, 0, 0, 4, 18, 16, - 32, 0, 1, 0, 0, 0, - 2, 0, 0, 0, 95, 0, - 0, 4, 242, 16, 32, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 104, 0, 0, 2, - 8, 0, 0, 0, 105, 0, - 0, 4, 0, 0, 0, 0, - 6, 0, 0, 0, 4, 0, - 0, 0, 93, 8, 0, 1, - 143, 0, 0, 3, 0, 0, - 17, 0, 0, 0, 0, 0, - 92, 40, 0, 1, 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, 101, 0, 0, 3, - 242, 32, 16, 0, 2, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 3, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 4, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 5, 0, - 0, 0, 101, 0, 0, 3, - 242, 32, 16, 0, 6, 0, - 0, 0, 94, 0, 0, 2, - 4, 0, 0, 0, 54, 0, - 0, 6, 130, 48, 32, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 9, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 56, 0, - 0, 9, 226, 0, 16, 0, - 0, 0, 0, 0, 6, 137, - 32, 0, 0, 0, 0, 0, - 33, 0, 0, 0, 6, 128, - 32, 0, 0, 0, 0, 0, - 34, 0, 0, 0, 50, 0, - 0, 14, 226, 0, 16, 0, - 0, 0, 0, 0, 86, 14, - 16, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 64, 0, 0, - 0, 64, 0, 0, 0, 64, - 6, 25, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 56, 0, 0, 8, 242, 0, - 16, 0, 1, 0, 0, 0, - 166, 10, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 9, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 1, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 8, 0, - 0, 0, 86, 5, 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, 10, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 8, 242, 0, 16, 0, - 1, 0, 0, 0, 70, 14, - 16, 0, 1, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 11, 0, 0, 0, - 56, 0, 0, 9, 242, 0, - 16, 0, 2, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 86, 133, 32, 0, 0, 0, - 0, 0, 33, 0, 0, 0, - 50, 0, 0, 11, 242, 0, - 16, 0, 2, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 6, 128, 32, 0, 0, 0, - 0, 0, 33, 0, 0, 0, - 70, 14, 16, 0, 2, 0, - 0, 0, 50, 0, 0, 11, - 242, 0, 16, 0, 2, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 166, 138, 32, 0, - 0, 0, 0, 0, 33, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 49, 0, - 0, 8, 34, 0, 16, 0, - 0, 0, 0, 0, 10, 16, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 50, 0, 0, 16, 114, 0, - 16, 0, 3, 0, 0, 0, - 6, 16, 32, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 102, 102, 102, 191, - 0, 0, 0, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 205, 204, 204, 61, 205, 204, - 204, 61, 0, 0, 128, 63, - 0, 0, 0, 0, 50, 0, - 0, 16, 114, 0, 16, 0, - 4, 0, 0, 0, 6, 16, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 2, 64, - 0, 0, 102, 102, 102, 191, - 205, 204, 76, 191, 0, 0, - 0, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 128, 63, 0, 0, 128, 63, - 0, 0, 128, 63, 0, 0, - 0, 0, 32, 0, 0, 11, - 194, 0, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, - 2, 0, 0, 0, 6, 128, - 32, 0, 0, 0, 0, 0, - 35, 0, 0, 0, 56, 0, - 0, 8, 130, 0, 16, 0, - 3, 0, 0, 0, 1, 64, - 0, 0, 205, 204, 76, 61, - 58, 16, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 54, 32, 0, 5, 114, 0, - 16, 0, 5, 0, 0, 0, - 246, 15, 16, 0, 3, 0, - 0, 0, 1, 0, 0, 8, - 130, 0, 16, 0, 3, 0, - 0, 0, 1, 64, 0, 0, - 7, 0, 0, 0, 10, 16, - 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 13, 114, 0, 16, 0, - 6, 0, 0, 0, 70, 130, - 32, 6, 0, 0, 0, 0, - 12, 0, 0, 0, 58, 0, - 16, 0, 3, 0, 0, 0, - 70, 130, 32, 6, 0, 0, - 0, 0, 12, 0, 0, 0, - 58, 0, 16, 0, 3, 0, - 0, 0, 50, 0, 0, 19, - 114, 0, 16, 0, 7, 0, - 0, 0, 70, 130, 32, 134, - 65, 0, 0, 0, 0, 0, - 0, 0, 12, 0, 0, 0, - 58, 0, 16, 0, 3, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 64, 0, 0, - 0, 64, 0, 0, 0, 64, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 63, 0, 0, - 128, 63, 0, 0, 0, 0, - 50, 0, 0, 12, 114, 0, - 16, 0, 6, 0, 0, 0, - 70, 2, 16, 0, 7, 0, - 0, 0, 2, 64, 0, 0, - 205, 204, 204, 61, 205, 204, - 204, 61, 205, 204, 204, 61, - 0, 0, 0, 0, 70, 2, - 16, 0, 6, 0, 0, 0, - 55, 0, 0, 9, 114, 0, - 16, 0, 3, 0, 0, 0, - 86, 5, 16, 0, 0, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 70, 2, - 16, 0, 4, 0, 0, 0, - 54, 0, 0, 5, 34, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 0, 48, 0, 0, 1, - 33, 0, 0, 7, 130, 0, - 16, 0, 3, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 4, 0, 0, 0, 3, 0, - 4, 3, 58, 0, 16, 0, - 3, 0, 0, 0, 0, 0, - 0, 11, 50, 0, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 191, - 0, 0, 0, 191, 0, 0, - 0, 0, 0, 0, 0, 0, - 70, 144, 144, 0, 26, 0, - 16, 0, 0, 0, 0, 0, - 50, 0, 0, 10, 50, 0, - 16, 0, 4, 0, 0, 0, - 6, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 4, 0, 0, 0, 70, 16, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 56, 0, - 0, 8, 242, 0, 16, 0, - 7, 0, 0, 0, 86, 5, - 16, 0, 4, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 5, 0, 0, 0, - 50, 0, 0, 10, 242, 0, - 16, 0, 4, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 6, 0, 16, 0, 4, 0, - 0, 0, 70, 14, 16, 0, - 7, 0, 0, 0, 50, 0, - 0, 11, 242, 0, 16, 0, - 4, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 166, 26, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 4, 0, 0, 0, - 50, 0, 0, 11, 242, 0, - 16, 0, 4, 0, 0, 0, - 70, 142, 32, 0, 0, 0, - 0, 0, 7, 0, 0, 0, - 246, 31, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 4, 0, - 0, 0, 0, 0, 0, 9, - 130, 0, 16, 0, 3, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 26, 144, - 144, 128, 65, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 31, 0, 4, 3, - 42, 0, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, - 114, 0, 16, 0, 7, 0, - 0, 0, 70, 2, 16, 0, - 3, 0, 0, 0, 18, 0, - 0, 1, 31, 0, 4, 3, - 58, 0, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 6, - 130, 48, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 5, 0, - 0, 0, 54, 0, 0, 5, - 114, 0, 16, 0, 7, 0, - 0, 0, 70, 2, 16, 0, - 5, 0, 0, 0, 18, 0, - 0, 1, 54, 0, 0, 5, - 114, 0, 16, 0, 7, 0, - 0, 0, 70, 2, 16, 0, - 6, 0, 0, 0, 21, 0, - 0, 1, 21, 0, 0, 1, - 54, 0, 0, 6, 130, 0, - 16, 0, 5, 0, 0, 0, - 58, 48, 32, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 54, 0, 0, 5, 242, 32, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 4, 0, - 0, 0, 54, 0, 0, 6, - 18, 32, 16, 0, 1, 0, - 0, 0, 10, 144, 144, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 54, 0, 0, 5, - 34, 32, 16, 0, 1, 0, - 0, 0, 58, 0, 16, 0, - 3, 0, 0, 0, 54, 0, - 0, 8, 194, 32, 16, 0, - 1, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 54, 0, 0, 5, 242, 32, - 16, 0, 2, 0, 0, 0, - 70, 14, 16, 0, 1, 0, - 0, 0, 54, 0, 0, 5, - 242, 32, 16, 0, 3, 0, - 0, 0, 70, 14, 16, 0, - 2, 0, 0, 0, 54, 0, - 0, 5, 114, 32, 16, 0, - 4, 0, 0, 0, 70, 2, - 16, 0, 7, 0, 0, 0, - 54, 0, 0, 5, 130, 32, - 16, 0, 4, 0, 0, 0, - 58, 0, 16, 0, 5, 0, - 0, 0, 54, 0, 0, 6, - 114, 32, 16, 0, 5, 0, - 0, 0, 70, 18, 32, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 54, 0, 0, 5, - 130, 32, 16, 0, 5, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 54, 0, - 0, 6, 114, 32, 16, 0, - 6, 0, 0, 0, 70, 18, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, - 6, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 0, - 117, 0, 0, 3, 0, 0, - 17, 0, 0, 0, 0, 0, - 30, 0, 0, 7, 34, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 1, 0, 0, 0, 22, 0, - 0, 1, 62, 0, 0, 1, - 83, 84, 65, 84, 148, 0, - 0, 0, 60, 0, 0, 0, - 8, 0, 0, 0, 4, 0, - 0, 0, 11, 0, 0, 0, - 24, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 3, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 3, 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, - 5, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 5, 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 -}; diff --git a/demo/d3d11/shaders/pointPS.hlsl b/demo/d3d11/shaders/pointPS.hlsl deleted file mode 100644 index e8bcaf4..0000000 --- a/demo/d3d11/shaders/pointPS.hlsl +++ /dev/null @@ -1,103 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - PointShaderConst gParams; -}; - -Texture2D<float> shadowTexture : register(t0); // shadow map - -SamplerComparisonState shadowSampler : register(s0); // texture sample used to sample depth from shadow texture in this sample - -float sqr(float x) { return x * x; } - -float shadowSample(float4 gl_TexCoord[6]) -{ - float3 pos = float3(gl_TexCoord[1].xyz / gl_TexCoord[1].w); - //float3 uvw = (pos.xyz * 0.5) + vec3(0.5); - float3 uvw = (pos.xyz * float3(0.5, 0.5, 1.0)) + float3(0.5, 0.5, 0.0); - - // user clip - if (uvw.x < 0.0 || uvw.x > 1.0) - return 1.0; - if (uvw.y < 0.0 || uvw.y > 1.0) - return 1.0; - - float s = 0.0; - float radius = 0.002; - - // flip uv y-coordinate - uvw.y = 1.0f - uvw.y; - - [unroll] - for (int i = 0; i < 8; i++) - { - float2 shadowTaps = gParams.shadowTaps[i].xy; - shadowTaps.y = 1.0f - shadowTaps.y; - - //s += shadow2D(shadowTex, vec3(uvw.xy + shadowTaps[i] * radius, uvw.z)).r; - s += shadowTexture.SampleCmpLevelZero(shadowSampler, uvw.xy + shadowTaps * radius, uvw.z); - } - s /= 8.0; - - return s; -} - -float4 pointPS(PointGeoOut input - //, out float gl_FragDepth : SV_DEPTH -) : SV_TARGET -{ - //gl_FragDepth = 0.0f; - - const float spotMin = gParams.spotMin; - const float spotMax = gParams.spotMax; - - float4 gl_FragColor; - float4 gl_TexCoord[6]; - - [unroll] - for (int i = 0; i < 6; i++) - gl_TexCoord[i] = input.texCoord[i]; - - // calculate normal from texture coordinates - float3 normal; - normal.xy = gl_TexCoord[0].xy * float2(2.0, -2.0) + float2(-1.0, 1.0); - float mag = dot(normal.xy, normal.xy); - if (mag > 1.0) discard; // kill pixels outside circle - normal.z = sqrt(1.0 - mag); - - if (gParams.mode == 2) - { - float alpha = normal.z * gl_TexCoord[3].w; - gl_FragColor.xyz = gl_TexCoord[3].xyz * alpha; - gl_FragColor.w = alpha; - - return gl_FragColor; - } - - // calculate lighting - float shadow = shadowSample(gl_TexCoord); - - float3 lPos = float3(gl_TexCoord[1].xyz / gl_TexCoord[1].w); - float attenuation = max(smoothstep(spotMax, spotMin, dot(lPos.xy, lPos.xy)), 0.05); - - float3 diffuse = float3(0.9, 0.9, 0.9); - float3 reflectance = gl_TexCoord[3].xyz; - - float3 Lo = diffuse * reflectance * max(0.0, sqr(-dot(gl_TexCoord[2].xyz, normal) * 0.5 + 0.5)) * max(0.2, shadow) * attenuation; - - const float tmp = 1.0 / 2.2; - gl_FragColor = float4(pow(abs(Lo), float3(tmp, tmp, tmp)), 1.0); - - /* - const float pointRadius = gParams.pointRadius; - const float4x4 gl_ProjectionMatrix = gParams.projection; - - float3 eyePos = gl_TexCoord[5].xyz + normal * pointRadius; - float4 ndcPos = mul(gl_ProjectionMatrix, float4(eyePos, 1.0)); - ndcPos.z /= ndcPos.w; - gl_FragDepth = ndcPos.z; - */ - - return gl_FragColor; -} diff --git a/demo/d3d11/shaders/pointPS.hlsl.h b/demo/d3d11/shaders/pointPS.hlsl.h deleted file mode 100644 index 843b166..0000000 --- a/demo/d3d11/shaders/pointPS.hlsl.h +++ /dev/null @@ -1,947 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer constBuf -// { -// -// struct PointShaderConst -// { -// -// float4x4 modelview; // Offset: 0 -// float4x4 projection; // Offset: 64 -// float4x4 lightTransform; // Offset: 128 -// float4 colors[8]; // Offset: 192 -// float4 shadowTaps[12]; // Offset: 320 -// float3 lightPos; // Offset: 512 -// float _pad0; // Offset: 524 -// float3 lightDir; // Offset: 528 -// float _pad1; // Offset: 540 -// float pointRadius; // Offset: 544 -// float pointScale; // Offset: 548 -// float spotMin; // Offset: 552 -// float spotMax; // Offset: 556 -// int mode; // Offset: 560 -// int _pad2[3]; // Offset: 576 -// -// } gParams; // Offset: 0 Size: 612 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// shadowSampler sampler_c NA NA 0 1 -// shadowTexture texture float 2d 0 1 -// constBuf cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_POSITION 0 xyzw 0 POS float -// TEXCOORD 0 xyzw 1 NONE float xy -// TEXCOORD 1 xyzw 2 NONE float xyzw -// TEXCOORD 2 xyzw 3 NONE float xyz -// TEXCOORD 3 xyzw 4 NONE float xyzw -// TEXCOORD 4 xyzw 5 NONE float -// TEXCOORD 5 xyzw 6 NONE float -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// SV_TARGET 0 xyzw 0 TARGET float xyzw -// -ps_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[36], immediateIndexed -dcl_sampler s0, mode_comparison -dcl_resource_texture2d (float,float,float,float) t0 -dcl_input_ps linear v1.xy -dcl_input_ps linear v2.xyzw -dcl_input_ps linear v3.xyz -dcl_input_ps linear v4.xyzw -dcl_output o0.xyzw -dcl_temps 4 -mad r0.xy, v1.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000) -dp2 r0.x, r0.xyxx, r0.xyxx -lt r0.y, l(1.000000), r0.x -discard_nz r0.y -add r0.x, -r0.x, l(1.000000) -sqrt r0.z, r0.x -ieq r0.w, cb0[35].x, l(2) -if_nz r0.w - mul r0.w, r0.z, v4.w - mul o0.xyz, r0.wwww, v4.xyzx - mov o0.w, r0.w - ret -endif -div r1.xyz, v2.xyzx, v2.wwww -mad r2.xyz, r1.xyzx, l(0.500000, 0.500000, 1.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000) -lt r0.w, r2.x, l(0.000000) -lt r1.z, l(1.000000), r2.x -or r0.w, r0.w, r1.z -if_z r0.w - lt r0.w, r2.y, l(0.000000) - lt r1.z, l(1.000000), r2.y - or r0.w, r0.w, r1.z - if_z r0.w - add r0.w, -cb0[20].y, l(1.000000) - mul r3.x, cb0[20].x, l(0.002000) - mul r3.y, r0.w, l(0.002000) - add r2.w, -r2.y, l(1.000000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r0.w, r1.zwzz, t0.xxxx, s0, r2.z - add r1.z, -cb0[21].y, l(1.000000) - mul r3.x, cb0[21].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - add r1.z, -cb0[22].y, l(1.000000) - mul r3.x, cb0[22].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - add r1.z, -cb0[23].y, l(1.000000) - mul r3.x, cb0[23].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - add r1.z, -cb0[24].y, l(1.000000) - mul r3.x, cb0[24].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - add r1.z, -cb0[25].y, l(1.000000) - mul r3.x, cb0[25].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - add r1.z, -cb0[26].y, l(1.000000) - mul r3.x, cb0[26].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - add r1.z, -cb0[27].y, l(1.000000) - mul r3.x, cb0[27].x, l(0.002000) - mul r3.y, r1.z, l(0.002000) - add r1.zw, r2.xxxw, r3.xxxy - sample_c_lz_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.xxxx, s0, r2.z - add r0.w, r0.w, r1.z - mul r0.w, r0.w, l(0.125000) - else - mov r0.w, l(1.000000) - endif -else - mov r0.w, l(1.000000) -endif -dp2 r1.x, r1.xyxx, r1.xyxx -add r1.y, -cb0[34].w, cb0[34].z -add r1.x, r1.x, -cb0[34].w -div r1.y, l(1.000000, 1.000000, 1.000000, 1.000000), r1.y -mul_sat r1.x, r1.y, r1.x -mad r1.y, r1.x, l(-2.000000), l(3.000000) -mul r1.x, r1.x, r1.x -mul r1.x, r1.x, r1.y -max r1.x, r1.x, l(0.050000) -mul r1.yzw, v4.xxyz, l(0.000000, 0.900000, 0.900000, 0.900000) -mad r0.xy, v1.xyxx, l(2.000000, -2.000000, 0.000000, 0.000000), l(-1.000000, 1.000000, 0.000000, 0.000000) -dp3 r0.x, v3.xyzx, r0.xyzx -mad r0.x, r0.x, l(-0.500000), l(0.500000) -mul r0.x, r0.x, r0.x -mul r0.xyz, r0.xxxx, r1.yzwy -max r0.w, r0.w, l(0.200000) -mul r0.xyz, r0.wwww, r0.xyzx -mul r0.xyz, r1.xxxx, r0.xyzx -log r0.xyz, |r0.xyzx| -mul r0.xyz, r0.xyzx, l(0.454545, 0.454545, 0.454545, 0.000000) -exp o0.xyz, r0.xyzx -mov o0.w, l(1.000000) -ret -// Approximately 101 instruction slots used -#endif - -const BYTE g_pointPS[] = -{ - 68, 88, 66, 67, 43, 46, - 192, 8, 211, 105, 212, 151, - 103, 8, 148, 62, 30, 192, - 144, 175, 1, 0, 0, 0, - 244, 17, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 12, 4, 0, 0, 220, 4, - 0, 0, 16, 5, 0, 0, - 88, 17, 0, 0, 82, 68, - 69, 70, 208, 3, 0, 0, - 1, 0, 0, 0, 196, 0, - 0, 0, 3, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 255, 255, 0, 1, 0, 0, - 156, 3, 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, - 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, 3, 0, - 0, 0, 170, 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, - 1, 0, 0, 0, 184, 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, 1, 0, 0, 0, - 115, 104, 97, 100, 111, 119, - 83, 97, 109, 112, 108, 101, - 114, 0, 115, 104, 97, 100, - 111, 119, 84, 101, 120, 116, - 117, 114, 101, 0, 99, 111, - 110, 115, 116, 66, 117, 102, - 0, 171, 171, 171, 184, 0, - 0, 0, 1, 0, 0, 0, - 220, 0, 0, 0, 112, 2, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4, 1, - 0, 0, 0, 0, 0, 0, - 100, 2, 0, 0, 2, 0, - 0, 0, 120, 3, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 103, 80, 97, 114, - 97, 109, 115, 0, 80, 111, - 105, 110, 116, 83, 104, 97, - 100, 101, 114, 67, 111, 110, - 115, 116, 0, 109, 111, 100, - 101, 108, 118, 105, 101, 119, - 0, 102, 108, 111, 97, 116, - 52, 120, 52, 0, 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, - 39, 1, 0, 0, 112, 114, - 111, 106, 101, 99, 116, 105, - 111, 110, 0, 108, 105, 103, - 104, 116, 84, 114, 97, 110, - 115, 102, 111, 114, 109, 0, - 99, 111, 108, 111, 114, 115, - 0, 102, 108, 111, 97, 116, - 52, 0, 1, 0, 3, 0, - 1, 0, 4, 0, 8, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 117, 1, - 0, 0, 115, 104, 97, 100, - 111, 119, 84, 97, 112, 115, - 0, 171, 1, 0, 3, 0, - 1, 0, 4, 0, 12, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 117, 1, - 0, 0, 108, 105, 103, 104, - 116, 80, 111, 115, 0, 102, - 108, 111, 97, 116, 51, 0, - 1, 0, 3, 0, 1, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 217, 1, 0, 0, - 95, 112, 97, 100, 48, 0, - 102, 108, 111, 97, 116, 0, - 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, 10, 2, 0, 0, - 108, 105, 103, 104, 116, 68, - 105, 114, 0, 95, 112, 97, - 100, 49, 0, 112, 111, 105, - 110, 116, 82, 97, 100, 105, - 117, 115, 0, 112, 111, 105, - 110, 116, 83, 99, 97, 108, - 101, 0, 115, 112, 111, 116, - 77, 105, 110, 0, 115, 112, - 111, 116, 77, 97, 120, 0, - 109, 111, 100, 101, 0, 105, - 110, 116, 0, 171, 0, 0, - 2, 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, - 111, 2, 0, 0, 95, 112, - 97, 100, 50, 0, 171, 171, - 0, 0, 2, 0, 1, 0, - 1, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 111, 2, 0, 0, - 29, 1, 0, 0, 48, 1, - 0, 0, 0, 0, 0, 0, - 84, 1, 0, 0, 48, 1, - 0, 0, 64, 0, 0, 0, - 95, 1, 0, 0, 48, 1, - 0, 0, 128, 0, 0, 0, - 110, 1, 0, 0, 124, 1, - 0, 0, 192, 0, 0, 0, - 160, 1, 0, 0, 172, 1, - 0, 0, 64, 1, 0, 0, - 208, 1, 0, 0, 224, 1, - 0, 0, 0, 2, 0, 0, - 4, 2, 0, 0, 16, 2, - 0, 0, 12, 2, 0, 0, - 52, 2, 0, 0, 224, 1, - 0, 0, 16, 2, 0, 0, - 61, 2, 0, 0, 16, 2, - 0, 0, 28, 2, 0, 0, - 67, 2, 0, 0, 16, 2, - 0, 0, 32, 2, 0, 0, - 79, 2, 0, 0, 16, 2, - 0, 0, 36, 2, 0, 0, - 90, 2, 0, 0, 16, 2, - 0, 0, 40, 2, 0, 0, - 98, 2, 0, 0, 16, 2, - 0, 0, 44, 2, 0, 0, - 106, 2, 0, 0, 116, 2, - 0, 0, 48, 2, 0, 0, - 152, 2, 0, 0, 160, 2, - 0, 0, 64, 2, 0, 0, - 5, 0, 0, 0, 1, 0, - 144, 0, 0, 0, 15, 0, - 196, 2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 12, 1, 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, 54, - 46, 51, 46, 57, 54, 48, - 48, 46, 49, 54, 51, 56, - 52, 0, 171, 171, 73, 83, - 71, 78, 200, 0, 0, 0, - 7, 0, 0, 0, 8, 0, - 0, 0, 176, 0, 0, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 15, 0, - 0, 0, 188, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 15, 3, - 0, 0, 188, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 2, 0, 0, 0, 15, 15, - 0, 0, 188, 0, 0, 0, - 2, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 15, 7, - 0, 0, 188, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 4, 0, 0, 0, 15, 15, - 0, 0, 188, 0, 0, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 5, 0, 0, 0, 15, 0, - 0, 0, 188, 0, 0, 0, - 5, 0, 0, 0, 0, 0, - 0, 0, 3, 0, 0, 0, - 6, 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, 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, 69, 88, 64, 12, - 0, 0, 80, 0, 0, 0, - 16, 3, 0, 0, 106, 8, - 0, 1, 89, 0, 0, 4, - 70, 142, 32, 0, 0, 0, - 0, 0, 36, 0, 0, 0, - 90, 8, 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, 98, 16, - 0, 3, 242, 16, 16, 0, - 2, 0, 0, 0, 98, 16, - 0, 3, 114, 16, 16, 0, - 3, 0, 0, 0, 98, 16, - 0, 3, 242, 16, 16, 0, - 4, 0, 0, 0, 101, 0, - 0, 3, 242, 32, 16, 0, - 0, 0, 0, 0, 104, 0, - 0, 2, 4, 0, 0, 0, - 50, 0, 0, 15, 50, 0, - 16, 0, 0, 0, 0, 0, - 70, 16, 16, 0, 1, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 64, 0, 0, - 0, 192, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 191, - 0, 0, 128, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, - 70, 0, 16, 0, 0, 0, - 0, 0, 70, 0, 16, 0, - 0, 0, 0, 0, 49, 0, - 0, 7, 34, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 10, 0, 16, 0, 0, 0, - 0, 0, 13, 0, 4, 3, - 26, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 0, 8, - 18, 0, 16, 0, 0, 0, - 0, 0, 10, 0, 16, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 75, 0, - 0, 5, 66, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 32, 0, 0, 8, 130, 0, - 16, 0, 0, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 35, 0, 0, 0, - 1, 64, 0, 0, 2, 0, - 0, 0, 31, 0, 4, 3, - 58, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 130, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 0, 0, 0, 0, 58, 16, - 16, 0, 4, 0, 0, 0, - 56, 0, 0, 7, 114, 32, - 16, 0, 0, 0, 0, 0, - 246, 15, 16, 0, 0, 0, - 0, 0, 70, 18, 16, 0, - 4, 0, 0, 0, 54, 0, - 0, 5, 130, 32, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 62, 0, 0, 1, 21, 0, - 0, 1, 14, 0, 0, 7, - 114, 0, 16, 0, 1, 0, - 0, 0, 70, 18, 16, 0, - 2, 0, 0, 0, 246, 31, - 16, 0, 2, 0, 0, 0, - 50, 0, 0, 15, 114, 0, - 16, 0, 2, 0, 0, 0, - 70, 2, 16, 0, 1, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 63, 0, 0, - 0, 63, 0, 0, 128, 63, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 49, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 10, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 49, 0, - 0, 7, 66, 0, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 10, 0, 16, 0, 2, 0, - 0, 0, 60, 0, 0, 7, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 1, 0, 0, 0, - 31, 0, 0, 3, 58, 0, - 16, 0, 0, 0, 0, 0, - 49, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 0, 16, 0, 2, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 0, 0, 49, 0, - 0, 7, 66, 0, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 26, 0, 16, 0, 2, 0, - 0, 0, 60, 0, 0, 7, - 130, 0, 16, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 1, 0, 0, 0, - 31, 0, 0, 3, 58, 0, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 130, 0, - 16, 0, 0, 0, 0, 0, - 26, 128, 32, 128, 65, 0, - 0, 0, 0, 0, 0, 0, - 20, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 56, 0, 0, 8, 18, 0, - 16, 0, 3, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 20, 0, 0, 0, - 1, 64, 0, 0, 111, 18, - 3, 59, 56, 0, 0, 7, - 34, 0, 16, 0, 3, 0, - 0, 0, 58, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 0, 0, 0, 8, 130, 0, - 16, 0, 2, 0, 0, 0, - 26, 0, 16, 128, 65, 0, - 0, 0, 2, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 0, 0, 0, 7, - 194, 0, 16, 0, 1, 0, - 0, 0, 6, 12, 16, 0, - 2, 0, 0, 0, 6, 4, - 16, 0, 3, 0, 0, 0, - 71, 0, 0, 141, 194, 0, - 0, 128, 67, 85, 21, 0, - 130, 0, 16, 0, 0, 0, - 0, 0, 230, 10, 16, 0, - 1, 0, 0, 0, 6, 112, - 16, 0, 0, 0, 0, 0, - 0, 96, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 2, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 21, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 21, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, - 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, - 6, 112, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 2, 0, 0, 0, - 0, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 22, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, - 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, - 6, 112, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 2, 0, 0, 0, - 0, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 23, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 23, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, - 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, - 6, 112, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 2, 0, 0, 0, - 0, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 24, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 24, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, - 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, - 6, 112, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 2, 0, 0, 0, - 0, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 25, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 25, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, - 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, - 6, 112, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 2, 0, 0, 0, - 0, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 26, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 26, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, - 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, - 6, 112, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 2, 0, 0, 0, - 0, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 0, 0, - 0, 9, 66, 0, 16, 0, - 1, 0, 0, 0, 26, 128, - 32, 128, 65, 0, 0, 0, - 0, 0, 0, 0, 27, 0, - 0, 0, 1, 64, 0, 0, - 0, 0, 128, 63, 56, 0, - 0, 8, 18, 0, 16, 0, - 3, 0, 0, 0, 10, 128, - 32, 0, 0, 0, 0, 0, - 27, 0, 0, 0, 1, 64, - 0, 0, 111, 18, 3, 59, - 56, 0, 0, 7, 34, 0, - 16, 0, 3, 0, 0, 0, - 42, 0, 16, 0, 1, 0, - 0, 0, 1, 64, 0, 0, - 111, 18, 3, 59, 0, 0, - 0, 7, 194, 0, 16, 0, - 1, 0, 0, 0, 6, 12, - 16, 0, 2, 0, 0, 0, - 6, 4, 16, 0, 3, 0, - 0, 0, 71, 0, 0, 141, - 194, 0, 0, 128, 67, 85, - 21, 0, 66, 0, 16, 0, - 1, 0, 0, 0, 230, 10, - 16, 0, 1, 0, 0, 0, - 6, 112, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 42, 0, - 16, 0, 2, 0, 0, 0, - 0, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 42, 0, 16, 0, - 1, 0, 0, 0, 56, 0, - 0, 7, 130, 0, 16, 0, - 0, 0, 0, 0, 58, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 62, 18, 0, 0, 1, - 54, 0, 0, 5, 130, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 128, 63, 21, 0, 0, 1, - 18, 0, 0, 1, 54, 0, - 0, 5, 130, 0, 16, 0, - 0, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 63, - 21, 0, 0, 1, 15, 0, - 0, 7, 18, 0, 16, 0, - 1, 0, 0, 0, 70, 0, - 16, 0, 1, 0, 0, 0, - 70, 0, 16, 0, 1, 0, - 0, 0, 0, 0, 0, 10, - 34, 0, 16, 0, 1, 0, - 0, 0, 58, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 34, 0, 0, 0, - 42, 128, 32, 0, 0, 0, - 0, 0, 34, 0, 0, 0, - 0, 0, 0, 9, 18, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 58, 128, 32, 128, - 65, 0, 0, 0, 0, 0, - 0, 0, 34, 0, 0, 0, - 14, 0, 0, 10, 34, 0, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 128, 63, 0, 0, 128, 63, - 0, 0, 128, 63, 0, 0, - 128, 63, 26, 0, 16, 0, - 1, 0, 0, 0, 56, 32, - 0, 7, 18, 0, 16, 0, - 1, 0, 0, 0, 26, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 50, 0, 0, 9, - 34, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 192, - 1, 64, 0, 0, 0, 0, - 64, 64, 56, 0, 0, 7, - 18, 0, 16, 0, 1, 0, - 0, 0, 10, 0, 16, 0, - 1, 0, 0, 0, 10, 0, - 16, 0, 1, 0, 0, 0, - 56, 0, 0, 7, 18, 0, - 16, 0, 1, 0, 0, 0, - 10, 0, 16, 0, 1, 0, - 0, 0, 26, 0, 16, 0, - 1, 0, 0, 0, 52, 0, - 0, 7, 18, 0, 16, 0, - 1, 0, 0, 0, 10, 0, - 16, 0, 1, 0, 0, 0, - 1, 64, 0, 0, 205, 204, - 76, 61, 56, 0, 0, 10, - 226, 0, 16, 0, 1, 0, - 0, 0, 6, 25, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 102, 102, 102, 63, 102, 102, - 102, 63, 102, 102, 102, 63, - 50, 0, 0, 15, 50, 0, - 16, 0, 0, 0, 0, 0, - 70, 16, 16, 0, 1, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 64, 0, 0, - 0, 192, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 191, - 0, 0, 128, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 16, 0, 0, 7, 18, 0, - 16, 0, 0, 0, 0, 0, - 70, 18, 16, 0, 3, 0, - 0, 0, 70, 2, 16, 0, - 0, 0, 0, 0, 50, 0, - 0, 9, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 0, - 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 191, 1, 64, 0, 0, - 0, 0, 0, 63, 56, 0, - 0, 7, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 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, 150, 7, - 16, 0, 1, 0, 0, 0, - 52, 0, 0, 7, 130, 0, - 16, 0, 0, 0, 0, 0, - 58, 0, 16, 0, 0, 0, - 0, 0, 1, 64, 0, 0, - 205, 204, 76, 62, 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, 56, 0, 0, 7, - 114, 0, 16, 0, 0, 0, - 0, 0, 6, 0, 16, 0, - 1, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, - 47, 0, 0, 6, 114, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 128, 129, 0, - 0, 0, 0, 0, 0, 0, - 56, 0, 0, 10, 114, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 47, 186, 232, 62, 47, 186, - 232, 62, 47, 186, 232, 62, - 0, 0, 0, 0, 25, 0, - 0, 5, 114, 32, 16, 0, - 0, 0, 0, 0, 70, 2, - 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, 148, 0, - 0, 0, 101, 0, 0, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 5, 0, 0, 0, - 75, 0, 0, 0, 1, 0, - 0, 0, 2, 0, 0, 0, - 4, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 8, 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, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 -}; diff --git a/demo/d3d11/shaders/pointVS.hlsl b/demo/d3d11/shaders/pointVS.hlsl deleted file mode 100644 index 6ab4b6c..0000000 --- a/demo/d3d11/shaders/pointVS.hlsl +++ /dev/null @@ -1,26 +0,0 @@ -#include "shaderCommon.h" - -cbuffer constBuf : register(b0) -{ - PointShaderConst gParams; -}; - -PointVertexOut pointVS(PointVertexIn input, uint instance : SV_VertexID) -{ - const float4 gl_Vertex = input.position; - const float4x4 gl_ModelViewMatrix = gParams.modelview; - - float density = input.density; - int phase = input.phase; - - // calculate window-space point size - float4 viewPos = mul(gl_ModelViewMatrix, float4(gl_Vertex.xyz, 1.0)); - - PointVertexOut output; - output.position = viewPos; - output.density = density; - output.phase = phase; - output.vertex = gl_Vertex; - - return output; -} diff --git a/demo/d3d11/shaders/pointVS.hlsl.h b/demo/d3d11/shaders/pointVS.hlsl.h deleted file mode 100644 index b78b3f1..0000000 --- a/demo/d3d11/shaders/pointVS.hlsl.h +++ /dev/null @@ -1,374 +0,0 @@ -#if 0 -// -// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 -// -// -// Buffer Definitions: -// -// cbuffer constBuf -// { -// -// struct PointShaderConst -// { -// -// float4x4 modelview; // Offset: 0 -// float4x4 projection; // Offset: 64 -// float4x4 lightTransform; // Offset: 128 -// float4 colors[8]; // Offset: 192 -// float4 shadowTaps[12]; // Offset: 320 -// float3 lightPos; // Offset: 512 -// float _pad0; // Offset: 524 -// float3 lightDir; // Offset: 528 -// float _pad1; // Offset: 540 -// float pointRadius; // Offset: 544 -// float pointScale; // Offset: 548 -// float spotMin; // Offset: 552 -// float spotMax; // Offset: 556 -// int mode; // Offset: 560 -// int _pad2[3]; // Offset: 576 -// -// } gParams; // Offset: 0 Size: 612 -// -// } -// -// -// Resource Bindings: -// -// Name Type Format Dim Slot Elements -// ------------------------------ ---------- ------- ----------- ---- -------- -// constBuf cbuffer NA NA 0 1 -// -// -// -// Input signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xyzw 0 NONE float xyzw -// DENSITY 0 x 1 NONE float x -// PHASE 0 x 2 NONE int x -// SV_VertexID 0 x 3 VERTID uint -// -// -// Output signature: -// -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------- ------ -// POSITION 0 xyzw 0 NONE float xyzw -// DENSITY 0 x 1 NONE float x -// PHASE 0 x 2 NONE int x -// VERTEX 0 xyzw 3 NONE float xyzw -// -vs_5_0 -dcl_globalFlags refactoringAllowed -dcl_constantbuffer cb0[4], immediateIndexed -dcl_input v0.xyzw -dcl_input v1.x -dcl_input v2.x -dcl_output o0.xyzw -dcl_output o1.x -dcl_output o2.x -dcl_output o3.xyzw -dcl_temps 1 -mul r0.xyzw, v0.yyyy, cb0[1].xyzw -mad r0.xyzw, cb0[0].xyzw, v0.xxxx, r0.xyzw -mad r0.xyzw, cb0[2].xyzw, v0.zzzz, r0.xyzw -add o0.xyzw, r0.xyzw, cb0[3].xyzw -mov o1.x, v1.x -mov o2.x, v2.x -mov o3.xyzw, v0.xyzw -ret -// Approximately 8 instruction slots used -#endif - -const BYTE g_pointVS[] = -{ - 68, 88, 66, 67, 195, 164, - 148, 248, 252, 197, 222, 222, - 84, 139, 94, 6, 43, 78, - 110, 120, 1, 0, 0, 0, - 192, 6, 0, 0, 5, 0, - 0, 0, 52, 0, 0, 0, - 176, 3, 0, 0, 68, 4, - 0, 0, 212, 4, 0, 0, - 36, 6, 0, 0, 82, 68, - 69, 70, 116, 3, 0, 0, - 1, 0, 0, 0, 104, 0, - 0, 0, 1, 0, 0, 0, - 60, 0, 0, 0, 0, 5, - 254, 255, 0, 1, 0, 0, - 64, 3, 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, 1, 0, - 0, 0, 99, 111, 110, 115, - 116, 66, 117, 102, 0, 171, - 171, 171, 92, 0, 0, 0, - 1, 0, 0, 0, 128, 0, - 0, 0, 112, 2, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 168, 0, 0, 0, - 0, 0, 0, 0, 100, 2, - 0, 0, 2, 0, 0, 0, - 28, 3, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 103, 80, 97, 114, 97, 109, - 115, 0, 80, 111, 105, 110, - 116, 83, 104, 97, 100, 101, - 114, 67, 111, 110, 115, 116, - 0, 109, 111, 100, 101, 108, - 118, 105, 101, 119, 0, 102, - 108, 111, 97, 116, 52, 120, - 52, 0, 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, 203, 0, - 0, 0, 112, 114, 111, 106, - 101, 99, 116, 105, 111, 110, - 0, 108, 105, 103, 104, 116, - 84, 114, 97, 110, 115, 102, - 111, 114, 109, 0, 99, 111, - 108, 111, 114, 115, 0, 102, - 108, 111, 97, 116, 52, 0, - 1, 0, 3, 0, 1, 0, - 4, 0, 8, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 25, 1, 0, 0, - 115, 104, 97, 100, 111, 119, - 84, 97, 112, 115, 0, 171, - 1, 0, 3, 0, 1, 0, - 4, 0, 12, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 25, 1, 0, 0, - 108, 105, 103, 104, 116, 80, - 111, 115, 0, 102, 108, 111, - 97, 116, 51, 0, 1, 0, - 3, 0, 1, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 125, 1, 0, 0, 95, 112, - 97, 100, 48, 0, 102, 108, - 111, 97, 116, 0, 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, - 174, 1, 0, 0, 108, 105, - 103, 104, 116, 68, 105, 114, - 0, 95, 112, 97, 100, 49, - 0, 112, 111, 105, 110, 116, - 82, 97, 100, 105, 117, 115, - 0, 112, 111, 105, 110, 116, - 83, 99, 97, 108, 101, 0, - 115, 112, 111, 116, 77, 105, - 110, 0, 115, 112, 111, 116, - 77, 97, 120, 0, 109, 111, - 100, 101, 0, 105, 110, 116, - 0, 171, 0, 0, 2, 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, 19, 2, - 0, 0, 95, 112, 97, 100, - 50, 0, 171, 171, 0, 0, - 2, 0, 1, 0, 1, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 19, 2, 0, 0, 193, 0, - 0, 0, 212, 0, 0, 0, - 0, 0, 0, 0, 248, 0, - 0, 0, 212, 0, 0, 0, - 64, 0, 0, 0, 3, 1, - 0, 0, 212, 0, 0, 0, - 128, 0, 0, 0, 18, 1, - 0, 0, 32, 1, 0, 0, - 192, 0, 0, 0, 68, 1, - 0, 0, 80, 1, 0, 0, - 64, 1, 0, 0, 116, 1, - 0, 0, 132, 1, 0, 0, - 0, 2, 0, 0, 168, 1, - 0, 0, 180, 1, 0, 0, - 12, 2, 0, 0, 216, 1, - 0, 0, 132, 1, 0, 0, - 16, 2, 0, 0, 225, 1, - 0, 0, 180, 1, 0, 0, - 28, 2, 0, 0, 231, 1, - 0, 0, 180, 1, 0, 0, - 32, 2, 0, 0, 243, 1, - 0, 0, 180, 1, 0, 0, - 36, 2, 0, 0, 254, 1, - 0, 0, 180, 1, 0, 0, - 40, 2, 0, 0, 6, 2, - 0, 0, 180, 1, 0, 0, - 44, 2, 0, 0, 14, 2, - 0, 0, 24, 2, 0, 0, - 48, 2, 0, 0, 60, 2, - 0, 0, 68, 2, 0, 0, - 64, 2, 0, 0, 5, 0, - 0, 0, 1, 0, 144, 0, - 0, 0, 15, 0, 104, 2, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 176, 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, 54, 46, 51, - 46, 57, 54, 48, 48, 46, - 49, 54, 51, 56, 52, 0, - 171, 171, 73, 83, 71, 78, - 140, 0, 0, 0, 4, 0, - 0, 0, 8, 0, 0, 0, - 104, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 15, 0, 0, - 113, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 1, 0, - 0, 0, 1, 1, 0, 0, - 121, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 2, 0, - 0, 0, 1, 1, 0, 0, - 127, 0, 0, 0, 0, 0, - 0, 0, 6, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 80, 79, 83, 73, 84, 73, - 79, 78, 0, 68, 69, 78, - 83, 73, 84, 89, 0, 80, - 72, 65, 83, 69, 0, 83, - 86, 95, 86, 101, 114, 116, - 101, 120, 73, 68, 0, 171, - 79, 83, 71, 78, 136, 0, - 0, 0, 4, 0, 0, 0, - 8, 0, 0, 0, 104, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 113, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 1, 14, 0, 0, 121, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 2, 0, 0, 0, - 1, 14, 0, 0, 127, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 3, 0, 0, 0, - 15, 0, 0, 0, 80, 79, - 83, 73, 84, 73, 79, 78, - 0, 68, 69, 78, 83, 73, - 84, 89, 0, 80, 72, 65, - 83, 69, 0, 86, 69, 82, - 84, 69, 88, 0, 171, 171, - 83, 72, 69, 88, 72, 1, - 0, 0, 80, 0, 1, 0, - 82, 0, 0, 0, 106, 8, - 0, 1, 89, 0, 0, 4, - 70, 142, 32, 0, 0, 0, - 0, 0, 4, 0, 0, 0, - 95, 0, 0, 3, 242, 16, - 16, 0, 0, 0, 0, 0, - 95, 0, 0, 3, 18, 16, - 16, 0, 1, 0, 0, 0, - 95, 0, 0, 3, 18, 16, - 16, 0, 2, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 0, 0, 0, 0, - 101, 0, 0, 3, 18, 32, - 16, 0, 1, 0, 0, 0, - 101, 0, 0, 3, 18, 32, - 16, 0, 2, 0, 0, 0, - 101, 0, 0, 3, 242, 32, - 16, 0, 3, 0, 0, 0, - 104, 0, 0, 2, 1, 0, - 0, 0, 56, 0, 0, 8, - 242, 0, 16, 0, 0, 0, - 0, 0, 86, 21, 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, - 0, 0, 0, 0, 70, 142, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 6, 16, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 50, 0, 0, 10, - 242, 0, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 166, 26, 16, 0, - 0, 0, 0, 0, 70, 14, - 16, 0, 0, 0, 0, 0, - 0, 0, 0, 8, 242, 32, - 16, 0, 0, 0, 0, 0, - 70, 14, 16, 0, 0, 0, - 0, 0, 70, 142, 32, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 54, 0, 0, 5, - 18, 32, 16, 0, 1, 0, - 0, 0, 10, 16, 16, 0, - 1, 0, 0, 0, 54, 0, - 0, 5, 18, 32, 16, 0, - 2, 0, 0, 0, 10, 16, - 16, 0, 2, 0, 0, 0, - 54, 0, 0, 5, 242, 32, - 16, 0, 3, 0, 0, 0, - 70, 30, 16, 0, 0, 0, - 0, 0, 62, 0, 0, 1, - 83, 84, 65, 84, 148, 0, - 0, 0, 8, 0, 0, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 7, 0, 0, 0, - 4, 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, - 3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0 -}; diff --git a/demo/d3d11/shaders/shaderCommon.h b/demo/d3d11/shaders/shaderCommon.h deleted file mode 100644 index 176c97d..0000000 --- a/demo/d3d11/shaders/shaderCommon.h +++ /dev/null @@ -1,237 +0,0 @@ -struct MeshShaderConst -{ - float4x4 modelviewprojection; - float4x4 modelview; - float4x4 objectTransform; - float4x4 lightTransform; - - float4 clipPlane; - float4 fogColor; - float4 color; - float4 secondaryColor; - - float4 shadowTaps[12]; - - float3 lightPos; - float _pad0; - float3 lightDir; - float _pad1; - - float bias; - float expand; - float spotMin; - float spotMax; - - int grid; - int tex; - int colorArray; - int _pad2; -}; - -struct DebugRenderConst -{ - float4x4 modelview; - float4x4 projection; -}; - - -#ifndef EXCLUDE_SHADER_STRUCTS -struct MeshVertexIn -{ - float3 position : POSITION; - float3 normal : NORMAL; - float2 texCoord : TEXCOORD; - float4 color : COLOR; -}; - -struct MeshVertexOut -{ - float4 position : SV_POSITION; - //float3 normal : NORMAL; - //float4 color : COLOR; - float4 texCoord[8] : TEXCOORD; - //float clipDistance[1] : CLIP_DISTANCE; -}; -#endif - -struct PointShaderConst -{ - float4x4 modelview; - float4x4 projection; - float4x4 lightTransform; - - float4 colors[8]; - float4 shadowTaps[12]; - - float3 lightPos; - float _pad0; - float3 lightDir; - float _pad1; - - float pointRadius; // point size in world space - float pointScale; // scale to calculate size in pixels - float spotMin; - float spotMax; - - int mode; - int _pad2[3]; -}; - -#ifndef EXCLUDE_SHADER_STRUCTS -struct PointVertexIn -{ - float4 position : POSITION; - float density : DENSITY; - int phase : PHASE; -}; - -struct PointVertexOut -{ - float4 position : POSITION; - float density : DENSITY; - int phase : PHASE; - float4 vertex : VERTEX; -}; - -struct PointGeoOut -{ - float4 position : SV_POSITION; - float4 texCoord[6] : TEXCOORD; -}; -#endif - -struct FluidShaderConst -{ - float4x4 modelviewprojection; - float4x4 modelview; - float4x4 projection; // ogl projection - float4x4 modelview_inverse; - float4x4 projection_inverse; // ogl inverse projection - - float4 invTexScale; - - float3 invViewport; - float _pad0; - //float3 invProjection; - //float _pad1; - - float blurRadiusWorld; - float blurScale; - float blurFalloff; - int debug; - - float3 lightPos; - float _pad1; - float3 lightDir; - float _pad2; - float4x4 lightTransform; - - float4 color; - float4 clipPosToEye; - - float spotMin; - float spotMax; - float ior; - float _pad3; - - float4 shadowTaps[12]; -}; - -#ifndef EXCLUDE_SHADER_STRUCTS -struct FluidVertexIn -{ - float4 position : POSITION; - float4 q1 : U; - float4 q2 : V; - float4 q3 : W; -}; - -struct FluidVertexOut -{ - float4 position : POSITION; - float4 texCoord[6] : TEXCOORD; -}; - -struct FluidGeoOut -{ - float4 position : SV_POSITION; - float4 texCoord[4] : TEXCOORD; -}; - -struct PassthroughVertexIn -{ - float2 position : POSITION; - float2 texCoord : TEXCOORD; -}; - -struct PassthroughVertexOut -{ - float4 position : SV_POSITION; - float2 texCoord[1] : TEXCOORD; -}; -#endif - - -struct DiffuseShaderConst -{ - float3 lightPos; float pad0; - float3 lightDir; float pad1; - float4x4 lightTransform; - float4 color; - - float4x4 modelView; - float4x4 modelViewProjection; - float4x4 projection; - - float4 shadowTaps[12]; - - float diffusion; - float diffuseRadius; // point size in world space - float diffuseScale; // scale to calculate size in pixels - - float spotMin; - float spotMax; - - float motionBlurScale; - - float pad3; - float pad4; - -}; - -#ifndef EXCLUDE_SHADER_STRUCTS - -struct DiffuseVertexIn -{ - float4 position : POSITION; // lifetime in w - float4 velocity : VELOCITY; -}; - -struct DiffuseVertexOut -{ - float4 worldPos : POSITION; // lifetime in w - float4 ndcPos : NCDPOS; - float4 viewPos : VIEWPOS; - float4 viewVel : VIEWVEL; - - float4 color : COLOR; -}; - -struct DiffuseGeometryOut -{ - float4 clipPos : SV_POSITION; - - float4 worldPos : POSITION; - - float4 viewPos : VIEWPOS; - float4 viewVel : VIEWVEL; - - float4 lightDir : LIGHTDIR; - float4 color : COLOR; - - float4 uv : UV; - -}; - -#endif - diff --git a/demo/d3d11/shadersD3D11.cpp b/demo/d3d11/shadersD3D11.cpp deleted file mode 100644 index 9e1d278..0000000 --- a/demo/d3d11/shadersD3D11.cpp +++ /dev/null @@ -1,1041 +0,0 @@ -#include "core/maths.h" -#include "core/extrude.h" - -#include "shaders.h" - -#include "meshRender.h" -#include "pointRender.h" -#include "fluidRender.h" -#include "diffuseRender.h" -#include "debugLineRender.h" - -#include "shadowMap.h" -#include "renderTarget.h" - -#include "imguiGraph.h" -#include "imguiGraphD3D11.h" - -#include "appD3D11Ctx.h" - -#include <d3d11.h> -#include <d3dcompiler.h> - -#include <cstdlib> - -DebugLineRender gDebugLineRender; -MeshRenderer gMeshRenderer; -PointRenderer gPointRenderer; -DiffuseRenderer gDiffuseRenderer; - -AppGraphCtx* gAppGraphCtx; - -static float gSpotMin = 0.5f; -static float gSpotMax = 1.0f; -float gShadowBias = 0.075f; - -struct RenderContext -{ - RenderContext() - { - memset(&mMeshDrawParams, 0, sizeof(MeshDrawParams)); - } - - MeshDrawParams mMeshDrawParams; - - Matrix44 view; - Matrix44 proj; - - ShadowMap* shadowMap; - GpuMesh* immediateMesh; - - SDL_Window* window; - - int msaaSamples; -}; - -RenderContext gContext; - - -// convert an OpenGL style projection matrix to D3D (clip z range [0, 1]) -Matrix44 ConvertToD3DProjection(const Matrix44& proj) -{ - Matrix44 scale = Matrix44::kIdentity; - scale.columns[2][2] = 0.5f; - - Matrix44 bias = Matrix44::kIdentity; - bias.columns[3][2] = 1.0f; - - return scale*bias*proj; -} - -#define checkDxErrors(err) __checkDxErrors (err, __FILE__, __LINE__) - -inline void __checkDxErrors(HRESULT err, const char *file, const int line) -{ - if (FAILED(err)) - { - char* lpMsgBuf; - - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - err, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)&lpMsgBuf, - 0, NULL); - - fprintf(stdout, "DX Error = %04d \"%s\" from file <%s>, line %i.\n", - err, lpMsgBuf, file, line); - - exit(EXIT_FAILURE); - } -} - -void InitRender(SDL_Window* window, bool fullscreen, int msaaSamples) -{ - // must always have at least one sample - msaaSamples = Max(1, msaaSamples); - - // create app graph context - gAppGraphCtx = AppGraphCtxCreate(0); - - AppGraphCtxInitRenderTarget(gAppGraphCtx, window, fullscreen, msaaSamples); - //gScene = getScene(0); - - float clearVal[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; - AppGraphCtxFrameStart(gAppGraphCtx, clearVal); - - // create imgui, connect to app graph context - - ImguiGraphDesc desc; - desc.device = gAppGraphCtx->m_device; - desc.deviceContext = gAppGraphCtx->m_deviceContext; - desc.winW = gAppGraphCtx->m_winW; - desc.winH = gAppGraphCtx->m_winH; - - imguiGraphInit("../../data/DroidSans.ttf", &desc); - - AppGraphCtxFramePresent(gAppGraphCtx, true); - - gPointRenderer.Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext); - gMeshRenderer.Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext); - gDebugLineRender.Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext); - gDiffuseRenderer.Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext); - - // create a mesh for immediate mode rendering - gContext.immediateMesh = new GpuMesh(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext); - - gContext.window = window; - gContext.msaaSamples = msaaSamples; -} - -void GetRenderDevice(ID3D11Device** device, ID3D11DeviceContext** context) -{ - *device = gAppGraphCtx->m_device; - *context = gAppGraphCtx->m_deviceContext; -} - -void ReshapeRender(SDL_Window* window) -{ - AppGraphCtxReleaseRenderTarget(gAppGraphCtx); - AppGraphCtxInitRenderTarget(gAppGraphCtx, window, false, gContext.msaaSamples); -} - -void DestroyRender() -{ - gDebugLineRender.Destroy(); - gMeshRenderer.Destroy(); - gPointRenderer.Destroy(); - gDiffuseRenderer.Destroy(); - - imguiGraphDestroy(); - - delete gContext.immediateMesh; - - // do this first, since it flushes all GPU work - AppGraphCtxReleaseRenderTarget(gAppGraphCtx); - AppGraphCtxRelease(gAppGraphCtx); - - gAppGraphCtx = nullptr; -} - -void StartFrame(Vec4 clear) -{ - AppGraphCtxFrameStart(gAppGraphCtx, clear); - - MeshDrawParams meshDrawParams; - memset(&meshDrawParams, 0, sizeof(MeshDrawParams)); - meshDrawParams.renderStage = MESH_DRAW_LIGHT; - meshDrawParams.renderMode = MESH_RENDER_SOLID; - meshDrawParams.cullMode = MESH_CULL_BACK; - meshDrawParams.projection = (XMMATRIX)Matrix44::kIdentity; - meshDrawParams.view = (XMMATRIX)Matrix44::kIdentity; - meshDrawParams.model = DirectX::XMMatrixMultiply( - DirectX::XMMatrixScaling(1.0f, 1.0f, 1.0f), - DirectX::XMMatrixTranslation(0.0f, 0.0f, 0.0f) - ); - - gContext.mMeshDrawParams = meshDrawParams; -} - -void FlushFrame() -{ - gAppGraphCtx->m_deviceContext->Flush(); - -} - -void EndFrame() -{ - FlushFrame(); - - ImguiGraphDesc desc; - desc.device = gAppGraphCtx->m_device; - desc.deviceContext = gAppGraphCtx->m_deviceContext; - desc.winW = gAppGraphCtx->m_winW; - desc.winH = gAppGraphCtx->m_winH; - - imguiGraphUpdate(&desc); -} - -void PresentFrame(bool fullsync) -{ - AppGraphCtxFramePresent(gAppGraphCtx, fullsync); - -} - -void ReadFrame(int* backbuffer, int width, int height) -{ - assert(0); -} - -void GetViewRay(int x, int y, Vec3& origin, Vec3& dir) -{ - using namespace DirectX; - - XMVECTOR nearVector = XMVector3Unproject(XMVectorSet(float(x), float(gAppGraphCtx->m_winH-y), 0.0f, 0.0f), 0.0f, 0.0f, (float)gAppGraphCtx->m_winW, (float)gAppGraphCtx->m_winH, 0.0f, 1.0f, (XMMATRIX)gContext.proj, XMMatrixIdentity(), (XMMATRIX)gContext.view); - XMVECTOR farVector = XMVector3Unproject(XMVectorSet(float(x), float(gAppGraphCtx->m_winH-y), 1.0f, 0.0f), 0.0f, 0.0f, (float)gAppGraphCtx->m_winW, (float)gAppGraphCtx->m_winH, 0.0f, 1.0f, (XMMATRIX)gContext.proj, XMMatrixIdentity(), (XMMATRIX)gContext.view); - - origin = Vec3(XMVectorGetX(nearVector), XMVectorGetY(nearVector), XMVectorGetZ(nearVector)); - XMVECTOR tmp = farVector - nearVector; - dir = Normalize(Vec3(XMVectorGetX(tmp), XMVectorGetY(tmp), XMVectorGetZ(tmp))); - -} - -Colour gColors[] = -{ - Colour(0.0f, 0.5f, 1.0f), - Colour(0.797f, 0.354f, 0.000f), - Colour(0.092f, 0.465f, 0.820f), - Colour(0.000f, 0.349f, 0.173f), - Colour(0.875f, 0.782f, 0.051f), - Colour(0.000f, 0.170f, 0.453f), - Colour(0.673f, 0.111f, 0.000f), - Colour(0.612f, 0.194f, 0.394f) -}; - - -void SetFillMode(bool wire) -{ - gContext.mMeshDrawParams.renderMode = wire?MESH_RENDER_WIREFRAME:MESH_RENDER_SOLID; -} - -void SetCullMode(bool enabled) -{ - gContext.mMeshDrawParams.cullMode = enabled?MESH_CULL_BACK:MESH_CULL_NONE; -} - -void SetView(Matrix44 view, Matrix44 projection) -{ - Matrix44 vp = projection*view; - - gContext.mMeshDrawParams.model = (XMMATRIX)Matrix44::kIdentity; - gContext.mMeshDrawParams.view = (XMMATRIX)view; - gContext.mMeshDrawParams.projection = (XMMATRIX)(ConvertToD3DProjection(projection)); - - gContext.view = view; - gContext.proj = ConvertToD3DProjection(projection); -} - - - -FluidRenderer* CreateFluidRenderer(uint32_t width, uint32_t height) -{ - FluidRenderer* renderer = new(_aligned_malloc(sizeof(FluidRenderer), 16)) FluidRenderer(); - renderer->Init(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext, width, height); - - return renderer; -} - -void DestroyFluidRenderer(FluidRenderer* renderer) -{ - renderer->Destroy(); - renderer->~FluidRenderer(); - - _aligned_free(renderer); -} - -FluidRenderBuffers CreateFluidRenderBuffers(int numParticles, bool enableInterop) -{ - FluidRenderBuffers buffers = {}; - buffers.mNumFluidParticles = numParticles; - - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = numParticles*sizeof(Vec4); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - bufDesc.StructureByteStride = 0; - - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mPositionVBO); - - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mAnisotropyVBO[0]); - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mAnisotropyVBO[1]); - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mAnisotropyVBO[2]); - - bufDesc.ByteWidth = numParticles*sizeof(float); - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mDensityVBO); - } - - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = numParticles * sizeof(int); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - bufDesc.StructureByteStride = 0; - - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mIndices); - } - - if (enableInterop) - { - extern NvFlexLibrary* g_flexLib; - - buffers.mPositionBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mPositionVBO, numParticles, sizeof(Vec4)); - buffers.mDensitiesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mDensityVBO, numParticles, sizeof(float)); - buffers.mIndicesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mIndices, numParticles, sizeof(int)); - - buffers.mAnisotropyBuf[0] = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mAnisotropyVBO[0], numParticles, sizeof(Vec4)); - buffers.mAnisotropyBuf[1] = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mAnisotropyVBO[1], numParticles, sizeof(Vec4)); - buffers.mAnisotropyBuf[2] = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mAnisotropyVBO[2], numParticles, sizeof(Vec4)); - } - - return buffers; -} - -void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, NvFlexSolver* solver, bool anisotropy, bool density) -{ - if (!anisotropy) - { - // regular particles - NvFlexGetParticles(solver, buffers.mPositionBuf, buffers.mNumFluidParticles); - } - else - { - // fluid buffers - NvFlexGetSmoothParticles(solver, buffers.mPositionBuf, buffers.mNumFluidParticles); - NvFlexGetAnisotropy(solver, buffers.mAnisotropyBuf[0], buffers.mAnisotropyBuf[1], buffers.mAnisotropyBuf[2]); - } - - if (density) - { - NvFlexGetDensities(solver, buffers.mDensitiesBuf, buffers.mNumFluidParticles); - } - else - { - NvFlexGetPhases(solver, buffers.mDensitiesBuf, buffers.mNumFluidParticles); - } - - NvFlexGetActive(solver, buffers.mIndicesBuf); -} - -void UpdateFluidRenderBuffers(FluidRenderBuffers buffers, Vec4* particles, float* densities, Vec4* anisotropy1, Vec4* anisotropy2, Vec4* anisotropy3, int numParticles, int* indices, int numIndices) -{ - D3D11_MAPPED_SUBRESOURCE res; - - // vertices - if (particles) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mPositionVBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, particles, sizeof(Vec4)*numParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mPositionVBO, 0); - } - - if (anisotropy1) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mAnisotropyVBO[0], 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, anisotropy1, sizeof(Vec4)*numParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mAnisotropyVBO[0], 0); - } - - if (anisotropy2) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mAnisotropyVBO[1], 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, anisotropy2, sizeof(Vec4)*numParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mAnisotropyVBO[1], 0); - } - - if (anisotropy3) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mAnisotropyVBO[2], 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, anisotropy3, sizeof(Vec4)*numParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mAnisotropyVBO[2], 0); - } - - if (densities) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mDensityVBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, densities, sizeof(float)*numParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mDensityVBO, 0); - } - - // indices - if (indices) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mIndices, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, indices, sizeof(int)*numIndices); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mIndices, 0); - } - -} - -void DestroyFluidRenderBuffers(FluidRenderBuffers buffers) -{ - COMRelease(buffers.mPositionVBO); - COMRelease(buffers.mAnisotropyVBO[0]); - COMRelease(buffers.mAnisotropyVBO[1]); - COMRelease(buffers.mAnisotropyVBO[2]); - COMRelease(buffers.mDensityVBO); - COMRelease(buffers.mIndices); - - NvFlexUnregisterD3DBuffer(buffers.mPositionBuf); - NvFlexUnregisterD3DBuffer(buffers.mDensitiesBuf); - NvFlexUnregisterD3DBuffer(buffers.mIndicesBuf); - - NvFlexUnregisterD3DBuffer(buffers.mAnisotropyBuf[0]); - NvFlexUnregisterD3DBuffer(buffers.mAnisotropyBuf[1]); - NvFlexUnregisterD3DBuffer(buffers.mAnisotropyBuf[2]); -} - - -static const int kShadowResolution = 2048; - - -ShadowMap* ShadowCreate() -{ - ShadowMap* shadowMap = new(_aligned_malloc(sizeof(ShadowMap), 16)) ShadowMap(); - shadowMap->init(gAppGraphCtx->m_device, kShadowResolution); - - return shadowMap; -} - -void ShadowDestroy(ShadowMap* map) -{ - map->~ShadowMap(); - _aligned_free(map); -} - -void ShadowBegin(ShadowMap* map) -{ - ShadowMap* shadowMap = map; - shadowMap->bindAndClear(gAppGraphCtx->m_deviceContext); - - gContext.mMeshDrawParams.renderStage = MESH_DRAW_SHADOW; -} - -void ShadowEnd() -{ - AppGraphCtx* context = gAppGraphCtx; - - // reset to main frame buffer - context->m_deviceContext->RSSetViewports(1, &context->m_viewport); - context->m_deviceContext->OMSetRenderTargets(1, &context->m_rtv, context->m_dsv); - context->m_deviceContext->OMSetDepthStencilState(context->m_depthState, 0u); - context->m_deviceContext->ClearDepthStencilView(context->m_dsv, D3D11_CLEAR_DEPTH, 1.0, 0); - - gContext.mMeshDrawParams.renderStage = MESH_DRAW_NULL; - -} - - -struct ShadowParams -{ - DirectX::XMMATRIX lightTransform; - float3 lightPos; - float3 lightDir; - float bias; - float4 shadowTaps[12]; -}; - -void ShadowApply(ShadowParams* params, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, void* shadowTex) -{ - params->lightTransform = (DirectX::XMMATRIX&)(ConvertToD3DProjection(lightTransform)); - params->lightPos = (float3&)lightPos; - params->lightDir = (float3&)Normalize(lightTarget - lightPos); - params->bias = gShadowBias; - - const Vec4 taps[] = - { - Vec2(-0.326212f,-0.40581f), Vec2(-0.840144f,-0.07358f), - Vec2(-0.695914f,0.457137f), Vec2(-0.203345f,0.620716f), - Vec2(0.96234f,-0.194983f), Vec2(0.473434f,-0.480026f), - Vec2(0.519456f,0.767022f), Vec2(0.185461f,-0.893124f), - Vec2(0.507431f,0.064425f), Vec2(0.89642f,0.412458f), - Vec2(-0.32194f,-0.932615f), Vec2(-0.791559f,-0.59771f) - }; - memcpy(params->shadowTaps, taps, sizeof(taps)); - -} - -void BindSolidShader(Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float bias, Vec4 fogColor) -{ - gContext.mMeshDrawParams.renderStage = MESH_DRAW_LIGHT; - - gContext.mMeshDrawParams.grid = 0; - gContext.mMeshDrawParams.spotMin = gSpotMin; - gContext.mMeshDrawParams.spotMax = gSpotMax; - gContext.mMeshDrawParams.fogColor = (float4&)fogColor; - - gContext.mMeshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; - - ShadowParams shadow; - ShadowApply(&shadow, lightPos, lightTarget, lightTransform, shadowMap); - gContext.mMeshDrawParams.lightTransform = shadow.lightTransform; - gContext.mMeshDrawParams.lightDir = shadow.lightDir; - gContext.mMeshDrawParams.lightPos = shadow.lightPos; - gContext.mMeshDrawParams.bias = shadow.bias; - memcpy(gContext.mMeshDrawParams.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); - - gContext.shadowMap = shadowMap; - -} - -void UnbindSolidShader() -{ - gContext.mMeshDrawParams.renderStage = MESH_DRAW_NULL; -} - -void DrawMesh(const Mesh* m, Vec3 color) -{ - if (m) - { - if (m->m_colours.size()) - { - gContext.mMeshDrawParams.colorArray = 1; - gContext.immediateMesh->UpdateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, (Vec4*)&m->m_colours[0], (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces())); - } - else - { - gContext.mMeshDrawParams.colorArray = 0; - gContext.immediateMesh->UpdateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, NULL, (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces())); - } - - gContext.mMeshDrawParams.color = (float4&)color; - gContext.mMeshDrawParams.secondaryColor = (float4&)color; - gContext.mMeshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; - gContext.mMeshDrawParams.shadowMap = gContext.shadowMap; - - gMeshRenderer.Draw(gContext.immediateMesh, &gContext.mMeshDrawParams); - - if (m->m_colours.size()) - gContext.mMeshDrawParams.colorArray = 0; - - } -} - -void DrawCloth(const Vec4* positions, const Vec4* normals, const float* uvs, const int* indices, int numTris, int numPositions, int colorIndex, float expand, bool twosided, bool smooth) -{ - if (!numTris) - return; - - gContext.immediateMesh->UpdateData(positions, normals, NULL, NULL, indices, numPositions, numTris); - - if (twosided) - SetCullMode(false); - - gContext.mMeshDrawParams.bias = 0.0f; - gContext.mMeshDrawParams.expand = expand; - - gContext.mMeshDrawParams.color = (float4&)(gColors[colorIndex + 1] * 1.5f); - gContext.mMeshDrawParams.secondaryColor = (float4&)(gColors[colorIndex] * 1.5f); - gContext.mMeshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; - gContext.mMeshDrawParams.shadowMap = gContext.shadowMap; - - gMeshRenderer.Draw(gContext.immediateMesh, &gContext.mMeshDrawParams); - - if (twosided) - SetCullMode(true); - - gContext.mMeshDrawParams.bias = gShadowBias; - gContext.mMeshDrawParams.expand = 0.0f; - -} - -void DrawRope(Vec4* positions, int* indices, int numIndices, float radius, int color) -{ - if (numIndices < 2) - return; - - std::vector<Vec3> vertices; - std::vector<Vec3> normals; - std::vector<int> triangles; - - // flatten curve - std::vector<Vec3> curve(numIndices); - for (int i = 0; i < numIndices; ++i) - curve[i] = Vec3(positions[indices[i]]); - - const int resolution = 8; - const int smoothing = 3; - - vertices.reserve(resolution*numIndices*smoothing); - normals.reserve(resolution*numIndices*smoothing); - triangles.reserve(numIndices*resolution * 6 * smoothing); - - Extrude(&curve[0], int(curve.size()), vertices, normals, triangles, radius, resolution, smoothing); - - gContext.immediateMesh->UpdateData(&vertices[0], &normals[0], NULL, NULL, &triangles[0], int(vertices.size()), int(triangles.size())/3); - - SetCullMode(false); - - gContext.mMeshDrawParams.color = (float4&)(gColors[color % 8] * 1.5f); - gContext.mMeshDrawParams.secondaryColor = (float4&)(gColors[color % 8] * 1.5f); - gContext.mMeshDrawParams.objectTransform = (float4x4&)Matrix44::kIdentity; - gContext.mMeshDrawParams.shadowMap = gContext.shadowMap; - - gMeshRenderer.Draw(gContext.immediateMesh, &gContext.mMeshDrawParams); - - SetCullMode(true); -} - -void DrawPlane(const Vec4& p, bool color) -{ - std::vector<Vec3> vertices; - std::vector<Vec3> normals; - std::vector<int> indices; - - Vec3 u, v; - BasisFromVector(Vec3(p.x, p.y, p.z), &u, &v); - - Vec3 c = Vec3(p.x, p.y, p.z)*-p.w; - - gContext.mMeshDrawParams.shadowMap = gContext.shadowMap; - - if (color) - gContext.mMeshDrawParams.color = (float4&)(p * 0.5f + Vec4(0.5f, 0.5f, 0.5f, 0.5f)); - - const float kSize = 200.0f; - const int kGrid = 3; - - // draw a grid of quads, otherwise z precision suffers - for (int x = -kGrid; x <= kGrid; ++x) - { - for (int y = -kGrid; y <= kGrid; ++y) - { - Vec3 coff = c + u*float(x)*kSize*2.0f + v*float(y)*kSize*2.0f; - - int indexStart = int(vertices.size()); - - vertices.push_back(Vec3(coff + u*kSize + v*kSize)); - vertices.push_back(Vec3(coff - u*kSize + v*kSize)); - vertices.push_back(Vec3(coff - u*kSize - v*kSize)); - vertices.push_back(Vec3(coff + u*kSize - v*kSize)); - - normals.push_back(Vec3(p.x, p.y, p.z)); - normals.push_back(Vec3(p.x, p.y, p.z)); - normals.push_back(Vec3(p.x, p.y, p.z)); - normals.push_back(Vec3(p.x, p.y, p.z)); - - - indices.push_back(indexStart+0); - indices.push_back(indexStart+1); - indices.push_back(indexStart+2); - - indices.push_back(indexStart+2); - indices.push_back(indexStart+3); - indices.push_back(indexStart+0); - } - } - - gContext.immediateMesh->UpdateData(&vertices[0], &normals[0], NULL, NULL, &indices[0], int(vertices.size()), int(indices.size())/3); - gMeshRenderer.Draw(gContext.immediateMesh, &gContext.mMeshDrawParams); -} - -void DrawPlanes(Vec4* planes, int n, float bias) -{ - gContext.mMeshDrawParams.color = (float4&)Vec4(0.9f, 0.9f, 0.9f, 1.0f); - - gContext.mMeshDrawParams.bias = 0.0f; - gContext.mMeshDrawParams.grid = 1; - gContext.mMeshDrawParams.expand = 0; - - for (int i = 0; i < n; ++i) - { - Vec4 p = planes[i]; - p.w -= bias; - - DrawPlane(p, false); - } - - gContext.mMeshDrawParams.grid = 0; - gContext.mMeshDrawParams.bias = gShadowBias; - -} - -GpuMesh* CreateGpuMesh(const Mesh* m) -{ - GpuMesh* mesh = new GpuMesh(gAppGraphCtx->m_device, gAppGraphCtx->m_deviceContext); - - mesh->UpdateData((Vec3*)&m->m_positions[0], &m->m_normals[0], NULL, NULL, (int*)&m->m_indices[0], m->GetNumVertices(), int(m->GetNumFaces())); - - return mesh; -} - -void DestroyGpuMesh(GpuMesh* m) -{ - delete m; -} - -void DrawGpuMesh(GpuMesh* m, const Matrix44& xform, const Vec3& color) -{ - if (m) - { - MeshDrawParams params = gContext.mMeshDrawParams; - - params.color = (float4&)color; - params.secondaryColor = (float4&)color; - params.objectTransform = (float4x4&)xform; - params.shadowMap = gContext.shadowMap; - - gMeshRenderer.Draw(m, ¶ms); - } -} - -void DrawGpuMeshInstances(GpuMesh* m, const Matrix44* xforms, int n, const Vec3& color) -{ - if (m) - { - gContext.mMeshDrawParams.color = (float4&)color; - gContext.mMeshDrawParams.secondaryColor = (float4&)color; - gContext.mMeshDrawParams.shadowMap = gContext.shadowMap; - - // copy params - MeshDrawParams params = gContext.mMeshDrawParams; - - for (int i = 0; i < n; ++i) - { - params.objectTransform = (float4x4&)xforms[i]; - - gMeshRenderer.Draw(m, ¶ms); - } - } -} - -void DrawPoints(VertexBuffer positions, VertexBuffer colors, IndexBuffer indices, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowTex, bool showDensity) -{ - if (n == 0) - return; - - PointDrawParams params; - - params.renderMode = POINT_RENDER_SOLID; - params.cullMode = POINT_CULL_BACK; - params.model = (XMMATRIX&)Matrix44::kIdentity; - params.view = (XMMATRIX&)gContext.view; - params.projection = (XMMATRIX&)gContext.proj; - - params.pointRadius = radius; - params.pointScale = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); - params.spotMin = gSpotMin; - params.spotMax = gSpotMax; - - int mode = 0; - if (showDensity) - mode = 1; - if (shadowTex == 0) - mode = 2; - params.mode = mode; - - for (int i = 0; i < 8; i++) - params.colors[i] = *((float4*)&gColors[i].r); - - // set shadow parameters - ShadowParams shadow; - ShadowApply(&shadow, lightPos, lightTarget, lightTransform, shadowTex); - params.lightTransform = shadow.lightTransform; - params.lightDir = shadow.lightDir; - params.lightPos = shadow.lightPos; - memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); - - if (gContext.mMeshDrawParams.renderStage == MESH_DRAW_SHADOW) - { - params.renderStage = POINT_DRAW_SHADOW; - params.mode = 2; - } - else - params.renderStage = POINT_DRAW_LIGHT; - - params.shadowMap = gContext.shadowMap; - - gPointRenderer.Draw(¶ms, positions, colors, indices, n, offset); - -} - -void RenderEllipsoids(FluidRenderer* renderer, FluidRenderBuffers buffers, int n, int offset, float radius, float screenWidth, float screenAspect, float fov, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, Vec4 color, float blur, float ior, bool debug) -{ - if (n == 0) - return; - - FluidDrawParams params; - - params.renderMode = FLUID_RENDER_SOLID; - params.cullMode = FLUID_CULL_BACK; - params.model = (XMMATRIX&)Matrix44::kIdentity; - params.view = (XMMATRIX&)gContext.view; - params.projection = (XMMATRIX&)gContext.proj; - - params.offset = offset; - params.n = n; - params.renderStage = FLUID_DRAW_LIGHT; - - const float viewHeight = tanf(fov / 2.0f); - params.invViewport = float3(1.0f / screenWidth, screenAspect / screenWidth, 1.0f); - params.invProjection = float3(screenAspect * viewHeight, viewHeight, 1.0f); - - params.shadowMap = gContext.shadowMap; - - renderer->mDepthTex.BindAndClear(gAppGraphCtx->m_deviceContext); - - // draw static shapes into depth buffer - //DrawShapes(); - - renderer->DrawEllipsoids(¶ms, &buffers); - - - //--------------------------------------------------------------- - // build smooth depth - - renderer->mDepthSmoothTex.BindAndClear(gAppGraphCtx->m_deviceContext); - - params.blurRadiusWorld = radius * 0.5f; - params.blurScale = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); - params.invTexScale = float4(1.0f / screenAspect, 1.0f, 0.0f, 0.0f); - params.blurFalloff = blur; - params.debug = debug; - - renderer->DrawBlurDepth(¶ms); - - //--------------------------------------------------------------- - // composite - - AppGraphCtx* context = gAppGraphCtx; - - { - context->m_deviceContext->RSSetViewports(1, &context->m_viewport); - context->m_deviceContext->RSSetScissorRects(0, nullptr); - - context->m_deviceContext->OMSetRenderTargets(1, &context->m_rtv, context->m_dsv); - context->m_deviceContext->OMSetDepthStencilState(context->m_depthState, 0u); - - float blendFactor[4] = { 1.0, 1.0, 1.0, 1.0 }; - context->m_deviceContext->OMSetBlendState(context->m_blendState, blendFactor, 0xffff); - } - - params.invTexScale = (float4&)Vec2(1.0f / screenWidth, screenAspect / screenWidth); - params.clipPosToEye = (float4&)Vec2(tanf(fov*0.5f)*screenAspect, tanf(fov*0.5f)); - params.color = (float4&)color; - params.ior = ior; - params.spotMin = gSpotMin; - params.spotMax = gSpotMax; - params.debug = debug; - - params.lightPos = (float3&)lightPos; - params.lightDir = (float3&)-Normalize(lightTarget - lightPos); - params.lightTransform = (XMMATRIX&)(ConvertToD3DProjection(lightTransform)); - - - AppGraphCtxResolveFrame(context); - - - renderer->DrawComposite(¶ms, context->m_resolvedTargetSRV); - - { - AppGraphCtx* context = gAppGraphCtx; - context->m_deviceContext->OMSetBlendState(nullptr, 0, 0xffff); - } -} - -DiffuseRenderBuffers CreateDiffuseRenderBuffers(int numParticles, bool& enableInterop) -{ - DiffuseRenderBuffers buffers = {}; - buffers.mNumDiffuseParticles = numParticles; - if (numParticles > 0) - { - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = numParticles * sizeof(Vec4); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - if (enableInterop) - { - bufDesc.CPUAccessFlags = 0; - bufDesc.Usage = D3D11_USAGE_DEFAULT; - bufDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; - } - - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mDiffusePositionVBO); - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mDiffuseVelocityVBO); - } - - { - D3D11_BUFFER_DESC bufDesc; - bufDesc.ByteWidth = numParticles * sizeof(int); - bufDesc.Usage = D3D11_USAGE_DYNAMIC; - bufDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; - bufDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; - bufDesc.MiscFlags = 0; - if (enableInterop) - { - bufDesc.CPUAccessFlags = 0; - bufDesc.Usage = D3D11_USAGE_DEFAULT; - bufDesc.MiscFlags = D3D11_RESOURCE_MISC_SHARED; - } - - gAppGraphCtx->m_device->CreateBuffer(&bufDesc, NULL, &buffers.mDiffuseIndicesIBO); - } - - if (enableInterop) - { - extern NvFlexLibrary* g_flexLib; - - buffers.mDiffuseIndicesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mDiffuseIndicesIBO, numParticles, sizeof(int)); - buffers.mDiffusePositionsBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mDiffusePositionVBO, numParticles, sizeof(Vec4)); - buffers.mDiffuseVelocitiesBuf = NvFlexRegisterD3DBuffer(g_flexLib, buffers.mDiffuseVelocityVBO, numParticles, sizeof(Vec4)); - - if (buffers.mDiffuseIndicesBuf == nullptr || - buffers.mDiffusePositionsBuf == nullptr || - buffers.mDiffuseVelocitiesBuf == nullptr) - enableInterop = false; - } - } - - return buffers; -} - -void DestroyDiffuseRenderBuffers(DiffuseRenderBuffers buffers) -{ - if (buffers.mNumDiffuseParticles > 0) - { - COMRelease(buffers.mDiffusePositionVBO); - COMRelease(buffers.mDiffuseVelocityVBO); - COMRelease(buffers.mDiffuseIndicesIBO); - - NvFlexUnregisterD3DBuffer(buffers.mDiffuseIndicesBuf); - NvFlexUnregisterD3DBuffer(buffers.mDiffusePositionsBuf); - NvFlexUnregisterD3DBuffer(buffers.mDiffuseVelocitiesBuf); - } -} - -void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, NvFlexSolver* solver) -{ - // diffuse particles - if (buffers.mNumDiffuseParticles) - { - NvFlexGetDiffuseParticles(solver, buffers.mDiffusePositionsBuf, buffers.mDiffuseVelocitiesBuf, buffers.mDiffuseIndicesBuf); - } -} - -void UpdateDiffuseRenderBuffers(DiffuseRenderBuffers buffers, Vec4* diffusePositions, Vec4* diffuseVelocities, int* diffuseIndices, int numDiffuseParticles) -{ - D3D11_MAPPED_SUBRESOURCE res; - - // vertices - if (diffusePositions) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mDiffusePositionVBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, diffusePositions, sizeof(Vec4)*numDiffuseParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mDiffusePositionVBO, 0); - } - - if (diffuseVelocities) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mDiffuseVelocityVBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, diffuseVelocities, sizeof(Vec4)*numDiffuseParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mDiffuseVelocityVBO, 0); - } - - if (diffuseIndices) - { - gAppGraphCtx->m_deviceContext->Map(buffers.mDiffuseIndicesIBO, 0, D3D11_MAP_WRITE_DISCARD, 0, &res); - memcpy(res.pData, diffuseIndices, sizeof(int)*numDiffuseParticles); - gAppGraphCtx->m_deviceContext->Unmap(buffers.mDiffuseIndicesIBO, 0); - } - -} - -void RenderDiffuse(FluidRenderer* render, DiffuseRenderBuffers buffers, int n, float radius, float screenWidth, float screenAspect, float fov, Vec4 color, Vec3 lightPos, Vec3 lightTarget, Matrix44 lightTransform, ShadowMap* shadowMap, float motionBlur, float inscatter, float outscatter, bool shadowEnabled, bool front) -{ - if (n == 0) - return; - - DiffuseDrawParams params; - - params.model = (const XMMATRIX&)Matrix44::kIdentity; - params.view = (const XMMATRIX&)gContext.view; - params.projection = (const XMMATRIX&)gContext.proj; - params.diffuseRadius = screenWidth / screenAspect * (1.0f / (tanf(fov * 0.5f))); - params.diffuseScale = radius; - params.spotMin = gSpotMin; - params.spotMax = gSpotMax; - params.color = float4(1.0f, 1.0f, 1.0f, 1.0f); - params.motionScale = motionBlur; - - // set shadow parameters - ShadowParams shadow; - ShadowApply(&shadow, lightPos, lightTarget, lightTransform, shadowMap); - params.lightTransform = shadow.lightTransform; - params.lightDir = shadow.lightDir; - params.lightPos = shadow.lightPos; - params.shadowMap = gContext.shadowMap; - - memcpy(params.shadowTaps, shadow.shadowTaps, sizeof(shadow.shadowTaps)); - - - gDiffuseRenderer.Draw(¶ms, buffers.mDiffusePositionVBO, buffers.mDiffuseVelocityVBO, buffers.mDiffuseIndicesIBO, n); - - // reset depth stencil state - gAppGraphCtx->m_deviceContext->OMSetDepthStencilState(gAppGraphCtx->m_depthState, 0u); - - -} - - -void BeginLines() -{ - -} - -void DrawLine(const Vec3& p, const Vec3& q, const Vec4& color) -{ - gDebugLineRender.AddLine(p, q, color); -} - -void EndLines() -{ - // draw - Matrix44 projectionViewWorld = ((Matrix44&)(gContext.mMeshDrawParams.projection))*((Matrix44&)(gContext.mMeshDrawParams.view)); - - gDebugLineRender.FlushLines(projectionViewWorld); -} - -void BeginPoints(float size) {} -void DrawPoint(const Vec3& p, const Vec4& color) {} -void EndPoints() {} - diff --git a/demo/d3d11/shadowMap.cpp b/demo/d3d11/shadowMapD3D11.cpp index 403ec59..a824929 100644 --- a/demo/d3d11/shadowMap.cpp +++ b/demo/d3d11/shadowMapD3D11.cpp @@ -8,9 +8,9 @@ * license agreement from NVIDIA CORPORATION is strictly prohibited. */ -#include "shadowMap.h" +#include "shadowMapD3D11.h" -ShadowMap::ShadowMap() +ShadowMapD3D11::ShadowMapD3D11() { } @@ -56,7 +56,7 @@ static D3D11_SHADER_RESOURCE_VIEW_DESC _getSrvDesc(DXGI_FORMAT format) return desc; } -HRESULT ShadowMap::init(ID3D11Device* device, int resolution) +HRESULT ShadowMapD3D11::init(ID3D11Device* device, int resolution) { // set viewport { @@ -122,7 +122,7 @@ HRESULT ShadowMap::init(ID3D11Device* device, int resolution) return S_OK; } -void ShadowMap::bindAndClear(ID3D11DeviceContext* context) +void ShadowMapD3D11::bindAndClear(ID3D11DeviceContext* context) { ID3D11RenderTargetView* ppRtv[1] = { m_backRtv.Get() }; context->OMSetRenderTargets(1, ppRtv, m_depthDsv.Get()); @@ -136,7 +136,7 @@ void ShadowMap::bindAndClear(ID3D11DeviceContext* context) context->ClearDepthStencilView(m_depthDsv.Get(), D3D11_CLEAR_DEPTH, 1.0, 0); } -void ShadowMap::setDefaultLight(FXMVECTOR eye, FXMVECTOR at, FXMVECTOR up) +void ShadowMapD3D11::setDefaultLight(FXMVECTOR eye, FXMVECTOR at, FXMVECTOR up) { float sizeX = 50.0f; float sizeY = 50.0f; @@ -146,7 +146,7 @@ void ShadowMap::setDefaultLight(FXMVECTOR eye, FXMVECTOR at, FXMVECTOR up) setLightMatrices(eye, at, up, sizeX, sizeY, znear, zfar); } -void ShadowMap::setLightMatrices(FXMVECTOR eye, FXMVECTOR lookAt, FXMVECTOR up, float sizeX, float sizeY, float zNear, float zFar) +void ShadowMapD3D11::setLightMatrices(FXMVECTOR eye, FXMVECTOR lookAt, FXMVECTOR up, float sizeX, float sizeY, float zNear, float zFar) { m_lightView = XMMatrixLookAtLH(eye, lookAt, up); diff --git a/demo/d3d11/shadowMap.h b/demo/d3d11/shadowMapD3D11.h index 2ed15ca..1fa79ec 100644 --- a/demo/d3d11/shadowMap.h +++ b/demo/d3d11/shadowMapD3D11.h @@ -20,10 +20,9 @@ using namespace Microsoft::WRL; #define NV_NULL nullptr #define NV_RETURN_ON_FAIL(x) { HRESULT _res = (x); if (FAILED(_res)) { return _res; } } -struct ShadowMap +struct ShadowMapD3D11 { - - ShadowMap(); + ShadowMapD3D11(); HRESULT init(ID3D11Device* device, int resolution); |