summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/23-vectordisplay
diff options
context:
space:
mode:
author Julian Sikorski <belegdol+github@gmail.com>2019-10-13 13:50:38 +0200
committer R. Belmont <rb6502@users.noreply.github.com>2019-10-13 07:50:38 -0400
commit0837e7451a84f95c29dbdb9bd6b8b931fee1635d (patch)
tree626bcbd250a7fbebdf5958a288d2f438d4f9fb5a /3rdparty/bgfx/examples/23-vectordisplay
parentc913ccb59d713ce0b91135520719ac5385e54358 (diff)
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
Diffstat (limited to '3rdparty/bgfx/examples/23-vectordisplay')
-rw-r--r--3rdparty/bgfx/examples/23-vectordisplay/main.cpp17
-rw-r--r--3rdparty/bgfx/examples/23-vectordisplay/makefile2
-rw-r--r--3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.cpp24
-rw-r--r--3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.h10
4 files changed, 26 insertions, 27 deletions
diff --git a/3rdparty/bgfx/examples/23-vectordisplay/main.cpp b/3rdparty/bgfx/examples/23-vectordisplay/main.cpp
index badeeccff9a..cb72564d19f 100644
--- a/3rdparty/bgfx/examples/23-vectordisplay/main.cpp
+++ b/3rdparty/bgfx/examples/23-vectordisplay/main.cpp
@@ -22,23 +22,23 @@ struct PosColorVertex
static void init()
{
- ms_decl
+ ms_layout
.begin()
.add(bgfx::Attrib::Position, 3, bgfx::AttribType::Float)
.add(bgfx::Attrib::Color0, 4, bgfx::AttribType::Uint8, true)
.end();
}
- static bgfx::VertexDecl ms_decl;
+ static bgfx::VertexLayout ms_layout;
};
-bgfx::VertexDecl PosColorVertex::ms_decl;
+bgfx::VertexLayout PosColorVertex::ms_layout;
class ExampleVectorDisplay : public entry::AppI
{
public:
- ExampleVectorDisplay(const char* _name, const char* _description)
- : entry::AppI(_name, _description)
+ ExampleVectorDisplay(const char* _name, const char* _description, const char* _url)
+ : entry::AppI(_name, _description, _url)
{
}
@@ -218,4 +218,9 @@ public:
} // namespace
-ENTRY_IMPLEMENT_MAIN(ExampleVectorDisplay, "23-vectordisplay", "Rendering lines as oldschool vectors.");
+ENTRY_IMPLEMENT_MAIN(
+ ExampleVectorDisplay
+ , "23-vectordisplay"
+ , "Rendering lines as oldschool vectors."
+ , "https://bkaradzic.github.io/bgfx/examples.html#vectordisplay"
+ );
diff --git a/3rdparty/bgfx/examples/23-vectordisplay/makefile b/3rdparty/bgfx/examples/23-vectordisplay/makefile
index 171709170a4..ef9203197d7 100644
--- a/3rdparty/bgfx/examples/23-vectordisplay/makefile
+++ b/3rdparty/bgfx/examples/23-vectordisplay/makefile
@@ -1,5 +1,5 @@
#
-# Copyright 2011-2018 Branimir Karadzic. All rights reserved.
+# Copyright 2011-2019 Branimir Karadzic. All rights reserved.
# License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
#
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 <float.h> // FLT_EPSILON
#include <alloca.h> // 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;
diff --git a/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.h b/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.h
index 3dfe15732d9..3b208b01978 100644
--- a/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.h
+++ b/3rdparty/bgfx/examples/23-vectordisplay/vectordisplay.h
@@ -1,12 +1,6 @@
/*
* 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/
*/
#ifndef __VECTORDISPLAY_H__
@@ -28,7 +22,7 @@ struct PosColorUvVertex
uint32_t m_abgr;
static void init();
- static bgfx::VertexDecl ms_decl;
+ static bgfx::VertexLayout ms_layout;
};
class VectorDisplay
@@ -41,7 +35,7 @@ public:
}
void init(bool _originBottomLeft, float _texelHalf);
-
+
void setup(uint16_t _width, uint16_t _height, uint8_t _view = 2);
void resize(uint16_t _width, uint16_t _height);
void teardown();