Git Product home page Git Product logo

Comments (12)

e2002e avatar e2002e commented on August 16, 2024 1

Open GL !

from kinc.

RobDangerous avatar RobDangerous commented on August 16, 2024

Please use the issue template so I get the necessary info. What revision of Kinc are you on? Is this OpenGL?

from kinc.

e2002e avatar e2002e commented on August 16, 2024

Hi,
Kha commit 206d1ee3
Kinc commit b4d0aed

I pinpointed the issue to getTextureUnit().
It's possible to read / write to texture2 in the example only if the first set texture units is texture2. Subsequent calls seem to ignore bindings.

from kinc.

RobDangerous avatar RobDangerous commented on August 16, 2024

ok, you already answered 50% of my questions, good progress.

from kinc.

e2002e avatar e2002e commented on August 16, 2024

Hello, I looked into the code and I see that the getTextureUnit() has the job of allocation the computeTextureUnits, it gives these a binding point. What I can tell from further tests is that all compute textures seem to share the same binding point:
As I said, the only image that can be written / read is the first that we allocate, and I also noted that even when writing to another image in the compute shader, the operation will occur on the first allocated one anyway.

from kinc.

RobDangerous avatar RobDangerous commented on August 16, 2024

But when will you tell me what graphics backend you are using so I can check what you are talking about?

from kinc.

e2002e avatar e2002e commented on August 16, 2024

Hello, I have checked out Kha and Kinc to main and pulled the lattest changes.
There are compilations errors:

`../../../Kha/Backends/Kinc-hxcpp/main.cpp: In function ‘void {anonymous}::mix(kinc_a2_buffer_t*, int, void*)’:
../../../Kha/Backends/Kinc-hxcpp/main.cpp:229:74: error: ‘kinc_a2_buffer_t’ {aka ‘struct kinc_a2_buffer’} has no member named ‘format’
  229 |                 ::kha::audio2::Audio_obj::_callCallback(samples, buffer->format.samples_per_second);
      |                                                                          ^~~~~~
../../../Kha/Backends/Kinc-hxcpp/main.cpp:239:44: error: ‘kinc_a2_buffer_t’ {aka ‘struct kinc_a2_buffer’} has no member named ‘data’
  239 |                         *(float *)&buffer->data[buffer->write_location] = value;
      |                                            ^~~~
../../../Kha/Backends/Kinc-hxcpp/main.cpp: In function ‘void kha_kinc_init_audio()’:
../../../Kha/Backends/Kinc-hxcpp/main.cpp:343:30: error: invalid conversion from ‘void (*)(kinc_a2_buffer_t*, int, void*)’ {aka ‘void (*)(kinc_a2_buffer*, int, void*)’} to ‘void (*)(kinc_a2_buffer_t*, uint32_t, void*)’ {aka ‘void (*)(kinc_a2_buffer*, unsigned int, void*)’} [-fpermissive]
  343 |         kinc_a2_set_callback(mix, nullptr);
/Kha/Backends/Kinc-hxcpp/main.cpp:345:54: error: invalid conversion from ‘uint32_t (*)()’ {aka ‘unsigned int (*)()’} to ‘int’ [-fpermissive]
  345 |         ::kha::audio2::Audio_obj::samplesPerSecond = kinc_a2_samples_per_second;

from kinc.

RobDangerous avatar RobDangerous commented on August 16, 2024

I know, I'm currently merging and fixing up a feature-branch. Check the test status before pulling and especially before reporting, please - when it shows a red x, I already know about it. Also please don't add unrelated things into a GitHub issue.
grafik

from kinc.

e2002e avatar e2002e commented on August 16, 2024

Ok, thanks for reminding.

from kinc.

e2002e avatar e2002e commented on August 16, 2024

Hi rob,
I've added some printf statements to the kinc_g4_compute_shader_get_texture_unit() function in Kha/Kinc/Backends/Graphics4/OpenGL/Sources/kinc/backend/graphics4/compute.c.h

This looks like:

    int index = compute_findTexture(shader, name);
    fprintf(stderr, "index=%d\n", index);
    if (index < 0) {
	int location = glGetUniformLocation(shader->impl._programid, name);
	glCheckErrors();
	fprintf(stderr, "location=%d\n", location);
	index = shader->impl.textureCount;
	shader->impl.textureValues[index] = location;
	strcpy(shader->impl.textures[index], name);
	++shader->impl.textureCount;
	fprintf(stderr, "count=%d\n", shader->impl.textureCount);
}

And the output seems to reveal a bug:

Starting Kinc
Using OpenGL version 4.6 (forward-compatible).
index=-1
location=-1
count=1
index=-1
location=1
count=2

UPDATE:
Actually I thought there was an issue with the uniform location but it turns out the shader optimizes out the unused texture.
The issue's still the same though, the compute texture unit that we don't assign first can be writen / read to/from.

from kinc.

RobDangerous avatar RobDangerous commented on August 16, 2024

Don't worry, I don't need help debugging this. I'll get to it when I get to it.

from kinc.

RobDangerous avatar RobDangerous commented on August 16, 2024

Reminds me, if you want to come back to the Discord, feel free to - I opened up dedicated beginner channels for situations like this.

from kinc.

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.