Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


HimanshuGoel97

Member Since 09 Jul 2013
Offline Last Active Today, 09:16 AM

Posts I've Made

In Topic: GLSL Driver optimizer

20 February 2015 - 08:17 PM

I managed to get swizzling working and at this point it is possible to write very simple shaders which can read from textures.

However I now need to implement comparison operators while setting things up for 'if' statements. So I was wondering, if it was better to do

 

all(equals(vecA, vecB))

 

or 

 

vecA.x == vecB.x && vecA.y == vecB.y ...

 

I'm getting the feeling that it doesn't matter and that the 'all(equals(' is just for convenience and translates to exactly the same thing but I want to make sure of it.


In Topic: Am I wasting my time with this

19 February 2015 - 09:55 PM

This might not be the best advice considering that you want to get working fast, but although it took me almost an entire year to start writing stuff I was satisfied with, since I didn't feel that any of the available tools suited what I wanted I ended up working on my own 2d and 3d engines. I won't say I suggest you do the same, but if you're just looking to get an understanding of how it all works at the lowest level, it's probably a nice option. Not to mention learning to manage large projects, keeping track of performance, understanding the details of different algorithms to determine what you need etc. I have a fairly strong background in C# as well but it still took me a while to start doing all those things in a clean manner (I restarted from scratch a few times simply because my code wasn't clean enough to my liking)


In Topic: GLSL Driver optimizer

19 February 2015 - 09:34 PM

 

 

What are you motivations to make your own non standard shader language? Usually those who can write a shader code want to write it with standard hlsl/glsl.

My game engine is designed to be easily ported to any platform, as a result it didn't make much sense to have platform dependent shaders, I couldn't find any libraries for the latest shader model, so I came up with a workaround to write them in C# (basically using the DLR to build a shader as a result of the execution of the C# code).

By the way, if you like C#, you will be interested by the Paradox3D engine.
As for their shader system, I think it is mainly an extension of hlsl, that they convert to glsl for you.
https://github.com/SiliconStudio/paradox

 

Thanks! I've been looking around for as many references as I can get.

 

Currently I'm struggling with handling swizzling without having to write extensive amounts of code.


In Topic: GLSL Driver optimizer

18 February 2015 - 10:13 AM

So, I realized that using dynamics I could completely eliminate temporary variables at the cost of increased complexity. After a few hours of work I managed to get it working, the code can be considered slightly more correct, although I could probably add a special case for an Assignment immediately after a Creation.

 

The input is


            dynamic Variables = Manager.ShaderStart();

            Manager.StreamOut<Vec4>("color", 0);
            Manager.Uniform<KInt>("k");
            Manager.Create<KInt>("l");

            Variables.l = (KInt)5;
            Variables.k *= Variables.l;
            Variables.color = Variables.k;

and the GLSL generated is

#version 440 core
layout(location = 0) out vec4 color;

uniform int k;


void main(){
int l;
l = 5;
k = (k*l);
color = vec4(k);
}

In Topic: GLSL Driver optimizer

18 February 2015 - 06:36 AM

What are you motivations to make your own non standard shader language? Usually those who can write a shader code want to write it with standard hlsl/glsl.

My game engine is designed to be easily ported to any platform, as a result it didn't make much sense to have platform dependent shaders, I couldn't find any libraries for the latest shader model, so I came up with a workaround to write them in C# (basically using the DLR to build a shader as a result of the execution of the C# code).


PARTNERS