Skip to content

Commit

Permalink
Fix scissor rects
Browse files Browse the repository at this point in the history
  • Loading branch information
Beyley committed Mar 7, 2024
1 parent 3ca2523 commit 09f333c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions game/renderer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,12 @@ pub fn draw(self: *Self, encoder: *core.gpu.RenderPassEncoder) !void {
encoder.setBindGroup(1, self.texture.bind_group.?, &.{});

for (self.recorded_buffers.items) |recorded_buffer| {
// const scissor_width = @min(self.gfx.viewport[2], recorded_buffer.scissor[2]);
// const scissor_height = @min(self.gfx.viewport[3], recorded_buffer.scissor[3]);

// encoder.setScissorRect(0, 0, scissor_width, scissor_height);
encoder.setScissorRect(
recorded_buffer.scissor[0],
recorded_buffer.scissor[1],
recorded_buffer.scissor[2],
recorded_buffer.scissor[3],
);
encoder.setVertexBuffer(0, recorded_buffer.vtx_buf, 0, @sizeOf(Gfx.Vector2) * vtx_per_buf);
encoder.setVertexBuffer(1, recorded_buffer.vtx_buf, @sizeOf(Gfx.Vector2) * vtx_per_buf, @sizeOf(Gfx.Vector2) * vtx_per_buf);
encoder.setVertexBuffer(2, recorded_buffer.vtx_buf, @sizeOf(Gfx.Vector2) * 2 * vtx_per_buf, @sizeOf(Gfx.ColorF) * vtx_per_buf);
Expand Down

0 comments on commit 09f333c

Please sign in to comment.