About shader over gl3, why and where?

We create a shader,
SHc = glCreateShader( type); where is the SHc? some doc said it locate at mainboard memory, some say it at display card mem? who is right? ( where SHc points to an area in display card mem).

2] next, we read shader text into mem by textFileRead("…"), then input it into display card mem by glShaderSource( ), Why don’t we read it into display card mem directly, cancel the read procedure.

3] then compile and create a program for GPU runs.
Why don’t we create the program at very first? them add shaders and compile, link, which may be more suitable to the custom of programming,

Does this proceduer do more good?
1] generate a gpu program,
2] create shader pointers,
3] read shaders text into VBO diresctly
4] compile and link the program which will be run by GPU.

where is the SHc?

Nowhere. It’s just a number, an opaque handle that represents the created shader object. Where the implementation allocates the memory for this object is irrelevant to you.

next, we read shader text into mem by textFileRead(“…”), then input it into display card mem by glShaderSource( ), Why don’t we read it into display card mem directly, cancel the read procedure.

And how exactly would that be of some benefit, when the very next step is to run a CPU-based process (ie: compiling the shader)?

Why don’t we create the program at very first?

Because there’s no point, since the program object needs compiled shader objects to work. Unless you creating separate programs.

[QUOTE=Alfonse Reinheart;1265070]Nowhere. It’s just a number, an opaque handle that represents the created shader object. Where the implementation allocates the memory for this object is irrelevant to you.

most docs say like this. it allocates gc mem just like that os allocate system mem for object. which has nothing to do with programmer.
but the name show us a delusion.

And how exactly would that be of some benefit, when the very next step is to run a CPU-based process (ie: compiling the shader)?
that seems like a subprocess in socalled cpu-based program.

Because there’s no point, since the program object needs compiled shader objects to work. Unless you creating separate programs.[/QUOTE]
entry point?
why not act it as a subprogram?

hot to use this multi-quote? like you used that.

Nowhere. It’s just a number, an opaque handle that represents the created shader object. Where the implementation allocates the memory for this object is irrelevant to you.

most docs say like this. it allocates gc mem just like that os allocate system mem for object. which has nothing to do with programmer.
but the name show us a delusion.

[QUOTE]

Because there’s no point, since the program obj

entry point?
why not act it as a subprogram?

[/QUOTE]

[QUOTE=Alfonse Reinheart;1265070]Nowhere. It’s just a number, an opaque handle that represents the created shader object. Where the implementation allocates the memory for this object is irrelevant to you.

And how exactly would that be of some benefit, when the very next step is to run a CPU-based process (ie: compiling the shader)?

Because there’s no point, since the program object needs compiled shader objects to work. Unless you creating separate programs.[/QUOTE]

most docs say like this. it allocates gc mem just like that os allocate system mem for object. which has nothing to do with programmer. but the name show us a delusion.

the benefit will be reducing coding, and compact. and make design clear, not get error. just like a subprogram running in a mainprog.

It’s text formatting, standard PHP forum markup. I just copy-and-pasted your text into quote blocks that I wrote.

Of course, you’d have to expend more than a couple seconds worth of effort in formulating a reply.

most docs say like this. it allocates gc mem just like that os allocate system mem for object. which has nothing to do with programmer. but the name show us a delusion.

What “most docs”? Show me an example of one that says this.

the benefit will be reducing coding, and compact. and make design clear, not get error. just like a subprogram running in a mainprog.

Except that it would in no way do any of these. First, shaders are not “like a subprogram running in a mainprog”, so trying to pretend that they are does not make the design clear. Second, you only “get error” if you do it wrong. Third, the implementation needs to compile your shader. This is a CPU process, not a GPU one, so putting the shader source code into GPU memory is completely worthless.

Fourth, as your posts indicate, you have too minimal of an understanding of the API or graphics hardware to be making suggestions about what would be a better API.

You haven’t got a helpful reply on this yet, so I’ll help you out. Websearch “bbcode”. Example hits (the first from this site):

Search down on each for “quote”. For instance:[noparse]

Stuff.

More of my quote

More stuff.[/noparse]

would display as:

Stuff.

More of my quote
More stuff.

Of course, you can put carriage returns in there where you want for readability. You can also use the quote “toolbar button” in the editing dialog to do this as well, if you can’t remember the markup.

By the way, you’re asking good questions. Keep reading up on OpenGL and asking probing questions like this, and don’t let the attitude of some discourage you. However, these aren’t really advanced questions. Consider posting in the Beginner’s forum until you’re sure you’ve got your footing and know you’re asking an advanced question.

[QUOTE=Dark Photon;1265091]You haven’t got a helpful reply on this yet, so I’ll help you out. Websearch “bbcode”. Example hits (the first from this site):

Search down on each for “quote”. For instance:[noparse]
Stuff.

More stuff.[/noparse]

would display as:
Stuff. More stuff.

Of course, you can put carriage returns in there where you want for readability. You can also use the quote “toolbar button” in the editing dialog to do this as well, if you can’t remember the markup.

By the way, you’re asking good questions. Keep reading up on OpenGL and asking probing questions like this, and don’t let the attitude of some discourage you. However, these aren’t really advanced questions. Consider posting in the Beginner’s forum until you’re sure you’ve got your footing and know you’re asking an advanced question.[/QUOTE]

I can use the bbcode. and how to quote a paragraph. however, I think its too trouble to write it one by one, so I just use the toolbar prompt, but don’t know how to use that multiquote one by one.
forget it. it’s not important for our question.
I don’t care what the apitude the reply is. verybody has his own words style. what I want is to get result. the correct result,
Im not lazer , but muany books wrote like a lecture in a class without emphases. often can’t get use to it.
What I put the matter here is imagine there may be more skillful specialists to reply and answer.
In fact, beginner question and that of advance have no distinclt gap, I think how to install, get materials is belong to beginner, others may be to advace catalogue.

[QUOTE=Alfonse Reinheart;1265080]It’s text formatting, standard PHP forum markup. I just copy-and-pasted your text into quote blocks that I wrote.

Of course, you’d have to expend more than a couple seconds worth of effort in formulating a reply.

What “most docs”? Show me an example of one that says this.

Except that it would in no way do any of these. First, shaders are not “like a subprogram running in a mainprog”, so trying to pretend that they are does not make the design clear. Second, you only “get error” if you do it wrong. Third, the implementation needs to compile your shader. This is a CPU process, not a GPU one, so putting the shader source code into GPU memory is completely worthless.

Fourth, as your posts indicate, you have too minimal of an understanding of the API or graphics hardware to be making suggestions about what would be a better API.[/QUOTE]
control -c and c one by one? too trouble, forget it.
2] but all the books are translated from Eng, they are in Chinese. I have no Eng original book one. the sample is from those books, you may be familiar with them. and know where they are from which books.
3]no, I haven’t yet said that the shader is a subprog, just said the prog in glsl looks like a subprog, as it were.
4]I siad as you do, it compliesand then add to the prog. just consern about sequence.
they are compiled and linked in cpu procedure, just run in gpu. as the glsl is a gpu language.
5]you are right to guess that, Im out of gpu hardware and api of gl, despite they have the same style as winapi.
and what is important, havnt’ yet found how gopu process these api parallelly.
Can you show me one sample how the gpu(n ora) process tow , three or more sharders sync.?

or say process vertices sync parallely. for exaple, if the gpu has 12 pipelines, how glsl controls them to process 12 vertices sync?
How to reflect that in gl api?

[QUOTE=reader1;1265103]or say process vertices sync parallely. for exaple, if the gpu has 12 pipelines, how glsl controls them to process 12 vertices sync?
How to reflect that in gl api?[/QUOTE]

It doesn’t need to. Just like you don’t need to know exactly how your mail gets from one place to another in order to send it. OpenGL removes those details from your consideration. If you render 12 vertices in a draw call, OpenGL will do what it says it will do. Exactly how the GPU farms out vertex shader invocations and so forth is both unimportant and hardware-dependent.

No, I dont totlally agree to you at this spot.
Sometimes, Im always curious how many routers the mail pass through. that may be more important form other one who does his work.
just like task schedual, know how opengl operates the paralle running may be useful sometimes.
opengl tells pipeline work routine, but no parallel, how about if we calculate 128, or 360 vertices, but if display card has only 128 pipelines?

[QUOTE=reader1;1265118]No, I dont totlally agree to you at this spot.
Sometimes, Im always curious how many routers the mail pass through. that may be more important form other one who does his work.
just like task schedual, know how opengl operates the paralle running may be useful sometimes.
opengl tells pipeline work routine, but no parallel, how about if we calculate 128, or 360 vertices, but if display card has only 128 pipelines?[/QUOTE]

Then obviously some of those vertices will have to wait to begin their execution. This sort of scheduling is generally handled internally by the GPU.

you are certainly right. but How does opengl call the instructions is vague.
which api can shed a light on it?

[QUOTE=reader1;1265144]you are certainly right. but How does opengl call the instructions is vague.
which api can shed a light on it?[/QUOTE]

None. No API, not even the upcoming Vulkan or Direct3D 12, is that low-level that it involves explicit details of GPU workload scheduling.

You are talking about specific details about things that vary significantly from hardware to hardware. The question cannot be answered in the general case anymore than I already have: it’s handled internally in an implementation-defined manor, typically implemented in GPU scheduling logic, possibly informed by data provided at render-time.

[QUOTE=Alfonse Reinheart;1265148]None. No API, not even the upcoming Vulkan or Direct3D 12, is that low-level that it involves explicit details of GPU workload scheduling.

You are talking about specific details about things that vary significantly from hardware to hardware. The question cannot be answered in the general case anymore than I already have: it’s handled internally in an implementation-defined manor, typically implemented in GPU scheduling logic, possibly informed by data provided at render-time.[/QUOTE]
I don;t like to discuss hardware here. just wish to know how the language works.
well, I seem to forget what question I have asked here. I shall review. lets go back to our right way.