Kode / Kha

Ultra-portable, high performance, open source multimedia framework.
http://kha.tech
zlib License
1.48k stars 174 forks source link

Problems with setting uniform float on opengl (observed on Windows 11 and HTML5) #1381

Closed smallfx closed 2 years ago

smallfx commented 2 years ago

Describe the bug

Example code here: https://github.com/smallfx/kha_issues

I am on Windows 11, and I'm experiencing some weirdness with the opengl graphics target when compiling for Windows and HTML5. (in the case of HTML5 I guess it would be opengl es?) Anecdotally this was also observed on Windows 10 after upgrading to a recent version of Kha, although I can't test that anymore because I upgraded to 11.

For the OpenGL graphics target, it seems like setting a uniform float using my_cool_framebuffer.g4.setFloat() does not take effect. It should be noted that it can be observed to take effect properly when compiling with default graphics (as mentioned above).

(It should also be noted that I am using a custom g2 (aptly named CustomG2) to more closely replicate my engine's setup and to have a custom useCanvas function. In my engine it is also used to add additional things to the vertex structure by default, etc.)

To Reproduce Steps to reproduce the behavior:

  1. Be on Windows (I am on Windows 11, platform seems irrelevant for HTML5's case though. also observed on macOS when compiling for HTML5)
  2. In CMD or Windows Terminal, cd to the kha_issues cloned git repo directory.
  3. Run node <KHA_DIRECTORY>\Tools\khamake\khamake.js --run --graphics opengl (compiling for HTML5 results in the same thing)
  4. Witness the following behavior (no darkening effect despite the call to g4.setFloat()) スクリーンショット 2021-12-04 160930

Expected behavior It is expected that setting the screenDarkenUniform uniform with g4.setFloat() would darken the rendered image according to the shader specified in the custom pipeline.

Execution Environment:

Build time: 0m 39s Starting Kinc Initializing a new default audio device. Falling back to the system's preferred WASAPI mix format. Starting application


- Application output (if it runs): no output, it just runs.
RobDangerous commented 2 years ago

There's two bugs in your program: