mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[hud] Pass surface size to HUD renderer
This commit is contained in:
parent
bb01318984
commit
8b84d002f8
@ -49,10 +49,9 @@ namespace dxvk::hud {
|
||||
|
||||
|
||||
void Hud::render(const Rc<DxvkContext>& ctx, VkExtent2D surfaceSize) {
|
||||
HudUniformData uniformData;
|
||||
uniformData.surfaceSize = surfaceSize;
|
||||
m_uniformData.surfaceSize = surfaceSize;
|
||||
|
||||
this->updateUniformBuffer(ctx, uniformData);
|
||||
this->updateUniformBuffer(ctx, m_uniformData);
|
||||
|
||||
this->setupRendererState(ctx);
|
||||
this->renderHudElements(ctx);
|
||||
@ -75,7 +74,7 @@ namespace dxvk::hud {
|
||||
ctx->bindResourceBuffer(0,
|
||||
DxvkBufferSlice(m_uniformBuffer));
|
||||
|
||||
m_renderer.beginFrame(ctx);
|
||||
m_renderer.beginFrame(ctx, m_uniformData.surfaceSize);
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,6 +76,7 @@ namespace dxvk::hud {
|
||||
DxvkRasterizerState m_rsState;
|
||||
DxvkBlendMode m_blendMode;
|
||||
|
||||
HudUniformData m_uniformData;
|
||||
HudRenderer m_renderer;
|
||||
HudDeviceInfo m_hudDeviceInfo;
|
||||
HudFps m_hudFramerate;
|
||||
|
@ -8,6 +8,7 @@ namespace dxvk::hud {
|
||||
|
||||
HudRenderer::HudRenderer(const Rc<DxvkDevice>& device)
|
||||
: m_mode (Mode::RenderNone),
|
||||
m_surfaceSize { 0, 0 },
|
||||
m_vertShader (createVertexShader(device)),
|
||||
m_textShader (createTextShader(device)),
|
||||
m_lineShader (createLineShader(device)),
|
||||
@ -25,7 +26,7 @@ namespace dxvk::hud {
|
||||
}
|
||||
|
||||
|
||||
void HudRenderer::beginFrame(const Rc<DxvkContext>& context) {
|
||||
void HudRenderer::beginFrame(const Rc<DxvkContext>& context, VkExtent2D surfaceSize) {
|
||||
auto vertexSlice = m_vertexBuffer->allocSlice();
|
||||
context->invalidateBuffer(m_vertexBuffer, vertexSlice);
|
||||
|
||||
@ -52,7 +53,8 @@ namespace dxvk::hud {
|
||||
context->bindResourceSampler(1, m_fontSampler);
|
||||
context->bindResourceView (1, m_fontView, nullptr);
|
||||
|
||||
m_mode = Mode::RenderNone;
|
||||
m_mode = Mode::RenderNone;
|
||||
m_surfaceSize = surfaceSize;
|
||||
m_vertexIndex = 0;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,8 @@ namespace dxvk::hud {
|
||||
~HudRenderer();
|
||||
|
||||
void beginFrame(
|
||||
const Rc<DxvkContext>& context);
|
||||
const Rc<DxvkContext>& context,
|
||||
VkExtent2D surfaceSize);
|
||||
|
||||
void drawText(
|
||||
const Rc<DxvkContext>& context,
|
||||
@ -80,6 +81,10 @@ namespace dxvk::hud {
|
||||
size_t vertexCount,
|
||||
const HudVertex* vertexData);
|
||||
|
||||
VkExtent2D surfaceSize() const {
|
||||
return m_surfaceSize;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
enum class Mode {
|
||||
@ -91,6 +96,7 @@ namespace dxvk::hud {
|
||||
std::array<uint8_t, 256> m_charMap;
|
||||
|
||||
Mode m_mode;
|
||||
VkExtent2D m_surfaceSize;
|
||||
|
||||
Rc<DxvkShader> m_vertShader;
|
||||
Rc<DxvkShader> m_textShader;
|
||||
|
Loading…
x
Reference in New Issue
Block a user