Commit Graph

40 Commits

Author SHA1 Message Date
Isaac Marovitz
5d59c552e7 Fix Non-Float Textures + Image Read + FSI Buffers
Fixes Mario Party Superstars
2024-12-23 21:42:15 -06:00
Isaac Marovitz
80bb95dfb9 Shader Extra Set Support + Cleanup (#36)
Separate samplers are now supported and arrays in constant sets are bound
2024-12-23 21:41:39 -06:00
Isaac Marovitz
c0dcb6c4f2 Dual Source Blend Support in Shader
Fixes Super Mario Galaxy and The Legend of Zelda: Skyward Sword HD
2024-12-23 21:41:26 -06:00
Isaac Marovitz
5220ee1dc8 Some debug improvements 2024-12-23 21:40:46 -06:00
Isaac Marovitz
ffb9040b3b Shader Gen Fixes
Fixes Luigi’s Mansion 2 HD
2024-12-23 21:40:42 -06:00
Isaac Marovitz
0064afeb6a FSI (with raster order groups) 2024-12-23 21:40:34 -06:00
Isaac Marovitz
69bee52a89 SwizzleAdd (NOT TESTED) 2024-12-23 21:40:32 -06:00
Isaac Marovitz
015f5d00b4 Image shader gen support 2024-12-23 21:39:56 -06:00
Isaac Marovitz
6188872a7c Update binding model description comment 2024-12-23 21:39:16 -06:00
Isaac Marovitz
60722a1837 Metal: Better Bindings (#29)
* Tell GAL to use Vk model (and break everything)

* ResourceBindingSegments

* Set information on backend caps

* Get ready to break everything

* Refactor EncoderStateManager

* Remove padding from helper shaders

* Fix ref array sizes

* Seperate vert & frag buffers

* Shader-side changes

* Fixes

* Fix some helper shader resource layouts

* Sort by binding id

* Fix helper shader layouts

* Don’t do inline vertex buffer updates

* Check for null storage
2024-12-23 21:38:32 -06:00
riperiperi
4b53d18bef Fix Geometry/TFB on compute, Buffer Textures, add Window Resizing (#28) 2024-12-23 21:38:00 -06:00
Isaac Marovitz
c160810bfc Fragment input interpolation qualifiers
Fixes Mario’s shadow in SMO
2024-12-23 21:37:55 -06:00
Isaac Marovitz
f1086afcdf Fix fragment point_coord in 2024-12-23 21:37:03 -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
a1ab7fe6a2 VoteAllEqual, FindLSB/MSB 2024-12-23 21:36:58 -06:00
Isaac Marovitz
fac2cbbbbf Fix vertex “built-ins”
Only declare main func out in main

Fix simd_ballot

Fix thread_index_in_simdgroup outside of compute

Fix atomic operations

instance_index
2024-12-23 21:36:56 -06:00
Isaac Marovitz
becf828d0a Instruction.Barrier
Whoops

Fix inline functions in compute stage

Fix regression

Declare SharedMemories + Only Declare Memories on Main Func

Lowecase struct

Avoid magic strings

Make function signatures readable

Change how unsized arrays are indexed

Use string builder

Fix shuffle instructions

Cleanup NumberFormater

Bunch of Subgroup I/O Vars

Will probably need further refinement

Fix point_coord type

Fix support buffer declaration

Fix point_coord
2024-12-23 21:36:48 -06:00
Isaac Marovitz
e615d7d849 Fix modulo operator
Support sample offsets

Include FragmentIn as additional arg

Always declare frag output struct

SubgroupLaneId
2024-12-23 21:35:02 -06:00
Isaac Marovitz
db24e0f6fe Implement IoVariable.FrontFacing 2024-12-23 21:33:24 -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
8be6b671b8 Fix FragmentOutputColor Type 2024-12-23 21:32:59 -06:00
Isaac Marovitz
381f4ec091 FragmentOutputDepth Fixes 2024-12-23 21:29:20 -06:00
Isaac Marovitz
b76f9105c8 Depth Sampler Fixes 2024-12-23 21:29:09 -06:00
Isaac Marovitz
486fd78eba Revert position changes 2024-12-23 21:29:06 -06:00
Isaac Marovitz
27ece39dbe More shader fixes 2024-12-23 21:29:02 -06:00
Samuliak
d5b98d6187 declare local memory 2024-12-23 21:28:51 -06:00
Samuliak
913f25b2a0 support multiple render targets & fix: incorrect texture name 2024-12-23 21:28:41 -06:00
Samuliak
e3364b0fcc support fragment coord as an input to a shader 2024-12-23 21:23:24 -06:00
Isaac Marovitz
3117aeca7f Cleanup Shader I/O 2024-12-23 21:17:17 -06:00
Isaac Marovitz
987a42ce30 Fix fragment shader bindings 2024-12-23 21:17:09 -06:00
Isaac Marovitz
e2445990a5 Fix some shader gen problems… 2024-12-23 21:16:52 -06:00
Isaac Marovitz
c0da3d68ca Formatting 2024-12-23 21:16:07 -06:00
Isaac Marovitz
d45c7711ba Fix fragment shaders (and fuck everything up) 2024-12-23 21:09:35 -06:00
Isaac Marovitz
d65858be25 Fix IoMap variable names
Output struct

Lazy Vertex IO

Output fixes

Fix output struct definition

MSL Binding Model description

Might need tweaks/adjustments

Cleanup

Typo + Format
2024-12-23 21:07:58 -06:00
Isaac Marovitz
c5522e3694 Back to where we were
First special instruction

Start Load/Store implementation

Start TextureSample

Sample progress

I/O Load/Store Progress

Rest of load/store

TODO: Currently, the generator still assumes the GLSL style of I/O attributres. On MSL, the vertex function should output a struct which contains a float4 with the required position attribute.

TextureSize and VectorExtract

Fix UserDefined IO Vars

Fix stage input struct names
2024-12-23 21:05:34 -06:00
Isaac Marovitz
b1785c0b14 Update for new Shader IR format 2024-12-23 21:01:10 -06:00
Isaac Marovitz
dc4d3078ef Vertex Input Attributes 2024-12-23 21:00:45 -06:00
Isaac Marovitz
4b5c3d7fc6 More Shader Gen Stuff
Mostly copied from GLSL since in terms of syntax within blocks they’re pretty similar. Likely the result will need tweaking…

Isn’t that conveniant?

“Do the simd_shuffle”

atomics

Remaining instructions

Remove removed special instructions

Getting somewhere…
2024-12-23 21:00:23 -06:00
Isaac Marovitz
a7908c187d Warn when generating unsupported shader 2024-12-23 20:55:27 -06:00
Evan Husted
cbad43b003 some initial metal commits cherry-picked 2024-12-23 20:35:49 -06:00