Closed rogermc2 closed 5 years ago
Here is the C version code which has been built and run with Xcode 9.3. I hope its all there as the source is from a few different directories
As well as the graphic display, it reports:
GLFW Version: 3.3.0 Cocoa NSGL
Varying Max Length: 13
Varying Buffer mode: 8c8c
Varying name: position_out
Maximum name length: 12
Type of varying: 8b52
Size of varying: 1
Varying name: velocity_out
Maximum name length: 12
Type of varying: 8b51
Size of varying: 1
Varying Max Length: 13
Varying Buffer mode: 8c8c
Varying name: world_space_position
Maximum name length: 20
Type of varying: 8b52
Size of varying: 1
Program ended with exit code: 0.
I tried removing the link step removed from Program_From
.
The same failure messages occurred.
I think I had Transform_Feedback_Varyings
working OK on another example.
Can you PR that other example?
Another similar example I checked produces the same problem.
I was looking at a more complex example that uses Transform_Feedback_Varyings but couldn't complete compilation as GL.Objects.Buffers.Draw_Elements_Base_Vertex
(glDrawElementsBaseVertex
) seems to have disappeared from GL.Objects.Buffers
.
I got the more complex example working by commenting out GL.Objects.Buffers.Draw_Elements_Base_Vertex
I don't think I can PR it as it contains quite a lot of new functionality including Assimp
and ImageMagick
routines.
Also very much a work in progress, so probably a bit of a mess!
This example that I'm trying to implement is from http://ogldev.atspace.co.uk/www/tutorial28/tutorial28.html
The following initialisation code seems to link the varyings OK as it generates the PS_Update_Technique.Init, Update_Program Link for Varyings ok
message.
procedure Init (theTechnique : in out Update_Technique) is
use GL.Objects.Programs;
use GL.Objects.Shaders;
use Program_Loader;
Varyings : constant String := "Type1,Position1,Velocity1,Age1";
OK : Boolean;
begin
-- Program_From includes linking
theTechnique.Update_Program := Program_From
((Src ("src/shaders/ps_update.vs", Vertex_Shader),
Src ("src/shaders/ps_update.gs", Geometry_Shader),
Src ("src/shaders/ps_update.fs", Fragment_Shader)));
OK := GL.Objects.Programs.Link_Status (theTechnique.Update_Program);
if not OK then
Put_Line ("PS_Update_Technique.Init, Update_Program Link failed");
Put_Line (GL.Objects.Programs.Info_Log (theTechnique.Update_Program));
else
Put_Line ("PS_Update_Technique.Init, Update_Program Link ok");
end if;
Use_Program (theTechnique.Update_Program);
Transform_Feedback_Varyings (theTechnique.Update_Program, Varyings,
Interleaved_Attribs);
theTechnique.Update_Program.Link;
OK := GL.Objects.Programs.Link_Status (theTechnique.Update_Program);
if not OK then
Put_Line ("PS_Update_Technique.Init, Update_Program Link for Varyings failed");
Put_Line (GL.Objects.Programs.Info_Log (theTechnique.Update_Program));
else
Put_Line ("PS_Update_Technique.Init, Update_Program Link for Varyings ok");
end if;
Utilities.Set_Uniform_Location (theTechnique.Update_Program, "gDeltaTimeMillis",
theTechnique.Delta_Millisec_Location);
Utilities.Set_Uniform_Location (theTechnique.Update_Program, "gRandomTexture",
theTechnique.Random_Texture_Location);
Utilities.Set_Uniform_Location (theTechnique.Update_Program, "gTime",
theTechnique.Time_Location);
Utilities.Set_Uniform_Location (theTechnique.Update_Program, "gLauncherLifetime",
theTechnique.Launcher_Lifetime_Location);
Utilities.Set_Uniform_Location (theTechnique.Update_Program, "gShellLifetime",
theTechnique.Shell_Lifetime_Location);
Utilities.Set_Uniform_Location (theTechnique.Update_Program, "gSecondaryShellLifetime",
theTechnique.Secondary_Shell_Lifetime_Location);
exception
when others =>
Put_Line ("An exception occurred in PS_Update_Technique.Init.");
raise;
end Init;
I'm writing a short varyings test program based on the Init
procedure to test transform varyings which I can PR when completed.
I added some tests:
V_Size := Transform_Feedback_Varyings (Update_Program);
V_Max_Length := Transform_Feedback_Varying_Max_Length (Update_Program);
V_Type := Transform_Feedback_Buffer_Mode (Update_Program);
Put_Line ("Transform_Feedback_Buffer_Mode: " & Buffer_Mode'Image (V_Type));
Put_Line ("Transform_Feedback_Size: " & Size'Image (V_Size));
Put_Line ("Transform_Feedback_Max_Length: " & Size'Image (V_Max_Length));
This seems to produce correct results, at least for Mode
and Size
:
Transform_Feedback_Buffer_Mode: INTERLEAVED_ATTRIBS
Transform_Feedback_Size: 4
Transform_Feedback_Max_Length: 10
I also tried Get_Transform_Feedback_Varying
but it failed because some parameters need to be declared out
.
I'll have a go at fixing this next.
Also, Transform_Feedback_Varyings
doesn't seem to correspond to the glTransformFeedbackVaryings
specification.
I'll investigate this later.
I added some tests:
V_Size := Transform_Feedback_Varyings (Update_Program);
V_Max_Length := Transform_Feedback_Varying_Max_Length (Update_Program);
V_Type := Transform_Feedback_Buffer_Mode (Update_Program);
Put_Line ("Transform_Feedback_Buffer_Mode: " & Buffer_Mode'Image (V_Type));
Put_Line ("Transform_Feedback_Size: " & Size'Image (V_Size));
Put_Line ("Transform_Feedback_Max_Length: " & Size'Image (V_Max_Length));
This seems to produce correct results, at least for Mode
and Size
:
Transform_Feedback_Buffer_Mode: INTERLEAVED_ATTRIBS
Transform_Feedback_Size: 4
Transform_Feedback_Max_Length: 10
I also tried Get_Transform_Feedback_Varying
but it failed because some parameters need to be declared out
.
Also, Transform_Feedback_Varyings
doesn't seem to correspond to glTransformFeedbackVaryings
I'll have a go at fixing this next.
Changed Transform_Feedback_Varyings
to Transform_Feedback_Varyings_Size
as it doesn't call glTransformFeedbackVaryings
but actually returns Program_Size_Param (Object, Enums.Transform_Feedback_Varyings)
I'll have a look at this somewhen in the next week.
Weird result!
Varyings : constant String := "Type1,Position1,Velocity1,Age1";
is accepted.
But if I delete "1" from any of the names, it fails.
For example, Velocity
instead of Velocity1
produces:
Update_Program Link for Varyings failed ERROR: Could not find transform feedback binding for 'Velocity.'
I have Get_Transform_Feedback_Varying
working.
GL.Objects.Programs.Get_Transform_Feedback_Varying
(Update_Program, 0, Buffer_Size, Name_Length, Vertices_Length, V_Type, Varyings_Name);
Put_Line ("Varying name: " & Varyings_Name (1 .. Integer (Name_Length)));
etc. produces:
Varying name: Type1
Varying name: Position1
Varying name: Velocity1
Varying name: Age1
I've PR'd the test program in case it helps.
Transform feedback example
now runs OK after changing varying names to end with "1":
` Varyings : constant String := "position1,velocity1";
Yet to test fully.
Cosmetic problem: Space missing in Set_Vertex_Attrib_Pointer error message: Use the otherSet_Vertex_Attrib_Pointer, Set_Vertex_Integer_Attrib_Pointer ...
Transform feedback example now runs OK. Ready to merge?
This example currently produces:
I have left in debug
Put_Line
messages which would need to be removed eventually. I have commented outGet_Transform_Feedback_Varying
associated code as this causes an exception on detectingMax Length: 0
associated with theV_Type
attributes. This exception occurs prior to theUpdate_Program Link failed
message being activated. I'll add the C version shortly after confirming that it still works.