Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411490 Posts in 69371 Topics- by 58428 Members - Latest Member: shelton786

April 24, 2024, 08:44:15 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)General programming discussion
Pages: 1 ... 6 7 [8] 9 10 ... 16
Print
Author Topic: General programming discussion  (Read 29233 times)
ferreiradaselva
Level 3
***



View Profile
« Reply #140 on: October 03, 2017, 10:48:10 AM »

Clever! I'd never thought of doing it that way.
Yeah, I was amazed by that. it's the kind of so stupidly simple thing that we wonder why the heck we never thought about.



So, I think I will join this: https://www.gamedev.net/forums/topic/692444-welcome-to-the-gamedev-challenges-forum/
Logged

Crimsontide
Level 5
*****


View Profile
« Reply #141 on: October 03, 2017, 01:58:25 PM »

Clever! I'd never thought of doing it that way.
Yeah, I was amazed by that. it's the kind of so stupidly simple thing that we wonder why the heck we never thought about.



So, I think I will join this: https://www.gamedev.net/forums/topic/692444-welcome-to-the-gamedev-challenges-forum/

I'm confused.  Is the stupidly simple thing iterating backwards or using a single triangle for full screen shaders?  What are we talking about??
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #142 on: October 03, 2017, 02:01:31 PM »

Full screen triangle  Cool
Logged
ferreiradaselva
Level 3
***



View Profile
« Reply #143 on: October 03, 2017, 02:45:25 PM »

Full screen triangle  Cool
lol

I'm confused.  Is the stupidly simple thing iterating backwards or using a single triangle for full screen shaders?  What are we talking about??

Like this:
Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #144 on: October 03, 2017, 02:47:57 PM »

I would have thought it would kill the fillrate and when I ask for a similar idea I was said the cost of clipping would not be worth it ... always test kids, don't let logic build fantasy world superseding reality.
Logged

powly
Level 4
****



View Profile WWW
« Reply #145 on: October 04, 2017, 05:04:48 AM »

There is no fillrate penalty since no fragments are shaded and the clipping cost is negligible (is clipping even performed against x and y edges? It doesn’t really have a benefit). On some hardware (newer NV at least) the compute is combined so there is also zero penalty from fragment shader scheduling. The triangle is still the way to go if you want to do this.

The real argument here is that a fragment/pixel shader is the wrong thing for this kind of computation; you should use a compute shader instead, it fits the domain better and gives you extra possibilities with sharing local data and scheduling (for example you could do persistent threads). In D3D you can even write straight into the back buffer from CS, in OpenGL I guess you have to do at least one final pass as a traditional rendering operation.
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #146 on: October 04, 2017, 06:25:06 AM »

I think it might old knowledge from old platform passed without reevaluation, I remember asking, while inspecting a n64 games, why they would have all these duplicated 3d quads for a flat ground, and was told that a single quad would be more costly due to clipping, I still don't know better lol.
Logged

Ordnas
Level 10
*****



View Profile WWW
« Reply #147 on: October 05, 2017, 11:39:01 PM »

Full screen triangle  Cool
lol

I'm confused.  Is the stupidly simple thing iterating backwards or using a single triangle for full screen shaders?  What are we talking about??

Like this:


Interesting. It seems that FXAA and SweetFX post-processes also uses this trick:

https://www.reddit.com/r/gamedev/comments/2j17wk/a_slightly_faster_bufferless_vertex_shader_trick/

https://web.archive.org/web/20140719063725/http://www.altdev.co/2011/08/08/interesting-vertex-shader-trick/
Logged

Games:

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #148 on: October 09, 2017, 05:43:14 PM »

SO recently I have start poking around with cemu, there is a function call Texture and shader dump. I tried it and I expected unreadable asm mess ... Turns out it's jumbled OpenGL THat I surprsingly understand because familiar pattern jump at me!

I was wondering, is there an application that can format indentation automatically to make it more readable?
Logged

ferreiradaselva
Level 3
***



View Profile
« Reply #149 on: October 10, 2017, 01:44:43 AM »

If you didn't see yet, you will probably like the article on uber shaders from the people making dolphin (for dolphin): https://dolphin-emu.org/blog/2017/07/30/ubershaders/


--

I feel sad for whoever uses my libraries. I'm almost certain that I will make another drastic change:

I'm think about removing all the typedefs from it. RIP in Peace.

I should've not used it in the first place.

edit:

I like the linux coding style (mostly), but I was always flexible with that typedef argumentation. For some projects I would use, for others I wouldn't. For gamedev stuff, I always used.

But, yesterday I was reading someone's else code. And heck, maybe it actually obfuscate a little (?) Cause I was taking longer than I should to understand what was structure and what wasn't. I remember when I was working on some of my contributions to GLFW, that I would have the same problem.



« Last Edit: October 10, 2017, 01:55:32 AM by ferreiradaselva » Logged

JWki
Level 4
****


View Profile
« Reply #150 on: October 10, 2017, 03:01:13 AM »

If you didn't see yet, you will probably like the article on uber shaders from the people making dolphin (for dolphin): https://dolphin-emu.org/blog/2017/07/30/ubershaders/


--

I feel sad for whoever uses my libraries. I'm almost certain that I will make another drastic change:

I'm think about removing all the typedefs from it. RIP in Peace.

I should've not used it in the first place.

edit:

I like the linux coding style (mostly), but I was always flexible with that typedef argumentation. For some projects I would use, for others I wouldn't. For gamedev stuff, I always used.

But, yesterday I was reading someone's else code. And heck, maybe it actually obfuscate a little (?) Cause I was taking longer than I should to understand what was structure and what wasn't. I remember when I was working on some of my contributions to GLFW, that I would have the same problem.





What's the problem with typedefs?
Logged
ferreiradaselva
Level 3
***



View Profile
« Reply #151 on: October 10, 2017, 03:47:39 AM »

There always have been a war on whether or not structs should be typedef'ed. As for why we typedef, it's usually beause we don't want to write "struct" on every declaration. The most correct use of typedef (by the book) is to use when you are making an opaque structure or typedef'ing one of the C data types (char, int, float, double, void, etc.).

I always used for the lazy reason: to not write "struct"

The problem is that typedef hides if the type a variable declared is a structure. Which was the problem I mentioned above. Reading your own code and understanding what is and what is not a structure is easy, the problem is when somebody else tries to read your code. There's also the problem (this one I agree 100%, it's a sacrilege, heresy of 3rd degree) of typedef'ing pointers.

I'm starting to lean to the side of non-typedefers and only used for the purpose it's supposed to be used for.
Logged

Ordnas
Level 10
*****



View Profile WWW
« Reply #152 on: October 10, 2017, 11:58:47 PM »

There always have been a war on whether or not structs should be typedef'ed. As for why we typedef, it's usually beause we don't want to write "struct" on every declaration. The most correct use of typedef (by the book) is to use when you are making an opaque structure or typedef'ing one of the C data types (char, int, float, double, void, etc.).

I always used for the lazy reason: to not write "struct"

The problem is that typedef hides if the type a variable declared is a structure. Which was the problem I mentioned above. Reading your own code and understanding what is and what is not a structure is easy, the problem is when somebody else tries to read your code. There's also the problem (this one I agree 100%, it's a sacrilege, heresy of 3rd degree) of typedef'ing pointers.

I'm starting to lean to the side of non-typedefers and only used for the purpose it's supposed to be used for.

For me, typedef are useful when I do not want to occupy a single row for writing just "TArray<TWeakObjectPtr<ABossSoldierEntityPawn>>", expecially in a function parameter.

The opaque for data types I saw it in engine datatypes, like Real, and you want to switch from float to double precision, and in the Engine Math library you still have Real as type.
Logged

Games:

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #153 on: October 11, 2017, 11:07:01 AM »

If you didn't see yet, you will probably like the article on uber shaders from the people making dolphin (for dolphin): https://dolphin-emu.org/blog/2017/07/30/ubershaders/



I have seen it, cemu is a different beast altogether. It's plain shader unlike wii which is just a permutation of free fixed shader pass (hence don't have actual shader to cache directly).

Code:
#version 420
#extension GL_ARB_texture_gather : enable
// shader 580a5580037e6497
uniform ivec4 uf_remappedPS[7];
layout(binding = 0) uniform sampler2D textureUnitPS0;// Tex0 addr 0xf5ff8000 res 64x64x1 dim 1 tm: 4 format 0820 compSel: 0 1 2 3 mipView: 0x0 (num 0x1) sliceView: 0x0 (num 0x1) Sampler0 ClampX/Y/Z: 2 2 2 border: 0
layout(binding = 1) uniform sampler2D textureUnitPS1;// Tex1 addr 0x424d2000 res 256x256x1 dim 1 tm: 4 format 0031 compSel: 0 1 2 3 mipView: 0x0 (num 0x7) sliceView: 0x0 (num 0x1) Sampler1 ClampX/Y/Z: 0 0 2 border: 0
layout(binding = 2) uniform sampler2D textureUnitPS2;// Tex2 addr 0x424ea000 res 512x512x1 dim 1 tm: 4 format 0031 compSel: 0 1 2 3 mipView: 0x0 (num 0x8) sliceView: 0x0 (num 0x1) Sampler2 ClampX/Y/Z: 0 0 2 border: 0
layout(binding = 3) uniform sampler2D textureUnitPS3;// Tex3 addr 0x3e1b7000 res 256x256x1 dim 1 tm: 4 format 0031 compSel: 0 1 2 3 mipView: 0x0 (num 0x7) sliceView: 0x0 (num 0x1) Sampler3 ClampX/Y/Z: 2 2 2 border: 0
layout(binding = 4) uniform sampler2D textureUnitPS4;// Tex4 addr 0x42516000 res 512x512x1 dim 1 tm: 4 format 0031 compSel: 0 1 2 3 mipView: 0x0 (num 0x8) sliceView: 0x0 (num 0x1) Sampler4 ClampX/Y/Z: 0 0 2 border: 0
layout(binding = 5) uniform sampler2D textureUnitPS5;// Tex5 addr 0x424de000 res 256x256x1 dim 1 tm: 4 format 0031 compSel: 0 1 2 3 mipView: 0x0 (num 0x7) sliceView: 0x0 (num 0x1) Sampler5 ClampX/Y/Z: 0 0 2 border: 0
layout(location = 0) in vec4 passParameterSem0;
layout(location = 1) in vec4 passParameterSem1;
layout(location = 2) in vec4 passParameterSem2;
layout(location = 3) in vec4 passParameterSem3;
layout(location = 4) in vec4 passParameterSem4;
layout(location = 5) in vec4 passParameterSem5;
layout(location = 6) in vec4 passParameterSem6;
layout(location = 7) in vec4 passParameterSem7;
layout(location = 0) out vec4 passPixelColor0;
layout(location = 1) out vec4 passPixelColor1;
layout(location = 2) out vec4 passPixelColor2;
layout(location = 3) out vec4 passPixelColor3;
layout(location = 4) out vec4 passPixelColor4;
uniform vec2 uf_fragCoordScale;
int clampFI32(int v)
{
if( v == 0x7FFFFFFF )
return floatBitsToInt(1.0);
else if( v == 0xFFFFFFFF )
return floatBitsToInt(0.0);
return floatBitsToInt(clamp(intBitsToFloat(v), 0.0, 1.0));
}
float mul_nonIEEE(float a, float b){ return min(a*b,min(abs(a)*3.40282347E+38F,abs(b)*3.40282347E+38F)); }
void main()
{
ivec4 R0i = ivec4(0);
ivec4 R1i = ivec4(0);
ivec4 R2i = ivec4(0);
ivec4 R3i = ivec4(0);
ivec4 R4i = ivec4(0);
ivec4 R5i = ivec4(0);
ivec4 R6i = ivec4(0);
ivec4 R7i = ivec4(0);
ivec4 R8i = ivec4(0);
ivec4 R9i = ivec4(0);
ivec4 R122i = ivec4(0);
ivec4 R123i = ivec4(0);
ivec4 R125i = ivec4(0);
ivec4 R126i = ivec4(0);
ivec4 R127i = ivec4(0);
int backupReg0i, backupReg1i, backupReg2i, backupReg3i, backupReg4i;
ivec4 PV0i = ivec4(0), PV1i = ivec4(0);
int PS0i = 0, PS1i = 0;
ivec4 tempi = ivec4(0);
float tempResultf;
int tempResulti;
ivec4 ARi = ivec4(0);
bool predResult = true;
bool activeMaskStack[2];
bool activeMaskStackC[3];
activeMaskStack[0] = false;
activeMaskStackC[0] = false;
activeMaskStackC[1] = false;
activeMaskStack[0] = true;
activeMaskStackC[0] = true;
activeMaskStackC[1] = true;
vec3 cubeMapSTM;
int cubeMapFaceId;
R0i = floatBitsToInt(passParameterSem0);
R1i = floatBitsToInt(passParameterSem1);
R2i = floatBitsToInt(passParameterSem2);
R3i = floatBitsToInt(passParameterSem3);
R4i = floatBitsToInt(passParameterSem4);
R5i = floatBitsToInt(passParameterSem5);
R6i = floatBitsToInt(passParameterSem6);
R7i = floatBitsToInt(passParameterSem7);
if( activeMaskStackC[1] == true ) {
R0i.w = floatBitsToInt(texture(textureUnitPS3, intBitsToFloat(R6i.xy)).x);
R8i.xyz = floatBitsToInt(texture(textureUnitPS4, intBitsToFloat(R6i.zw)).xyz);
R9i.xyz = floatBitsToInt(texture(textureUnitPS5, intBitsToFloat(R7i.xy)).xyz);
}
if( activeMaskStackC[1] == true ) {
activeMaskStack[1] = activeMaskStack[0];
activeMaskStackC[2] = activeMaskStackC[1];
// 0
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R4i.x),intBitsToFloat(R4i.y),intBitsToFloat(R4i.z),-0.0),vec4(intBitsToFloat(R4i.x),intBitsToFloat(R4i.y),intBitsToFloat(R4i.z),0.0)));
PV0i.x = tempi.x;
PV0i.y = tempi.x;
PV0i.z = tempi.x;
PV0i.w = tempi.x;
R2i.x = 0;
PS0i = R2i.x;
// 1
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R5i.x),intBitsToFloat(R5i.y),intBitsToFloat(R5i.z),-0.0),vec4(intBitsToFloat(R5i.x),intBitsToFloat(R5i.y),intBitsToFloat(R5i.z),0.0)));
PV1i.x = tempi.x;
PV1i.y = tempi.x;
PV1i.z = tempi.x;
PV1i.w = tempi.x;
R126i.w = tempi.x;
tempResultf = 1.0 / sqrt(intBitsToFloat(PV0i.x));
R127i.w = floatBitsToInt(tempResultf);
PS1i = R127i.w;
// 2
backupReg0i = R4i.x;
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(R3i.x),intBitsToFloat(R3i.y),intBitsToFloat(R3i.z),-0.0),vec4(intBitsToFloat(R3i.x),intBitsToFloat(R3i.y),intBitsToFloat(R3i.z),0.0)));
PV0i.x = tempi.x;
PV0i.y = tempi.x;
PV0i.z = tempi.x;
PV0i.w = tempi.x;
R127i.y = tempi.x;
R4i.x = floatBitsToInt(intBitsToFloat(backupReg0i) * intBitsToFloat(PS1i));
PS0i = R4i.x;
// 3
backupReg0i = R0i.y;
backupReg0i = R0i.y;
backupReg1i = R0i.z;
backupReg1i = R0i.z;
backupReg2i = R4i.y;
R127i.x = floatBitsToInt(dot(vec4(intBitsToFloat(R0i.x),intBitsToFloat(backupReg0i),intBitsToFloat(backupReg1i),-0.0),vec4(intBitsToFloat(R0i.x),intBitsToFloat(backupReg0i),intBitsToFloat(backupReg1i),0.0)));
PV1i.x = R127i.x;
PV1i.y = R127i.x;
PV1i.z = R127i.x;
PV1i.w = R127i.x;
R4i.y = floatBitsToInt(intBitsToFloat(backupReg2i) * intBitsToFloat(R127i.w));
PS1i = R4i.y;
// 4
backupReg0i = R4i.z;
R4i.z = floatBitsToInt(intBitsToFloat(backupReg0i) * intBitsToFloat(R127i.w));
tempResultf = 1.0 / sqrt(intBitsToFloat(R126i.w));
PS0i = floatBitsToInt(tempResultf);
// 5
backupReg0i = R5i.x;
backupReg1i = R5i.z;
R5i.x = floatBitsToInt(intBitsToFloat(backupReg0i) * intBitsToFloat(PS0i));
R2i.y = floatBitsToInt(intBitsToFloat(R5i.y) * intBitsToFloat(PS0i));
R5i.z = floatBitsToInt(intBitsToFloat(backupReg1i) * intBitsToFloat(PS0i));
tempResultf = 1.0 / sqrt(intBitsToFloat(R127i.y));
PS1i = floatBitsToInt(tempResultf);
// 6
backupReg0i = R3i.x;
backupReg1i = R3i.y;
backupReg2i = R3i.z;
R3i.x = floatBitsToInt(intBitsToFloat(backupReg0i) * intBitsToFloat(PS1i));
R3i.y = floatBitsToInt(intBitsToFloat(backupReg1i) * intBitsToFloat(PS1i));
R3i.z = floatBitsToInt(intBitsToFloat(backupReg2i) * intBitsToFloat(PS1i));
tempResultf = 1.0 / sqrt(intBitsToFloat(R127i.x));
PS0i = floatBitsToInt(tempResultf);
// 7
backupReg0i = R0i.x;
backupReg1i = R0i.y;
backupReg2i = R0i.z;
R0i.x = floatBitsToInt(intBitsToFloat(backupReg0i) * intBitsToFloat(PS0i));
R0i.y = floatBitsToInt(intBitsToFloat(backupReg1i) * intBitsToFloat(PS0i));
R0i.z = floatBitsToInt(intBitsToFloat(backupReg2i) * intBitsToFloat(PS0i));
// 8
predResult = (intBitsToFloat(uf_remappedPS[0].y) >= intBitsToFloat(R0i.w));
activeMaskStack[1] = predResult;
activeMaskStackC[2] = predResult == true && activeMaskStackC[1] == true;
}
else {
activeMaskStack[1] = false;
activeMaskStackC[2] = false;
}
if( activeMaskStackC[2] == true ) {
// 0
if(  (0 == 0)) discard;
}
activeMaskStackC[1] = activeMaskStack[0] == true && activeMaskStackC[0] == true;
if( activeMaskStackC[1] == true ) {
R7i.xyz = floatBitsToInt(texture(textureUnitPS1, intBitsToFloat(R7i.xy)).xyz);
R6i.xyz = floatBitsToInt(texture(textureUnitPS2, intBitsToFloat(R6i.zw)).xyz);
}
if( activeMaskStackC[1] == true ) {
// 0
R127i.x = floatBitsToInt((intBitsToFloat(R8i.z) * 2.0 + -(1.0)));
PV0i.x = R127i.x;
R123i.y = floatBitsToInt((intBitsToFloat(R9i.z) * 2.0 + -(1.0)));
PV0i.y = R123i.y;
R123i.z = floatBitsToInt((intBitsToFloat(R9i.x) * 2.0 + -(1.0)));
PV0i.z = R123i.z;
R127i.w = floatBitsToInt((intBitsToFloat(R8i.x) * 2.0 + -(1.0)));
PV0i.w = R127i.w;
R127i.y = floatBitsToInt((intBitsToFloat(R8i.y) * 2.0 + -(1.0)));
PS0i = R127i.y;
// 1
backupReg0i = R2i.z;
R123i.x = floatBitsToInt((intBitsToFloat(R9i.y) * 2.0 + -(1.0)));
PV1i.x = R123i.x;
PV1i.y = floatBitsToInt(-(intBitsToFloat(PV0i.w)) + intBitsToFloat(PV0i.z));
R2i.z = floatBitsToInt(intBitsToFloat(uf_remappedPS[1].w) * 1.0);
PV1i.w = floatBitsToInt(-(intBitsToFloat(PV0i.x)) + intBitsToFloat(PV0i.y));
R125i.w = floatBitsToInt(intBitsToFloat(backupReg0i) * intBitsToFloat(0x41000000));
PS1i = R125i.w;
// 2
R126i.x = floatBitsToInt(floor(intBitsToFloat(PS1i)));
PV0i.x = R126i.x;
R126i.y = floatBitsToInt((intBitsToFloat(PV1i.y) * intBitsToFloat(uf_remappedPS[2].w) + intBitsToFloat(R127i.w)));
PV0i.z = floatBitsToInt(-(intBitsToFloat(R127i.y)) + intBitsToFloat(PV1i.x));
R123i.w = floatBitsToInt((intBitsToFloat(PV1i.w) * intBitsToFloat(uf_remappedPS[2].w) + intBitsToFloat(R127i.x)));
PV0i.w = R123i.w;
R122i.x = floatBitsToInt((intBitsToFloat(R7i.x) * intBitsToFloat(R6i.x) + -(intBitsToFloat(R7i.x))));
PS0i = R122i.x;
// 3
R123i.x = floatBitsToInt((intBitsToFloat(PV0i.w) * intBitsToFloat(uf_remappedPS[1].z) + intBitsToFloat(R2i.z)));
PV1i.x = R123i.x;
R123i.y = floatBitsToInt((intBitsToFloat(PV0i.z) * intBitsToFloat(uf_remappedPS[2].w) + intBitsToFloat(R127i.y)));
PV1i.y = R123i.y;
R126i.z = floatBitsToInt(intBitsToFloat(PV0i.x) * intBitsToFloat(0x3b808081));
R127i.w = floatBitsToInt((intBitsToFloat(PS0i) * intBitsToFloat(uf_remappedPS[2].z) + intBitsToFloat(R7i.x)));
R127i.x = floatBitsToInt((intBitsToFloat(R7i.y) * intBitsToFloat(R6i.y) + -(intBitsToFloat(R7i.y))));
PS1i = R127i.x;
// 4
PV0i.x = floatBitsToInt(intBitsToFloat(R2i.y) * intBitsToFloat(PV1i.x));
PV0i.y = floatBitsToInt(intBitsToFloat(R5i.z) * intBitsToFloat(PV1i.x));
R123i.z = floatBitsToInt((intBitsToFloat(R126i.y) * intBitsToFloat(uf_remappedPS[1].x) + intBitsToFloat(R2i.x)));
PV0i.z = R123i.z;
PV0i.w = floatBitsToInt(intBitsToFloat(R5i.x) * intBitsToFloat(PV1i.x));
R126i.y = floatBitsToInt((intBitsToFloat(PV1i.y) * intBitsToFloat(uf_remappedPS[1].y) + intBitsToFloat(R2i.x)));
PS0i = R126i.y;
// 5
R123i.x = floatBitsToInt((intBitsToFloat(R3i.x) * intBitsToFloat(PV0i.z) + intBitsToFloat(PV0i.w)));
PV1i.x = R123i.x;
R127i.y = floatBitsToInt((intBitsToFloat(R127i.x) * intBitsToFloat(uf_remappedPS[2].z) + intBitsToFloat(R7i.y)));
R123i.z = floatBitsToInt((intBitsToFloat(R3i.z) * intBitsToFloat(PV0i.z) + intBitsToFloat(PV0i.y)));
PV1i.z = R123i.z;
R123i.w = floatBitsToInt((intBitsToFloat(R3i.y) * intBitsToFloat(PV0i.z) + intBitsToFloat(PV0i.x)));
PV1i.w = R123i.w;
R122i.x = floatBitsToInt((intBitsToFloat(R7i.z) * intBitsToFloat(R6i.z) + -(intBitsToFloat(R7i.z))));
PS1i = R122i.x;
// 6
backupReg0i = R126i.y;
backupReg0i = R126i.y;
R127i.x = floatBitsToInt((intBitsToFloat(R0i.x) * intBitsToFloat(R126i.y) + intBitsToFloat(PV1i.x)));
PV0i.x = R127i.x;
R126i.y = floatBitsToInt((intBitsToFloat(R0i.y) * intBitsToFloat(backupReg0i) + intBitsToFloat(PV1i.w)));
PV0i.y = R126i.y;
R127i.z = floatBitsToInt((intBitsToFloat(R0i.z) * intBitsToFloat(backupReg0i) + intBitsToFloat(PV1i.z)));
PV0i.z = R127i.z;
R126i.w = floatBitsToInt((intBitsToFloat(PS1i) * intBitsToFloat(uf_remappedPS[2].z) + intBitsToFloat(R7i.z)));
R125i.x = floatBitsToInt(floor(intBitsToFloat(R126i.z)));
PS0i = R125i.x;
// 7
tempi.x = floatBitsToInt(dot(vec4(intBitsToFloat(PV0i.x),intBitsToFloat(PV0i.y),intBitsToFloat(PV0i.z),-0.0),vec4(intBitsToFloat(PV0i.x),intBitsToFloat(PV0i.y),intBitsToFloat(PV0i.z),0.0)));
PV1i.x = tempi.x;
PV1i.y = tempi.x;
PV1i.z = tempi.x;
PV1i.w = tempi.x;
R3i.x = floatBitsToInt(intBitsToFloat(R1i.x) * intBitsToFloat(R127i.w));
PS1i = R3i.x;
// 8
R0i.x = uf_remappedPS[3].x;
R3i.y = floatBitsToInt(intBitsToFloat(R1i.y) * intBitsToFloat(R127i.y));
R3i.z = floatBitsToInt(intBitsToFloat(R1i.z) * intBitsToFloat(R126i.w));
R3i.w = 0;
tempResultf = 1.0 / sqrt(intBitsToFloat(PV1i.x));
PS0i = floatBitsToInt(tempResultf);
// 9
backupReg0i = R126i.y;
backupReg1i = R127i.z;
R7i.x = floatBitsToInt(intBitsToFloat(R127i.x) * intBitsToFloat(PS0i));
PV1i.x = R7i.x;
R126i.y = floatBitsToInt(intBitsToFloat(backupReg0i) * intBitsToFloat(PS0i));
PV1i.y = R126i.y;
R127i.z = floatBitsToInt(intBitsToFloat(backupReg1i) * intBitsToFloat(PS0i));
R0i.w = uf_remappedPS[4].x;
R0i.y = uf_remappedPS[3].y;
PS1i = R0i.y;
// 10
R9i.x = PV1i.x;
R6i.y = PV1i.y;
PV0i.z = floatBitsToInt(intBitsToFloat(PV1i.y) + 1.0);
PV0i.z = floatBitsToInt(intBitsToFloat(PV0i.z) / 2.0);
PV0i.w = floatBitsToInt(intBitsToFloat(PV1i.x) + 1.0);
PV0i.w = floatBitsToInt(intBitsToFloat(PV0i.w) / 2.0);
R0i.z = uf_remappedPS[3].z;
PS0i = R0i.z;
// 11
PV1i.x = floatBitsToInt(max(intBitsToFloat(PV0i.w), 0.0));
PV1i.y = floatBitsToInt(-(intBitsToFloat(PV0i.z)) + 1.0);
R2i.z = floatBitsToInt(intBitsToFloat(R125i.x) * intBitsToFloat(0x3b808081));
R2i.w = uf_remappedPS[3].w;
R2i.x = floatBitsToInt(intBitsToFloat(R125i.w) + -(intBitsToFloat(R126i.x)));
PS1i = R2i.x;
// 12
R1i.x = floatBitsToInt(min(intBitsToFloat(PV1i.x), 1.0));
R2i.y = floatBitsToInt(intBitsToFloat(R126i.z) + -(intBitsToFloat(R125i.x)));
PV0i.w = floatBitsToInt(max(intBitsToFloat(PV1i.y), 0.0));
PS0i = floatBitsToInt(intBitsToFloat(R4i.z) * intBitsToFloat(R127i.z));
// 13
R6i.x = floatBitsToInt((intBitsToFloat(R4i.y) * intBitsToFloat(R126i.y) + intBitsToFloat(PS0i)));
R1i.y = floatBitsToInt(min(intBitsToFloat(PV0i.w), 1.0));
}
if( activeMaskStackC[1] == true ) {
R1i.xyzw = floatBitsToInt(texture(textureUnitPS0, intBitsToFloat(R1i.xy)).xyzw);
}
if( activeMaskStackC[1] == true ) {
// 0
R125i.x = floatBitsToInt((intBitsToFloat(uf_remappedPS[5].z) * intBitsToFloat(R1i.z) + 0.0));
R126i.y = floatBitsToInt((intBitsToFloat(uf_remappedPS[5].y) * intBitsToFloat(R1i.y) + 0.0));
R123i.z = floatBitsToInt((intBitsToFloat(R4i.x) * intBitsToFloat(R7i.x) + intBitsToFloat(R6i.x)));
PV0i.z = R123i.z;
R123i.w = floatBitsToInt((intBitsToFloat(uf_remappedPS[5].w) * intBitsToFloat(R1i.w) + 0.0));
PV0i.w = R123i.w;
// 1
PV1i.y = floatBitsToInt(max(intBitsToFloat(PV0i.z), -(intBitsToFloat(PV0i.z))));
R127i.z = floatBitsToInt((intBitsToFloat(uf_remappedPS[5].x) * intBitsToFloat(R1i.x) + 0.0));
R1i.w = PV0i.w;
R1i.w = floatBitsToInt(intBitsToFloat(R1i.w) / 2.0);
// 2
PV0i.x = floatBitsToInt(-(intBitsToFloat(PV1i.y)) + 1.0);
PV0i.x = clampFI32(PV0i.x);
// 3
tempResultf = log2(intBitsToFloat(PV0i.x));
if( isinf(tempResultf) == true ) tempResultf = -3.40282347E+38F;
PS1i = floatBitsToInt(tempResultf);
// 4
PV0i.z = floatBitsToInt(intBitsToFloat(uf_remappedPS[6].w) * intBitsToFloat(PS1i));
// 5
PS1i = floatBitsToInt(exp2(intBitsToFloat(PV0i.z)));
// 6
R123i.x = floatBitsToInt((intBitsToFloat(uf_remappedPS[6].x) * intBitsToFloat(PS1i) + intBitsToFloat(R127i.z)));
PV0i.x = R123i.x;
R123i.z = floatBitsToInt((intBitsToFloat(uf_remappedPS[6].z) * intBitsToFloat(PS1i) + intBitsToFloat(R125i.x)));
PV0i.z = R123i.z;
R123i.w = floatBitsToInt((intBitsToFloat(uf_remappedPS[6].y) * intBitsToFloat(PS1i) + intBitsToFloat(R126i.y)));
PV0i.w = R123i.w;
// 7
R1i.x = PV0i.x;
R1i.x = floatBitsToInt(intBitsToFloat(R1i.x) / 2.0);
R1i.y = PV0i.w;
R1i.y = floatBitsToInt(intBitsToFloat(R1i.y) / 2.0);
R1i.z = PV0i.z;
R1i.z = floatBitsToInt(intBitsToFloat(R1i.z) / 2.0);
// 8
R8i.xyz = ivec3(R2i.x,R2i.y,R2i.z);
R8i.w = R2i.w;
// 9
R7i.xyz = ivec3(R0i.x,R0i.y,R0i.z);
R7i.w = R0i.w;
// 10
R5i.xyz = ivec3(R3i.x,R3i.y,R3i.z);
R5i.w = R3i.w;
// 11
R4i.xyz = ivec3(R1i.x,R1i.y,R1i.z);
R4i.w = R1i.w;
// 12
backupReg0i = R6i.y;
R6i.xyz = ivec3(R9i.x,backupReg0i,R9i.z);
R6i.w = R9i.z;
}
// export
passPixelColor0 = vec4(intBitsToFloat(R4i.x), intBitsToFloat(R4i.y), intBitsToFloat(R4i.z), intBitsToFloat(R4i.w));
passPixelColor1 = vec4(intBitsToFloat(R5i.x), intBitsToFloat(R5i.y), intBitsToFloat(R5i.z), intBitsToFloat(R5i.w));
passPixelColor2 = vec4(intBitsToFloat(R6i.x), intBitsToFloat(R6i.y), intBitsToFloat(R6i.z), intBitsToFloat(R6i.w));
passPixelColor3 = vec4(intBitsToFloat(R7i.x), intBitsToFloat(R7i.y), intBitsToFloat(R7i.z), intBitsToFloat(R7i.w));
passPixelColor4 = vec4(intBitsToFloat(R8i.x), intBitsToFloat(R8i.y), intBitsToFloat(R8i.z), intBitsToFloat(R8i.w));
}

I looking for tool to make it easy to parse it, I think there is unrolled loop, but I don't know if there is tool for spotting repetition or just format things with proper indentation, I already use code compare to spot pattern across different shader, for example the snippet above seems to be about doing stuff and putting it in a deffered buffer. It's from xenoblade x, you can hijack it, modify it and reinject it in the game.

For example can you decode the sample above? We see it declare a bunch of texture, then do a bunch of dot product of a vector against himself (which should always return 1 unless it's 0) and then have a lot of similar mul and add between various results, that looks like an unroll for loop, then output to different target. If you did a texture dump, you can look at the texture (sampler) declaration and search for the texture of the same name (addr) which clue you about what's happening too (you can spot normal, cubemap, diffuse, etc ...) and the size of the texture tells you if it's a screen render target (for example 1024x720 vs 512x512), the latter is abused to change screen resolution for lesser hardware, or apply colorpost process by hand in the emulator rendering.

You can also look at the texture format as a clue using:
http://compat.cemu.info/wiki/Tutorial:How_to_create_graphic_pack
and the msdn reference
Logged

JWki
Level 4
****


View Profile
« Reply #154 on: October 16, 2017, 11:52:03 PM »

Just wanted to share this blog post because I thought it was very interesting:

http://ourmachinery.com/post/multi-threading-the-truth/
Logged
ferreiradaselva
Level 3
***



View Profile
« Reply #155 on: October 17, 2017, 12:49:33 PM »

Just wanted to share this blog post because I thought it was very interesting:

http://ourmachinery.com/post/multi-threading-the-truth/

I was working on my framework using (mostly) IDs, and I could go down that path. But, since I'm doing something that maybe others will be interested in using, I decided to not put a built-in multi-threading, since it would make the learning curve steep, in my opinion. A very nice article, still.

I'm looking at those snippets, and it's so familiar.

--

I was looking for binary 3D file formats, and there's only FBX? There's no widely used open-source alternative?

Also, I've been thinking about glTF, and I will probably never adopt it. I just have a hatred for data formats with nested items. In my opinion it doesn't make more readable at all, because the nesting can get deep, and it makes it harder to parse. Always when I wrote some format that requires parent-child relationship in the past, I would use an ID for the current item and an ID to tell who is the parent of that current item. Makes everything simpler.
Logged

JWki
Level 4
****


View Profile
« Reply #156 on: October 17, 2017, 01:53:27 PM »

Just wanted to share this blog post because I thought it was very interesting:

http://ourmachinery.com/post/multi-threading-the-truth/

I was working on my framework using (mostly) IDs, and I could go down that path. But, since I'm doing something that maybe others will be interested in using, I decided to not put a built-in multi-threading, since it would make the learning curve steep, in my opinion. A very nice article, still.

I'm looking at those snippets, and it's so familiar.

--

I was looking for binary 3D file formats, and there's only FBX? There's no widely used open-source alternative?

Also, I've been thinking about glTF, and I will probably never adopt it. I just have a hatred for data formats with nested items. In my opinion it doesn't make more readable at all, because the nesting can get deep, and it makes it harder to parse. Always when I wrote some format that requires parent-child relationship in the past, I would use an ID for the current item and an ID to tell who is the parent of that current item. Makes everything simpler.

For binary as in runtime format I'd always use a custom one, and glTF or Fbx or whatever for intermediate where text based is fine.
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #157 on: October 17, 2017, 03:32:50 PM »

Also this (I guess it's not binary... but still) http://opengex.org/
Logged
Ordnas
Level 10
*****



View Profile WWW
« Reply #158 on: October 17, 2017, 11:44:56 PM »

Just wanted to share this blog post because I thought it was very interesting:

http://ourmachinery.com/post/multi-threading-the-truth/

Very interesting!  Smiley
Liked the writing about commit() to avoid hal-written states and the compare-and-swap (CAS) instruction.
Logged

Games:

ferreiradaselva
Level 3
***



View Profile
« Reply #159 on: October 18, 2017, 04:53:21 AM »

I will check that opengex. But, for binary, I guess the only way is to stick with fbx.
Logged

Pages: 1 ... 6 7 [8] 9 10 ... 16
Print
Jump to:  

Theme orange-lt created by panic