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

New binding system concept #348

Open
ghost opened this issue Jun 11, 2017 · 0 comments
Open

New binding system concept #348

ghost opened this issue Jun 11, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Jun 11, 2017

Hello. I suggest to make new binding system. I suggest to add binding objects.

auto BufferBinding = new BufferBaseBinding(0, GL_SHADER_STORAGE_BUFFER);
BufferBinding.setBuffer(SomeBufferObject);
BufferBinding.apply();

// or Context.apply();

After will possible to just use BufferBinding.apply();. I suggest to base buffer binding on WeakPtr.

Also I suggest to make multi-bind support.
https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_multi_bind.txt

auto MultiBinding = new MultiBufferBindingBase(0, GL_SHADER_STORAGE_BUFFER); 
MultiBinding.addBuffer(SomeBufferObject);
MultiBinding.addBuffer(AnotherBufferObject);

// removing buffers
MultiBinding.spliceBuffer(0);
MultiBinding.spliceBuffer(AnotherBufferObject);

MultiBinding.apply();

Also, I tired support my own OpenGL wrapper. I also planned rewrite ray tracer host code.

About ranged binding and setting.

auto Range = new Range<GLint>(0, 16);
auto Range = new Range(0, strided<GLint>(16)); // probably this (without template)

RangedBinding.setBuffer(SomeBuffer, Range);
MultiRangedBinding.addBuffer(SomeBuffer, Range);

Only, I don't know how should work multi-bind with range objects.

I suggest to multi-bind textures.

auto MultiBindTexture = new MultiTextureBinding(0); // bind from zeros
MultiBindTexture.addTexture(TextureObject); 
MultiBindTexture.apply();
MultiBindTexture.setUniformStride(UniformLocation, 48); // if uniform is array, length optional
MultiBindTexture.setUniformStride(UniformLocation, new Range(0, 48)); // if need offset from 

auto MultiBindSampler = new MultiSamplerBinding(0); // from zero texture bindings
MultiBindSampler.addSampler(SamplerObject);
MultiBindSampler.apply();

And just binding textures.

auto TextureBindingObject = new TextureBinding(0);
TextureBindingObject.setTexture(TextureObject);
TextureBindingObject.apply();
TextureBindingObject.setUniform(UniformLocation); // to uniform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant