| 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 | { |
no test coverage detected