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) {
|
void Hud::render(const Rc<DxvkContext>& ctx, VkExtent2D surfaceSize) {
|
||||||
HudUniformData uniformData;
|
m_uniformData.surfaceSize = surfaceSize;
|
||||||
uniformData.surfaceSize = surfaceSize;
|
|
||||||
|
|
||||||
this->updateUniformBuffer(ctx, uniformData);
|
this->updateUniformBuffer(ctx, m_uniformData);
|
||||||
|
|
||||||
this->setupRendererState(ctx);
|
this->setupRendererState(ctx);
|
||||||
this->renderHudElements(ctx);
|
this->renderHudElements(ctx);
|
||||||
@ -75,7 +74,7 @@ namespace dxvk::hud {
|
|||||||
ctx->bindResourceBuffer(0,
|
ctx->bindResourceBuffer(0,
|
||||||
DxvkBufferSlice(m_uniformBuffer));
|
DxvkBufferSlice(m_uniformBuffer));
|
||||||
|
|
||||||
m_renderer.beginFrame(ctx);
|
m_renderer.beginFrame(ctx, m_uniformData.surfaceSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,6 +76,7 @@ namespace dxvk::hud {
|
|||||||
DxvkRasterizerState m_rsState;
|
DxvkRasterizerState m_rsState;
|
||||||
DxvkBlendMode m_blendMode;
|
DxvkBlendMode m_blendMode;
|
||||||
|
|
||||||
|
HudUniformData m_uniformData;
|
||||||
HudRenderer m_renderer;
|
HudRenderer m_renderer;
|
||||||
HudDeviceInfo m_hudDeviceInfo;
|
HudDeviceInfo m_hudDeviceInfo;
|
||||||
HudFps m_hudFramerate;
|
HudFps m_hudFramerate;
|
||||||
|
@ -8,6 +8,7 @@ namespace dxvk::hud {
|
|||||||
|
|
||||||
HudRenderer::HudRenderer(const Rc<DxvkDevice>& device)
|
HudRenderer::HudRenderer(const Rc<DxvkDevice>& device)
|
||||||
: m_mode (Mode::RenderNone),
|
: m_mode (Mode::RenderNone),
|
||||||
|
m_surfaceSize { 0, 0 },
|
||||||
m_vertShader (createVertexShader(device)),
|
m_vertShader (createVertexShader(device)),
|
||||||
m_textShader (createTextShader(device)),
|
m_textShader (createTextShader(device)),
|
||||||
m_lineShader (createLineShader(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();
|
auto vertexSlice = m_vertexBuffer->allocSlice();
|
||||||
context->invalidateBuffer(m_vertexBuffer, vertexSlice);
|
context->invalidateBuffer(m_vertexBuffer, vertexSlice);
|
||||||
|
|
||||||
@ -52,7 +53,8 @@ namespace dxvk::hud {
|
|||||||
context->bindResourceSampler(1, m_fontSampler);
|
context->bindResourceSampler(1, m_fontSampler);
|
||||||
context->bindResourceView (1, m_fontView, nullptr);
|
context->bindResourceView (1, m_fontView, nullptr);
|
||||||
|
|
||||||
m_mode = Mode::RenderNone;
|
m_mode = Mode::RenderNone;
|
||||||
|
m_surfaceSize = surfaceSize;
|
||||||
m_vertexIndex = 0;
|
m_vertexIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,7 +66,8 @@ namespace dxvk::hud {
|
|||||||
~HudRenderer();
|
~HudRenderer();
|
||||||
|
|
||||||
void beginFrame(
|
void beginFrame(
|
||||||
const Rc<DxvkContext>& context);
|
const Rc<DxvkContext>& context,
|
||||||
|
VkExtent2D surfaceSize);
|
||||||
|
|
||||||
void drawText(
|
void drawText(
|
||||||
const Rc<DxvkContext>& context,
|
const Rc<DxvkContext>& context,
|
||||||
@ -80,6 +81,10 @@ namespace dxvk::hud {
|
|||||||
size_t vertexCount,
|
size_t vertexCount,
|
||||||
const HudVertex* vertexData);
|
const HudVertex* vertexData);
|
||||||
|
|
||||||
|
VkExtent2D surfaceSize() const {
|
||||||
|
return m_surfaceSize;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
enum class Mode {
|
enum class Mode {
|
||||||
@ -91,6 +96,7 @@ namespace dxvk::hud {
|
|||||||
std::array<uint8_t, 256> m_charMap;
|
std::array<uint8_t, 256> m_charMap;
|
||||||
|
|
||||||
Mode m_mode;
|
Mode m_mode;
|
||||||
|
VkExtent2D m_surfaceSize;
|
||||||
|
|
||||||
Rc<DxvkShader> m_vertShader;
|
Rc<DxvkShader> m_vertShader;
|
||||||
Rc<DxvkShader> m_textShader;
|
Rc<DxvkShader> m_textShader;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user