Re: [Mesa-dev] [PATCH 01/13] gallium: add PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS
On 05.09.2011 23:44, Marek Olšák wrote: > --- > src/gallium/include/pipe/p_defines.h |1 + > src/mesa/state_tracker/st_extensions.c |3 +++ > 2 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/src/gallium/include/pipe/p_defines.h > b/src/gallium/include/pipe/p_defines.h > index 19c0cab..9a9ce2e 100644 > --- a/src/gallium/include/pipe/p_defines.h > +++ b/src/gallium/include/pipe/p_defines.h > @@ -474,6 +474,7 @@ enum pipe_cap { > PIPE_CAP_SCALED_RESOLVE = 49, > PIPE_CAP_MIN_TEXEL_OFFSET = 50, > PIPE_CAP_MAX_TEXEL_OFFSET = 51, > + PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS = 52 > }; > Can we remove the old PIPE_CAP_ARRAY_TEXTURES then in favour of returning 0 as maximum number of layers ? > /* Shader caps not specific to any single stage */ > diff --git a/src/mesa/state_tracker/st_extensions.c > b/src/mesa/state_tracker/st_extensions.c > index aa7f3b5..122ffab 100644 > --- a/src/mesa/state_tracker/st_extensions.c > +++ b/src/mesa/state_tracker/st_extensions.c > @@ -85,6 +85,9 @@ void st_init_limits(struct st_context *st) > c->MaxTextureRectSize >= _min(1 << (c->MaxTextureLevels - 1), MAX_TEXTURE_RECT_SIZE); > > + c->MaxArrayTextureLayers > + = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS); > + > c->MaxTextureImageUnits >= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS), > MAX_TEXTURE_IMAGE_UNITS); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 40401] Cogs is slow
https://bugs.freedesktop.org/show_bug.cgi?id=40401 Niels Ole Salscheider changed: What|Removed |Added CC||niels_ole@salscheider-onlin ||e.de -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/13] gallium: add PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS
- Original Message - > On 05.09.2011 23:44, Marek Olšák wrote: > > --- > > src/gallium/include/pipe/p_defines.h |1 + > > src/mesa/state_tracker/st_extensions.c |3 +++ > > 2 files changed, 4 insertions(+), 0 deletions(-) > > > > diff --git a/src/gallium/include/pipe/p_defines.h > > b/src/gallium/include/pipe/p_defines.h > > index 19c0cab..9a9ce2e 100644 > > --- a/src/gallium/include/pipe/p_defines.h > > +++ b/src/gallium/include/pipe/p_defines.h > > @@ -474,6 +474,7 @@ enum pipe_cap { > > PIPE_CAP_SCALED_RESOLVE = 49, > > PIPE_CAP_MIN_TEXEL_OFFSET = 50, > > PIPE_CAP_MAX_TEXEL_OFFSET = 51, > > + PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS = 52 > > }; > > > Can we remove the old PIPE_CAP_ARRAY_TEXTURES then in favour of > returning 0 as maximum number of layers ? I'd like that too FWIW. Jose ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] glsl/builtins: Fix invalid vecN constants in hyperbolic functions.
On 5 September 2011 12:24, Kenneth Graunke wrote: > Each of these vecN constants only provided one component, which is > illegal. The printed IR is meant to contain exactly as many components > as are necessary; the IR reader does not splat single values. > > Signed-off-by: Kenneth Graunke > --- > src/glsl/builtins/ir/acosh |6 +++--- > src/glsl/builtins/ir/asinh |6 +++--- > src/glsl/builtins/ir/atanh | 18 +- > src/glsl/builtins/ir/cosh |6 +++--- > src/glsl/builtins/ir/sinh |6 +++--- > 5 files changed, 21 insertions(+), 21 deletions(-) > > diff --git a/src/glsl/builtins/ir/acosh b/src/glsl/builtins/ir/acosh > index 5518e75..9a4c291 100644 > --- a/src/glsl/builtins/ir/acosh > +++ b/src/glsl/builtins/ir/acosh > @@ -7,15 +7,15 @@ >(signature vec2 > (parameters >(declare (in) vec2 x)) > - ((return (expression vec2 log (expression vec2 + (var_ref x) > (expression vec2 sqrt (expression vec2 - (expression vec2 * (var_ref x) > (var_ref x)) (constant vec2 (1) > + ((return (expression vec2 log (expression vec2 + (var_ref x) > (expression vec2 sqrt (expression vec2 - (expression vec2 * (var_ref x) > (var_ref x)) (constant float (1) > >(signature vec3 > (parameters >(declare (in) vec3 x)) > - ((return (expression vec3 log (expression vec3 + (var_ref x) > (expression vec3 sqrt (expression vec3 - (expression vec3 * (var_ref x) > (var_ref x)) (constant vec3 (1) > + ((return (expression vec3 log (expression vec3 + (var_ref x) > (expression vec3 sqrt (expression vec3 - (expression vec3 * (var_ref x) > (var_ref x)) (constant float (1) > >(signature vec4 > (parameters >(declare (in) vec4 x)) > - ((return (expression vec4 log (expression vec4 + (var_ref x) > (expression vec4 sqrt (expression vec4 - (expression vec4 * (var_ref x) > (var_ref x)) (constant vec4 (1) > + ((return (expression vec4 log (expression vec4 + (var_ref x) > (expression vec4 sqrt (expression vec4 - (expression vec4 * (var_ref x) > (var_ref x)) (constant float (1) > )) > diff --git a/src/glsl/builtins/ir/asinh b/src/glsl/builtins/ir/asinh > index cdc2c20..93f73cc 100644 > --- a/src/glsl/builtins/ir/asinh > +++ b/src/glsl/builtins/ir/asinh > @@ -7,15 +7,15 @@ >(signature vec2 > (parameters >(declare (in) vec2 x)) > - ((return (expression vec2 log (expression vec2 + (var_ref x) > (expression vec2 sqrt (expression vec2 + (expression vec2 * (var_ref x) > (var_ref x)) (constant vec2 (1) > + ((return (expression vec2 log (expression vec2 + (var_ref x) > (expression vec2 sqrt (expression vec2 + (expression vec2 * (var_ref x) > (var_ref x)) (constant float (1) > >(signature vec3 > (parameters >(declare (in) vec3 x)) > - ((return (expression vec3 log (expression vec3 + (var_ref x) > (expression vec3 sqrt (expression vec3 + (expression vec3 * (var_ref x) > (var_ref x)) (constant vec3 (1) > + ((return (expression vec3 log (expression vec3 + (var_ref x) > (expression vec3 sqrt (expression vec3 + (expression vec3 * (var_ref x) > (var_ref x)) (constant float (1) > >(signature vec4 > (parameters >(declare (in) vec4 x)) > - ((return (expression vec4 log (expression vec4 + (var_ref x) > (expression vec4 sqrt (expression vec4 + (expression vec4 * (var_ref x) > (var_ref x)) (constant vec4 (1) > + ((return (expression vec4 log (expression vec4 + (var_ref x) > (expression vec4 sqrt (expression vec4 + (expression vec4 * (var_ref x) > (var_ref x)) (constant float (1) > )) > diff --git a/src/glsl/builtins/ir/atanh b/src/glsl/builtins/ir/atanh > index 5559e97..5ef3596 100644 > --- a/src/glsl/builtins/ir/atanh > +++ b/src/glsl/builtins/ir/atanh > @@ -11,27 +11,27 @@ >(signature vec2 > (parameters >(declare (in) vec2 x)) > - ((return (expression vec2 * (constant vec2 (0.5)) > + ((return (expression vec2 * (constant float (0.5)) > (expression vec2 log > (expression vec2 / > -(expression vec2 + (constant vec2 (1)) (var_ref x)) > -(expression vec2 - (constant vec2 (1)) (var_ref > x > +(expression vec2 + (constant float (1)) (var_ref x)) > +(expression vec2 - (constant float (1)) (var_ref > x > >(signature vec3 > (parameters >(declare (in) vec3 x)) > - ((return (expression vec3 * (constant vec3 (0.5)) > + ((return (expression vec3 * (constant float (0.5)) > (expression vec3 log > (expression vec3 / > -(expression vec3 + (constant vec3 (1)) (var_ref x)) > -(expression vec3 - (constant vec3 (1)) (var_ref > x > +(expression vec3 + (constant float (1)) (var_ref x)) > +(expression vec3 - (constant float (1)) (v
Re: [Mesa-dev] [PATCH] mesa: add a UniformBooleanTrue option
On Mon, 5 Sep 2011 14:59:03 -0500, Bryan Cain wrote: > Drivers supporting native integers set UniformBooleanTrue to the integer value > that should be used for true when uploading uniform booleans. This is ~0 for > Gallium and 1 for i965. Looks good. Reviewed-by: Eric Anholt pgpm1u1Bwud8c.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: fix the constant interp bitmask for flat mode
On Tue, 6 Sep 2011 09:34:00 +0800, Yuanhan Liu wrote: > Fix the constant interpolation enable bit mask for flat light mode. > FRAG_BIT_COL0 attribute bit might be 0, in which case we need to > shift one more bit right. > > This would fix the oglc specularColor test fail on both Sandybridge and > Ivybridge. > > v2: move the constant interp bitmask setup code into for(; attr < > FRAG_ATTRIB_MAX; attr++) loop suggested by Eric. Reviewed-by: Eric Anholt pgp5RYx0RGMGj.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: fix the constant interp bitmask for flat mode
On 09/05/2011 06:34 PM, Yuanhan Liu wrote: > Fix the constant interpolation enable bit mask for flat light mode. > FRAG_BIT_COL0 attribute bit might be 0, in which case we need to > shift one more bit right. > > This would fix the oglc specularColor test fail on both Sandybridge and > Ivybridge. > > v2: move the constant interp bitmask setup code into for(; attr < > FRAG_ATTRIB_MAX; attr++) loop suggested by Eric. > > Signed-off-by: Yuanhan Liu > Signed-off-by: Xiang, Haihao Reviewed-by: Kenneth Graunke ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] new-vs on gen4
On 09/02/2011 06:37 PM, Eric Anholt wrote: > This series gets gen4 to be non-regressing for the new vertex shader. > I'd be fine with not pushing the last patch and letting Paul's patches > land, then fixing the bug as it remains there. Once these two land, I > think it's time to turn on the new backend by default. For the series: Reviewed-by: Kenneth Graunke ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [RFC 0/3] Fix several segmentation faults related to depth buffer
On Mon, Sep 5, 2011 at 16:37, Alon Levy wrote: > Fixes three segmentation faults where it is wrongly assumed the depth > buffer's > renderbuffer's region is not NULL. > > 735794 - verified to be fixed by these three patches (these three apply > to 7.11 almost cleanly, just the second requires minor changes). > > Related RHBZs (maybe solved as well, didn't reproduce): > 734183 - [abrt] gnome-shell-3.1.4-2.gite7b9933.fc16: prepare_depthbuffer > 717140 -[abrt] compiz-0.9.4-2.fc15: prepare_depthbuffer > > Alon Levy (3): > i965: prepare_depthbuffer: fix segfault, rhbz#735794 > i965: prepare_depthbuffer: don't update NULL region'ed surface, >rhbz#735794 > i965: emit_depthbuffer: fix segfault, rhbz#735794 > > src/mesa/drivers/dri/i965/brw_misc_state.c |7 +-- > src/mesa/drivers/dri/i965/brw_wm_surface_state.c |3 +++ > 2 files changed, 8 insertions(+), 2 deletions(-) > > Hi Alon, those patches fix the crash you are having, but I am wondering why the crash happened in the first place. E.g., we should not get to the situation where region is NULL under normal cases. >From what it looks like, it could happen when GPU was hung for example. Could you open a bug on freedesktop.org bugzilla and attach dmesg and /sys/kernel/debug/dri/0/i915_error_state, so we could look into it further? -- Eugeni Dodonov ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/11] mesa: Remove API facing bits of EXT_paletted_texture and EXT_shared_texture_palette
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 08/31/2011 08:36 PM, Brian Paul wrote: > On 08/31/2011 02:21 PM, Ian Romanick wrote: >> From: Ian Romanick >> >> This was also discussed at XDS 2010. However, actually making the >> change was delayed because several drivers still exposed these >> extensions to significant benefit (e.g., tdfx). Now that those >> drivers have been removed, this code can be removed as well. >> >> v2: A lot of bits that were missed in the previous patch have been >> removed. > > For the series: > Reviewed-by: Brian Paul > > I presume you've run conform on this. It tests color index in a few > ways (like CI->RGBA in glDrawPixels). Good call. :) I didn't run all of conform (I don't still have an unmodified copy), but I did run the following subtests without regression: pxtrans-cirgbtex pxstore-ci pxtrans-cidraw pxtrans-citex -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAk5mbikACgkQX1gOwKyEAw+7mQCeIkGFuicd03F/TOZnPKWdmrmt pbMAnj8XBw7D6ptcHPm8q80r7X9xEwYa =V+3W -END PGP SIGNATURE- ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/9] Stop trying to remap function offset in drivers
This is the first part of a re-spin of my previous extension refactoring patches. This series just removes the function remapping from all of the drivers. This has been handled by remap.c in core Mesa for a long time. The next patch to the list will gut most of the now-unused parts of remap_helper.h. The series after that will remove some unnecessary extension enable flags. I'll try to have a proposal for handling different GL APIs (e.g., 3.0 core vs. 3.0 forward-looking vs. ES 2.0) out later this week. None of the patches mentioned above should change this issue for Mesa in any way. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/9] intel: Enable extensions by just setting the flags
From: Ian Romanick Core Mesa already does the dispatch offset remapping for every function that could possibly ever be supported. There's no need to continue using that cruft in the driver. Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/intel/intel_extensions.c | 290 + 1 files changed, 99 insertions(+), 191 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 64c996c..880ca0d 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -32,186 +32,6 @@ #include "intel_extensions.h" #include "utils.h" - -#define need_GL_ARB_ES2_compatibility -#define need_GL_ARB_draw_elements_base_vertex -#define need_GL_ARB_framebuffer_object -#define need_GL_ARB_map_buffer_range -#define need_GL_ARB_occlusion_query -#define need_GL_ARB_point_parameters -#define need_GL_ARB_shader_objects -#define need_GL_ARB_sync -#define need_GL_ARB_vertex_array_object -#define need_GL_ARB_vertex_program -#define need_GL_ARB_vertex_shader -#define need_GL_ARB_window_pos -#define need_GL_EXT_blend_color -#define need_GL_EXT_blend_equation_separate -#define need_GL_EXT_blend_func_separate -#define need_GL_EXT_blend_minmax -#define need_GL_EXT_draw_buffers2 -#define need_GL_EXT_fog_coord -#define need_GL_EXT_framebuffer_blit -#define need_GL_EXT_framebuffer_multisample -#define need_GL_EXT_framebuffer_object -#define need_GL_EXT_gpu_program_parameters -#define need_GL_EXT_point_parameters -#define need_GL_EXT_provoking_vertex -#define need_GL_EXT_secondary_color -#define need_GL_EXT_separate_shader_objects -#define need_GL_EXT_stencil_two_side -#define need_GL_EXT_timer_query -#define need_GL_APPLE_vertex_array_object -#define need_GL_APPLE_object_purgeable -#define need_GL_ATI_separate_stencil -#define need_GL_ATI_envmap_bumpmap -#define need_GL_NV_point_sprite -#define need_GL_NV_vertex_program -#define need_GL_OES_EGL_image -#define need_GL_VERSION_2_0 -#define need_GL_VERSION_2_1 - -#include "main/remap_helper.h" - - -/** - * Extension strings exported by the intel driver. - * - * Extensions supported by all chips supported by i830_dri, i915_dri, or - * i965_dri. - */ -static const struct dri_extension card_extensions[] = { - { "GL_ARB_ES2_compatibility", GL_ARB_ES2_compatibility_functions }, - { "GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions }, - { "GL_ARB_explicit_attrib_location", NULL }, - { "GL_ARB_framebuffer_object", GL_ARB_framebuffer_object_functions}, - { "GL_ARB_half_float_pixel", NULL }, - { "GL_ARB_map_buffer_range", GL_ARB_map_buffer_range_functions }, - { "GL_ARB_multitexture", NULL }, - { "GL_ARB_pixel_buffer_object", NULL }, - { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions }, - { "GL_ARB_point_sprite", NULL }, - { "GL_ARB_sampler_objects",NULL }, - { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, - { "GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, - { "GL_ARB_sync", GL_ARB_sync_functions }, - { "GL_ARB_texture_border_clamp", NULL }, - { "GL_ARB_texture_cube_map", NULL }, - { "GL_ARB_texture_env_add",NULL }, - { "GL_ARB_texture_env_combine",NULL }, - { "GL_ARB_texture_env_crossbar", NULL }, - { "GL_ARB_texture_env_dot3", NULL }, - { "GL_ARB_texture_mirrored_repeat",NULL }, - { "GL_ARB_texture_rectangle", NULL }, - { "GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions}, - { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }, - { "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions }, - { "GL_ARB_window_pos", GL_ARB_window_pos_functions }, - { "GL_EXT_blend_color",GL_EXT_blend_color_functions }, - { "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions }, - { "GL_EXT_blend_func_separate",GL_EXT_blend_func_separate_functions }, - { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions }, - { "GL_EXT_blend_logic_op", NULL }, - { "GL_EXT_blend_subtract", NULL }, - { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, - { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, - { "GL_EXT_framebuffer_multisample", GL_EXT_framebuffer_multisample_functions }, - { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, - { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, - { "GL_EXT_packed_depth_stencil", NULL }, - { "GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions }, - { "GL_EXT_secondary_color",GL_EXT_secondary_color_functions }, - { "
[Mesa-dev] [PATCH 2/9] intel: Move S3TC extension enable bits to intel_extensions.c
From: Ian Romanick Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/intel/intel_context.c|7 --- src/mesa/drivers/dri/intel/intel_extensions.c |8 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index a05a9c3..2688d7b 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -856,13 +856,6 @@ intelInitContext(struct intel_context *intel, intel_fbo_init(intel); - if (intel->ctx.Mesa_DXTn) { - _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); - _mesa_enable_extension(ctx, "GL_S3_s3tc"); - } - else if (driQueryOptionb(&intel->optionCache, "force_s3tc_enable")) { - _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); - } intel->use_texture_tiling = driQueryOptionb(&intel->optionCache, "texture_tiling"); intel->use_early_z = driQueryOptionb(&intel->optionCache, "early_z"); diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 880ca0d..9fce737 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -166,4 +166,12 @@ intelInitExtensions(struct gl_context *ctx) if (driQueryOptionb(&intel->optionCache, "stub_occlusion_query")) ctx->Extensions.ARB_occlusion_query = true; } + + if (intel->ctx.Mesa_DXTn) { + ctx->Extensions.EXT_texture_compression_s3tc = true; + ctx->Extensions.S3_s3tc = true; + } + else if (driQueryOptionb(&intel->optionCache, "force_s3tc_enable")) { + ctx->Extensions.EXT_texture_compression_s3tc = true; + } } -- 1.7.4.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/9] nouveau: Enable extensions by just setting the flags
From: Ian Romanick Core Mesa already does the dispatch offset remapping for every function that could possibly ever be supported. There's no need to continue using that cruft in the driver. Since the call to _mesa_enable_imaging_extensions (via driInitExtensions) is removed, EXT_blend_color, EXT_blend_logic_op, EXT_blend_minmax, and EXT_blend_subtract are explicitly added to the list. Cc: Ben Skeggs Reviewed-by: Francisco Jerez Cc: Viktor Novotný --- src/mesa/drivers/dri/nouveau/nouveau_context.c | 44 ++- src/mesa/drivers/dri/nouveau/nv10_context.c| 14 +++- src/mesa/drivers/dri/nouveau/nv20_context.c| 14 +++- 3 files changed, 29 insertions(+), 43 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 22b9957..1c35578 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -24,6 +24,7 @@ * */ +#include #include "nouveau_driver.h" #include "nouveau_context.h" #include "nouveau_bufferobj.h" @@ -41,30 +42,6 @@ #include "tnl/tnl.h" #include "tnl/t_context.h" -#define need_GL_EXT_framebuffer_object -#define need_GL_EXT_fog_coord -#define need_GL_EXT_secondary_color - -#include "main/remap_helper.h" - -static const struct dri_extension nouveau_extensions[] = { - { "GL_ARB_multitexture",NULL }, - { "GL_ARB_texture_env_add", NULL }, - { "GL_ARB_texture_mirrored_repeat", NULL }, - { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, - { "GL_EXT_framebuffer_blit",NULL }, - { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, - { "GL_EXT_packed_depth_stencil", NULL}, - { "GL_EXT_secondary_color", GL_EXT_secondary_color_functions }, - { "GL_EXT_stencil_wrap",NULL }, - { "GL_EXT_texture_env_combine", NULL }, - { "GL_EXT_texture_filter_anisotropic", NULL }, - { "GL_EXT_texture_lod_bias",NULL }, - { "GL_NV_blend_square", NULL }, - { "GL_NV_texture_env_combine4", NULL }, - { NULL, NULL } -}; - static void nouveau_channel_flush_notify(struct nouveau_channel *chan) { @@ -140,7 +117,24 @@ nouveau_context_init(struct gl_context *ctx, struct nouveau_screen *screen, nctx->hw.chan->user_private = nctx; /* Enable any supported extensions. */ - driInitExtensions(ctx, nouveau_extensions, GL_TRUE); + ctx->Extensions.ARB_multitexture = true; + ctx->Extensions.ARB_texture_mirrored_repeat = true; + ctx->Extensions.EXT_blend_color = true; + ctx->Extensions.EXT_blend_logic_op = true; + ctx->Extensions.EXT_blend_minmax = true; + ctx->Extensions.EXT_blend_subtract = true; + ctx->Extensions.EXT_fog_coord = true; + ctx->Extensions.EXT_framebuffer_blit = true; + ctx->Extensions.EXT_framebuffer_object = true; + ctx->Extensions.EXT_packed_depth_stencil = true; + ctx->Extensions.EXT_secondary_color = true; + ctx->Extensions.EXT_stencil_wrap = true; + ctx->Extensions.EXT_texture_env_add = true; + ctx->Extensions.EXT_texture_env_combine = true; + ctx->Extensions.EXT_texture_filter_anisotropic = true; + ctx->Extensions.EXT_texture_lod_bias = true; + ctx->Extensions.NV_blend_square = true; + ctx->Extensions.NV_texture_env_combine4 = true; return GL_TRUE; } diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c index 8074b4b..da0ef2b 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_context.c +++ b/src/mesa/drivers/dri/nouveau/nv10_context.c @@ -24,6 +24,7 @@ * */ +#include #include "main/state.h" #include "nouveau_driver.h" #include "nouveau_context.h" @@ -34,14 +35,6 @@ #include "nv04_driver.h" #include "nv10_driver.h" -static const struct dri_extension nv10_extensions[] = { - { "GL_ARB_texture_env_crossbar", NULL }, - { "GL_EXT_texture_rectangle", NULL }, - { "GL_ARB_texture_env_combine", NULL }, - { "GL_ARB_texture_env_dot3",NULL }, - { NULL, NULL } -}; - static GLboolean use_fast_zclear(struct gl_context *ctx, GLbitfield buffers) { @@ -439,7 +432,10 @@ nv10_context_create(struct nouveau_screen *screen, const struct gl_config *visua if (!nouveau_context_init(ctx, screen, visual, share_ctx)) goto fail; - driInitExtensions(ctx, nv10_extensions, GL_FALSE); + ctx->Extensions.ARB_texture_env_crossbar = true; + ctx->Extensions.ARB_texture_env_combine = true; + ctx->Extensions.ARB_texture_env_dot3 = true; + ctx->Extensions.NV_texture_rectangle = true; /* GL constants. */ ctx->Const.MaxTextureLevels = 12; diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c index e0483b2..2766851 100644 ---
[Mesa-dev] [PATCH 4/9] r200: Enable extensions by just setting the flags
From: Ian Romanick Core Mesa already does the dispatch offset remapping for every function that could possibly ever be supported. There's no need to continue using that cruft in the driver. Since the call to _mesa_enable_imaging_extensions (via driInitExtensions) is removed, EXT_blend_logic_op is explicitly added to the list. EXT_blend_color is also added, but it depends on the drmSupportsBlendColor flag. Cc: Alex Deucher Cc: Dave Airlie --- src/mesa/drivers/dri/r200/r200_context.c | 171 +++--- 1 files changed, 64 insertions(+), 107 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 4e08d34..6fbface 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -32,6 +32,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell */ +#include #include "main/glheader.h" #include "main/api_arrayelt.h" #include "main/context.h" @@ -61,24 +62,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_span.h" -#define need_GL_ARB_occlusion_query -#define need_GL_ARB_vertex_array_object -#define need_GL_ARB_vertex_program -#define need_GL_APPLE_vertex_array_object -#define need_GL_ATI_fragment_shader -#define need_GL_EXT_blend_minmax -#define need_GL_EXT_fog_coord -#define need_GL_EXT_secondary_color -#define need_GL_EXT_blend_equation_separate -#define need_GL_EXT_blend_func_separate -#define need_GL_EXT_gpu_program_parameters -#define need_GL_NV_vertex_program -#define need_GL_ARB_point_parameters -#define need_GL_EXT_framebuffer_object -#define need_GL_OES_EGL_image - -#include "main/remap_helper.h" - #include "utils.h" #include "xmlpool.h" /* for symbolic values of enum-type options */ @@ -111,75 +94,6 @@ static const GLubyte *r200GetString( struct gl_context *ctx, GLenum name ) } -/* Extension strings exported by the R200 driver. - */ -static const struct dri_extension card_extensions[] = -{ -{ "GL_ARB_half_float_pixel", NULL }, -{ "GL_ARB_multitexture", NULL }, -{ "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, -{ "GL_ARB_texture_border_clamp", NULL }, -{ "GL_ARB_texture_env_add",NULL }, -{ "GL_ARB_texture_env_combine",NULL }, -{ "GL_ARB_texture_env_dot3", NULL }, -{ "GL_ARB_texture_env_crossbar", NULL }, -{ "GL_ARB_texture_mirrored_repeat",NULL }, -{ "GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions}, -{ "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions }, -{ "GL_EXT_blend_subtract", NULL }, -{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, -{ "GL_EXT_packed_depth_stencil", NULL}, -{ "GL_EXT_secondary_color",GL_EXT_secondary_color_functions }, -{ "GL_EXT_stencil_wrap", NULL }, -{ "GL_EXT_texture_edge_clamp", NULL }, -{ "GL_EXT_texture_env_combine",NULL }, -{ "GL_EXT_texture_env_dot3", NULL }, -{ "GL_EXT_texture_filter_anisotropic", NULL }, -{ "GL_EXT_texture_lod_bias", NULL }, -{ "GL_EXT_texture_mirror_clamp", NULL }, -{ "GL_EXT_texture_rectangle", NULL }, -{ "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions }, -{ "GL_ATI_texture_env_combine3", NULL }, -{ "GL_ATI_texture_mirror_once",NULL }, -{ "GL_MESA_pack_invert", NULL }, -{ "GL_NV_blend_square",NULL }, -#if FEATURE_OES_EGL_image -{ "GL_OES_EGL_image", GL_OES_EGL_image_functions }, -#endif -{ NULL,NULL } -}; - -static const struct dri_extension blend_extensions[] = { -{ "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions }, -{ "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions }, -{ NULL,NULL } -}; - -static const struct dri_extension ARB_vp_extension[] = { -{ "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }, -{ "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions}, -{ NULL,NULL } -}; - -static const struct dri_extension NV_vp_extension[] = { -{ "GL_NV_vertex_program", GL_NV_vertex_program_functions } -}; - -static const struct dri_extension ATI_fs_extension[] = { -{ "GL_ATI_fragment_shader",GL_ATI_fragment_shader_functions } -}; - -static const struct dri_extension point_extensions[] = { -{ "GL_ARB_point_sprite", NULL }, -{ "GL_ARB_point_parameters", GL_ARB_point_parameters_functions }, -{ NULL,NULL } -}; - -static const struct dri_extension mm_extensions[] =
[Mesa-dev] [PATCH 6/9] r600: Enable extensions by just setting the flags
From: Ian Romanick Core Mesa already does the dispatch offset remapping for every function that could possibly ever be supported. There's no need to continue using that cruft in the driver. Since the call to _mesa_enable_imaging_extensions (via driInitExtensions) is removed, EXT_blend_color and EXT_blend_logic_op are explicitly added to the list. Cc: Alex Deucher Cc: Dave Airlie --- src/mesa/drivers/dri/r600/r600_context.c | 167 +++--- 1 files changed, 62 insertions(+), 105 deletions(-) diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 1b96761..9f32e1c 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -35,6 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * \author Nicolai Haehnle */ +#include #include "main/glheader.h" #include "main/api_arrayelt.h" #include "main/context.h" @@ -78,103 +79,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define R600_ENABLE_GLSL_TEST 1 -#define need_GL_VERSION_2_0 -#define need_GL_VERSION_2_1 -#define need_GL_ARB_draw_elements_base_vertex -#define need_GL_ARB_occlusion_query -#define need_GL_ARB_point_parameters -#define need_GL_ARB_vertex_program -#define need_GL_EXT_blend_equation_separate -#define need_GL_EXT_blend_func_separate -#define need_GL_EXT_blend_minmax -#define need_GL_EXT_framebuffer_object -#define need_GL_EXT_fog_coord -#define need_GL_EXT_gpu_program_parameters -#define need_GL_EXT_provoking_vertex -#define need_GL_EXT_secondary_color -#define need_GL_EXT_stencil_two_side -#define need_GL_ATI_separate_stencil -#define need_GL_NV_vertex_program -#define need_GL_OES_EGL_image - -#include "main/remap_helper.h" - -static const struct dri_extension card_extensions[] = { - /* *INDENT-OFF* */ - {"GL_ARB_depth_clamp",NULL}, - {"GL_ARB_depth_texture", NULL}, - {"GL_ARB_fragment_program", NULL}, - {"GL_ARB_fragment_program_shadow", NULL}, - {"GL_ARB_occlusion_query",GL_ARB_occlusion_query_functions}, - {"GL_ARB_multitexture", NULL}, - {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions}, - {"GL_ARB_shadow",NULL}, - {"GL_ARB_shadow_ambient",NULL}, - {"GL_ARB_texture_border_clamp", NULL}, - {"GL_ARB_texture_cube_map", NULL}, - {"GL_ARB_texture_env_add", NULL}, - {"GL_ARB_texture_env_combine", NULL}, - {"GL_ARB_texture_env_crossbar", NULL}, - {"GL_ARB_texture_env_dot3", NULL}, - {"GL_ARB_texture_mirrored_repeat", NULL}, - {"GL_ARB_texture_non_power_of_two", NULL}, - {"GL_ARB_vertex_program",GL_ARB_vertex_program_functions}, - {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions}, - {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions}, - {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions}, - {"GL_EXT_blend_subtract",NULL}, - {"GL_EXT_packed_depth_stencil", NULL}, - {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, - {"GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions}, - {"GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions }, - {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions}, - {"GL_EXT_shadow_funcs", NULL}, - {"GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions}, - {"GL_EXT_stencil_wrap", NULL}, - {"GL_EXT_texture_edge_clamp",NULL}, - {"GL_EXT_texture_env_combine", NULL}, - {"GL_EXT_texture_env_dot3", NULL}, - {"GL_EXT_texture_filter_anisotropic",NULL}, - {"GL_EXT_texture_lod_bias", NULL}, - {"GL_EXT_texture_mirror_clamp", NULL}, - {"GL_EXT_texture_rectangle", NULL}, - {"GL_EXT_vertex_array_bgra", NULL}, - {"GL_EXT_texture_sRGB", NULL}, - {"GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions}, - {"GL_ATI_texture_env_combine3", NULL}, - {"GL_ATI_texture_mirror_once", NULL}, - {"GL_MESA_pack_invert", NULL}, - {"GL_MESA_ycbcr_texture",NULL}, - {"GL_NV_blend_square", NULL}, - {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, - {"GL_ARB_pixel_buffer_object",NULL}, - {"GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions }, -#if FEATURE_OES_EGL_image - {"GL_OES_EGL_image", GL_OES_EGL_image_functions}, -#endif - {NULL, NULL} - /* *INDENT-ON* */ -}; - - -static const struct dri_extension mm_extensions[] = { - { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, - { NULL, NULL } -}; - -/** - * The GL 2.0 functions are needed to make display lists work with - * functions added by GL
[Mesa-dev] [PATCH 5/9] r300: Enable extensions by just setting the flags
From: Ian Romanick Core Mesa already does the dispatch offset remapping for every function that could possibly ever be supported. There's no need to continue using that cruft in the driver. Since the call to _mesa_enable_imaging_extensions (via driInitExtensions) is removed, EXT_blend_color and EXT_blend_logic_op are explicitly added to the list. Cc: Alex Deucher Cc: Dave Airlie --- src/mesa/drivers/dri/r300/r300_context.c | 162 -- 1 files changed, 63 insertions(+), 99 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 213d3c0..984aff5 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -35,6 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * \author Nicolai Haehnle */ +#include #include "main/glheader.h" #include "main/api_arrayelt.h" #include "main/context.h" @@ -71,91 +72,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "utils.h" #include "xmlpool.h" /* for symbolic values of enum-type options */ -#define need_GL_VERSION_2_0 -#define need_GL_ARB_occlusion_query -#define need_GL_ARB_point_parameters -#define need_GL_ARB_vertex_program -#define need_GL_EXT_blend_equation_separate -#define need_GL_EXT_blend_func_separate -#define need_GL_EXT_blend_minmax -#define need_GL_EXT_framebuffer_blit -#define need_GL_EXT_framebuffer_object -#define need_GL_EXT_fog_coord -#define need_GL_EXT_gpu_program_parameters -#define need_GL_EXT_provoking_vertex -#define need_GL_EXT_secondary_color -#define need_GL_EXT_stencil_two_side -#define need_GL_ATI_separate_stencil -#define need_GL_NV_vertex_program -#define need_GL_OES_EGL_image - -#include "main/remap_helper.h" - -static const struct dri_extension card_extensions[] = { - /* *INDENT-OFF* */ - {"GL_ARB_depth_texture", NULL}, - {"GL_ARB_fragment_program", NULL}, - {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, - {"GL_ARB_multitexture", NULL}, - {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions}, - {"GL_ARB_shadow",NULL}, - {"GL_ARB_shadow_ambient",NULL}, - {"GL_ARB_texture_border_clamp", NULL}, - {"GL_ARB_texture_cube_map", NULL}, - {"GL_ARB_texture_env_add", NULL}, - {"GL_ARB_texture_env_combine", NULL}, - {"GL_ARB_texture_env_crossbar", NULL}, - {"GL_ARB_texture_env_dot3", NULL}, - {"GL_ARB_texture_mirrored_repeat", NULL}, - {"GL_ARB_vertex_program",GL_ARB_vertex_program_functions}, - {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions}, - {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions}, - {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions}, - {"GL_EXT_blend_subtract",NULL}, - {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, - {"GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions}, - {"GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions }, - {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions}, - {"GL_EXT_shadow_funcs", NULL}, - {"GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions}, - {"GL_EXT_stencil_wrap", NULL}, - {"GL_EXT_texture_edge_clamp",NULL}, - {"GL_EXT_texture_env_combine", NULL}, - {"GL_EXT_texture_env_dot3", NULL}, - {"GL_EXT_texture_filter_anisotropic",NULL}, - {"GL_EXT_texture_lod_bias", NULL}, - {"GL_EXT_texture_mirror_clamp", NULL}, - {"GL_EXT_texture_rectangle", NULL}, - {"GL_EXT_texture_sRGB", NULL}, - {"GL_EXT_vertex_array_bgra", NULL}, - {"GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions}, - {"GL_ATI_texture_env_combine3", NULL}, - {"GL_ATI_texture_mirror_once", NULL}, - {"GL_MESA_pack_invert", NULL}, - {"GL_MESA_ycbcr_texture",NULL}, - {"GL_NV_blend_square", NULL}, - {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, -#if FEATURE_OES_EGL_image - {"GL_OES_EGL_image", GL_OES_EGL_image_functions }, -#endif - {NULL, NULL} - /* *INDENT-ON* */ -}; - - -static const struct dri_extension mm_extensions[] = { - { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, - { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, - { NULL, NULL } -}; - -/** - * The GL 2.0 functions are needed to make display lists work with - * functions added by GL_ATI_separate_stencil. - */ -static const struct dri_extension gl_20_extension[] = { - {"GL_VERSION_2_0", GL_VERSION_2_0_functions }, -}; static const struct tnl_pipeline_stage *r300_pipeline[] = { /* Ca
[Mesa-dev] [PATCH 8/9] swrast-dri: Remove call to driInitExtensions
From: Ian Romanick The only purpose this call served in the DRI swrast driver was to initialize the remap table. Core Mesa already does the dispatch offset remapping for every function that could possibly ever be supported. There's no need to continue using that cruft in the driver. --- src/mesa/drivers/dri/swrast/swrast.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 719b406..25d1d0c 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -681,8 +681,6 @@ dri_create_context(gl_api api, _mesa_enable_1_5_extensions(mesaCtx); _mesa_enable_2_0_extensions(mesaCtx); _mesa_enable_2_1_extensions(mesaCtx); - -driInitExtensions( mesaCtx, NULL, GL_FALSE ); break; case API_OPENGLES: _mesa_enable_1_3_extensions(mesaCtx); -- 1.7.4.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 7/9] radeon: Enable extensions by just setting the flags
From: Ian Romanick Core Mesa already does the dispatch offset remapping for every function that could possibly ever be supported. There's no need to continue using that cruft in the driver. Since the call to _mesa_enable_imaging_extensions (via driInitExtensions) is removed, EXT_blend_color, EXT_blend_logic_op, EXT_blend_minmax, and EXT_blend_subtract are no longer advertised. These all resulted in software fallbacks, so their loss will not be mourned. Cc: Alex Deucher Cc: Dave Airlie --- src/mesa/drivers/dri/radeon/radeon_context.c | 99 ++--- 1 files changed, 40 insertions(+), 59 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 4d41e99..aac45be 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -34,6 +34,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Keith Whitwell */ +#include #include "main/glheader.h" #include "main/api_arrayelt.h" #include "main/context.h" @@ -62,56 +63,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_queryobj.h" #include "radeon_blit.h" -#define need_GL_ARB_occlusion_query -#define need_GL_EXT_blend_minmax -#define need_GL_EXT_fog_coord -#define need_GL_EXT_secondary_color -#define need_GL_EXT_framebuffer_object -#define need_GL_OES_EGL_image -#include "main/remap_helper.h" - #include "utils.h" #include "xmlpool.h" /* for symbolic values of enum-type options */ -/* Extension strings exported by the R100 driver. - */ -static const struct dri_extension card_extensions[] = -{ -{ "GL_ARB_multitexture", NULL }, -{ "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, -{ "GL_ARB_texture_border_clamp", NULL }, -{ "GL_ARB_texture_env_add",NULL }, -{ "GL_ARB_texture_env_combine",NULL }, -{ "GL_ARB_texture_env_crossbar", NULL }, -{ "GL_ARB_texture_env_dot3", NULL }, -{ "GL_ARB_texture_mirrored_repeat",NULL }, -{ "GL_EXT_blend_logic_op", NULL }, -{ "GL_EXT_blend_subtract", GL_EXT_blend_minmax_functions }, -{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, -{ "GL_EXT_packed_depth_stencil", NULL}, -{ "GL_EXT_secondary_color",GL_EXT_secondary_color_functions }, -{ "GL_EXT_stencil_wrap", NULL }, -{ "GL_EXT_texture_edge_clamp", NULL }, -{ "GL_EXT_texture_env_combine",NULL }, -{ "GL_EXT_texture_env_dot3", NULL }, -{ "GL_EXT_texture_filter_anisotropic", NULL }, -{ "GL_EXT_texture_lod_bias", NULL }, -{ "GL_EXT_texture_mirror_clamp", NULL }, -{ "GL_ATI_texture_env_combine3", NULL }, -{ "GL_ATI_texture_mirror_once",NULL }, -{ "GL_MESA_ycbcr_texture", NULL }, -{ "GL_NV_blend_square",NULL }, -#if FEATURE_OES_EGL_image -{ "GL_OES_EGL_image", GL_OES_EGL_image_functions }, -#endif -{ NULL,NULL } -}; - -static const struct dri_extension mm_extensions[] = { - { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, - { NULL, NULL } -}; - extern const struct tnl_pipeline_stage _radeon_render_stage; extern const struct tnl_pipeline_stage _radeon_tcl_stage; @@ -359,24 +313,51 @@ r100CreateContext( gl_api api, _math_matrix_set_identity( &rmesa->tmpmat[i] ); } - driInitExtensions( ctx, card_extensions, GL_TRUE ); - if (rmesa->radeon.radeonScreen->kernel_mm) - driInitExtensions(ctx, mm_extensions, GL_FALSE); - if (rmesa->radeon.radeonScreen->drmSupportsCubeMapsR100) - _mesa_enable_extension( ctx, "GL_ARB_texture_cube_map" ); + ctx->Extensions.ARB_multitexture = true; + ctx->Extensions.ARB_texture_border_clamp = true; + ctx->Extensions.ARB_texture_env_combine = true; + ctx->Extensions.ARB_texture_env_crossbar = true; + ctx->Extensions.ARB_texture_env_dot3 = true; + ctx->Extensions.ARB_texture_mirrored_repeat = true; + ctx->Extensions.EXT_blend_logic_op = true; + ctx->Extensions.EXT_blend_subtract = true; + ctx->Extensions.EXT_fog_coord = true; + ctx->Extensions.EXT_packed_depth_stencil = true; + ctx->Extensions.EXT_secondary_color = true; + ctx->Extensions.EXT_stencil_wrap = true; + ctx->Extensions.EXT_texture_env_add = true; + ctx->Extensions.EXT_texture_env_combine = true; + ctx->Extensions.EXT_texture_env_dot3 = true; + ctx->Extensions.EXT_texture_filter_anisotropic = true; + ctx->Extensions.EXT_texture_lod_bias = true; + ctx->Extensions.EXT_texture_mirror_clamp = true; + ctx->Extensions.ATI_texture_env_combine3 = true; + ctx->Extensions.ATI_texture_mirror_once = true; + ctx->Extensions.MESA_ycbcr_texture = true; + ctx->Extensions.NV_blend_square = true; +#if FEATURE_OES_EGL_image + ctx
[Mesa-dev] [PATCH 9/9] dri: Remove all extension enabling utility functions
From: Ian Romanick --- src/mesa/drivers/dri/common/utils.c | 114 -- src/mesa/drivers/dri/common/utils.h | 25 - src/mesa/drivers/dri/intel/intel_extensions_es.c |6 - src/mesa/drivers/dri/swrast/swrast.c |3 - 4 files changed, 0 insertions(+), 148 deletions(-) diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index d828183..54156d3 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -137,120 +137,6 @@ driGetRendererString( char * buffer, const char * hardware_name, } - - -#define need_GL_ARB_copy_buffer -#define need_GL_ARB_draw_buffers -#define need_GL_ARB_multisample -#define need_GL_ARB_texture_compression -#define need_GL_ARB_transpose_matrix -#define need_GL_ARB_vertex_buffer_object -#define need_GL_ARB_window_pos -#define need_GL_EXT_compiled_vertex_array -#define need_GL_EXT_multi_draw_arrays -#define need_GL_EXT_polygon_offset -#define need_GL_EXT_texture_object -#define need_GL_EXT_vertex_array -#define need_GL_IBM_multimode_draw_arrays -#define need_GL_MESA_window_pos - -/* These are needed in *all* drivers because Mesa internally implements - * certain functionality in terms of functions provided by these extensions. - * For example, glBlendFunc is implemented by calling glBlendFuncSeparateEXT. - */ -#define need_GL_EXT_blend_func_separate -#define need_GL_NV_vertex_program - -#include "main/remap_helper.h" - -static const struct dri_extension all_mesa_extensions[] = { - { "GL_ARB_copy_buffer", GL_ARB_copy_buffer_functions }, - { "GL_ARB_draw_buffers", GL_ARB_draw_buffers_functions }, - { "GL_ARB_multisample", GL_ARB_multisample_functions }, - { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions }, - { "GL_ARB_transpose_matrix", GL_ARB_transpose_matrix_functions }, - { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions}, - { "GL_ARB_window_pos",GL_ARB_window_pos_functions }, - { "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions }, - { "GL_EXT_compiled_vertex_array", GL_EXT_compiled_vertex_array_functions }, - { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions }, - { "GL_EXT_polygon_offset",GL_EXT_polygon_offset_functions }, - { "GL_EXT_texture_object",GL_EXT_texture_object_functions }, - { "GL_EXT_vertex_array", GL_EXT_vertex_array_functions }, - { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions }, - { "GL_MESA_window_pos", GL_MESA_window_pos_functions }, - { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, - { NULL, NULL } -}; - - -/** - * Enable and map extensions supported by the driver. - * - * When ctx is NULL, extensions are not enabled, but their functions - * are still mapped. When extensions_to_enable is NULL, all static - * functions known to mesa core are mapped. - * - * \bug - * ARB_imaging isn't handled properly. In Mesa, enabling ARB_imaging also - * enables all the sub-extensions that are folded into it. This means that - * we need to add entry-points (via \c driInitSingleExtension) for those - * new functions here. - */ -void driInitExtensions( struct gl_context * ctx, - const struct dri_extension * extensions_to_enable, - GLboolean enable_imaging ) -{ - static int first_time = 1; - unsigned i; - - if ( first_time ) { - first_time = 0; - driInitExtensions( NULL, all_mesa_extensions, GL_FALSE ); - } - - if ( (ctx != NULL) && enable_imaging ) { - _mesa_enable_imaging_extensions( ctx ); - } - - /* The caller is too lazy to list any extension */ - if ( extensions_to_enable == NULL ) { - /* Map the static functions. Together with those mapped by remap - * table, this should cover everything mesa core knows. - */ - _mesa_map_static_functions(); - return; - } - - for ( i = 0 ; extensions_to_enable[i].name != NULL ; i++ ) { - driInitSingleExtension( ctx, & extensions_to_enable[i] ); - } -} - - - - -/** - * Enable and map functions for a single extension - * - * \param ctx Context where extension is to be enabled. - * \param ext Extension that is to be enabled. - * - * \sa driInitExtensions, _mesa_enable_extension, _mesa_map_function_array - */ -void driInitSingleExtension( struct gl_context * ctx, -const struct dri_extension * ext ) -{ -if ( ext->functions != NULL ) { - _mesa_map_function_array(ext->functions); -} - -if ( ctx != NULL ) { - _mesa_enable_extension( ctx, ext->name ); -} -} - - /** * Utility function used by drivers to test the verions of other components. * diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index a1c9ea6..100d0dd 100644 --- a/s
[Mesa-dev] [PATCH 0/5] glsl: Add front-end support for gl_ClipDistance.
This patch series modifies the GLSL front-end to implement all the proper behaviors for gl_ClipDistance, namely: - gl_ClipDistance is predeclared as unsized in both the vertex and fragment shader. - It is an error to size gl_ClipDistance (either explicitly or implicitly) larger than gl_MaxClipDistances. - It is an error to write to both gl_ClipDistance and gl_ClipVertex. There is no back-end support for gl_ClipDistance yet. [PATCH 1/5] glsl: Make gl_ClipDistance[] implicitly sized. [PATCH 2/5] glsl: Add constant gl_MaxClipDistances. [PATCH 3/5] glsl: Rework oversize array check for gl_TexCoord. [PATCH 4/5] glsl: Check that gl_ClipDistance[] is not sized too large. [PATCH 5/5] glsl: Make sure gl_ClipDistance and gl_ClipVertex are not both written. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/5] glsl: Make gl_ClipDistance[] implicitly sized.
>From the GLSL 1.30 spec, section 7.1 (Vertex Shader Special Variables): The gl_ClipDistance array is predeclared as unsized and must be sized by the shader either redeclaring it with a size or indexing it only with integral constant expressions. Fixes piglit tests clip-distance-implicit-length.vert, clip-distance-implicit-nonconst-access.vert, and {vs,fs}-clip-distance-explicitly-sized.shader_test. --- src/glsl/ir_variable.cpp | 28 1 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index b848769..3809456 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -595,9 +595,18 @@ generate_130_vs_variables(exec_list *instructions, & builtin_130_vs_variables[i]); } + /* From the GLSL 1.30 spec, section 7.1 (Vertex Shader Special +* Variables): +* +* The gl_ClipDistance array is predeclared as unsized and must +* be sized by the shader either redeclaring it with a size or +* indexing it only with integral constant expressions. +* +* We represent this in Mesa by initially declaring the array as +* size 0. +*/ const glsl_type *const clip_distance_array_type = - glsl_type::get_array_instance(glsl_type::float_type, - state->Const.MaxClipPlanes); + glsl_type::get_array_instance(glsl_type::float_type, 0); /* FINISHME: gl_ClipDistance needs a real location assigned. */ add_variable(instructions, state->symbols, @@ -802,9 +811,20 @@ generate_130_fs_variables(exec_list *instructions, { generate_120_fs_variables(instructions, state); + /* From the GLSL 1.30 spec, section 7.2 (Fragment Shader Special +* Variables): +* +* The built-in input variable gl_ClipDistance array contains linearly +* interpolated values for the vertex values written by the vertex shader +* to the gl_ClipDistance vertex output variable. This array must be +* sized in the fragment shader either implicitly or explicitly to be the +* same size as it was sized in the vertex shader. +* +* In other words, the array must be pre-declared as implicitly sized. We +* represent this in Mesa by initially declaring the array as size 0. +*/ const glsl_type *const clip_distance_array_type = - glsl_type::get_array_instance(glsl_type::float_type, - state->Const.MaxClipPlanes); + glsl_type::get_array_instance(glsl_type::float_type, 0); /* FINISHME: gl_ClipDistance needs a real location assigned. */ add_variable(instructions, state->symbols, -- 1.7.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/5] glsl: Add constant gl_MaxClipDistances.
Fixes piglit tests {vs,fs}-clip-distance-sizeable-to-max.shader_test. --- src/glsl/ir_variable.cpp | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp index 3809456..e0b6f38 100644 --- a/src/glsl/ir_variable.cpp +++ b/src/glsl/ir_variable.cpp @@ -585,6 +585,17 @@ generate_120_vs_variables(exec_list *instructions, static void +generate_130_uniforms(exec_list *instructions, + struct _mesa_glsl_parse_state *state) +{ + glsl_symbol_table *const symtab = state->symbols; + + add_builtin_constant(instructions, symtab, "gl_MaxClipDistances", +state->Const.MaxClipPlanes); +} + + +static void generate_130_vs_variables(exec_list *instructions, struct _mesa_glsl_parse_state *state) { @@ -595,6 +606,8 @@ generate_130_vs_variables(exec_list *instructions, & builtin_130_vs_variables[i]); } + generate_130_uniforms(instructions, state); + /* From the GLSL 1.30 spec, section 7.1 (Vertex Shader Special * Variables): * @@ -811,6 +824,8 @@ generate_130_fs_variables(exec_list *instructions, { generate_120_fs_variables(instructions, state); + generate_130_uniforms(instructions, state); + /* From the GLSL 1.30 spec, section 7.2 (Fragment Shader Special * Variables): * -- 1.7.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/5] glsl: Rework oversize array check for gl_TexCoord.
The check now applies both when explicitly declaring the size of gl_TexCoord and when implicitly setting the size of gl_TexCoord by accessing it using integral constant expressions. This is prep work for adding similar size checks to gl_ClipDistance. Fixes piglit tests texcoord/implicit-access-max.{frag,vert}. --- src/glsl/ast_to_hir.cpp | 45 + 1 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 9e7496b..fbb2c14 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -893,6 +893,29 @@ get_scalar_boolean_operand(exec_list *instructions, return new(ctx) ir_constant(true); } +/** + * If name refers to a builtin array whose maximum allowed size is less than + * size, report an error and return true. Otherwise return false. + */ +static bool +check_builtin_array_max_size(const char *name, unsigned size, + YYLTYPE loc, struct _mesa_glsl_parse_state *state) +{ + if ((strcmp("gl_TexCoord", name) == 0) + && (size > state->Const.MaxTextureCoords)) { + /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec: + * + * "The size [of gl_TexCoord] can be at most + * gl_MaxTextureCoords." + */ + _mesa_glsl_error(&loc, state, "`gl_TexCoord' array size cannot " + "be larger than gl_MaxTextureCoords (%u)\n", + state->Const.MaxTextureCoords); + return true; + } + return false; +} + ir_rvalue * ast_expression::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) @@ -1550,8 +1573,15 @@ ast_expression::hir(exec_list *instructions, * FINISHME: array access limits be added to ir_dereference? */ ir_variable *const v = array->whole_variable_referenced(); - if ((v != NULL) && (unsigned(idx) > v->max_array_access)) + if ((v != NULL) && (unsigned(idx) > v->max_array_access)) { v->max_array_access = idx; + + /* Check whether this access will, as a side effect, implicitly +* cause the size of a built-in array to be too large. +*/ + if (check_builtin_array_max_size(v->name, idx+1, loc, state)) + error_emitted = true; +} } } else if (array->type->array_size() == 0) { _mesa_glsl_error(&loc, state, "unsized array index must be constant"); @@ -2121,18 +2151,9 @@ get_variable_being_redeclared(ir_variable *var, ast_declaration *decl, * FINISHME: required or not. */ - /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec: - * - * "The size [of gl_TexCoord] can be at most - * gl_MaxTextureCoords." - */ const unsigned size = unsigned(var->type->array_size()); - if ((strcmp("gl_TexCoord", var->name) == 0) - && (size > state->Const.MaxTextureCoords)) { -_mesa_glsl_error(& loc, state, "`gl_TexCoord' array size cannot " - "be larger than gl_MaxTextureCoords (%u)\n", - state->Const.MaxTextureCoords); - } else if ((size > 0) && (size <= earlier->max_array_access)) { + check_builtin_array_max_size(var->name, size, loc, state); + if ((size > 0) && (size <= earlier->max_array_access)) { _mesa_glsl_error(& loc, state, "array size must be > %u due to " "previous access", earlier->max_array_access); -- 1.7.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/5] glsl: Check that gl_ClipDistance[] is not sized too large.
Fixes piglit tests clip-distance-explicit-too-large-with-access.{frag,vert} and clip-distance-explicit-too-large.{frag,vert}. --- src/glsl/ast_to_hir.cpp | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index fbb2c14..a4eaf85 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -912,6 +912,21 @@ check_builtin_array_max_size(const char *name, unsigned size, "be larger than gl_MaxTextureCoords (%u)\n", state->Const.MaxTextureCoords); return true; + } else if (strcmp("gl_ClipDistance", name) == 0 + && size > state->Const.MaxClipPlanes) { + /* From section 7.1 (Vertex Shader Special Variables) of the + * GLSL 1.30 spec: + * + * "The gl_ClipDistance array is predeclared as unsized and + * must be sized by the shader either redeclaring it with a + * size or indexing it only with integral constant + * expressions. ... The size can be at most + * gl_MaxClipDistances." + */ + _mesa_glsl_error(&loc, state, "`gl_ClipDistance' array size cannot " + "be larger than gl_MaxClipDistances (%u)\n", + state->Const.MaxClipPlanes); + return true; } return false; } -- 1.7.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/5] glsl: Make sure gl_ClipDistance and gl_ClipVertex are not both written.
>From section 7.1 (Vertex Shader Special Variables) of the GLSL 1.30 spec: "It is an error for a shader to statically write both gl_ClipVertex and gl_ClipDistance." Fixes piglit test mixing-clip-distance-and-clip-vertex-disallowed.c. --- src/glsl/linker.cpp | 19 +++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index ba81c59..195f58f 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -262,6 +262,25 @@ validate_vertex_shader_executable(struct gl_shader_program *prog, return false; } + if (prog->Version >= 130) { + /* From section 7.1 (Vertex Shader Special Variables) of the + * GLSL 1.30 spec: + * + * "It is an error for a shader to statically write both + * gl_ClipVertex and gl_ClipDistance." + */ + find_assignment_visitor clip_vertex("gl_ClipVertex"); + find_assignment_visitor clip_distance("gl_ClipDistance"); + + clip_vertex.run(shader->ir); + clip_distance.run(shader->ir); + if (clip_vertex.variable_found() && clip_distance.variable_found()) { + linker_error(prog, "vertex shader writes to both `gl_ClipVertex' " + "and `gl_ClipDistance'\n"); + return false; + } + } + return true; } -- 1.7.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] DEATH to old drivers!
On Thu, 2011-08-25 at 07:38 -0700, Kenneth Graunke wrote: > On 08/25/2011 07:03 AM, Ian Romanick wrote: > > That's a fair point. Since we have a clean mechanism to improve those > > interfaces (e.g., DRI2!), there's relatively little cost in keeping that > > code around. > > > > I'd usually be pretty stoked about deleting 842 lines of code, but it > > feels pretty insignificant right after deleting 85,811 lines of code! I > > may have now out ajaxed ajax. :) > > It may be insignificant in size, but it _does_ make it harder for people > trying to get up to speed with the DRI code. There are a lot of > structures, tokens, and functions which _look_ relevant for a DRI2 > driver, but are actually DRI1. It's not entirely clear, for example, > that dri_context and dri_screen are DRI1-only. I imagine Chad has an > opinion on this. > > So I'm still in favor of removing DRI1 entirely. People can just stick > with 7.11. I will happily renamespace the remaining DRI1 code in libGL to avoid that kind of confusion, if it helps. I have at least one product where I'm going to have to ship both updated DRI2 and extant DRI1 drivers for the forseeable future, so I really want not to need two libGL's. Apologies for reviving the thread, I was delightfully far from a computer for the past two weeks. But what a nice thing to give me as a welcome home present! Having started my interest in Mesa on tdfx and mach64 I'm entirely pleased to see them in the dustbin. - ajax signature.asc Description: This is a digitally signed message part ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 5/9] r300: Enable extensions by just setting the flags
So much win! I have a couple nits; replying inline. On Tue, Sep 6, 2011 at 1:13 PM, Ian Romanick wrote: > From: Ian Romanick > > Core Mesa already does the dispatch offset remapping for every > function that could possibly ever be supported. There's no need to > continue using that cruft in the driver. > > Since the call to _mesa_enable_imaging_extensions (via > driInitExtensions) is removed, EXT_blend_color and EXT_blend_logic_op > are explicitly added to the list. > > Cc: Alex Deucher > Cc: Dave Airlie > --- > src/mesa/drivers/dri/r300/r300_context.c | 162 > -- > 1 files changed, 63 insertions(+), 99 deletions(-) > > diff --git a/src/mesa/drivers/dri/r300/r300_context.c > b/src/mesa/drivers/dri/r300/r300_context.c > index 213d3c0..984aff5 100644 > --- a/src/mesa/drivers/dri/r300/r300_context.c > +++ b/src/mesa/drivers/dri/r300/r300_context.c > @@ -35,6 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE > SOFTWARE. > * \author Nicolai Haehnle > */ > > +#include > #include "main/glheader.h" > #include "main/api_arrayelt.h" > #include "main/context.h" > @@ -71,91 +72,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE > SOFTWARE. > #include "utils.h" > #include "xmlpool.h" /* for symbolic values of enum-type options */ > > -#define need_GL_VERSION_2_0 > -#define need_GL_ARB_occlusion_query > -#define need_GL_ARB_point_parameters > -#define need_GL_ARB_vertex_program > -#define need_GL_EXT_blend_equation_separate > -#define need_GL_EXT_blend_func_separate > -#define need_GL_EXT_blend_minmax > -#define need_GL_EXT_framebuffer_blit > -#define need_GL_EXT_framebuffer_object > -#define need_GL_EXT_fog_coord > -#define need_GL_EXT_gpu_program_parameters > -#define need_GL_EXT_provoking_vertex > -#define need_GL_EXT_secondary_color > -#define need_GL_EXT_stencil_two_side > -#define need_GL_ATI_separate_stencil > -#define need_GL_NV_vertex_program > -#define need_GL_OES_EGL_image > - > -#include "main/remap_helper.h" > - > -static const struct dri_extension card_extensions[] = { > - /* *INDENT-OFF* */ > - {"GL_ARB_depth_texture", NULL}, > - {"GL_ARB_fragment_program", NULL}, > - {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, > - {"GL_ARB_multitexture", NULL}, > - {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions}, > - {"GL_ARB_shadow", NULL}, > - {"GL_ARB_shadow_ambient", NULL}, > - {"GL_ARB_texture_border_clamp", NULL}, > - {"GL_ARB_texture_cube_map", NULL}, > - {"GL_ARB_texture_env_add", NULL}, > - {"GL_ARB_texture_env_combine", NULL}, > - {"GL_ARB_texture_env_crossbar", NULL}, > - {"GL_ARB_texture_env_dot3", NULL}, > - {"GL_ARB_texture_mirrored_repeat", NULL}, > - {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions}, > - {"GL_EXT_blend_equation_separate", > GL_EXT_blend_equation_separate_functions}, > - {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions}, > - {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions}, > - {"GL_EXT_blend_subtract", NULL}, > - {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, > - {"GL_EXT_gpu_program_parameters", > GL_EXT_gpu_program_parameters_functions}, > - {"GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions }, > - {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions}, > - {"GL_EXT_shadow_funcs", NULL}, > - {"GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions}, > - {"GL_EXT_stencil_wrap", NULL}, > - {"GL_EXT_texture_edge_clamp", NULL}, > - {"GL_EXT_texture_env_combine", NULL}, > - {"GL_EXT_texture_env_dot3", NULL}, > - {"GL_EXT_texture_filter_anisotropic", NULL}, > - {"GL_EXT_texture_lod_bias", NULL}, > - {"GL_EXT_texture_mirror_clamp", NULL}, > - {"GL_EXT_texture_rectangle", NULL}, > - {"GL_EXT_texture_sRGB", NULL}, > - {"GL_EXT_vertex_array_bgra", NULL}, > - {"GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions}, > - {"GL_ATI_texture_env_combine3", NULL}, > - {"GL_ATI_texture_mirror_once", NULL}, > - {"GL_MESA_pack_invert", NULL}, > - {"GL_MESA_ycbcr_texture", NULL}, > - {"GL_NV_blend_square", NULL}, > - {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, > -#if FEATURE_OES_EGL_image > - {"GL_OES_EGL_image", GL_OES_EGL_image_functions }, > -#endif > - {NULL, NULL} > - /* *INDENT-ON* */ > -}; > - > - > -static const struct dri_extension mm_extensions[] = { > - { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, > - { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, > - { NULL, NULL } > -}; > - >
Re: [Mesa-dev] DEATH to old drivers!
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/06/2011 02:17 PM, Adam Jackson wrote: > On Thu, 2011-08-25 at 07:38 -0700, Kenneth Graunke wrote: >> On 08/25/2011 07:03 AM, Ian Romanick wrote: >>> That's a fair point. Since we have a clean mechanism to improve those >>> interfaces (e.g., DRI2!), there's relatively little cost in keeping that >>> code around. >>> >>> I'd usually be pretty stoked about deleting 842 lines of code, but it >>> feels pretty insignificant right after deleting 85,811 lines of code! I >>> may have now out ajaxed ajax. :) >> >> It may be insignificant in size, but it _does_ make it harder for people >> trying to get up to speed with the DRI code. There are a lot of >> structures, tokens, and functions which _look_ relevant for a DRI2 >> driver, but are actually DRI1. It's not entirely clear, for example, >> that dri_context and dri_screen are DRI1-only. I imagine Chad has an >> opinion on this. >> >> So I'm still in favor of removing DRI1 entirely. People can just stick >> with 7.11. > > I will happily renamespace the remaining DRI1 code in libGL to avoid > that kind of confusion, if it helps. I have at least one product where > I'm going to have to ship both updated DRI2 and extant DRI1 drivers for > the forseeable future, so I really want not to need two libGL's. > > Apologies for reviving the thread, I was delightfully far from a > computer for the past two weeks. But what a nice thing to give me as a > welcome home present! Having started my interest in Mesa on tdfx and > mach64 I'm entirely pleased to see them in the dustbin. I ended up leaving the DRI1 protocol code in libGL. A libGL built from today's Mesa master should still work with DRI1 drivers built from 7.11. -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iEYEARECAAYFAk5mlZYACgkQX1gOwKyEAw85DACgg+SZevM8mU/zDCB5A33zQcgs 2+4An28c7lwU3obHGnePg3rYwsD1/Oqp =5Cyt -END PGP SIGNATURE- ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 5/9] r300: Enable extensions by just setting the flags
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/06/2011 02:45 PM, Corbin Simpson wrote: > So much win! I have a couple nits; replying inline. > > On Tue, Sep 6, 2011 at 1:13 PM, Ian Romanick wrote: >> From: Ian Romanick >> >> Core Mesa already does the dispatch offset remapping for every >> function that could possibly ever be supported. There's no need to >> continue using that cruft in the driver. >> >> Since the call to _mesa_enable_imaging_extensions (via >> driInitExtensions) is removed, EXT_blend_color and EXT_blend_logic_op >> are explicitly added to the list. >> >> Cc: Alex Deucher >> Cc: Dave Airlie >> --- >> src/mesa/drivers/dri/r300/r300_context.c | 162 >> -- >> 1 files changed, 63 insertions(+), 99 deletions(-) >> >> diff --git a/src/mesa/drivers/dri/r300/r300_context.c >> b/src/mesa/drivers/dri/r300/r300_context.c >> index 213d3c0..984aff5 100644 >> --- a/src/mesa/drivers/dri/r300/r300_context.c >> +++ b/src/mesa/drivers/dri/r300/r300_context.c >> @@ -35,6 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE >> SOFTWARE. >> * \author Nicolai Haehnle >> */ >> >> +#include >> #include "main/glheader.h" >> #include "main/api_arrayelt.h" >> #include "main/context.h" >> @@ -71,91 +72,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE >> SOFTWARE. >> #include "utils.h" >> #include "xmlpool.h" /* for symbolic values of enum-type options >> */ >> >> -#define need_GL_VERSION_2_0 >> -#define need_GL_ARB_occlusion_query >> -#define need_GL_ARB_point_parameters >> -#define need_GL_ARB_vertex_program >> -#define need_GL_EXT_blend_equation_separate >> -#define need_GL_EXT_blend_func_separate >> -#define need_GL_EXT_blend_minmax >> -#define need_GL_EXT_framebuffer_blit >> -#define need_GL_EXT_framebuffer_object >> -#define need_GL_EXT_fog_coord >> -#define need_GL_EXT_gpu_program_parameters >> -#define need_GL_EXT_provoking_vertex >> -#define need_GL_EXT_secondary_color >> -#define need_GL_EXT_stencil_two_side >> -#define need_GL_ATI_separate_stencil >> -#define need_GL_NV_vertex_program >> -#define need_GL_OES_EGL_image >> - >> -#include "main/remap_helper.h" >> - >> -static const struct dri_extension card_extensions[] = { >> - /* *INDENT-OFF* */ >> - {"GL_ARB_depth_texture", NULL}, >> - {"GL_ARB_fragment_program", NULL}, >> - {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, >> - {"GL_ARB_multitexture", NULL}, >> - {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions}, >> - {"GL_ARB_shadow",NULL}, >> - {"GL_ARB_shadow_ambient",NULL}, >> - {"GL_ARB_texture_border_clamp", NULL}, >> - {"GL_ARB_texture_cube_map", NULL}, >> - {"GL_ARB_texture_env_add", NULL}, >> - {"GL_ARB_texture_env_combine", NULL}, >> - {"GL_ARB_texture_env_crossbar", NULL}, >> - {"GL_ARB_texture_env_dot3", NULL}, >> - {"GL_ARB_texture_mirrored_repeat", NULL}, >> - {"GL_ARB_vertex_program",GL_ARB_vertex_program_functions}, >> - {"GL_EXT_blend_equation_separate", >> GL_EXT_blend_equation_separate_functions}, >> - {"GL_EXT_blend_func_separate", >> GL_EXT_blend_func_separate_functions}, >> - {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions}, >> - {"GL_EXT_blend_subtract",NULL}, >> - {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, >> - {"GL_EXT_gpu_program_parameters", >> GL_EXT_gpu_program_parameters_functions}, >> - {"GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions }, >> - {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions}, >> - {"GL_EXT_shadow_funcs", NULL}, >> - {"GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions}, >> - {"GL_EXT_stencil_wrap", NULL}, >> - {"GL_EXT_texture_edge_clamp",NULL}, >> - {"GL_EXT_texture_env_combine", NULL}, >> - {"GL_EXT_texture_env_dot3", NULL}, >> - {"GL_EXT_texture_filter_anisotropic",NULL}, >> - {"GL_EXT_texture_lod_bias", NULL}, >> - {"GL_EXT_texture_mirror_clamp", NULL}, >> - {"GL_EXT_texture_rectangle", NULL}, >> - {"GL_EXT_texture_sRGB", NULL}, >> - {"GL_EXT_vertex_array_bgra", NULL}, >> - {"GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions}, >> - {"GL_ATI_texture_env_combine3", NULL}, >> - {"GL_ATI_texture_mirror_once", NULL}, >> - {"GL_MESA_pack_invert", NULL}, >> - {"GL_MESA_ycbcr_texture",NULL}, >> - {"GL_NV_blend_square", NULL}, >> - {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, >> -#if FEATURE_OES_EGL_image >> - {"GL_OES_EGL_image", GL_OES_EGL_image_functions }, >> -#endif >> - {NULL, NULL} >> - /* *INDENT-ON* */ >> -}; >> - >> - >> -static const s
Re: [Mesa-dev] State tracker pipe_surface woes...
2011/9/3 Jose Fonseca : > > > - Original Message - >> 2011/9/2 Stéphane Marchesin : >> > 2011/9/2 Jose Fonseca : >> >> - Original Message - >> >>> Hi, >> >>> >> >>> While debugging some code I ran across the following situation: >> >>> >> >>> - pipe_context c1 is created >> >>> - pipe_surface s1 is created >> >>> - strb-> surface is set to s1 (s1's refcount goes up) >> >>> - pipe_context c1 is destroyed >> >>> - strb is destroyed >> >>> - strb->surface is destroyed (so s1's refcount is now 0 and we >> >>> want >> >>> to >> >>> destroy it) >> >>> >> >>> At that point s1 references c1 which is not available any more, >> >>> so >> >>> when we try to call ctx->surface_destroy to destroy s1 we crash. >> >>> >> >>> We discussed this a bit on IRC, and we agreed that the proper >> >>> solution, since surfaces outlive their context, is to make >> >>> surfaces >> >>> screen-bound instead. I'm going to implement that unless someone >> >>> objects. >> >>> >> >>> As a side note, the same issue will happen with sampler_views, so >> >>> it'll get a similar fix. >> >> >> >> Sampler views and surfaces were previously objects bound to >> >> screen, and we changed that because of poor multithreading >> >> semantics. Per-context sampler views / render targets actually >> >> matches the 3D APIs semantics better, so I don't think that >> >> reverting is the solution. >> >> >> >> It looks to me that the issue here is that pipe_context should not >> >> be destroyed before the surfaces. strb->surface should only be >> >> used by one context, and should be destroyed before that context >> >> is destroyed. >> >> >> >> IIUC, strb matches GL renderbuffer semantics and can be shared by >> >> multiple context. If so, strb is treating pipe_surfaces as a >> >> entity shareable by contexts when really shouldn't. >> >> >> >> The solution is: >> >> - strb can only have pipe_resources, plus the key for the surface >> >> (face, level, etc) >> >> - the pipe_surfaces that are derived should be stored/cached in >> >> the GLcontext. >> >> - when the GLcontext / pipe_context is being destroy, the pipe >> >> surfaces can be destroyed before >> >> >> > >> > I don't understand some of it. From what I see, it should be >> > enough, >> > whenever strb binds a surface, to add a pointer to this strb to a >> > list of strb's to the pipe_context. By doing that, we would be able >> > to >> > unbind the surfaces from the strb before we destroy the context. >> > However, pipe_context structures can't reference gl structures, so >> > how >> > would you solve that? >> > >> >> Alright, maybe I'm too tired, I just have to put it in strb... My >> other questions still stand though :) >> >> Stéphane >> >> >> > Also, what difference does it make if strb's only have >> > pipe_resources? > > Pipe resources can be shared between contexts, therefore they should not > refer context or context data. > So it is always safe to destroy pipe_resources pipe_contexts on any order. > > Using your example above, if you replace surface "s1" with resource "r1", a > reference from r1 to c1 would be violating the semantics. > >> > And why do I need a key? > > "key" is a bad name perhaps. Unless the resource is always a single level 2d > texture, if we replace the strb->surface with a strb->resource, we will need > to specify separately which face/level is sought. > >> > This all is definitely more complex than it should be. > > May be I'm not understanding what you were proposing. When you said that > > "the proper solution, since surfaces outlive their context, is to make > surfaces screen-bound instead" > > I interpreted this statement as moving the pipe_context::create_surface > method to pipe_screen::create_surface. Was this really your plan or did you > meant something else? > > Because, my understanding is that it should be the other way around: when we > moved the create_surface method from pipe_screen to pipe_context, we forgot > to fix the st_renderbuffer code to do this properly. > > > > The fix I proposed may seem a bit complex, but keeping pipe_surfaces as > context objects actually helps pipe drivers that put derived data in > pipe_surfaces to be much simpler, as they no longer need complicated locking > to be thread safe -- the state tracker guarantees that pipe_surfaces belong > to that context, and that context alone. > > That is, moving stuff all into the screen sounds simple at first, but then it > becomes a serious nightmare to make it thread safe. > > > > Note that if st_renderbuffer can't be shared between GL contexts, then the > solution can be much simpler: all we need to do is ensure that the surfaces > are destroyed before the context. I haven't looked at the Mesa state tracker > code in a while, so I'm a bit rusty in this regard. > > ARB_framebuffer_object says that framebuffer objects are per-context, but > renderbuffer objects like textures can be shared between contexts. So when > one looks at st_renderbuffer defini
Re: [Mesa-dev] [PATCH 4/9] r200: Enable extensions by just setting the flags
Am 06.09.2011 22:13, schrieb Ian Romanick: > From: Ian Romanick > > Core Mesa already does the dispatch offset remapping for every > function that could possibly ever be supported. There's no need to > continue using that cruft in the driver. > > Since the call to _mesa_enable_imaging_extensions (via > driInitExtensions) is removed, EXT_blend_logic_op is explicitly added > to the list. EXT_blend_color is also added, but it depends on the > drmSupportsBlendColor flag. Hmm, I don't think EXT_blend_logic_op was advertized before. The reason for this is that EXT_blend_logic_op together with EXT_blend_equation_separate allows some unholy combinations which the r200 (possibly other hw too) can't handle correctly. Namely this combination makes it possible to have logic ops on rgb or alpha channels and color blending on the other channels. I know that at least sometime in the past this driver did not advertize EXT_blend_logic_op, since OpenGL 1.1 style logic ops do not have that problem and EXT_blend_logic_op wasn't really all that important. I guess though it's not exactly a severe problem since surely apps old enough to use EXT_blend_logic_op wouldn't try to use EXT_blend_equation_separate (though in theory some app could be clever and really want to do that...). Roland ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/8] meta: move texcoord setup into setup_texture_coords()
From: Brian Paul --- src/mesa/drivers/common/meta.c | 268 ++-- 1 files changed, 176 insertions(+), 92 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index ad04d36..a0e9316 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2477,6 +2477,160 @@ _mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target, /** + * Compute the texture coordinates for the four vertices of a quad for + * drawing a 2D texture image or slice of a cube/3D texture. + * \param faceTarget GL_TEXTURE_1D/2D/3D or cube face name + * \param slice slice of a 1D/2D array texture or 3D texture + * \param width width of the texture image + * \param height height of the texture image + * \param coords0/1/2/3 returns the computed texcoords + */ +static void +setup_texture_coords(GLenum faceTarget, + GLint slice, + GLint width, + GLint height, + GLfloat coords0[3], + GLfloat coords1[3], + GLfloat coords2[3], + GLfloat coords3[3]) +{ + static const GLfloat st[4][2] = { + {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f} + }; + GLuint i; + GLfloat r; + + switch (faceTarget) { + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + case GL_TEXTURE_2D_ARRAY: + if (faceTarget == GL_TEXTURE_3D) + r = 1.0F / slice; + else if (faceTarget == GL_TEXTURE_2D_ARRAY) + r = slice; + else + r = 0.0F; + coords0[0] = 0.0F; /* s */ + coords0[1] = 0.0F; /* t */ + coords0[2] = r; /* r */ + coords1[0] = 1.0F; + coords1[1] = 0.0F; + coords1[2] = r; + coords2[0] = 1.0F; + coords2[1] = 1.0F; + coords2[2] = r; + coords3[0] = 0.0F; + coords3[1] = 1.0F; + coords3[2] = r; + break; + case GL_TEXTURE_RECTANGLE_ARB: + coords0[0] = 0.0F; /* s */ + coords0[1] = 0.0F; /* t */ + coords0[2] = 0.0F; /* r */ + coords1[0] = width; + coords1[1] = 0.0F; + coords1[2] = 0.0F; + coords2[0] = width; + coords2[1] = height; + coords2[2] = 0.0F; + coords3[0] = 0.0F; + coords3[1] = height; + coords3[2] = 0.0F; + break; + case GL_TEXTURE_1D_ARRAY: + coords0[0] = 0.0F; /* s */ + coords0[1] = slice; /* t */ + coords0[2] = 0.0F; /* r */ + coords1[0] = 1.0f; + coords1[1] = slice; + coords1[2] = 0.0F; + coords2[0] = 1.0F; + coords2[1] = slice; + coords2[2] = 0.0F; + coords3[0] = 0.0F; + coords3[1] = slice; + coords3[2] = 0.0F; + break; + + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + /* loop over quad verts */ + for (i = 0; i < 4; i++) { + /* Compute sc = +/-scale and tc = +/-scale. + * Not +/-1 to avoid cube face selection ambiguity near the edges, + * though that can still sometimes happen with this scale factor... + */ + const GLfloat scale = 0.f; + const GLfloat sc = (2.0f * st[i][0] - 1.0f) * scale; + const GLfloat tc = (2.0f * st[i][1] - 1.0f) * scale; + GLfloat *coord; + + switch (i) { + case 0: +coord = coords0; +break; + case 1: +coord = coords1; +break; + case 2: +coord = coords2; +break; + case 3: +coord = coords3; +break; + default: +assert(0); + } + + switch (faceTarget) { + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: +coord[0] = 1.0f; +coord[1] = -tc; +coord[2] = -sc; +break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: +coord[0] = -1.0f; +coord[1] = -tc; +coord[2] = sc; +break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: +coord[0] = sc; +coord[1] = 1.0f; +coord[2] = tc; +break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: +coord[0] = sc; +coord[1] = -1.0f; +coord[2] = -tc; +break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: +coord[0] = sc; +coord[1] = -tc; +coord[2] = 1.0f; +break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: +coord[0] = -sc; +coord[1] = -tc; +coord[2] = -1.0f; +break; + default: +assert(0); + } + } + break; + default: + assert(0 && "unexpected target in meta setup_texture_coords()"); + } +} + + +/** * Called via ctx->Driver
[Mesa-dev] [PATCH 2/8] meta: added _mesa_meta_GetTexImage()
From: Brian Paul If the texture is compressed, call the meta decompress_texture_image() function. Otherwise, call the core _mesa_get_teximage() function. --- src/mesa/drivers/common/driverfuncs.c |2 +- src/mesa/drivers/common/meta.c| 224 + src/mesa/drivers/common/meta.h|7 + 3 files changed, 232 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 6484d28..36ed4f8 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -94,7 +94,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->TexSubImage1D = _mesa_store_texsubimage1d; driver->TexSubImage2D = _mesa_store_texsubimage2d; driver->TexSubImage3D = _mesa_store_texsubimage3d; - driver->GetTexImage = _mesa_get_teximage; + driver->GetTexImage = _mesa_meta_GetTexImage; driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D; driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D; driver->CopyTexSubImage3D = _mesa_meta_CopyTexSubImage3D; diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index a0e9316..2ebcd35 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -59,6 +59,7 @@ #include "main/stencil.h" #include "main/texobj.h" #include "main/texenv.h" +#include "main/texgetimage.h" #include "main/teximage.h" #include "main/texparam.h" #include "main/texstate.h" @@ -259,6 +260,18 @@ struct gen_mipmap_state GLuint FBO; }; + +/** + * State for texture decompression + */ +struct decompress_state +{ + GLuint ArrayObj; + GLuint VBO, FBO, RBO; + GLint Width, Height; +}; + + #define MAX_META_OPS_DEPTH 2 /** * All per-context meta state. @@ -278,6 +291,7 @@ struct gl_meta_state struct drawpix_state DrawPix; /**< For _mesa_meta_DrawPixels() */ struct bitmap_state Bitmap;/**< For _mesa_meta_Bitmap() */ struct gen_mipmap_state Mipmap;/**< For _mesa_meta_GenerateMipmap() */ + struct decompress_state Decompress; /**< For texture decompression */ }; @@ -3023,3 +3037,213 @@ _mesa_meta_CopyTexSubImage3D(struct gl_context *ctx, GLenum target, GLint level, copy_tex_sub_image(ctx, 3, target, level, xoffset, yoffset, zoffset, x, y, width, height); } + + +/** + * Decompress a texture image by drawing a quad with the compressed + * texture and reading the pixels out of the color buffer. + * \param slice which slice of a 3D texture or layer of a 1D/2D texture + * \param destFormat format, ala glReadPixels + * \param destType type, ala glReadPixels + * \param dest destination buffer + * \param destRowLength dest image rowLength (ala GL_PACK_ROW_LENGTH) + */ +static void +decompress_texture_image(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLuint slice, + GLenum destFormat, GLenum destType, + GLvoid *dest, GLint destRowLength) +{ + struct decompress_state *decompress = &ctx->Meta->Decompress; + struct gl_texture_object *texObj = texImage->TexObject; + const GLint width = texImage->Width; + const GLint height = texImage->Height; + const GLenum target = texObj->Target; + GLenum faceTarget; + struct vertex { + GLfloat x, y, tex[3]; + }; + struct vertex verts[4]; + GLuint fboDrawSave, fboReadSave; + + if (slice > 0) { + assert(target == GL_TEXTURE_3D || + target == GL_TEXTURE_2D_ARRAY); + } + + if (target == GL_TEXTURE_CUBE_MAP) { + faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face; + } + else { + faceTarget = target; + } + + /* save fbo bindings (not saved by _mesa_meta_begin()) */ + fboDrawSave = ctx->DrawBuffer->Name; + fboReadSave = ctx->ReadBuffer->Name; + + _mesa_meta_begin(ctx, MESA_META_ALL); + + /* Create/bind FBO/renderbuffer */ + if (decompress->FBO == 0) { + _mesa_GenFramebuffersEXT(1, &decompress->FBO); + _mesa_GenRenderbuffersEXT(1, &decompress->RBO); + _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, decompress->FBO); + _mesa_BindRenderbufferEXT(GL_RENDERBUFFER_EXT, decompress->RBO); + _mesa_FramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, + GL_COLOR_ATTACHMENT0_EXT, + GL_RENDERBUFFER_EXT, + decompress->RBO); + } + else { + _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, decompress->FBO); + } + + /* alloc dest surface */ + if (width != decompress->Width || height != decompress->Height) { + _mesa_RenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGBA, + width, height); + decompress->Width = width; + decompress->Height = height; + } + + /* setup VBO data */ + if (decompress->ArrayObj == 0) { + /* create verte
[Mesa-dev] [PATCH 3/8] mesa: add new pixel format unpacking code
From: Brian Paul This will be used instead of the texel fetch code to unpack images in various formats. --- src/mesa/SConscript |1 + src/mesa/main/format_unpack.c | 1494 + src/mesa/main/format_unpack.h | 49 ++ src/mesa/sources.mak |1 + 4 files changed, 1545 insertions(+), 0 deletions(-) create mode 100644 src/mesa/main/format_unpack.c create mode 100644 src/mesa/main/format_unpack.h diff --git a/src/mesa/SConscript b/src/mesa/SConscript index 64b7065..dfc8bd4 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -72,6 +72,7 @@ main_sources = [ 'main/ffvertex_prog.c', 'main/fog.c', 'main/formats.c', +'main/format_unpack.c', 'main/framebuffer.c', 'main/get.c', 'main/getstring.c', diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c new file mode 100644 index 000..c5146f7 --- /dev/null +++ b/src/mesa/main/format_unpack.c @@ -0,0 +1,1494 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (c) 2011 VMware, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include "colormac.h" +#include "format_unpack.h" +#include "macros.h" +#include "../../gallium/auxiliary/util/u_format_rgb9e5.h" +#include "../../gallium/auxiliary/util/u_format_r11g11b10f.h" + + +/** + * Convert an 8-bit sRGB value from non-linear space to a + * linear RGB value in [0, 1]. + * Implemented with a 256-entry lookup table. + */ +static INLINE GLfloat +nonlinear_to_linear(GLubyte cs8) +{ + static GLfloat table[256]; + static GLboolean tableReady = GL_FALSE; + if (!tableReady) { + /* compute lookup table now */ + GLuint i; + for (i = 0; i < 256; i++) { + const GLfloat cs = UBYTE_TO_FLOAT(i); + if (cs <= 0.04045) { +table[i] = cs / 12.92f; + } + else { +table[i] = (GLfloat) pow((cs + 0.055) / 1.055, 2.4); + } + } + tableReady = GL_TRUE; + } + return table[cs8]; +} + + +typedef void (*unpack_rgba_func)(const void *src, GLfloat dst[4]); + + +static void +unpack_RGBA(const void *src, GLfloat dst[4]) +{ + const GLuint s = *((const GLuint *) src); + dst[RCOMP] = UBYTE_TO_FLOAT( (s >> 24)); + dst[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); + dst[BCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); + dst[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); +} + +static void +unpack_RGBA_REV(const void *src, GLfloat dst[4]) +{ + const GLuint s = *((const GLuint *) src); + dst[RCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); + dst[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); + dst[BCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); + dst[ACOMP] = UBYTE_TO_FLOAT( (s >> 24)); +} + +static void +unpack_ARGB(const void *src, GLfloat dst[4]) +{ + const GLuint s = *((const GLuint *) src); + dst[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); + dst[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); + dst[BCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); + dst[ACOMP] = UBYTE_TO_FLOAT( (s >> 24)); +} + +static void +unpack_ARGB_REV(const void *src, GLfloat dst[4]) +{ + const GLuint s = *((const GLuint *) src); + dst[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); + dst[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); + dst[BCOMP] = UBYTE_TO_FLOAT( (s >> 24)); + dst[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); +} + +static void +unpack_XRGB(const void *src, GLfloat dst[4]) +{ + const GLuint s = *((const GLuint *) src); + dst[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); + dst[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); + dst[BCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); + dst[ACOMP] = 1.0f; +} + +static void +unpack_XRGB_REV(const void *src, GLfloat dst[4]) +{ + const GLuint s = *((const GLuint *) src); + dst[RCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); + dst[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); + dst[BCOMP] = UBYTE_TO_FLOAT( (s >> 24)
[Mesa-dev] [PATCH 4/8] mesa: added _mesa_get_uncompressed_format(), _mesa_format_num_components()
From: Brian Paul --- src/mesa/main/formats.c | 64 +++ src/mesa/main/formats.h |7 + 2 files changed, 71 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index c6634c4..11d6706 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -1343,6 +1343,70 @@ _mesa_get_srgb_format_linear(gl_format format) /** + * If the given format is a compressed format, return a corresponding + * uncompressed format. + */ +gl_format +_mesa_get_uncompressed_format(gl_format format) +{ + switch (format) { + case MESA_FORMAT_RGB_FXT1: + return MESA_FORMAT_RGB888; + case MESA_FORMAT_RGBA_FXT1: + return MESA_FORMAT_RGBA; + case MESA_FORMAT_RGB_DXT1: + case MESA_FORMAT_SRGB_DXT1: + return MESA_FORMAT_RGB888; + case MESA_FORMAT_RGBA_DXT1: + case MESA_FORMAT_SRGBA_DXT1: + return MESA_FORMAT_RGBA; + case MESA_FORMAT_RGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT3: + return MESA_FORMAT_RGBA; + case MESA_FORMAT_RGBA_DXT5: + case MESA_FORMAT_SRGBA_DXT5: + return MESA_FORMAT_RGBA; + case MESA_FORMAT_RED_RGTC1: + return MESA_FORMAT_R8; + case MESA_FORMAT_SIGNED_RED_RGTC1: + return MESA_FORMAT_SIGNED_R8; + case MESA_FORMAT_RG_RGTC2: + return MESA_FORMAT_RG88; + case MESA_FORMAT_SIGNED_RG_RGTC2: + return MESA_FORMAT_SIGNED_RG88_REV; + case MESA_FORMAT_L_LATC1: + return MESA_FORMAT_L8; + case MESA_FORMAT_SIGNED_L_LATC1: + return MESA_FORMAT_SIGNED_L8; + case MESA_FORMAT_LA_LATC2: + return MESA_FORMAT_AL88; + case MESA_FORMAT_SIGNED_LA_LATC2: + return MESA_FORMAT_SIGNED_AL88; + default: +#ifdef DEBUG + assert(!_mesa_is_format_compressed(format)); +#endif + return format; + } +} + + +GLuint +_mesa_format_num_components(gl_format format) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + return ((info->RedBits > 0) + + (info->GreenBits > 0) + + (info->BlueBits > 0) + + (info->AlphaBits > 0) + + (info->LuminanceBits > 0) + + (info->IntensityBits > 0) + + (info->DepthBits > 0) + + (info->StencilBits > 0)); +} + + +/** * Return number of bytes needed to store an image of the given size * in the given format. */ diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 75d93de..610204c 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -266,4 +266,11 @@ _mesa_test_formats(void); extern gl_format _mesa_get_srgb_format_linear(gl_format format); +extern gl_format +_mesa_get_uncompressed_format(gl_format format); + +extern GLuint +_mesa_format_num_components(gl_format format); + + #endif /* FORMATS_H */ -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/8] mesa: new _mesa_decompress_image() function
From: Brian Paul Use the old texture fetch functions to decompress a whole image. To be used by glGetTexImage(). --- src/mesa/main/texcompress.c | 86 +++ src/mesa/main/texcompress.h |5 ++ 2 files changed, 91 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 42bd1ee..08ad130 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -37,6 +37,9 @@ #include "mfeatures.h" #include "mtypes.h" #include "texcompress.h" +#include "texcompress_fxt1.h" +#include "texcompress_rgtc.h" +#include "texcompress_s3tc.h" /** @@ -437,3 +440,86 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, return (GLubyte *) image + offset; } + + +/** + * Decompress a compressed texture image, returning a GL_RGBA/GL_FLOAT image. + */ +void +_mesa_decompress_image(gl_format format, GLuint width, GLuint height, + const GLubyte *src, GLint srcRowStride, + GLfloat *dest) +{ + void (*fetch)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel); + struct gl_texture_image texImage; /* dummy teximage */ + GLuint i, j; + + /* setup dummy texture image info */ + memset(&texImage, 0, sizeof(texImage)); + texImage.Data = (void *) src; + texImage.RowStride = srcRowStride; + + switch (format) { + /* DXT formats */ + case MESA_FORMAT_RGB_DXT1: + fetch = _mesa_fetch_texel_2d_f_rgb_dxt1; + break; + case MESA_FORMAT_RGBA_DXT1: + fetch = _mesa_fetch_texel_2d_f_rgba_dxt1; + break; + case MESA_FORMAT_RGBA_DXT3: + fetch = _mesa_fetch_texel_2d_f_rgba_dxt3; + break; + case MESA_FORMAT_RGBA_DXT5: + fetch = _mesa_fetch_texel_2d_f_rgba_dxt5; + break; + + /* FXT1 formats */ + case MESA_FORMAT_RGB_FXT1: + fetch = _mesa_fetch_texel_2d_f_rgb_fxt1; + break; + case MESA_FORMAT_RGBA_FXT1: + fetch = _mesa_fetch_texel_2d_f_rgba_fxt1; + break; + + /* Red/RG formats */ + case MESA_FORMAT_RED_RGTC1: + fetch = _mesa_fetch_texel_2d_f_red_rgtc1; + break; + case MESA_FORMAT_SIGNED_RED_RGTC1: + fetch = _mesa_fetch_texel_2d_f_signed_red_rgtc1; + break; + case MESA_FORMAT_RG_RGTC2: + fetch = _mesa_fetch_texel_2d_f_rg_rgtc2; + break; + case MESA_FORMAT_SIGNED_RG_RGTC2: + fetch = _mesa_fetch_texel_2d_f_signed_rg_rgtc2; + break; + + /* L/LA formats */ + case MESA_FORMAT_L_LATC1: + fetch = _mesa_fetch_texel_2d_f_l_latc1; + break; + case MESA_FORMAT_SIGNED_L_LATC1: + fetch = _mesa_fetch_texel_2d_f_signed_l_latc1; + break; + case MESA_FORMAT_LA_LATC2: + fetch = _mesa_fetch_texel_2d_f_la_latc2; + break; + case MESA_FORMAT_SIGNED_LA_LATC2: + fetch = _mesa_fetch_texel_2d_f_signed_la_latc2; + break; + + default: + _mesa_problem(NULL, "Unexpected format in _mesa_decompress_image()"); + return; + } + + for (j = 0; j < height; j++) { + for (i = 0; i < width; i++) { + fetch(&texImage, i, j, 0, dest); + dest += 4; + } + } +} diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index 375cf90..2c35706 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -50,6 +50,11 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, gl_format mesaFormat, GLsizei width, const GLubyte *image); +extern void +_mesa_decompress_image(gl_format format, GLuint width, GLuint height, + const GLubyte *src, GLint srcRowStride, + GLfloat *dest); + #else /* _HAVE_FULL_GL */ /* no-op macros */ -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/8] mesa: handle compressed images in get_tex_rgba()
From: Brian Paul Uses the new _mesa_decompress_image() function. Unlike the meta path that uses textured quad rendering to do decompression, this works with signed formats as well. --- src/mesa/main/texgetimage.c | 164 --- 1 files changed, 106 insertions(+), 58 deletions(-) diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 99ace91..a39ac59 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -34,11 +34,13 @@ #include "enums.h" #include "context.h" #include "formats.h" +#include "format_unpack.h" #include "image.h" #include "mfeatures.h" #include "mtypes.h" #include "pack.h" #include "pbo.h" +#include "texcompress.h" #include "texgetimage.h" #include "texfetch.h" #include "teximage.h" @@ -173,95 +175,141 @@ get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions, /** - * glGetTexImage for (s)RGBA, Luminance, etc. pixels. - * This is the slow way since we use texture sampling. + * glGetTexImage for color formats (RGBA, RGB, alpha, LA, etc). + * Compressed textures are handled here as well. */ static void get_tex_rgba(struct gl_context *ctx, GLuint dimensions, GLenum format, GLenum type, GLvoid *pixels, struct gl_texture_image *texImage) { - const GLint width = texImage->Width; - const GLint height = texImage->Height; - const GLint depth = texImage->Depth; - const GLenum dataType = _mesa_get_format_datatype(texImage->TexFormat); + /* don't want to apply sRGB -> RGB conversion here so override the format */ + const gl_format texFormat = _mesa_get_srgb_format_linear(texImage->TexFormat); + const GLuint width = texImage->Width; + const GLuint height = texImage->Height; + const GLuint depth = texImage->Depth; + const GLenum dataType = _mesa_get_format_datatype(texFormat); + const GLenum baseFormat = _mesa_get_format_base_format(texFormat); /* Normally, no pixel transfer ops are performed during glGetTexImage. * The only possible exception is component clamping to [0,1]. */ GLbitfield transferOps = 0x0; - GLint img, row; - GLfloat (*rgba)[4] = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat)); - const GLboolean is_sampler_srgb_decode = - _mesa_get_format_color_encoding(texImage->TexFormat) == GL_SRGB && - texImage->TexObject->Sampler.sRGBDecode == GL_DECODE_EXT; - if (!rgba) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage"); - return; - } - - /* Clamping does not apply to GetTexImage (final conversion)? -* Looks like we need clamp though when going from format -* containing negative values to unsigned format. + /* In general, clamping does not apply to glGetTexImage, except when +* the returned type of the image can't hold negative values. */ - if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) { - transferOps |= IMAGE_CLAMP_BIT; - } - else if (!type_with_negative_values(type) && -(dataType == GL_FLOAT || - dataType == GL_SIGNED_NORMALIZED)) { - transferOps |= IMAGE_CLAMP_BIT; + if (!type_with_negative_values(type)) { + /* the returned image type can't have negative values */ + if (dataType == GL_FLOAT || + dataType == GL_SIGNED_NORMALIZED || + format == GL_LUMINANCE || + format == GL_LUMINANCE_ALPHA) { + transferOps |= IMAGE_CLAMP_BIT; + } } - /* glGetTexImage always returns sRGB data for sRGB textures. Make sure the -* fetch functions return sRGB data without linearizing it. -*/ - if (is_sampler_srgb_decode) { - texImage->TexObject->Sampler.sRGBDecode = GL_SKIP_DECODE_EXT; - _mesa_set_fetch_functions(texImage, dimensions); - } + if (_mesa_is_format_compressed(texFormat)) { + /* Decompress into temp buffer, then pack into user buffer */ + GLfloat *tempImage, *srcRow; + GLuint row; - for (img = 0; img < depth; img++) { + tempImage = (GLfloat *) malloc(texImage->Width * texImage->Height * + texImage->Depth * 4 * sizeof(GLfloat)); + if (!tempImage) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage()"); + return; + } + + _mesa_decompress_image(texFormat, texImage->Width, texImage->Height, + texImage->Data, texImage->RowStride, tempImage); + + if (baseFormat == GL_LUMINANCE || + baseFormat == GL_LUMINANCE_ALPHA) { + /* Set green and blue to zero since the pack function here will + * compute L=R+G+B. + */ + GLuint i; + for (i = 0; i < width * height; i++) { +tempImage[i * 4 + GCOMP] = tempImage[i * 4 + BCOMP] = 0.0f; + } + } + + srcRow = tempImage; for (row = 0; row < height; row++) { void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels, width, height, format, type,
[Mesa-dev] [PATCH 7/8] mesa: use ctx->Driver.GetTexImage() to decompress base texture image
From: Brian Paul This is a simple way to do the job and it removes one more use of the soon-to-be-removed gl_texture_image::FetchTexelc() function. --- src/mesa/main/mipmap.c | 85 --- 1 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index cf9d522..869243d 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1985,50 +1985,45 @@ generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target, static void generate_mipmap_compressed(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj, - const struct gl_texture_image *srcImage, + struct gl_texture_image *srcImage, GLuint maxLevel) { GLint level; gl_format temp_format; - GLenum datatype; - GLuint comps; - GLuint row; GLint components; GLuint temp_src_stride, temp_dst_stride; /* in bytes */ GLchan *temp_src = NULL, *temp_dst = NULL; + GLenum temp_datatype; + GLenum temp_base_format; - /* Choose the format we will do _mesa_generate_mipmap_level() in, -* and uncompress the firstImage into a temporary of that format. -*/ + /* only two types of compressed textures at this time */ assert(texObj->Target == GL_TEXTURE_2D || texObj->Target == GL_TEXTURE_CUBE_MAP_ARB); - if (srcImage->_BaseFormat == GL_RGB) { - temp_format = MESA_FORMAT_RGB888; - components = 3; - } else if (srcImage->_BaseFormat == GL_RED) { - temp_format = MESA_FORMAT_R8; - components = 1; - } else if (srcImage->_BaseFormat == GL_RG) { - temp_format = MESA_FORMAT_RG88; - components = 2; - } else if (srcImage->_BaseFormat == GL_RGBA) { - temp_format = MESA_FORMAT_RGBA; - components = 4; - } else if (srcImage->_BaseFormat == GL_LUMINANCE) { - temp_format = MESA_FORMAT_L8; - components = 1; - } else if (srcImage->_BaseFormat == GL_LUMINANCE_ALPHA) { - temp_format = MESA_FORMAT_AL88; - components = 2; - } else { - _mesa_problem(ctx, "bad srcImage->_BaseFormat in _mesa_generate_mipmaps"); - return; + /* +* Choose a format for the temporary, uncompressed base image. +* Then, get number of components, choose temporary image datatype, +* and get base format. +*/ + temp_format = _mesa_get_uncompressed_format(srcImage->TexFormat); + + components = _mesa_format_num_components(temp_format); + + /* Revisit this if we get compressed formats with >8 bits per component */ + if (_mesa_get_format_datatype(srcImage->TexFormat) + == GL_SIGNED_NORMALIZED) { + temp_datatype = GL_BYTE; + } + else { + temp_datatype = GL_UNSIGNED_BYTE; } - /* allocate storage for uncompressed GL_RGB or GL_RGBA images */ - temp_src_stride = _mesa_format_row_stride(temp_format, srcImage->Width); + temp_base_format = _mesa_get_format_base_format(temp_format); + + + /* allocate storage for the temporary, uncompressed image */ /* 20 extra bytes, just be safe when calling last FetchTexel */ + temp_src_stride = _mesa_format_row_stride(temp_format, srcImage->Width); temp_src = (GLubyte *) malloc(temp_src_stride * srcImage->Height + 20); if (!temp_src) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps"); @@ -2036,16 +2031,20 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, } /* decompress base image to the temporary */ - for (row = 0; row < srcImage->Height; row++) { - GLuint col; - GLchan *dst = (GLchan *) temp_src + temp_src_stride * row; - for (col = 0; col < srcImage->Width; col++) { -srcImage->FetchTexelc(srcImage, col, row, 0, dst); -dst += components; - } + { + /* save pixel packing mode */ + struct gl_pixelstore_attrib save = ctx->Pack; + /* use default/tight packing parameters */ + ctx->Pack = ctx->DefaultPacking; + + /* Get the uncompressed image */ + ctx->Driver.GetTexImage(ctx, target, texObj->BaseLevel, + temp_base_format, temp_datatype, + temp_src, texObj, srcImage); + /* restore packing mode */ + ctx->Pack = save; } - _mesa_format_to_type_and_comps(temp_format, &datatype, &comps); for (level = texObj->BaseLevel; level < maxLevel; level++) { /* generate image[level+1] from image[level] */ @@ -2086,7 +2085,10 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, return; } - _mesa_generate_mipmap_level(target, datatype, comps, border, + /* Free old image data */ + ctx->Driver.FreeTextureImageBuffer(ctx, dstImage); + + _mesa_generate_mipmap_level(target, temp_datatype, components, border, srcWidth, srcHeight, srcDepth, temp_src, temp_src_stride /
[Mesa-dev] [PATCH 8/8] mesa: use _mesa_unpack_float_z_row in get_tex_depth()
From: Brian Paul Removes another use of the gl_texture_image::FetchTexelf() function. --- src/mesa/main/texgetimage.c | 12 +++- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index a39ac59..4ab39a4 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -77,8 +77,9 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions, const GLint width = texImage->Width; const GLint height = texImage->Height; const GLint depth = texImage->Depth; - GLint img, row, col; + GLint img, row; GLfloat *depthRow = (GLfloat *) malloc(width * sizeof(GLfloat)); + const GLint texelSize = _mesa_get_format_bytes(texImage->TexFormat); if (!depthRow) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage"); @@ -90,11 +91,12 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions, void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels, width, height, format, type, img, row, 0); - assert(dest); + const GLubyte *src = (GLubyte *) texImage->Data + +(texImage->ImageOffsets[img] + + texImage->RowStride * row) * texelSize; + + _mesa_unpack_float_z_row(texImage->TexFormat, width, src, depthRow); - for (col = 0; col < width; col++) { -texImage->FetchTexelf(texImage, col, row, img, depthRow + col); - } _mesa_pack_depth_span(ctx, width, dest, type, depthRow, &ctx->Pack); } } -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] State tracker pipe_surface woes...
Am 07.09.2011 00:01, schrieb Stéphane Marchesin: > 2011/9/3 Jose Fonseca : >> >> >> - Original Message - >>> 2011/9/2 Stéphane Marchesin : 2011/9/2 Jose Fonseca : > - Original Message - >> Hi, >> >> While debugging some code I ran across the following situation: >> >> - pipe_context c1 is created >> - pipe_surface s1 is created >> - strb-> surface is set to s1 (s1's refcount goes up) >> - pipe_context c1 is destroyed >> - strb is destroyed >> - strb->surface is destroyed (so s1's refcount is now 0 and we >> want >> to >> destroy it) >> >> At that point s1 references c1 which is not available any more, >> so >> when we try to call ctx->surface_destroy to destroy s1 we crash. >> >> We discussed this a bit on IRC, and we agreed that the proper >> solution, since surfaces outlive their context, is to make >> surfaces >> screen-bound instead. I'm going to implement that unless someone >> objects. >> >> As a side note, the same issue will happen with sampler_views, so >> it'll get a similar fix. > > Sampler views and surfaces were previously objects bound to > screen, and we changed that because of poor multithreading > semantics. Per-context sampler views / render targets actually > matches the 3D APIs semantics better, so I don't think that > reverting is the solution. > > It looks to me that the issue here is that pipe_context should not > be destroyed before the surfaces. strb->surface should only be > used by one context, and should be destroyed before that context > is destroyed. > > IIUC, strb matches GL renderbuffer semantics and can be shared by > multiple context. If so, strb is treating pipe_surfaces as a > entity shareable by contexts when really shouldn't. > > The solution is: > - strb can only have pipe_resources, plus the key for the surface > (face, level, etc) > - the pipe_surfaces that are derived should be stored/cached in > the GLcontext. > - when the GLcontext / pipe_context is being destroy, the pipe > surfaces can be destroyed before > I don't understand some of it. From what I see, it should be enough, whenever strb binds a surface, to add a pointer to this strb to a list of strb's to the pipe_context. By doing that, we would be able to unbind the surfaces from the strb before we destroy the context. However, pipe_context structures can't reference gl structures, so how would you solve that? >>> >>> Alright, maybe I'm too tired, I just have to put it in strb... My >>> other questions still stand though :) >>> >>> Stéphane >>> >>> Also, what difference does it make if strb's only have pipe_resources? >> >> Pipe resources can be shared between contexts, therefore they should not >> refer context or context data. >> So it is always safe to destroy pipe_resources pipe_contexts on any order. >> >> Using your example above, if you replace surface "s1" with resource "r1", a >> reference from r1 to c1 would be violating the semantics. >> And why do I need a key? >> >> "key" is a bad name perhaps. Unless the resource is always a single level >> 2d texture, if we replace the strb->surface with a strb->resource, we will >> need to specify separately which face/level is sought. >> This all is definitely more complex than it should be. >> >> May be I'm not understanding what you were proposing. When you said that >> >> "the proper solution, since surfaces outlive their context, is to make >> surfaces screen-bound instead" >> >> I interpreted this statement as moving the pipe_context::create_surface >> method to pipe_screen::create_surface. Was this really your plan or did you >> meant something else? >> >> Because, my understanding is that it should be the other way around: when we >> moved the create_surface method from pipe_screen to pipe_context, we forgot >> to fix the st_renderbuffer code to do this properly. >> >> >> >> The fix I proposed may seem a bit complex, but keeping pipe_surfaces as >> context objects actually helps pipe drivers that put derived data in >> pipe_surfaces to be much simpler, as they no longer need complicated locking >> to be thread safe -- the state tracker guarantees that pipe_surfaces belong >> to that context, and that context alone. >> >> That is, moving stuff all into the screen sounds simple at first, but then >> it becomes a serious nightmare to make it thread safe. >> >> >> >> Note that if st_renderbuffer can't be shared between GL contexts, then the >> solution can be much simpler: all we need to do is ensure that the surfaces >> are destroyed before the context. I haven't looked at the Mesa state tracker >> code in a while, so I'm a bit rusty in this regard. >> >> ARB_framebuffer_object says that framebuffer objects are per-context, but >> rende
Re: [Mesa-dev] [PATCH 0/9] Stop trying to remap function offset in drivers
On 09/06/2011 01:13 PM, Ian Romanick wrote: > This is the first part of a re-spin of my previous extension > refactoring patches. This series just removes the function remapping > from all of the drivers. This has been handled by remap.c in core > Mesa for a long time. > > The next patch to the list will gut most of the now-unused parts of > remap_helper.h. > > The series after that will remove some unnecessary extension enable > flags. > > I'll try to have a proposal for handling different GL APIs (e.g., 3.0 > core vs. 3.0 forward-looking vs. ES 2.0) out later this week. None of > the patches mentioned above should change this issue for Mesa in any > way. Patches 1, 2, and 9: Reviewed-by: Kenneth Graunke ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] State tracker pipe_surface woes...
2011/9/6 Roland Scheidegger : > Am 07.09.2011 00:01, schrieb Stéphane Marchesin: >> 2011/9/3 Jose Fonseca : >>> >>> >>> - Original Message - 2011/9/2 Stéphane Marchesin : > 2011/9/2 Jose Fonseca : >> - Original Message - >>> Hi, >>> >>> While debugging some code I ran across the following situation: >>> >>> - pipe_context c1 is created >>> - pipe_surface s1 is created >>> - strb-> surface is set to s1 (s1's refcount goes up) >>> - pipe_context c1 is destroyed >>> - strb is destroyed >>> - strb->surface is destroyed (so s1's refcount is now 0 and we >>> want >>> to >>> destroy it) >>> >>> At that point s1 references c1 which is not available any more, >>> so >>> when we try to call ctx->surface_destroy to destroy s1 we crash. >>> >>> We discussed this a bit on IRC, and we agreed that the proper >>> solution, since surfaces outlive their context, is to make >>> surfaces >>> screen-bound instead. I'm going to implement that unless someone >>> objects. >>> >>> As a side note, the same issue will happen with sampler_views, so >>> it'll get a similar fix. >> >> Sampler views and surfaces were previously objects bound to >> screen, and we changed that because of poor multithreading >> semantics. Per-context sampler views / render targets actually >> matches the 3D APIs semantics better, so I don't think that >> reverting is the solution. >> >> It looks to me that the issue here is that pipe_context should not >> be destroyed before the surfaces. strb->surface should only be >> used by one context, and should be destroyed before that context >> is destroyed. >> >> IIUC, strb matches GL renderbuffer semantics and can be shared by >> multiple context. If so, strb is treating pipe_surfaces as a >> entity shareable by contexts when really shouldn't. >> >> The solution is: >> - strb can only have pipe_resources, plus the key for the surface >> (face, level, etc) >> - the pipe_surfaces that are derived should be stored/cached in >> the GLcontext. >> - when the GLcontext / pipe_context is being destroy, the pipe >> surfaces can be destroyed before >> > > I don't understand some of it. From what I see, it should be > enough, > whenever strb binds a surface, to add a pointer to this strb to a > list of strb's to the pipe_context. By doing that, we would be able > to > unbind the surfaces from the strb before we destroy the context. > However, pipe_context structures can't reference gl structures, so > how > would you solve that? > Alright, maybe I'm too tired, I just have to put it in strb... My other questions still stand though :) Stéphane > Also, what difference does it make if strb's only have > pipe_resources? >>> >>> Pipe resources can be shared between contexts, therefore they should not >>> refer context or context data. >>> So it is always safe to destroy pipe_resources pipe_contexts on any order. >>> >>> Using your example above, if you replace surface "s1" with resource "r1", a >>> reference from r1 to c1 would be violating the semantics. >>> > And why do I need a key? >>> >>> "key" is a bad name perhaps. Unless the resource is always a single level >>> 2d texture, if we replace the strb->surface with a strb->resource, we will >>> need to specify separately which face/level is sought. >>> > This all is definitely more complex than it should be. >>> >>> May be I'm not understanding what you were proposing. When you said that >>> >>> "the proper solution, since surfaces outlive their context, is to make >>> surfaces screen-bound instead" >>> >>> I interpreted this statement as moving the pipe_context::create_surface >>> method to pipe_screen::create_surface. Was this really your plan or did you >>> meant something else? >>> >>> Because, my understanding is that it should be the other way around: when >>> we moved the create_surface method from pipe_screen to pipe_context, we >>> forgot to fix the st_renderbuffer code to do this properly. >>> >>> >>> >>> The fix I proposed may seem a bit complex, but keeping pipe_surfaces as >>> context objects actually helps pipe drivers that put derived data in >>> pipe_surfaces to be much simpler, as they no longer need complicated >>> locking to be thread safe -- the state tracker guarantees that >>> pipe_surfaces belong to that context, and that context alone. >>> >>> That is, moving stuff all into the screen sounds simple at first, but then >>> it becomes a serious nightmare to make it thread safe. >>> >>> >>> >>> Note that if st_renderbuffer can't be shared between GL contexts, then the >>> solution can be much simpler: all we need to do is ensure that the surfaces >>> are destroyed before the context. I haven't looked at the Mesa state
Re: [Mesa-dev] [PATCH 07/13] r600g: fix texture array filtering
On Tue, Sep 6, 2011 at 8:29 AM, Dave Airlie wrote: > On Mon, Sep 5, 2011 at 10:44 PM, Marek Olšák wrote: >> This fixes piglit/fbo-generatemipmap-array. >> >> It looks like SQ_TEX_SAMPLER_WORD0_0.TEX_ARRAY_OVERRIDE should be set >> for array textures in order to disable filtering between slices, >> which adds a dependency between sampler views and sampler states. >> >> This patch reworks sampler state updates such that they are postponed until >> draw time. TEX_ARRAY_OVERRIDE is updated according to bound sampler views. >> >> This also consolidates setting the texture state between vertex and >> pixel shaders. > > Have you measured the impact of this on framerate? I spent a lot of > time making sure we didn't do things in the draw_vbo path that we > didn't need to. > > It might be better to attempt these sort of updates at bind time if we > can, even if its a bit uglier, though hopefully the dirty flag > mitigates this I'd rather know for sure. Well, I didn't test the performance. However if an app does not use texture arrays, this may be either as fast as the old code or faster. The dirty flag ensures sampler states are not updated needlessly, so basically it just postpones the state update, it doesn't add more CPU work. The things are different when bind_fragment_sampler_states is called twice (imagine cso_cache or u_blitter restoring the state, then an app changes it; or vice versa, an app changes the state, then u_blit or u_blitter change it again). In that case, the new code would be faster, because the bind_*_sampler_states functions don't set anything, they just copy the parameters. The state update is done only once in draw_vbo. I originally did this at bind time and not only was it ugly, it was less efficient overall. The thing was the sampler states would have had to be updated TWICE whenever a sampler view was changed from non-array to array or vice versa. One state update was in set_*_sampler_states and the other one in set_*_sampler_views, trying to update TEX_ARRAY_OVERRIDE in sampler states. I hope that makes sense. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/5] glsl: Add front-end support for gl_ClipDistance.
On 09/06/2011 01:51 PM, Paul Berry wrote: > This patch series modifies the GLSL front-end to implement all the > proper behaviors for gl_ClipDistance, namely: > > - gl_ClipDistance is predeclared as unsized in both the vertex and > fragment shader. > - It is an error to size gl_ClipDistance (either explicitly or > implicitly) larger than gl_MaxClipDistances. > - It is an error to write to both gl_ClipDistance and gl_ClipVertex. > > There is no back-end support for gl_ClipDistance yet. > > [PATCH 1/5] glsl: Make gl_ClipDistance[] implicitly sized. > [PATCH 2/5] glsl: Add constant gl_MaxClipDistances. > [PATCH 3/5] glsl: Rework oversize array check for gl_TexCoord. > [PATCH 4/5] glsl: Check that gl_ClipDistance[] is not sized too large. > [PATCH 5/5] glsl: Make sure gl_ClipDistance and gl_ClipVertex are not both > written. Nice work as always, Paul. For the series: Reviewed-by: Kenneth Graunke ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 40668] New: Mesa compilation failure with wayland master
https://bugs.freedesktop.org/show_bug.cgi?id=40668 Summary: Mesa compilation failure with wayland master Product: Mesa Version: unspecified Platform: Other OS/Version: All Status: NEW Severity: normal Priority: medium Component: Other AssignedTo: mesa-dev@lists.freedesktop.org ReportedBy: sarv...@gmail.com configure flags used: ./configure --prefix=/usr --mandir=\${prefix}/share/man --infodir=\${prefix}/share/info --sysconfdir=/etc --libdir=\${prefix}/lib/x86_64-linux-gnu --localstatedir=/var --build=x86_64-linux-gnu --with-driver=dri --with-dri-drivers="swrast nouveau r200 r300 r600 radeon i915 i965" --with-dri-driverdir=/usr/lib/x86_64-linux-gnu/dri --enable-glx-tls --enable-shared-dricore --enable-shared-glapi --enable-texture-float --enable-driglx-direct --with-egl-platforms="x11 drm wayland" --enable-gallium-llvm --with-gallium-drivers="swrast nouveau r600 i915 r300" --enable-gles1 --enable-gles2 --enable-openvg --enable-gallium-egl --disable-glu --disable-glut --disable-glw error: gcc -c -I. -I../../../../src/gallium/include -I../../../../src/gallium/auxiliary -I../../../../src/egl/main -I../../../../src/egl/wayland/wayland-drm/ -I../../../../include -DHAVE_X11_BACKEND -DHAVE_WAYLAND_BACKEND -DHAVE_DRM_BACKEND -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DHAVE_ALIAS -DHAVE_MINCORE -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0209 -DHAVE_WAYLAND_BACKEND -Wall -g -O2 -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing -Wall -g -O2 -fPIC -DUSE_X86_64_ASM -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DHAVE_ALIAS -DHAVE_MINCORE -DHAVE_LIBUDEV -DHAVE_XCB_DRI2 -DXCB_DRI2_CONNECT_DEVICE_NAME_BROKEN -D__STDC_CONSTANT_MACROS -DHAVE_LLVM=0x0209 -DHAVE_WAYLAND_BACKEND -fvisibility=hidden common/native_wayland_drm_bufmgr_helper.c -o common/native_wayland_drm_bufmgr_helper.o In file included from common/native_wayland_drm_bufmgr_helper.c:13:0: common/native_wayland_drm_bufmgr_helper.h:35:47: warning: 'struct wl_visual' declared inside parameter list common/native_wayland_drm_bufmgr_helper.h:35:47: warning: its scope is only this definition or declaration, which is probably not what you want common/native_wayland_drm_bufmgr_helper.c:19:47: warning: 'struct wl_visual' declared inside parameter list common/native_wayland_drm_bufmgr_helper.c:16:1: error: conflicting types for 'egl_g3d_wl_drm_helper_reference_buffer' common/native_wayland_drm_bufmgr_helper.h:32:1: note: previous declaration of 'egl_g3d_wl_drm_helper_reference_buffer' was here make[5]: *** [common/native_wayland_drm_bufmgr_helper.o] Error 1 make[5]: Leaving directory `/build/buildd/mesa-7.12.0~git20110906.23eec54b/build/dri/src/gallium/state_trackers/egl' make[4]: *** [subdirs] Error 1 make[4]: Leaving directory `/build/buildd/mesa-7.12.0~git20110906.23eec54b/build/dri/src/gallium/state_trackers' make[3]: *** [default] Error 1 make[3]: Leaving directory `/build/buildd/mesa-7.12.0~git20110906.23eec54b/build/dri/src/gallium' make[2]: *** [subdirs] Error 1 make[2]: Leaving directory `/build/buildd/mesa-7.12.0~git20110906.23eec54b/build/dri/src' make[1]: *** [default] Error 1 make[1]: Leaving directory `/build/buildd/mesa-7.12.0~git20110906.23eec54b/build/dri' make: *** [debian/stamp/x86_64-linux-gnu-build-dri] Error 2 make: *** Waiting for unfinished jobs Full build log available here (too large to attach) https://launchpadlibrarian.net/79197922/buildlog_ubuntu-natty-amd64.mesa_7.12.0~git20110906.23eec54b-0ubuntu0sarvatt~natty_FAILEDTOBUILD.txt.gz that build log contains a number of patches but can be reproduced on a clean checkout with the above configure flags and no patches. -- Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 01/13] gallium: add PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS
On Tue, Sep 6, 2011 at 12:12 PM, Jose Fonseca wrote: > - Original Message - >> On 05.09.2011 23:44, Marek Olšák wrote: >> > --- >> > src/gallium/include/pipe/p_defines.h | 1 + >> > src/mesa/state_tracker/st_extensions.c | 3 +++ >> > 2 files changed, 4 insertions(+), 0 deletions(-) >> > >> > diff --git a/src/gallium/include/pipe/p_defines.h >> > b/src/gallium/include/pipe/p_defines.h >> > index 19c0cab..9a9ce2e 100644 >> > --- a/src/gallium/include/pipe/p_defines.h >> > +++ b/src/gallium/include/pipe/p_defines.h >> > @@ -474,6 +474,7 @@ enum pipe_cap { >> > PIPE_CAP_SCALED_RESOLVE = 49, >> > PIPE_CAP_MIN_TEXEL_OFFSET = 50, >> > PIPE_CAP_MAX_TEXEL_OFFSET = 51, >> > + PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS = 52 >> > }; >> > >> Can we remove the old PIPE_CAP_ARRAY_TEXTURES then in favour of >> returning 0 as maximum number of layers ? > > I'd like that too FWIW. Amended in the attached patch. Marek From 13ca856296bb1d54e7b1cdd243569cd36ee301fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 5 Sep 2011 22:52:21 +0200 Subject: [PATCH] gallium: add PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS v2: remove PIPE_CAP_ARRAY_TEXTURES in favor of the new CAP. --- src/gallium/drivers/i915/i915_screen.c |2 +- src/gallium/drivers/nv50/nv50_screen.c |2 +- src/gallium/drivers/nvc0/nvc0_screen.c |4 ++-- src/gallium/drivers/nvfx/nvfx_screen.c |2 +- src/gallium/drivers/r300/r300_screen.c |2 +- src/gallium/drivers/r600/r600_pipe.c |5 ++--- src/gallium/drivers/softpipe/sp_screen.c |4 ++-- src/gallium/include/pipe/p_defines.h |2 +- src/mesa/state_tracker/st_extensions.c |5 - 9 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index c108c70..4e55e16 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -124,7 +124,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) return is->debug.lie ? 1 : 0; /* Unsupported features (boolean caps). */ - case PIPE_CAP_ARRAY_TEXTURES: + case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS: case PIPE_CAP_DEPTH_CLAMP: case PIPE_CAP_INDEP_BLEND_ENABLE: case PIPE_CAP_INDEP_BLEND_FUNC: diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 235cd82..7d43f1f 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -88,7 +88,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 10; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: return 13; - case PIPE_CAP_ARRAY_TEXTURES: /* shader support missing */ + case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS: /* shader support missing */ return 0; case PIPE_CAP_TEXTURE_MIRROR_CLAMP: case PIPE_CAP_TEXTURE_MIRROR_REPEAT: diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index d3027de..a8bd092 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nvc0/nvc0_screen.c @@ -79,8 +79,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 10; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: return 13; - case PIPE_CAP_ARRAY_TEXTURES: - return 1; + case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS: + return 8192; case PIPE_CAP_TEXTURE_MIRROR_CLAMP: case PIPE_CAP_TEXTURE_MIRROR_REPEAT: case PIPE_CAP_TEXTURE_SWIZZLE: diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index 3b77c96..5729e66 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -85,7 +85,7 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 0; // TODO: implement depth clamp case PIPE_CAP_PRIMITIVE_RESTART: return 0; // TODO: implement primitive restart - case PIPE_CAP_ARRAY_TEXTURES: + case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS: case PIPE_CAP_TGSI_INSTANCEID: case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: case PIPE_CAP_FRAGMENT_COLOR_CLAMP_CONTROL: diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 8c0500c..896ee9a 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -135,7 +135,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param) case PIPE_CAP_DEPTH_CLAMP: case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE: case PIPE_CAP_SHADER_STENCIL_EXPORT: -case PIPE_CAP_ARRAY_TEXTURES: +case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS: case PIPE_CAP_TGSI_INSTANCEID: case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index e02da6e..cfbeae5 100644 --- a/src/galliu
Re: [Mesa-dev] State tracker pipe_surface woes...
2011/9/2 Jose Fonseca : > - Original Message - >> Hi, >> >> While debugging some code I ran across the following situation: >> >> - pipe_context c1 is created >> - pipe_surface s1 is created >> - strb-> surface is set to s1 (s1's refcount goes up) >> - pipe_context c1 is destroyed >> - strb is destroyed >> - strb->surface is destroyed (so s1's refcount is now 0 and we want >> to >> destroy it) >> >> At that point s1 references c1 which is not available any more, so >> when we try to call ctx->surface_destroy to destroy s1 we crash. >> >> We discussed this a bit on IRC, and we agreed that the proper >> solution, since surfaces outlive their context, is to make surfaces >> screen-bound instead. I'm going to implement that unless someone >> objects. >> >> As a side note, the same issue will happen with sampler_views, so >> it'll get a similar fix. > > Sampler views and surfaces were previously objects bound to screen, and we > changed that because of poor multithreading semantics. Per-context sampler > views / render targets actually matches the 3D APIs semantics better, so I > don't think that reverting is the solution. > > It looks to me that the issue here is that pipe_context should not be > destroyed before the surfaces. strb->surface should only be used by one > context, and should be destroyed before that context is destroyed. > > IIUC, strb matches GL renderbuffer semantics and can be shared by multiple > context. If so, strb is treating pipe_surfaces as a entity shareable by > contexts when really shouldn't. > > The solution is: > - strb can only have pipe_resources, plus the key for the surface (face, > level, etc) Another bit I don't get: since pipe_resources don't have a pointer to the context, how do you go back to the corresponding context/surface when all you have is the pipe_resource? Stéphane ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev