Code Monkey home page Code Monkey logo

Comments (12)

dukeeeey avatar dukeeeey commented on June 5, 2024 2

#extension GL_ARB_shader_texture_lod : require
is the correct solution. You want it to error out if it's unsupported. This is a strange bug, it turns out every vendors implementation is technically wrong, other than MESA. They are simply too lax with the spec.

from supermodel.

dukeeeey avatar dukeeeey commented on June 5, 2024

The code is correct. The issue is the driver is missing functions that are part of the spec.

from supermodel.

zephryn avatar zephryn commented on June 5, 2024

Found out that adding #extension GL_ARB_shader_texture_lod : require to the fragment shader and not changing anything else seems to make it work again on my system, but yeah I probably didn't consider it just being a strange driver issue as much as I should have. Strange.

from supermodel.

trzy avatar trzy commented on June 5, 2024

Is this something we should add to the source code? Or, will it have a potentially adverse affect on systems where texture2DLod exists by replacing it with a function that behaves slightly different?

from supermodel.

zephryn avatar zephryn commented on June 5, 2024

The extension's spec page has the following snippet, which makes me imagine it's at least intended to be functionally identical to machines where it compiles without the extension specified:

    The existing isotropic vertex texture functions:

        texture1DLod,   texture1DProjLod,
        texture2DLod,   texture2DProjLod,
        texture3DLod,   texture3DProjLod,
        textureCubeLod,
        shadow1DLod,    shadow1DProjLod,
        shadow2DLod,    shadow2DProjLod,

    are added to the built-in functions for fragment shaders.

The spec also states it's written for GLSL 1.1 and OpenGL 2.0, and other references to this issue on the net seem to imply that GLSL 1.0-1.1 aren't supposed to support this function in fragment shaders without an extension; I don't know how different GLSL 1.2 (which the shader that causes this issue specifies its version as) is any different in regards to this quirk though.

It might better suffice to change require to enable in the extension declaration I posted earlier so that the extension isn't absolutely necessary to compile the shader, since evidently other setups don't have an issue with how things are now.

That being said, the biggest thing for me is that I haven't tested on anything else so I don't know for certain if this change would cause oddities with other machines because of OpenGL Implementation Magic individual graphics drivers seem to possess.

from supermodel.

dukeeeey avatar dukeeeey commented on June 5, 2024

You should really file a bug report with whomever wrote the gl driver. The version is set to #120 which means a compliant driver should support it since it's part of the core spec. The function got altered and renamed slightly for gl3+ to become just texturelod if I recall. That is the version used by the quad shader. The quad shader needs gl 4.5 but the triangle version is designed to run on the minimum possible gl version.

from supermodel.

casasfernando avatar casasfernando commented on June 5, 2024

I'm a bit late to the party. Discussing this same issue on the forums for the last couple of days: https://www.supermodel3.com/Forum/viewtopic.php?f=5&t=2231&start=20

Anyways. Looking at the specs for glsl 1.20 these functions can't be used in a fragment shader, but only in vertex shaders. The extension on the other hand allows the functions to be used in fragment shaders as well.
I found that mesa doesn't seem to allow to use extensions unless they are declared in the code or you use the force_glsl_extensions_warn=true environment variable at runtime.

Adding #extension GL_ARB_shader_texture_lod : require solves the problem but I will check later today if just using enable is enough and report back.

from supermodel.

casasfernando avatar casasfernando commented on June 5, 2024

After testing I can also confirm that it’s enough to set the extension to ‘enable’ instead of ‘require’.

from supermodel.

casasfernando avatar casasfernando commented on June 5, 2024

Thanks a lot for your help and patience the last few days @dukeeeey.

I can create a PR to address this one if you want, just let me know.

from supermodel.

trzy avatar trzy commented on June 5, 2024

I think a PR would be nice. Feels like this comes up frequently for people.

from supermodel.

casasfernando avatar casasfernando commented on June 5, 2024

I think a PR would be nice. Feels like this comes up frequently for people.

PR created.

Thanks!

from supermodel.

dukeeeey avatar dukeeeey commented on June 5, 2024

fixed already

from supermodel.

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.