Gallium 3D: kos_winsys

git-svn-id: svn://kolibrios.org@3773 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2013-07-06 15:15:26 +00:00
parent 985e4f70b5
commit 09ee9d676a
3 changed files with 70 additions and 17 deletions

View File

@ -72,14 +72,21 @@ graw_create_window_and_screen(int x,
if (format != PIPE_FORMAT_B8G8R8X8_UNORM)
goto fail;
winsys = kos_create_sw_winsys();
winsys = kos_create_sw_winsys();
if (winsys == NULL)
goto fail;
screen = sw_screen_create(winsys);
screen = sw_screen_create(winsys);
if (screen == NULL)
goto fail;
BeginDraw();
DrawWindow(x, y,width-1,height-1,
NULL,0,0x41);
EndDraw();
*handle = (void *)winsys;
return (screen);
fail:
@ -99,12 +106,44 @@ graw_set_display_func(void (* draw)(void))
void
graw_main_loop(void)
{
for (;;) {
if (graw.draw) {
graw.draw();
}
delay(1);
}
int ev;
oskey_t key;
BeginDraw();
DrawWindow(0,0,0,0, NULL, 0x000000,0x41);
EndDraw();
if (graw.draw)
{
graw.draw();
}
while(1)
{
ev = wait_for_event(100);
switch(ev)
{
case 1:
BeginDraw();
DrawWindow(0,0,0,0, NULL, 0x000000,0x41);
EndDraw();
if (graw.draw)
{
graw.draw();
}
continue;
case 2:
key = get_key();
// printf("key %x\n", key.code);
if( key.code == 0x1b)
return;
continue;
default:
continue;
};
};
}

View File

@ -8,7 +8,6 @@
#include "util/u_memory.h"
#include "state_tracker/graw.h"
#if 0
/* Helper functions. These are the same for all graw implementations.
*/
PUBLIC void *
@ -55,7 +54,6 @@ graw_parse_fragment_shader(struct pipe_context *pipe,
state.tokens = tokens;
return pipe->create_fs_state(pipe, &state);
}
#endif
static char out_filename[256] = "";

View File

@ -182,11 +182,27 @@ kos_sw_display( struct sw_winsys *winsys,
struct sw_displaytarget *dt)
{
struct kos_sw_displaytarget *gdt = kos_sw_displaytarget(dt);
struct blit_call bc;
int ret;
bc.dstx = 0;
bc.dsty = 24;
bc.w = gdt->width;
bc.h = gdt->height;
bc.srcx = 0;
bc.srcy = 0;
bc.srcw = gdt->width;
bc.srch = gdt->height;
bc.stride = gdt->stride;
bc.bitmap = gdt->data;
__asm__ __volatile__(
"int $0x40":"=a"(ret):"a"(73), "b"(0x00),
"c"(&bc):"memory");
return ret;
// StretchDIBits(hDC,
// 0, 0, gdt->width, gdt->height,
// 0, 0, gdt->width, gdt->height,
// gdt->data, &gdt->bmi, 0, SRCCOPY);
}
static void