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

Make the BC3 shaders compatible with GLSL ES version 310 #12

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

nanley
Copy link

@nanley nanley commented Sep 9, 2022

This is based on a collection of changes I had to make when I tried to compile these shaders in gles31 apps. Please let me know what you think.

@darksylinc
Copy link
Owner

  1. Could you do #define const instead? I prefer if const stays, rather than being removed. It's a very useful keyword that improves readability and maintenance
  2. @reduz thoughts? Originally betsy was written to maximize Vulkan compatibility so that it can be ported to Godot (that mostly reduces to declaring #version 450 on top though), but goals have changed a little. AFAIK this PR needs GLES 3.1 (not 3.0) due to the need for Compute Shader support.

@nanley
Copy link
Author

nanley commented Oct 4, 2022

Updated const.

WRT to Vulkan compatibility, we shouldn't need to change the version directive right? AFAICT, GL_KHR_vulkan_glsl is compatible with #version 310 es.

One downside I've noticed with the PR's usage of rg32 and rgba16 (c2f0e02) is that it'd require a Vulkan app to set VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT during image creation. This could have a negative performance impact with some Vulkan drivers. One solution is to update the stitch shader to use rgba16. However, that would impact a number of other shaders outside of the BC3 scope.

Increases compatibility with GLSL ES version 310.
This is a better fit for indexing and for using as a boolean.

While we're here, avoid implicit data type conversions with the elements
in the uniform. This increases compatibility with GLSL ES version 310.
Increases compatibility with GLSL ES version 310.
Increases compatibility with GLSL ES version 310.
Increases compatibility with GLSL ES version 310.
To be used in the following commit.
Increases compatibility with GLSL ES version 310.

The ARB_shader_image_load_store extension says,

	For textures allocated by the GL, an image unit format is
	compatible with a texture internal format if they match by size.

The textures were allocated by the GL implementation, so this format
substitution is safe to do.
The shaders are compatible with GLSL ES version 310. Require the
GL_ARB_ES3_1_compatibility extension and change the version directives
accordingly so that we get validation from the GL implementation.
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