From 0837e7451a84f95c29dbdb9bd6b8b931fee1635d Mon Sep 17 00:00:00 2001 From: Julian Sikorski Date: Sun, 13 Oct 2019 13:50:38 +0200 Subject: WIP: sync bgfx, bx and bimg with latest upstream (#5723) * Sync with bgfx upstream revision b91d0b6 * Sync with bx upstream revision d60912b * Sync with bimg upstream revision bd81f60 * Add astc-codec decoder * Rename VertexDecl to VertexLayout * Rename UniformType enum Int1 to Sampler. * Add NVN stub * Fix unused-const-variable error on macOS * Drop redundant explicit language parameters buildoptions_cpp are only applied to c++ files and buildoptions_objcpp are only applied to objective c++ files. As such, hardcoding -x offers no benefit while preventing overrides (such as one needed by 3rdparty/bgfx/src/renderer_vk.cpp on macOS) from working. * Re-introduce -x c++ in places where C code is compiled as C++ to prevent clang from throwing a warning * Build bgfx as Objective-C++ on macOS It is needed due to included headers * Enable Direct3D12 and Vulkan bgfx rendering backends * Enable building of spirv shaders * Properly escape /c in cmd call * Comment out dx12 bgfx renderer * Honor VERBOSE setting during shaders build * Only invert hlsl shader XYZ_TO_sRGB matrix for opengl * Add spirv shaders * OpenGL ES needs transposed matrix too * Metal needs transposed matrix as well --- .../examples/23-vectordisplay/vectordisplay.cpp | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to '3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp') diff --git a/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp b/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp index e63d156b966..7bface50c0d 100644 --- a/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp +++ b/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp @@ -1,14 +1,14 @@ /* * Copyright 2014 Kai Jourdan. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause - * - * Based on code from Brian Luczkiewicz - * https://github.com/blucz/Vector - * - * Uses the SIMPLEX-Font which is a variant of the Hershey font (public domain) - * http://paulbourke.net/dataformats/hershey/ */ +// Reference(s): +// - Based on code from Brian Luczkiewicz +// https://github.com/blucz/Vector +// - Uses the SIMPLEX-Font which is a variant of the Hershey font (public domain) +// https://web.archive.org/web/20120313001837/http://paulbourke.net/dataformats/hershey/ +// #include // FLT_EPSILON #include // alloca @@ -35,7 +35,7 @@ const int HALF_TEXTURE_SIZE = TEXTURE_SIZE / 2; void PosColorUvVertex::init() { - ms_decl + ms_layout .begin() .add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float) .add(bgfx::Attrib::TexCoord0, 2, bgfx::AttribType::Float) @@ -43,7 +43,7 @@ void PosColorUvVertex::init() .end(); } -bgfx::VertexDecl PosColorUvVertex::ms_decl; +bgfx::VertexLayout PosColorUvVertex::ms_layout; inline float normalizef(float _a) { @@ -94,7 +94,7 @@ void VectorDisplay::setup(uint16_t _width, uint16_t _height, uint8_t _view) m_blitShader = loadProgram("vs_vectordisplay_fb", "fs_vectordisplay_blit"); u_params = bgfx::createUniform("u_params", bgfx::UniformType::Vec4); - s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1); + s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Sampler); genLinetex(); @@ -737,7 +737,7 @@ bool VectorDisplay::setDecaySteps(int _steps) for (int i = 0; i < m_numberDecaySteps; ++i) { - m_vertexBuffers.push_back(bgfx::createDynamicVertexBuffer(MAX_NUMBER_VERTICES, PosColorUvVertex::ms_decl) ); + m_vertexBuffers.push_back(bgfx::createDynamicVertexBuffer(MAX_NUMBER_VERTICES, PosColorUvVertex::ms_layout) ); m_vertexBuffersSize.push_back(0); } @@ -769,10 +769,10 @@ void VectorDisplay::getSize(float* _outWidth, float* _outHeight) void VectorDisplay::screenSpaceQuad(float _textureWidth, float _textureHeight, float _width, float _height) { - if (3 == getAvailTransientVertexBuffer(3, PosColorUvVertex::ms_decl) ) + if (3 == getAvailTransientVertexBuffer(3, PosColorUvVertex::ms_layout) ) { bgfx::TransientVertexBuffer vb; - bgfx::allocTransientVertexBuffer(&vb, 3, PosColorUvVertex::ms_decl); + bgfx::allocTransientVertexBuffer(&vb, 3, PosColorUvVertex::ms_layout); PosColorUvVertex* vertex = (PosColorUvVertex*)vb.data; const float zz = 0.0f; -- cgit v1.2.3-70-g09d2