Go to advanced search

by Janq
Fri Aug 08, 2014 11:45 pm
Forum: C/C++
Topic: More C++ Templates
Replies: 4
Views: 929

Re: More C++ Templates

AndyD wrote:The ref keyword is not part of C++, it is part Microsoft's managed version of C++ called C++/CLI[/url].[/list]
Although C++/CLI does have a ref keyword in this case it is just another C++11 type alias.
by Janq
Fri Aug 08, 2014 11:42 pm
Forum: C/C++
Topic: More C++ Templates
Replies: 4
Views: 929

Re: More C++ Templates

1)template<typename T> using Vec=myvec<T, myalloc<T>>; This is using a C++11 feature called type aliases which is similar to a "templated typedef". Basically it says that whenever you write Vec<x> it gets translated into myvec<x, myalloc<x>>. 2) template <typename element> void f(Vec<elem...
by Janq
Sun Dec 08, 2013 1:25 am
Forum: C/C++
Topic: strcpy problem??
Replies: 10
Views: 3320

Re: strcpy problem??

Why does the following code generate a segfault instead of printing out "testing" ?? Because a) you've lost the \0 null terminator on the string and b) you've overrun the buffer. The \0 would not be lost... "test" starts with one, and strcat searches for the \0 and then copies &...
by Janq
Sun Dec 08, 2013 1:20 am
Forum: C/C++
Topic: strcpy problem??
Replies: 10
Views: 3320

Re: strcpy problem??

Literal strings are placed in read-only memory so it is segfaulting because you cannot write to the memory. When you write "char *test="test";" what is happening is that the address of the literal string "test" is being assigned to test (a pointer). Then you call strcat...
by Janq
Thu Nov 07, 2013 7:28 pm
Forum: C/C++
Topic: Default "C" subroutine values
Replies: 4
Views: 1857

Re: Default "C" subroutine values

In C, no. In C++ yes:

Code: Select all

void Pointxy(int x, int y, unsigned int colour=0)
{
}

void ...some function...
{
    Pointxy(5,6);   // results in x=5, y=6, colour=0
    Pointxy(3,4,0x10203040);
}
(assuming colour is passed as an 8:8:8:8 packed integer - same thing works for any type though).
by Janq
Fri Sep 27, 2013 11:10 pm
Forum: OpenGLES
Topic: GLESv2 shader bug?
Replies: 23
Views: 9584

Re: GLESv2 shader bug?

Hi Dom,

Just got some time to test this and yes, it seems to be fixed now. Thanks!
by Janq
Fri Sep 20, 2013 9:46 am
Forum: OpenGLES
Topic: GLESv2 shader bug?
Replies: 23
Views: 9584

Re: GLESv2 shader bug?

Thanks Dom. Would be nice to see a fix for this because it makes writing shaders that have dependent reads very difficult. If anyone else is struggling with this issue you can often (but not always) work around it by forcing the compiler to do extra ALU calculations on the texture coordinates. For e...
by Janq
Tue Sep 17, 2013 5:29 pm
Forum: OpenGLES
Topic: GLESv2 shader bug?
Replies: 23
Views: 9584

Re: GLESv2 shader bug?

Unfortunately there is no offline compiler for the VideoCoreIV (at least not a publically available one), and the driver does not support the binary shader extension (at least it doesn't report that it does - haven't checked the source code for the userland libs to see if it does anything with that ...
by Janq
Sun Sep 08, 2013 9:00 pm
Forum: OpenGLES
Topic: GLESv2 shader bug?
Replies: 23
Views: 9584

Re: GLESv2 shader bug?

No, CompileVertexShader creates a GL_VERTEX_SHADER and CompilePixelShader creates a GL_FRAGMENT_SHADER. You might be confused because the code calls both CompileVertexShader() and CompilePixelShader() with the same source code, but: when compiling the vertex shader it #defines COMPILE_VS to 1 and wh...
by Janq
Wed Sep 04, 2013 2:16 am
Forum: OpenGLES
Topic: GLESv2 shader bug?
Replies: 23
Views: 9584

Re: GLESv2 shader bug?

Interesting, but yeah - it probably just forces an extra instruction or two to be generated which ends up with the compiler generating valid code. Its not really a problem, but probably a bug that should be fixed! Possibly it has already been fixed but we don't have the latest firmware. It shouldn't...
by Janq
Wed Sep 04, 2013 1:53 am
Forum: OpenGLES
Topic: GLESv2 shader bug?
Replies: 23
Views: 9584

Re: GLESv2 shader bug?

Thanks for testing that for me. Yeah - the callstack just shows that it is waiting for a response from the GPU side (which is basically what it does forever after that!).

Hopefully Dom, or someone will see this and take a look, or at least point it at the relevant person.
by Janq
Tue Sep 03, 2013 11:50 pm
Forum: OpenGLES
Topic: GLESv2 shader bug?
Replies: 23
Views: 9584

GLESv2 shader bug?

Hello, I've run into what seems to be a bug in the Pi GLES v2 implementation (possibly a shader compiler bug). Or at least my Pi is broken in a very specific way (seems unlikely!). Basically it seems that if I do a dependent read "too soon" after fetching a texture it will hang the GPU (or...
by Janq
Fri Mar 08, 2013 4:44 am
Forum: OpenGLES
Topic: Explanation of vertex skinning
Replies: 6
Views: 4241

Re: Explanation of vertex skinning

You can generally drop influences from a skin without too many problems as long as you renormalize the weights afterwards. Going from 3->4 shouldn't really make much difference for most models (more weights are often used on tricky areas like armpits and knees and you'll find that most vertices only...
by Janq
Mon Mar 04, 2013 8:36 pm
Forum: OpenGLES
Topic: Explanation of vertex skinning
Replies: 6
Views: 4241

Re: Explanation of vertex skinning

For vertex skinning you basically need to export the following data: Per vertex: A list of bone indices (typically 4). A list of weights - the weights MUST sum to 1. Per bone: The inverse of the bind pose transform - this is because the skin's vertices are stored in the bind pose - ie. if you just d...
by Janq
Wed Jan 30, 2013 1:22 am
Forum: C/C++
Topic: Eclipse and GDB - GDB terminates immediately
Replies: 12
Views: 6070

Re: Eclipse and GDB - GDB terminates immediately

hugocheung wrote:***I wonder if anyone is able to use these Windows settings to run gdbserver before.
Remote debugging the Pi from Windows works fine for me (using the setup I outlined above) - but I'm not using Ian Lindsdell's binaries - I built my own mingw based toolchain.
by Janq
Fri Jan 25, 2013 7:48 pm
Forum: C/C++
Topic: Eclipse and GDB - GDB terminates immediately
Replies: 12
Views: 6070

Re: Eclipse and GDB - GDB terminates immediately

Ah - you beat me to it! - anyway - you might want to try the Remote Systems approach because its a lot simpler once you've set it up and it does a lot of stuff for you that could otherwise go wrong (eg. automatically running gdbserver, etc..).
by Janq
Fri Jan 25, 2013 7:43 pm
Forum: C/C++
Topic: Eclipse and GDB - GDB terminates immediately
Replies: 12
Views: 6070

Re: Eclipse and GDB - GDB terminates immediately

The simplest way is to set up a remote SSH connection in the Remote Systems view (Window/Show View/Other..., then select Remote Systems). Then in that window right click and select "New Connection" and go through all the different steps to set up an SSH connection (its mostly obvious). Onc...
by Janq
Mon Jan 07, 2013 6:25 am
Forum: C/C++
Topic: Integers and Long Integers
Replies: 35
Views: 10488

Re: Integers and Long Integers

Next when you declare 'millonDollar' you should initialize it with a floating point number, some compilers are better than others at fixing this than others but why risk it. Do you actually have any expamples of compilers that are so screwed up they can't handle converting an integer constant and p...
by Janq
Mon Sep 24, 2012 1:43 am
Forum: C/C++
Topic: gcc bug ?
Replies: 3
Views: 1302

Re: gcc bug ?

You aren't initialising sum at the top of main() so it has some random value from the stack (which just happens to be 0 [or something small] in the O0-2 cases).
by Janq
Sat Sep 22, 2012 5:22 pm
Forum: C/C++
Topic: Caveat: Porting Visual Studio C/C++ code over to the Pi
Replies: 11
Views: 2674

Re: Caveat: Porting Visual Studio C/C++ code over to the Pi

Commodore 64? Mine doesn't look dead. :-) lol - well - cc65 is only really c-like - its not a very standard C compiler to start with. And even then - you want to stay away from int because it takes multiple instructions to deal with even a 16bit int in 6502 (and signed 16bit quantities are problema...
by Janq
Wed Sep 19, 2012 12:14 pm
Forum: C/C++
Topic: Caveat: Porting Visual Studio C/C++ code over to the Pi
Replies: 11
Views: 2674

Re: Caveat: Porting Visual Studio C/C++ code over to the Pi

Commodore 64? Mine doesn't look dead. :-) lol - well - cc65 is only really c-like - its not a very standard C compiler to start with. And even then - you want to stay away from int because it takes multiple instructions to deal with even a 16bit int in 6502 (and signed 16bit quantities are problema...
by Janq
Wed Sep 19, 2012 12:09 pm
Forum: C/C++
Topic: Caveat: Porting Visual Studio C/C++ code over to the Pi
Replies: 11
Views: 2674

Re: Caveat: Porting Visual Studio C/C++ code over to the Pi

Platforms where int was 16bit are long dead (e.g. DOS was the main one). Arduino? Ah - interesting - I wasn't aware that Arduino used 16bit ints (although tbh - probably easier to code in asm on such a low end CPU ;)... but still - not really standard these days. For Windows (95 and up) or Linux in...
by Janq
Tue Sep 18, 2012 4:28 pm
Forum: C/C++
Topic: Caveat: Porting Visual Studio C/C++ code over to the Pi
Replies: 11
Views: 2674

Re: Caveat: Porting Visual Studio C/C++ code over to the Pi

int is 32bits in both VC and GCC. Platforms where int was 16bit are long dead (e.g. DOS was the main one).
by Janq
Sun Sep 02, 2012 1:40 am
Forum: OpenGLES
Topic: Problem with mod/floor in GLES2 fragment shader
Replies: 2
Views: 1830

Re: Problem with mod/floor in GLES2 fragment shader

MattOwnby wrote:ehhh I just had to change the 2 to 2.0 inside the mod function and now it works. *sigh*
This is (afaik) correct behaviour with GLSL. GLSL is much more strict (far more strict than is necessary) about implicit conversions - HLSL is much more sensible imo ;)
by Janq
Thu Aug 30, 2012 3:06 pm
Forum: OpenGLES
Topic: Is accelerated image proccessing posible?
Replies: 8
Views: 3152

Re: Is accelerated image proccessing posible?

Things like gamma correction, saturation, HDR, merging two images, colour replacment. If there were multiple input images they would be the same size in pixels and be aligned over eachother. Simple things would be on a per pixel basis. It would be nice to do stuff that was influenced by neighbourin...

Go to advanced search