Skip to content

Instantly share code, notes, and snippets.

void flip() override
{
if (NULL == m_commandBuffer)
{
return;
}
//for (uint32_t ii = 0, num = m_numWindows; ii < num; ++ii)
if (m_numWindows > 0)
{
@attilaz
attilaz / gist:eb629b22346d2d2e3652b965887da215
Last active February 10, 2020 22:16
simd function name changes
# for shuffle should we somehow show that it is handled as 32bitx4
# if we want shuffling with 16bit and 8 bit values...
void simd_shuf_xyAB(Ty _a, Ty _b); -> simd_shuf_v32x4_xyAB ???
void simd_shuf_ABxy(Ty _a, Ty _b);
void simd_shuf_CDzw(Ty _a, Ty _b);
void simd_shuf_zwCD(Ty _a, Ty _b);
void simd_shuf_xAyB(Ty _a, Ty _b);
void simd_shuf_AxBy(Ty _a, Ty _b);
void simd_shuf_zCwD(Ty _a, Ty _b);
void simd_shuf_CzDw(Ty _a, Ty _b);
TextureDescriptor desc = s_renderMtl->m_textureDescriptor;
desc.textureType = _depth > 1 ? MTLTextureType3D : MTLTextureType2D;
desc.pixelFormat = m_ptr.pixelFormat();
desc.width = _rect.m_width;
desc.height = _rect.m_height;
desc.depth = _depth;
desc.mipmapLevelCount = 1;
desc.sampleCount = 1;
desc.arrayLength = 1;
2019-08-11 13:28:40.661225+0200 examplesDebug[11881:276989] [DYMTLInitPlatform] platform initialization successful
2019-08-11 13:28:41.656750+0200 examplesDebug[11881:277026] /Users/attilaz/Documents/githubnew/bgfx/src/bgfx.cpp (3363): BGFX bgfx platform data like window handle or backbuffer is not set, creating headless device.
2019-08-11 13:28:41.656930+0200 examplesDebug[11881:277026] /Users/attilaz/Documents/githubnew/bgfx/src/bgfx.cpp (3394): BGFX Init...
2019-08-11 13:28:41.660797+0200 examplesDebug[11881:277026] /Users/attilaz/Documents/githubnew/bgfx/src/bgfx.cpp (1783): BGFX Application called bgfx::renderFrame directly, not creating render thread.
2019-08-11 13:28:41.660968+0200 examplesDebug[11881:277026] /Users/attilaz/Documents/githubnew/bgfx/src/bgfx.cpp (1799): BGFX Running in multi-threaded mode
2019-08-11 13:28:41.940267+0200 examplesDebug[11881:276833] Metal GPU Frame Capture Enabled
void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) override
{
const TextureMtl& texture = m_textures[_handle.idx];
#if BX_PLATFORM_OSX
BlitCommandEncoder bce = s_renderMtl->getBlitCommandEncoder();
bce.synchronizeTexture(texture.m_ptr, 0, _mip);
endEncoding();
#endif // BX_PLATFORM_OSX
@attilaz
attilaz / gist:bc75cd64ca186caac3fa886ada02a32f
Last active April 14, 2019 17:20
material specification
Storage for materials:
Version A. compact/hardcoded for certain shading types
type: 1 byte (phong=0, pbrMetallicRoughnes=1, pbrSpecularGlossiness=2, ...)
if ( type == 0 )
4 floats diffuseColor
string diffuseTexture
1 byte diffuseTexture texcoord channel
4 bytes diffuseTexture sampler parameters
.....
@attilaz
attilaz / gist:2530b9efd5a10f2395ebe1abd4514e5b
Created January 14, 2019 15:47
#include<string> #include <vector>
This file has been truncated, but you can view the full file.
#line 1 "..\\..\\..\\tools\\shaderc\\shaderc_spirv.cpp"
#line 1 "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.10.25017\\include\\string"
#pragma once
#line 1 "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.10.25017\\include\\istream"
#pragma once
#define BUTTON_ID 1
cButton* btn = new cButton(LOC"PLAY", "images/foo.png");
btn->setPosition(sGuiVec2(100,200));
btn->setScale(2.0f);
btn->setAnchorPoint(sGuiVec2(0,0));
btn->onPressed().addHandler(this, &onButtonPressed);
addChild(btn, 1, BUTTON_ID);
void onButtonPressed(cButton* btn)
@attilaz
attilaz / geometryc.txt
Created October 28, 2017 11:30
geometryc benchmark
I have tested two large obj file with geometryc.
ApCity uncompressed zip lzma
No Index compress 1,366,519 486,989 337,053
Index compress 1,244,034 432,734 296,368
Index+Vertex DWORD 1,244,034 388,990 300,717
Salle
No Index compress 28,663,702 17,863,876 11,664,913
@attilaz
attilaz / androidfilereader
Created July 24, 2017 06:33
Android File read from assets
class FileReaderAndroidImpl : public bx::FileReaderI
{
public:
FileReaderAndroidImpl(AAssetManager *assetManager, AAsset* _file)
: m_assetManager(assetManager)
, m_file(_file)
, m_open(false)
{
}