mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 13:40:11 +01:00
Merge commit 'origin/gallium-0.1' into gallium-0.2
Conflicts: src/mesa/shader/slang/slang_link.c
This commit is contained in:
commit
a8d1521f30
33 changed files with 359 additions and 78 deletions
|
|
@ -48,9 +48,9 @@ PrintConfigs(EGLDisplay d)
|
|||
eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
|
||||
|
||||
printf("Configurations:\n");
|
||||
printf(" bf lv d st colorbuffer dp st vis supported\n");
|
||||
printf(" id sz l b ro r g b a th cl id surfaces \n");
|
||||
printf("---------------------------------------------------\n");
|
||||
printf(" bf lv d st colorbuffer dp st ms vis supported\n");
|
||||
printf(" id sz l b ro r g b a th cl ns b id surfaces \n");
|
||||
printf("--------------------------------------------------------\n");
|
||||
for (i = 0; i < numConfigs; i++) {
|
||||
EGLint id, size, level;
|
||||
EGLint red, green, blue, alpha;
|
||||
|
|
@ -58,6 +58,7 @@ PrintConfigs(EGLDisplay d)
|
|||
EGLint surfaces;
|
||||
EGLint doubleBuf = 1, stereo = 0;
|
||||
EGLint vid;
|
||||
EGLint samples, sampleBuffers;
|
||||
char surfString[100] = "";
|
||||
|
||||
eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
|
||||
|
|
@ -73,6 +74,9 @@ PrintConfigs(EGLDisplay d)
|
|||
eglGetConfigAttrib(d, configs[i], EGL_NATIVE_VISUAL_ID, &vid);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces);
|
||||
|
||||
eglGetConfigAttrib(d, configs[i], EGL_SAMPLES, &samples);
|
||||
eglGetConfigAttrib(d, configs[i], EGL_SAMPLE_BUFFERS, &sampleBuffers);
|
||||
|
||||
if (surfaces & EGL_WINDOW_BIT)
|
||||
strcat(surfString, "win,");
|
||||
if (surfaces & EGL_PBUFFER_BIT)
|
||||
|
|
@ -86,12 +90,13 @@ PrintConfigs(EGLDisplay d)
|
|||
if (strlen(surfString) > 0)
|
||||
surfString[strlen(surfString) - 1] = 0;
|
||||
|
||||
printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d 0x%02x %-12s\n",
|
||||
printf("0x%02x %2d %2d %c %c %2d %2d %2d %2d %2d %2d %2d%2d 0x%02x %-12s\n",
|
||||
id, size, level,
|
||||
doubleBuf ? 'y' : '.',
|
||||
stereo ? 'y' : '.',
|
||||
red, green, blue, alpha,
|
||||
depth, stencil, vid, surfString);
|
||||
depth, stencil,
|
||||
samples, sampleBuffers, vid, surfString);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,6 +130,8 @@ static void Display(void)
|
|||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, 1.0, 1.0, 0.0, 0.0);
|
||||
glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 0.0, 0.0, 1.0, 1.0);
|
||||
glBegin(GL_TRIANGLES);
|
||||
glColor3f(0,0,1);
|
||||
glVertex3f( 0.9, -0.9, -30.0);
|
||||
|
|
|
|||
11
progs/fp/local.txt
Normal file
11
progs/fp/local.txt
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
!!ARBfp1.0
|
||||
TEMP R0;
|
||||
PARAM c[4] = { { 0, 0, 0, 0 },
|
||||
program.local[0..1],
|
||||
{ 1, 1, 1, 1 } };
|
||||
MOV R0, c[1];
|
||||
SUB R0, R0, c[0];
|
||||
ADD R0, R0, c[2];
|
||||
MUL R0, R0, c[3];
|
||||
MOV result.color, R0;
|
||||
END
|
||||
|
|
@ -80,6 +80,10 @@ struct cso_context {
|
|||
};
|
||||
|
||||
|
||||
static void
|
||||
free_framebuffer_state(struct pipe_framebuffer_state *fb);
|
||||
|
||||
|
||||
static boolean delete_blend_state(struct cso_context *ctx, void *state)
|
||||
{
|
||||
struct cso_blend *cso = (struct cso_blend *)state;
|
||||
|
|
@ -252,6 +256,9 @@ void cso_release_all( struct cso_context *ctx )
|
|||
pipe_texture_reference(&ctx->textures_saved[i], NULL);
|
||||
}
|
||||
|
||||
free_framebuffer_state(&ctx->fb);
|
||||
free_framebuffer_state(&ctx->fb_saved);
|
||||
|
||||
if (ctx->cache) {
|
||||
cso_cache_delete( ctx->cache );
|
||||
ctx->cache = NULL;
|
||||
|
|
@ -765,12 +772,42 @@ void cso_restore_vertex_shader(struct cso_context *ctx)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy framebuffer state from src to dst with refcounting of surfaces.
|
||||
*/
|
||||
static void
|
||||
copy_framebuffer_state(struct pipe_framebuffer_state *dst,
|
||||
const struct pipe_framebuffer_state *src)
|
||||
{
|
||||
uint i;
|
||||
|
||||
dst->width = src->width;
|
||||
dst->height = src->height;
|
||||
dst->num_cbufs = src->num_cbufs;
|
||||
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
|
||||
pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]);
|
||||
}
|
||||
pipe_surface_reference(&dst->zsbuf, src->zsbuf);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
free_framebuffer_state(struct pipe_framebuffer_state *fb)
|
||||
{
|
||||
uint i;
|
||||
|
||||
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
|
||||
pipe_surface_reference(&fb->cbufs[i], NULL);
|
||||
}
|
||||
pipe_surface_reference(&fb->zsbuf, NULL);
|
||||
}
|
||||
|
||||
|
||||
enum pipe_error cso_set_framebuffer(struct cso_context *ctx,
|
||||
const struct pipe_framebuffer_state *fb)
|
||||
{
|
||||
if (memcmp(&ctx->fb, fb, sizeof(*fb)) != 0) {
|
||||
ctx->fb = *fb;
|
||||
copy_framebuffer_state(&ctx->fb, fb);
|
||||
ctx->pipe->set_framebuffer_state(ctx->pipe, fb);
|
||||
}
|
||||
return PIPE_OK;
|
||||
|
|
@ -778,14 +815,15 @@ enum pipe_error cso_set_framebuffer(struct cso_context *ctx,
|
|||
|
||||
void cso_save_framebuffer(struct cso_context *ctx)
|
||||
{
|
||||
ctx->fb_saved = ctx->fb;
|
||||
copy_framebuffer_state(&ctx->fb_saved, &ctx->fb);
|
||||
}
|
||||
|
||||
void cso_restore_framebuffer(struct cso_context *ctx)
|
||||
{
|
||||
if (memcmp(&ctx->fb, &ctx->fb_saved, sizeof(ctx->fb))) {
|
||||
ctx->fb = ctx->fb_saved;
|
||||
copy_framebuffer_state(&ctx->fb, &ctx->fb_saved);
|
||||
ctx->pipe->set_framebuffer_state(ctx->pipe, &ctx->fb);
|
||||
free_framebuffer_state(&ctx->fb_saved);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -222,8 +222,8 @@ static void widepoint_first_point( struct draw_stage *stage,
|
|||
/* find fragment shader PointCoord/Fog input */
|
||||
wide->point_coord_fs_input = 0; /* XXX fix this! */
|
||||
|
||||
/* setup extra vp output */
|
||||
draw->extra_vp_outputs.semantic_name = TGSI_SEMANTIC_FOG;
|
||||
/* setup extra vp output (point coord implemented as a texcoord) */
|
||||
draw->extra_vp_outputs.semantic_name = TGSI_SEMANTIC_GENERIC;
|
||||
draw->extra_vp_outputs.semantic_index = 0;
|
||||
draw->extra_vp_outputs.slot = draw->vs.num_vs_outputs;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ pb_malloc_buffer_create(size_t size,
|
|||
|
||||
|
||||
static struct pb_buffer *
|
||||
pb_malloc_buffer_create_buffer(struct pb_manager *mgr,
|
||||
pb_malloc_bufmgr_create_buffer(struct pb_manager *mgr,
|
||||
size_t size,
|
||||
const struct pb_desc *desc)
|
||||
{
|
||||
|
|
@ -137,6 +137,13 @@ pb_malloc_buffer_create_buffer(struct pb_manager *mgr,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
pb_malloc_bufmgr_flush(struct pb_manager *mgr)
|
||||
{
|
||||
/* No-op */
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pb_malloc_bufmgr_destroy(struct pb_manager *mgr)
|
||||
{
|
||||
|
|
@ -146,8 +153,9 @@ pb_malloc_bufmgr_destroy(struct pb_manager *mgr)
|
|||
|
||||
static struct pb_manager
|
||||
pb_malloc_bufmgr = {
|
||||
pb_malloc_buffer_create_buffer,
|
||||
pb_malloc_bufmgr_destroy
|
||||
pb_malloc_bufmgr_destroy,
|
||||
pb_malloc_bufmgr_create_buffer,
|
||||
pb_malloc_bufmgr_flush
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -69,13 +69,22 @@ struct pipe_winsys;
|
|||
*/
|
||||
struct pb_manager
|
||||
{
|
||||
void
|
||||
(*destroy)( struct pb_manager *mgr );
|
||||
|
||||
struct pb_buffer *
|
||||
(*create_buffer)( struct pb_manager *mgr,
|
||||
size_t size,
|
||||
const struct pb_desc *desc);
|
||||
|
||||
/**
|
||||
* Flush all temporary-held buffers.
|
||||
*
|
||||
* Used mostly to aid debugging memory issues or to clean up resources when
|
||||
* the drivers are long lived.
|
||||
*/
|
||||
void
|
||||
(*destroy)( struct pb_manager *mgr );
|
||||
(*flush)( struct pb_manager *mgr );
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -153,9 +162,6 @@ struct pb_manager *
|
|||
pb_cache_manager_create(struct pb_manager *provider,
|
||||
unsigned usecs);
|
||||
|
||||
void
|
||||
pb_cache_flush(struct pb_manager *mgr);
|
||||
|
||||
|
||||
/**
|
||||
* Fenced buffer manager.
|
||||
|
|
|
|||
|
|
@ -75,6 +75,21 @@ pb_alt_manager_create_buffer(struct pb_manager *_mgr,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
pb_alt_manager_flush(struct pb_manager *_mgr)
|
||||
{
|
||||
struct pb_alt_manager *mgr = pb_alt_manager(_mgr);
|
||||
|
||||
assert(mgr->provider1->flush);
|
||||
if(mgr->provider1->flush)
|
||||
mgr->provider1->flush(mgr->provider1);
|
||||
|
||||
assert(mgr->provider2->flush);
|
||||
if(mgr->provider2->flush)
|
||||
mgr->provider2->flush(mgr->provider2);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pb_alt_manager_destroy(struct pb_manager *mgr)
|
||||
{
|
||||
|
|
@ -97,6 +112,7 @@ pb_alt_manager_create(struct pb_manager *provider1,
|
|||
|
||||
mgr->base.destroy = pb_alt_manager_destroy;
|
||||
mgr->base.create_buffer = pb_alt_manager_create_buffer;
|
||||
mgr->base.flush = pb_alt_manager_flush;
|
||||
mgr->provider1 = provider1;
|
||||
mgr->provider2 = provider2;
|
||||
|
||||
|
|
|
|||
|
|
@ -306,8 +306,8 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
pb_cache_flush(struct pb_manager *_mgr)
|
||||
static void
|
||||
pb_cache_manager_flush(struct pb_manager *_mgr)
|
||||
{
|
||||
struct pb_cache_manager *mgr = pb_cache_manager(_mgr);
|
||||
struct list_head *curr, *next;
|
||||
|
|
@ -323,13 +323,17 @@ pb_cache_flush(struct pb_manager *_mgr)
|
|||
next = curr->next;
|
||||
}
|
||||
pipe_mutex_unlock(mgr->mutex);
|
||||
|
||||
assert(mgr->provider->flush);
|
||||
if(mgr->provider->flush)
|
||||
mgr->provider->flush(mgr->provider);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pb_cache_manager_destroy(struct pb_manager *mgr)
|
||||
{
|
||||
pb_cache_flush(mgr);
|
||||
pb_cache_manager_flush(mgr);
|
||||
FREE(mgr);
|
||||
}
|
||||
|
||||
|
|
@ -349,6 +353,7 @@ pb_cache_manager_create(struct pb_manager *provider,
|
|||
|
||||
mgr->base.destroy = pb_cache_manager_destroy;
|
||||
mgr->base.create_buffer = pb_cache_manager_create_buffer;
|
||||
mgr->base.flush = pb_cache_manager_flush;
|
||||
mgr->provider = provider;
|
||||
mgr->usecs = usecs;
|
||||
LIST_INITHEAD(&mgr->delayed);
|
||||
|
|
|
|||
|
|
@ -313,6 +313,16 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
pb_debug_manager_flush(struct pb_manager *_mgr)
|
||||
{
|
||||
struct pb_debug_manager *mgr = pb_debug_manager(_mgr);
|
||||
assert(mgr->provider->flush);
|
||||
if(mgr->provider->flush)
|
||||
mgr->provider->flush(mgr->provider);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pb_debug_manager_destroy(struct pb_manager *_mgr)
|
||||
{
|
||||
|
|
@ -336,6 +346,7 @@ pb_debug_manager_create(struct pb_manager *provider, size_t band_size)
|
|||
|
||||
mgr->base.destroy = pb_debug_manager_destroy;
|
||||
mgr->base.create_buffer = pb_debug_manager_create_buffer;
|
||||
mgr->base.flush = pb_debug_manager_flush;
|
||||
mgr->provider = provider;
|
||||
mgr->band_size = band_size;
|
||||
|
||||
|
|
|
|||
|
|
@ -94,6 +94,19 @@ fenced_bufmgr_create_buffer(struct pb_manager *mgr,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
fenced_bufmgr_flush(struct pb_manager *mgr)
|
||||
{
|
||||
struct fenced_pb_manager *fenced_mgr = fenced_pb_manager(mgr);
|
||||
|
||||
fenced_buffer_list_check_free(fenced_mgr->fenced_list, TRUE);
|
||||
|
||||
assert(fenced_mgr->provider->flush);
|
||||
if(fenced_mgr->provider->flush)
|
||||
fenced_mgr->provider->flush(fenced_mgr->provider);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fenced_bufmgr_destroy(struct pb_manager *mgr)
|
||||
{
|
||||
|
|
@ -123,6 +136,7 @@ fenced_bufmgr_create(struct pb_manager *provider,
|
|||
|
||||
fenced_mgr->base.destroy = fenced_bufmgr_destroy;
|
||||
fenced_mgr->base.create_buffer = fenced_bufmgr_create_buffer;
|
||||
fenced_mgr->base.flush = fenced_bufmgr_flush;
|
||||
|
||||
fenced_mgr->provider = provider;
|
||||
fenced_mgr->fenced_list = fenced_buffer_list_create(winsys);
|
||||
|
|
|
|||
|
|
@ -199,6 +199,13 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
mm_bufmgr_flush(struct pb_manager *mgr)
|
||||
{
|
||||
/* No-op */
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mm_bufmgr_destroy(struct pb_manager *mgr)
|
||||
{
|
||||
|
|
@ -230,8 +237,9 @@ mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
|
|||
if (!mm)
|
||||
return NULL;
|
||||
|
||||
mm->base.create_buffer = mm_bufmgr_create_buffer;
|
||||
mm->base.destroy = mm_bufmgr_destroy;
|
||||
mm->base.create_buffer = mm_bufmgr_create_buffer;
|
||||
mm->base.flush = mm_bufmgr_flush;
|
||||
|
||||
mm->size = size;
|
||||
mm->align2 = align2; /* 64-byte alignment */
|
||||
|
|
|
|||
|
|
@ -202,6 +202,13 @@ pool_bufmgr_create_buffer(struct pb_manager *mgr,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
pool_bufmgr_flush(struct pb_manager *mgr)
|
||||
{
|
||||
/* No-op */
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pool_bufmgr_destroy(struct pb_manager *mgr)
|
||||
{
|
||||
|
|
@ -238,6 +245,7 @@ pool_bufmgr_create(struct pb_manager *provider,
|
|||
|
||||
pool->base.destroy = pool_bufmgr_destroy;
|
||||
pool->base.create_buffer = pool_bufmgr_create_buffer;
|
||||
pool->base.flush = pool_bufmgr_flush;
|
||||
|
||||
LIST_INITHEAD(&pool->free);
|
||||
|
||||
|
|
|
|||
|
|
@ -406,6 +406,17 @@ pb_slab_manager_create_buffer(struct pb_manager *_mgr,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
pb_slab_manager_flush(struct pb_manager *_mgr)
|
||||
{
|
||||
struct pb_slab_manager *mgr = pb_slab_manager(_mgr);
|
||||
|
||||
assert(mgr->provider->flush);
|
||||
if(mgr->provider->flush)
|
||||
mgr->provider->flush(mgr->provider);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pb_slab_manager_destroy(struct pb_manager *_mgr)
|
||||
{
|
||||
|
|
@ -430,6 +441,7 @@ pb_slab_manager_create(struct pb_manager *provider,
|
|||
|
||||
mgr->base.destroy = pb_slab_manager_destroy;
|
||||
mgr->base.create_buffer = pb_slab_manager_create_buffer;
|
||||
mgr->base.flush = pb_slab_manager_flush;
|
||||
|
||||
mgr->provider = provider;
|
||||
mgr->bufSize = bufSize;
|
||||
|
|
@ -465,6 +477,19 @@ pb_slab_range_manager_create_buffer(struct pb_manager *_mgr,
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
pb_slab_range_manager_flush(struct pb_manager *_mgr)
|
||||
{
|
||||
struct pb_slab_range_manager *mgr = pb_slab_range_manager(_mgr);
|
||||
|
||||
/* Individual slabs don't hold any temporary buffers so no need to call them */
|
||||
|
||||
assert(mgr->provider->flush);
|
||||
if(mgr->provider->flush)
|
||||
mgr->provider->flush(mgr->provider);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pb_slab_range_manager_destroy(struct pb_manager *_mgr)
|
||||
{
|
||||
|
|
@ -499,6 +524,7 @@ pb_slab_range_manager_create(struct pb_manager *provider,
|
|||
|
||||
mgr->base.destroy = pb_slab_range_manager_destroy;
|
||||
mgr->base.create_buffer = pb_slab_range_manager_create_buffer;
|
||||
mgr->base.flush = pb_slab_range_manager_flush;
|
||||
|
||||
mgr->provider = provider;
|
||||
mgr->minBufSize = minBufSize;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ include $(TOP)/configs/current
|
|||
LIBNAME = tgsi
|
||||
|
||||
C_SOURCES = \
|
||||
tgsi_sanity.c \
|
||||
tgsi_build.c \
|
||||
tgsi_dump.c \
|
||||
tgsi_exec.c \
|
||||
|
|
@ -12,6 +13,7 @@ C_SOURCES = \
|
|||
tgsi_parse.c \
|
||||
tgsi_scan.c \
|
||||
tgsi_sse2.c \
|
||||
tgsi_text.c \
|
||||
tgsi_transform.c \
|
||||
tgsi_util.c
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ dump_enum(
|
|||
#define CHR(C) ctx->printf( ctx, "%c", C )
|
||||
#define UIX(I) ctx->printf( ctx, "0x%x", I )
|
||||
#define UID(I) ctx->printf( ctx, "%u", I )
|
||||
#define INSTID(I) ctx->printf( ctx, "% 3u", I )
|
||||
#define SID(I) ctx->printf( ctx, "%d", I )
|
||||
#define FLT(F) ctx->printf( ctx, "%10.4f", F )
|
||||
#define ENM(E,ENUMS) dump_enum( ctx, E, ENUMS, sizeof( ENUMS ) / sizeof( *ENUMS ) )
|
||||
|
|
@ -315,8 +316,8 @@ iter_instruction(
|
|||
uint i;
|
||||
boolean first_reg = TRUE;
|
||||
|
||||
UID( instno );
|
||||
CHR( ':' );
|
||||
INSTID( instno );
|
||||
TXT( ": " );
|
||||
TXT( tgsi_get_opcode_info( inst->Instruction.Opcode )->mnemonic );
|
||||
|
||||
switch (inst->Instruction.Saturate) {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
|
|||
{ 1, 1, 0, 0, "COS" },
|
||||
{ 1, 1, 0, 0, "DDX" },
|
||||
{ 1, 1, 0, 0, "DDY" },
|
||||
{ 0, 1, 0, 0, "KILP" },
|
||||
{ 0, 0, 0, 0, "KILP" },
|
||||
{ 1, 1, 0, 0, "PK2H" },
|
||||
{ 1, 1, 0, 0, "PK2US" },
|
||||
{ 1, 1, 0, 0, "PK4B" },
|
||||
|
|
@ -146,7 +146,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
|
|||
{ 0, 1, 0, 0, "CALLNZ" },
|
||||
{ 0, 1, 0, 0, "IFC" },
|
||||
{ 0, 1, 0, 0, "BREAKC" },
|
||||
{ 0, 0, 0, 0, "KIL" },
|
||||
{ 0, 1, 0, 0, "KIL" },
|
||||
{ 0, 0, 0, 0, "END" },
|
||||
{ 1, 1, 0, 0, "SWZ" }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -152,6 +152,12 @@ check_register_usage(
|
|||
{
|
||||
if (!check_file_name( ctx, file ))
|
||||
return FALSE;
|
||||
|
||||
if (index < 0 || index > MAX_REGISTERS) {
|
||||
report_error( ctx, "%s[%i]: Invalid index %s", file_names[file], index, name );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (indirect_access) {
|
||||
if (!is_any_register_declared( ctx, file ))
|
||||
report_error( ctx, "%s: Undeclared %s register", file_names[file], name );
|
||||
|
|
@ -174,12 +180,10 @@ iter_instruction(
|
|||
const struct tgsi_opcode_info *info;
|
||||
uint i;
|
||||
|
||||
/* There must be no other instructions after END.
|
||||
*/
|
||||
if (ctx->index_of_END != ~0) {
|
||||
report_error( ctx, "Unexpected instruction after END" );
|
||||
}
|
||||
else if (inst->Instruction.Opcode == TGSI_OPCODE_END) {
|
||||
if (inst->Instruction.Opcode == TGSI_OPCODE_END) {
|
||||
if (ctx->index_of_END != ~0) {
|
||||
report_error( ctx, "Too many END instructions" );
|
||||
}
|
||||
ctx->index_of_END = ctx->num_instructions;
|
||||
}
|
||||
|
||||
|
|
@ -301,10 +305,10 @@ epilog(
|
|||
struct sanity_check_ctx *ctx = (struct sanity_check_ctx *) iter;
|
||||
uint file;
|
||||
|
||||
/* There must be an END instruction at the end.
|
||||
/* There must be an END instruction somewhere.
|
||||
*/
|
||||
if (ctx->index_of_END == ~0 || ctx->index_of_END != ctx->num_instructions - 1) {
|
||||
report_error( ctx, "Expected END at end of instruction sequence" );
|
||||
if (ctx->index_of_END == ~0) {
|
||||
report_error( ctx, "Missing END instruction" );
|
||||
}
|
||||
|
||||
/* Check if all declared registers were used.
|
||||
|
|
|
|||
|
|
@ -122,8 +122,12 @@ debug_malloc(const char *file, unsigned line, const char *function,
|
|||
struct debug_memory_footer *ftr;
|
||||
|
||||
hdr = real_malloc(sizeof(*hdr) + size + sizeof(*ftr));
|
||||
if(!hdr)
|
||||
if(!hdr) {
|
||||
debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
|
||||
file, line, function,
|
||||
(long unsigned)size);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hdr->no = last_no++;
|
||||
hdr->file = file;
|
||||
|
|
@ -219,8 +223,12 @@ debug_realloc(const char *file, unsigned line, const char *function,
|
|||
|
||||
/* alloc new */
|
||||
new_hdr = real_malloc(sizeof(*new_hdr) + new_size + sizeof(*new_ftr));
|
||||
if(!new_hdr)
|
||||
if(!new_hdr) {
|
||||
debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
|
||||
file, line, function,
|
||||
(long unsigned)new_size);
|
||||
return NULL;
|
||||
}
|
||||
new_hdr->no = old_hdr->no;
|
||||
new_hdr->file = old_hdr->file;
|
||||
new_hdr->line = old_hdr->line;
|
||||
|
|
@ -261,8 +269,19 @@ debug_memory_end(unsigned long start_no)
|
|||
for (; entry != &list; entry = entry->prev) {
|
||||
struct debug_memory_header *hdr;
|
||||
void *ptr;
|
||||
struct debug_memory_footer *ftr;
|
||||
|
||||
hdr = LIST_ENTRY(struct debug_memory_header, entry, head);
|
||||
ptr = data_from_header(hdr);
|
||||
ftr = footer_from_header(hdr);
|
||||
|
||||
if(hdr->magic != DEBUG_MEMORY_MAGIC) {
|
||||
debug_printf("%s:%u:%s: bad or corrupted memory %p\n",
|
||||
hdr->file, hdr->line, hdr->function,
|
||||
ptr);
|
||||
debug_assert(0);
|
||||
}
|
||||
|
||||
if((start_no <= hdr->no && hdr->no < last_no) ||
|
||||
(last_no < start_no && (hdr->no < last_no || start_no <= hdr->no))) {
|
||||
debug_printf("%s:%u:%s: %u bytes at %p not freed\n",
|
||||
|
|
@ -270,7 +289,15 @@ debug_memory_end(unsigned long start_no)
|
|||
hdr->size, ptr);
|
||||
total_size += hdr->size;
|
||||
}
|
||||
|
||||
if(ftr->magic != DEBUG_MEMORY_MAGIC) {
|
||||
debug_printf("%s:%u:%s: buffer overflow %p\n",
|
||||
hdr->file, hdr->line, hdr->function,
|
||||
ptr);
|
||||
debug_assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
if(total_size) {
|
||||
debug_printf("Total of %u KB of system memory apparently leaked\n",
|
||||
(total_size + 1023)/1024);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_debug.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ This directory contains a Gallium3D pipe driver which traces all incoming calls.
|
|||
|
||||
To build, invoke scons on the top dir as
|
||||
|
||||
scons statetrackers=mesa drivers=softpipe,i915simple,trace winsys=xlib
|
||||
scons statetrackers=mesa drivers=softpipe,i965simple,trace winsys=xlib
|
||||
|
||||
|
||||
= Usage =
|
||||
|
|
|
|||
|
|
@ -1933,7 +1933,10 @@ struct gl_fragment_program
|
|||
{
|
||||
struct gl_program Base; /**< base class */
|
||||
GLenum FogOption;
|
||||
GLboolean UsesKill;
|
||||
GLboolean UsesKill; /**< shader uses KIL instruction */
|
||||
GLboolean UsesPointCoord; /**< shader uses gl_PointCoord */
|
||||
GLboolean UsesFrontFacing; /**< shader used gl_FrontFacing */
|
||||
GLboolean UsesFogFragCoord; /**< shader used gl_FogFragCoord */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1112,7 +1112,8 @@ get_matrix_dims(GLenum type, GLint *rows, GLint *cols)
|
|||
|
||||
/**
|
||||
* Determine the number of rows and columns occupied by a uniform
|
||||
* according to its datatype.
|
||||
* according to its datatype. For non-matrix types (such as GL_FLOAT_VEC4),
|
||||
* the number of rows = 1 and cols = number of elements in the vector.
|
||||
*/
|
||||
static void
|
||||
get_uniform_rows_cols(const struct gl_program_parameter *p,
|
||||
|
|
@ -1121,11 +1122,17 @@ get_uniform_rows_cols(const struct gl_program_parameter *p,
|
|||
get_matrix_dims(p->DataType, rows, cols);
|
||||
if (*rows == 0 && *cols == 0) {
|
||||
/* not a matrix type, probably a float or vector */
|
||||
*rows = p->Size / 4 + 1;
|
||||
if (p->Size % 4 == 0)
|
||||
*cols = 4;
|
||||
else
|
||||
*cols = p->Size % 4;
|
||||
if (p->Size <= 4) {
|
||||
*rows = 1;
|
||||
*cols = p->Size;
|
||||
}
|
||||
else {
|
||||
*rows = p->Size / 4 + 1;
|
||||
if (p->Size % 4 == 0)
|
||||
*cols = 4;
|
||||
else
|
||||
*cols = p->Size % 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,24 @@
|
|||
#include "slang_link.h"
|
||||
|
||||
|
||||
/** cast wrapper */
|
||||
static struct gl_vertex_program *
|
||||
vertex_program(struct gl_program *prog)
|
||||
{
|
||||
assert(prog->Target == GL_VERTEX_PROGRAM_ARB);
|
||||
return (struct gl_vertex_program *) prog;
|
||||
}
|
||||
|
||||
|
||||
/** cast wrapper */
|
||||
static struct gl_fragment_program *
|
||||
fragment_program(struct gl_program *prog)
|
||||
{
|
||||
assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB);
|
||||
return (struct gl_fragment_program *) prog;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Record a linking error.
|
||||
*/
|
||||
|
|
@ -363,6 +381,7 @@ static void
|
|||
_slang_update_inputs_outputs(struct gl_program *prog)
|
||||
{
|
||||
GLuint i, j;
|
||||
GLuint maxAddrReg = 0;
|
||||
|
||||
prog->InputsRead = 0x0;
|
||||
prog->OutputsWritten = 0x0;
|
||||
|
|
@ -373,30 +392,33 @@ _slang_update_inputs_outputs(struct gl_program *prog)
|
|||
for (j = 0; j < numSrc; j++) {
|
||||
if (inst->SrcReg[j].File == PROGRAM_INPUT) {
|
||||
prog->InputsRead |= 1 << inst->SrcReg[j].Index;
|
||||
if (prog->Target == GL_FRAGMENT_PROGRAM_ARB &&
|
||||
inst->SrcReg[j].Index == FRAG_ATTRIB_FOGC) {
|
||||
/* The fragment shader FOGC input is used for fog,
|
||||
* front-facing and sprite/point coord.
|
||||
*/
|
||||
struct gl_fragment_program *fp = fragment_program(prog);
|
||||
const GLint swz = GET_SWZ(inst->SrcReg[j].Swizzle, 0);
|
||||
if (swz == SWIZZLE_X)
|
||||
fp->UsesFogFragCoord = GL_TRUE;
|
||||
else if (swz == SWIZZLE_Y)
|
||||
fp->UsesFrontFacing = GL_TRUE;
|
||||
else if (swz == SWIZZLE_Z || swz == SWIZZLE_W)
|
||||
fp->UsesPointCoord = GL_TRUE;
|
||||
}
|
||||
}
|
||||
else if (inst->SrcReg[j].File == PROGRAM_ADDRESS) {
|
||||
maxAddrReg = MAX2(maxAddrReg, inst->SrcReg[j].Index + 1);
|
||||
}
|
||||
}
|
||||
if (inst->DstReg.File == PROGRAM_OUTPUT) {
|
||||
prog->OutputsWritten |= 1 << inst->DstReg.Index;
|
||||
}
|
||||
else if (inst->DstReg.File == PROGRAM_ADDRESS) {
|
||||
maxAddrReg = MAX2(maxAddrReg, inst->DstReg.Index + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** cast wrapper */
|
||||
static struct gl_vertex_program *
|
||||
vertex_program(struct gl_program *prog)
|
||||
{
|
||||
assert(prog->Target == GL_VERTEX_PROGRAM_ARB);
|
||||
return (struct gl_vertex_program *) prog;
|
||||
}
|
||||
|
||||
|
||||
/** cast wrapper */
|
||||
static struct gl_fragment_program *
|
||||
fragment_program(struct gl_program *prog)
|
||||
{
|
||||
assert(prog->Target == GL_FRAGMENT_PROGRAM_ARB);
|
||||
return (struct gl_fragment_program *) prog;
|
||||
prog->NumAddressRegs = maxAddrReg;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ static void update_raster_state( struct st_context *st )
|
|||
raster->line_stipple_factor = ctx->Line.StippleFactor - 1;
|
||||
|
||||
/* _NEW_MULTISAMPLE */
|
||||
if (ctx->Multisample._Enabled)
|
||||
if (ctx->Multisample._Enabled || st->force_msaa)
|
||||
raster->multisample = 1;
|
||||
|
||||
/* _NEW_SCISSOR */
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
|||
0, 0, 0,
|
||||
surface_usage );
|
||||
|
||||
assert(strb->surface->texture);
|
||||
assert(strb->surface->buffer);
|
||||
assert(strb->surface->format);
|
||||
assert(strb->surface->block.size);
|
||||
|
|
|
|||
|
|
@ -455,6 +455,11 @@ st_TexImage(GLcontext * ctx,
|
|||
_mesa_align_free(texImage->Data);
|
||||
}
|
||||
|
||||
if (width == 0 || height == 0 || depth == 0) {
|
||||
/* stop after freeing old image */
|
||||
return;
|
||||
}
|
||||
|
||||
/* If this is the only mipmap level in the texture, could call
|
||||
* bmBufferData with NULL data to free the old block and avoid
|
||||
* waiting on any outstanding fences.
|
||||
|
|
@ -1048,7 +1053,8 @@ st_copy_texsubimage(GLcontext *ctx,
|
|||
GLboolean use_fallback = GL_TRUE;
|
||||
GLboolean matching_base_formats;
|
||||
|
||||
st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
|
||||
/* any rendering in progress must complete before we grab the fb image */
|
||||
st_finish(ctx->st);
|
||||
|
||||
/* determine if copying depth or color data */
|
||||
if (texBaseFormat == GL_DEPTH_COMPONENT) {
|
||||
|
|
|
|||
|
|
@ -88,6 +88,19 @@ void st_invalidate_state(GLcontext * ctx, GLuint new_state)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check for multisample env var override.
|
||||
*/
|
||||
int
|
||||
st_get_msaa(void)
|
||||
{
|
||||
const char *msaa = _mesa_getenv("__GL_FSAA_MODE");
|
||||
if (msaa)
|
||||
return atoi(msaa);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static struct st_context *
|
||||
st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
|
||||
{
|
||||
|
|
@ -141,6 +154,8 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe )
|
|||
|
||||
st->pixel_xfer.cache = _mesa_new_program_cache();
|
||||
|
||||
st->force_msaa = st_get_msaa();
|
||||
|
||||
/* GL limits and extensions */
|
||||
st_init_limits(st);
|
||||
st_init_extensions(st);
|
||||
|
|
@ -188,8 +203,6 @@ static void st_destroy_context_priv( struct st_context *st )
|
|||
st_destroy_drawtex(st);
|
||||
#endif
|
||||
|
||||
_vbo_DestroyContext(st->ctx);
|
||||
|
||||
for (i = 0; i < Elements(st->state.sampler_texture); i++) {
|
||||
pipe_texture_reference(&st->state.sampler_texture[i], NULL);
|
||||
}
|
||||
|
|
@ -223,6 +236,8 @@ void st_destroy_context( struct st_context *st )
|
|||
|
||||
_mesa_delete_program_cache(st->ctx, st->pixel_xfer.cache);
|
||||
|
||||
_vbo_DestroyContext(st->ctx);
|
||||
|
||||
_mesa_free_context_data(ctx);
|
||||
|
||||
st_destroy_context_priv(st);
|
||||
|
|
|
|||
|
|
@ -181,6 +181,8 @@ struct st_context
|
|||
struct blit_state *blit;
|
||||
|
||||
struct cso_context *cso_context;
|
||||
|
||||
int force_msaa;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -238,4 +240,8 @@ st_fb_orientation(const struct gl_framebuffer *fb)
|
|||
}
|
||||
|
||||
|
||||
extern int
|
||||
st_get_msaa(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -51,13 +51,12 @@ st_create_framebuffer( const __GLcontextModes *visual,
|
|||
{
|
||||
struct st_framebuffer *stfb = CALLOC_STRUCT(st_framebuffer);
|
||||
if (stfb) {
|
||||
int samples = 0;
|
||||
const char *msaa_override = _mesa_getenv("__GL_FSAA_MODE");
|
||||
int samples = st_get_msaa();
|
||||
|
||||
if (visual->sampleBuffers)
|
||||
samples = visual->samples;
|
||||
|
||||
_mesa_initialize_framebuffer(&stfb->Base, visual);
|
||||
if (visual->sampleBuffers) samples = visual->samples;
|
||||
if (msaa_override) {
|
||||
samples = _mesa_atoi(msaa_override);
|
||||
}
|
||||
|
||||
{
|
||||
/* fake frontbuffer */
|
||||
|
|
|
|||
|
|
@ -35,10 +35,13 @@
|
|||
#include "tgsi/tgsi_parse.h"
|
||||
#include "tgsi/tgsi_build.h"
|
||||
#include "tgsi/tgsi_util.h"
|
||||
#include "tgsi/tgsi_dump.h"
|
||||
#include "tgsi/tgsi_sanity.h"
|
||||
#include "st_mesa_to_tgsi.h"
|
||||
#include "shader/prog_instruction.h"
|
||||
#include "shader/prog_parameter.h"
|
||||
|
||||
#include "shader/prog_print.h"
|
||||
#include "pipe/p_debug.h"
|
||||
|
||||
/*
|
||||
* Map mesa register file to TGSI register file.
|
||||
|
|
@ -239,6 +242,15 @@ compile_instruction(
|
|||
immediateMapping,
|
||||
indirectAccess );
|
||||
|
||||
/**
|
||||
* This not at all the correct solution.
|
||||
* FIXME: Roll this up in the above map functions
|
||||
*/
|
||||
if (fullsrc->SrcRegister.File == TGSI_FILE_IMMEDIATE && fullsrc->SrcRegister.Index == ~0) {
|
||||
fullsrc->SrcRegister.File = TGSI_FILE_CONSTANT;
|
||||
fullsrc->SrcRegister.Index = inst->SrcReg[i].Index;
|
||||
}
|
||||
|
||||
/* swizzle (ext swizzle also depends on negation) */
|
||||
{
|
||||
GLuint swz[4];
|
||||
|
|
@ -980,5 +992,17 @@ tgsi_translate_mesa_program(
|
|||
maxTokens - ti );
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
if(!tgsi_sanity_check(tokens)) {
|
||||
debug_printf("Due to sanity check failure(s) above the following shader program is invalid:\n");
|
||||
debug_printf("\nOriginal program:\n%s", program->String);
|
||||
debug_printf("\nMesa program:\n");
|
||||
_mesa_print_program(program);
|
||||
debug_printf("\nTGSI program:\n");
|
||||
tgsi_dump(tokens, 0);
|
||||
assert(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ti;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,7 +409,10 @@ st_translate_fragment_program(struct st_context *st,
|
|||
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
|
||||
break;
|
||||
case FRAG_ATTRIB_FOGC:
|
||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
|
||||
if (stfp->Base.UsesPointCoord)
|
||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
||||
else
|
||||
stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
|
||||
stfp->input_semantic_index[slot] = 0;
|
||||
interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -244,12 +244,14 @@ void _vbo_DestroyContext( GLcontext *ctx )
|
|||
ctx->aelt_context = NULL;
|
||||
}
|
||||
|
||||
vbo_exec_destroy(ctx);
|
||||
if (vbo_context(ctx)) {
|
||||
vbo_exec_destroy(ctx);
|
||||
#if FEATURE_dlist
|
||||
vbo_save_destroy(ctx);
|
||||
vbo_save_destroy(ctx);
|
||||
#endif
|
||||
FREE(vbo_context(ctx));
|
||||
ctx->swtnl_im = NULL;
|
||||
FREE(vbo_context(ctx));
|
||||
ctx->swtnl_im = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue