diff options
author | Marek Olšák <[email protected]> | 2010-04-05 03:19:08 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2010-04-05 07:09:46 +0200 |
commit | b71bfc4400e1d7c15a2bebbbd3b26a8770fbf546 (patch) | |
tree | 9988c965cb23b78c5eeeb032b39dccc6da961551 /src/gallium/drivers/r300/r300_screen.c | |
parent | 32327196f7f7a97bebc462a1ba94270580ef3fe9 (diff) |
r300g: simplify accessing screen from context
Diffstat (limited to 'src/gallium/drivers/r300/r300_screen.c')
-rw-r--r-- | src/gallium/drivers/r300/r300_screen.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 0a98458dc37..b52850674f6 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -72,7 +72,7 @@ static const char* r300_get_name(struct pipe_screen* pscreen) { struct r300_screen* r300screen = r300_screen(pscreen); - return chip_families[r300screen->caps->family]; + return chip_families[r300screen->caps.family]; } static int r300_get_param(struct pipe_screen* pscreen, int param) @@ -82,13 +82,13 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) switch (param) { case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: case PIPE_CAP_MAX_COMBINED_SAMPLERS: - return r300screen->caps->num_tex_units; + return r300screen->caps.num_tex_units; case PIPE_CAP_NPOT_TEXTURES: /* XXX enable now to get GL2.1 API, * figure out later how to emulate this */ return 1; case PIPE_CAP_TWO_SIDED_STENCIL: - if (r300screen->caps->is_r500) { + if (r300screen->caps.is_r500) { return 1; } else { return 0; @@ -125,7 +125,7 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: - if (r300screen->caps->is_r500) { + if (r300screen->caps.is_r500) { /* 13 == 4096 */ return 13; } else { @@ -143,7 +143,7 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) case PIPE_CAP_BLEND_EQUATION_SEPARATE: return 1; case PIPE_CAP_SM3: - if (r300screen->caps->is_r500) { + if (r300screen->caps.is_r500) { return 1; } else { return 0; @@ -180,9 +180,9 @@ static float r300_get_paramf(struct pipe_screen* pscreen, int param) case PIPE_CAP_MAX_POINT_WIDTH_AA: /* The maximum dimensions of the colorbuffer are our practical * rendering limits. 2048 pixels should be enough for anybody. */ - if (r300screen->caps->is_r500) { + if (r300screen->caps.is_r500) { return 4096.0f; - } else if (r300screen->caps->is_r400) { + } else if (r300screen->caps.is_r400) { return 4021.0f; } else { return 2560.0f; @@ -205,8 +205,8 @@ static boolean r300_is_format_supported(struct pipe_screen* screen, unsigned geom_flags) { uint32_t retval = 0; - boolean is_r500 = r300_screen(screen)->caps->is_r500; - boolean is_r400 = r300_screen(screen)->caps->is_r400; + boolean is_r500 = r300_screen(screen)->caps.is_r500; + boolean is_r400 = r300_screen(screen)->caps.is_r400; boolean is_z24 = format == PIPE_FORMAT_X8Z24_UNORM || format == PIPE_FORMAT_S8_USCALED_Z24_UNORM; boolean is_color2101010 = format == PIPE_FORMAT_R10G10B10A2_UNORM; @@ -265,29 +265,25 @@ static void r300_destroy_screen(struct pipe_screen* pscreen) if (rws) rws->destroy(rws); - FREE(r300screen->caps); FREE(r300screen); } struct pipe_screen* r300_create_screen(struct r300_winsys_screen *rws) { struct r300_screen *r300screen = CALLOC_STRUCT(r300_screen); - struct r300_capabilities *caps = CALLOC_STRUCT(r300_capabilities); - if (!r300screen || !caps) { + if (!r300screen) { FREE(r300screen); - FREE(caps); return NULL; } - caps->pci_id = rws->get_value(rws, R300_VID_PCI_ID); - caps->num_frag_pipes = rws->get_value(rws, R300_VID_GB_PIPES); - caps->num_z_pipes = rws->get_value(rws, R300_VID_Z_PIPES); + r300screen->caps.pci_id = rws->get_value(rws, R300_VID_PCI_ID); + r300screen->caps.num_frag_pipes = rws->get_value(rws, R300_VID_GB_PIPES); + r300screen->caps.num_z_pipes = rws->get_value(rws, R300_VID_Z_PIPES); r300_init_debug(r300screen); - r300_parse_chipset(caps); + r300_parse_chipset(&r300screen->caps); - r300screen->caps = caps; r300screen->rws = rws; r300screen->screen.winsys = (struct pipe_winsys*)rws; r300screen->screen.destroy = r300_destroy_screen; |