set topology per draw cmd

This commit is contained in:
jacob 2025-01-17 14:05:01 -06:00
parent 9549897e6b
commit a015143f5c
3 changed files with 4 additions and 11 deletions

View File

@ -898,7 +898,6 @@ void renderer_canvas_present(struct renderer_canvas **canvases, u32 canvases_cou
ID3D11DeviceContext_ClearRenderTargetView(G.devcon, G.backbuffer_view, clear_color);
/* Set draw mode */
ID3D11DeviceContext_IASetPrimitiveTopology(G.devcon, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
for (u32 i = 0; i < canvases_count; ++i) {
struct renderer_canvas *canvas = canvases[i];
@ -955,6 +954,8 @@ void renderer_canvas_present(struct renderer_canvas **canvases, u32 canvases_cou
last_texture_handle = texture_handle;
}
ID3D11DeviceContext_IASetPrimitiveTopology(G.devcon, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
/* Activate buffer */
u32 zero = 0;
UINT vertex_stride = shader->vertex_size;
@ -971,6 +972,8 @@ void renderer_canvas_present(struct renderer_canvas **canvases, u32 canvases_cou
case SHADER_GRID:
{
ID3D11DeviceContext_IASetPrimitiveTopology(G.devcon, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
/* Activate buffer */
u32 zero = 0;
UINT vertex_stride = shader->vertex_size;

View File

@ -41,7 +41,6 @@ float4 ps_main(ps_input input) : SV_TARGET
float2 v = abs(round(screen_pos / spacing) * spacing - screen_pos);
float dist = min(v.x, v.y);
color = input.col * step(dist, thickness / 2);
return color;

View File

@ -1,12 +1,3 @@
/*
* TODO:
* * maybe rename this to 'sprite.hlsl' (draw_rect and stuff would become draw_sprite)
* that way UI & text can have a separate shader (IE: draw_ui_rect, draw_ui_text, etc...)
*
* for tiles - separate shader. maybe upload all tile data in constant buffer, and drawing
* tiles can just be one giant quad (that the fragment shader indexes into)
*/
struct {
SamplerState sampler0;
Texture2D texture0;