Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411423 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 18, 2024, 03:31:05 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The happy programmer room
Pages: 1 ... 200 201 [202] 203 204 ... 279
Print
Author Topic: The happy programmer room  (Read 677666 times)
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4020 on: March 01, 2015, 04:43:45 PM »

glVertexAttribPointer() has been replaced with a better API

Which one? Cannot find anything related to this.

I wrote an answer on GDSE that might help:
http://gamedev.stackexchange.com/questions/92832/in-opengl-whats-quicker-lots-of-smaller-vaos-or-one-large-one-updated-each-fr/95616#95616
Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
powly
Level 4
****



View Profile WWW
« Reply #4021 on: March 02, 2015, 11:38:15 AM »

Ah, thanks! I'm maybe not as excited about this but will definitely start using it -- less binds is less binds and it looks somewhat better. Along with the direct state access in 4.5 you don't have to bind an attribute array buffer ever, I guess. In your example there, should the second

Code:
glVertexAttribFormat(0, 3, GL_FLOAT, false, 0);

have 2 as the first parameter since it's the location? I'm trying to get away from manually handling locations and querying what GL decided to use instead.
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4022 on: March 02, 2015, 12:01:30 PM »

Yes, it should be.  Nice catch, I fixed my answer.
Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
Sik
Level 10
*****


View Profile WWW
« Reply #4023 on: March 04, 2015, 11:09:51 AM »

This, pretty much.
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4024 on: March 07, 2015, 06:53:09 PM »

I just had an epiphany about how I am going to design my scripting engine.

For a while now I've been struggling to come up with a solution to the goal using a common language to write CPU kernels, GPU shaders, entity data, AI behaviours, and so on.  I tried writing my own interpreters/compilers for existing languages and even a custom language.

Yesterday I discovered the concept of an embedded domain-specific language (EDSL).  This got me thinking, and I asked myself this: what if I used an existing scripting language as a host for an EDSL?

I'm gonna go ahead and use Lua as the reference implementation, since it has such a great API.  This is an example of a simple kernel that adds 1 to its input.  You would use this specific dialect of the EDSL to write shaders.

Code:
x = Input(0, Integer)

y = x + Integer(1)

Output(0, y)

Using operator overloading and type constructors, I can encode what appear to be imperative instructions as nodes of an abstract syntax tree (AST).  The AST can then be interpreted, compiled to GLSL or SPIR-V, etc.  This paves the way for opaque usage of asynchronous or lazy procedures.  On top of this, the host language now becomes an extremely powerful preprocessor.

The beauty of this is that I could potentially support other scripting languages as hosts.  This is the Scheme equivalent of the example kernel:

Code:
(define x
    (make-input 0 make-integer))

(define y
    (+ x (make-integer 1)))

(make-output 0 y)

I could even write a system to build up an AST in-place using C++ as my host!
« Last Edit: March 07, 2015, 07:03:26 PM by Boreal » Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #4025 on: March 08, 2015, 02:59:12 AM »

Boreal, what you are describing is called "abstract interpretation". It's quite a useful technique. But you've yet not hit upone one of it's major difficulties. How are you going to handle control flow? Hopefully, you don't need it, as nearly all languages don't give you sufficient hooks to do it abstractly. Getting variables to work as expected is also hard.

It's possible to get it going, but most people prefer just to write a simple language parser instead, which also gives you an AST.
Logged
powly
Level 4
****



View Profile WWW
« Reply #4026 on: March 08, 2015, 03:50:23 AM »

Sounds cool, handling that kind of off-loading automatically would be awesome.

I got this simple method for video capturing up and running -- it's great to not have to open up some other software and then convert before uploading. I switched from the suggested direct readpixels to a pixel pack buffer to reduce lag when the program is not bandwidth bound. I also tried to output directly to webm, but the compression is very slow so it might be a better idea to keep using mp4 or convert offline. Or something else maybe? I know next to nothing about video formats.
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4027 on: March 08, 2015, 02:01:29 PM »

Boreal, what you are describing is called "abstract interpretation". It's quite a useful technique. But you've yet not hit upone one of it's major difficulties. How are you going to handle control flow? Hopefully, you don't need it, as nearly all languages don't give you sufficient hooks to do it abstractly. Getting variables to work as expected is also hard.

It's possible to get it going, but most people prefer just to write a simple language parser instead, which also gives you an AST.

The EDSL is pure, so control flow only exists in the form of condition statements (if-then-else).  My first thoughts were just to use another type constructor, a la

Code:
x = Input(0, Boolean)
y = Cond(x, Integer(100), Integer(0))

But you're right, that may end up being a big oversight on my part.
« Last Edit: March 08, 2015, 02:07:12 PM by Boreal » Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
oahda
Level 10
*****



View Profile
« Reply #4028 on: March 09, 2015, 01:13:40 AM »

I tried to read up on this EDSL thing and I tried to parse your post again, but I still don't really get exactly what it is or what the point of it is. Not to have to write both C++ and GLSL but write both program and shader in Lua? Why? What am I not understanding? Sad
Logged

Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4029 on: March 09, 2015, 04:48:24 AM »

I tried to read up on this EDSL thing and I tried to parse your post again, but I still don't really get exactly what it is or what the point of it is. Not to have to write both C++ and GLSL but write both program and shader in Lua? Why? What am I not understanding? Sad

The idea stemmed from using compute shaders, and potentially having to support a CPU fallback if the user's GPU did not support OpenGL 4.3.  I figured if I had a DSL, I could write it once and compile it both to GLSL and to some function to be run on the CPU in parallel, and I wouldn't have to maintain multiple copies of the same program in different languages.  Then I got thinking about the other possibilities, like being able to script AI or networking while both abstracting away finicky implementation details and allowing mass parallelization.  As well, I can use the host language as a super powerful implementation-agnostic preprocessor and macro system.

I've always just been the kind of programmer to prefer doing more work up front if it means simplifying and streamlining things later.  As well, I am dedicated to making my game mod-friendly.  While there's a lot to be said for supporting many DSLs individually, I would rather only have to deal with minimally one FFI since it's a huge pain, even with Lua, and put the burden of interfacing with my EDSL on the host language.
Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #4030 on: March 09, 2015, 11:00:36 AM »

The idea stemmed from using compute shaders, and potentially having to support a CPU fallback if the user's GPU did not support OpenGL 4.3.  
Of course, Mesa has already done this for you, in the context of OpenGl at least.
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4031 on: March 09, 2015, 10:45:45 PM »

It just werks.  It's incredibly naive and there's no types other than an integer yet, but still.



Updated to reflect adding a pseudo-generic type system.
« Last Edit: March 10, 2015, 01:52:01 AM by Boreal » Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
Layl
Level 3
***

professional jerkface


View Profile WWW
« Reply #4032 on: March 10, 2015, 01:57:17 AM »

I'm looking at doing something similar for my shader code, basically a system that translates .NET IL into GLSL, allowing you to write your shaders in C#. Since there's already an existing project that does this, I can either just add that in as a dependency, or write my own implementation based on it.
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4033 on: March 10, 2015, 02:07:59 AM »

I can somewhat see turning CIL into SPIR-V, but to GLSL?  That's a bit crazy.
« Last Edit: March 10, 2015, 02:14:12 AM by Boreal » Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #4034 on: March 14, 2015, 06:47:43 PM »

I got accepted into a university and am starting a four year long coop software engineering program in September! :D
Logged

oahda
Level 10
*****



View Profile
« Reply #4035 on: March 25, 2015, 03:23:05 AM »

UTF16 text rendering working in like an hour with custom OpenGL using SDL_ttf for SDL2!

Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #4036 on: March 25, 2015, 05:30:27 PM »

but does it handle emoji Well, hello there!
/sad joke, kill me
Logged

Photon
Level 4
****


View Profile
« Reply #4037 on: March 25, 2015, 06:35:54 PM »

I got accepted into a university and am starting a four year long coop software engineering program in September! :D
Congratulations!  Hand Shake Left Grin Hand Shake Right
Logged
Exudes
Level 0
*



View Profile
« Reply #4038 on: March 25, 2015, 07:13:13 PM »



I almost feel like I should name them.
Logged
Boreal
Level 6
*


Reinventing the wheel


View Profile
« Reply #4039 on: March 26, 2015, 11:41:55 PM »

Today I discovered the -jN flag for Make, which enables a multi-core build (set N to the number of cores + 1).

Since I have an 8-core (FX-8320) my build is lightning fast now  Wizard
Logged

"In software, the only numbers of significance are 0, 1, and N." - Josh Barczak

magma - Reconstructed Mantle API
Pages: 1 ... 200 201 [202] 203 204 ... 279
Print
Jump to:  

Theme orange-lt created by panic