Notthesameman
Posts: 12
Joined: Mon Mar 09, 2020 9:46 pm

Wrong shader colors?

Wed Apr 08, 2020 8:13 pm

hello everyone, im having trouble with this code, it should work on the rpi4.
Wrong shader colors i think is the right words.

Code: Select all

"  vec4 txcol = texelFetch( s_color,  ivec2( ( int(txindex.g*65280.0) | int(txindex.r*255.0)) ,0 )  , 0 );\n"
thanks and i hope someone can help :D

Notthesameman
Posts: 12
Joined: Mon Mar 09, 2020 9:46 pm

Re: Wrong shader colors?

Thu Apr 09, 2020 2:36 pm

update: if i change

Code: Select all

255.0
the 0 to 1 i get more proper colors, the colors are reversed on the whole screen, backgrounds are still the same.

User avatar
Paeryn
Posts: 2952
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Wrong shader colors?

Thu Apr 09, 2020 3:15 pm

Notthesameman wrote:
Thu Apr 09, 2020 2:36 pm
update: if i change

Code: Select all

255.0
the 0 to 1 i get more proper colors, the colors are reversed on the whole screen, backgrounds are still the same.
Do you mean you changed 255.0 to 255.1? What is the range of values in txindex.g, AFAIK it needs to be less than 0.25 (or less depending on the width of the texture, 4096 is the reported maximum). I don't know what happens of you try reading over that.
She who travels light — forgot something.

Notthesameman
Posts: 12
Joined: Mon Mar 09, 2020 9:46 pm

Re: Wrong shader colors?

Thu Apr 09, 2020 5:35 pm

yes, sorry if i didnt explain my self, the image seems to be reverse like a color is flipped so i thought maybe if i changed .x and .y maybe it work but didint, i was told that this line of code was the error

i was not sure what is the value to set, do i set lower then 0.25?
let me try this then ill report back what it does

Code: Select all

txindex.g*0.25

Notthesameman
Posts: 12
Joined: Mon Mar 09, 2020 9:46 pm

Re: Wrong shader colors?

Thu Apr 09, 2020 5:48 pm

im getting a singe color now on pictures that were showing correct but colors missing or odd color with this code

Code: Select all

txindex.g*0.20


if i set

Code: Select all

txindex.g*165280.0
i was messing with the numbers and some things showed correctly

on the second code if i set

Code: Select all

txindex.r*255.0
im not sure why it doesnt do anything

User avatar
Paeryn
Posts: 2952
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Wrong shader colors?

Thu Apr 09, 2020 7:10 pm

I was wondering because you look to be using the green and red channels of txindex as a 16-bit index into a 1D texture. The 0.25 limit on the green channel I suggested is because if it is 0.25 or higher then you are going to end up with a value that is larger than the maximum texture width that OpenGL says is supported (4096 on a Pi4, I've an idea Pi0-3 is only 2048 but I haven't got one set up to test). What is the width of the texture bound to s_color anyway?

Scaling the green component down isn't likely to help as that will mess up all the indices, you need to make sure that the values are in range. This might not be the actual problem, it's just the most likely that I can think of since in your other thread you said it worked on other hardware.
She who travels light — forgot something.

Notthesameman
Posts: 12
Joined: Mon Mar 09, 2020 9:46 pm

Re: Wrong shader colors?

Fri Apr 10, 2020 6:01 am

Paeryn wrote:
Thu Apr 09, 2020 7:10 pm
I was wondering because you look to be using the green and red channels of txindex as a 16-bit index into a 1D texture. The 0.25 limit on the green channel I suggested is because if it is 0.25 or higher then you are going to end up with a value that is larger than the maximum texture width that OpenGL says is supported (4096 on a Pi4, I've an idea Pi0-3 is only 2048 but I haven't got one set up to test). What is the width of the texture bound to s_color anyway?

Scaling the green component down isn't likely to help as that will mess up all the indices, you need to make sure that the values are in range. This might not be the actual problem, it's just the most likely that I can think of since in your other thread you said it worked on other hardware.
how do i know when txindex is 16bit or other bits? not sure if what im trying to do is 1D texture?
i tired to use 4096 but got the same results.

not sure where is the width of the s_color? heres the original source file
https://github.com/devmiyax/yabause/blo ... shaderes.c (line 299)

in the other post when i changed 255.0 to 255.1 this was the results

first image is 255.1 and second image is 255.0
not sure why its not fixing the other red areas, gun of charactor and building?
Attachments
doom fix.jpg
doom fix.jpg (23.95 KiB) Viewed 725 times
doom broken.jpg
doom broken.jpg (22.3 KiB) Viewed 725 times

User avatar
Paeryn
Posts: 2952
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Wrong shader colors?

Fri Apr 10, 2020 2:41 pm

After searching through the code it looks like s_color is fixed at 2048 pixels wide so I would assume that s_texture only has values that will fit. You'd be better off asking the author about this problem as they'll know how the code works.

As to your modifying of 255.0 to 255.1 only affecting the background, that's probably the only layer that uses that lookup table.
She who travels light — forgot something.

Notthesameman
Posts: 12
Joined: Mon Mar 09, 2020 9:46 pm

Re: Wrong shader colors?

Fri Apr 10, 2020 9:51 pm

the auther already came here and posted the code asking that he drivers on raspberry pi 4 might be the issue?
someone said that color doesnt have enough precsion, a few devs already confirmed that it is on highp.

we already went through this over and over ive had devs go to yabasanshiro, also them asking to come here, other to take it to retropie, but everyone we have asked dont know

i was doing testing and it seems i can high as 500000.0 and it will give all color on screen but scrambled, ive gottent closer for other layers but just off, not sure what is missing, the colors that are present are .r and .g but not .b unless it has to be switch.
if anyone else has any ideas that be nice to see what we can solve here

Notthesameman
Posts: 12
Joined: Mon Mar 09, 2020 9:46 pm

Re: Wrong shader colors?

Sat Apr 11, 2020 11:55 pm

not sure if theses are color, or width of a texture or image? ive used colors but it seems i can get more colors if i use <<8, if anyone can explain what this is for, the way i saw it is that it fixed other layers of colors.

ive advanced alot enough for the games to almost playble, ill post back when i run into a dead or out of ideas, thanks again for everyones help on here

Notthesameman
Posts: 12
Joined: Mon Mar 09, 2020 9:46 pm

Re: Wrong shader colors?

Sun Apr 12, 2020 3:34 pm

i made some what progress, im not a dev so its kind of a mess what i tired to do, not sure why rpi4 is not reading the opengl for this emulators, im stuck now, i got alot on the road, heres a few previews of progress.
the code i dont understand is 255.0, the 0 into 1 corrects the colors, i need to modify this for color to come in properly

Code: Select all

 if (param->sprite != -1){
    glUniform1i(param->sprite, 0);
its strange that i used that <<8 not sure what it does but it fixed the colors also,

Code: Select all

"  vec4 txcol = texelFetch( s_color,  ivec2( ( int(txindex.g*255.116)<<8 | int(txindex.r*255.120)) ,0 )  , 0 );\n"
i had to set the numbers how they are presented if not they come out scrambled, not sure if its the emulator or on the pi

some codes if a try to modify it just seems to not effect what i change, i wanted to see why all games are like this so far i fixed alot of things and wasnt easy, im getting alot of bold colors,spots, color im getting alot of black and also no health bars, no charactors on the screen, it seems its reversed like inside out, back is in front and front is in the back. for now i can only post 3 images, but if someone can point out what i can try to fix theses errors, thank you for your time
Attachments
MVS.jpg
MVS.jpg (30.67 KiB) Viewed 558 times
dxtitle.jpg
dxtitle.jpg (32.45 KiB) Viewed 558 times
darious.jpg
darious.jpg (24.87 KiB) Viewed 558 times

Return to “OpenGLES”