mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
Merge commit 'origin/mesa_7_7_branch'
This commit is contained in:
commit
5173d14cb5
44 changed files with 179 additions and 102 deletions
|
|
@ -369,7 +369,7 @@ static void keyPress(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(0);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,6 +220,12 @@ static void load_test_file (const char *filename)
|
|||
|
||||
fseek (f, 0, SEEK_END);
|
||||
size = ftell (f);
|
||||
|
||||
if (size == -1) {
|
||||
fclose (f);
|
||||
return;
|
||||
}
|
||||
|
||||
fseek (f, 0, SEEK_SET);
|
||||
|
||||
code = (char *) (malloc (size));
|
||||
|
|
|
|||
|
|
@ -3516,7 +3516,7 @@ check_functions( const char *extensions )
|
|||
struct name_test_pair *entry;
|
||||
int failures = 0, passes = 0, untested = 0;
|
||||
int totalFail = 0, totalPass = 0, totalUntested = 0, totalUnsupported = 0;
|
||||
int doTests;
|
||||
int doTests = 0;
|
||||
const char *version = (const char *) glGetString(GL_VERSION);
|
||||
|
||||
/* The functions list will have "real" entries (consisting of
|
||||
|
|
|
|||
|
|
@ -424,13 +424,13 @@ main(int argc, char *argv[])
|
|||
{
|
||||
const char *dpyName = XDisplayName(NULL);
|
||||
|
||||
struct window *h0, *h1, *h2, *h3;
|
||||
struct window *h0;
|
||||
|
||||
/* four windows and contexts sharing display lists and texture objects */
|
||||
h0 = AddWindow(dpyName, 10, 10, NULL);
|
||||
h1 = AddWindow(dpyName, 330, 10, h0);
|
||||
h2 = AddWindow(dpyName, 10, 350, h0);
|
||||
h3 = AddWindow(dpyName, 330, 350, h0);
|
||||
(void) AddWindow(dpyName, 330, 10, h0);
|
||||
(void) AddWindow(dpyName, 10, 350, h0);
|
||||
(void) AddWindow(dpyName, 330, 350, h0);
|
||||
|
||||
InitGLstuff(h0);
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
|||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
|
|
|||
|
|
@ -130,6 +130,12 @@ static rawImageRec *RawImageOpen(const char *fileName)
|
|||
if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL ||
|
||||
raw->tmpB == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
free(raw->tmp);
|
||||
free(raw->tmpR);
|
||||
free(raw->tmpG);
|
||||
free(raw->tmpB);
|
||||
free(raw->tmpA);
|
||||
free(raw);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -139,6 +145,14 @@ static rawImageRec *RawImageOpen(const char *fileName)
|
|||
raw->rowSize = (GLint *)malloc(x);
|
||||
if (raw->rowStart == NULL || raw->rowSize == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
free(raw->tmp);
|
||||
free(raw->tmpR);
|
||||
free(raw->tmpG);
|
||||
free(raw->tmpB);
|
||||
free(raw->tmpA);
|
||||
free(raw->rowStart);
|
||||
free(raw->rowSize);
|
||||
free(raw);
|
||||
return NULL;
|
||||
}
|
||||
raw->rleEnd = 512 + (2 * x);
|
||||
|
|
@ -216,6 +230,7 @@ static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final)
|
|||
final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4);
|
||||
if (final->data == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ptr = final->data;
|
||||
|
|
|
|||
|
|
@ -99,9 +99,11 @@ static void Init( void )
|
|||
sz = (GLuint) fread(buf, 1, sizeof(buf), f);
|
||||
if (!feof(f)) {
|
||||
fprintf(stderr, "file too long\n");
|
||||
fclose(f);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
fprintf(stderr, "%.*s\n", sz, buf);
|
||||
|
||||
if (strncmp( buf, "!!VP", 4 ) == 0) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
void main() {
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_PointSize = 10 * gl_Color.x;
|
||||
gl_PointSize = 10.0 * gl_Color.x;
|
||||
gl_Position = gl_Vertex;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ setup_ipc(void)
|
|||
|
||||
printf("Waiting for connection from another 'corender'\n");
|
||||
Sock = AcceptConnection(k);
|
||||
assert(Sock != -1);
|
||||
|
||||
printf("Got connection, sending windowID\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -426,8 +426,6 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits)
|
|||
GLXFBConfig *configs = NULL;
|
||||
int nConfigs;
|
||||
|
||||
if (!visinfo)
|
||||
configs = glXChooseFBConfig(dpy, scrnum, fbAttribSingle, &nConfigs);
|
||||
if (!visinfo)
|
||||
configs = glXChooseFBConfig(dpy, scrnum, fbAttribDouble, &nConfigs);
|
||||
|
||||
|
|
@ -964,8 +962,10 @@ print_fbconfig_info(Display *dpy, int scrnum, InfoMode mode)
|
|||
/* get list of all fbconfigs on this screen */
|
||||
fbconfigs = glXGetFBConfigs(dpy, scrnum, &numFBConfigs);
|
||||
|
||||
if (numFBConfigs == 0)
|
||||
if (numFBConfigs == 0) {
|
||||
XFree(fbconfigs);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("%d GLXFBConfigs:\n", numFBConfigs);
|
||||
if (mode == Normal)
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
|
|||
|
||||
if (0 == nConfigs || !fbConfigs) {
|
||||
printf("Error: glxChooseFBConfig failed\n");
|
||||
XFree(fbConfigs);
|
||||
XCloseDisplay(dpy);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
|
|||
fbConfigs = ChooseFBConfig(dpy, screen, fbAttribs[attempt], &nConfigs);
|
||||
if (nConfigs==0 || !fbConfigs) {
|
||||
printf("Note: glXChooseFBConfig(%s) failed\n", fbString[attempt]);
|
||||
XFree(fbConfigs);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ PrintConfigs(Display *dpy, int screen, Bool horizFormat)
|
|||
fbConfigs = GetAllFBConfigs(dpy, screen, &nConfigs);
|
||||
if (!nConfigs || !fbConfigs) {
|
||||
printf("Error: glxGetFBConfigs failed\n");
|
||||
XFree(fbConfigs);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@ main(int argc, char *argv[])
|
|||
const char *dpyName = XDisplayName(NULL);
|
||||
pthread_t t0, t1, t2, t3;
|
||||
struct thread_init_arg tia0, tia1, tia2, tia3;
|
||||
struct window *h0, *h1, *h2, *h3;
|
||||
struct window *h0;
|
||||
|
||||
XInitThreads();
|
||||
|
||||
|
|
@ -462,9 +462,9 @@ main(int argc, char *argv[])
|
|||
|
||||
/* four windows and contexts sharing display lists and texture objects */
|
||||
h0 = AddWindow(gDpy, dpyName, 10, 10, gCtx);
|
||||
h1 = AddWindow(gDpy, dpyName, 330, 10, gCtx);
|
||||
h2 = AddWindow(gDpy, dpyName, 10, 350, gCtx);
|
||||
h3 = AddWindow(gDpy, dpyName, 330, 350, gCtx);
|
||||
(void) AddWindow(gDpy, dpyName, 330, 10, gCtx);
|
||||
(void) AddWindow(gDpy, dpyName, 10, 350, gCtx);
|
||||
(void) AddWindow(gDpy, dpyName, 330, 350, gCtx);
|
||||
|
||||
if (!glXMakeCurrent(gDpy, h0->Win, gCtx)) {
|
||||
Error(dpyName, "glXMakeCurrent failed for init thread.");
|
||||
|
|
|
|||
|
|
@ -192,7 +192,8 @@ draw_print_arrays(struct draw_context *draw, uint prim, int start, uint count)
|
|||
prim, start, count);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
uint ii, j;
|
||||
uint ii = 0;
|
||||
uint j;
|
||||
|
||||
if (draw->pt.user.elts) {
|
||||
/* indexed arrays */
|
||||
|
|
|
|||
|
|
@ -302,7 +302,10 @@ util_unpack_color_ub(enum pipe_format format, const void *src,
|
|||
static INLINE void
|
||||
util_pack_color(const float rgba[4], enum pipe_format format, void *dest)
|
||||
{
|
||||
ubyte r, g, b, a;
|
||||
ubyte r = 0;
|
||||
ubyte g = 0;
|
||||
ubyte b = 0;
|
||||
ubyte a = 0;
|
||||
|
||||
if (pf_size_x(format) <= 8) {
|
||||
/* format uses 8-bit components or less */
|
||||
|
|
|
|||
|
|
@ -851,6 +851,7 @@ static boolean i915_debug_packet( struct debug_stream *stream )
|
|||
default:
|
||||
return debug(stream, "", 0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -51,13 +51,7 @@ LIBRARY_INCLUDES = \
|
|||
-I$(TOP)/src/gallium/drivers/svga/include
|
||||
|
||||
LIBRARY_DEFINES = \
|
||||
-std=gnu99 -fvisibility=hidden \
|
||||
-DHAVE_STDINT_H -DHAVE_SYS_TYPES_H
|
||||
|
||||
CC = gcc -fvisibility=hidden -msse -msse2
|
||||
|
||||
# Set the gnu99 standard to enable anonymous structs in vmware headers.
|
||||
#
|
||||
CFLAGS = -Wall -Wmissing-prototypes -std=gnu99 -ffast-math \
|
||||
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS)
|
||||
|
||||
include ../../Makefile.template
|
||||
|
|
|
|||
|
|
@ -88,11 +88,11 @@ drm_get_device_id(struct drm_device *device)
|
|||
}
|
||||
|
||||
ret = fgets(path, sizeof( path ), file);
|
||||
fclose(file);
|
||||
if (!ret)
|
||||
return;
|
||||
|
||||
sscanf(path, "%x", &device->deviceID);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -151,11 +151,13 @@ render_filter_to_gallium(int xrender_filter, int *out_filter)
|
|||
case PictFilterBest:
|
||||
*out_filter = PIPE_TEX_FILTER_LINEAR;
|
||||
break;
|
||||
default:
|
||||
debug_printf("Unkown xrender filter\n");
|
||||
case PictFilterConvolution:
|
||||
*out_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
return FALSE;
|
||||
default:
|
||||
debug_printf("Unknown xrender filter\n");
|
||||
*out_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
@ -565,6 +567,8 @@ boolean xorg_solid_bind_state(struct exa_context *exa,
|
|||
renderer_bind_viewport(exa->renderer, pixmap);
|
||||
renderer_bind_rasterizer(exa->renderer);
|
||||
bind_blend_state(exa, PictOpSrc, NULL, NULL, NULL);
|
||||
cso_set_samplers(exa->renderer->cso, 0, NULL);
|
||||
cso_set_sampler_textures(exa->renderer->cso, 0, NULL);
|
||||
setup_constant_buffers(exa, pixmap);
|
||||
|
||||
shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits);
|
||||
|
|
|
|||
|
|
@ -230,6 +230,11 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src,
|
|||
if (!priv || !priv->tex)
|
||||
return FALSE;
|
||||
|
||||
/* make sure that any pending operations are flushed to hardware */
|
||||
if (exa->pipe->is_texture_referenced(exa->pipe, priv->tex, 0, 0) &
|
||||
(PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE))
|
||||
xorg_exa_flush(exa, 0, NULL);
|
||||
|
||||
transfer = exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
|
||||
PIPE_TRANSFER_WRITE, x, y, w, h);
|
||||
if (!transfer)
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
|
|||
int x, y, w, h;
|
||||
struct exa_pixmap_priv *dst = exaGetPixmapDriverPrivate(pPixmap);
|
||||
|
||||
if (!dst->tex) {
|
||||
if (dst && !dst->tex) {
|
||||
xorg_exa_set_shared_usage(pPixmap);
|
||||
pScrn->pScreen->ModifyPixmapHeader(pPixmap, 0, 0, 0, 0, 0, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,20 +28,8 @@ LIBRARY_INCLUDES = \
|
|||
$(shell pkg-config libdrm --cflags-only-I)
|
||||
|
||||
LIBRARY_DEFINES = \
|
||||
-std=gnu99 -fvisibility=hidden \
|
||||
-DHAVE_STDINT_H -D_FILE_OFFSET_BITS=64 \
|
||||
$(shell pkg-config libdrm --cflags-only-other)
|
||||
|
||||
CC = gcc -fvisibility=hidden -msse -msse2
|
||||
|
||||
# Set the gnu99 standard to enable anonymous structs in vmware headers.
|
||||
#
|
||||
CFLAGS = -Wall -Wmissing-prototypes -std=gnu99 -ffast-math \
|
||||
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS)
|
||||
|
||||
include ../../../../Makefile.template
|
||||
|
||||
|
||||
symlinks:
|
||||
|
||||
|
||||
include depend
|
||||
|
|
|
|||
|
|
@ -331,6 +331,7 @@ vmw_ioctl_region_create(struct vmw_winsys_screen *vws, uint32_t size)
|
|||
return region;
|
||||
|
||||
out_err1:
|
||||
FREE(region);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst,
|
|||
struct pipe_reference *dst_ref;
|
||||
struct vmw_svga_winsys_surface *dst = *pdst;
|
||||
|
||||
if(*pdst == src || pdst == NULL)
|
||||
if(pdst == NULL || *pdst == src)
|
||||
return;
|
||||
|
||||
src_ref = src ? &src->refcnt : NULL;
|
||||
|
|
|
|||
|
|
@ -284,7 +284,12 @@ GLUhalfEdge *__gl_meshMakeEdge( GLUmesh *mesh )
|
|||
}
|
||||
|
||||
e = MakeEdge( &mesh->eHead );
|
||||
if (e == NULL) return NULL;
|
||||
if (e == NULL) {
|
||||
memFree(newVertex1);
|
||||
memFree(newVertex2);
|
||||
memFree(newFace);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MakeVertex( newVertex1, e, &mesh->vHead );
|
||||
MakeVertex( newVertex2, e->Sym, &mesh->vHead );
|
||||
|
|
|
|||
|
|
@ -3526,6 +3526,8 @@ gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin,
|
|||
afterImage =
|
||||
malloc(image_size(widthout, heightout, format, GL_UNSIGNED_SHORT));
|
||||
if (beforeImage == NULL || afterImage == NULL) {
|
||||
free(beforeImage);
|
||||
free(afterImage);
|
||||
return GLU_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
|
|
@ -3760,6 +3762,7 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat,
|
|||
glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
|
||||
glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes);
|
||||
free(newImage);
|
||||
return GLU_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
|
@ -7382,6 +7385,8 @@ int gluScaleImage3D(GLenum format,
|
|||
afterImage = malloc(imageSize3D(widthOut, heightOut, depthOut, format,
|
||||
GL_UNSIGNED_SHORT));
|
||||
if (beforeImage == NULL || afterImage == NULL) {
|
||||
free(beforeImage);
|
||||
free(afterImage);
|
||||
return GLU_OUT_OF_MEMORY;
|
||||
}
|
||||
retrieveStoreModes3D(&psm);
|
||||
|
|
|
|||
|
|
@ -250,12 +250,14 @@ driCreateContext(__GLXscreenConfigs * psc,
|
|||
{
|
||||
__GLXDRIcontextPrivate *pcp, *pcp_shared;
|
||||
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode;
|
||||
const __DRIcoreExtension *core = psc->core;
|
||||
const __DRIcoreExtension *core;
|
||||
__DRIcontext *shared = NULL;
|
||||
|
||||
if (!psc || !psc->driScreen)
|
||||
return NULL;
|
||||
|
||||
core = psc->core;
|
||||
|
||||
if (shareList) {
|
||||
pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext;
|
||||
shared = pcp_shared->driContext;
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ void brw_validate_state(struct brw_context *brw);
|
|||
void brw_upload_state(struct brw_context *brw);
|
||||
void brw_init_state(struct brw_context *brw);
|
||||
void brw_destroy_state(struct brw_context *brw);
|
||||
void brw_clear_validated_bos(struct brw_context *brw);
|
||||
|
||||
/***********************************************************************
|
||||
* brw_state_cache.c
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ static void xor_states( struct brw_state_flags *result,
|
|||
result->cache = a->cache ^ b->cache;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
brw_clear_validated_bos(struct brw_context *brw)
|
||||
{
|
||||
int i;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
#include "brw_state.h"
|
||||
#include "brw_fallback.h"
|
||||
#include "brw_vs.h"
|
||||
|
||||
#include "brw_wm.h"
|
||||
|
||||
static void
|
||||
dri_bo_release(dri_bo **bo)
|
||||
|
|
@ -66,8 +66,14 @@ static void brw_destroy_context( struct intel_context *intel )
|
|||
|
||||
brw_destroy_state(brw);
|
||||
brw_draw_destroy( brw );
|
||||
|
||||
_mesa_free(brw->wm.compile_data);
|
||||
brw_clear_validated_bos(brw);
|
||||
if (brw->wm.compile_data) {
|
||||
_mesa_free(brw->wm.compile_data->instruction);
|
||||
_mesa_free(brw->wm.compile_data->vreg);
|
||||
_mesa_free(brw->wm.compile_data->refs);
|
||||
_mesa_free(brw->wm.compile_data->prog_instructions);
|
||||
_mesa_free(brw->wm.compile_data);
|
||||
}
|
||||
|
||||
for (i = 0; i < brw->state.nr_color_regions; i++)
|
||||
intel_region_release(&brw->state.color_regions[i]);
|
||||
|
|
|
|||
|
|
@ -157,7 +157,6 @@ static void do_wm_prog( struct brw_context *brw,
|
|||
sizeof(*c->prog_instructions));
|
||||
c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg));
|
||||
c->refs = _mesa_calloc(BRW_WM_MAX_REF * sizeof(*c->refs));
|
||||
c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg));
|
||||
} else {
|
||||
void *instruction = c->instruction;
|
||||
void *prog_instructions = c->prog_instructions;
|
||||
|
|
|
|||
|
|
@ -221,6 +221,8 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level,
|
|||
return;
|
||||
|
||||
fail:
|
||||
if (INTEL_DEBUG & DEBUG_FALLBACKS)
|
||||
fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__);
|
||||
_mesa_meta_CopyTexImage1D(ctx, target, level, internalFormat, x, y,
|
||||
width, border);
|
||||
}
|
||||
|
|
@ -268,6 +270,8 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level,
|
|||
return;
|
||||
|
||||
fail:
|
||||
if (INTEL_DEBUG & DEBUG_FALLBACKS)
|
||||
fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__);
|
||||
_mesa_meta_CopyTexImage2D(ctx, target, level, internalFormat, x, y,
|
||||
width, height, border);
|
||||
}
|
||||
|
|
@ -292,6 +296,8 @@ intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level,
|
|||
if (!do_copy_texsubimage(intel_context(ctx), target,
|
||||
intel_texture_image(texImage),
|
||||
internalFormat, xoffset, 0, x, y, width, 1)) {
|
||||
if (INTEL_DEBUG & DEBUG_FALLBACKS)
|
||||
fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__);
|
||||
_mesa_meta_CopyTexSubImage1D(ctx, target, level, xoffset, x, y, width);
|
||||
}
|
||||
}
|
||||
|
|
@ -317,8 +323,8 @@ intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,
|
|||
internalFormat,
|
||||
xoffset, yoffset, x, y, width, height)) {
|
||||
|
||||
DBG("%s - fallback to _mesa_meta_CopyTexSubImage2D\n", __FUNCTION__);
|
||||
|
||||
if (INTEL_DEBUG & DEBUG_FALLBACKS)
|
||||
fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__);
|
||||
_mesa_meta_CopyTexSubImage2D(ctx, target, level,
|
||||
xoffset, yoffset, x, y, width, height);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register
|
|||
|
||||
static inline void reset_srcreg(struct rc_src_register* reg)
|
||||
{
|
||||
memset(reg, 0, sizeof(reg));
|
||||
memset(reg, 0, sizeof(struct rc_src_register));
|
||||
reg->Swizzle = RC_SWIZZLE_XYZW;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -560,23 +560,23 @@ static void sincos_constants(struct radeon_compiler* c, unsigned int *constants)
|
|||
* MAD dest, tmp.y, weight, tmp.x
|
||||
*/
|
||||
static void sin_approx(
|
||||
struct radeon_compiler* c, struct rc_instruction * before,
|
||||
struct radeon_compiler* c, struct rc_instruction * inst,
|
||||
struct rc_dst_register dst, struct rc_src_register src, const unsigned int* constants)
|
||||
{
|
||||
unsigned int tempreg = rc_find_free_temporary(c);
|
||||
|
||||
emit2(c, before, RC_OPCODE_MUL, 0, dstregtmpmask(tempreg, RC_MASK_XY),
|
||||
emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstregtmpmask(tempreg, RC_MASK_XY),
|
||||
swizzle(src, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X),
|
||||
srcreg(RC_FILE_CONSTANT, constants[0]));
|
||||
emit3(c, before, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_X),
|
||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_X),
|
||||
swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y),
|
||||
absolute(swizzle(src, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)),
|
||||
swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X));
|
||||
emit3(c, before, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_Y),
|
||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_Y),
|
||||
swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X),
|
||||
absolute(swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)),
|
||||
negate(swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)));
|
||||
emit3(c, before, RC_OPCODE_MAD, 0, dst,
|
||||
emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dst,
|
||||
swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y),
|
||||
swizzle(srcreg(RC_FILE_CONSTANT, constants[0]), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W),
|
||||
swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X));
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
|
|||
else
|
||||
radeon->texture_row_align = 32;
|
||||
radeon->texture_rect_row_align = 64;
|
||||
radeon->texture_compressed_row_align = 64;
|
||||
radeon->texture_compressed_row_align = 32;
|
||||
}
|
||||
|
||||
radeon_init_dma(radeon);
|
||||
|
|
|
|||
|
|
@ -37,26 +37,35 @@
|
|||
#include "main/texobj.h"
|
||||
#include "radeon_texture.h"
|
||||
|
||||
static GLuint radeon_compressed_texture_size(GLcontext *ctx,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
gl_format mesaFormat)
|
||||
static unsigned get_aligned_compressed_row_stride(
|
||||
gl_format format,
|
||||
unsigned width,
|
||||
unsigned minStride)
|
||||
{
|
||||
GLuint size = _mesa_format_image_size(mesaFormat, width, height, depth);
|
||||
const unsigned blockSize = _mesa_get_format_bytes(format);
|
||||
unsigned blockWidth, blockHeight, numXBlocks;
|
||||
|
||||
if (mesaFormat == MESA_FORMAT_RGB_DXT1 ||
|
||||
mesaFormat == MESA_FORMAT_RGBA_DXT1) {
|
||||
if (width + 3 < 8) /* width one block */
|
||||
size = size * 4;
|
||||
else if (width + 3 < 16)
|
||||
size = size * 2;
|
||||
} else {
|
||||
/* DXT3/5, 16 bytes per block */
|
||||
// WARN_ONCE("DXT 3/5 suffers from multitexturing problems!\n");
|
||||
if (width + 3 < 8)
|
||||
size = size * 2;
|
||||
_mesa_get_format_block_size(format, &blockWidth, &blockHeight);
|
||||
numXBlocks = (width + blockWidth - 1) / blockWidth;
|
||||
|
||||
while (numXBlocks * blockSize < minStride)
|
||||
{
|
||||
++numXBlocks;
|
||||
}
|
||||
|
||||
return size;
|
||||
return numXBlocks * blockSize;
|
||||
}
|
||||
|
||||
static unsigned get_compressed_image_size(
|
||||
gl_format format,
|
||||
unsigned rowStride,
|
||||
unsigned height)
|
||||
{
|
||||
unsigned blockWidth, blockHeight;
|
||||
|
||||
_mesa_get_format_block_size(format, &blockWidth, &blockHeight);
|
||||
|
||||
return rowStride * ((height + blockHeight - 1) / blockHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -74,10 +83,8 @@ static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree
|
|||
|
||||
/* Find image size in bytes */
|
||||
if (_mesa_is_format_compressed(mt->mesaFormat)) {
|
||||
/* TODO: Is this correct? Need test cases for compressed textures! */
|
||||
row_align = rmesa->texture_compressed_row_align - 1;
|
||||
lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
|
||||
lvl->size = radeon_compressed_texture_size(rmesa->glCtx, lvl->width, lvl->height, lvl->depth, mt->mesaFormat);
|
||||
lvl->rowstride = get_aligned_compressed_row_stride(mt->mesaFormat, lvl->width, rmesa->texture_compressed_row_align);
|
||||
lvl->size = get_compressed_image_size(mt->mesaFormat, lvl->rowstride, lvl->height);
|
||||
} else if (mt->target == GL_TEXTURE_RECTANGLE_NV) {
|
||||
row_align = rmesa->texture_rect_row_align - 1;
|
||||
lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align;
|
||||
|
|
@ -485,11 +492,12 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj,
|
|||
unsigned firstLevel,
|
||||
unsigned lastLevel)
|
||||
{
|
||||
const unsigned numLevels = lastLevel - firstLevel;
|
||||
const unsigned numLevels = lastLevel - firstLevel + 1;
|
||||
unsigned *mtSizes = calloc(numLevels, sizeof(unsigned));
|
||||
radeon_mipmap_tree **mts = calloc(numLevels, sizeof(radeon_mipmap_tree *));
|
||||
unsigned mtCount = 0;
|
||||
unsigned maxMtIndex = 0;
|
||||
radeon_mipmap_tree *tmp;
|
||||
|
||||
for (unsigned level = firstLevel; level <= lastLevel; ++level) {
|
||||
radeon_texture_image *img = get_radeon_texture_image(texObj->base.Image[0][level]);
|
||||
|
|
@ -511,7 +519,7 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj,
|
|||
|
||||
if (!found) {
|
||||
mtSizes[mtCount] += img->mt->levels[img->mtlevel].size;
|
||||
mts[mtCount++] = img->mt;
|
||||
mts[mtCount] = img->mt;
|
||||
mtCount++;
|
||||
}
|
||||
}
|
||||
|
|
@ -526,7 +534,11 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj,
|
|||
}
|
||||
}
|
||||
|
||||
return mts[maxMtIndex];
|
||||
tmp = mts[maxMtIndex];
|
||||
free(mtSizes);
|
||||
free(mts);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -582,12 +582,12 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
|
|||
/* TODO */
|
||||
assert(0);
|
||||
} else {
|
||||
dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
|
||||
dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
|
||||
}
|
||||
|
||||
if (dims == 3) {
|
||||
unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat);
|
||||
dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth);
|
||||
dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, texImage->Height, texImage->Depth);
|
||||
if (!dstImageOffsets) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -598,8 +598,11 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
|
|||
radeon_teximage_map(image, GL_TRUE);
|
||||
|
||||
if (compressed) {
|
||||
uint32_t srcRowStride, bytesPerRow, rows;
|
||||
uint32_t srcRowStride, bytesPerRow, rows, block_width, block_height;
|
||||
GLubyte *img_start;
|
||||
|
||||
_mesa_get_format_block_size(texImage->TexFormat, &block_width, &block_height);
|
||||
|
||||
if (!image->mt) {
|
||||
dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
|
||||
img_start = _mesa_compressed_image_address(xoffset, yoffset, 0,
|
||||
|
|
@ -607,17 +610,16 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
|
|||
texImage->Width, texImage->Data);
|
||||
}
|
||||
else {
|
||||
uint32_t blocks_x, block_width, block_height;
|
||||
_mesa_get_format_block_size(image->mt->mesaFormat, &block_width, &block_height);
|
||||
blocks_x = dstRowStride / block_width;
|
||||
img_start = texImage->Data + _mesa_get_format_bytes(image->mt->mesaFormat) * 4 * (blocks_x * (yoffset / 4) + xoffset / 4);
|
||||
uint32_t offset;
|
||||
offset = dstRowStride / _mesa_get_format_bytes(texImage->TexFormat) * yoffset / block_height + xoffset / block_width;
|
||||
offset *= _mesa_get_format_bytes(texImage->TexFormat);
|
||||
img_start = texImage->Data + offset;
|
||||
}
|
||||
srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
|
||||
bytesPerRow = srcRowStride;
|
||||
rows = (height + 3) / 4;
|
||||
|
||||
copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow);
|
||||
rows = (height + block_height - 1) / block_height;
|
||||
|
||||
copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow);
|
||||
}
|
||||
else {
|
||||
if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat,
|
||||
|
|
|
|||
|
|
@ -570,7 +570,7 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
|
|||
static FetchTexelFuncF
|
||||
_mesa_get_texel_fetch_func(gl_format format, GLuint dims)
|
||||
{
|
||||
FetchTexelFuncF f;
|
||||
FetchTexelFuncF f = NULL;
|
||||
GLuint i;
|
||||
/* XXX replace loop with direct table lookup */
|
||||
for (i = 0; i < MESA_FORMAT_COUNT; i++) {
|
||||
|
|
|
|||
|
|
@ -521,10 +521,11 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
|
|||
struct gl_texture_object *texObj,
|
||||
struct gl_texture_image *texImage)
|
||||
{
|
||||
const GLuint size = _mesa_format_image_size(texImage->TexFormat,
|
||||
texImage->Width,
|
||||
texImage->Height,
|
||||
texImage->Depth);
|
||||
const GLuint row_stride = _mesa_format_row_stride(texImage->TexFormat,
|
||||
texImage->Width);
|
||||
const GLuint row_stride_stored = _mesa_format_row_stride(texImage->TexFormat,
|
||||
texImage->RowStride);
|
||||
GLuint i;
|
||||
|
||||
if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
|
||||
/* pack texture image into a PBO */
|
||||
|
|
@ -540,8 +541,22 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
|
|||
img = ADD_POINTERS(buf, img);
|
||||
}
|
||||
|
||||
/* just memcpy, no pixelstore or pixel transfer */
|
||||
_mesa_memcpy(img, texImage->Data, size);
|
||||
/* no pixelstore or pixel transfer, but respect stride */
|
||||
|
||||
if (row_stride == row_stride_stored) {
|
||||
const GLuint size = _mesa_format_image_size(texImage->TexFormat,
|
||||
texImage->Width,
|
||||
texImage->Height,
|
||||
texImage->Depth);
|
||||
_mesa_memcpy(img, texImage->Data, size);
|
||||
}
|
||||
else {
|
||||
GLuint bw, bh;
|
||||
_mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
|
||||
for (i = 0; i < (texImage->Height + bh - 1) / bh; i++) {
|
||||
memcpy(img + i * row_stride, texImage->Data + i * row_stride_stored, row_stride);
|
||||
}
|
||||
}
|
||||
|
||||
if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
|
||||
ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ _mesa_remove_extra_move_use(struct gl_program *prog)
|
|||
* FOO tmpY, arg0, arg1;
|
||||
*/
|
||||
|
||||
for (i = 0; i < prog->NumInstructions - 1; i++) {
|
||||
for (i = 0; i + 1 < prog->NumInstructions; i++) {
|
||||
const struct prog_instruction *mov = prog->Instructions + i;
|
||||
|
||||
if (mov->Opcode != OPCODE_MOV ||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue