Clear screen to neutral gray
This commit is contained in:
+5
-1
@@ -8,7 +8,8 @@
|
|||||||
struct BlitData {
|
struct BlitData {
|
||||||
float4 rect; // NDC fit rect: x0, y0, x1, y1
|
float4 rect; // NDC fit rect: x0, y0, x1, y1
|
||||||
uint selected;
|
uint selected;
|
||||||
uint pad[3];
|
uint mode; // 0 = sample texture, 1 = solid background
|
||||||
|
uint pad[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
[[vk::push_constant]]
|
[[vk::push_constant]]
|
||||||
@@ -33,5 +34,8 @@ VSOutput main(uint vertexIndex : SV_VertexID) {
|
|||||||
|
|
||||||
[shader("fragment")]
|
[shader("fragment")]
|
||||||
float4 main(VSOutput input) {
|
float4 main(VSOutput input) {
|
||||||
|
if (blit.mode == 1) {
|
||||||
|
return float4(0.18, 0.18, 0.18, 1.0);
|
||||||
|
}
|
||||||
return textures[NonUniformResourceIndex(blit.selected)].Sample(input.UV);
|
return textures[NonUniformResourceIndex(blit.selected)].Sample(input.UV);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-1
@@ -50,7 +50,8 @@ struct TextureResources {
|
|||||||
struct BlitData {
|
struct BlitData {
|
||||||
f32 rect[4]; // NDC fit rect: x0, y0, x1, y1
|
f32 rect[4]; // NDC fit rect: x0, y0, x1, y1
|
||||||
u32 selected;
|
u32 selected;
|
||||||
u32 pad[3];
|
u32 mode; // 0 = sample texture, 1 = solid background
|
||||||
|
u32 pad[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Typedefs for wapp arrays of our types
|
// Typedefs for wapp arrays of our types
|
||||||
@@ -481,12 +482,28 @@ int main() {
|
|||||||
prRhiCmdBindDescriptorSets(cb, PR_RHI_PIPELINE_BIND_POINT_GRAPHICS,
|
prRhiCmdBindDescriptorSets(cb, PR_RHI_PIPELINE_BIND_POINT_GRAPHICS,
|
||||||
app.pipeline_layout, 0, sets);
|
app.pipeline_layout, 0, sets);
|
||||||
|
|
||||||
|
// Draw background (fullscreen grey quad)
|
||||||
|
BlitData bg = {};
|
||||||
|
bg.rect[0] = -1.0f;
|
||||||
|
bg.rect[1] = -1.0f;
|
||||||
|
bg.rect[2] = 1.0f;
|
||||||
|
bg.rect[3] = 1.0f;
|
||||||
|
bg.selected = 0;
|
||||||
|
bg.mode = 1;
|
||||||
|
prRhiCmdPushConstants(cb, app.pipeline_layout,
|
||||||
|
(PrRhiShaderStage)(PR_RHI_SHADER_STAGE_VERTEX |
|
||||||
|
PR_RHI_SHADER_STAGE_FRAGMENT),
|
||||||
|
0, sizeof(BlitData), &bg);
|
||||||
|
prRhiCmdDraw(cb, 4, 1, 0, 0);
|
||||||
|
|
||||||
|
// Draw texture (contain-fit)
|
||||||
BlitData blit = {};
|
BlitData blit = {};
|
||||||
blit.rect[0] = fit_rect[0];
|
blit.rect[0] = fit_rect[0];
|
||||||
blit.rect[1] = fit_rect[1];
|
blit.rect[1] = fit_rect[1];
|
||||||
blit.rect[2] = fit_rect[2];
|
blit.rect[2] = fit_rect[2];
|
||||||
blit.rect[3] = fit_rect[3];
|
blit.rect[3] = fit_rect[3];
|
||||||
blit.selected = app.selected;
|
blit.selected = app.selected;
|
||||||
|
blit.mode = 0;
|
||||||
prRhiCmdPushConstants(cb, app.pipeline_layout,
|
prRhiCmdPushConstants(cb, app.pipeline_layout,
|
||||||
(PrRhiShaderStage)(PR_RHI_SHADER_STAGE_VERTEX |
|
(PrRhiShaderStage)(PR_RHI_SHADER_STAGE_VERTEX |
|
||||||
PR_RHI_SHADER_STAGE_FRAGMENT),
|
PR_RHI_SHADER_STAGE_FRAGMENT),
|
||||||
|
|||||||
Reference in New Issue
Block a user