trunk/3rdparty/bgfx/examples/common/nanovg/nanovg.cpp
| r245386 | r245387 | |
| 412 | 412 | { |
| 413 | 413 | cint.rgba[i] = c0.rgba[i] * oneminu + c1.rgba[i] * u; |
| 414 | 414 | } |
| 415 | | |
| 415 | |
| 416 | 416 | return cint; |
| 417 | 417 | } |
| 418 | 418 | |
| r245386 | r245387 | |
| 934 | 934 | } |
| 935 | 935 | |
| 936 | 936 | // Transform the current scissor rect into current transform space. |
| 937 | | // If there is difference in rotation, this will be approximation. |
| 937 | // If there is difference in rotation, this will be approximation. |
| 938 | 938 | memcpy(pxform, state->scissor.xform, sizeof(float)*6); |
| 939 | 939 | ex = state->scissor.extent[0]; |
| 940 | 940 | ey = state->scissor.extent[1]; |
| r245386 | r245387 | |
| 1194 | 1194 | { |
| 1195 | 1195 | float x12,y12,x23,y23,x34,y34,x123,y123,x234,y234,x1234,y1234; |
| 1196 | 1196 | float dx,dy,d2,d3; |
| 1197 | | |
| 1197 | |
| 1198 | 1198 | if (level > 10) return; |
| 1199 | 1199 | |
| 1200 | 1200 | x12 = (x1+x2)*0.5f; |
| r245386 | r245387 | |
| 1226 | 1226 | x1234 = (x123+x234)*0.5f; |
| 1227 | 1227 | y1234 = (y123+y234)*0.5f; |
| 1228 | 1228 | |
| 1229 | | nvg__tesselateBezier(ctx, x1,y1, x12,y12, x123,y123, x1234,y1234, level+1, 0); |
| 1230 | | nvg__tesselateBezier(ctx, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1, type); |
| 1229 | nvg__tesselateBezier(ctx, x1,y1, x12,y12, x123,y123, x1234,y1234, level+1, 0); |
| 1230 | nvg__tesselateBezier(ctx, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1, type); |
| 1231 | 1231 | } |
| 1232 | 1232 | |
| 1233 | 1233 | static void nvg__flattenPaths(NVGcontext* ctx) |
| r245386 | r245387 | |
| 1625 | 1625 | |
| 1626 | 1626 | |
| 1627 | 1627 | static int nvg__expandStroke(NVGcontext* ctx, float w, int lineCap, int lineJoin, float miterLimit) |
| 1628 | | { |
| 1628 | { |
| 1629 | 1629 | NVGpathCache* cache = ctx->cache; |
| 1630 | 1630 | NVGvertex* verts; |
| 1631 | 1631 | NVGvertex* dst; |
| r245386 | r245387 | |
| 1889 | 1889 | { |
| 1890 | 1890 | float x0 = ctx->commandx; |
| 1891 | 1891 | float y0 = ctx->commandy; |
| 1892 | | float vals[] = { NVG_BEZIERTO, |
| 1892 | float vals[] = { NVG_BEZIERTO, |
| 1893 | 1893 | x0 + 2.0f/3.0f*(cx - x0), y0 + 2.0f/3.0f*(cy - y0), |
| 1894 | 1894 | x + 2.0f/3.0f*(cx - x), y + 2.0f/3.0f*(cy - y), |
| 1895 | 1895 | x, y }; |
| r245386 | r245387 | |
| 1971 | 1971 | float px = 0, py = 0, ptanx = 0, ptany = 0; |
| 1972 | 1972 | float vals[3 + 5*7 + 100]; |
| 1973 | 1973 | int i, ndivs, nvals; |
| 1974 | | int move = ctx->ncommands > 0 ? NVG_LINETO : NVG_MOVETO; |
| 1974 | int move = ctx->ncommands > 0 ? NVG_LINETO : NVG_MOVETO; |
| 1975 | 1975 | |
| 1976 | 1976 | // Clamp angles |
| 1977 | 1977 | da = a1 - a0; |
| r245386 | r245387 | |
| 2364 | 2364 | } |
| 2365 | 2365 | } |
| 2366 | 2366 | |
| 2367 | | // TODO: add back-end bit to do this just once per frame. |
| 2367 | // TODO: add back-end bit to do this just once per frame. |
| 2368 | 2368 | nvg__flushTextTexture(ctx); |
| 2369 | 2369 | |
| 2370 | 2370 | nvg__renderText(ctx, verts, nverts); |
trunk/3rdparty/bgfx/makefile
| r245386 | r245387 | |
| 217 | 217 | BUILD_PROJECT_DIR=gmake-osx |
| 218 | 218 | BUILD_OUTPUT_DIR=osx64_clang |
| 219 | 219 | BUILD_TOOLS_CONFIG=release64 |
| 220 | BUILD_TOOLS_SUFFIX=Release |
| 220 | 221 | EXE= |
| 221 | 222 | else |
| 222 | 223 | OS=linux |
| 223 | 224 | BUILD_PROJECT_DIR=gmake-linux |
| 224 | 225 | BUILD_OUTPUT_DIR=linux64_gcc |
| 225 | 226 | BUILD_TOOLS_CONFIG=release64 |
| 227 | BUILD_TOOLS_SUFFIX=Release |
| 226 | 228 | EXE= |
| 227 | 229 | endif |
| 228 | 230 | else |
| r245386 | r245387 | |
| 230 | 232 | BUILD_PROJECT_DIR=gmake-mingw-gcc |
| 231 | 233 | BUILD_OUTPUT_DIR=win32_mingw-gcc |
| 232 | 234 | BUILD_TOOLS_CONFIG=release32 |
| 235 | BUILD_TOOLS_SUFFIX=Release |
| 233 | 236 | EXE=.exe |
| 234 | 237 | endif |
| 235 | 238 | |
| 236 | | .build/$(BUILD_OUTPUT_DIR)/bin/shadercRelease$(EXE): .build/projects/$(BUILD_PROJECT_DIR) |
| 239 | tools/bin/$(OS)/shaderc$(EXE): .build/projects/$(BUILD_PROJECT_DIR) |
| 237 | 240 | $(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) -f shaderc.make config=$(BUILD_TOOLS_CONFIG) |
| 241 | $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/shaderc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@) |
| 238 | 242 | |
| 239 | | tools/bin/$(OS)/shaderc$(EXE): .build/$(BUILD_OUTPUT_DIR)/bin/shadercRelease$(EXE) |
| 240 | | $(SILENT) cp $(<) $(@) |
| 241 | | |
| 242 | | .build/$(BUILD_OUTPUT_DIR)/bin/geometrycRelease$(EXE): .build/projects/$(BUILD_PROJECT_DIR) |
| 243 | tools/bin/$(OS)/geometryc$(EXE): .build/projects/$(BUILD_PROJECT_DIR) |
| 243 | 244 | $(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) -f geometryc.make config=$(BUILD_TOOLS_CONFIG) |
| 245 | $(SILENT) cp .build/$(BUILD_OUTPUT_DIR)/bin/geometryc$(BUILD_TOOLS_SUFFIX)$(EXE) $(@) |
| 244 | 246 | |
| 245 | | tools/bin/$(OS)/geometryc$(EXE): .build/$(BUILD_OUTPUT_DIR)/bin/geometrycRelease$(EXE) |
| 246 | | $(SILENT) cp $(<) $(@) |
| 247 | | |
| 248 | 247 | tools: tools/bin/$(OS)/shaderc$(EXE) tools/bin/$(OS)/geometryc$(EXE) |
trunk/3rdparty/bgfx/src/renderer_d3d11.cpp
| r245386 | r245387 | |
| 543 | 543 | g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId; |
| 544 | 544 | ++g_caps.numGPUs; |
| 545 | 545 | |
| 546 | | if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) |
| 547 | | && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) |
| 548 | | && ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) |
| 546 | if (NULL == m_adapter) |
| 549 | 547 | { |
| 550 | | m_adapter = adapter; |
| 551 | | m_adapter->AddRef(); |
| 552 | | m_driverType = D3D_DRIVER_TYPE_UNKNOWN; |
| 553 | | } |
| 548 | if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) |
| 549 | && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) |
| 550 | && ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) |
| 551 | { |
| 552 | m_adapter = adapter; |
| 553 | m_adapter->AddRef(); |
| 554 | m_driverType = D3D_DRIVER_TYPE_UNKNOWN; |
| 555 | } |
| 554 | 556 | |
| 555 | | if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) |
| 556 | | && 0 != strstr(description, "PerfHUD") ) |
| 557 | | { |
| 558 | | m_adapter = adapter; |
| 559 | | m_driverType = D3D_DRIVER_TYPE_REFERENCE; |
| 557 | if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) |
| 558 | && 0 != strstr(description, "PerfHUD") ) |
| 559 | { |
| 560 | m_adapter = adapter; |
| 561 | m_driverType = D3D_DRIVER_TYPE_REFERENCE; |
| 562 | } |
| 560 | 563 | } |
| 561 | 564 | } |
| 562 | 565 | |
| r245386 | r245387 | |
| 696 | 699 | |
| 697 | 700 | m_numWindows = 1; |
| 698 | 701 | |
| 702 | #if !defined(__MINGW32__) |
| 699 | 703 | if (BX_ENABLED(BGFX_CONFIG_DEBUG) ) |
| 700 | 704 | { |
| 701 | 705 | ID3D11InfoQueue* infoQueue; |
| r245386 | r245387 | |
| 727 | 731 | setGraphicsDebuggerPresent(true); |
| 728 | 732 | } |
| 729 | 733 | } |
| 734 | #endif // __MINGW__ |
| 730 | 735 | |
| 731 | 736 | UniformHandle handle = BGFX_INVALID_HANDLE; |
| 732 | 737 | for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii) |
trunk/3rdparty/bgfx/src/renderer_d3d11.h
| r245386 | r245387 | |
| 49 | 49 | # define D3D_FEATURE_LEVEL_11_1 D3D_FEATURE_LEVEL(0xb100) |
| 50 | 50 | #endif // D3D_FEATURE_LEVEL_11_1 |
| 51 | 51 | |
| 52 | #if defined(__MINGW32__) |
| 52 | 53 | // MinGW Linux/Wine missing defines... |
| 53 | | #ifndef D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT |
| 54 | | # define D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT 8 |
| 55 | | #endif // D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT |
| 54 | # ifndef D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT |
| 55 | # define D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT 8 |
| 56 | # endif // D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT |
| 56 | 57 | |
| 57 | | #ifndef D3D11_PS_CS_UAV_REGISTER_COUNT |
| 58 | | # define D3D11_PS_CS_UAV_REGISTER_COUNT 8 |
| 59 | | #endif // D3D11_PS_CS_UAV_REGISTER_COUNT |
| 58 | # ifndef D3D11_PS_CS_UAV_REGISTER_COUNT |
| 59 | # define D3D11_PS_CS_UAV_REGISTER_COUNT 8 |
| 60 | # endif // D3D11_PS_CS_UAV_REGISTER_COUNT |
| 60 | 61 | |
| 61 | | #ifndef D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT |
| 62 | | # define D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT 8 |
| 63 | | #endif |
| 62 | # ifndef D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT |
| 63 | # define D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT 8 |
| 64 | # endif |
| 64 | 65 | |
| 65 | | #ifndef D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT |
| 66 | | # define D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT 8 |
| 67 | | #endif // D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT |
| 66 | # ifndef D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT |
| 67 | # define D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT 8 |
| 68 | # endif // D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT |
| 68 | 69 | |
| 69 | | #ifndef D3D11_APPEND_ALIGNED_ELEMENT |
| 70 | | # define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX |
| 71 | | #endif // D3D11_APPEND_ALIGNED_ELEMENT |
| 70 | # ifndef D3D11_APPEND_ALIGNED_ELEMENT |
| 71 | # define D3D11_APPEND_ALIGNED_ELEMENT UINT32_MAX |
| 72 | # endif // D3D11_APPEND_ALIGNED_ELEMENT |
| 72 | 73 | |
| 74 | # ifndef D3D11_REQ_MAXANISOTROPY |
| 75 | # define D3D11_REQ_MAXANISOTROPY 16 |
| 76 | # endif // D3D11_REQ_MAXANISOTROPY |
| 77 | |
| 78 | # ifndef D3D11_FEATURE_DATA_FORMAT_SUPPORT |
| 79 | typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT |
| 80 | { |
| 81 | DXGI_FORMAT InFormat; |
| 82 | UINT OutFormatSupport; |
| 83 | } D3D11_FEATURE_DATA_FORMAT_SUPPORT; |
| 84 | # endif // D3D11_FEATURE_DATA_FORMAT_SUPPORT |
| 85 | |
| 86 | # ifndef D3D11_FEATURE_DATA_FORMAT_SUPPORT2 |
| 87 | typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT2 |
| 88 | { |
| 89 | DXGI_FORMAT InFormat; |
| 90 | UINT OutFormatSupport2; |
| 91 | } D3D11_FEATURE_DATA_FORMAT_SUPPORT2; |
| 92 | # endif // D3D11_FEATURE_DATA_FORMAT_SUPPORT2 |
| 93 | #endif // __MINGW32__ |
| 94 | |
| 73 | 95 | namespace bgfx { namespace d3d11 |
| 74 | 96 | { |
| 75 | 97 | struct BufferD3D11 |
trunk/3rdparty/bgfx/src/renderer_d3d9.cpp
| r245386 | r245387 | |
| 365 | 365 | D3DADAPTER_IDENTIFIER9 desc; |
| 366 | 366 | HRESULT hr = m_d3d9->GetAdapterIdentifier(ii, 0, &desc); |
| 367 | 367 | if (SUCCEEDED(hr) ) |
| 368 | | { |
| 368 | { |
| 369 | 369 | BX_TRACE("Adapter #%d", ii); |
| 370 | 370 | BX_TRACE("\tDriver: %s", desc.Driver); |
| 371 | 371 | BX_TRACE("\tDescription: %s", desc.Description); |
| r245386 | r245387 | |
| 380 | 380 | g_caps.gpu[ii].vendorId = (uint16_t)desc.VendorId; |
| 381 | 381 | g_caps.gpu[ii].deviceId = (uint16_t)desc.DeviceId; |
| 382 | 382 | |
| 383 | | if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) |
| 384 | | && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) |
| 385 | | && ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) |
| 383 | if (D3DADAPTER_DEFAULT == m_adapter) |
| 386 | 384 | { |
| 387 | | m_adapter = ii; |
| 388 | | } |
| 385 | if ( (BGFX_PCI_ID_NONE != g_caps.vendorId || 0 != g_caps.deviceId) |
| 386 | && (BGFX_PCI_ID_NONE == g_caps.vendorId || desc.VendorId == g_caps.vendorId) |
| 387 | && ( 0 == g_caps.deviceId || desc.DeviceId == g_caps.deviceId) ) |
| 388 | { |
| 389 | m_adapter = ii; |
| 390 | } |
| 389 | 391 | |
| 390 | | #if BGFX_CONFIG_DEBUG_PERFHUD |
| 391 | | if (0 != strstr(desc.Description, "PerfHUD") ) |
| 392 | | { |
| 393 | | m_adapter = ii; |
| 394 | | m_deviceType = D3DDEVTYPE_REF; |
| 392 | if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD) |
| 393 | && 0 != strstr(desc.Description, "PerfHUD")) |
| 394 | { |
| 395 | m_adapter = ii; |
| 396 | m_deviceType = D3DDEVTYPE_REF; |
| 397 | } |
| 395 | 398 | } |
| 396 | | #endif // BGFX_CONFIG_DEBUG_PERFHUD |
| 397 | 399 | } |
| 398 | 400 | } |
| 399 | 401 | |
trunk/3rdparty/bgfx/tools/shaderc/shaderc_dx11.cpp
| r245386 | r245387 | |
| 8 | 8 | #if SHADERC_CONFIG_DIRECT3D11 |
| 9 | 9 | |
| 10 | 10 | #include <d3dcompiler.h> |
| 11 | #include <d3d11shader.h> |
| 11 | 12 | |
| 13 | #ifndef D3D_SVF_USED |
| 14 | # define D3D_SVF_USED 2 |
| 15 | #endif // D3D_SVF_USED |
| 16 | |
| 17 | static const GUID GUID_ID3D11ShaderReflection = { 0x0a233719, 0x3960, 0x4578, { 0x9d, 0x7c, 0x20, 0x3b, 0x8b, 0x1d, 0x9c, 0xc1 } }; |
| 18 | |
| 12 | 19 | struct RemapInputSemantic |
| 13 | 20 | { |
| 14 | 21 | bgfx::Attrib::Enum m_attr; |
| r245386 | r245387 | |
| 202 | 209 | ID3D11ShaderReflection* reflect = NULL; |
| 203 | 210 | hr = D3DReflect(code->GetBufferPointer() |
| 204 | 211 | , code->GetBufferSize() |
| 205 | | , IID_ID3D11ShaderReflection |
| 212 | , GUID_ID3D11ShaderReflection |
| 206 | 213 | , (void**)&reflect |
| 207 | 214 | ); |
| 208 | 215 | if (FAILED(hr) ) |
| r245386 | r245387 | |
| 370 | 377 | ID3DBlob* stripped; |
| 371 | 378 | hr = D3DStripShader(code->GetBufferPointer() |
| 372 | 379 | , code->GetBufferSize() |
| 373 | | , D3DCOMPILER_STRIP_REFLECTION_DATA |
| 380 | , D3DCOMPILER_STRIP_REFLECTION_DATA |
| 374 | 381 | | D3DCOMPILER_STRIP_TEST_BLOBS |
| 375 | 382 | , &stripped |
| 376 | 383 | ); |
| r245386 | r245387 | |
| 437 | 444 | return false; |
| 438 | 445 | } |
| 439 | 446 | |
| 440 | | #endif // SHADERC_CONFIG_DIRECT3D11 |
| | No newline at end of file |
| 447 | #endif // SHADERC_CONFIG_DIRECT3D11 |
trunk/3rdparty/bx/scripts/toolchain.lua
| r245386 | r245387 | |
| 19 | 19 | { "asmjs", "Emscripten/asm.js" }, |
| 20 | 20 | { "freebsd", "FreeBSD" }, |
| 21 | 21 | { "linux-gcc", "Linux (GCC compiler)" }, |
| 22 | { "linux-gcc-5", "Linux (GCC-5 compiler)" }, |
| 22 | 23 | { "linux-clang", "Linux (Clang compiler)" }, |
| 23 | 24 | { "ios-arm", "iOS - ARM" }, |
| 24 | 25 | { "ios-simulator", "iOS - Simulator" }, |
| r245386 | r245387 | |
| 164 | 165 | elseif "linux-gcc" == _OPTIONS["gcc"] then |
| 165 | 166 | location (path.join(_buildDir, "projects", _ACTION .. "-linux")) |
| 166 | 167 | |
| 168 | elseif "linux-gcc-5" == _OPTIONS["gcc"] then |
| 169 | premake.gcc.cc = "gcc-5" |
| 170 | premake.gcc.cxx = "g++-5" |
| 171 | premake.gcc.ar = "ar" |
| 172 | location (path.join(_buildDir, "projects", _ACTION .. "-linux")) |
| 173 | |
| 167 | 174 | elseif "linux-clang" == _OPTIONS["gcc"] then |
| 168 | 175 | premake.gcc.cc = "clang" |
| 169 | 176 | premake.gcc.cxx = "clang++" |
| r245386 | r245387 | |
| 465 | 472 | } |
| 466 | 473 | buildoptions { "-m64" } |
| 467 | 474 | |
| 468 | | configuration { "linux-gcc and not linux-clang" } |
| 475 | configuration { "linux-clang" } |
| 476 | |
| 477 | configuration { "linux-gcc-5" } |
| 469 | 478 | buildoptions { |
| 479 | -- "-fno-omit-frame-pointer", |
| 480 | -- "-fsanitize=address", |
| 481 | -- "-fsanitize=undefined", |
| 482 | -- "-fsanitize=float-divide-by-zero", |
| 483 | -- "-fsanitize=float-cast-overflow", |
| 484 | } |
| 485 | links { |
| 486 | -- "asan", |
| 487 | -- "ubsan", |
| 488 | } |
| 489 | |
| 490 | configuration { "linux-g*" } |
| 491 | buildoptions { |
| 470 | 492 | "-mfpmath=sse", -- force SSE to get 32-bit and 64-bit builds deterministic. |
| 471 | 493 | } |
| 472 | 494 | |
| 473 | | configuration { "linux-clang" } |
| 474 | | |
| 475 | 495 | configuration { "linux-*" } |
| 476 | 496 | buildoptions { |
| 477 | 497 | "-msse2", |
| r245386 | r245387 | |
| 489 | 509 | "-Wl,--gc-sections", |
| 490 | 510 | } |
| 491 | 511 | |
| 492 | | configuration { "linux-gcc", "x32" } |
| 512 | configuration { "linux-g*", "x32" } |
| 493 | 513 | targetdir (path.join(_buildDir, "linux32_gcc/bin")) |
| 494 | 514 | objdir (path.join(_buildDir, "linux32_gcc/obj")) |
| 495 | 515 | libdirs { path.join(_libDir, "lib/linux32_gcc") } |
| r245386 | r245387 | |
| 497 | 517 | "-m32", |
| 498 | 518 | } |
| 499 | 519 | |
| 500 | | configuration { "linux-gcc", "x64" } |
| 520 | configuration { "linux-g*", "x64" } |
| 501 | 521 | targetdir (path.join(_buildDir, "linux64_gcc/bin")) |
| 502 | 522 | objdir (path.join(_buildDir, "linux64_gcc/obj")) |
| 503 | 523 | libdirs { path.join(_libDir, "lib/linux64_gcc") } |