cancel
Showing results for 
Search instead for 
Did you mean: 

OpenGL & Vulkan

ronniko
Adept I

Could OpenGL have feature change shaders code like bindlless textures ?

First interesting could GNC GPU change shaders code or piece of shader code, from texture or special (lets say ShaderBuffer) ?

How exactly GNC GPU change shaders ?

My proposition apply to OpenGL new feature, change shaders code from bindlless textures or from special ShaderBufferArray.

And when we draw one mesh 3 times (glDrawElementsInstanced ) , in main shader we do somthing like this  ShaderBufferArray([gl_InstanceID])

This mechanism will allow change on GPU shaders or  piece of shader code without CPU driver.

I know Shader Subroutine but dynamic subroutines slow and decrease FPS on 11%.

Very funny look ShaderBufferArray when we in Compute Shader could change on fly shader code in ShaderBufferArray !

Generated cool effects on fly.

0 Likes
2 Replies
dorisyan
Staff

Hi ronniko​, thanks for your proposition! As shader code couldn't be generated automatically, there is no feature that could change shaders code.

0 Likes

If we did compile shader code(small pieces)  and then store(like asm shader code) in GPU texture or special ShaderBufferArray and generate diferents shaders code from small parts ?

I mean make up from small asm pieces shader blocks one big shader code.

Psevdo code in Compute shader:

ShaderBufferArray[0] read;

ShaderBufferArray[1] read;

ShaderBufferArray[2] read;

ShaderBufferArray[3] write;

output ShaderBufferArray[3] = ShaderBufferArray[0] + ShaderBufferArray[1] + ShaderBufferArray[2];

And we get new shader code in ShaderBufferArray[3]

0 Likes