diff options
Diffstat (limited to 'src/mesa')
46 files changed, 264 insertions, 177 deletions
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 81d026a697..833f9ad232 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -424,7 +424,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, const uint8_t * depth_bits, const uint8_t * stencil_bits, unsigned num_depth_stencil_bits, const GLenum * db_modes, unsigned num_db_modes, - const uint8_t * msaa_samples, unsigned num_msaa_modes) + const uint8_t * msaa_samples, unsigned num_msaa_modes, + GLboolean enable_accum) { static const uint8_t bits_table[4][4] = { /* R G B A */ @@ -486,7 +487,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, __GLcontextModes *modes; unsigned i, j, k, h; unsigned num_modes; - unsigned num_accum_bits = 2; + unsigned num_accum_bits = (enable_accum) ? 2 : 1; switch ( fb_type ) { case GL_UNSIGNED_BYTE_3_3_2: diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index 2aa6de66c1..02ca3feb73 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -104,7 +104,8 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type, const uint8_t * depth_bits, const uint8_t * stencil_bits, unsigned num_depth_stencil_bits, const GLenum * db_modes, unsigned num_db_modes, - const uint8_t * msaa_samples, unsigned num_msaa_modes); + const uint8_t * msaa_samples, unsigned num_msaa_modes, + GLboolean enable_accum); __DRIconfig **driConcatConfigs(__DRIconfig **a, __DRIconfig **b); diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index 6a84651479..bd1044a2bf 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -658,7 +658,7 @@ ffbFillInModes( __DRIscreen *psp, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, back_buffer_factor, - msaa_samples_array, 1); + msaa_samples_array, 1, GL_TRUE); if (configs == NULL) { fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 476c801358..1c4deef319 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -92,7 +92,7 @@ i810FillInModes( __DRIscreen *psp, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, back_buffer_factor, - msaa_samples_array, 1); + msaa_samples_array, 1, GL_TRUE); if (configs == NULL) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__ ); diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 0adee6131e..e9315a50fe 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -581,7 +581,7 @@ intelInitContext(struct intel_context *intel, GLcontext *ctx = &intel->ctx; GLcontext *shareCtx = (GLcontext *) sharedContextPrivate; __DRIscreen *sPriv = driContextPriv->driScreenPriv; - intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private; + struct intel_screen *intelScreen = sPriv->private; int bo_reuse_mode; if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx, @@ -718,11 +718,6 @@ intelInitContext(struct intel_context *intel, intel->RenderIndex = ~0; - if (intel->gen >= 4 && !intel->intelScreen->irq_active) { - _mesa_printf("IRQs not active. Exiting\n"); - exit(1); - } - intelInitExtensions(ctx); INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control); diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 36abef470a..0f0a194b3f 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -246,7 +246,7 @@ struct intel_context __DRIdrawable *driDrawable; __DRIdrawable *driReadDrawable; __DRIscreen *driScreen; - intelScreenPrivate *intelScreen; + struct intel_screen *intelScreen; /** * Configuration cache diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 301c3df17c..e2859e44f9 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -287,11 +287,6 @@ intel_region_release(struct intel_region **region_handle) region->pbo = NULL; dri_bo_unreference(region->buffer); - if (region->classic_map != NULL) { - drmUnmap(region->classic_map, - region->pitch * region->cpp * region->height); - } - free(region); } *region_handle = NULL; diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h index 535fcd7be0..860ae11bd2 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.h +++ b/src/mesa/drivers/dri/intel/intel_regions.h @@ -52,7 +52,7 @@ struct intel_buffer_object; */ struct intel_region { - dri_bo *buffer; /**< buffer manager's buffer */ + drm_intel_bo *buffer; /**< buffer manager's buffer */ GLuint refcount; /**< Reference count for region */ GLuint cpp; /**< bytes per pixel */ GLuint width; /**< in pixels */ @@ -66,7 +66,6 @@ struct intel_region uint32_t tiling; /**< Which tiling mode the region is in */ uint32_t bit_6_swizzle; /**< GEM flag for address swizzling requirement */ - drmAddress classic_map; /**< drmMap of the region when not in GEM mode */ struct intel_buffer_object *pbo; /* zero-copy uploads */ }; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index c9ef1647a3..6dc20d0fef 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -169,7 +169,7 @@ intel_get_param(__DRIscreen *psp, int param, int *value) static void intelDestroyScreen(__DRIscreen * sPriv) { - intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private; + struct intel_screen *intelScreen = sPriv->private; dri_bufmgr_destroy(intelScreen->bufmgr); driDestroyOptionInfo(&intelScreen->optionCache); @@ -283,7 +283,7 @@ intelCreateContext(const __GLcontextModes * mesaVis, void *sharedContextPrivate) { __DRIscreen *sPriv = driContextPriv->driScreenPriv; - intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private; + struct intel_screen *intelScreen = sPriv->private; #ifdef I915 if (IS_9XX(intelScreen->deviceID)) { @@ -304,7 +304,7 @@ intelCreateContext(const __GLcontextModes * mesaVis, } static GLboolean -intel_init_bufmgr(intelScreenPrivate *intelScreen) +intel_init_bufmgr(struct intel_screen *intelScreen) { __DRIscreen *spriv = intelScreen->driScrnPriv; int num_fences = 0; @@ -336,20 +336,19 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen) static const __DRIconfig **intelInitScreen2(__DRIscreen *psp) { - intelScreenPrivate *intelScreen; + struct intel_screen *intelScreen; GLenum fb_format[3]; GLenum fb_type[3]; static const GLenum back_buffer_modes[] = { - GLX_NONE, GLX_SWAP_UNDEFINED_OML, - GLX_SWAP_EXCHANGE_OML, GLX_SWAP_COPY_OML + GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML }; uint8_t depth_bits[4], stencil_bits[4], msaa_samples_array[1]; int color; __DRIconfig **configs = NULL; /* Allocate the private area */ - intelScreen = (intelScreenPrivate *) CALLOC(sizeof(intelScreenPrivate)); + intelScreen = CALLOC(sizeof *intelScreen); if (!intelScreen) { fprintf(stderr, "\nERROR! Allocating private area failed\n"); return GL_FALSE; @@ -361,8 +360,6 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp) intelScreen->driScrnPriv = psp; psp->private = (void *) intelScreen; - intelScreen->drmMinor = psp->drm_version.minor; - /* Determine chipset ID */ if (!intel_get_param(psp, I915_PARAM_CHIPSET_ID, &intelScreen->deviceID)) @@ -371,18 +368,8 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp) if (!intel_init_bufmgr(intelScreen)) return GL_FALSE; - intelScreen->irq_active = 1; psp->extensions = intelScreenExtensions; - depth_bits[0] = 0; - stencil_bits[0] = 0; - depth_bits[1] = 16; - stencil_bits[1] = 0; - depth_bits[2] = 24; - stencil_bits[2] = 0; - depth_bits[3] = 24; - stencil_bits[3] = 8; - msaa_samples_array[0] = 0; fb_format[0] = GL_RGB; @@ -397,27 +384,27 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp) depth_bits[0] = 0; stencil_bits[0] = 0; + /* Generate a rich set of useful configs that do not include an + * accumulation buffer. + */ for (color = 0; color < ARRAY_SIZE(fb_format); color++) { __DRIconfig **new_configs; int depth_factor; - /* With DRI2 right now, GetBuffers always returns a depth/stencil buffer - * with the same cpp as the drawable. So we can't support depth cpp != - * color cpp currently. + /* Starting with DRI2 protocol version 1.1 we can request a depth/stencil + * buffer that has a diffferent number of bits per pixel than the color + * buffer. This isn't yet supported here. */ if (fb_type[color] == GL_UNSIGNED_SHORT_5_6_5) { depth_bits[1] = 16; stencil_bits[1] = 0; - - depth_factor = 2; } else { depth_bits[1] = 24; - stencil_bits[1] = 0; - depth_bits[2] = 24; - stencil_bits[2] = 8; - - depth_factor = 3; + stencil_bits[1] = 8; } + + depth_factor = 2; + new_configs = driCreateConfigs(fb_format[color], fb_type[color], depth_bits, stencil_bits, @@ -425,7 +412,33 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp) back_buffer_modes, ARRAY_SIZE(back_buffer_modes), msaa_samples_array, - ARRAY_SIZE(msaa_samples_array)); + ARRAY_SIZE(msaa_samples_array), + GL_FALSE); + if (configs == NULL) + configs = new_configs; + else + configs = driConcatConfigs(configs, new_configs); + } + + /* Generate the minimum possible set of configs that include an + * accumulation buffer. + */ + for (color = 0; color < ARRAY_SIZE(fb_format); color++) { + __DRIconfig **new_configs; + + if (fb_type[color] == GL_UNSIGNED_SHORT_5_6_5) { + depth_bits[0] = 16; + stencil_bits[0] = 0; + } else { + depth_bits[0] = 24; + stencil_bits[0] = 8; + } + + new_configs = driCreateConfigs(fb_format[color], fb_type[color], + depth_bits, stencil_bits, 1, + back_buffer_modes + 1, 1, + msaa_samples_array, 1, + GL_TRUE); if (configs == NULL) configs = new_configs; else diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h index e87e306d86..c31b836552 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.h +++ b/src/mesa/drivers/dri/intel/intel_screen.h @@ -34,46 +34,14 @@ #include "i915_drm.h" #include "xmlconfig.h" -/* XXX: change name or eliminate to avoid conflict with "struct - * intel_region"!!! - */ -typedef struct +struct intel_screen { - drm_handle_t handle; - drmSize size; /* region size in bytes */ - char *map; /* memory map */ - int offset; /* from start of video mem, in bytes */ - unsigned int bo_handle; /* buffer object id if available, or -1 */ - /** - * Flags if the region is tiled. - * - * Not included is Y versus X tiling. - */ - GLboolean tiled; -} intelRegion; - -typedef struct -{ - intelRegion front; - intelRegion back; - intelRegion depth; - intelRegion tex; - int deviceID; - int width; - int height; - int pitch; /* common row stride, in pixels */ int logTextureGranularity; __DRIscreen *driScrnPriv; - volatile drm_i915_sarea_t *sarea; - - int drmMinor; - - int irq_active; - GLboolean no_hw; GLboolean no_vbo; @@ -84,14 +52,10 @@ typedef struct * Configuration cache with default values for all contexts */ driOptionCache optionCache; -} intelScreenPrivate; - - +}; extern GLboolean intelMapScreenRegions(__DRIscreen * sPriv); -extern void intelUnmapScreenRegions(intelScreenPrivate * intelScreen); - extern void intelDestroyContext(__DRIcontext * driContextPriv); extern GLboolean intelUnbindContext(__DRIcontext * driContextPriv); @@ -101,6 +65,4 @@ intelMakeCurrent(__DRIcontext * driContextPriv, __DRIdrawable * driDrawPriv, __DRIdrawable * driReadPriv); -extern struct intel_context *intelScreenContext(intelScreenPrivate *intelScreen); - #endif diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 6402141170..d63292edd3 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -728,7 +728,7 @@ intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname, void intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, - GLint glx_texture_format, + GLint texture_format, __DRIdrawable *dPriv) { struct gl_framebuffer *fb = dPriv->driverPrivate; @@ -758,7 +758,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, if (rb->region == NULL) return; - if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) + if (texture_format == __DRI_TEXTURE_FORMAT_RGB) internalFormat = GL_RGB; else internalFormat = GL_RGBA; @@ -788,7 +788,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, intelImage->face = target_to_face(target); intelImage->level = level; - if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) + if (texture_format == __DRI_TEXTURE_FORMAT_RGB) texImage->TexFormat = MESA_FORMAT_XRGB8888; else texImage->TexFormat = MESA_FORMAT_ARGB8888; @@ -808,7 +808,7 @@ intelSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) /* The old interface didn't have the format argument, so copy our * implementation's behavior at the time. */ - intelSetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv); + intelSetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv); } diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 5cbfb85627..4bd6dee6c0 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -119,7 +119,7 @@ mach64FillInModes( __DRIscreen *psp, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, back_buffer_factor, - msaa_samples_array, 1); + msaa_samples_array, 1, GL_TRUE); if (configs == NULL) { fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index e7813b6372..687412bca5 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -160,7 +160,7 @@ mgaFillInModes( __DRIscreen *psp, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, back_buffer_factor, - msaa_samples_array, 1); + msaa_samples_array, 1, GL_TRUE); if (configs == NULL) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__ ); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c b/src/mesa/drivers/dri/nouveau/nouveau_screen.c index de6328251e..6abab8c965 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c @@ -83,7 +83,8 @@ nouveau_get_configs(void) back_buffer_modes, Elements(back_buffer_modes), msaa_samples, - Elements(msaa_samples)); + Elements(msaa_samples), + GL_TRUE); assert(config); configs = configs ? driConcatConfigs(configs, config) diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index ef6b5a35c4..2d91802823 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -449,7 +449,7 @@ r128FillInModes( __DRIscreen *psp, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, back_buffer_factor, - msaa_samples_array, 1); + msaa_samples_array, 1, GL_TRUE); if (configs == NULL) { fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 8986191c39..6ecd46ecd9 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -360,6 +360,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, ctx->Const.Max3DTextureLevels = 9; ctx->Const.MaxCubeTextureLevels = 12; ctx->Const.MaxTextureRectSize = 2048; + ctx->Const.MaxRenderbufferSize = 2048; ctx->Const.MaxTextureMaxAnisotropy = 16.0; @@ -390,6 +391,7 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; ctx->Const.MaxDrawBuffers = 1; + ctx->Const.MaxColorAttachments = 1; _mesa_set_mvp_with_dp4( ctx, GL_TRUE ); diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index e06437bd50..1606553009 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -894,7 +894,10 @@ void r200InitState( r200ContextPtr rmesa ) } } - ALLOC_STATE( stp, polygon_stipple, STP_STATE_SIZE, "STP/stp", 0 ); + if (rmesa->radeon.radeonScreen->kernel_mm) + ALLOC_STATE( stp, polygon_stipple, STP_STATE_SIZE, "STP/stp", 0 ); + else + ALLOC_STATE( stp, never, STP_STATE_SIZE, "STP/stp", 0 ); for (i = 0; i < 6; i++) if (rmesa->radeon.radeonScreen->kernel_mm) diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 458de08522..9ccf30c3ac 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -764,7 +764,7 @@ void r200SetTexOffset(__DRIcontext * pDRICtx, GLint texname, } } -void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, +void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format, __DRIdrawable *dPriv) { struct gl_texture_unit *texUnit; @@ -781,7 +781,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo type = GL_BGRA; format = GL_UNSIGNED_BYTE; - internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4); + internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4); radeon = pDRICtx->driverPrivate; rmesa = pDRICtx->driverPrivate; @@ -832,7 +832,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo pitch_val = rb->pitch; switch (rb->cpp) { case 4: - if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) + if (texture_format == __DRI_TEXTURE_FORMAT_RGB) t->pp_txformat = tx_table_le[MESA_FORMAT_RGB888].format; else t->pp_txformat = tx_table_le[MESA_FORMAT_ARGB8888].format; @@ -862,7 +862,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo void r200SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) { - r200SetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv); + r200SetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv); } diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index d87acecdab..b0fb8e970b 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -295,7 +295,7 @@ static char *toswiz(int swiz_val) { case 2: return "B"; case 3: return "A"; case 4: return "0"; - case 5: return "1/2"; + case 5: return "H"; case 6: return "1"; case 7: return "U"; } diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index c2eb613b23..829f028950 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -121,8 +121,19 @@ static unsigned int translate_alpha_op(struct r300_fragment_program_compiler *c, static unsigned int fix_hw_swizzle(unsigned int swz) { - if (swz == 5) swz = 6; - if (swz == RC_SWIZZLE_UNUSED) swz = 4; + switch (swz) { + case RC_SWIZZLE_ZERO: + case RC_SWIZZLE_UNUSED: + swz = 4; + break; + case RC_SWIZZLE_HALF: + swz = 5; + break; + case RC_SWIZZLE_ONE: + swz = 6; + break; + } + return swz; } diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 7c21efb1de..fe2ed22dc2 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -345,11 +345,13 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen) ctx->Const.MaxTextureLevels = 13; ctx->Const.MaxCubeTextureLevels = 13; ctx->Const.MaxTextureRectSize = 4096; + ctx->Const.MaxRenderbufferSize = 4096; } else { ctx->Const.MaxTextureLevels = 12; ctx->Const.MaxCubeTextureLevels = 12; ctx->Const.MaxTextureRectSize = 2048; + ctx->Const.MaxRenderbufferSize = 2048; } ctx->Const.MinPointSize = 1.0; @@ -363,6 +365,7 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen) ctx->Const.MaxLineWidthAA = R300_LINESIZE_MAX; ctx->Const.MaxDrawBuffers = 1; + ctx->Const.MaxColorAttachments = 1; /* currently bogus data */ if (r300->options.hw_tcl_enabled) { diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 09e046859a..4ba6740e3d 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -415,7 +415,7 @@ void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname, t->pp_txpitch |= pitch_val; } -void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, __DRIdrawable *dPriv) +void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format, __DRIdrawable *dPriv) { struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; @@ -431,7 +431,7 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo type = GL_BGRA; format = GL_UNSIGNED_BYTE; - internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4); + internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4); radeon = pDRICtx->driverPrivate; rmesa = pDRICtx->driverPrivate; @@ -481,7 +481,7 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo pitch_val = rb->pitch; switch (rb->cpp) { case 4: - if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) + if (texture_format == __DRI_TEXTURE_FORMAT_RGB) t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8); else t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); @@ -520,5 +520,5 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo void r300SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) { - r300SetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv); + r300SetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv); } diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 5b7d7c28ec..f575e74c3e 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -270,6 +270,8 @@ static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen) ctx->Const.MaxLineWidthAA = 0xffff / 8.0; ctx->Const.MaxDrawBuffers = 1; /* hw supports 8 */ + ctx->Const.MaxColorAttachments = 1; + ctx->Const.MaxRenderbufferSize = 4096; /* 256 for reg-based consts, inline consts also supported */ ctx->Const.VertexProgram.MaxInstructions = 8192; /* in theory no limit */ diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 8228cd67c8..dd33ef3c6a 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -988,7 +988,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo type = GL_BGRA; format = GL_UNSIGNED_BYTE; - internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4); + internalFormat = (glx_texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4); radeon = pDRICtx->driverPrivate; rmesa = pDRICtx->driverPrivate; @@ -1037,7 +1037,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo pitch_val = rb->pitch; switch (rb->cpp) { case 4: - if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) { + if (glx_texture_format == __DRI_TEXTURE_FORMAT_RGB) { SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); @@ -1116,5 +1116,5 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo void r600SetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) { - r600SetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv); + r600SetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv); } diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index e0be74935b..a742dbcf12 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -200,7 +200,8 @@ static void r700SetupVTXConstants(GLcontext * ctx, } else { - nVBsize = paos->count * pStreamDesc->stride; + nVBsize = (paos->count - 1) * pStreamDesc->stride + + pStreamDesc->size * getTypeSize(pStreamDesc->type); } uSQ_VTX_CONSTANT_WORD0_0 = paos->offset; @@ -218,11 +219,11 @@ static void r700SetupVTXConstants(GLcontext * ctx, SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_NORM, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); } - //else - //{ - // SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_INT, - // SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); - //} + else + { + SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_SCALED, + SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); + } if(1 == pStreamDesc->_signed) { diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h b/src/mesa/drivers/dri/radeon/radeon_common.h index f31f08edf3..cd01c9984e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.h +++ b/src/mesa/drivers/dri/radeon/radeon_common.h @@ -48,6 +48,9 @@ void radeon_check_front_buffer_rendering(GLcontext *ctx); static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb) { struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb; + radeon_print(RADEON_MEMORY, RADEON_TRACE, + "%s(rb %p)\n", + __func__, rb); if (rrb && rrb->base.ClassID == RADEON_RB_CLASS) return rrb; else @@ -56,6 +59,10 @@ static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbu static inline struct radeon_renderbuffer *radeon_get_renderbuffer(struct gl_framebuffer *fb, int att_index) { + radeon_print(RADEON_MEMORY, RADEON_TRACE, + "%s(fb %p, index %d)\n", + __func__, fb, att_index); + if (att_index >= 0) return radeon_renderbuffer(fb->Attachment[att_index].Renderbuffer); else diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 475e93bc05..4625af14ad 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -317,6 +317,8 @@ r100CreateContext( const __GLcontextModes *glVisual, rmesa->boxes = 0; ctx->Const.MaxDrawBuffers = 1; + ctx->Const.MaxColorAttachments = 1; + ctx->Const.MaxRenderbufferSize = 2048; _mesa_set_mvp_with_dp4( ctx, GL_TRUE ); diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index e780b9eef1..56dcc50785 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -29,6 +29,7 @@ #include "main/imports.h" #include "main/macros.h" #include "main/mtypes.h" +#include "main/enums.h" #include "main/fbobject.h" #include "main/framebuffer.h" #include "main/renderbuffer.h" @@ -56,6 +57,10 @@ radeon_delete_renderbuffer(struct gl_renderbuffer *rb) { struct radeon_renderbuffer *rrb = radeon_renderbuffer(rb); + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s(rb %p, rrb %p) \n", + __func__, rb, rrb); + ASSERT(rrb); if (rrb && rrb->bo) { @@ -68,6 +73,10 @@ static void * radeon_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s(%p, rb %p) \n", + __func__, ctx, rb); + return NULL; } @@ -85,6 +94,10 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, GLboolean software_buffer = GL_FALSE; int cpp; + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s(%p, rb %p) \n", + __func__, ctx, rb); + ASSERT(rb->Name != 0); switch (internalFormat) { case GL_R3_G3_B2: @@ -200,6 +213,10 @@ radeon_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->Width = width; rb->Height = height; rb->InternalFormat = internalFormat; + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s(%p, rb %p) \n", + __func__, ctx, rb); + return GL_TRUE; } @@ -212,6 +229,10 @@ radeon_resize_buffers(GLcontext *ctx, struct gl_framebuffer *fb, struct radeon_framebuffer *radeon_fb = (struct radeon_framebuffer*)fb; int i; + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s(%p, fb %p) \n", + __func__, ctx, fb); + _mesa_resize_framebuffer(ctx, fb, width, height); fb->Initialized = GL_TRUE; /* XXX remove someday */ @@ -252,6 +273,11 @@ radeon_create_renderbuffer(gl_format format, __DRIdrawable *driDrawPriv) struct radeon_renderbuffer *rrb; rrb = CALLOC_STRUCT(radeon_renderbuffer); + + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s( rrb %p ) \n", + __func__, rrb); + if (!rrb) return NULL; @@ -331,6 +357,11 @@ radeon_new_renderbuffer(GLcontext * ctx, GLuint name) struct radeon_renderbuffer *rrb; rrb = CALLOC_STRUCT(radeon_renderbuffer); + + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s(%p, rrb %p) \n", + __func__, ctx, rrb); + if (!rrb) return NULL; @@ -348,6 +379,11 @@ static void radeon_bind_framebuffer(GLcontext * ctx, GLenum target, struct gl_framebuffer *fb, struct gl_framebuffer *fbread) { + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s(%p, fb %p, target %s) \n", + __func__, ctx, fb, + _mesa_lookup_enum_by_nr(target)); + if (target == GL_FRAMEBUFFER_EXT || target == GL_DRAW_FRAMEBUFFER_EXT) { radeon_draw_buffer(ctx, fb); } @@ -365,6 +401,10 @@ radeon_framebuffer_renderbuffer(GLcontext * ctx, if (ctx->Driver.Flush) ctx->Driver.Flush(ctx); /* +r6/r7 */ + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s(%p, fb %p, rb %p) \n", + __func__, ctx, fb, rb); + _mesa_framebuffer_renderbuffer(ctx, fb, attachment, rb); radeon_draw_buffer(ctx, fb); } @@ -383,6 +423,10 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, int retry = 0; gl_format texFormat; + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s(%p, rrb %p, texImage %p) \n", + __func__, ctx, rrb, texImage); + restart: if (texImage->TexFormat == _dri_texformat_argb8888) { rrb->base.DataType = GL_UNSIGNED_BYTE; @@ -453,6 +497,11 @@ radeon_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage) /* make an radeon_renderbuffer to wrap the texture image */ rrb = CALLOC_STRUCT(radeon_renderbuffer); + + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s(%p, rrb %p, texImage %p) \n", + __func__, ctx, rrb, texImage); + if (!rrb) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glFramebufferTexture"); return NULL; @@ -480,6 +529,10 @@ radeon_render_texture(GLcontext * ctx, radeon_texture_image *radeon_image; GLuint imageOffset; + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s(%p, fb %p, rrb %p, att %p)\n", + __func__, ctx, fb, rrb, att); + (void) fb; ASSERT(newImage); diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 93b6399a66..631f729048 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -293,18 +293,18 @@ radeonFillInModes( __DRIscreen *psp, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, back_buffer_factor, msaa_samples_array, - 1); + 1, GL_TRUE); configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, depth_bits_array, stencil_bits_array, 1, back_buffer_modes, 1, - msaa_samples_array, 1); + msaa_samples_array, 1, GL_TRUE); configs = driConcatConfigs(configs_r5g6b5, configs_a8r8g8b8); } else configs = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, back_buffer_factor, - msaa_samples_array, 1); + msaa_samples_array, 1, GL_TRUE); if (configs == NULL) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", @@ -1676,7 +1676,8 @@ __DRIconfig **radeonInitScreen2(__DRIscreen *psp) back_buffer_modes, ARRAY_SIZE(back_buffer_modes), msaa_samples_array, - ARRAY_SIZE(msaa_samples_array)); + ARRAY_SIZE(msaa_samples_array), + GL_TRUE); if (configs == NULL) configs = new_configs; else diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 8db3d2b143..1adb609603 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -810,6 +810,10 @@ static void map_unmap_rb(struct gl_renderbuffer *rb, int flag) if (rrb == NULL || !rrb->bo) return; + radeon_print(RADEON_MEMORY, RADEON_TRACE, + "%s( rb %p, flag %s )\n", + __func__, rb, flag ? "true":"false"); + if (flag) { radeon_bo_wait(rrb->bo); r = radeon_bo_map(rrb->bo, 1); @@ -832,6 +836,10 @@ radeon_map_unmap_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, { GLuint i, j; + radeon_print(RADEON_MEMORY, RADEON_TRACE, + "%s( %p , fb %p, map %s )\n", + __func__, ctx, fb, map ? "true":"false"); + /* color draw buffers */ for (j = 0; j < ctx->DrawBuffer->_NumColorDrawBuffers; j++) map_unmap_rb(fb->_ColorDrawBuffers[j], map); diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 84ddcfd4fd..f852116dee 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -639,7 +639,7 @@ void radeonSetTexOffset(__DRIcontext * pDRICtx, GLint texname, } } -void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_format, +void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format, __DRIdrawable *dPriv) { struct gl_texture_unit *texUnit; @@ -656,7 +656,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_ type = GL_BGRA; format = GL_UNSIGNED_BYTE; - internalFormat = (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT ? 3 : 4); + internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4); radeon = pDRICtx->driverPrivate; rmesa = pDRICtx->driverPrivate; @@ -705,7 +705,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_ t->override_offset = 0; switch (rb->cpp) { case 4: - if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) + if (texture_format == __DRI_TEXTURE_FORMAT_RGB) t->pp_txformat = tx_table[MESA_FORMAT_RGB888].format; else t->pp_txformat = tx_table[MESA_FORMAT_ARGB8888].format; @@ -740,7 +740,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_ void radeonSetTexBuffer(__DRIcontext *pDRICtx, GLint target, __DRIdrawable *dPriv) { - radeonSetTexBuffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv); + radeonSetTexBuffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv); } diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 86b213c05c..9b9d90bdd0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -129,6 +129,10 @@ static void teximage_set_map_data(radeon_texture_image *image) */ void radeon_teximage_map(radeon_texture_image *image, GLboolean write_enable) { + radeon_print(RADEON_TEXTURE, RADEON_VERBOSE, + "%s(img %p), write_enable %s.\n", + __func__, image, + write_enable ? "true": "false"); if (image->mt) { assert(!image->base.Data); @@ -140,6 +144,9 @@ void radeon_teximage_map(radeon_texture_image *image, GLboolean write_enable) void radeon_teximage_unmap(radeon_texture_image *image) { + radeon_print(RADEON_TEXTURE, RADEON_VERBOSE, + "%s(img %p)\n", + __func__, image); if (image->mt) { assert(image->base.Data); @@ -275,6 +282,11 @@ void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_objec radeon_texture_image *baseimage = get_radeon_texture_image(texObj->Image[face][texObj->BaseLevel]); bo = !baseimage->mt ? baseimage->bo : baseimage->mt->bo; + radeon_print(RADEON_TEXTURE, RADEON_TRACE, + "%s(%p, target %s, tex %p)\n", + __func__, ctx, _mesa_lookup_enum_by_nr(target), + texObj); + if (bo && radeon_bo_is_referenced_by_cs(bo, rmesa->cmdbuf.cs)) { radeon_print(RADEON_TEXTURE, RADEON_NORMAL, "%s(%p, tex %p) Trying to generate mipmap for texture " diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 8e879ca41c..74a001b789 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -939,7 +939,7 @@ savageFillInModes( __DRIscreen *psp, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, back_buffer_factor, - msaa_samples_array, 1); + msaa_samples_array, 1, GL_TRUE); if (configs == NULL) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__ ); diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index cb7ed8a08b..80fb455ec7 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -103,7 +103,7 @@ sisFillInModes(__DRIscreen *psp, int bpp) configs = driCreateConfigs(fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, back_buffer_factor, - msaa_samples_array, 1); + msaa_samples_array, 1, GL_TRUE); if (configs == NULL) { fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); return NULL; diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 4e823669bf..40535b03b9 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -132,7 +132,8 @@ swrastFillInModes(__DRIscreen *psp, configs = driCreateConfigs(fb_format, fb_type, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, - back_buffer_factor, msaa_samples_array, 1); + back_buffer_factor, msaa_samples_array, 1, + GL_TRUE); if (configs == NULL) { fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 9f6b35faa2..d554bcdc92 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -383,7 +383,8 @@ tdfxFillInModes(__DRIscreen *psp, stencil_bits_array, deep ? 2 : 4, db_modes, 2, - msaa_samples_array, 1); + msaa_samples_array, 1, + GL_TRUE); } /** diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 8c91c937c6..ee10b569bf 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -354,7 +354,7 @@ viaFillInModes( __DRIscreen *psp, depth_bits_array, stencil_bits_array, depth_buffer_factor, back_buffer_modes, back_buffer_factor, - msaa_samples_array, 1); + msaa_samples_array, 1, GL_TRUE); if (configs == NULL) { fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__); diff --git a/src/mesa/drivers/windows/gdi/mesa.def b/src/mesa/drivers/windows/gdi/mesa.def index 700e333429..a31dc55e3f 100644 --- a/src/mesa/drivers/windows/gdi/mesa.def +++ b/src/mesa/drivers/windows/gdi/mesa.def @@ -869,6 +869,7 @@ EXPORTS _mesa_add_renderbuffer _mesa_bzero _mesa_calloc + _mesa_check_conditional_render _mesa_choose_tex_format _mesa_create_framebuffer _mesa_create_visual diff --git a/src/mesa/glapi/glapi.h b/src/mesa/glapi/glapi.h index 47ea23e92b..f802a61d3b 100644 --- a/src/mesa/glapi/glapi.h +++ b/src/mesa/glapi/glapi.h @@ -46,8 +46,6 @@ #define GL_GLEXT_PROTOTYPES -#include "GL/gl.h" -#include "GL/glext.h" #include "glthread.h" @@ -136,7 +134,7 @@ struct _glapi_table * _glapi_get_override_dispatch(int layer); -extern GLuint +extern unsigned int _glapi_get_dispatch_table_size(void); @@ -148,7 +146,7 @@ extern int _glapi_add_dispatch( const char * const * function_names, const char * parameter_signature ); -extern GLint +extern int _glapi_get_proc_offset(const char *funcName); @@ -157,7 +155,7 @@ _glapi_get_proc_address(const char *funcName); extern const char * -_glapi_get_proc_name(GLuint offset); +_glapi_get_proc_name(unsigned int offset); #endif diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 591aa1121d..c292d1fea5 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -495,12 +495,6 @@ _mesa_init_constants(GLcontext *ctx) { assert(ctx); - assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS); - assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS); - - /* Max texture size should be <= max viewport size (render to texture) */ - assert((1 << (MAX_TEXTURE_LEVELS - 1)) <= MAX_WIDTH); - /* Constants, may be overriden (usually only reduced) by device drivers */ ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS; ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS; @@ -571,26 +565,6 @@ _mesa_init_constants(GLcontext *ctx) /* GL_EXT_provoking_vertex */ ctx->Const.QuadsFollowProvokingVertexConvention = GL_TRUE; - - /* sanity checks */ - ASSERT(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.MaxTextureImageUnits, - ctx->Const.MaxTextureCoordUnits)); - ASSERT(ctx->Const.FragmentProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS); - ASSERT(ctx->Const.VertexProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS); - ASSERT(ctx->Const.MaxCombinedTextureImageUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS); - ASSERT(ctx->Const.MaxTextureCoordUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS); - ASSERT(MAX_COMBINED_TEXTURE_IMAGE_UNITS <= 32); /* GLbitfield size limit */ - - ASSERT(MAX_NV_FRAGMENT_PROGRAM_TEMPS <= MAX_PROGRAM_TEMPS); - ASSERT(MAX_NV_VERTEX_PROGRAM_TEMPS <= MAX_PROGRAM_TEMPS); - ASSERT(MAX_NV_VERTEX_PROGRAM_INPUTS <= VERT_ATTRIB_MAX); - ASSERT(MAX_NV_VERTEX_PROGRAM_OUTPUTS <= VERT_RESULT_MAX); - - /* check that we don't exceed the size of various bitfields */ - ASSERT(VERT_RESULT_MAX <= - (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten))); - ASSERT(FRAG_ATTRIB_MAX <= - (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead))); } @@ -601,17 +575,41 @@ _mesa_init_constants(GLcontext *ctx) static void check_context_limits(GLcontext *ctx) { - /* Many context limits/constants are limited by the size of - * internal arrays. - */ + /* check that we don't exceed the size of various bitfields */ + assert(VERT_RESULT_MAX <= + (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten))); + assert(FRAG_ATTRIB_MAX <= + (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead))); + + assert(MAX_COMBINED_TEXTURE_IMAGE_UNITS <= 8 * sizeof(GLbitfield)); + + /* shader-related checks */ + assert(ctx->Const.FragmentProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS); + assert(ctx->Const.VertexProgram.MaxLocalParams <= MAX_PROGRAM_LOCAL_PARAMS); + + assert(MAX_NV_FRAGMENT_PROGRAM_TEMPS <= MAX_PROGRAM_TEMPS); + assert(MAX_NV_VERTEX_PROGRAM_TEMPS <= MAX_PROGRAM_TEMPS); + assert(MAX_NV_VERTEX_PROGRAM_INPUTS <= VERT_ATTRIB_MAX); + assert(MAX_NV_VERTEX_PROGRAM_OUTPUTS <= VERT_RESULT_MAX); + + /* Texture unit checks */ + assert(ctx->Const.MaxTextureImageUnits > 0); assert(ctx->Const.MaxTextureImageUnits <= MAX_TEXTURE_IMAGE_UNITS); + assert(ctx->Const.MaxTextureCoordUnits > 0); assert(ctx->Const.MaxTextureCoordUnits <= MAX_TEXTURE_COORD_UNITS); + assert(ctx->Const.MaxTextureUnits > 0); assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_IMAGE_UNITS); assert(ctx->Const.MaxTextureUnits <= MAX_TEXTURE_COORD_UNITS); - + assert(ctx->Const.MaxTextureUnits == MIN2(ctx->Const.MaxTextureImageUnits, + ctx->Const.MaxTextureCoordUnits)); + assert(ctx->Const.MaxCombinedTextureImageUnits > 0); + assert(ctx->Const.MaxCombinedTextureImageUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS); + assert(ctx->Const.MaxTextureCoordUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS); /* number of coord units cannot be greater than number of image units */ assert(ctx->Const.MaxTextureCoordUnits <= ctx->Const.MaxTextureImageUnits); + + /* Texture size checks */ assert(ctx->Const.MaxTextureLevels <= MAX_TEXTURE_LEVELS); assert(ctx->Const.Max3DTextureLevels <= MAX_3D_TEXTURE_LEVELS); assert(ctx->Const.MaxCubeTextureLevels <= MAX_CUBE_TEXTURE_LEVELS); @@ -622,6 +620,13 @@ check_context_limits(GLcontext *ctx) assert((1 << (ctx->Const.MaxCubeTextureLevels - 1)) <= MAX_WIDTH); assert((1 << (ctx->Const.Max3DTextureLevels - 1)) <= MAX_WIDTH); + /* Texture level checks */ + assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS); + assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS); + + /* Max texture size should be <= max viewport size (render to texture) */ + assert((1 << (MAX_TEXTURE_LEVELS - 1)) <= MAX_WIDTH); + assert(ctx->Const.MaxViewportWidth <= MAX_WIDTH); assert(ctx->Const.MaxViewportHeight <= MAX_WIDTH); diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index fcd0a56d76..78612b0856 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2678,7 +2678,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_z24_s8(TEXSTORE_PARAMS) { - const GLfloat depthScale = (GLfloat) 0xffffff; + const GLuint depthScale = 0xffffff; const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType) / sizeof(GLuint); @@ -2752,7 +2752,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) _mesa_unpack_depth_span(ctx, srcWidth, GL_UNSIGNED_INT_24_8_EXT, /* dst type */ dstRow, /* dst addr */ - (GLuint) depthScale, + depthScale, srcType, src, srcPacking); /* get the 8-bit stencil values */ _mesa_unpack_stencil_span(ctx, srcWidth, diff --git a/src/mesa/shader/slang/library/SConscript b/src/mesa/shader/slang/library/SConscript index ef131146be..0b25467a4e 100644 --- a/src/mesa/shader/slang/library/SConscript +++ b/src/mesa/shader/slang/library/SConscript @@ -12,13 +12,13 @@ def glsl_compile_emitter(target, source, env): return (target, source) bld_frag = Builder( - action = glsl_compile[0].abspath + ' fragment $SOURCE $TARGET', + action = Action(glsl_compile[0].abspath + ' fragment $SOURCE $TARGET', '$CODEGENCODESTR'), emitter = glsl_compile_emitter, suffix = '.gc', src_suffix = '_gc.h') bld_vert = Builder( - action = glsl_compile[0].abspath + ' vertex $SOURCE $TARGET', + action = Action(glsl_compile[0].abspath + ' vertex $SOURCE $TARGET', '$CODEGENCODESTR'), emitter = glsl_compile_emitter, suffix = '.gc', src_suffix = '_gc.h') diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 63d10f4597..852274119c 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -2608,8 +2608,8 @@ compile_with_grammar(const char *source, return GL_FALSE; } - if (sl_pp_context_add_extension(context, "ARB_draw_buffers", "GL_ARB_draw_buffers") || - sl_pp_context_add_extension(context, "ARB_texture_rectangle", "GL_ARB_texture_rectangle")) { + if (sl_pp_context_add_extension(context, "GL_ARB_draw_buffers") || + sl_pp_context_add_extension(context, "GL_ARB_texture_rectangle")) { slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context)); sl_pp_context_destroy(context); return GL_FALSE; diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 85420a950f..25430bba77 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -637,7 +637,7 @@ accum_bitmap(struct st_context *st, const GLubyte *bitmap ) { struct bitmap_cache *cache = st->bitmap.cache; - int px = -999, py; + int px = -999, py = -999; const GLfloat z = st->ctx->Current.RasterPos[2]; if (width > BITMAP_CACHE_WIDTH || @@ -671,6 +671,7 @@ accum_bitmap(struct st_context *st, } assert(px != -999); + assert(py != -999); if (x < cache->xmin) cache->xmin = x; diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 9f2fe7420d..4638879fc2 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -37,6 +37,7 @@ #include "main/context.h" #include "main/fbobject.h" #include "main/framebuffer.h" +#include "main/macros.h" #include "main/renderbuffer.h" #include "pipe/p_context.h" @@ -340,12 +341,17 @@ st_render_texture(GLcontext *ctx, struct gl_renderbuffer *rb; struct pipe_texture *pt = st_get_texobj_texture(att->Texture); struct st_texture_object *stObj; - const struct gl_texture_image *texImage = - att->Texture->Image[att->CubeMapFace][att->TextureLevel]; + const struct gl_texture_image *texImage; + GLint pt_level; + /* When would this fail? Perhaps assert? */ if (!pt) return; + /* The first gallium texture level = Mesa BaseLevel */ + pt_level = MAX2(0, (GLint) att->TextureLevel - att->Texture->BaseLevel); + texImage = att->Texture->Image[att->CubeMapFace][pt_level]; + /* create new renderbuffer which wraps the texture image */ rb = st_new_renderbuffer(ctx, 0); if (!rb) { @@ -365,7 +371,7 @@ st_render_texture(GLcontext *ctx, /* point renderbuffer at texobject */ strb->rtt = stObj; - strb->rtt_level = att->TextureLevel; + strb->rtt_level = pt_level; strb->rtt_face = att->CubeMapFace; strb->rtt_slice = att->Zoffset; @@ -380,6 +386,8 @@ st_render_texture(GLcontext *ctx, pipe_surface_reference(&strb->surface, NULL); + assert(strb->rtt_level <= strb->texture->last_level); + /* new surface for rendering into the texture */ strb->surface = screen->get_tex_surface(screen, strb->texture, diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h index 8484aab5a9..d9bf54dd46 100644 --- a/src/mesa/swrast_setup/ss_tritmp.h +++ b/src/mesa/swrast_setup/ss_tritmp.h @@ -40,7 +40,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) GLfloat offset, oz0, oz1, oz2; GLenum mode = GL_FILL; GLuint facing = 0; - GLchan saved_color[3][4]; + GLchan saved_color[3][4] = { { 0 } }; GLfloat saved_col0[3][4] = { { 0 } }; GLfloat saved_spec[3][4] = { { 0 } }; GLfloat saved_index[3] = { 0 }; |