Merge branch 'mesa_7_7_branch'
Conflicts: src/gallium/state_trackers/xorg/xorg_xv.c src/mesa/drivers/dri/intel/intel_span.c
This commit is contained in:
commit
a087eb590d
|
@ -58,6 +58,7 @@ tbd
|
||||||
<li>Endianness fixes for the DRI swrast driver (bug 22767).</li>
|
<li>Endianness fixes for the DRI swrast driver (bug 22767).</li>
|
||||||
<li>Point sprite fixes for i915/945 driver.
|
<li>Point sprite fixes for i915/945 driver.
|
||||||
<li>Fixed assorted memory leaks (usually on error paths)
|
<li>Fixed assorted memory leaks (usually on error paths)
|
||||||
|
<li>Fixed some GLSL compiler bugs (ex: 25579)
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>Changes</h2>
|
<h2>Changes</h2>
|
||||||
|
|
|
@ -93,7 +93,12 @@ static ImageRec *ImageOpen(char *fileName)
|
||||||
fread(image, 1, 12, image->file);
|
fread(image, 1, 12, image->file);
|
||||||
|
|
||||||
if (swapFlag) {
|
if (swapFlag) {
|
||||||
ConvertShort(&image->imagic, 6);
|
ConvertShort(&image->imagic, 1);
|
||||||
|
ConvertShort(&image->type, 1);
|
||||||
|
ConvertShort(&image->dim, 1);
|
||||||
|
ConvertShort(&image->xsize, 1);
|
||||||
|
ConvertShort(&image->ysize, 1);
|
||||||
|
ConvertShort(&image->zsize, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
image->tmp = (unsigned char *)malloc(image->xsize*256);
|
image->tmp = (unsigned char *)malloc(image->xsize*256);
|
||||||
|
|
|
@ -117,7 +117,12 @@ static rawImageRec *RawImageOpen(const char *fileName)
|
||||||
fread(raw, 1, 12, raw->file);
|
fread(raw, 1, 12, raw->file);
|
||||||
|
|
||||||
if (swapFlag) {
|
if (swapFlag) {
|
||||||
ConvertShort(&raw->imagic, 6);
|
ConvertShort(&raw->imagic, 1);
|
||||||
|
ConvertShort(&raw->type, 1);
|
||||||
|
ConvertShort(&raw->dim, 1);
|
||||||
|
ConvertShort(&raw->sizeX, 1);
|
||||||
|
ConvertShort(&raw->sizeY, 1);
|
||||||
|
ConvertShort(&raw->sizeZ, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
raw->tmp = (unsigned char *)malloc(raw->sizeX*256);
|
raw->tmp = (unsigned char *)malloc(raw->sizeX*256);
|
||||||
|
|
|
@ -370,6 +370,7 @@ def generate(env):
|
||||||
'-Wno-long-long',
|
'-Wno-long-long',
|
||||||
'-ffast-math',
|
'-ffast-math',
|
||||||
'-fmessage-length=0', # be nice to Eclipse
|
'-fmessage-length=0', # be nice to Eclipse
|
||||||
|
'-fno-strict-aliasing', # we violate strict pointer aliasing rules
|
||||||
]
|
]
|
||||||
cflags += [
|
cflags += [
|
||||||
'-Werror=declaration-after-statement',
|
'-Werror=declaration-after-statement',
|
||||||
|
@ -390,15 +391,15 @@ def generate(env):
|
||||||
else:
|
else:
|
||||||
ccflags += [
|
ccflags += [
|
||||||
'/O2', # optimize for speed
|
'/O2', # optimize for speed
|
||||||
#'/fp:fast', # fast floating point
|
'/GL', # enable whole program optimization
|
||||||
]
|
]
|
||||||
ccflags += [
|
ccflags += [
|
||||||
|
'/fp:fast', # fast floating point
|
||||||
'/W3', # warning level
|
'/W3', # warning level
|
||||||
#'/Wp64', # enable 64 bit porting warnings
|
#'/Wp64', # enable 64 bit porting warnings
|
||||||
]
|
]
|
||||||
if env['machine'] == 'x86':
|
if env['machine'] == 'x86':
|
||||||
ccflags += [
|
ccflags += [
|
||||||
#'/QIfist', # Suppress _ftol
|
|
||||||
#'/arch:SSE2', # use the SSE2 instructions
|
#'/arch:SSE2', # use the SSE2 instructions
|
||||||
]
|
]
|
||||||
if platform == 'windows':
|
if platform == 'windows':
|
||||||
|
@ -476,6 +477,11 @@ def generate(env):
|
||||||
]
|
]
|
||||||
# Handle circular dependencies in the libraries
|
# Handle circular dependencies in the libraries
|
||||||
env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
|
env['_LIBFLAGS'] = '-Wl,--start-group ' + env['_LIBFLAGS'] + ' -Wl,--end-group'
|
||||||
|
if msvc:
|
||||||
|
if not env['debug']:
|
||||||
|
# enable Link-time Code Generation
|
||||||
|
linkflags += ['/LTCG']
|
||||||
|
env.Append(ARFLAGS = ['/LTCG'])
|
||||||
if platform == 'windows' and msvc:
|
if platform == 'windows' and msvc:
|
||||||
# See also:
|
# See also:
|
||||||
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
|
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
|
||||||
|
|
|
@ -87,6 +87,7 @@ rbug_get_message(struct rbug_connection *c, uint32_t *serial)
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
data->opcode = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
uint8_t *ptr = ((uint8_t*)data) + read;
|
uint8_t *ptr = ((uint8_t*)data) + read;
|
||||||
|
|
|
@ -277,6 +277,15 @@ svga_screen_surface_create(struct svga_screen *svgascreen,
|
||||||
while(size < key->size.width)
|
while(size < key->size.width)
|
||||||
size <<= 1;
|
size <<= 1;
|
||||||
key->size.width = size;
|
key->size.width = size;
|
||||||
|
/* Since we're reusing buffers we're effectively transforming all
|
||||||
|
* of them into dynamic buffers.
|
||||||
|
*
|
||||||
|
* It would be nice to not cache long lived static buffers. But there
|
||||||
|
* is no way to detect the long lived from short lived ones yet. A
|
||||||
|
* good heuristic would be buffer size.
|
||||||
|
*/
|
||||||
|
key->flags &= ~SVGA3D_SURFACE_HINT_STATIC;
|
||||||
|
key->flags |= SVGA3D_SURFACE_HINT_DYNAMIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = svga_screen_cache_lookup(svgascreen, key);
|
handle = svga_screen_cache_lookup(svgascreen, key);
|
||||||
|
|
|
@ -525,7 +525,7 @@ svga_texture_view_surface(struct pipe_context *pipe,
|
||||||
{
|
{
|
||||||
struct svga_screen *ss = svga_screen(tex->base.screen);
|
struct svga_screen *ss = svga_screen(tex->base.screen);
|
||||||
struct svga_winsys_surface *handle;
|
struct svga_winsys_surface *handle;
|
||||||
int i, j;
|
uint32_t i, j;
|
||||||
unsigned z_offset = 0;
|
unsigned z_offset = 0;
|
||||||
|
|
||||||
SVGA_DBG(DEBUG_PERF,
|
SVGA_DBG(DEBUG_PERF,
|
||||||
|
@ -657,13 +657,11 @@ svga_get_tex_surface(struct pipe_screen *screen,
|
||||||
s->real_level = 0;
|
s->real_level = 0;
|
||||||
s->real_zslice = 0;
|
s->real_zslice = 0;
|
||||||
} else {
|
} else {
|
||||||
struct svga_winsys_screen *sws = svga_winsys_screen(screen);
|
|
||||||
|
|
||||||
SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: no %p, level %u, face %u, z %u, %p\n",
|
SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: no %p, level %u, face %u, z %u, %p\n",
|
||||||
pt, level, face, zslice, s);
|
pt, level, face, zslice, s);
|
||||||
|
|
||||||
memset(&s->key, 0, sizeof s->key);
|
memset(&s->key, 0, sizeof s->key);
|
||||||
sws->surface_reference(sws, &s->handle, tex->handle);
|
s->handle = tex->handle;
|
||||||
s->real_face = face;
|
s->real_face = face;
|
||||||
s->real_level = level;
|
s->real_level = level;
|
||||||
s->real_zslice = zslice;
|
s->real_zslice = zslice;
|
||||||
|
@ -677,11 +675,14 @@ static void
|
||||||
svga_tex_surface_destroy(struct pipe_surface *surf)
|
svga_tex_surface_destroy(struct pipe_surface *surf)
|
||||||
{
|
{
|
||||||
struct svga_surface *s = svga_surface(surf);
|
struct svga_surface *s = svga_surface(surf);
|
||||||
|
struct svga_texture *t = svga_texture(surf->texture);
|
||||||
struct svga_screen *ss = svga_screen(surf->texture->screen);
|
struct svga_screen *ss = svga_screen(surf->texture->screen);
|
||||||
|
|
||||||
|
if(s->handle != t->handle) {
|
||||||
SVGA_DBG(DEBUG_DMA, "unref sid %p (tex surface)\n", s->handle);
|
SVGA_DBG(DEBUG_DMA, "unref sid %p (tex surface)\n", s->handle);
|
||||||
assert(s->key.cachable == 0);
|
|
||||||
svga_screen_surface_destroy(ss, &s->key, &s->handle);
|
svga_screen_surface_destroy(ss, &s->key, &s->handle);
|
||||||
|
}
|
||||||
|
|
||||||
pipe_texture_reference(&surf->texture, NULL);
|
pipe_texture_reference(&surf->texture, NULL);
|
||||||
FREE(surf);
|
FREE(surf);
|
||||||
}
|
}
|
||||||
|
@ -909,7 +910,6 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
|
||||||
unsigned min_lod, unsigned max_lod)
|
unsigned min_lod, unsigned max_lod)
|
||||||
{
|
{
|
||||||
struct svga_screen *ss = svga_screen(pt->screen);
|
struct svga_screen *ss = svga_screen(pt->screen);
|
||||||
struct svga_winsys_screen *sws = ss->sws;
|
|
||||||
struct svga_texture *tex = svga_texture(pt);
|
struct svga_texture *tex = svga_texture(pt);
|
||||||
struct svga_sampler_view *sv = NULL;
|
struct svga_sampler_view *sv = NULL;
|
||||||
SVGA3dSurfaceFormat format = svga_translate_format(pt->format);
|
SVGA3dSurfaceFormat format = svga_translate_format(pt->format);
|
||||||
|
@ -960,7 +960,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
|
||||||
|
|
||||||
sv = CALLOC_STRUCT(svga_sampler_view);
|
sv = CALLOC_STRUCT(svga_sampler_view);
|
||||||
pipe_reference_init(&sv->reference, 1);
|
pipe_reference_init(&sv->reference, 1);
|
||||||
sv->texture = tex;
|
pipe_texture_reference(&sv->texture, pt);
|
||||||
sv->min_lod = min_lod;
|
sv->min_lod = min_lod;
|
||||||
sv->max_lod = max_lod;
|
sv->max_lod = max_lod;
|
||||||
|
|
||||||
|
@ -975,7 +975,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
|
||||||
pt->depth0,
|
pt->depth0,
|
||||||
pt->last_level);
|
pt->last_level);
|
||||||
sv->key.cachable = 0;
|
sv->key.cachable = 0;
|
||||||
sws->surface_reference(sws, &sv->handle, tex->handle);
|
sv->handle = tex->handle;
|
||||||
return sv;
|
return sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -998,7 +998,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
|
||||||
if (!sv->handle) {
|
if (!sv->handle) {
|
||||||
assert(0);
|
assert(0);
|
||||||
sv->key.cachable = 0;
|
sv->key.cachable = 0;
|
||||||
sws->surface_reference(sws, &sv->handle, tex->handle);
|
sv->handle = tex->handle;
|
||||||
return sv;
|
return sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1012,14 +1012,14 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt,
|
||||||
void
|
void
|
||||||
svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view *v)
|
svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view *v)
|
||||||
{
|
{
|
||||||
struct svga_texture *tex = v->texture;
|
struct svga_texture *tex = svga_texture(v->texture);
|
||||||
unsigned numFaces;
|
unsigned numFaces;
|
||||||
unsigned age = 0;
|
unsigned age = 0;
|
||||||
int i, k;
|
int i, k;
|
||||||
|
|
||||||
assert(svga);
|
assert(svga);
|
||||||
|
|
||||||
if (v->handle == v->texture->handle)
|
if (v->handle == tex->handle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
age = tex->age;
|
age = tex->age;
|
||||||
|
@ -1047,11 +1047,14 @@ svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view *
|
||||||
void
|
void
|
||||||
svga_destroy_sampler_view_priv(struct svga_sampler_view *v)
|
svga_destroy_sampler_view_priv(struct svga_sampler_view *v)
|
||||||
{
|
{
|
||||||
struct svga_screen *ss = svga_screen(v->texture->base.screen);
|
struct svga_texture *tex = svga_texture(v->texture);
|
||||||
|
|
||||||
|
if(v->handle != tex->handle) {
|
||||||
|
struct svga_screen *ss = svga_screen(v->texture->screen);
|
||||||
SVGA_DBG(DEBUG_DMA, "unref sid %p (sampler view)\n", v->handle);
|
SVGA_DBG(DEBUG_DMA, "unref sid %p (sampler view)\n", v->handle);
|
||||||
svga_screen_surface_destroy(ss, &v->key, &v->handle);
|
svga_screen_surface_destroy(ss, &v->key, &v->handle);
|
||||||
|
}
|
||||||
|
pipe_texture_reference(&v->texture, NULL);
|
||||||
FREE(v);
|
FREE(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ struct svga_sampler_view
|
||||||
{
|
{
|
||||||
struct pipe_reference reference;
|
struct pipe_reference reference;
|
||||||
|
|
||||||
struct svga_texture *texture;
|
struct pipe_texture *texture;
|
||||||
|
|
||||||
int min_lod;
|
int min_lod;
|
||||||
int max_lod;
|
int max_lod;
|
||||||
|
@ -94,6 +94,13 @@ struct svga_texture
|
||||||
* operation.
|
* operation.
|
||||||
*/
|
*/
|
||||||
struct svga_host_surface_cache_key key;
|
struct svga_host_surface_cache_key key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle for the host side surface.
|
||||||
|
*
|
||||||
|
* This handle is owned by this texture. Views should hold on to a reference
|
||||||
|
* to this texture and never destroy this handle directly.
|
||||||
|
*/
|
||||||
struct svga_winsys_surface *handle;
|
struct svga_winsys_surface *handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,8 @@ static int emit_vs_consts( struct svga_context *svga,
|
||||||
struct svga_tracked_state svga_hw_vs_parameters =
|
struct svga_tracked_state svga_hw_vs_parameters =
|
||||||
{
|
{
|
||||||
"hw vs params",
|
"hw vs params",
|
||||||
(SVGA_NEW_VS_CONST_BUFFER |
|
(SVGA_NEW_PRESCALE |
|
||||||
|
SVGA_NEW_VS_CONST_BUFFER |
|
||||||
SVGA_NEW_ZERO_STRIDE |
|
SVGA_NEW_ZERO_STRIDE |
|
||||||
SVGA_NEW_VS_RESULT),
|
SVGA_NEW_VS_RESULT),
|
||||||
emit_vs_consts
|
emit_vs_consts
|
||||||
|
|
|
@ -256,7 +256,7 @@ crtc_load_cursor_argb_kms(xf86CrtcPtr crtc, CARD32 * image)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
err_bo_destroy:
|
err_bo_destroy:
|
||||||
kms_bo_destroy(crtcp->cursor_bo);
|
kms_bo_destroy(&crtcp->cursor_bo);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -304,10 +304,8 @@ xorg_crtc_cursor_destroy(xf86CrtcPtr crtc)
|
||||||
pipe_texture_reference(&crtcp->cursor_tex, NULL);
|
pipe_texture_reference(&crtcp->cursor_tex, NULL);
|
||||||
#ifdef HAVE_LIBKMS
|
#ifdef HAVE_LIBKMS
|
||||||
if (crtcp->cursor_bo)
|
if (crtcp->cursor_bo)
|
||||||
kms_bo_destroy(crtcp->cursor_bo);
|
kms_bo_destroy(&crtcp->cursor_bo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
xfree(crtcp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -319,11 +317,12 @@ crtc_destroy(xf86CrtcPtr crtc)
|
||||||
{
|
{
|
||||||
struct crtc_private *crtcp = crtc->driver_private;
|
struct crtc_private *crtcp = crtc->driver_private;
|
||||||
|
|
||||||
if (crtcp->cursor_tex)
|
xorg_crtc_cursor_destroy(crtc);
|
||||||
pipe_texture_reference(&crtcp->cursor_tex, NULL);
|
|
||||||
|
|
||||||
drmModeFreeCrtc(crtcp->drm_crtc);
|
drmModeFreeCrtc(crtcp->drm_crtc);
|
||||||
|
|
||||||
xfree(crtcp);
|
xfree(crtcp);
|
||||||
|
crtc->driver_private = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const xf86CrtcFuncsRec crtc_funcs = {
|
static const xf86CrtcFuncsRec crtc_funcs = {
|
||||||
|
|
|
@ -260,8 +260,7 @@ drv_close_resource_management(ScrnInfoPtr pScrn)
|
||||||
|
|
||||||
#ifdef HAVE_LIBKMS
|
#ifdef HAVE_LIBKMS
|
||||||
if (ms->kms)
|
if (ms->kms)
|
||||||
kms_destroy(ms->kms);
|
kms_destroy(&ms->kms);
|
||||||
ms->kms = NULL;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -688,6 +687,9 @@ drv_leave_vt(int scrnIndex, int flags)
|
||||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||||
int o;
|
int o;
|
||||||
|
|
||||||
|
if (ms->winsys_leave_vt)
|
||||||
|
ms->winsys_leave_vt(pScrn);
|
||||||
|
|
||||||
for (o = 0; o < config->num_crtc; o++) {
|
for (o = 0; o < config->num_crtc; o++) {
|
||||||
xf86CrtcPtr crtc = config->crtc[o];
|
xf86CrtcPtr crtc = config->crtc[o];
|
||||||
|
|
||||||
|
@ -750,6 +752,9 @@ drv_enter_vt(int scrnIndex, int flags)
|
||||||
if (!xf86SetDesiredModes(pScrn))
|
if (!xf86SetDesiredModes(pScrn))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (ms->winsys_enter_vt)
|
||||||
|
ms->winsys_enter_vt(pScrn);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -898,8 +903,7 @@ drv_destroy_front_buffer_kms(ScrnInfoPtr pScrn)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
kms_bo_unmap(ms->root_bo);
|
kms_bo_unmap(ms->root_bo);
|
||||||
kms_bo_destroy(ms->root_bo);
|
kms_bo_destroy(&ms->root_bo);
|
||||||
ms->root_bo = NULL;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,7 +949,7 @@ drv_create_front_buffer_kms(ScrnInfoPtr pScrn)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
err_destroy:
|
err_destroy:
|
||||||
kms_bo_destroy(bo);
|
kms_bo_destroy(&bo);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,8 @@ typedef struct _modesettingRec
|
||||||
/* winsys hocks */
|
/* winsys hocks */
|
||||||
Bool (*winsys_screen_init)(ScrnInfoPtr pScr);
|
Bool (*winsys_screen_init)(ScrnInfoPtr pScr);
|
||||||
Bool (*winsys_screen_close)(ScrnInfoPtr pScr);
|
Bool (*winsys_screen_close)(ScrnInfoPtr pScr);
|
||||||
|
Bool (*winsys_enter_vt)(ScrnInfoPtr pScr);
|
||||||
|
Bool (*winsys_leave_vt)(ScrnInfoPtr pScr);
|
||||||
void *winsys_priv;
|
void *winsys_priv;
|
||||||
|
|
||||||
#ifdef DRM_MODE_FEATURE_DIRTYFB
|
#ifdef DRM_MODE_FEATURE_DIRTYFB
|
||||||
|
|
|
@ -212,17 +212,67 @@ check_yuv_textures(struct xorg_xv_port_priv *priv, int width, int height)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
query_image_attributes(ScrnInfoPtr pScrn,
|
||||||
|
int id,
|
||||||
|
unsigned short *w, unsigned short *h,
|
||||||
|
int *pitches, int *offsets)
|
||||||
|
{
|
||||||
|
int size, tmp;
|
||||||
|
|
||||||
|
if (*w > IMAGE_MAX_WIDTH)
|
||||||
|
*w = IMAGE_MAX_WIDTH;
|
||||||
|
if (*h > IMAGE_MAX_HEIGHT)
|
||||||
|
*h = IMAGE_MAX_HEIGHT;
|
||||||
|
|
||||||
|
*w = (*w + 1) & ~1;
|
||||||
|
if (offsets)
|
||||||
|
offsets[0] = 0;
|
||||||
|
|
||||||
|
switch (id) {
|
||||||
|
case FOURCC_YV12:
|
||||||
|
*h = (*h + 1) & ~1;
|
||||||
|
size = (*w + 3) & ~3;
|
||||||
|
if (pitches) {
|
||||||
|
pitches[0] = size;
|
||||||
|
}
|
||||||
|
size *= *h;
|
||||||
|
if (offsets) {
|
||||||
|
offsets[1] = size;
|
||||||
|
}
|
||||||
|
tmp = ((*w >> 1) + 3) & ~3;
|
||||||
|
if (pitches) {
|
||||||
|
pitches[1] = pitches[2] = tmp;
|
||||||
|
}
|
||||||
|
tmp *= (*h >> 1);
|
||||||
|
size += tmp;
|
||||||
|
if (offsets) {
|
||||||
|
offsets[2] = size;
|
||||||
|
}
|
||||||
|
size += tmp;
|
||||||
|
break;
|
||||||
|
case FOURCC_UYVY:
|
||||||
|
case FOURCC_YUY2:
|
||||||
|
default:
|
||||||
|
size = *w << 1;
|
||||||
|
if (pitches)
|
||||||
|
pitches[0] = size;
|
||||||
|
size *= *h;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
copy_packed_data(ScrnInfoPtr pScrn,
|
copy_packed_data(ScrnInfoPtr pScrn,
|
||||||
struct xorg_xv_port_priv *port,
|
struct xorg_xv_port_priv *port,
|
||||||
int id,
|
int id,
|
||||||
unsigned char *buf,
|
unsigned char *buf,
|
||||||
int srcPitch,
|
|
||||||
int left,
|
int left,
|
||||||
int top,
|
int top,
|
||||||
int w, int h)
|
unsigned short w, unsigned short h)
|
||||||
{
|
{
|
||||||
unsigned char *src;
|
|
||||||
int i, j;
|
int i, j;
|
||||||
struct pipe_texture **dst = port->yuv[port->current_set];
|
struct pipe_texture **dst = port->yuv[port->current_set];
|
||||||
struct pipe_transfer *ytrans, *utrans, *vtrans;
|
struct pipe_transfer *ytrans, *utrans, *vtrans;
|
||||||
|
@ -232,8 +282,6 @@ copy_packed_data(ScrnInfoPtr pScrn,
|
||||||
int yidx, uidx, vidx;
|
int yidx, uidx, vidx;
|
||||||
int y_array_size = w * h;
|
int y_array_size = w * h;
|
||||||
|
|
||||||
src = buf + (top * srcPitch) + (left << 1);
|
|
||||||
|
|
||||||
ytrans = screen->get_tex_transfer(screen, dst[0],
|
ytrans = screen->get_tex_transfer(screen, dst[0],
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
PIPE_TRANSFER_WRITE,
|
PIPE_TRANSFER_WRITE,
|
||||||
|
@ -255,15 +303,22 @@ copy_packed_data(ScrnInfoPtr pScrn,
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case FOURCC_YV12: {
|
case FOURCC_YV12: {
|
||||||
for (i = 0; i < w; ++i) {
|
int pitches[3], offsets[3];
|
||||||
for (j = 0; j < h; ++j) {
|
unsigned char *y, *u, *v;
|
||||||
/*XXX use src? */
|
query_image_attributes(pScrn, FOURCC_YV12,
|
||||||
y1 = buf[j*w + i];
|
&w, &h, pitches, offsets);
|
||||||
u = buf[(j/2) * (w/2) + i/2 + y_array_size];
|
|
||||||
v = buf[(j/2) * (w/2) + i/2 + y_array_size + y_array_size/4];
|
y = buf + offsets[0];
|
||||||
ymap[yidx++] = y1;
|
v = buf + offsets[1];
|
||||||
umap[uidx++] = u;
|
u = buf + offsets[2];
|
||||||
vmap[vidx++] = v;
|
for (i = 0; i < h; ++i) {
|
||||||
|
for (j = 0; j < w; ++j) {
|
||||||
|
int yoffset = (w*i+j);
|
||||||
|
int ii = (i|1), jj = (j|1);
|
||||||
|
int vuoffset = (w/2)*(ii/2) + (jj/2);
|
||||||
|
ymap[yidx++] = y[yoffset];
|
||||||
|
umap[uidx++] = u[vuoffset];
|
||||||
|
vmap[vidx++] = v[vuoffset];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -510,7 +565,6 @@ put_image(ScrnInfoPtr pScrn,
|
||||||
ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
|
ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
|
||||||
PixmapPtr pPixmap;
|
PixmapPtr pPixmap;
|
||||||
INT32 x1, x2, y1, y2;
|
INT32 x1, x2, y1, y2;
|
||||||
int srcPitch;
|
|
||||||
BoxRec dstBox;
|
BoxRec dstBox;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -529,21 +583,12 @@ put_image(ScrnInfoPtr pScrn,
|
||||||
width, height))
|
width, height))
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
switch (id) {
|
|
||||||
case FOURCC_UYVY:
|
|
||||||
case FOURCC_YUY2:
|
|
||||||
case FOURCC_YV12:
|
|
||||||
default:
|
|
||||||
srcPitch = width << 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = check_yuv_textures(pPriv, width, height);
|
ret = check_yuv_textures(pPriv, width, height);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
copy_packed_data(pScrn, pPriv, id, buf, srcPitch,
|
copy_packed_data(pScrn, pPriv, id, buf,
|
||||||
src_x, src_y, width, height);
|
src_x, src_y, width, height);
|
||||||
|
|
||||||
if (pDraw->type == DRAWABLE_WINDOW) {
|
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||||
|
@ -561,38 +606,6 @@ put_image(ScrnInfoPtr pScrn,
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
query_image_attributes(ScrnInfoPtr pScrn,
|
|
||||||
int id,
|
|
||||||
unsigned short *w, unsigned short *h,
|
|
||||||
int *pitches, int *offsets)
|
|
||||||
{
|
|
||||||
int size;
|
|
||||||
|
|
||||||
if (*w > IMAGE_MAX_WIDTH)
|
|
||||||
*w = IMAGE_MAX_WIDTH;
|
|
||||||
if (*h > IMAGE_MAX_HEIGHT)
|
|
||||||
*h = IMAGE_MAX_HEIGHT;
|
|
||||||
|
|
||||||
*w = (*w + 1) & ~1;
|
|
||||||
if (offsets)
|
|
||||||
offsets[0] = 0;
|
|
||||||
|
|
||||||
switch (id) {
|
|
||||||
case FOURCC_UYVY:
|
|
||||||
case FOURCC_YUY2:
|
|
||||||
case FOURCC_YV12:
|
|
||||||
default:
|
|
||||||
size = *w << 1;
|
|
||||||
if (pitches)
|
|
||||||
pitches[0] = size;
|
|
||||||
size *= *h;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct xorg_xv_port_priv *
|
static struct xorg_xv_port_priv *
|
||||||
port_priv_create(struct xorg_renderer *r)
|
port_priv_create(struct xorg_renderer *r)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,14 +52,16 @@
|
||||||
/**
|
/**
|
||||||
* DRM_VMW_GET_PARAM - get device information.
|
* DRM_VMW_GET_PARAM - get device information.
|
||||||
*
|
*
|
||||||
* Currently we support only one parameter:
|
|
||||||
*
|
|
||||||
* DRM_VMW_PARAM_FIFO_OFFSET:
|
* DRM_VMW_PARAM_FIFO_OFFSET:
|
||||||
* Offset to use to map the first page of the FIFO read-only.
|
* Offset to use to map the first page of the FIFO read-only.
|
||||||
* The fifo is mapped using the mmap() system call on the drm device.
|
* The fifo is mapped using the mmap() system call on the drm device.
|
||||||
|
*
|
||||||
|
* DRM_VMW_PARAM_OVERLAY_IOCTL:
|
||||||
|
* Does the driver support the overlay ioctl.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DRM_VMW_PARAM_FIFO_OFFSET 0
|
#define DRM_VMW_PARAM_FIFO_OFFSET 0
|
||||||
|
#define DRM_VMW_PARAM_OVERLAY_IOCTL 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct drm_vmw_getparam_arg
|
* struct drm_vmw_getparam_arg
|
||||||
|
|
|
@ -66,11 +66,15 @@ Bool vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
|
||||||
|
|
||||||
Bool vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
|
Bool vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
|
||||||
|
|
||||||
|
void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw);
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* vmw_ioctl.c
|
* vmw_ioctl.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
int vmw_ioctl_supports_overlay(struct vmw_driver *vmw);
|
||||||
|
|
||||||
int vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot);
|
int vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot);
|
||||||
|
|
||||||
struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_driver *vmw,
|
struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_driver *vmw,
|
||||||
|
|
|
@ -56,6 +56,37 @@ struct vmw_dma_buffer
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
vmw_ioctl_get_param(struct vmw_driver *vmw, uint32_t param, uint64_t *out)
|
||||||
|
{
|
||||||
|
struct drm_vmw_getparam_arg gp_arg;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
memset(&gp_arg, 0, sizeof(gp_arg));
|
||||||
|
gp_arg.param = param;
|
||||||
|
ret = drmCommandWriteRead(vmw->fd, DRM_VMW_GET_PARAM,
|
||||||
|
&gp_arg, sizeof(gp_arg));
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
*out = gp_arg.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
vmw_ioctl_supports_overlay(struct vmw_driver *vmw)
|
||||||
|
{
|
||||||
|
uint64_t value;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_OVERLAY_IOCTL, &value);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return value ? 0 : -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot)
|
vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot)
|
||||||
{
|
{
|
||||||
|
|
|
@ -124,6 +124,26 @@ vmw_screen_close(ScrnInfoPtr pScrn)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Bool
|
||||||
|
vmw_screen_enter_vt(ScrnInfoPtr pScrn)
|
||||||
|
{
|
||||||
|
debug_printf("%s: enter\n", __func__);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Bool
|
||||||
|
vmw_screen_leave_vt(ScrnInfoPtr pScrn)
|
||||||
|
{
|
||||||
|
struct vmw_driver *vmw = vmw_driver(pScrn);
|
||||||
|
|
||||||
|
debug_printf("%s: enter\n", __func__);
|
||||||
|
|
||||||
|
vmw_video_stop_all(pScrn, vmw);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions for setting up hooks into the xorg state tracker
|
* Functions for setting up hooks into the xorg state tracker
|
||||||
*/
|
*/
|
||||||
|
@ -142,6 +162,8 @@ vmw_screen_pre_init(ScrnInfoPtr pScrn, int flags)
|
||||||
ms = modesettingPTR(pScrn);
|
ms = modesettingPTR(pScrn);
|
||||||
ms->winsys_screen_init = vmw_screen_init;
|
ms->winsys_screen_init = vmw_screen_init;
|
||||||
ms->winsys_screen_close = vmw_screen_close;
|
ms->winsys_screen_close = vmw_screen_close;
|
||||||
|
ms->winsys_enter_vt = vmw_screen_enter_vt;
|
||||||
|
ms->winsys_leave_vt = vmw_screen_leave_vt;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,6 +276,11 @@ vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
|
||||||
|
|
||||||
debug_printf("%s: enter\n", __func__);
|
debug_printf("%s: enter\n", __func__);
|
||||||
|
|
||||||
|
if (vmw_ioctl_supports_overlay(vmw) != 0) {
|
||||||
|
debug_printf("No overlay ioctl support\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
numAdaptors = xf86XVListGenericAdaptors(pScrn, &overlayAdaptors);
|
numAdaptors = xf86XVListGenericAdaptors(pScrn, &overlayAdaptors);
|
||||||
|
|
||||||
newAdaptor = vmw_video_init_adaptor(pScrn, vmw);
|
newAdaptor = vmw_video_init_adaptor(pScrn, vmw);
|
||||||
|
@ -346,7 +351,8 @@ vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) {
|
for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) {
|
||||||
vmw_video_port_cleanup(pScrn, &video->port[i]);
|
/* make sure the port is stoped as well */
|
||||||
|
vmw_xv_stop_video(pScrn, &video->port[i], TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: I'm sure this function is missing code for turning off Xv */
|
/* XXX: I'm sure this function is missing code for turning off Xv */
|
||||||
|
@ -358,6 +364,38 @@ vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
*-----------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* vmw_video_stop_all --
|
||||||
|
*
|
||||||
|
* Stop all video streams from playing.
|
||||||
|
*
|
||||||
|
* Results:
|
||||||
|
* None.
|
||||||
|
*
|
||||||
|
* Side effects:
|
||||||
|
* All buffers are freed.
|
||||||
|
*
|
||||||
|
*-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw)
|
||||||
|
{
|
||||||
|
struct vmw_video_private *video = vmw->video_priv;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
debug_printf("%s: enter\n", __func__);
|
||||||
|
|
||||||
|
if (!video)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) {
|
||||||
|
vmw_xv_stop_video(pScrn, &video->port[i], TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*-----------------------------------------------------------------------------
|
*-----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
|
@ -164,7 +164,6 @@ if env['platform'] != 'winddk':
|
||||||
'state_tracker/st_cb_flush.c',
|
'state_tracker/st_cb_flush.c',
|
||||||
'state_tracker/st_cb_drawpixels.c',
|
'state_tracker/st_cb_drawpixels.c',
|
||||||
'state_tracker/st_cb_fbo.c',
|
'state_tracker/st_cb_fbo.c',
|
||||||
'state_tracker/st_cb_get.c',
|
|
||||||
'state_tracker/st_cb_feedback.c',
|
'state_tracker/st_cb_feedback.c',
|
||||||
'state_tracker/st_cb_program.c',
|
'state_tracker/st_cb_program.c',
|
||||||
'state_tracker/st_cb_queryobj.c',
|
'state_tracker/st_cb_queryobj.c',
|
||||||
|
|
|
@ -2149,6 +2149,7 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
|
||||||
const GLenum wrapTSave = texObj->WrapT;
|
const GLenum wrapTSave = texObj->WrapT;
|
||||||
const GLenum wrapRSave = texObj->WrapR;
|
const GLenum wrapRSave = texObj->WrapR;
|
||||||
const GLuint fboSave = ctx->DrawBuffer->Name;
|
const GLuint fboSave = ctx->DrawBuffer->Name;
|
||||||
|
const GLuint original_active_unit = ctx->Texture.CurrentUnit;
|
||||||
GLenum faceTarget;
|
GLenum faceTarget;
|
||||||
GLuint dstLevel;
|
GLuint dstLevel;
|
||||||
GLuint border = 0;
|
GLuint border = 0;
|
||||||
|
@ -2288,6 +2289,9 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
|
||||||
/* texture is already locked, unlock now */
|
/* texture is already locked, unlock now */
|
||||||
_mesa_unlock_texture(ctx, texObj);
|
_mesa_unlock_texture(ctx, texObj);
|
||||||
|
|
||||||
|
if (original_active_unit != 0)
|
||||||
|
_mesa_BindTexture(target, texObj->Name);
|
||||||
|
|
||||||
for (dstLevel = baseLevel + 1; dstLevel <= maxLevel; dstLevel++) {
|
for (dstLevel = baseLevel + 1; dstLevel <= maxLevel; dstLevel++) {
|
||||||
const struct gl_texture_image *srcImage;
|
const struct gl_texture_image *srcImage;
|
||||||
const GLuint srcLevel = dstLevel - 1;
|
const GLuint srcLevel = dstLevel - 1;
|
||||||
|
|
|
@ -356,6 +356,63 @@
|
||||||
} while (0)
|
} while (0)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
#elif (SPANTMP_PIXEL_FMT == GL_BGR) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
|
||||||
|
|
||||||
|
/**
|
||||||
|
** GL_BGR, GL_UNSIGNED_INT_8_8_8_8_REV
|
||||||
|
**
|
||||||
|
** This is really for MESA_FORMAT_XRGB8888. The spantmp code needs to be
|
||||||
|
** kicked to the curb, and we need to just code-gen this.
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef GET_VALUE
|
||||||
|
#ifndef GET_PTR
|
||||||
|
#define GET_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * pitch)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
|
||||||
|
#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
|
||||||
|
#endif /* GET_VALUE */
|
||||||
|
|
||||||
|
# define INIT_MONO_PIXEL(p, color) \
|
||||||
|
p = PACK_COLOR_8888(0xff, color[0], color[1], color[2])
|
||||||
|
|
||||||
|
# define WRITE_RGBA(_x, _y, r, g, b, a) \
|
||||||
|
PUT_VALUE(_x, _y, ((r << 16) | \
|
||||||
|
(g << 8) | \
|
||||||
|
(b << 0) | \
|
||||||
|
(0xff << 24)))
|
||||||
|
|
||||||
|
#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
|
||||||
|
|
||||||
|
# if defined( USE_X86_ASM )
|
||||||
|
# define READ_RGBA(rgba, _x, _y) \
|
||||||
|
do { \
|
||||||
|
GLuint p = GET_VALUE(_x, _y); \
|
||||||
|
__asm__ __volatile__( "bswap %0; rorl $8, %0" \
|
||||||
|
: "=r" (p) : "0" (p) ); \
|
||||||
|
((GLuint *)rgba)[0] = p | 0xff000000; \
|
||||||
|
} while (0)
|
||||||
|
# elif defined( MESA_BIG_ENDIAN )
|
||||||
|
/* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
|
||||||
|
* rotlwi instruction. It also produces good code on SPARC.
|
||||||
|
*/
|
||||||
|
# define READ_RGBA( rgba, _x, _y ) \
|
||||||
|
do { \
|
||||||
|
GLuint p = GET_VALUE(_x, _y); \
|
||||||
|
*((uint32_t *) rgba) = (t << 8) | 0xff; \
|
||||||
|
} while (0)
|
||||||
|
# else
|
||||||
|
# define READ_RGBA( rgba, _x, _y ) \
|
||||||
|
do { \
|
||||||
|
GLuint p = GET_VALUE(_x, _y); \
|
||||||
|
rgba[0] = (p >> 16) & 0xff; \
|
||||||
|
rgba[1] = (p >> 8) & 0xff; \
|
||||||
|
rgba[2] = (p >> 0) & 0xff; \
|
||||||
|
rgba[3] = 0xff; \
|
||||||
|
} while (0)
|
||||||
|
# endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error SPANTMP_PIXEL_FMT must be set to a valid value!
|
#error SPANTMP_PIXEL_FMT must be set to a valid value!
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -56,9 +56,6 @@ translate_texture_format(GLuint mesa_format, GLuint internal_format)
|
||||||
case MESA_FORMAT_ARGB4444:
|
case MESA_FORMAT_ARGB4444:
|
||||||
return MAPSURF_16BIT | MT_16BIT_ARGB4444;
|
return MAPSURF_16BIT | MT_16BIT_ARGB4444;
|
||||||
case MESA_FORMAT_ARGB8888:
|
case MESA_FORMAT_ARGB8888:
|
||||||
if (internal_format == GL_RGB)
|
|
||||||
return MAPSURF_32BIT | MT_32BIT_XRGB8888;
|
|
||||||
else
|
|
||||||
return MAPSURF_32BIT | MT_32BIT_ARGB8888;
|
return MAPSURF_32BIT | MT_32BIT_ARGB8888;
|
||||||
case MESA_FORMAT_XRGB8888:
|
case MESA_FORMAT_XRGB8888:
|
||||||
return MAPSURF_32BIT | MT_32BIT_XRGB8888;
|
return MAPSURF_32BIT | MT_32BIT_XRGB8888;
|
||||||
|
|
|
@ -645,7 +645,7 @@ i830_state_draw_region(struct intel_context *intel,
|
||||||
DSTORG_VERT_BIAS(0x8) | DEPTH_IS_Z); /* .5 */
|
DSTORG_VERT_BIAS(0x8) | DEPTH_IS_Z); /* .5 */
|
||||||
|
|
||||||
if (irb != NULL) {
|
if (irb != NULL) {
|
||||||
switch (irb->texformat) {
|
switch (irb->Base.Format) {
|
||||||
case MESA_FORMAT_ARGB8888:
|
case MESA_FORMAT_ARGB8888:
|
||||||
case MESA_FORMAT_XRGB8888:
|
case MESA_FORMAT_XRGB8888:
|
||||||
value |= DV_PF_8888;
|
value |= DV_PF_8888;
|
||||||
|
@ -661,7 +661,7 @@ i830_state_draw_region(struct intel_context *intel,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_mesa_problem(ctx, "Bad renderbuffer format: %d\n",
|
_mesa_problem(ctx, "Bad renderbuffer format: %d\n",
|
||||||
irb->texformat);
|
irb->Base.Format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -806,6 +806,7 @@ static GLboolean i915_debug_packet( struct debug_stream *stream )
|
||||||
default:
|
default:
|
||||||
return debug(stream, "", 0);
|
return debug(stream, "", 0);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -57,9 +57,6 @@ translate_texture_format(gl_format mesa_format, GLuint internal_format,
|
||||||
case MESA_FORMAT_ARGB4444:
|
case MESA_FORMAT_ARGB4444:
|
||||||
return MAPSURF_16BIT | MT_16BIT_ARGB4444;
|
return MAPSURF_16BIT | MT_16BIT_ARGB4444;
|
||||||
case MESA_FORMAT_ARGB8888:
|
case MESA_FORMAT_ARGB8888:
|
||||||
if (internal_format == GL_RGB)
|
|
||||||
return MAPSURF_32BIT | MT_32BIT_XRGB8888;
|
|
||||||
else
|
|
||||||
return MAPSURF_32BIT | MT_32BIT_ARGB8888;
|
return MAPSURF_32BIT | MT_32BIT_ARGB8888;
|
||||||
case MESA_FORMAT_XRGB8888:
|
case MESA_FORMAT_XRGB8888:
|
||||||
return MAPSURF_32BIT | MT_32BIT_XRGB8888;
|
return MAPSURF_32BIT | MT_32BIT_XRGB8888;
|
||||||
|
|
|
@ -587,7 +587,7 @@ i915_state_draw_region(struct intel_context *intel,
|
||||||
DSTORG_VERT_BIAS(0x8) | /* .5 */
|
DSTORG_VERT_BIAS(0x8) | /* .5 */
|
||||||
LOD_PRECLAMP_OGL | TEX_DEFAULT_COLOR_OGL);
|
LOD_PRECLAMP_OGL | TEX_DEFAULT_COLOR_OGL);
|
||||||
if (irb != NULL) {
|
if (irb != NULL) {
|
||||||
switch (irb->texformat) {
|
switch (irb->Base.Format) {
|
||||||
case MESA_FORMAT_ARGB8888:
|
case MESA_FORMAT_ARGB8888:
|
||||||
case MESA_FORMAT_XRGB8888:
|
case MESA_FORMAT_XRGB8888:
|
||||||
value |= DV_PF_8888;
|
value |= DV_PF_8888;
|
||||||
|
@ -603,7 +603,7 @@ i915_state_draw_region(struct intel_context *intel,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_mesa_problem(ctx, "Bad renderbuffer format: %d\n",
|
_mesa_problem(ctx, "Bad renderbuffer format: %d\n",
|
||||||
irb->texformat);
|
irb->Base.Format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "brw_state.h"
|
#include "brw_state.h"
|
||||||
#include "brw_defines.h"
|
#include "brw_defines.h"
|
||||||
#include "brw_util.h"
|
#include "brw_util.h"
|
||||||
|
#include "intel_fbo.h"
|
||||||
#include "main/macros.h"
|
#include "main/macros.h"
|
||||||
#include "main/enums.h"
|
#include "main/enums.h"
|
||||||
|
|
||||||
|
@ -89,6 +90,28 @@ struct brw_cc_unit_key {
|
||||||
GLenum depth_func;
|
GLenum depth_func;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify blend function to force destination alpha to 1.0
|
||||||
|
*
|
||||||
|
* If \c function specifies a blend function that uses destination alpha,
|
||||||
|
* replace it with a function that hard-wires destination alpha to 1.0. This
|
||||||
|
* is used when rendering to xRGB targets.
|
||||||
|
*/
|
||||||
|
static GLenum
|
||||||
|
fix_xRGB_alpha(GLenum function)
|
||||||
|
{
|
||||||
|
switch (function) {
|
||||||
|
case GL_DST_ALPHA:
|
||||||
|
return GL_ONE;
|
||||||
|
|
||||||
|
case GL_ONE_MINUS_DST_ALPHA:
|
||||||
|
case GL_SRC_ALPHA_SATURATE:
|
||||||
|
return GL_ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return function;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key)
|
cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key)
|
||||||
{
|
{
|
||||||
|
@ -132,6 +155,17 @@ cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key)
|
||||||
key->blend_dst_rgb = ctx->Color.BlendDstRGB;
|
key->blend_dst_rgb = ctx->Color.BlendDstRGB;
|
||||||
key->blend_src_a = ctx->Color.BlendSrcA;
|
key->blend_src_a = ctx->Color.BlendSrcA;
|
||||||
key->blend_dst_a = ctx->Color.BlendDstA;
|
key->blend_dst_a = ctx->Color.BlendDstA;
|
||||||
|
|
||||||
|
/* If the renderbuffer is XRGB, we have to frob the blend function to
|
||||||
|
* force the destination alpha to 1.0. This means replacing GL_DST_ALPHA
|
||||||
|
* with GL_ONE and GL_ONE_MINUS_DST_ALPAH with GL_ZERO.
|
||||||
|
*/
|
||||||
|
if (ctx->Visual.alphaBits == 0) {
|
||||||
|
key->blend_src_rgb = fix_xRGB_alpha(key->blend_src_rgb);
|
||||||
|
key->blend_src_a = fix_xRGB_alpha(key->blend_src_a);
|
||||||
|
key->blend_dst_rgb = fix_xRGB_alpha(key->blend_dst_rgb);
|
||||||
|
key->blend_dst_a = fix_xRGB_alpha(key->blend_dst_a);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
key->alpha_enabled = ctx->Color.AlphaEnabled;
|
key->alpha_enabled = ctx->Color.AlphaEnabled;
|
||||||
|
|
|
@ -94,9 +94,6 @@ static GLuint translate_tex_format( gl_format mesa_format,
|
||||||
return BRW_SURFACEFORMAT_R8G8B8_UNORM;
|
return BRW_SURFACEFORMAT_R8G8B8_UNORM;
|
||||||
|
|
||||||
case MESA_FORMAT_ARGB8888:
|
case MESA_FORMAT_ARGB8888:
|
||||||
if (internal_format == GL_RGB)
|
|
||||||
return BRW_SURFACEFORMAT_B8G8R8X8_UNORM;
|
|
||||||
else
|
|
||||||
return BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
|
return BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
|
||||||
|
|
||||||
case MESA_FORMAT_XRGB8888:
|
case MESA_FORMAT_XRGB8888:
|
||||||
|
@ -104,9 +101,6 @@ static GLuint translate_tex_format( gl_format mesa_format,
|
||||||
|
|
||||||
case MESA_FORMAT_RGBA8888_REV:
|
case MESA_FORMAT_RGBA8888_REV:
|
||||||
_mesa_problem(NULL, "unexpected format in i965:translate_tex_format()");
|
_mesa_problem(NULL, "unexpected format in i965:translate_tex_format()");
|
||||||
if (internal_format == GL_RGB)
|
|
||||||
return BRW_SURFACEFORMAT_R8G8B8X8_UNORM;
|
|
||||||
else
|
|
||||||
return BRW_SURFACEFORMAT_R8G8B8A8_UNORM;
|
return BRW_SURFACEFORMAT_R8G8B8A8_UNORM;
|
||||||
|
|
||||||
case MESA_FORMAT_RGB565:
|
case MESA_FORMAT_RGB565:
|
||||||
|
@ -537,12 +531,16 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
|
||||||
region_bo = region->buffer;
|
region_bo = region->buffer;
|
||||||
|
|
||||||
key.surface_type = BRW_SURFACE_2D;
|
key.surface_type = BRW_SURFACE_2D;
|
||||||
switch (irb->texformat) {
|
switch (irb->Base.Format) {
|
||||||
|
/* XRGB and ARGB are treated the same here because the chips in this
|
||||||
|
* family cannot render to XRGB targets. This means that we have to
|
||||||
|
* mask writes to alpha (ala glColorMask) and reconfigure the alpha
|
||||||
|
* blending hardware to use GL_ONE (or GL_ZERO) for cases where
|
||||||
|
* GL_DST_ALPHA (or GL_ONE_MINUS_DST_ALPHA) is used.
|
||||||
|
*/
|
||||||
case MESA_FORMAT_ARGB8888:
|
case MESA_FORMAT_ARGB8888:
|
||||||
key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
|
|
||||||
break;
|
|
||||||
case MESA_FORMAT_XRGB8888:
|
case MESA_FORMAT_XRGB8888:
|
||||||
key.surface_format = BRW_SURFACEFORMAT_B8G8R8X8_UNORM;
|
key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM;
|
||||||
break;
|
break;
|
||||||
case MESA_FORMAT_RGB565:
|
case MESA_FORMAT_RGB565:
|
||||||
key.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM;
|
key.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM;
|
||||||
|
@ -554,7 +552,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
|
||||||
key.surface_format = BRW_SURFACEFORMAT_B4G4R4A4_UNORM;
|
key.surface_format = BRW_SURFACEFORMAT_B4G4R4A4_UNORM;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->texformat);
|
_mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->Base.Format);
|
||||||
}
|
}
|
||||||
key.tiling = region->tiling;
|
key.tiling = region->tiling;
|
||||||
if (brw->intel.intelScreen->driScrnPriv->dri2.enabled) {
|
if (brw->intel.intelScreen->driScrnPriv->dri2.enabled) {
|
||||||
|
@ -579,6 +577,13 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
|
||||||
/* _NEW_COLOR */
|
/* _NEW_COLOR */
|
||||||
memcpy(key.color_mask, ctx->Color.ColorMask,
|
memcpy(key.color_mask, ctx->Color.ColorMask,
|
||||||
sizeof(key.color_mask));
|
sizeof(key.color_mask));
|
||||||
|
|
||||||
|
/* As mentioned above, disable writes to the alpha component when the
|
||||||
|
* renderbuffer is XRGB.
|
||||||
|
*/
|
||||||
|
if (ctx->Visual.alphaBits == 0)
|
||||||
|
key.color_mask[3] = GL_FALSE;
|
||||||
|
|
||||||
key.color_blend = (!ctx->Color._LogicOpEnabled &&
|
key.color_blend = (!ctx->Color._LogicOpEnabled &&
|
||||||
ctx->Color.BlendEnabled);
|
ctx->Color.BlendEnabled);
|
||||||
|
|
||||||
|
|
|
@ -496,7 +496,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
|
||||||
CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]);
|
CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]);
|
||||||
CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]);
|
CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]);
|
||||||
|
|
||||||
switch (irb->texformat) {
|
switch (irb->Base.Format) {
|
||||||
case MESA_FORMAT_ARGB8888:
|
case MESA_FORMAT_ARGB8888:
|
||||||
case MESA_FORMAT_XRGB8888:
|
case MESA_FORMAT_XRGB8888:
|
||||||
clearVal = PACK_COLOR_8888(clear[3], clear[0],
|
clearVal = PACK_COLOR_8888(clear[3], clear[0],
|
||||||
|
@ -515,7 +515,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_mesa_problem(ctx, "Unexpected renderbuffer format: %d\n",
|
_mesa_problem(ctx, "Unexpected renderbuffer format: %d\n",
|
||||||
irb->texformat);
|
irb->Base.Format);
|
||||||
clearVal = 0;
|
clearVal = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "drivers/common/meta.h"
|
#include "drivers/common/meta.h"
|
||||||
|
|
||||||
#include "intel_context.h"
|
#include "intel_context.h"
|
||||||
|
#include "intel_batchbuffer.h"
|
||||||
#include "intel_buffers.h"
|
#include "intel_buffers.h"
|
||||||
#include "intel_fbo.h"
|
#include "intel_fbo.h"
|
||||||
#include "intel_mipmap_tree.h"
|
#include "intel_mipmap_tree.h"
|
||||||
|
@ -105,8 +106,8 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||||
{
|
{
|
||||||
struct intel_context *intel = intel_context(ctx);
|
struct intel_context *intel = intel_context(ctx);
|
||||||
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
|
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
|
||||||
GLboolean softwareBuffer = GL_FALSE;
|
|
||||||
int cpp;
|
int cpp;
|
||||||
|
GLuint pitch;
|
||||||
|
|
||||||
ASSERT(rb->Name != 0);
|
ASSERT(rb->Name != 0);
|
||||||
|
|
||||||
|
@ -116,18 +117,14 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||||
case GL_RGB5:
|
case GL_RGB5:
|
||||||
rb->Format = MESA_FORMAT_RGB565;
|
rb->Format = MESA_FORMAT_RGB565;
|
||||||
rb->DataType = GL_UNSIGNED_BYTE;
|
rb->DataType = GL_UNSIGNED_BYTE;
|
||||||
irb->texformat = MESA_FORMAT_RGB565;
|
|
||||||
cpp = 2;
|
|
||||||
break;
|
break;
|
||||||
case GL_RGB:
|
case GL_RGB:
|
||||||
case GL_RGB8:
|
case GL_RGB8:
|
||||||
case GL_RGB10:
|
case GL_RGB10:
|
||||||
case GL_RGB12:
|
case GL_RGB12:
|
||||||
case GL_RGB16:
|
case GL_RGB16:
|
||||||
rb->Format = MESA_FORMAT_ARGB8888;
|
rb->Format = MESA_FORMAT_XRGB8888;
|
||||||
rb->DataType = GL_UNSIGNED_BYTE;
|
rb->DataType = GL_UNSIGNED_BYTE;
|
||||||
irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: Need xrgb8888 */
|
|
||||||
cpp = 4;
|
|
||||||
break;
|
break;
|
||||||
case GL_RGBA:
|
case GL_RGBA:
|
||||||
case GL_RGBA2:
|
case GL_RGBA2:
|
||||||
|
@ -139,8 +136,6 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||||
case GL_RGBA16:
|
case GL_RGBA16:
|
||||||
rb->Format = MESA_FORMAT_ARGB8888;
|
rb->Format = MESA_FORMAT_ARGB8888;
|
||||||
rb->DataType = GL_UNSIGNED_BYTE;
|
rb->DataType = GL_UNSIGNED_BYTE;
|
||||||
irb->texformat = MESA_FORMAT_ARGB8888;
|
|
||||||
cpp = 4;
|
|
||||||
break;
|
break;
|
||||||
case GL_STENCIL_INDEX:
|
case GL_STENCIL_INDEX:
|
||||||
case GL_STENCIL_INDEX1_EXT:
|
case GL_STENCIL_INDEX1_EXT:
|
||||||
|
@ -150,29 +145,21 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||||
/* alloc a depth+stencil buffer */
|
/* alloc a depth+stencil buffer */
|
||||||
rb->Format = MESA_FORMAT_S8_Z24;
|
rb->Format = MESA_FORMAT_S8_Z24;
|
||||||
rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
|
rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
|
||||||
cpp = 4;
|
|
||||||
irb->texformat = MESA_FORMAT_S8_Z24;
|
|
||||||
break;
|
break;
|
||||||
case GL_DEPTH_COMPONENT16:
|
case GL_DEPTH_COMPONENT16:
|
||||||
rb->Format = MESA_FORMAT_Z16;
|
rb->Format = MESA_FORMAT_Z16;
|
||||||
rb->DataType = GL_UNSIGNED_SHORT;
|
rb->DataType = GL_UNSIGNED_SHORT;
|
||||||
cpp = 2;
|
|
||||||
irb->texformat = MESA_FORMAT_Z16;
|
|
||||||
break;
|
break;
|
||||||
case GL_DEPTH_COMPONENT:
|
case GL_DEPTH_COMPONENT:
|
||||||
case GL_DEPTH_COMPONENT24:
|
case GL_DEPTH_COMPONENT24:
|
||||||
case GL_DEPTH_COMPONENT32:
|
case GL_DEPTH_COMPONENT32:
|
||||||
rb->Format = MESA_FORMAT_S8_Z24;
|
rb->Format = MESA_FORMAT_S8_Z24;
|
||||||
rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
|
rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
|
||||||
cpp = 4;
|
|
||||||
irb->texformat = MESA_FORMAT_S8_Z24;
|
|
||||||
break;
|
break;
|
||||||
case GL_DEPTH_STENCIL_EXT:
|
case GL_DEPTH_STENCIL_EXT:
|
||||||
case GL_DEPTH24_STENCIL8_EXT:
|
case GL_DEPTH24_STENCIL8_EXT:
|
||||||
rb->Format = MESA_FORMAT_S8_Z24;
|
rb->Format = MESA_FORMAT_S8_Z24;
|
||||||
rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
|
rb->DataType = GL_UNSIGNED_INT_24_8_EXT;
|
||||||
cpp = 4;
|
|
||||||
irb->texformat = MESA_FORMAT_S8_Z24;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_mesa_problem(ctx,
|
_mesa_problem(ctx,
|
||||||
|
@ -181,6 +168,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat);
|
rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat);
|
||||||
|
cpp = _mesa_get_format_bytes(rb->Format);
|
||||||
|
|
||||||
intelFlush(ctx);
|
intelFlush(ctx);
|
||||||
|
|
||||||
|
@ -190,22 +178,16 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate new memory region/renderbuffer */
|
/* allocate new memory region/renderbuffer */
|
||||||
if (softwareBuffer) {
|
|
||||||
return _mesa_soft_renderbuffer_storage(ctx, rb, internalFormat,
|
|
||||||
width, height);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* Choose a pitch to match hardware requirements:
|
/* Choose a pitch to match hardware requirements:
|
||||||
*/
|
*/
|
||||||
GLuint pitch = ((cpp * width + 63) & ~63) / cpp;
|
pitch = ((cpp * width + 63) & ~63) / cpp;
|
||||||
|
|
||||||
/* alloc hardware renderbuffer */
|
/* alloc hardware renderbuffer */
|
||||||
DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width,
|
DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width, height, pitch);
|
||||||
height, pitch);
|
|
||||||
|
|
||||||
irb->region = intel_region_alloc(intel, I915_TILING_NONE,
|
irb->region = intel_region_alloc(intel, I915_TILING_NONE, cpp,
|
||||||
cpp, width, height, pitch,
|
width, height, pitch, GL_TRUE);
|
||||||
GL_TRUE);
|
|
||||||
if (!irb->region)
|
if (!irb->region)
|
||||||
return GL_FALSE; /* out of memory? */
|
return GL_FALSE; /* out of memory? */
|
||||||
|
|
||||||
|
@ -215,7 +197,6 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||||
rb->Height = height;
|
rb->Height = height;
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -297,7 +278,6 @@ intel_create_renderbuffer(gl_format format)
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
|
||||||
struct intel_renderbuffer *irb;
|
struct intel_renderbuffer *irb;
|
||||||
const GLuint name = 0;
|
|
||||||
|
|
||||||
irb = CALLOC_STRUCT(intel_renderbuffer);
|
irb = CALLOC_STRUCT(intel_renderbuffer);
|
||||||
if (!irb) {
|
if (!irb) {
|
||||||
|
@ -305,7 +285,7 @@ intel_create_renderbuffer(gl_format format)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_mesa_init_renderbuffer(&irb->Base, name);
|
_mesa_init_renderbuffer(&irb->Base, 0);
|
||||||
irb->Base.ClassID = INTEL_RB_CLASS;
|
irb->Base.ClassID = INTEL_RB_CLASS;
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
@ -314,10 +294,6 @@ intel_create_renderbuffer(gl_format format)
|
||||||
irb->Base.DataType = GL_UNSIGNED_BYTE;
|
irb->Base.DataType = GL_UNSIGNED_BYTE;
|
||||||
break;
|
break;
|
||||||
case MESA_FORMAT_XRGB8888:
|
case MESA_FORMAT_XRGB8888:
|
||||||
/* XXX this is a hack since XRGB surfaces don't seem to work
|
|
||||||
* properly yet. Reading the alpha channel returns 0 instead of 1.
|
|
||||||
*/
|
|
||||||
format = MESA_FORMAT_ARGB8888;
|
|
||||||
irb->Base._BaseFormat = GL_RGB;
|
irb->Base._BaseFormat = GL_RGB;
|
||||||
irb->Base.DataType = GL_UNSIGNED_BYTE;
|
irb->Base.DataType = GL_UNSIGNED_BYTE;
|
||||||
break;
|
break;
|
||||||
|
@ -346,7 +322,6 @@ intel_create_renderbuffer(gl_format format)
|
||||||
|
|
||||||
irb->Base.Format = format;
|
irb->Base.Format = format;
|
||||||
irb->Base.InternalFormat = irb->Base._BaseFormat;
|
irb->Base.InternalFormat = irb->Base._BaseFormat;
|
||||||
irb->texformat = format;
|
|
||||||
|
|
||||||
/* intel-specific methods */
|
/* intel-specific methods */
|
||||||
irb->Base.Delete = intel_delete_renderbuffer;
|
irb->Base.Delete = intel_delete_renderbuffer;
|
||||||
|
@ -423,7 +398,6 @@ static GLboolean
|
||||||
intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
|
intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
|
||||||
struct gl_texture_image *texImage)
|
struct gl_texture_image *texImage)
|
||||||
{
|
{
|
||||||
irb->texformat = texImage->TexFormat;
|
|
||||||
gl_format texFormat;
|
gl_format texFormat;
|
||||||
|
|
||||||
if (texImage->TexFormat == MESA_FORMAT_ARGB8888) {
|
if (texImage->TexFormat == MESA_FORMAT_ARGB8888) {
|
||||||
|
@ -591,6 +565,7 @@ static void
|
||||||
intel_finish_render_texture(GLcontext * ctx,
|
intel_finish_render_texture(GLcontext * ctx,
|
||||||
struct gl_renderbuffer_attachment *att)
|
struct gl_renderbuffer_attachment *att)
|
||||||
{
|
{
|
||||||
|
struct intel_context *intel = intel_context(ctx);
|
||||||
struct gl_texture_object *tex_obj = att->Texture;
|
struct gl_texture_object *tex_obj = att->Texture;
|
||||||
struct gl_texture_image *image =
|
struct gl_texture_image *image =
|
||||||
tex_obj->Image[att->CubeMapFace][att->TextureLevel];
|
tex_obj->Image[att->CubeMapFace][att->TextureLevel];
|
||||||
|
@ -598,8 +573,14 @@ intel_finish_render_texture(GLcontext * ctx,
|
||||||
|
|
||||||
/* Flag that this image may now be validated into the object's miptree. */
|
/* Flag that this image may now be validated into the object's miptree. */
|
||||||
intel_image->used_as_render_target = GL_FALSE;
|
intel_image->used_as_render_target = GL_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Since we've (probably) rendered to the texture and will (likely) use
|
||||||
|
* it in the texture domain later on in this batchbuffer, flush the
|
||||||
|
* batch. Once again, we wish for a domain tracker in libdrm to cover
|
||||||
|
* usage inside of a batchbuffer like GEM does in the kernel.
|
||||||
|
*/
|
||||||
|
intel_batchbuffer_emit_mi_flush(intel->batch);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do additional "completeness" testing of a framebuffer object.
|
* Do additional "completeness" testing of a framebuffer object.
|
||||||
|
@ -632,7 +613,7 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (irb->texformat) {
|
switch (irb->Base.Format) {
|
||||||
case MESA_FORMAT_ARGB8888:
|
case MESA_FORMAT_ARGB8888:
|
||||||
case MESA_FORMAT_XRGB8888:
|
case MESA_FORMAT_XRGB8888:
|
||||||
case MESA_FORMAT_RGB565:
|
case MESA_FORMAT_RGB565:
|
||||||
|
|
|
@ -62,8 +62,6 @@ struct intel_renderbuffer
|
||||||
struct gl_renderbuffer Base;
|
struct gl_renderbuffer Base;
|
||||||
struct intel_region *region;
|
struct intel_region *region;
|
||||||
|
|
||||||
gl_format texformat;
|
|
||||||
|
|
||||||
GLuint vbl_pending; /**< vblank sequence number of pending flip */
|
GLuint vbl_pending; /**< vblank sequence number of pending flip */
|
||||||
|
|
||||||
uint8_t *span_cache;
|
uint8_t *span_cache;
|
||||||
|
|
|
@ -285,11 +285,11 @@ intelReadPixels(GLcontext * ctx,
|
||||||
|
|
||||||
intelFlush(ctx);
|
intelFlush(ctx);
|
||||||
|
|
||||||
#ifdef I915
|
|
||||||
if (do_blit_readpixels
|
if (do_blit_readpixels
|
||||||
(ctx, x, y, width, height, format, type, pack, pixels))
|
(ctx, x, y, width, height, format, type, pack, pixels))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef I915
|
||||||
if (do_texture_readpixels
|
if (do_texture_readpixels
|
||||||
(ctx, x, y, width, height, format, type, pack, pixels))
|
(ctx, x, y, width, height, format, type, pack, pixels))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -334,7 +334,7 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
|
||||||
#include "intel_spantmp.h"
|
#include "intel_spantmp.h"
|
||||||
|
|
||||||
/* x8r8g8b8 color span and pixel functions */
|
/* x8r8g8b8 color span and pixel functions */
|
||||||
#define INTEL_PIXEL_FMT GL_BGRA
|
#define INTEL_PIXEL_FMT GL_BGR
|
||||||
#define INTEL_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
|
#define INTEL_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV
|
||||||
#define INTEL_READ_VALUE(offset) pread_xrgb8888(irb, offset)
|
#define INTEL_READ_VALUE(offset) pread_xrgb8888(irb, offset)
|
||||||
#define INTEL_WRITE_VALUE(offset, v) pwrite_xrgb8888(irb, offset, v)
|
#define INTEL_WRITE_VALUE(offset, v) pwrite_xrgb8888(irb, offset, v)
|
||||||
|
@ -616,7 +616,7 @@ intel_set_span_functions(struct intel_context *intel,
|
||||||
uint32_t tiling = irb->region->tiling;
|
uint32_t tiling = irb->region->tiling;
|
||||||
|
|
||||||
if (intel->intelScreen->kernel_exec_fencing) {
|
if (intel->intelScreen->kernel_exec_fencing) {
|
||||||
switch (irb->texformat) {
|
switch (irb->Base.Format) {
|
||||||
case MESA_FORMAT_RGB565:
|
case MESA_FORMAT_RGB565:
|
||||||
intel_gttmap_InitPointers_RGB565(rb);
|
intel_gttmap_InitPointers_RGB565(rb);
|
||||||
break;
|
break;
|
||||||
|
@ -630,13 +630,7 @@ intel_set_span_functions(struct intel_context *intel,
|
||||||
intel_gttmap_InitPointers_xRGB8888(rb);
|
intel_gttmap_InitPointers_xRGB8888(rb);
|
||||||
break;
|
break;
|
||||||
case MESA_FORMAT_ARGB8888:
|
case MESA_FORMAT_ARGB8888:
|
||||||
if (rb->_BaseFormat == GL_RGB) {
|
|
||||||
/* XXX remove this code someday when we enable XRGB surfaces */
|
|
||||||
/* 8888 RGBx */
|
|
||||||
intel_gttmap_InitPointers_xRGB8888(rb);
|
|
||||||
} else {
|
|
||||||
intel_gttmap_InitPointers_ARGB8888(rb);
|
intel_gttmap_InitPointers_ARGB8888(rb);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case MESA_FORMAT_Z16:
|
case MESA_FORMAT_Z16:
|
||||||
intel_gttmap_InitDepthPointers_z16(rb);
|
intel_gttmap_InitDepthPointers_z16(rb);
|
||||||
|
@ -659,7 +653,7 @@ intel_set_span_functions(struct intel_context *intel,
|
||||||
default:
|
default:
|
||||||
_mesa_problem(NULL,
|
_mesa_problem(NULL,
|
||||||
"Unexpected MesaFormat %d in intelSetSpanFunctions",
|
"Unexpected MesaFormat %d in intelSetSpanFunctions",
|
||||||
irb->texformat);
|
irb->Base.Format);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -668,7 +662,7 @@ intel_set_span_functions(struct intel_context *intel,
|
||||||
/* If in GEM mode, we need to do the tile address swizzling ourselves,
|
/* If in GEM mode, we need to do the tile address swizzling ourselves,
|
||||||
* instead of the fence registers handling it.
|
* instead of the fence registers handling it.
|
||||||
*/
|
*/
|
||||||
switch (irb->texformat) {
|
switch (irb->Base.Format) {
|
||||||
case MESA_FORMAT_RGB565:
|
case MESA_FORMAT_RGB565:
|
||||||
switch (tiling) {
|
switch (tiling) {
|
||||||
case I915_TILING_NONE:
|
case I915_TILING_NONE:
|
||||||
|
@ -726,22 +720,6 @@ intel_set_span_functions(struct intel_context *intel,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MESA_FORMAT_ARGB8888:
|
case MESA_FORMAT_ARGB8888:
|
||||||
if (rb->_BaseFormat == GL_RGB) {
|
|
||||||
/* XXX remove this code someday when we enable XRGB surfaces */
|
|
||||||
/* 8888 RGBx */
|
|
||||||
switch (tiling) {
|
|
||||||
case I915_TILING_NONE:
|
|
||||||
default:
|
|
||||||
intelInitPointers_xRGB8888(rb);
|
|
||||||
break;
|
|
||||||
case I915_TILING_X:
|
|
||||||
intel_XTile_InitPointers_xRGB8888(rb);
|
|
||||||
break;
|
|
||||||
case I915_TILING_Y:
|
|
||||||
intel_YTile_InitPointers_xRGB8888(rb);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* 8888 RGBA */
|
/* 8888 RGBA */
|
||||||
switch (tiling) {
|
switch (tiling) {
|
||||||
case I915_TILING_NONE:
|
case I915_TILING_NONE:
|
||||||
|
@ -755,7 +733,6 @@ intel_set_span_functions(struct intel_context *intel,
|
||||||
intel_YTile_InitPointers_ARGB8888(rb);
|
intel_YTile_InitPointers_ARGB8888(rb);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case MESA_FORMAT_Z16:
|
case MESA_FORMAT_Z16:
|
||||||
switch (tiling) {
|
switch (tiling) {
|
||||||
|
|
|
@ -50,8 +50,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
|
||||||
if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) {
|
if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) {
|
||||||
return MESA_FORMAT_RGB565;
|
return MESA_FORMAT_RGB565;
|
||||||
}
|
}
|
||||||
/* XXX use MESA_FORMAT_XRGB8888 someday */
|
return do32bpt ? MESA_FORMAT_XRGB8888 : MESA_FORMAT_RGB565;
|
||||||
return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565;
|
|
||||||
|
|
||||||
case GL_RGBA8:
|
case GL_RGBA8:
|
||||||
case GL_RGB10_A2:
|
case GL_RGB10_A2:
|
||||||
|
@ -70,8 +69,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
|
||||||
case GL_RGB10:
|
case GL_RGB10:
|
||||||
case GL_RGB12:
|
case GL_RGB12:
|
||||||
case GL_RGB16:
|
case GL_RGB16:
|
||||||
/* XXX use MESA_FORMAT_XRGB8888 someday */
|
return MESA_FORMAT_XRGB8888;
|
||||||
return MESA_FORMAT_ARGB8888;
|
|
||||||
|
|
||||||
case GL_RGB5:
|
case GL_RGB5:
|
||||||
case GL_RGB4:
|
case GL_RGB4:
|
||||||
|
|
|
@ -1163,7 +1163,11 @@ static int check_blnd(GLcontext *ctx, struct radeon_state_atom *atom)
|
||||||
count += 3;
|
count += 3;
|
||||||
|
|
||||||
if (context->radeon.radeonScreen->chip_family > CHIP_FAMILY_R600) {
|
if (context->radeon.radeonScreen->chip_family > CHIP_FAMILY_R600) {
|
||||||
for (ui = 0; ui < R700_MAX_RENDER_TARGETS; ui++) {
|
/* targets are enabled in r700SetRenderTarget but state
|
||||||
|
size is calculated before that. Until MRT's are done
|
||||||
|
hardcode target0 as enabled. */
|
||||||
|
count += 3;
|
||||||
|
for (ui = 1; ui < R700_MAX_RENDER_TARGETS; ui++) {
|
||||||
if (r700->render_target[ui].enabled)
|
if (r700->render_target[ui].enabled)
|
||||||
count += 3;
|
count += 3;
|
||||||
}
|
}
|
||||||
|
|
|
@ -564,10 +564,6 @@ _mesa_init_constants(GLcontext *ctx)
|
||||||
/* GL_ARB_draw_buffers */
|
/* GL_ARB_draw_buffers */
|
||||||
ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS;
|
ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS;
|
||||||
|
|
||||||
/* GL_OES_read_format */
|
|
||||||
ctx->Const.ColorReadFormat = GL_RGBA;
|
|
||||||
ctx->Const.ColorReadType = GL_UNSIGNED_BYTE;
|
|
||||||
|
|
||||||
#if FEATURE_EXT_framebuffer_object
|
#if FEATURE_EXT_framebuffer_object
|
||||||
ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS;
|
ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS;
|
||||||
ctx->Const.MaxRenderbufferSize = MAX_WIDTH;
|
ctx->Const.MaxRenderbufferSize = MAX_WIDTH;
|
||||||
|
|
|
@ -34,15 +34,20 @@
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
_mesa_Fogf(GLenum pname, GLfloat param)
|
_mesa_Fogf(GLenum pname, GLfloat param)
|
||||||
{
|
{
|
||||||
_mesa_Fogfv(pname, ¶m);
|
GLfloat fparam[4];
|
||||||
|
fparam[0] = param;
|
||||||
|
fparam[1] = fparam[2] = fparam[3] = 0.0F;
|
||||||
|
_mesa_Fogfv(pname, fparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
_mesa_Fogi(GLenum pname, GLint param )
|
_mesa_Fogi(GLenum pname, GLint param )
|
||||||
{
|
{
|
||||||
GLfloat fparam = (GLfloat) param;
|
GLfloat fparam[4];
|
||||||
_mesa_Fogfv(pname, &fparam);
|
fparam[0] = (GLfloat) param;
|
||||||
|
fparam[1] = fparam[2] = fparam[3] = 0.0F;
|
||||||
|
_mesa_Fogfv(pname, fparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -969,3 +969,29 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format)
|
||||||
/* OK */
|
/* OK */
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLenum
|
||||||
|
_mesa_get_color_read_format(GLcontext *ctx)
|
||||||
|
{
|
||||||
|
switch (ctx->ReadBuffer->_ColorReadBuffer->Format) {
|
||||||
|
case MESA_FORMAT_ARGB8888:
|
||||||
|
return GL_BGRA;
|
||||||
|
case MESA_FORMAT_RGB565:
|
||||||
|
return GL_BGR;
|
||||||
|
default:
|
||||||
|
return GL_RGBA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GLenum
|
||||||
|
_mesa_get_color_read_type(GLcontext *ctx)
|
||||||
|
{
|
||||||
|
switch (ctx->ReadBuffer->_ColorReadBuffer->Format) {
|
||||||
|
case MESA_FORMAT_ARGB8888:
|
||||||
|
return GL_UNSIGNED_BYTE;
|
||||||
|
case MESA_FORMAT_RGB565:
|
||||||
|
return GL_UNSIGNED_SHORT_5_6_5_REV;
|
||||||
|
default:
|
||||||
|
return GL_UNSIGNED_BYTE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -81,5 +81,10 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format);
|
||||||
extern GLboolean
|
extern GLboolean
|
||||||
_mesa_dest_buffer_exists(GLcontext *ctx, GLenum format);
|
_mesa_dest_buffer_exists(GLcontext *ctx, GLenum format);
|
||||||
|
|
||||||
|
extern GLenum
|
||||||
|
_mesa_get_color_read_type(GLcontext *ctx);
|
||||||
|
|
||||||
|
extern GLenum
|
||||||
|
_mesa_get_color_read_format(GLcontext *ctx);
|
||||||
|
|
||||||
#endif /* FRAMEBUFFER_H */
|
#endif /* FRAMEBUFFER_H */
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "mtypes.h"
|
#include "mtypes.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "texcompress.h"
|
#include "texcompress.h"
|
||||||
|
#include "framebuffer.h"
|
||||||
|
|
||||||
|
|
||||||
#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE )
|
#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE )
|
||||||
|
@ -1767,11 +1768,11 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
|
||||||
break;
|
break;
|
||||||
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
||||||
CHECK_EXT1(OES_read_format, "GetBooleanv");
|
CHECK_EXT1(OES_read_format, "GetBooleanv");
|
||||||
params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadType);
|
params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_type(ctx));
|
||||||
break;
|
break;
|
||||||
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
||||||
CHECK_EXT1(OES_read_format, "GetBooleanv");
|
CHECK_EXT1(OES_read_format, "GetBooleanv");
|
||||||
params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadFormat);
|
params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_format(ctx));
|
||||||
break;
|
break;
|
||||||
case GL_NUM_FRAGMENT_REGISTERS_ATI:
|
case GL_NUM_FRAGMENT_REGISTERS_ATI:
|
||||||
CHECK_EXT1(ATI_fragment_shader, "GetBooleanv");
|
CHECK_EXT1(ATI_fragment_shader, "GetBooleanv");
|
||||||
|
@ -3602,11 +3603,11 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
|
||||||
break;
|
break;
|
||||||
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
||||||
CHECK_EXT1(OES_read_format, "GetFloatv");
|
CHECK_EXT1(OES_read_format, "GetFloatv");
|
||||||
params[0] = (GLfloat)(ctx->Const.ColorReadType);
|
params[0] = (GLfloat)(_mesa_get_color_read_type(ctx));
|
||||||
break;
|
break;
|
||||||
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
||||||
CHECK_EXT1(OES_read_format, "GetFloatv");
|
CHECK_EXT1(OES_read_format, "GetFloatv");
|
||||||
params[0] = (GLfloat)(ctx->Const.ColorReadFormat);
|
params[0] = (GLfloat)(_mesa_get_color_read_format(ctx));
|
||||||
break;
|
break;
|
||||||
case GL_NUM_FRAGMENT_REGISTERS_ATI:
|
case GL_NUM_FRAGMENT_REGISTERS_ATI:
|
||||||
CHECK_EXT1(ATI_fragment_shader, "GetFloatv");
|
CHECK_EXT1(ATI_fragment_shader, "GetFloatv");
|
||||||
|
@ -5437,11 +5438,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
|
||||||
break;
|
break;
|
||||||
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
||||||
CHECK_EXT1(OES_read_format, "GetIntegerv");
|
CHECK_EXT1(OES_read_format, "GetIntegerv");
|
||||||
params[0] = ctx->Const.ColorReadType;
|
params[0] = _mesa_get_color_read_type(ctx);
|
||||||
break;
|
break;
|
||||||
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
||||||
CHECK_EXT1(OES_read_format, "GetIntegerv");
|
CHECK_EXT1(OES_read_format, "GetIntegerv");
|
||||||
params[0] = ctx->Const.ColorReadFormat;
|
params[0] = _mesa_get_color_read_format(ctx);
|
||||||
break;
|
break;
|
||||||
case GL_NUM_FRAGMENT_REGISTERS_ATI:
|
case GL_NUM_FRAGMENT_REGISTERS_ATI:
|
||||||
CHECK_EXT1(ATI_fragment_shader, "GetIntegerv");
|
CHECK_EXT1(ATI_fragment_shader, "GetIntegerv");
|
||||||
|
@ -7273,11 +7274,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
|
||||||
break;
|
break;
|
||||||
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
||||||
CHECK_EXT1(OES_read_format, "GetInteger64v");
|
CHECK_EXT1(OES_read_format, "GetInteger64v");
|
||||||
params[0] = (GLint64)(ctx->Const.ColorReadType);
|
params[0] = (GLint64)(_mesa_get_color_read_type(ctx));
|
||||||
break;
|
break;
|
||||||
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
||||||
CHECK_EXT1(OES_read_format, "GetInteger64v");
|
CHECK_EXT1(OES_read_format, "GetInteger64v");
|
||||||
params[0] = (GLint64)(ctx->Const.ColorReadFormat);
|
params[0] = (GLint64)(_mesa_get_color_read_format(ctx));
|
||||||
break;
|
break;
|
||||||
case GL_NUM_FRAGMENT_REGISTERS_ATI:
|
case GL_NUM_FRAGMENT_REGISTERS_ATI:
|
||||||
CHECK_EXT1(ATI_fragment_shader, "GetInteger64v");
|
CHECK_EXT1(ATI_fragment_shader, "GetInteger64v");
|
||||||
|
|
|
@ -942,9 +942,9 @@ StateVars = [
|
||||||
|
|
||||||
# GL_OES_read_format
|
# GL_OES_read_format
|
||||||
( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint,
|
( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint,
|
||||||
["ctx->Const.ColorReadType"], "", ["OES_read_format"] ),
|
["_mesa_get_color_read_type(ctx)"], "", ["OES_read_format"] ),
|
||||||
( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint,
|
( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint,
|
||||||
["ctx->Const.ColorReadFormat"], "", ["OES_read_format"] ),
|
["_mesa_get_color_read_format(ctx)"], "", ["OES_read_format"] ),
|
||||||
|
|
||||||
# GL_ATI_fragment_shader
|
# GL_ATI_fragment_shader
|
||||||
( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], "", ["ATI_fragment_shader"] ),
|
( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], "", ["ATI_fragment_shader"] ),
|
||||||
|
@ -1159,6 +1159,7 @@ def EmitHeader():
|
||||||
#include "mtypes.h"
|
#include "mtypes.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "texcompress.h"
|
#include "texcompress.h"
|
||||||
|
#include "framebuffer.h"
|
||||||
|
|
||||||
|
|
||||||
#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE )
|
#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE )
|
||||||
|
|
|
@ -206,7 +206,10 @@ _mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params)
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
_mesa_Lightf( GLenum light, GLenum pname, GLfloat param )
|
_mesa_Lightf( GLenum light, GLenum pname, GLfloat param )
|
||||||
{
|
{
|
||||||
_mesa_Lightfv( light, pname, ¶m );
|
GLfloat fparam[4];
|
||||||
|
fparam[0] = param;
|
||||||
|
fparam[1] = fparam[2] = fparam[3] = 0.0F;
|
||||||
|
_mesa_Lightfv( light, pname, fparam );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -285,7 +288,10 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
_mesa_Lighti( GLenum light, GLenum pname, GLint param )
|
_mesa_Lighti( GLenum light, GLenum pname, GLint param )
|
||||||
{
|
{
|
||||||
_mesa_Lightiv( light, pname, ¶m );
|
GLint iparam[4];
|
||||||
|
iparam[0] = param;
|
||||||
|
iparam[1] = iparam[2] = iparam[3] = 0;
|
||||||
|
_mesa_Lightiv( light, pname, iparam );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -537,14 +543,20 @@ _mesa_LightModeliv( GLenum pname, const GLint *params )
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
_mesa_LightModeli( GLenum pname, GLint param )
|
_mesa_LightModeli( GLenum pname, GLint param )
|
||||||
{
|
{
|
||||||
_mesa_LightModeliv( pname, ¶m );
|
GLint iparam[4];
|
||||||
|
iparam[0] = param;
|
||||||
|
iparam[1] = iparam[2] = iparam[3] = 0;
|
||||||
|
_mesa_LightModeliv( pname, iparam );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
_mesa_LightModelf( GLenum pname, GLfloat param )
|
_mesa_LightModelf( GLenum pname, GLfloat param )
|
||||||
{
|
{
|
||||||
_mesa_LightModelfv( pname, ¶m );
|
GLfloat fparam[4];
|
||||||
|
fparam[0] = param;
|
||||||
|
fparam[1] = fparam[2] = fparam[3] = 0.0F;
|
||||||
|
_mesa_LightModelfv( pname, fparam );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2356,9 +2356,6 @@ struct gl_constants
|
||||||
|
|
||||||
GLuint MaxDrawBuffers; /**< GL_ARB_draw_buffers */
|
GLuint MaxDrawBuffers; /**< GL_ARB_draw_buffers */
|
||||||
|
|
||||||
GLenum ColorReadFormat; /**< GL_OES_read_format */
|
|
||||||
GLenum ColorReadType; /**< GL_OES_read_format */
|
|
||||||
|
|
||||||
GLuint MaxColorAttachments; /**< GL_EXT_framebuffer_object */
|
GLuint MaxColorAttachments; /**< GL_EXT_framebuffer_object */
|
||||||
GLuint MaxRenderbufferSize; /**< GL_EXT_framebuffer_object */
|
GLuint MaxRenderbufferSize; /**< GL_EXT_framebuffer_object */
|
||||||
GLuint MaxSamples; /**< GL_ARB_framebuffer_object */
|
GLuint MaxSamples; /**< GL_ARB_framebuffer_object */
|
||||||
|
|
|
@ -69,8 +69,10 @@ _mesa_PointSize( GLfloat size )
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
_mesa_PointParameteri( GLenum pname, GLint param )
|
_mesa_PointParameteri( GLenum pname, GLint param )
|
||||||
{
|
{
|
||||||
const GLfloat value = (GLfloat) param;
|
GLfloat p[3];
|
||||||
_mesa_PointParameterfv(pname, &value);
|
p[0] = (GLfloat) param;
|
||||||
|
p[1] = p[2] = 0.0F;
|
||||||
|
_mesa_PointParameterfv(pname, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +92,10 @@ _mesa_PointParameteriv( GLenum pname, const GLint *params )
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
_mesa_PointParameterf( GLenum pname, GLfloat param)
|
_mesa_PointParameterf( GLenum pname, GLfloat param)
|
||||||
{
|
{
|
||||||
_mesa_PointParameterfv(pname, ¶m);
|
GLfloat p[3];
|
||||||
|
p[0] = param;
|
||||||
|
p[1] = p[2] = 0.0F;
|
||||||
|
_mesa_PointParameterfv(pname, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -186,8 +186,10 @@ _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
|
||||||
static void GLAPIENTRY
|
static void GLAPIENTRY
|
||||||
_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
|
_mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
|
||||||
{
|
{
|
||||||
GLfloat p = (GLfloat) param;
|
GLfloat p[4];
|
||||||
_mesa_TexGenfv( coord, pname, &p );
|
p[0] = (GLfloat) param;
|
||||||
|
p[1] = p[2] = p[3] = 0.0F;
|
||||||
|
_mesa_TexGenfv( coord, pname, p );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -415,7 +415,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx,
|
||||||
/* Detect cases where the application set the base level to an invalid
|
/* Detect cases where the application set the base level to an invalid
|
||||||
* value.
|
* value.
|
||||||
*/
|
*/
|
||||||
if ((baseLevel < 0) || (baseLevel > MAX_TEXTURE_LEVELS)) {
|
if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS)) {
|
||||||
char s[100];
|
char s[100];
|
||||||
_mesa_sprintf(s, "base level = %d is invalid", baseLevel);
|
_mesa_sprintf(s, "base level = %d is invalid", baseLevel);
|
||||||
incomplete(t, s);
|
incomplete(t, s);
|
||||||
|
|
|
@ -595,8 +595,10 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
|
||||||
case GL_DEPTH_TEXTURE_MODE_ARB:
|
case GL_DEPTH_TEXTURE_MODE_ARB:
|
||||||
{
|
{
|
||||||
/* convert float param to int */
|
/* convert float param to int */
|
||||||
GLint p = (GLint) params[0];
|
GLint p[4];
|
||||||
need_update = set_tex_parameteri(ctx, texObj, pname, &p);
|
p[0] = (GLint) params[0];
|
||||||
|
p[1] = p[2] = p[3] = 0;
|
||||||
|
need_update = set_tex_parameteri(ctx, texObj, pname, p);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -645,14 +647,21 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
|
||||||
case GL_TEXTURE_LOD_BIAS:
|
case GL_TEXTURE_LOD_BIAS:
|
||||||
case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
|
case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
|
||||||
{
|
{
|
||||||
GLfloat fparam = (GLfloat) param;
|
GLfloat fparam[4];
|
||||||
|
fparam[0] = (GLfloat) param;
|
||||||
|
fparam[1] = fparam[2] = fparam[3] = 0.0F;
|
||||||
/* convert int param to float */
|
/* convert int param to float */
|
||||||
need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
|
need_update = set_tex_parameterf(ctx, texObj, pname, fparam);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* this will generate an error if pname is illegal */
|
/* this will generate an error if pname is illegal */
|
||||||
need_update = set_tex_parameteri(ctx, texObj, pname, ¶m);
|
{
|
||||||
|
GLint iparam[4];
|
||||||
|
iparam[0] = param;
|
||||||
|
iparam[1] = iparam[2] = iparam[3] = 0;
|
||||||
|
need_update = set_tex_parameteri(ctx, texObj, pname, iparam);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->Driver.TexParameter && need_update) {
|
if (ctx->Driver.TexParameter && need_update) {
|
||||||
|
@ -694,8 +703,10 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
|
||||||
case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
|
case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
|
||||||
{
|
{
|
||||||
/* convert int param to float */
|
/* convert int param to float */
|
||||||
GLfloat fparam = (GLfloat) params[0];
|
GLfloat fparams[4];
|
||||||
need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
|
fparams[0] = (GLfloat) params[0];
|
||||||
|
fparams[1] = fparams[2] = fparams[3] = 0.0F;
|
||||||
|
need_update = set_tex_parameterf(ctx, texObj, pname, fparams);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -217,6 +217,12 @@ MatchInstruction(const GLubyte *token)
|
||||||
const struct instruction_pattern *inst;
|
const struct instruction_pattern *inst;
|
||||||
struct instruction_pattern result;
|
struct instruction_pattern result;
|
||||||
|
|
||||||
|
result.name = NULL;
|
||||||
|
result.opcode = MAX_OPCODE; /* i.e. invalid instruction */
|
||||||
|
result.inputs = 0;
|
||||||
|
result.outputs = 0;
|
||||||
|
result.suffixes = 0;
|
||||||
|
|
||||||
for (inst = Instructions; inst->name; inst++) {
|
for (inst = Instructions; inst->name; inst++) {
|
||||||
if (_mesa_strncmp((const char *) token, inst->name, 3) == 0) {
|
if (_mesa_strncmp((const char *) token, inst->name, 3) == 0) {
|
||||||
/* matched! */
|
/* matched! */
|
||||||
|
@ -247,7 +253,7 @@ MatchInstruction(const GLubyte *token)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.opcode = MAX_OPCODE; /* i.e. invalid instruction */
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -500,7 +500,7 @@ GLfloat *
|
||||||
_mesa_lookup_parameter_value(const struct gl_program_parameter_list *paramList,
|
_mesa_lookup_parameter_value(const struct gl_program_parameter_list *paramList,
|
||||||
GLsizei nameLen, const char *name)
|
GLsizei nameLen, const char *name)
|
||||||
{
|
{
|
||||||
GLuint i = _mesa_lookup_parameter_index(paramList, nameLen, name);
|
GLint i = _mesa_lookup_parameter_index(paramList, nameLen, name);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
|
|
|
@ -806,9 +806,17 @@ _mesa_find_free_register(const struct gl_program *prog, GLuint regFile)
|
||||||
const struct prog_instruction *inst = prog->Instructions + i;
|
const struct prog_instruction *inst = prog->Instructions + i;
|
||||||
const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
|
const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
|
||||||
|
|
||||||
|
/* check dst reg first */
|
||||||
|
if (inst->DstReg.File == regFile) {
|
||||||
|
used[inst->DstReg.Index] = GL_TRUE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* check src regs otherwise */
|
||||||
for (k = 0; k < n; k++) {
|
for (k = 0; k < n; k++) {
|
||||||
if (inst->SrcReg[k].File == regFile) {
|
if (inst->SrcReg[k].File == regFile) {
|
||||||
used[inst->SrcReg[k].Index] = GL_TRUE;
|
used[inst->SrcReg[k].Index] = GL_TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,9 +528,6 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type)
|
||||||
/* look for instructions which write to the varying vars identified above */
|
/* look for instructions which write to the varying vars identified above */
|
||||||
for (i = 0; i < prog->NumInstructions; i++) {
|
for (i = 0; i < prog->NumInstructions; i++) {
|
||||||
struct prog_instruction *inst = prog->Instructions + i;
|
struct prog_instruction *inst = prog->Instructions + i;
|
||||||
const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
|
|
||||||
GLuint j;
|
|
||||||
for (j = 0; j < numSrc; j++) {
|
|
||||||
if (inst->DstReg.File == type &&
|
if (inst->DstReg.File == type &&
|
||||||
outputMap[inst->DstReg.Index] >= 0) {
|
outputMap[inst->DstReg.Index] >= 0) {
|
||||||
/* change inst to write to the temp reg, instead of the varying */
|
/* change inst to write to the temp reg, instead of the varying */
|
||||||
|
@ -538,7 +535,6 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type)
|
||||||
inst->DstReg.Index = outputMap[inst->DstReg.Index];
|
inst->DstReg.Index = outputMap[inst->DstReg.Index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* insert new instructions to copy the temp vars to the varying vars */
|
/* insert new instructions to copy the temp vars to the varying vars */
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,7 +127,6 @@ typedef struct slang_operation_
|
||||||
* indicate such. num_children indicates number of elements.
|
* indicate such. num_children indicates number of elements.
|
||||||
*/
|
*/
|
||||||
GLboolean array_constructor;
|
GLboolean array_constructor;
|
||||||
double x;
|
|
||||||
} slang_operation;
|
} slang_operation;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -84,10 +84,11 @@ _slang_lookup_constant(const char *name)
|
||||||
for (i = 0; info[i].Name; i++) {
|
for (i = 0; info[i].Name; i++) {
|
||||||
if (strcmp(info[i].Name, name) == 0) {
|
if (strcmp(info[i].Name, name) == 0) {
|
||||||
/* found */
|
/* found */
|
||||||
GLint value = -1;
|
GLint values[16];
|
||||||
_mesa_GetIntegerv(info[i].Token, &value);
|
values[0] = -1;
|
||||||
ASSERT(value >= 0); /* sanity check that glGetFloatv worked */
|
_mesa_GetIntegerv(info[i].Token, values);
|
||||||
return value;
|
ASSERT(values[0] >= 0); /* sanity check that glGetFloatv worked */
|
||||||
|
return values[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -191,7 +191,6 @@ STATETRACKER_SOURCES = \
|
||||||
state_tracker/st_cb_bufferobjects.c \
|
state_tracker/st_cb_bufferobjects.c \
|
||||||
state_tracker/st_cb_clear.c \
|
state_tracker/st_cb_clear.c \
|
||||||
state_tracker/st_cb_flush.c \
|
state_tracker/st_cb_flush.c \
|
||||||
state_tracker/st_cb_get.c \
|
|
||||||
state_tracker/st_cb_drawpixels.c \
|
state_tracker/st_cb_drawpixels.c \
|
||||||
state_tracker/st_cb_fbo.c \
|
state_tracker/st_cb_fbo.c \
|
||||||
state_tracker/st_cb_feedback.c \
|
state_tracker/st_cb_feedback.c \
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include "sparc_matrix.h"
|
#include "sparc_matrix.h"
|
||||||
|
|
||||||
#if defined(SVR4) || defined(__SVR4) || defined(__svr4__)
|
#if defined(SVR4) || defined(__SVR4) || defined(__svr4__) || defined(__arch64__)
|
||||||
/* Solaris requires this for 64-bit. */
|
/* Solaris requires this for 64-bit. */
|
||||||
.register %g2, #scratch
|
.register %g2, #scratch
|
||||||
.register %g3, #scratch
|
.register %g3, #scratch
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the
|
|
||||||
* "Software"), to deal in the Software without restriction, including
|
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice (including the
|
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
|
||||||
* of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
|
||||||
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
|
|
||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* glGet functions
|
|
||||||
*
|
|
||||||
* \author Brian Paul
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "main/imports.h"
|
|
||||||
#include "main/context.h"
|
|
||||||
|
|
||||||
#include "pipe/p_defines.h"
|
|
||||||
|
|
||||||
#include "st_cb_fbo.h"
|
|
||||||
#include "st_cb_get.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Examine the current color read buffer format to determine
|
|
||||||
* which GL pixel format/type combo is the best match.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
get_preferred_read_format_type(GLcontext *ctx, GLint *format, GLint *type)
|
|
||||||
{
|
|
||||||
struct gl_framebuffer *fb = ctx->ReadBuffer;
|
|
||||||
struct st_renderbuffer *strb = st_renderbuffer(fb->_ColorReadBuffer);
|
|
||||||
|
|
||||||
/* defaults */
|
|
||||||
*format = ctx->Const.ColorReadFormat;
|
|
||||||
*type = ctx->Const.ColorReadType;
|
|
||||||
|
|
||||||
if (strb) {
|
|
||||||
/* XXX could add more cases here... */
|
|
||||||
if (strb->format == PIPE_FORMAT_A8R8G8B8_UNORM) {
|
|
||||||
*format = GL_BGRA;
|
|
||||||
if (_mesa_little_endian())
|
|
||||||
*type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
|
||||||
else
|
|
||||||
*type = GL_UNSIGNED_INT_8_8_8_8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We only intercept the OES preferred ReadPixels format/type.
|
|
||||||
* Everything else goes to the default _mesa_GetIntegerv.
|
|
||||||
*/
|
|
||||||
static GLboolean
|
|
||||||
st_GetIntegerv(GLcontext *ctx, GLenum pname, GLint *params)
|
|
||||||
{
|
|
||||||
GLint dummy;
|
|
||||||
|
|
||||||
switch (pname) {
|
|
||||||
case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
|
|
||||||
get_preferred_read_format_type(ctx, &dummy, params);
|
|
||||||
return GL_TRUE;
|
|
||||||
case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
|
|
||||||
get_preferred_read_format_type(ctx, params, &dummy);
|
|
||||||
return GL_TRUE;
|
|
||||||
default:
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void st_init_get_functions(struct dd_function_table *functions)
|
|
||||||
{
|
|
||||||
functions->GetIntegerv = st_GetIntegerv;
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
/**************************************************************************
|
|
||||||
*
|
|
||||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the
|
|
||||||
* "Software"), to deal in the Software without restriction, including
|
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sub license, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice (including the
|
|
||||||
* next paragraph) shall be included in all copies or substantial portions
|
|
||||||
* of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
|
||||||
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
|
|
||||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ST_CB_GET_H
|
|
||||||
#define ST_CB_GET_H
|
|
||||||
|
|
||||||
|
|
||||||
extern void
|
|
||||||
st_init_get_functions(struct dd_function_table *functions);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -51,7 +51,6 @@
|
||||||
#include "st_cb_drawtex.h"
|
#include "st_cb_drawtex.h"
|
||||||
#endif
|
#endif
|
||||||
#include "st_cb_fbo.h"
|
#include "st_cb_fbo.h"
|
||||||
#include "st_cb_get.h"
|
|
||||||
#if FEATURE_feedback
|
#if FEATURE_feedback
|
||||||
#include "st_cb_feedback.h"
|
#include "st_cb_feedback.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -331,7 +330,6 @@ void st_init_driver_functions(struct dd_function_table *functions)
|
||||||
st_init_rasterpos_functions(functions);
|
st_init_rasterpos_functions(functions);
|
||||||
#endif
|
#endif
|
||||||
st_init_fbo_functions(functions);
|
st_init_fbo_functions(functions);
|
||||||
st_init_get_functions(functions);
|
|
||||||
#if FEATURE_feedback
|
#if FEATURE_feedback
|
||||||
st_init_feedback_functions(functions);
|
st_init_feedback_functions(functions);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,17 +35,20 @@
|
||||||
|
|
||||||
static void clear_active_eval1( struct vbo_exec_context *exec, GLuint attr )
|
static void clear_active_eval1( struct vbo_exec_context *exec, GLuint attr )
|
||||||
{
|
{
|
||||||
|
assert(attr < Elements(exec->eval.map1));
|
||||||
exec->eval.map1[attr].map = NULL;
|
exec->eval.map1[attr].map = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_active_eval2( struct vbo_exec_context *exec, GLuint attr )
|
static void clear_active_eval2( struct vbo_exec_context *exec, GLuint attr )
|
||||||
{
|
{
|
||||||
|
assert(attr < Elements(exec->eval.map2));
|
||||||
exec->eval.map2[attr].map = NULL;
|
exec->eval.map2[attr].map = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint dim,
|
static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint dim,
|
||||||
struct gl_1d_map *map )
|
struct gl_1d_map *map )
|
||||||
{
|
{
|
||||||
|
assert(attr < Elements(exec->eval.map1));
|
||||||
if (!exec->eval.map1[attr].map) {
|
if (!exec->eval.map1[attr].map) {
|
||||||
exec->eval.map1[attr].map = map;
|
exec->eval.map1[attr].map = map;
|
||||||
exec->eval.map1[attr].sz = dim;
|
exec->eval.map1[attr].sz = dim;
|
||||||
|
@ -55,6 +58,7 @@ static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint
|
||||||
static void set_active_eval2( struct vbo_exec_context *exec, GLuint attr, GLuint dim,
|
static void set_active_eval2( struct vbo_exec_context *exec, GLuint attr, GLuint dim,
|
||||||
struct gl_2d_map *map )
|
struct gl_2d_map *map )
|
||||||
{
|
{
|
||||||
|
assert(attr < Elements(exec->eval.map2));
|
||||||
if (!exec->eval.map2[attr].map) {
|
if (!exec->eval.map2[attr].map) {
|
||||||
exec->eval.map2[attr].map = map;
|
exec->eval.map2[attr].map = map;
|
||||||
exec->eval.map2[attr].sz = dim;
|
exec->eval.map2[attr].sz = dim;
|
||||||
|
@ -73,18 +77,6 @@ void vbo_exec_eval_update( struct vbo_exec_context *exec )
|
||||||
clear_active_eval2( exec, attr );
|
clear_active_eval2( exec, attr );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* _NEW_PROGRAM */
|
|
||||||
if (ctx->VertexProgram._Enabled) {
|
|
||||||
for (attr = 0; attr < VBO_ATTRIB_FIRST_MATERIAL; attr++) {
|
|
||||||
/* _NEW_EVAL */
|
|
||||||
if (ctx->Eval.Map1Attrib[attr])
|
|
||||||
set_active_eval1( exec, attr, 4, &ctx->EvalMap.Map1Attrib[attr] );
|
|
||||||
|
|
||||||
if (ctx->Eval.Map2Attrib[attr])
|
|
||||||
set_active_eval2( exec, attr, 4, &ctx->EvalMap.Map2Attrib[attr] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->Eval.Map1Color4)
|
if (ctx->Eval.Map1Color4)
|
||||||
set_active_eval1( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 );
|
set_active_eval1( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 );
|
||||||
|
|
||||||
|
@ -125,6 +117,23 @@ void vbo_exec_eval_update( struct vbo_exec_context *exec )
|
||||||
else if (ctx->Eval.Map2Vertex3)
|
else if (ctx->Eval.Map2Vertex3)
|
||||||
set_active_eval2( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 );
|
set_active_eval2( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 );
|
||||||
|
|
||||||
|
/* _NEW_PROGRAM */
|
||||||
|
if (ctx->VertexProgram._Enabled) {
|
||||||
|
/* These are the 16 evaluators which GL_NV_vertex_program defines.
|
||||||
|
* They alias and override the conventional vertex attributs.
|
||||||
|
*/
|
||||||
|
for (attr = 0; attr < 16; attr++) {
|
||||||
|
/* _NEW_EVAL */
|
||||||
|
assert(attr < Elements(ctx->Eval.Map1Attrib));
|
||||||
|
if (ctx->Eval.Map1Attrib[attr])
|
||||||
|
set_active_eval1( exec, attr, 4, &ctx->EvalMap.Map1Attrib[attr] );
|
||||||
|
|
||||||
|
assert(attr < Elements(ctx->Eval.Map2Attrib));
|
||||||
|
if (ctx->Eval.Map2Attrib[attr])
|
||||||
|
set_active_eval2( exec, attr, 4, &ctx->EvalMap.Map2Attrib[attr] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exec->eval.recalculate_maps = 0;
|
exec->eval.recalculate_maps = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue