MCPcopy Create free account
hub / github.com/crownengine/crown / init

Method init

3rdparty/bgfx/src/bgfx.cpp:637–678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

635 static constexpr uint32_t kNumBatchIndices = kNumCharsPerBatch*6;
636
637 void TextVideoMemBlitter::init(uint8_t scale)
638 {
639 BGFX_CHECK_API_THREAD();
640 m_layout
641 .begin()
642 .add(Attrib::Position, 3, AttribType::Float)
643 .add(Attrib::Color0, 4, AttribType::Uint8, true)
644 .add(Attrib::Color1, 4, AttribType::Uint8, true)
645 .add(Attrib::TexCoord0, 2, AttribType::Float)
646 .end();
647
648 uint16_t width = 2048;
649 uint16_t height = 24;
650 uint8_t bpp = 1;
651 uint32_t pitch = width*bpp;
652
653 const Memory* mem;
654
655 mem = alloc(pitch*height);
656 uint8_t* rgba = mem->data;
657 charsetFillTexture(vga8x8, rgba, 8, pitch, bpp);
658 charsetFillTexture(vga8x16, &rgba[8*pitch], 16, pitch, bpp);
659 m_texture = createTexture2D(width, height, false, 1, TextureFormat::R8
660 , BGFX_SAMPLER_MIN_POINT
661 | BGFX_SAMPLER_MAG_POINT
662 | BGFX_SAMPLER_MIP_POINT
663 | BGFX_SAMPLER_U_CLAMP
664 | BGFX_SAMPLER_V_CLAMP
665 , mem
666 );
667
668 ShaderHandle vsh = createEmbeddedShader(s_embeddedShaders, g_caps.rendererType, "vs_debugfont");
669 ShaderHandle fsh = createEmbeddedShader(s_embeddedShaders, g_caps.rendererType, "fs_debugfont");
670
671 BX_ASSERT(isValid(vsh) && isValid(fsh), "Failed to create embedded blit shaders");
672
673 m_program = createProgram(vsh, fsh, true);
674
675 m_vb = s_ctx->createTransientVertexBuffer(kNumBatchVertices*m_layout.m_stride, &m_layout);
676 m_ib = s_ctx->createTransientIndexBuffer(kNumBatchIndices*2);
677 m_scale = bx::max<uint8_t>(scale, 1);
678 }
679
680 void TextVideoMemBlitter::shutdown()
681 {

Callers 3

initFunction · 0.45
createFrameBufferFunction · 0.45
theme.jsFile · 0.45

Calls 15

allocFunction · 0.85
charsetFillTextureFunction · 0.85
createTexture2DFunction · 0.85
createEmbeddedShaderFunction · 0.85
createProgramFunction · 0.85
dumpFunction · 0.85
memCopyFunction · 0.85
getHPCounterFunction · 0.85
resetViewFunction · 0.85
frameFunction · 0.85
imageConvertFunction · 0.85
initAttribTypeSizeTableFunction · 0.85

Tested by

no test coverage detected