Login
Username:

Password:

Remember me



Lost Password?

Register now!
Sections
Who's Online
74 user(s) are online (63 user(s) are browsing Forums)

Members: 1
Guests: 73

Raziel, more...
Support us!
Recent OS4 Files
OS4Depot.net
Report message:*
 

Re: SDL1 open issues

Subject: Re: SDL1 open issues
by kas1e on 2019/10/10 8:06:03

@Capehill
Do you mean that should be done on the OS level, not software-implemented in SDL ?

Btw, found another little issue when fixing irrlicht : this time its about SDL_ListModes() and maybe togeter with SDL_GetVideoInfo().

Issue is (long story):

When you create a window/fullscreen via SetVideoMode where you provide bitdepth as anything you don't have (let's say "24"), then, while all creates well, SDL_ListModes() will fail to list video modes (that expected, as if you don't have 24 bit modes what it will list). So that are expected, and it the same for win32 too.

I.e. that kind of code are fail on both win32 and amigaos4:

#include <stdio.h>
#include <SDL/SDL.h>
 
 
int main(int argcchar *argv[])
{
    
SDL_Init(SDL_INIT_VIDEO);
       
    
SDL_Surface *Screen SDL_SetVideoMode(102476824SDL_ANYFORMAT SDL_OPENGL);
 
    const 
SDL_VideoInfo *vi SDL_GetVideoInfo();
    
SDL_Rect **modes SDL_ListModes(vi->vfmtSDL_FULLSCREEN);    
   
    
printf("bitserpixel = %dn"vi->vfmt->BitsPerPixel);
      
    if(
modes == (SDL_Rect **)0){
        
printf("No modes available!n");
        
SDL_Quit();
    }
   
    if (
modes != 0)
    {
        if (
modes == (SDL_Rect **)-1) {
            
printf("All mode availablen");
        }
        else
        {
            for (
int i=0modes[i]; ++i) {
                
printf(" %d x %d x %dn"modes[i]->wmodes[i]->hvi->vfmt->BitsPerPixel);
            }
        }
    }
 
    
SDL_Quit();
   
}


So that is fine and expected to be like this.

But then, to make SDL_ListMode works even if we have set "24" in the SetVideoMode, we set manually pixel format to 32 , and then it should works. And it works on win32 and on linux, but fail on our side. There is that failing on os4 testcase:

#include <stdio.h>
#include <SDL/SDL.h>
 
 
int main(int argcchar *argv[])
{
    
SDL_Init(SDL_INIT_VIDEO);
       
    
SDL_Surface *Screen SDL_SetVideoMode(102476824SDL_ANYFORMAT SDL_OPENGL);
 
    const 
SDL_VideoInfo *vi SDL_GetVideoInfo();
   
    
SDL_PixelFormat pixelFormat = *(vi->vfmt);
    
pixelFormat.BitsPerPixel 32;
    
SDL_Rect **modes SDL_ListModes(&pixelFormatSDL_FULLSCREEN);    
   
    
printf("SDL: flags are set to %xn"SDL_FULLSCREEN);
    
printf("bitserpixel = %dn"vi->vfmt->BitsPerPixel);
   
    if (
modes != 0)
    {
        if (
modes == (SDL_Rect **)-1) {
            
printf("All mode availablen");
        }
        else
        {
            for (
int i=0modes[i]; ++i) {
            }
        }
    }
 
 
    
/* Check is there are any modes available */
    
if(modes == (SDL_Rect **)0){
        
printf("No modes available!n");
        
SDL_Quit();
    }
 
    
/* Check if our resolution is restricted */
    
else if(modes == (SDL_Rect **)-1){
        
printf("All resolutions available.n");
    }
    else{
    
/* Print valid modes */
    
printf("Available Modesn");
    for(
int i=0;modes[i];++i)
        
printf("  %d x %dn"modes[i]->wmodes[i]->h);
    }
 
    
SDL_Quit();
   
}


As you can see there i just set manually 32 bit to format before calling SDL_ListModes(). And that fail.

It can be that SDL_ListModes() fail to parse pixelFormat properly ?

I checked SDL_GetVideoInfo() call right after i call SetVideoMode, and in both case and on win32 and on os4 it return 24, as expected. But then, when i set pixelFormat.BitsPerPixel to 32, it then works on win32 when i call SDL_ListModes(&pixelFormat, SDL_FULLSCREEN);, but didn't on os4.

So my bet that there can be one of 2 issues:

1. just first argument of SDL_ListModes or do not parsed correctly

2. it is parsed correclty, but there maybe some "compare" , like if bits in 1st arg of pixelformat in the SDL_ListVideo mode do not equal to the bits used in the SetVideoMode call , then we fail (while should't). At least that prove while for example if we set in test case "16" to the SetVideoMode, but still keep 32 for SDL_ListModes it fail, but when we set 16 on both places , it works. Or if we have 32 in both places it works. But if SetVideoMode have one bits, and ListModes ask to list modes with other bits : then we fail.

While of course we should't fail , as we ask to list modes of bits we ask. And it works like this on win32 and linux, so probabaly that is bug on our side.
Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project