Commit Graph

105 Commits

Author SHA1 Message Date
Isaac Marovitz
fcd2adecc5 Better index buffer management 2024-12-23 21:39:43 -06:00
riperiperi
8411f69899 Fix preload cbs optimization (for real) (#34)
* Mostly fix preload cbs. There seems to be some random flickering...

* fix index buffer usage range

* fix missing preflush submit before present
2024-12-23 21:39:13 -06:00
Isaac Marovitz
58527e02ee Cleanup + Format 2024-12-23 21:38:54 -06:00
riperiperi
879c93cf73 Preload command speedup, Texture/buffer data flush, blit shader fix (#30)
* Move encoder state to be tied to command buffer, so preload and background cbs have their own encoder state

* Texture buffer/data flush, blit shader fix
2024-12-23 21:38:13 -06:00
Isaac Marovitz
7d5b4c5d1d Dont bind images in texture slots 2024-12-23 21:38:11 -06:00
Isaac Marovitz
2860db198c Stop depth/stencil blits from crashing everything 2024-12-23 21:38:04 -06:00
riperiperi
4b53d18bef Fix Geometry/TFB on compute, Buffer Textures, add Window Resizing (#28) 2024-12-23 21:38:00 -06:00
riperiperi
bbbc9e529d State and cache optimization (#27)
* WIP pipeline/depth state cache rework

* Fix some issues

* Fix some more default values

* Reduce allocations for state changes

* fix helpershader stuff

* explanation comment

* fix depth bias
2024-12-23 21:37:58 -06:00
Isaac Marovitz
4f7b3fa058 CommandBufferBarrier 2024-12-23 21:37:52 -06:00
Isaac Marovitz
97814b2852 Support non-index quad draws
Fixes Deltarune
2024-12-23 21:37:38 -06:00
Isaac Marovitz
d6dcc39131 Enable Alpha Test workaround on Metal 2024-12-23 21:37:10 -06:00
Isaac Marovitz
dae0f3cded Argument Buffers (#24)
* Stuff

* More arg buffer stuff

* Fixes

* Rebase

* Pass storage buffers to inline functions

* Fix binding

* Fix typo + Fix a couple shaders

* Enforce ids

* Dispose

* Mark used buffers as resident

* Update depth clear shader

* Fix non-contiguous struct defs

* Update ChangeBufferStride

* Fix StorageBuffer assignments

* Fix odyssey crash

* Retain buffer bindings

* Pad Std140

* Set texture data with safe buffers

* Clone buffers

* Always declare vert in

* Stop clears from breaking OpenGL games

* Fix depth clear

* Use invariant position

* Horribly inefficient texture & sampler arg buffers

* Fix missing struct access

* Minimise rebinds as much as possible

* Build arg buffers on staging buffer
2024-12-23 21:37:01 -06:00
Isaac Marovitz
9b138a413c Actually clear the right render target 2024-12-23 21:36:54 -06:00
Isaac Marovitz
d0e4adac36 PreloadCbs + FlushCommandsIfWeightExceeding 2024-12-23 21:36:46 -06:00
Isaac Marovitz
197184657f Cleanup Pipeline
Housekeeping

More housekeeping
2024-12-23 21:36:44 -06:00
Isaac Marovitz
b8779c6e09 Buffer Conversions (#23)
* Why is this not working

* Revert helper shader changes for now

* Byte Index Buffer Restride
2024-12-23 21:35:38 -06:00
riperiperi
20cf1a08c1 don't recreate render pipeline unless we're about to draw, pass view depth properly (#22) 2024-12-23 21:35:36 -06:00
Isaac Marovitz
dda746c0fb Metal: Buffers Take 2 (#21)
* Basic BufferManager

* Start Scoped Command Buffers

* Fences stuff

* Remember to cleanup sync manager

* Auto, Command Buffer Dependants

* Cleanup

* Cleanup + Fix Texture->Buffer Copies

* Slow buffer upload

* Cleanup + Rework TextureBuffer

* Don’t get unsafe

* Cleanup

* Goddamn it

* Staging Buffer + Interrupt Action + Flush
2024-12-23 21:35:33 -06:00
Isaac Marovitz
5423ad9ae1 Depth Bias 2024-12-23 21:35:13 -06:00
Isaac Marovitz
c883ebb645 Workaround for Wonder 2024-12-23 21:35:00 -06:00
Isaac Marovitz
9ab2cd94c1 Fix Clear Viewport 2024-12-23 21:34:55 -06:00
Isaac Marovitz
fe4fa6f4db Cleanup 2024-12-23 21:33:31 -06:00
Isaac Marovitz
02f1e289e2 Rebase Changes 2024-12-23 21:33:19 -06:00
Isaac Marovitz
49e83335d1 Cleanup + Format 2024-12-23 21:33:14 -06:00
Isaac Marovitz
f00cf8704f Metal: Compute Shaders (#19)
* check for too bix texture bindings

* implement lod query

* print shader stage name

* always have fragment input

* resolve merge conflicts

* fix: lod query

* fix: casting texture coords

* support non-array memories

* use structure types for buffers

* implement compute pipeline cache

* compute dispatch

* improve error message

* rebind compute state

* bind compute textures

* pass local size as an argument to dispatch

* implement texture buffers

* hack: change vertex index to vertex id

* pass support buffer as an argument to every function

* return at the end of function

* fix: certain missing compute bindings

* implement texture base

* improve texture binding system

* remove useless exception

* move texture handle to texture base

* fix: segfault when using disposed textures

---------

Co-authored-by: Samuliak <samuliak77@gmail.com>
Co-authored-by: SamoZ256 <96914946+SamoZ256@users.noreply.github.com>
2024-12-23 21:33:12 -06:00
Isaac Marovitz
a58568d036 RenderTargetColorMasks 2024-12-23 21:32:52 -06:00
Isaac Marovitz
43ad627d4f Implement Texture CopyTo 2024-12-23 21:32:45 -06:00
Isaac Marovitz
c5cca8a1a3 Cleanup present 2024-12-23 21:32:43 -06:00
Isaac Marovitz
f7941a0a8b Metal: Advanced Present (#6)
* Initial DrawTexture support & Advanced Present

* TODO: Get Scissors Working

* Chnage scissor state management

* Rebase problems…

* Rebase fixes again

* Update DrawTexture + Fix Topology

* Fix flipping

* Add clear action support

* Cleanup
2024-12-23 21:32:40 -06:00
SamoZ256
6cc4d46e8c Clone the state & flip viewport vertically (#16)
* implement texture get data

* reset all state before blit & clone state

* format

* support blit regions

* implement source region for blit

* replace bottom with top

* account for 0 size

* support image flipping

* revert presentation fixes & y flip

* revert

* flip viewport vertically

* switch face winding

* comment

* use SetBytes for texture clear

* implement missing compute builtins

* change storage and texture buffer alignment

* correct compute builtins

* don't use nullable for textures and samplers

* remove incorrect texture get data implementation

* Cleanup IntPtrs

---------

Co-authored-by: Isaac Marovitz <isaacryu@icloud.com>
2024-12-23 21:32:34 -06:00
Isaac Marovitz
327c1576f7 Whitespace formatting 2024-12-23 21:31:54 -06:00
Samuliak
3be47ae4a9 dispose drawable texture view 2024-12-23 21:31:41 -06:00
Samuliak
1c4e527ac2 dispose encoder state manager 2024-12-23 21:31:01 -06:00
Samuliak
2cb5265c8e warn about barriers 2024-12-23 21:30:53 -06:00
Samuliak
78553f31d9 do memory barriers 2024-12-23 21:30:50 -06:00
Samuliak
60084f826e remove useless parameters 2024-12-23 21:30:48 -06:00
Samuliak
fd4fe01348 fix: incorrect merge stuff 2024-12-23 21:30:39 -06:00
Samuliak
8f91b556af don't interrupt render pass before color clear 2024-12-23 21:30:29 -06:00
Samuliak
305a703d4a implement save and restore state system 2024-12-23 21:30:22 -06:00
Samuliak
a2c0c11380 revert deferred clears 2024-12-23 21:30:02 -06:00
Samuliak
016df3b050 prepare for deferred clears 2024-12-23 21:29:58 -06:00
Samuliak
084b75a398 resolve merge conflicts 2024-12-23 21:29:56 -06:00
Isaac Marovitz
bea46ff9ce Cleanup + Format 2024-12-23 21:29:50 -06:00
Samuliak
94e077ca27 do texture barrier tiled 2024-12-23 21:29:44 -06:00
Samuliak
a10b0230c3 do texture barrier 2024-12-23 21:29:42 -06:00
Isaac Marovitz
7f8d54d6dc Depth Clear 2024-12-23 21:29:33 -06:00
Isaac Marovitz
90e3899c23 Shitty Clears + Inline Buffer Improvements? 2024-12-23 21:29:24 -06:00
Isaac Marovitz
2316f30de1 Use return value of BeginRenderPass 2024-12-23 21:28:33 -06:00
Samuliak
f3d314104f don't end render pass when not neccessary 2024-12-23 21:28:01 -06:00
Isaac Marovitz
4f356b4117 Implement SetDepthClamp 2024-12-23 21:27:10 -06:00