Giter VIP home page Giter VIP logo

Comments (10)

lemoon avatar lemoon commented on June 9, 2024 1

Thank you for your response. Placing all resources in a single directory instead of separate placements for each project, and then copying the resources during Xcode project generation, followed by concatenating the resource directory with their respective files, could be a potential solution. Due to this issue, many of my projects require manual modification of all paths for debugging. Unfortunately, I am unable to provide you with more debug information promptly at the moment. I will provide you with feedback as I continue to use it in subsequent processes. Once again, I appreciate your response.

by the way , "swapChainDesc.samples = 4 " is work for me.

from llgl.

LukasBanana avatar LukasBanana commented on June 9, 2024 1

I found some CMake options to generate the working directory automatically:

I'll take a closer look tomorrow as this will require a higher CMake version as what I used before.

from llgl.

LukasBanana avatar LukasBanana commented on June 9, 2024 1

I added the automatic generation of the working directories for VS and Xcode with 9561114.

from llgl.

LukasBanana avatar LukasBanana commented on June 9, 2024

I see you selected some examples twice and some examples seem to work fine judging just by the logs. Can you please separate them and show the ones that fail again.

As for this error:

error (invalid argument): in 'CreateResourceHeap': cannot create resource heap with empty list of heap bindings
cannot create resource heap without bindings in pipeline layout

This is a small mistake, I haven't updated the Compute Shader example in a while, but you can simply change this line:

LLGL::Parse("cbuffer(2):comp, rwbuffer(3):comp, rwbuffer(4):comp")

... to this:

LLGL::Parse("heap{cbuffer(2):comp, rwbuffer(3):comp, rwbuffer(4):comp}")

and it should fix it. For a ResourceHeap, the resource bindings need to be specified as heapBindings and the Parse function reads the above layout as regular bindings.

The GLSL errors ERROR: 0:2: '' : version '130' is not supported can probably be fixed by just raising the GLSL shader version to 410 (in the respective .vert and .frag files) which is the highest version available on macOS.

UPDATE:
I fixed two of these issues with c24c33e and dd5bb47.

from llgl.

lemoon avatar lemoon commented on June 9, 2024

I see you selected some examples twice and some examples seem to work fine judging just by the logs. Can you please separate them and show the ones that fail again.

As for this error:

error (invalid argument): in 'CreateResourceHeap': cannot create resource heap with empty list of heap bindings
cannot create resource heap without bindings in pipeline layout

This is a small mistake, I haven't updated the Compute Shader example in a while, but you can simply change this line:

LLGL::Parse("cbuffer(2):comp, rwbuffer(3):comp, rwbuffer(4):comp")

... to this:

LLGL::Parse("heap{cbuffer(2):comp, rwbuffer(3):comp, rwbuffer(4):comp}")

and it should fix it. For a ResourceHeap, the resource bindings need to be specified as heapBindings and the Parse function reads the above layout as regular bindings.

The GLSL errors ERROR: 0:2: '' : version '130' is not supported can probably be fixed by just raising the GLSL shader version to 410 (in the respective .vert and .frag files) which is the highest version available on macOS.

UPDATE: I fixed two of these issues with c24c33e and dd5bb47.

Commit:
dd5bb47 [dd5bb47]
Parents:
c24c33e
Author:
Laura Hermanns [email protected]
Labels:
HEAD master origin/master origin/HEAD

This is the code I pulled from the latest master commit, and here is the error log from the execution.

select example: 1
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
3
selected renderer: Metal
Renderer:             Metal 2.1
Device:               Apple M2 Max
Vendor:               Apple
Shading Language:     Metal Shading Language
Swap Chain Format:    BGRA8UNorm
Depth/Stencil Format: <undefined>
failed to create instance of <MTLRenderPipelineState>: rasterSampleCount (8) is not supported by device.
select example:
select example: 2
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
3
selected renderer: Metal
render system:
  renderer:           Metal 2.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   Metal Shading Language

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        BGRA8UNorm
  depthStencilFormat: D32FloatS8X24UInt

error (invalid argument): in 'CreatePipelineState': cannot create graphics PSO without vertex shader
error (invalid argument): in 'CreatePipelineState': cannot create graphics PSO with compute shader being assigned to tessellation control stage
error (invalid argument): in 'CreatePipelineState': cannot create graphics PSO with vertex shader being assigned to tessellation evaluation stage
failed to create instance of <MTLRenderPipelineState>: rasterSampleCount (8) is not supported by device.
select example:
select example: 3
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
2
selected renderer: OpenGL
render system:
  renderer:           OpenGL 4.1 Metal - 83.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   GLSL 4.10

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        RGBA8UNorm
  depthStencilFormat: D24UNormS8UInt

error (unsupported feature): in 'CreateTexture': cannot create texture with unsupported format: BC1UNorm
texture creation time: 1.09454 ms
press TAB KEY to switch between five different texture samplers
UNSUPPORTED (log once): POSSIBLE ISSUE: unit 0 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable

select example: 3
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
3
selected renderer: Metal
render system:
  renderer:           Metal 2.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   Metal Shading Language

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        BGRA8UNorm
  depthStencilFormat: D32FloatS8X24UInt

failed to create instance of <MTLRenderPipelineState>: rasterSampleCount (8) is not supported by device.
select example:
select example: 4
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
2
selected renderer: OpenGL
render system:
  renderer:           OpenGL 4.1 Metal - 83.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   GLSL 4.10

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        RGBA8UNorm
  depthStencilFormat: D24UNormS8UInt

loaded texture: ../../Media/Textures/Crate.jpg
error (invalid argument): in 'CreateRenderTarget': cannot use color format for depth-stencil attachment
in 'ToGLDepthStencilAttachmentBinding': reached code path that should be unreachable
./RunExamplesMacOS.command: line 38:  6906 Abort trap: 6           ../../../$BUILD_DIR/Example_RenderTarget.app/Contents/MacOS/Example_RenderTarget
select example:
select example: 4
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
3
selected renderer: Metal
render system:
  renderer:           Metal 2.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   Metal Shading Language

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        BGRA8UNorm
  depthStencilFormat: D32FloatS8X24UInt

loaded texture: ../../Media/Textures/Crate.jpg
-[MTLTextureDescriptorInternal validateWithDevice:]:1344: failed assertion `Texture Descriptor Validation
MTLTextureDescriptor sampleCount (8) is not supported by device.
'
./RunExamplesMacOS.command: line 38:  6910 Abort trap: 6           ../../../$BUILD_DIR/Example_RenderTarget.app/Contents/MacOS/Example_RenderTarget
select example:
select example: 5
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
3
selected renderer: Metal
render system:
  renderer:           Metal 2.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   Metal Shading Language

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        BGRA8UNorm
  depthStencilFormat: D32FloatS8X24UInt

failed to create instance of <MTLRenderPipelineState>: rasterSampleCount (8) is not supported by device.
select example:
select example: 6
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
3
selected renderer: Metal
render system:
  renderer:           Metal 2.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   Metal Shading Language

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        BGRA8UNorm
  depthStencilFormat: D32FloatS8X24UInt

loaded texture: ../../Media/Textures/Plants_0.png
loaded texture: ../../Media/Textures/Plants_1.png
loaded texture: ../../Media/Textures/Plants_2.png
loaded texture: ../../Media/Textures/Plants_3.png
loaded texture: ../../Media/Textures/Plants_4.png
loaded texture: ../../Media/Textures/Plants_5.png
loaded texture: ../../Media/Textures/Plants_6.png
loaded texture: ../../Media/Textures/Plants_7.png
loaded texture: ../../Media/Textures/Plants_8.png
loaded texture: ../../Media/Textures/Plants_9.png
loaded texture: ../../Media/Textures/Grass.jpg
failed to create instance of <MTLRenderPipelineState>: rasterSampleCount (8) is not supported by device.
select example:
select example: 7
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
3
selected renderer: Metal
render system:
  renderer:           Metal 2.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   Metal Shading Language

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        BGRA8UNorm
  depthStencilFormat: D32FloatS8X24UInt

shaders not available for selected renderer in this example
select example:

select example: 8
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
3
selected renderer: Metal
render system:
  renderer:           Metal 2.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   Metal Shading Language

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        BGRA8UNorm
  depthStencilFormat: D32FloatS8X24UInt

-[MTLTextureDescriptorInternal validateWithDevice:]:1344: failed assertion `Texture Descriptor Validation
MTLTextureDescriptor sampleCount (8) is not supported by device.
'
./RunExamplesMacOS.command: line 38:  6937 Abort trap: 6           ../../../$BUILD_DIR/Example_PostProcessing.app/Contents/MacOS/Example_PostProcessing
select example:
select example: 9
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
3
selected renderer: Metal
render system:
  renderer:           Metal 2.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   Metal Shading Language

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        BGRA8UNorm
  depthStencilFormat: D32FloatS8X24UInt

failed to create instance of <MTLRenderPipelineState>: rasterSampleCount (8) is not supported by device.

select example: 10
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
3
selected renderer: Metal
render system:
  renderer:           Metal 2.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   Metal Shading Language

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        BGRA8UNorm
  depthStencilFormat: D32FloatS8X24UInt

failed to create instance of <MTLRenderPipelineState>: rasterSampleCount (8) is not supported by device.
select example: 12
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
3
selected renderer: Metal
render system:
  renderer:           Metal 2.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   Metal Shading Language

swap-chain:
  resolution:         800 x 800
  samples:            8
  colorFormat:        BGRA8UNorm
  depthStencilFormat: D32FloatS8X24UInt

failed to create instance of <MTLRenderPipelineState>: rasterSampleCount (8) is not supported by device.
select example: 16
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
3
selected renderer: Metal
render system:
  renderer:           Metal 2.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   Metal Shading Language

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        BGRA8UNorm
  depthStencilFormat: D32FloatS8X24UInt

loaded texture: ../../Media/Textures/Crate.jpg
loaded texture: ../../Media/Textures/TilesGray512.jpg
loaded texture: ../../Media/Textures/TilesBlue512.jpg
failed to create instance of <MTLRenderPipelineState>: rasterSampleCount (8) is not supported by device.
select example:
select example: 12
select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal
2
selected renderer: OpenGL
render system:
  renderer:           OpenGL 4.1 Metal - 83.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   GLSL 4.10

swap-chain:
  resolution:         800 x 800
  samples:            8
  colorFormat:        RGBA8UNorm
  depthStencilFormat: D24UNormS8UInt

compute shaders are not supported by this renderer
select example:

select example: 16
2select renderer:
 1.) Null
 2.) OpenGL
 3.) Metal

selected renderer: OpenGL
render system:
  renderer:           OpenGL 4.1 Metal - 83.1
  device:             Apple M2 Max
  vendor:             Apple
  shading language:   GLSL 4.10

swap-chain:
  resolution:         800 x 600
  samples:            8
  colorFormat:        RGBA8UNorm
  depthStencilFormat: D24UNormS8UInt

loaded texture: ../../Media/Textures/Crate.jpg
loaded texture: ../../Media/Textures/TilesGray512.jpg
loaded texture: ../../Media/Textures/TilesBlue512.jpg
ERROR: 0:3: '' :  version '430' is not supported
ERROR: 0:3: '' : syntax error: #version
ERROR: 0:4: '' :  #version required and missing.
ERROR: 0:12: '0' : syntax error: integers in layouts require GLSL 140 or later

ERROR: 0:3: '' :  version '430' is not supported
ERROR: 0:3: '' : syntax error: #version
ERROR: 0:4: '' :  #version required and missing.
ERROR: 0:7: '0' : syntax error: integers in layouts require GLSL 140 or later


from llgl.

LukasBanana avatar LukasBanana commented on June 9, 2024

Most of the issues seem to be coming from lower multi-sampling support. I addressed that in b46428e.

As for example 16 (Resource Binding): This one requires GLSL 430 for the GL backend, which is not supported on macOS, so you'll have to stick with Metal for that example and the OpenGL support is fragile on macOS anyway as it has been deprecated a long time ago.

I can't tell why this error shows up, though:

in 'CreateRenderTarget': cannot use color format for depth-stencil attachment

The RenderTarget example should only create a custom depth texture with the D32Float format, which is not a color format, so I don't understand how this ends up with a wrong configuration.
In case you are able to compile and run this example through Xcode, can you set a breakpoint at the LLGL_UNREACHABLE(); line in GLRenderTarget.cpp and tell me what value lldb shows you for the format parameter?

Besides that, I would stick to Metal over OpenGL on the modern M1 and M2 Macs.

from llgl.

lemoon avatar lemoon commented on June 9, 2024

Hello-Triangle still not work

image

image

After generating the Xcode project, when debugging, the paths for resources (such as "Example.metal") need to be redefined. Could you provide a command for this? My command is as follows:

#!/bin/sh

SOURCE_DIR="$(dirname $0)"
BUILD_DIR="$SOURCE_DIR/xcode_macos"

# Ensure we are inside the repository folder
if [ ! -f "$SOURCE_DIR/CMakeLists.txt" ]; then
    echo "error: file not found: CMakeLists.txt"
    exit 1
fi

# Make output build folder
if [ "$#" -eq 1 ]; then
    BUILD_DIR=$1
else
    if [ ! "$#" -eq 0 ]; then
        echo "error: too many arguemnts"
        echo "usage: BuildMacOS.command [BUILD_DIR]"
        exit 1
    fi
fi

if [ ! -d "$BUILD_DIR" ]; then
    mkdir "$BUILD_DIR"
fi

# Checkout external depenencies
GAUSSIAN_LIB_DIR="$BUILD_DIR/GaussianLib/include"

if [ ! -d "$GAUSSIAN_LIB_DIR" ]; then
    (cd "$BUILD_DIR" && git clone https://github.com/LukasBanana/GaussianLib.git)
fi

# Build into output directory
cmake -G "Xcode" \
    -DLLGL_BUILD_RENDERER_OPENGL=ON \
    -DLLGL_BUILD_RENDERER_METAL=ON \
    -DLLGL_BUILD_EXAMPLES=ON \
    -DGaussLib_INCLUDE_DIR:STRING="$GAUSSIAN_LIB_DIR" \
    -S "$SOURCE_DIR" \
    -B "$BUILD_DIR"

from llgl.

LukasBanana avatar LukasBanana commented on June 9, 2024

I haven't found a way in CMake yet to define the working directories. That's why I added this note to the examples folder. And the RunExamplesMacOS.command script automatically changes the working directory, but I don't know how to tell CMake to configure the projects this way.

The Hello Triangle tutorial doesn't use the ExampleBase project, so you'd have to change the sampling count to 4 yourself, that's what all Metal devices support. You can change it here:

swapChainDesc.samples = 8; // check if LLGL adapts sample count that is too high

from llgl.

LukasBanana avatar LukasBanana commented on June 9, 2024

Any updates on this issue @lemoon? I cannot test on an M2 device myself.

from llgl.

LukasBanana avatar LukasBanana commented on June 9, 2024

Several issues in the Mac backend have been fixed in recent commits. Please feel free to open a new ticket if any of the mentioned issued persist.

from llgl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.