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

Sokol shadows support #151

Closed

Conversation

ivan-ushakov
Copy link
Contributor

No description provided.

@CLAassistant
Copy link

CLAassistant commented May 22, 2024

CLA assistant check
All committers have signed the CLA.

@ivan-ushakov ivan-ushakov marked this pull request as draft May 22, 2024 19:44
@ivan-ushakov
Copy link
Contributor Author

Also tile map shader for GeforceFX (https://github.com/KD-lab-Open-Source/Perimeter/blob/cmake/Source/Render/shader/GeforceFX/tile_map_scene.psh#L54) contains commented out PCF:

dcl t0.xyzw
dcl t1.xyzw
dcl t2.xyzw
dcl t3.xyzw
dcl t4.xy
dcl t5.xy

dcl_2d s0
dcl_2d s1
dcl_2d s2
dcl_2d s4
dcl_2d s5

texld_pp  r0, t0, s0
texld_pp  r1, t1, s0
add_pp r0.rgb,r0,r1
texld_pp  r1, t2, s0
add_pp r0.rgb,r0,r1
texld_pp  r1, t3, s0

I think it was commented out because of performance but we could use it to get smooth shadows (https://learnopengl.com/Advanced-Lighting/Shadows/Shadow-Mapping).



enum SOKOL_MATERIAL_TYPE {
SOKOL_MAT_NONE = 0,
SOKOL_MAT_LIGHT = 1,
};

using pipeline_id_t = uint32_t;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to complexity of adding new pipeline types (and bit shifting) I decided to search pipeline by combination of parameters from context. I keep all pipelines in vector and since we don't expect to have a lot of pipelines, search should not be a problem.

@ivan-ushakov ivan-ushakov force-pushed the sokol-shadows-support branch 2 times, most recently from 2d03e1f to 8ed928f Compare May 23, 2024 16:55
@@ -20,7 +20,7 @@ IF (OPTION_PROCESS_SHADERS)

if(NOT DEFINED ENV{PERIMETER_SHADER_LANG})
#Use all GLSL dialects, HLSL for D3d and WebGPU
set(PERIMETER_SHADER_LANG "glsl410:glsl300es:hlsl5:wgsl")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wsgl does not support sampler2DShadow but in Sokol examples they use Open GL ES for this:

if (FIPS_EMSCRIPTEN)
    if (FIPS_EMSCRIPTEN_USE_WEBGPU)
        set(sokol_backend SOKOL_WGPU)
        set(slang "wgsl")
    else()
        set(sokol_backend SOKOL_GLES3)
        set(slang "glsl300es")
    endif()

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, is fine since we dont use wgpu but good to remember in future in case is needed back

@ivan-ushakov ivan-ushakov force-pushed the sokol-shadows-support branch 2 times, most recently from 6f98763 to e9f7c4f Compare May 26, 2024 12:25
@ivan-ushakov ivan-ushakov force-pushed the sokol-shadows-support branch from 82d7ccb to b5f28dc Compare June 6, 2024 18:22
@ivan-ushakov ivan-ushakov deleted the sokol-shadows-support branch October 23, 2024 06:31
IonAgorria added a commit to IonAgorria/Perimeter that referenced this pull request Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants