Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metal Rendering on macOS #1326

Merged
merged 165 commits into from
Nov 29, 2023
Merged

Metal Rendering on macOS #1326

merged 165 commits into from
Nov 29, 2023

Commits on Nov 14, 2023

  1. Initial work to resync Metal work on master

    Does not yet link - async sockets missing implementation
    
    Migrating Metal-cpp over to CMake management
    
    Also rolling Metal-cpp up to 13.3 SDK.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    a480ee4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2144231 View commit details
    Browse the repository at this point in the history
  3. Moving aux spans back onto normal IHandleMaterial

    I think it was set this way for debugging an issue, but the old code is causing issues itself.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    17b4d93 View commit details
    Browse the repository at this point in the history
  4. Fixing normalized co-ordinate identity crisis

    Treating normalized co-ordinates as if they were full range. Broke some things with inverted alpha. Stuff like the side of the tent in city should render correct now.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    002bfc4 View commit details
    Browse the repository at this point in the history
  5. Fixing texture indexes

    Texture is being bound to the wrong index. This was causing the cleft to fail to load.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    feac6b9 View commit details
    Browse the repository at this point in the history
  6. Skipping spans with length 0

    Eder Delin has had a 0 span since the resync, which Metal choked on
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    286096c View commit details
    Browse the repository at this point in the history
  7. Initial work on proper clear support

    Should fix menus and partially fix linking books. Books still aren't drawing their contents, but that doesn't seem to be a renderer issue. The scripts that draw the books may not be working for some reason.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    8a72c86 View commit details
    Browse the repository at this point in the history
  8. Fixes for fast material encoding

    Was using setFragmentBuffer, not setFragmentBytes. Also was doing fast and then slow encoding back to back.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    c952b78 View commit details
    Browse the repository at this point in the history
  9. Integrating the optimized M1 Metal renderer

    Also fixing several rendering bugs:
    - Single layer color materials now render correctly
    - Fixed lighting issues on moving surfaces
    - Fixed shader compilation crash on Intel HD Metal drivers by removing inline notation from shader functions. No performance decline was observed.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    bfd45ff View commit details
    Browse the repository at this point in the history
  10. Fixing crash on Intel graphics

    Intel graphics have unified memory, but don't support memoryless textures. Now explicitly checking for the Apple GPU family.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    1b1c2d5 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    b1fbfa0 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    4090cd8 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    2826d1a View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    b5fb8bb View commit details
    Browse the repository at this point in the history
  15. Fixing CheckTextureRef

    Thats a virtual interface, can't just rename that. Ooops!
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    62bc4d0 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    b6397a4 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    b889050 View commit details
    Browse the repository at this point in the history
  18. Fixing clear color

    Plasma is clearing the main drawable before it does offscreen drawing. In Metal, clearing and beginning drawing are linked. Need to cache the clear command until the main drawable pass begins.
    
    Strangely enough offscreen buffers like the shadow buffer still aren't clearing. This doesn't match what I've seen from the DirectX branch. Needs further investigation.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    702262b View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    45b5013 View commit details
    Browse the repository at this point in the history
  20. Fixing self shadow bug, removing LUT

    Avatar was self shadowing because the shadow map reflected the avatar state from the previous frame.
    
    The LUT for the shadow maps was a workaround to turn the x position into a color value. Removing the LUT in since we can just directly use that value in Metal instead of needing a texture go between. This also should slightly improve shadow quality over DX.
    
    Additional LUT removal
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    2f7e6ca View commit details
    Browse the repository at this point in the history
  21. Initial version of WaveDec1Lay_7

    Ahnonay is loading now. But there are clear water rendering issues in Ahnonay that will need to be resolved.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    207978b View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    793e9b9 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    946f10f View commit details
    Browse the repository at this point in the history
  24. Fixes for wave shaders

    Fixes directly to the WaveDecEnv shader. Minor changes to WaveSet7. Fixes for function hash table confusing different shaders and not tracking blend mode properly. Possibly related to GPU crashing, and fixes blend mode issues with shaders.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    bec6acd View commit details
    Browse the repository at this point in the history
  25. Adjusting Z-Bias

    Water in Ahnonay uses it, but it wasn't quite enough to prevent all collisions
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    fc72800 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    fdc6d27 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    0ef446c View commit details
    Browse the repository at this point in the history
  28. Fixing unintentional overflow

    Metal was getting a pointer to a uint8_t when it expected a short for the UV count. This was leading to UV count sometimes being read wrong.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    2b60361 View commit details
    Browse the repository at this point in the history
  29. Adding Wave Rip

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    be97c72 View commit details
    Browse the repository at this point in the history
  30. Fixing issue in WaveSet7

    sqrt in HLSL 1.1 implies an absolute value taken of the value, according to the spec. This fixes an issue where water might not render from some angles. This bug could also be present in other shaders, I have not checked yet,
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    4e862c1 View commit details
    Browse the repository at this point in the history
  31. Adding wave rip cmake

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    831cbc9 View commit details
    Browse the repository at this point in the history
  32. Adding hardware single weight skinning

    Some aspects of this are temporary until multiple wieght blending is introduced into the GPU pipeline. Integrated into the vertex shader. Not sure if this should be a compute shader eventually.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    79a26f8 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    59133aa View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    38ff4c6 View commit details
    Browse the repository at this point in the history
  35. Fixing alpha threshold

    When I first wrote this I picked just a really small number. Now I understand it should be 1.f/255.f to represent the smallest test DirectX can do.
    
    Some areas - specifically the Barons Office - are very sensitive to this value. The view outside the windows has some layers where the alpha values should be eliminated - but they hover just barely above zero. A test too small won’t catch them. I’m not sure the purpose of these layers - they don’t seem to add anything visually - but they are there in DirectX too with the same lack of visual contribution..
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    6cb40d0 View commit details
    Browse the repository at this point in the history
  36. Fixing memory pile up during intro movie

    The intro movie keeps its own run loop which prevents our autorelease pool from collecting memory until the intro movie is done. This leads to a pile up of gigs (or tens of gigs) of memory as no framebuffer can be released.
    
    Apple was nice enough to add NSAutoreleasePool to their list of bridged C++ classes though, so we can insert our own autorelease pool to capture that memory right into the pipeline.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    496f415 View commit details
    Browse the repository at this point in the history
  37. Improving state tracking

    State tracking is meant to reduce the number of redundant calls to the Metal command encoder. The DX renderer had something similar, but implemented differently.
    
    This is the beginning of improving state tracking. I’d like to move materials over to bindless rendering, which should also improve things. There are also more general redundancies to cut down.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    d1ba412 View commit details
    Browse the repository at this point in the history
  38. Adding texture anisotropy support

    This change has caused a performance decline. It’s likely related to the samplers being bound now instead of being hardcoded. Still investigating.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    8a6f194 View commit details
    Browse the repository at this point in the history
  39. Configuration menu
    Copy the full SHA
    236c278 View commit details
    Browse the repository at this point in the history
  40. Fixing performance with anisotropic texturing

    Metal didn’t like the dynamic array lookup I was doing. Converting it it to static lookups. This has restored expected performance. Also converted the sample type to a function constant.
    
    There is cleanup to do now. The fragment uniforms have been reduced to the alpha threshold, which is now awkwardly in a struct by itself. None of the layer data lives there anymore. In the pipeline, the encoding for shader lookup has gotten real messy.
    
    I’m probably going to look at adding MSAA first, but the cleanup is really overdue. I’ve had to work through multiple issues already that happened because I tried to do minor tweaks to that code but forgot to touch a specific part.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    78b3145 View commit details
    Browse the repository at this point in the history
  41. Initial MSAA support

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    f182e96 View commit details
    Browse the repository at this point in the history
  42. Simplifying shader code

    Using the power of C++ to move the sampleLayer function into the layers struct. The function can now directly access struct members and doesn’t need them passed as arguments.
    
    Having trouble with the array lookup of samplers on Intel graphics and hoping this helps.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    0985736 View commit details
    Browse the repository at this point in the history
  43. Fixing samplers

    Was using the wrong  samplers
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    0f4d76a View commit details
    Browse the repository at this point in the history
  44. Moving drawable pass back down to single pass

    Adding a clear shader to clear depth/color as needed without staerting a new pass
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    b18d6a0 View commit details
    Browse the repository at this point in the history
  45. Fixing rendering issues with state selection

    Shaded material states like water weren’t correctly hashing and testing equality based on span properties
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    03b9616 View commit details
    Browse the repository at this point in the history
  46. Bug fixes and performance improvements for MSAA

    MSAA textures are now memoryless. Vertex shader has been improved to reduce memory bandwidth and encoding time.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    6f82663 View commit details
    Browse the repository at this point in the history
  47. Configuration menu
    Copy the full SHA
    2e76abe View commit details
    Browse the repository at this point in the history
  48. Eliminating preshade colors from fragment pass

    Also getting rid of the buffers and arguments used to back it. They were only used for lighting, which is in the vertex pass.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    502ac98 View commit details
    Browse the repository at this point in the history
  49. Implementing offscreen render support

    Ki screenshotting no longer means death
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    50b301a View commit details
    Browse the repository at this point in the history
  50. Fix for KI snapshots on discrete cards

    Texture needs to be blitted out to CPU for discrete cards.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    fd7c091 View commit details
    Browse the repository at this point in the history
  51. Fixes for cubic target accidental recreation

    After a resolution change cubic render targets are always marked as dirty. This causes problems with the KI snapshot renders which will try to recreate the buffer and not re-render it.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    6d4fc83 View commit details
    Browse the repository at this point in the history
  52. Fixing not using correct number of piggybacks

    This was causing a Metal compiler crash because inconsistant function constants were being passed.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    008dfb8 View commit details
    Browse the repository at this point in the history
  53. Fixing graphics options not working

    We need to supply at least one display mode. This isn’t perfect - it causes graphics options to set the plate/cursor layer to 800x600. But it’s better.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    7122c02 View commit details
    Browse the repository at this point in the history
  54. Configuration menu
    Copy the full SHA
    0df7b78 View commit details
    Browse the repository at this point in the history
  55. Configuration menu
    Copy the full SHA
    d44b6b6 View commit details
    Browse the repository at this point in the history
  56. Fixes for shadowcasting

    My optimization broke shadow cast rendering. :( Fixed!
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    6a6d5c7 View commit details
    Browse the repository at this point in the history
  57. Configuration menu
    Copy the full SHA
    f0bb4dd View commit details
    Browse the repository at this point in the history
  58. Fixing menu going missing sometimes

    The new manual clear could have its draw culled if backface or frontface culling was set before the clear pass. Disabling culling. I could wind my rect the other way - but the engine is allowed to front face cull. Easiest to just turn it off.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    d0266bf View commit details
    Browse the repository at this point in the history
  59. Fixing crashes on Intel integrated graphics. It was having trouble wi…

    …th the sampleTypes being defined as size_t - which is way too large anyway. uint32_t is probably too large too but going with what works for now. Also doing some other cleanup and fixing unified vs Apple family capability mixups.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    6220ac3 View commit details
    Browse the repository at this point in the history
  60. Fixing postprocess texture options

    That should be LoadActionDontCare, and StoreActionStore. I had the opposite. Whoops!
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    603e9ac View commit details
    Browse the repository at this point in the history
  61. Fixing render glitch due to sampleType length mixup

    Bitten by this again. There’s got to be a better way. Also dropping the size down to uint8_t.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    afdee69 View commit details
    Browse the repository at this point in the history
  62. Re-creating plate manager when reloading device

    This allows the intro movie to properly resize (which relies on the plate manager getting re-created.)
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    6f1671a View commit details
    Browse the repository at this point in the history
  63. Removing logging

    That wasn’t supposed to be in the last commit
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    1ed5e18 View commit details
    Browse the repository at this point in the history
  64. Fixing device selection

    This should align the framebuffer device and the render device on dual GPU Intel Macbook Pros. Previously it would try to draw to an Intel IGP framebuffer while rendering on the discrete card.
    
    The way this is implemented is a bit of a hack. The Mac client app probably needs a deeper refactoring.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    0d680e3 View commit details
    Browse the repository at this point in the history
  65. Fixing water on Nvidia/MSL/Fast Math

    The water vertex shader needs to square as part of it’s reference math, but the value it needs to square can sometimes be negative. HLSL usually just does the “right” thing but MSL (and GLSL) need more direction and can treat squaring or square rooting a negative as undefined behavior. Absolute valuing first - in since we know that a square will always produce a positive.
    
    Long term - this HLSL code was ported over directly. It’s possible that this code could be replaced by some other Metal functions like reflect. More research is required.
    Colin Cornaby authored and colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    fb8a12f View commit details
    Browse the repository at this point in the history
  66. Updating “fixed” shaders to remove const samplers

    This was suplimented by the samplers that are set as pipeline resources to support configurable sampling.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    138690b View commit details
    Browse the repository at this point in the history
  67. Moving redering to main thread

    Also adding run loop to take care of intro movie not running on main thread, and honoring full screen setting
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    6e7243a View commit details
    Browse the repository at this point in the history
  68. Fixes for fog

    The previous fog algorithm was very wrong, but also covering for a problem where fog was being applied to layers it should not have been
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    160cda0 View commit details
    Browse the repository at this point in the history
  69. Configuration menu
    Copy the full SHA
    e183e50 View commit details
    Browse the repository at this point in the history
  70. Fixing god rays in Kadish

    Flat color base layers were blending against themselves
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    f84ff03 View commit details
    Browse the repository at this point in the history
  71. Fixes for problematic assets in Kadish

    A cube map near or in the vault in Kadish has inconsistant cubic mipmap face sizes, and will cause Metal to crash. This change will cause Metal to manually compute mipmap sizes, and then load the data anyway. This is what DX does. The mipmaps affected don’t seem to be intended to be used.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    1d1f700 View commit details
    Browse the repository at this point in the history
  72. Fixing fog color getting mingled with projections

    Calc lighting was done before projections were applied. This was allowing fog (which is part of lighting calc in Metal) to be enabled for projection layers. This was most visible in Kadish.
    
    This code is kind of messy, but has been through several improvement passes already.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    e0e69c8 View commit details
    Browse the repository at this point in the history
  73. Moving opacity check after lighting calc

    This fixes steam in Gira and probably other things.
    
    This function is still kind of a mess and needs more cleanup. The DX version is also messy though.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    c971b25 View commit details
    Browse the repository at this point in the history
  74. Fixing infinite loop bug created by early return

    Have to pop the layers.
    
    Code is still messy and needs a better solution.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    1de1a58 View commit details
    Browse the repository at this point in the history
  75. Adding ISetLayer

    Caching z bias state. Also caching cull mode state.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    c25ee81 View commit details
    Browse the repository at this point in the history
  76. Fixing state tracking

    Should fix bugs with water not drawing and cull mode not being tracked properly
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    711a6e8 View commit details
    Browse the repository at this point in the history
  77. Refactoring pass code

    Clearing up redundant loops, clarifying code, fixing some latent possible issues with pushover layers not being consistantly applied
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    4ffceed View commit details
    Browse the repository at this point in the history
  78. Early version of Metal font rendering

    Still has known issues to fix
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    0ff0d1a View commit details
    Browse the repository at this point in the history
  79. Configuration menu
    Copy the full SHA
    bbbab15 View commit details
    Browse the repository at this point in the history
  80. Configuration menu
    Copy the full SHA
    e11c4dd View commit details
    Browse the repository at this point in the history
  81. Fixing reflections in K’veer

    Reflections were having shadows renderer on them with out of range shadow values. This clamps the values so they can’t be out of range. The DX implementation used a LUT texture here that implicitly clamped the range.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    9f24e42 View commit details
    Browse the repository at this point in the history
  82. Fixes for age anomolies

    Fixing case where age UV index was encoded out of range (Great Tree Pub), and texture had no usable mipmap levels (GoMePubNew)
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    64e6188 View commit details
    Browse the repository at this point in the history
  83. Configuration menu
    Copy the full SHA
    4f2e935 View commit details
    Browse the repository at this point in the history
  84. Deleting numUVSrcs

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    2920f37 View commit details
    Browse the repository at this point in the history
  85. Configuration menu
    Copy the full SHA
    5620437 View commit details
    Browse the repository at this point in the history
  86. More blurring

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    22d96d0 View commit details
    Browse the repository at this point in the history
  87. Configuration menu
    Copy the full SHA
    9d551c0 View commit details
    Browse the repository at this point in the history
  88. Initial version of private Metal textures

    Textures can now be stored in private storage in Metal - which means on discrete cards they can be VRAM only. This feature is disabled on Apple Silicon - but perhaps should be enabled. Even though Apple Silicon doesn’t have VRAM, the GPU might be able to store a private texture in a better storage format.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    006c91d View commit details
    Browse the repository at this point in the history
  89. Fixing copy allocator for blur

    Description is a string, not the texture description.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    45aa3f2 View commit details
    Browse the repository at this point in the history
  90. Removing old fPipelineState

    This is a leftover from the initial Metal prototype
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    99ff520 View commit details
    Browse the repository at this point in the history
  91. Adding missing MPS link

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    6fa6565 View commit details
    Browse the repository at this point in the history
  92. Removing ranges import

    Ranges is a C++20 feature I didn’t end up using anyway
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    eb28191 View commit details
    Browse the repository at this point in the history
  93. Adding deep color support

    Also forcing plMetalTextFont and plates back through the devices pipeline state management to match the current color space
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    406fce4 View commit details
    Browse the repository at this point in the history
  94. Removing Poisson Disk Shadow Treatment

    Shadow blurring would be the best improvemnt for now (along with upgrading shadow resolution.) This could come back in the future - but for now it’s not really helping much.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    7a8f9d3 View commit details
    Browse the repository at this point in the history
  95. Enabling staging textures on all platforms

    All textures now get blitted to private memory.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    50d03ca View commit details
    Browse the repository at this point in the history
  96. Re-factoring how lights are encoded

    Lights can now go into a variable length buffer - trying to reduce memory traffic. Ideally the pipeline should probably hold these as a vector, but this is a start.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    56b11e6 View commit details
    Browse the repository at this point in the history
  97. Fixes for memory leaks

    Also fixing finding client data when app is launched from Finder
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    5ff886e View commit details
    Browse the repository at this point in the history
  98. Configuration menu
    Copy the full SHA
    ed6d806 View commit details
    Browse the repository at this point in the history
  99. Configuration menu
    Copy the full SHA
    85da7d9 View commit details
    Browse the repository at this point in the history
  100. Configuration menu
    Copy the full SHA
    e57ad87 View commit details
    Browse the repository at this point in the history
  101. Turning off main framebuffer viewport setting

    The engine doesn’t know the size, so it keeps setting it to the wrong one. The default viewport size is just fine anyway.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    8cc5e33 View commit details
    Browse the repository at this point in the history
  102. Fixing gamma texture descriptor

    I thought I already fixed this?
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    0af96b9 View commit details
    Browse the repository at this point in the history
  103. Fixing MPS Blur

    Copy depth is 1, not 0
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    d64b12c View commit details
    Browse the repository at this point in the history
  104. Binding samplers at encoder insetad of in shader

    This removes the function constants for the sampler type - and all the logic that goes with. Samplers are now encoded in an array. This should simplify what the fragment shader has to do - and should fix Intel Integrated Graphics which was unhappy with samplers as a non-const variable.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    4befb95 View commit details
    Browse the repository at this point in the history
  105. Configuration menu
    Copy the full SHA
    ad2774b View commit details
    Browse the repository at this point in the history
  106. Sampler states work again on projections

    Sampler state code is now shared. I’m not restoring the monolithic “encode all the layers” treatment that DirectX did. I need some flexbility to encode argument buffers at a later point, which means the material can’t just bind itself to encoder states inside of  a black box function.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    f3e8184 View commit details
    Browse the repository at this point in the history
  107. Fixes for spot lighting

    Cleaning up the variable names as well. Spot lighting was broken on Intel Integrated Graphics. The spot lighting intensity wasn’t clamped before the falloff calculation.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    0a1751a View commit details
    Browse the repository at this point in the history
  108. Culling redundant position calculations

    Position should be calculated only once now in the vertex shader. Position will also be blended with any skinning matrices before the lighting pass. That’s technically a fix - even though I haven’t seen any defects because of that yet.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    73756ff View commit details
    Browse the repository at this point in the history
  109. Fixes for over all projects

    Kadish light spots on ground now project (seemingly) correctly. Lighting was not correctly configured.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    f04eeaa View commit details
    Browse the repository at this point in the history
  110. Fixing weird shadow flickering issues

    Shadow light needs to be zeroed
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    4dbc852 View commit details
    Browse the repository at this point in the history
  111. Fixing ghost avatars

    Avatar textures for other players might be loaded in after material shader creation. That means the material shader state needs to be recreated for a color -> texture transition. Setting the dirty flag when an avatar texture is set - and checking it in the material ref.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    e626c9d View commit details
    Browse the repository at this point in the history
  112. Fixes for lighting

    The lighting struct was being written wrong when projection lights are also present. There’s a bit in lighting where it scales down lights that aren’t rendered which - makes no sense.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    8e5fb97 View commit details
    Browse the repository at this point in the history
  113. Upping Metal lights max to 32

    Restoring the original light count for Plasma for Metal. 32 lights is a lot - but there are a lot of visible improvements. This should possibly be tiered based on hardware.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    da55553 View commit details
    Browse the repository at this point in the history
  114. Sycronizing GPU state when correcting blend modes

    This should fix Ahnonay in it’s current state on Trollland
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    261dc21 View commit details
    Browse the repository at this point in the history
  115. Filtering available texture bindings by type

    Cubic bindings will no longer be present for layers that don’t have cubic textures.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    b0c1eab View commit details
    Browse the repository at this point in the history
  116. Fixing crash w aux spans and projections

    Need to reset the index buffer earlier in the render span function. Render all projections was a late addition, and it got added to the wrong place relative to the buffer restoration.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    0578e89 View commit details
    Browse the repository at this point in the history
  117. Fixing shadows not rendering on some hardware

    Shadow commands were being given inconsistant function constants on compliation. The shader is looking for the source types to be properly encoded as constants, but the shadow shader was hard coded to look for the source type constant for layer 3. This caused layers 1 and 2 to be dropped and not properly bound because the shader assumed there was nothing there.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    4309740 View commit details
    Browse the repository at this point in the history
  118. Fixes for WaveRip and vertex index streaming

    Streaming of subsets of vertex indexes was broken, fixing. Because of triple buffering or the index buffers, there might still be bugs. A partial update of a buffer should be applied on the previous version of the buffer, but we have to buffer swap. Should consider copying the previous buffers contents into the new buffer before updating for consistancy.
    
    WaveRip was also badly broken. Fixing.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    3155a3c View commit details
    Browse the repository at this point in the history
  119. Fixing Metal logging

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    d68fbfa View commit details
    Browse the repository at this point in the history
  120. Getting rid of stray log

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    7433165 View commit details
    Browse the repository at this point in the history
  121. Configuration menu
    Copy the full SHA
    eb1f3c8 View commit details
    Browse the repository at this point in the history
  122. Using target_include_directories

    Haven’t added platform specific scoping yet
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    7d00365 View commit details
    Browse the repository at this point in the history
  123. Configuration menu
    Copy the full SHA
    ab16219 View commit details
    Browse the repository at this point in the history
  124. Removing extra " from pfAllCreatables

    Co-authored-by: dgelessus <[email protected]>
    colincornaby and dgelessus committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    c4cec5c View commit details
    Browse the repository at this point in the history
  125. Removing Apple OpenAL support

    Only OpenAL soft support now
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    9bdea54 View commit details
    Browse the repository at this point in the history
  126. Fixing missing shadows bug

    Shadow stages 0 and 1 and the normal stages 0 and 1 conflict and were tromping over each other. Redoing this part of the pipeline to allow for alpha blend textures to be sourced from textures 0 or 1, while allowing the alpha blend texture coordinates to be derived in stage 3.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    d36cdeb View commit details
    Browse the repository at this point in the history
  127. Support for row major hsMatrix

    Swapping the shaders around to support row major hsMatrices and eliminating the swap function.
    
    This change hasn’t filtered down to the dynamic effects which get their uniforms through a giant buffer provided by the engine itself.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    fbee202 View commit details
    Browse the repository at this point in the history
  128. Removing most double decs from Metal shader

    Moving to using hsGMatStateEnums.h
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    7460ded View commit details
    Browse the repository at this point in the history
  129. Configuration menu
    Copy the full SHA
    0c63875 View commit details
    Browse the repository at this point in the history
  130. Configuration menu
    Copy the full SHA
    1c25979 View commit details
    Browse the repository at this point in the history
  131. Cleaning up sampler bug from optimizations

    Old sampler bindings were still in place hiding that per layer sampler binding was taking place during shader pre-compile. That caused state confusion because render encoders aren’t available during pre-compile. Removing old sampler bindings and making sure sampler binding only happens during draw - not precompiles.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    d971982 View commit details
    Browse the repository at this point in the history
  132. Moving shadow casting into lightless custom shader

    Shadows no longer need to alter light state - which is prep for the light refactor. Adds a programmable shadow pipeline that has it’s own state independent of the light system. Rendering of shadows is now done directly instead of through light manipulation and the “fixed” function vertex shader.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    a68ea2e View commit details
    Browse the repository at this point in the history
  133. Fixing bug in projections. Projections altered the sampler state for …

    …layer 0 without updating state tracking. (Perhaps sampler state changes should be wrapped in a function.)
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    ac0884f View commit details
    Browse the repository at this point in the history
  134. Adding graphics pipelines to pfFeatureInc

    Should allow tests to build on Mac again. pfFeatureInc included the Metal pipeline header, but didn’t declare it as a dependency.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    33e58a9 View commit details
    Browse the repository at this point in the history
  135. Configuration menu
    Copy the full SHA
    b8cf163 View commit details
    Browse the repository at this point in the history
  136. Configuration menu
    Copy the full SHA
    f0041e9 View commit details
    Browse the repository at this point in the history
  137. Configuration menu
    Copy the full SHA
    99d3c98 View commit details
    Browse the repository at this point in the history
  138. Configuration menu
    Copy the full SHA
    fbffe17 View commit details
    Browse the repository at this point in the history
  139. Adding clang-format

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    156fdbd View commit details
    Browse the repository at this point in the history
  140. Configuration menu
    Copy the full SHA
    b5f47c1 View commit details
    Browse the repository at this point in the history
  141. Adding comment for Metal UBO encoding

    Or rather the lack of UBO encoding.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    a0277c6 View commit details
    Browse the repository at this point in the history
  142. Fixing header guards

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    f45c306 View commit details
    Browse the repository at this point in the history
  143. Configuration menu
    Copy the full SHA
    448fbc6 View commit details
    Browse the repository at this point in the history
  144. Configuration menu
    Copy the full SHA
    da3da39 View commit details
    Browse the repository at this point in the history
  145. Moving some code to static_cast

    I likely have not found all the C style casts.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    b0428cd View commit details
    Browse the repository at this point in the history
  146. Configuration menu
    Copy the full SHA
    7bc5803 View commit details
    Browse the repository at this point in the history
  147. Removing delegate message filter for window size change. This was pre…

    …venting a delegate message from properly setting Plasma resolution on launch.
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    d9f0cb2 View commit details
    Browse the repository at this point in the history
  148. Configuration menu
    Copy the full SHA
    9568467 View commit details
    Browse the repository at this point in the history
  149. Another set of changes

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    8dab1e3 View commit details
    Browse the repository at this point in the history
  150. Configuration menu
    Copy the full SHA
    0705ab6 View commit details
    Browse the repository at this point in the history
  151. Configuration menu
    Copy the full SHA
    ea39b7e View commit details
    Browse the repository at this point in the history
  152. Configuration menu
    Copy the full SHA
    168277f View commit details
    Browse the repository at this point in the history
  153. Configuration menu
    Copy the full SHA
    f65a5eb View commit details
    Browse the repository at this point in the history
  154. Configuration menu
    Copy the full SHA
    d662e4c View commit details
    Browse the repository at this point in the history
  155. Shader CMake cleanup

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    b4899d7 View commit details
    Browse the repository at this point in the history
  156. Code feedback

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    da43aff View commit details
    Browse the repository at this point in the history
  157. Giving renderer direct access to the Metal layer and removing drawabl…

    …e callback
    
    (cherry picked from commit bcb7266f29fc71b136ce9c973fe41aac445ebfec)
    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    db3c6d4 View commit details
    Browse the repository at this point in the history
  158. Configuration menu
    Copy the full SHA
    1570887 View commit details
    Browse the repository at this point in the history
  159. More cleanup

    colincornaby committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    986e8d3 View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2023

  1. Configuration menu
    Copy the full SHA
    7b548f4 View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2023

  1. Configuration menu
    Copy the full SHA
    f3d9764 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e34919f View commit details
    Browse the repository at this point in the history

Commits on Nov 25, 2023

  1. Fixing pink screen at start

    The render command encoder is create lazily - and clear is not a draw call in Metal. A clear only pass meant no render was being encoded for the command buffer.
    
    The render command encoder management could use a bit of cleaning - but for now manually forcing the lazy creation of a command encoder. This could be probably moved to a non-lazy model - but it’s lazy right now because we’re holding for a clear command.
    colincornaby committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    0df34e5 View commit details
    Browse the repository at this point in the history

Commits on Nov 27, 2023

  1. Review feedback updates

    colincornaby committed Nov 27, 2023
    Configuration menu
    Copy the full SHA
    6c96be0 View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2023

  1. Configuration menu
    Copy the full SHA
    245b00f View commit details
    Browse the repository at this point in the history