2007-11-05 18:04:30 -07:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* Copyright 2007 VMware, Inc.
|
2008-12-12 05:09:56 +01:00
|
|
|
* Copyright (c) 2008 VMware, Inc.
|
2007-11-05 18:04:30 -07:00
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sub license, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial portions
|
|
|
|
* of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
2007-11-05 18:04:30 -07:00
|
|
|
* 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 "main/imports.h"
|
|
|
|
#include "main/context.h"
|
|
|
|
#include "main/macros.h"
|
2011-09-28 13:16:25 -06:00
|
|
|
#include "main/version.h"
|
2007-11-05 18:04:30 -07:00
|
|
|
|
|
|
|
#include "pipe/p_context.h"
|
|
|
|
#include "pipe/p_defines.h"
|
2008-02-27 11:24:35 -07:00
|
|
|
#include "pipe/p_screen.h"
|
2007-11-05 18:04:30 -07:00
|
|
|
|
|
|
|
#include "st_context.h"
|
|
|
|
#include "st_extensions.h"
|
2013-03-04 06:17:11 +10:00
|
|
|
#include "st_format.h"
|
2007-11-05 18:04:30 -07:00
|
|
|
|
2013-05-02 03:24:33 +02:00
|
|
|
static unsigned _min(unsigned a, unsigned b)
|
2007-11-06 09:41:45 -07:00
|
|
|
{
|
|
|
|
return (a < b) ? a : b;
|
|
|
|
}
|
|
|
|
|
2008-06-24 11:34:46 +09:00
|
|
|
static float _maxf(float a, float b)
|
2007-11-08 08:22:42 -07:00
|
|
|
{
|
|
|
|
return (a > b) ? a : b;
|
|
|
|
}
|
|
|
|
|
2008-05-02 10:08:03 +00:00
|
|
|
static int _clamp(int a, int min, int max)
|
2007-11-05 18:04:30 -07:00
|
|
|
{
|
2007-11-06 09:41:45 -07:00
|
|
|
if (a < min)
|
|
|
|
return min;
|
|
|
|
else if (a > max)
|
|
|
|
return max;
|
|
|
|
else
|
|
|
|
return a;
|
2007-11-05 18:04:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-06 09:41:45 -07:00
|
|
|
/**
|
|
|
|
* Query driver to get implementation limits.
|
|
|
|
* Note that we have to limit/clamp against Mesa's internal limits too.
|
|
|
|
*/
|
2007-11-05 18:04:30 -07:00
|
|
|
void st_init_limits(struct st_context *st)
|
|
|
|
{
|
2008-02-27 11:24:35 -07:00
|
|
|
struct pipe_screen *screen = st->pipe->screen;
|
2007-11-06 09:41:45 -07:00
|
|
|
struct gl_constants *c = &st->ctx->Const;
|
2013-06-12 17:15:46 +02:00
|
|
|
unsigned sh;
|
2012-12-06 16:16:10 +10:00
|
|
|
boolean can_ubo = TRUE;
|
2007-11-06 09:41:45 -07:00
|
|
|
|
|
|
|
c->MaxTextureLevels
|
2008-05-02 10:08:03 +00:00
|
|
|
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS),
|
2007-11-06 09:41:45 -07:00
|
|
|
MAX_TEXTURE_LEVELS);
|
2007-11-05 18:04:30 -07:00
|
|
|
|
2007-11-06 09:41:45 -07:00
|
|
|
c->Max3DTextureLevels
|
2008-05-02 10:08:03 +00:00
|
|
|
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_3D_LEVELS),
|
2007-11-06 09:41:45 -07:00
|
|
|
MAX_3D_TEXTURE_LEVELS);
|
2007-11-05 18:04:30 -07:00
|
|
|
|
2007-11-06 09:41:45 -07:00
|
|
|
c->MaxCubeTextureLevels
|
2008-05-02 10:08:03 +00:00
|
|
|
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS),
|
2007-11-06 09:41:45 -07:00
|
|
|
MAX_CUBE_TEXTURE_LEVELS);
|
2007-11-05 18:04:30 -07:00
|
|
|
|
2007-11-06 09:41:45 -07:00
|
|
|
c->MaxTextureRectSize
|
2008-05-02 10:08:03 +00:00
|
|
|
= _min(1 << (c->MaxTextureLevels - 1), MAX_TEXTURE_RECT_SIZE);
|
2007-11-05 18:04:30 -07:00
|
|
|
|
2011-09-05 22:52:21 +02:00
|
|
|
c->MaxArrayTextureLayers
|
|
|
|
= screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS);
|
|
|
|
|
2012-02-21 08:26:30 -07:00
|
|
|
/* Define max viewport size and max renderbuffer size in terms of
|
|
|
|
* max texture size (note: max tex RECT size = max tex 2D size).
|
|
|
|
* If this isn't true for some hardware we'll need new PIPE_CAP_ queries.
|
|
|
|
*/
|
|
|
|
c->MaxViewportWidth =
|
|
|
|
c->MaxViewportHeight =
|
|
|
|
c->MaxRenderbufferSize = c->MaxTextureRectSize;
|
|
|
|
|
2013-05-02 03:29:47 +02:00
|
|
|
c->MaxDrawBuffers = c->MaxColorAttachments =
|
|
|
|
_clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
|
|
|
|
1, MAX_DRAW_BUFFERS);
|
2007-11-08 08:22:42 -07:00
|
|
|
|
2012-03-24 13:36:17 +00:00
|
|
|
c->MaxDualSourceDrawBuffers
|
|
|
|
= _clamp(screen->get_param(screen, PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS),
|
|
|
|
0, MAX_DRAW_BUFFERS);
|
|
|
|
|
2007-11-08 08:22:42 -07:00
|
|
|
c->MaxLineWidth
|
2011-11-19 22:38:22 +01:00
|
|
|
= _maxf(1.0f, screen->get_paramf(screen,
|
|
|
|
PIPE_CAPF_MAX_LINE_WIDTH));
|
2007-11-08 08:22:42 -07:00
|
|
|
c->MaxLineWidthAA
|
2011-11-19 22:38:22 +01:00
|
|
|
= _maxf(1.0f, screen->get_paramf(screen,
|
|
|
|
PIPE_CAPF_MAX_LINE_WIDTH_AA));
|
2007-11-08 08:22:42 -07:00
|
|
|
|
|
|
|
c->MaxPointSize
|
2011-11-19 22:38:22 +01:00
|
|
|
= _maxf(1.0f, screen->get_paramf(screen,
|
|
|
|
PIPE_CAPF_MAX_POINT_WIDTH));
|
2007-11-08 08:22:42 -07:00
|
|
|
c->MaxPointSizeAA
|
2011-11-19 22:38:22 +01:00
|
|
|
= _maxf(1.0f, screen->get_paramf(screen,
|
|
|
|
PIPE_CAPF_MAX_POINT_WIDTH_AA));
|
2010-02-08 18:48:08 +01:00
|
|
|
/* called after _mesa_create_context/_mesa_init_point, fix default user
|
|
|
|
* settable max point size up
|
|
|
|
*/
|
|
|
|
st->ctx->Point.MaxSize = MAX2(c->MaxPointSize, c->MaxPointSizeAA);
|
2010-02-04 19:23:09 +01:00
|
|
|
/* these are not queryable. Note that GL basically mandates a 1.0 minimum
|
|
|
|
* for non-aa sizes, but we can go down to 0.0 for aa points.
|
|
|
|
*/
|
|
|
|
c->MinPointSize = 1.0f;
|
|
|
|
c->MinPointSizeAA = 0.0f;
|
2007-11-08 08:22:42 -07:00
|
|
|
|
|
|
|
c->MaxTextureMaxAnisotropy
|
2011-11-19 22:38:22 +01:00
|
|
|
= _maxf(2.0f, screen->get_paramf(screen,
|
|
|
|
PIPE_CAPF_MAX_TEXTURE_ANISOTROPY));
|
2007-11-08 08:22:42 -07:00
|
|
|
|
|
|
|
c->MaxTextureLodBias
|
2011-11-19 22:38:22 +01:00
|
|
|
= screen->get_paramf(screen, PIPE_CAPF_MAX_TEXTURE_LOD_BIAS);
|
2008-02-05 16:32:15 -07:00
|
|
|
|
2012-02-06 16:29:03 +01:00
|
|
|
c->QuadsFollowProvokingVertexConvention = screen->get_param(
|
|
|
|
screen, PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION);
|
2010-05-04 15:41:19 +01:00
|
|
|
|
2013-05-02 02:38:43 +02:00
|
|
|
c->MaxUniformBlockSize =
|
|
|
|
screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
|
|
|
|
PIPE_SHADER_CAP_MAX_CONSTS) * 16;
|
|
|
|
if (c->MaxUniformBlockSize < 16384) {
|
|
|
|
can_ubo = FALSE;
|
|
|
|
}
|
|
|
|
|
2013-06-12 17:15:46 +02:00
|
|
|
for (sh = 0; sh < PIPE_SHADER_TYPES; ++sh) {
|
|
|
|
struct gl_shader_compiler_options *options;
|
2010-09-15 18:47:17 -07:00
|
|
|
struct gl_program_constants *pc;
|
2010-11-23 10:28:43 -07:00
|
|
|
|
|
|
|
switch (sh) {
|
gallium: introduce get_shader_param (ALL DRIVERS CHANGED) (v3)
Changes in v3:
- Also change trace, which I forgot about
Changes in v2:
- No longer adds tessellation shaders
Currently each shader cap has FS and VS versions.
However, we want a version of them for geometry, tessellation control,
and tessellation evaluation shaders, and want to be able to easily
query a given cap type for a given shader stage.
Since having 5 duplicates of each shader cap is unmanageable, add
a new get_shader_param function that takes both a shader cap from a
new enum and a shader stage.
Drivers with non-unified shaders will first switch on the shader
and, within each case, switch on the cap.
Drivers with unified shaders instead first check whether the shader
is supported, and then switch on the cap.
MAX_CONST_BUFFERS is now per-stage.
The geometry shader cap is removed in favor of checking whether the
limit of geometry shader instructions is greater than 0, which is also
used for tessellation shaders.
WARNING: all drivers changed and compiled but only nvfx tested
2010-09-05 20:50:50 +02:00
|
|
|
case PIPE_SHADER_FRAGMENT:
|
2014-01-09 10:57:22 -07:00
|
|
|
pc = &c->Program[MESA_SHADER_FRAGMENT];
|
2013-06-12 17:15:46 +02:00
|
|
|
options = &st->ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT];
|
gallium: introduce get_shader_param (ALL DRIVERS CHANGED) (v3)
Changes in v3:
- Also change trace, which I forgot about
Changes in v2:
- No longer adds tessellation shaders
Currently each shader cap has FS and VS versions.
However, we want a version of them for geometry, tessellation control,
and tessellation evaluation shaders, and want to be able to easily
query a given cap type for a given shader stage.
Since having 5 duplicates of each shader cap is unmanageable, add
a new get_shader_param function that takes both a shader cap from a
new enum and a shader stage.
Drivers with non-unified shaders will first switch on the shader
and, within each case, switch on the cap.
Drivers with unified shaders instead first check whether the shader
is supported, and then switch on the cap.
MAX_CONST_BUFFERS is now per-stage.
The geometry shader cap is removed in favor of checking whether the
limit of geometry shader instructions is greater than 0, which is also
used for tessellation shaders.
WARNING: all drivers changed and compiled but only nvfx tested
2010-09-05 20:50:50 +02:00
|
|
|
break;
|
|
|
|
case PIPE_SHADER_VERTEX:
|
2014-01-09 10:57:22 -07:00
|
|
|
pc = &c->Program[MESA_SHADER_VERTEX];
|
2013-06-12 17:15:46 +02:00
|
|
|
options = &st->ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX];
|
gallium: introduce get_shader_param (ALL DRIVERS CHANGED) (v3)
Changes in v3:
- Also change trace, which I forgot about
Changes in v2:
- No longer adds tessellation shaders
Currently each shader cap has FS and VS versions.
However, we want a version of them for geometry, tessellation control,
and tessellation evaluation shaders, and want to be able to easily
query a given cap type for a given shader stage.
Since having 5 duplicates of each shader cap is unmanageable, add
a new get_shader_param function that takes both a shader cap from a
new enum and a shader stage.
Drivers with non-unified shaders will first switch on the shader
and, within each case, switch on the cap.
Drivers with unified shaders instead first check whether the shader
is supported, and then switch on the cap.
MAX_CONST_BUFFERS is now per-stage.
The geometry shader cap is removed in favor of checking whether the
limit of geometry shader instructions is greater than 0, which is also
used for tessellation shaders.
WARNING: all drivers changed and compiled but only nvfx tested
2010-09-05 20:50:50 +02:00
|
|
|
break;
|
|
|
|
case PIPE_SHADER_GEOMETRY:
|
2014-01-09 10:57:22 -07:00
|
|
|
pc = &c->Program[MESA_SHADER_GEOMETRY];
|
2013-06-12 17:15:46 +02:00
|
|
|
options = &st->ctx->ShaderCompilerOptions[MESA_SHADER_GEOMETRY];
|
gallium: introduce get_shader_param (ALL DRIVERS CHANGED) (v3)
Changes in v3:
- Also change trace, which I forgot about
Changes in v2:
- No longer adds tessellation shaders
Currently each shader cap has FS and VS versions.
However, we want a version of them for geometry, tessellation control,
and tessellation evaluation shaders, and want to be able to easily
query a given cap type for a given shader stage.
Since having 5 duplicates of each shader cap is unmanageable, add
a new get_shader_param function that takes both a shader cap from a
new enum and a shader stage.
Drivers with non-unified shaders will first switch on the shader
and, within each case, switch on the cap.
Drivers with unified shaders instead first check whether the shader
is supported, and then switch on the cap.
MAX_CONST_BUFFERS is now per-stage.
The geometry shader cap is removed in favor of checking whether the
limit of geometry shader instructions is greater than 0, which is also
used for tessellation shaders.
WARNING: all drivers changed and compiled but only nvfx tested
2010-09-05 20:50:50 +02:00
|
|
|
break;
|
2010-09-15 18:47:17 -07:00
|
|
|
default:
|
2013-06-12 17:15:46 +02:00
|
|
|
/* compute shader, etc. */
|
2010-09-15 18:47:17 -07:00
|
|
|
continue;
|
gallium: introduce get_shader_param (ALL DRIVERS CHANGED) (v3)
Changes in v3:
- Also change trace, which I forgot about
Changes in v2:
- No longer adds tessellation shaders
Currently each shader cap has FS and VS versions.
However, we want a version of them for geometry, tessellation control,
and tessellation evaluation shaders, and want to be able to easily
query a given cap type for a given shader stage.
Since having 5 duplicates of each shader cap is unmanageable, add
a new get_shader_param function that takes both a shader cap from a
new enum and a shader stage.
Drivers with non-unified shaders will first switch on the shader
and, within each case, switch on the cap.
Drivers with unified shaders instead first check whether the shader
is supported, and then switch on the cap.
MAX_CONST_BUFFERS is now per-stage.
The geometry shader cap is removed in favor of checking whether the
limit of geometry shader instructions is greater than 0, which is also
used for tessellation shaders.
WARNING: all drivers changed and compiled but only nvfx tested
2010-09-05 20:50:50 +02:00
|
|
|
}
|
|
|
|
|
2013-05-02 02:41:11 +02:00
|
|
|
pc->MaxTextureImageUnits =
|
|
|
|
_min(screen->get_shader_param(screen, sh,
|
|
|
|
PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS),
|
|
|
|
MAX_TEXTURE_IMAGE_UNITS);
|
|
|
|
|
2013-05-02 02:38:43 +02:00
|
|
|
pc->MaxInstructions = pc->MaxNativeInstructions =
|
|
|
|
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS);
|
|
|
|
pc->MaxAluInstructions = pc->MaxNativeAluInstructions =
|
|
|
|
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS);
|
|
|
|
pc->MaxTexInstructions = pc->MaxNativeTexInstructions =
|
|
|
|
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS);
|
|
|
|
pc->MaxTexIndirections = pc->MaxNativeTexIndirections =
|
|
|
|
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS);
|
|
|
|
pc->MaxAttribs = pc->MaxNativeAttribs =
|
|
|
|
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INPUTS);
|
|
|
|
pc->MaxTemps = pc->MaxNativeTemps =
|
|
|
|
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEMPS);
|
|
|
|
pc->MaxAddressRegs = pc->MaxNativeAddressRegs =
|
2013-06-04 09:51:15 -07:00
|
|
|
_min(screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_ADDRS),
|
|
|
|
MAX_PROGRAM_ADDRESS_REGS);
|
2013-05-02 02:38:43 +02:00
|
|
|
pc->MaxParameters = pc->MaxNativeParameters =
|
|
|
|
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_CONSTS);
|
|
|
|
|
|
|
|
pc->MaxUniformComponents = 4 * MIN2(pc->MaxNativeParameters, MAX_UNIFORMS);
|
|
|
|
|
|
|
|
pc->MaxUniformBlocks =
|
|
|
|
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_CONST_BUFFERS);
|
|
|
|
if (pc->MaxUniformBlocks)
|
|
|
|
pc->MaxUniformBlocks -= 1; /* The first one is for ordinary uniforms. */
|
2013-05-14 17:58:32 +02:00
|
|
|
pc->MaxUniformBlocks = _min(pc->MaxUniformBlocks, MAX_UNIFORM_BUFFERS);
|
2013-05-02 02:38:43 +02:00
|
|
|
|
|
|
|
pc->MaxCombinedUniformComponents = (pc->MaxUniformComponents +
|
|
|
|
c->MaxUniformBlockSize / 4 *
|
|
|
|
pc->MaxUniformBlocks);
|
gallium: introduce get_shader_param (ALL DRIVERS CHANGED) (v3)
Changes in v3:
- Also change trace, which I forgot about
Changes in v2:
- No longer adds tessellation shaders
Currently each shader cap has FS and VS versions.
However, we want a version of them for geometry, tessellation control,
and tessellation evaluation shaders, and want to be able to easily
query a given cap type for a given shader stage.
Since having 5 duplicates of each shader cap is unmanageable, add
a new get_shader_param function that takes both a shader cap from a
new enum and a shader stage.
Drivers with non-unified shaders will first switch on the shader
and, within each case, switch on the cap.
Drivers with unified shaders instead first check whether the shader
is supported, and then switch on the cap.
MAX_CONST_BUFFERS is now per-stage.
The geometry shader cap is removed in favor of checking whether the
limit of geometry shader instructions is greater than 0, which is also
used for tessellation shaders.
WARNING: all drivers changed and compiled but only nvfx tested
2010-09-05 20:50:50 +02:00
|
|
|
|
2011-09-09 08:06:29 -06:00
|
|
|
/* Gallium doesn't really care about local vs. env parameters so use the
|
|
|
|
* same limits.
|
|
|
|
*/
|
2011-09-12 12:46:45 +02:00
|
|
|
pc->MaxLocalParams = MIN2(pc->MaxParameters, MAX_PROGRAM_LOCAL_PARAMS);
|
|
|
|
pc->MaxEnvParams = MIN2(pc->MaxParameters, MAX_PROGRAM_ENV_PARAMS);
|
2011-09-09 08:06:29 -06:00
|
|
|
|
2010-09-14 05:10:59 +02:00
|
|
|
options->EmitNoNoise = TRUE;
|
|
|
|
|
2010-09-06 02:31:20 +02:00
|
|
|
/* TODO: make these more fine-grained if anyone needs it */
|
2011-08-31 17:28:53 -05:00
|
|
|
options->MaxIfDepth = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
|
2010-11-23 10:28:43 -07:00
|
|
|
options->EmitNoLoops = !screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
|
|
|
|
options->EmitNoFunctions = !screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_SUBROUTINES);
|
|
|
|
options->EmitNoMainReturn = !screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_SUBROUTINES);
|
2010-09-06 02:31:20 +02:00
|
|
|
|
2010-11-23 10:28:43 -07:00
|
|
|
options->EmitNoCont = !screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED);
|
2010-09-06 02:31:20 +02:00
|
|
|
|
2010-11-23 10:28:43 -07:00
|
|
|
options->EmitNoIndirectInput = !screen->get_shader_param(screen, sh,
|
2010-11-10 20:41:55 +01:00
|
|
|
PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR);
|
2010-11-23 10:28:43 -07:00
|
|
|
options->EmitNoIndirectOutput = !screen->get_shader_param(screen, sh,
|
2010-11-10 20:41:55 +01:00
|
|
|
PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR);
|
2010-11-23 10:28:43 -07:00
|
|
|
options->EmitNoIndirectTemp = !screen->get_shader_param(screen, sh,
|
2010-11-10 20:41:55 +01:00
|
|
|
PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR);
|
2010-11-23 10:28:43 -07:00
|
|
|
options->EmitNoIndirectUniform = !screen->get_shader_param(screen, sh,
|
2010-11-10 20:41:55 +01:00
|
|
|
PIPE_SHADER_CAP_INDIRECT_CONST_ADDR);
|
|
|
|
|
2013-05-02 02:38:43 +02:00
|
|
|
if (pc->MaxNativeInstructions &&
|
|
|
|
(options->EmitNoIndirectUniform || pc->MaxUniformBlocks < 12)) {
|
2012-12-06 16:16:10 +10:00
|
|
|
can_ubo = FALSE;
|
|
|
|
}
|
|
|
|
|
2011-04-27 09:05:30 -06:00
|
|
|
if (options->EmitNoLoops)
|
2010-11-23 10:28:43 -07:00
|
|
|
options->MaxUnrollIterations = MIN2(screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS), 65536);
|
2012-03-20 17:43:52 -06:00
|
|
|
else
|
|
|
|
options->MaxUnrollIterations = 255; /* SM3 limit */
|
2012-06-16 20:30:14 +02:00
|
|
|
options->LowerClipDistance = true;
|
gallium: introduce get_shader_param (ALL DRIVERS CHANGED) (v3)
Changes in v3:
- Also change trace, which I forgot about
Changes in v2:
- No longer adds tessellation shaders
Currently each shader cap has FS and VS versions.
However, we want a version of them for geometry, tessellation control,
and tessellation evaluation shaders, and want to be able to easily
query a given cap type for a given shader stage.
Since having 5 duplicates of each shader cap is unmanageable, add
a new get_shader_param function that takes both a shader cap from a
new enum and a shader stage.
Drivers with non-unified shaders will first switch on the shader
and, within each case, switch on the cap.
Drivers with unified shaders instead first check whether the shader
is supported, and then switch on the cap.
MAX_CONST_BUFFERS is now per-stage.
The geometry shader cap is removed in favor of checking whether the
limit of geometry shader instructions is greater than 0, which is also
used for tessellation shaders.
WARNING: all drivers changed and compiled but only nvfx tested
2010-09-05 20:50:50 +02:00
|
|
|
}
|
2010-08-25 05:25:41 +02:00
|
|
|
|
2014-01-17 22:52:28 +01:00
|
|
|
c->MaxCombinedTextureImageUnits =
|
|
|
|
_min(c->Program[MESA_SHADER_VERTEX].MaxTextureImageUnits +
|
|
|
|
c->Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits +
|
|
|
|
c->Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
|
|
|
|
MAX_COMBINED_TEXTURE_IMAGE_UNITS);
|
|
|
|
|
2013-05-02 02:41:11 +02:00
|
|
|
/* This depends on program constants. */
|
|
|
|
c->MaxTextureCoordUnits
|
2014-01-09 10:57:22 -07:00
|
|
|
= _min(c->Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits, MAX_TEXTURE_COORD_UNITS);
|
2013-05-02 02:41:11 +02:00
|
|
|
|
2014-01-09 10:57:22 -07:00
|
|
|
c->MaxTextureUnits = _min(c->Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits, c->MaxTextureCoordUnits);
|
2013-05-02 02:41:11 +02:00
|
|
|
|
2014-01-09 10:57:22 -07:00
|
|
|
c->Program[MESA_SHADER_VERTEX].MaxAttribs = MIN2(c->Program[MESA_SHADER_VERTEX].MaxAttribs, 16);
|
2013-05-02 02:38:43 +02:00
|
|
|
|
2011-11-22 15:05:29 +01:00
|
|
|
/* PIPE_SHADER_CAP_MAX_INPUTS for the FS specifies the maximum number
|
|
|
|
* of inputs. It's always 2 colors + N generic inputs. */
|
|
|
|
c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
|
|
|
|
PIPE_SHADER_CAP_MAX_INPUTS);
|
2010-09-02 12:58:58 -06:00
|
|
|
c->MaxVarying = MIN2(c->MaxVarying, MAX_VARYING);
|
2014-01-09 10:57:22 -07:00
|
|
|
c->Program[MESA_SHADER_FRAGMENT].MaxInputComponents = c->MaxVarying * 4;
|
|
|
|
c->Program[MESA_SHADER_VERTEX].MaxOutputComponents = c->MaxVarying * 4;
|
|
|
|
c->Program[MESA_SHADER_GEOMETRY].MaxInputComponents = c->MaxVarying * 4;
|
|
|
|
c->Program[MESA_SHADER_GEOMETRY].MaxOutputComponents = c->MaxVarying * 4;
|
2014-02-09 22:56:20 +01:00
|
|
|
c->MaxGeometryOutputVertices = screen->get_param(screen, PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES);
|
|
|
|
c->MaxGeometryTotalOutputComponents = screen->get_param(screen, PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS);
|
2010-09-21 18:13:02 -06:00
|
|
|
|
2011-11-18 15:51:47 +01:00
|
|
|
c->MinProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MIN_TEXEL_OFFSET);
|
|
|
|
c->MaxProgramTexelOffset = screen->get_param(screen, PIPE_CAP_MAX_TEXEL_OFFSET);
|
|
|
|
|
|
|
|
c->UniformBooleanTrue = ~0;
|
2011-10-17 14:30:26 -07:00
|
|
|
|
2011-12-18 02:13:17 +01:00
|
|
|
c->MaxTransformFeedbackBuffers =
|
2011-12-17 21:09:30 +01:00
|
|
|
screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS);
|
2011-12-18 02:13:17 +01:00
|
|
|
c->MaxTransformFeedbackBuffers = MIN2(c->MaxTransformFeedbackBuffers, MAX_FEEDBACK_BUFFERS);
|
2011-12-09 18:33:58 +01:00
|
|
|
c->MaxTransformFeedbackSeparateComponents =
|
|
|
|
screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS);
|
|
|
|
c->MaxTransformFeedbackInterleavedComponents =
|
|
|
|
screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS);
|
|
|
|
|
2011-10-17 14:30:26 -07:00
|
|
|
c->StripTextureBorder = GL_TRUE;
|
2011-12-10 04:14:46 +01:00
|
|
|
|
|
|
|
c->GLSLSkipStrictMaxUniformLimitCheck =
|
|
|
|
screen->get_param(screen, PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS);
|
|
|
|
|
2013-01-12 12:56:31 +01:00
|
|
|
if (can_ubo) {
|
2012-12-06 16:16:10 +10:00
|
|
|
st->ctx->Extensions.ARB_uniform_buffer_object = GL_TRUE;
|
2013-05-02 02:38:43 +02:00
|
|
|
c->UniformBufferOffsetAlignment =
|
2013-01-12 12:56:31 +01:00
|
|
|
screen->get_param(screen, PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT);
|
2013-05-02 02:38:43 +02:00
|
|
|
c->MaxCombinedUniformBlocks = c->MaxUniformBufferBindings =
|
2014-01-09 10:57:22 -07:00
|
|
|
c->Program[MESA_SHADER_VERTEX].MaxUniformBlocks +
|
|
|
|
c->Program[MESA_SHADER_GEOMETRY].MaxUniformBlocks +
|
|
|
|
c->Program[MESA_SHADER_FRAGMENT].MaxUniformBlocks;
|
2013-05-14 17:58:32 +02:00
|
|
|
assert(c->MaxCombinedUniformBlocks <= MAX_COMBINED_UNIFORM_BUFFERS);
|
2013-01-12 12:56:31 +01:00
|
|
|
}
|
2007-11-05 18:04:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-01-24 23:16:50 +01:00
|
|
|
/**
|
|
|
|
* Given a member \c x of struct gl_extensions, return offset of
|
|
|
|
* \c x in bytes.
|
|
|
|
*/
|
|
|
|
#define o(x) offsetof(struct gl_extensions, x)
|
|
|
|
|
|
|
|
|
|
|
|
struct st_extension_cap_mapping {
|
|
|
|
int extension_offset;
|
|
|
|
int cap;
|
|
|
|
};
|
|
|
|
|
2012-01-25 01:01:54 +01:00
|
|
|
struct st_extension_format_mapping {
|
|
|
|
int extension_offset[2];
|
|
|
|
enum pipe_format format[8];
|
|
|
|
|
|
|
|
/* If TRUE, at least one format must be supported for the extensions to be
|
|
|
|
* advertised. If FALSE, all the formats must be supported. */
|
|
|
|
GLboolean need_at_least_one;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enable extensions if certain pipe formats are supported by the driver.
|
|
|
|
* What extensions will be enabled and what formats must be supported is
|
|
|
|
* described by the array of st_extension_format_mapping.
|
|
|
|
*
|
|
|
|
* target and bind_flags are passed to is_format_supported.
|
|
|
|
*/
|
|
|
|
static void init_format_extensions(struct st_context *st,
|
|
|
|
const struct st_extension_format_mapping *mapping,
|
|
|
|
unsigned num_mappings,
|
|
|
|
enum pipe_texture_target target,
|
|
|
|
unsigned bind_flags)
|
|
|
|
{
|
|
|
|
struct pipe_screen *screen = st->pipe->screen;
|
|
|
|
GLboolean *extensions = (GLboolean *) &st->ctx->Extensions;
|
2012-10-16 18:33:08 -06:00
|
|
|
unsigned i;
|
|
|
|
int j;
|
2012-01-25 01:01:54 +01:00
|
|
|
int num_formats = Elements(mapping->format);
|
|
|
|
int num_ext = Elements(mapping->extension_offset);
|
|
|
|
|
|
|
|
for (i = 0; i < num_mappings; i++) {
|
|
|
|
int num_supported = 0;
|
|
|
|
|
|
|
|
/* Examine each format in the list. */
|
|
|
|
for (j = 0; j < num_formats && mapping[i].format[j]; j++) {
|
|
|
|
if (screen->is_format_supported(screen, mapping[i].format[j],
|
|
|
|
target, 0, bind_flags)) {
|
|
|
|
num_supported++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!num_supported ||
|
|
|
|
(!mapping[i].need_at_least_one && num_supported != j)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Enable all extensions in the list. */
|
|
|
|
for (j = 0; j < num_ext && mapping[i].extension_offset[j]; j++)
|
|
|
|
extensions[mapping[i].extension_offset[j]] = GL_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2011-07-25 13:30:17 -05:00
|
|
|
|
2007-11-05 18:04:30 -07:00
|
|
|
/**
|
2009-01-26 12:31:02 -07:00
|
|
|
* Use pipe_screen::get_param() to query PIPE_CAP_ values to determine
|
|
|
|
* which GL extensions are supported.
|
|
|
|
* Quite a few extensions are always supported because they are standard
|
|
|
|
* features or can be built on top of other gallium features.
|
|
|
|
* Some fine tuning may still be needed.
|
2007-11-05 18:04:30 -07:00
|
|
|
*/
|
|
|
|
void st_init_extensions(struct st_context *st)
|
|
|
|
{
|
2008-02-27 11:24:35 -07:00
|
|
|
struct pipe_screen *screen = st->pipe->screen;
|
2010-10-12 12:26:10 -04:00
|
|
|
struct gl_context *ctx = st->ctx;
|
2012-01-24 22:23:01 +01:00
|
|
|
int i, glsl_feature_level;
|
2012-01-24 23:16:50 +01:00
|
|
|
GLboolean *extensions = (GLboolean *) &ctx->Extensions;
|
|
|
|
|
|
|
|
static const struct st_extension_cap_mapping cap_mapping[] = {
|
2012-06-18 22:50:03 +02:00
|
|
|
{ o(ARB_base_instance), PIPE_CAP_START_INSTANCE },
|
2012-01-24 23:16:50 +01:00
|
|
|
{ o(ARB_depth_clamp), PIPE_CAP_DEPTH_CLIP_DISABLE },
|
|
|
|
{ o(ARB_depth_texture), PIPE_CAP_TEXTURE_SHADOW_MAP },
|
|
|
|
{ o(ARB_draw_buffers_blend), PIPE_CAP_INDEP_BLEND_FUNC },
|
|
|
|
{ o(ARB_draw_instanced), PIPE_CAP_TGSI_INSTANCEID },
|
|
|
|
{ o(ARB_fragment_program_shadow), PIPE_CAP_TEXTURE_SHADOW_MAP },
|
|
|
|
{ o(ARB_instanced_arrays), PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR },
|
|
|
|
{ o(ARB_occlusion_query), PIPE_CAP_OCCLUSION_QUERY },
|
|
|
|
{ o(ARB_occlusion_query2), PIPE_CAP_OCCLUSION_QUERY },
|
|
|
|
{ o(ARB_point_sprite), PIPE_CAP_POINT_SPRITE },
|
|
|
|
{ o(ARB_seamless_cube_map), PIPE_CAP_SEAMLESS_CUBE_MAP },
|
|
|
|
{ o(ARB_shader_stencil_export), PIPE_CAP_SHADER_STENCIL_EXPORT },
|
|
|
|
{ o(ARB_shader_texture_lod), PIPE_CAP_SM3 },
|
|
|
|
{ o(ARB_shadow), PIPE_CAP_TEXTURE_SHADOW_MAP },
|
2013-10-20 12:39:57 +02:00
|
|
|
{ o(ARB_texture_mirror_clamp_to_edge), PIPE_CAP_TEXTURE_MIRROR_CLAMP },
|
2012-01-24 23:16:50 +01:00
|
|
|
{ o(ARB_texture_non_power_of_two), PIPE_CAP_NPOT_TEXTURES },
|
2012-12-09 10:08:13 +00:00
|
|
|
{ o(ARB_timer_query), PIPE_CAP_QUERY_TIMESTAMP },
|
2012-01-24 23:16:50 +01:00
|
|
|
{ o(ARB_transform_feedback2), PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME },
|
2011-12-18 04:57:31 +01:00
|
|
|
{ o(ARB_transform_feedback3), PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME },
|
2012-01-24 23:16:50 +01:00
|
|
|
|
|
|
|
{ o(EXT_blend_equation_separate), PIPE_CAP_BLEND_EQUATION_SEPARATE },
|
|
|
|
{ o(EXT_draw_buffers2), PIPE_CAP_INDEP_BLEND_ENABLE },
|
|
|
|
{ o(EXT_stencil_two_side), PIPE_CAP_TWO_SIDED_STENCIL },
|
|
|
|
{ o(EXT_texture_array), PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS },
|
|
|
|
{ o(EXT_texture_filter_anisotropic), PIPE_CAP_ANISOTROPIC_FILTER },
|
|
|
|
{ o(EXT_texture_mirror_clamp), PIPE_CAP_TEXTURE_MIRROR_CLAMP },
|
|
|
|
{ o(EXT_texture_swizzle), PIPE_CAP_TEXTURE_SWIZZLE },
|
|
|
|
{ o(EXT_transform_feedback), PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS },
|
|
|
|
|
|
|
|
{ o(AMD_seamless_cubemap_per_texture), PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE },
|
|
|
|
{ o(ATI_separate_stencil), PIPE_CAP_TWO_SIDED_STENCIL },
|
|
|
|
{ o(ATI_texture_mirror_once), PIPE_CAP_TEXTURE_MIRROR_CLAMP },
|
|
|
|
{ o(NV_conditional_render), PIPE_CAP_CONDITIONAL_RENDER },
|
|
|
|
{ o(NV_texture_barrier), PIPE_CAP_TEXTURE_BARRIER },
|
|
|
|
/* GL_NV_point_sprite is not supported by gallium because we don't
|
|
|
|
* support the GL_POINT_SPRITE_R_MODE_NV option. */
|
2012-10-28 15:01:52 +01:00
|
|
|
|
2012-11-03 20:49:35 +10:00
|
|
|
{ o(OES_standard_derivatives), PIPE_CAP_SM3 },
|
2013-03-04 06:17:11 +10:00
|
|
|
{ o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY },
|
|
|
|
{ o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE }
|
2012-01-24 23:16:50 +01:00
|
|
|
};
|
2011-11-18 15:51:47 +01:00
|
|
|
|
2012-01-25 01:01:54 +01:00
|
|
|
/* Required: render target and sampler support */
|
|
|
|
static const struct st_extension_format_mapping rendertarget_mapping[] = {
|
|
|
|
{ { o(ARB_texture_float) },
|
|
|
|
{ PIPE_FORMAT_R32G32B32A32_FLOAT,
|
|
|
|
PIPE_FORMAT_R16G16B16A16_FLOAT } },
|
|
|
|
|
|
|
|
{ { o(ARB_texture_rgb10_a2ui) },
|
2013-12-26 19:06:25 +01:00
|
|
|
{ PIPE_FORMAT_R10G10B10A2_UINT,
|
|
|
|
PIPE_FORMAT_B10G10R10A2_UINT },
|
|
|
|
GL_TRUE }, /* at least one format must be supported */
|
2012-01-25 01:01:54 +01:00
|
|
|
|
|
|
|
{ { o(EXT_framebuffer_sRGB) },
|
|
|
|
{ PIPE_FORMAT_A8B8G8R8_SRGB,
|
|
|
|
PIPE_FORMAT_B8G8R8A8_SRGB },
|
|
|
|
GL_TRUE }, /* at least one format must be supported */
|
|
|
|
|
|
|
|
{ { o(EXT_packed_float) },
|
|
|
|
{ PIPE_FORMAT_R11G11B10_FLOAT } },
|
|
|
|
|
|
|
|
{ { o(EXT_texture_integer) },
|
|
|
|
{ PIPE_FORMAT_R32G32B32A32_UINT,
|
|
|
|
PIPE_FORMAT_R32G32B32A32_SINT } },
|
2013-02-14 12:24:02 -07:00
|
|
|
|
|
|
|
{ { o(ARB_texture_rg) },
|
|
|
|
{ PIPE_FORMAT_R8_UNORM,
|
|
|
|
PIPE_FORMAT_R8G8_UNORM } },
|
2012-01-25 01:01:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Required: depth stencil and sampler support */
|
|
|
|
static const struct st_extension_format_mapping depthstencil_mapping[] = {
|
|
|
|
{ { o(ARB_depth_buffer_float) },
|
|
|
|
{ PIPE_FORMAT_Z32_FLOAT,
|
|
|
|
PIPE_FORMAT_Z32_FLOAT_S8X24_UINT } },
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Required: sampler support */
|
|
|
|
static const struct st_extension_format_mapping texture_mapping[] = {
|
|
|
|
{ { o(ARB_texture_compression_rgtc) },
|
|
|
|
{ PIPE_FORMAT_RGTC1_UNORM,
|
|
|
|
PIPE_FORMAT_RGTC1_SNORM,
|
|
|
|
PIPE_FORMAT_RGTC2_UNORM,
|
|
|
|
PIPE_FORMAT_RGTC2_SNORM } },
|
|
|
|
|
|
|
|
{ { o(EXT_texture_compression_latc) },
|
|
|
|
{ PIPE_FORMAT_LATC1_UNORM,
|
|
|
|
PIPE_FORMAT_LATC1_SNORM,
|
|
|
|
PIPE_FORMAT_LATC2_UNORM,
|
|
|
|
PIPE_FORMAT_LATC2_SNORM } },
|
|
|
|
|
|
|
|
{ { o(EXT_texture_compression_s3tc),
|
2012-12-01 12:02:04 -08:00
|
|
|
o(ANGLE_texture_compression_dxt) },
|
2012-01-25 01:01:54 +01:00
|
|
|
{ PIPE_FORMAT_DXT1_RGB,
|
|
|
|
PIPE_FORMAT_DXT1_RGBA,
|
|
|
|
PIPE_FORMAT_DXT3_RGBA,
|
|
|
|
PIPE_FORMAT_DXT5_RGBA } },
|
|
|
|
|
|
|
|
{ { o(EXT_texture_shared_exponent) },
|
|
|
|
{ PIPE_FORMAT_R9G9B9E5_FLOAT } },
|
|
|
|
|
|
|
|
{ { o(EXT_texture_snorm) },
|
|
|
|
{ PIPE_FORMAT_R8G8B8A8_SNORM } },
|
|
|
|
|
|
|
|
{ { o(EXT_texture_sRGB),
|
|
|
|
o(EXT_texture_sRGB_decode) },
|
|
|
|
{ PIPE_FORMAT_A8B8G8R8_SRGB,
|
|
|
|
PIPE_FORMAT_B8G8R8A8_SRGB },
|
|
|
|
GL_TRUE }, /* at least one format must be supported */
|
|
|
|
|
|
|
|
{ { o(ATI_texture_compression_3dc) },
|
|
|
|
{ PIPE_FORMAT_LATC2_UNORM } },
|
|
|
|
|
|
|
|
{ { o(MESA_ycbcr_texture) },
|
|
|
|
{ PIPE_FORMAT_UYVY,
|
|
|
|
PIPE_FORMAT_YUYV },
|
|
|
|
GL_TRUE }, /* at least one format must be supported */
|
|
|
|
|
|
|
|
{ { o(OES_compressed_ETC1_RGB8_texture) },
|
|
|
|
{ PIPE_FORMAT_ETC1_RGB8 } },
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Required: vertex fetch support. */
|
|
|
|
static const struct st_extension_format_mapping vertex_mapping[] = {
|
|
|
|
{ { o(ARB_vertex_type_2_10_10_10_rev) },
|
|
|
|
{ PIPE_FORMAT_R10G10B10A2_UNORM,
|
|
|
|
PIPE_FORMAT_B10G10R10A2_UNORM,
|
|
|
|
PIPE_FORMAT_R10G10B10A2_SNORM,
|
|
|
|
PIPE_FORMAT_B10G10R10A2_SNORM,
|
|
|
|
PIPE_FORMAT_R10G10B10A2_USCALED,
|
|
|
|
PIPE_FORMAT_B10G10R10A2_USCALED,
|
|
|
|
PIPE_FORMAT_R10G10B10A2_SSCALED,
|
|
|
|
PIPE_FORMAT_B10G10R10A2_SSCALED } },
|
2013-11-07 21:48:34 +01:00
|
|
|
{ { o(ARB_vertex_type_10f_11f_11f_rev) },
|
|
|
|
{ PIPE_FORMAT_R11G11B10_FLOAT } },
|
2012-01-25 01:01:54 +01:00
|
|
|
};
|
|
|
|
|
2012-12-15 13:03:54 +10:00
|
|
|
static const struct st_extension_format_mapping tbo_rgb32[] = {
|
|
|
|
{ {o(ARB_texture_buffer_object_rgb32) },
|
|
|
|
{ PIPE_FORMAT_R32G32B32_FLOAT,
|
|
|
|
PIPE_FORMAT_R32G32B32_UINT,
|
|
|
|
PIPE_FORMAT_R32G32B32_SINT,
|
|
|
|
} },
|
|
|
|
};
|
|
|
|
|
2007-11-05 18:04:30 -07:00
|
|
|
/*
|
|
|
|
* Extensions that are supported by all Gallium drivers:
|
|
|
|
*/
|
2012-04-11 12:55:23 +02:00
|
|
|
ctx->Extensions.ARB_ES2_compatibility = GL_TRUE;
|
2010-06-05 19:32:29 +02:00
|
|
|
ctx->Extensions.ARB_draw_elements_base_vertex = GL_TRUE;
|
2011-11-18 15:51:47 +01:00
|
|
|
ctx->Extensions.ARB_explicit_attrib_location = GL_TRUE;
|
2010-01-21 06:37:48 +01:00
|
|
|
ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
|
2009-06-29 14:58:25 -06:00
|
|
|
ctx->Extensions.ARB_fragment_program = GL_TRUE;
|
2011-11-18 15:51:47 +01:00
|
|
|
ctx->Extensions.ARB_fragment_shader = GL_TRUE;
|
2010-12-18 10:31:33 +01:00
|
|
|
ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
|
2012-04-11 12:54:10 +02:00
|
|
|
ctx->Extensions.ARB_half_float_vertex = GL_TRUE;
|
2013-01-19 02:54:16 +01:00
|
|
|
ctx->Extensions.ARB_internalformat_query = GL_TRUE;
|
2009-06-08 17:07:21 -06:00
|
|
|
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
|
2007-11-07 08:18:34 -07:00
|
|
|
ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
|
|
|
|
ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
|
|
|
|
ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
|
|
|
|
ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
|
2009-06-22 17:01:44 -06:00
|
|
|
ctx->Extensions.ARB_vertex_program = GL_TRUE;
|
2011-11-18 15:51:47 +01:00
|
|
|
ctx->Extensions.ARB_vertex_shader = GL_TRUE;
|
2007-11-05 18:04:30 -07:00
|
|
|
|
|
|
|
ctx->Extensions.EXT_blend_color = GL_TRUE;
|
|
|
|
ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
|
|
|
|
ctx->Extensions.EXT_blend_minmax = GL_TRUE;
|
2010-04-04 23:15:15 +02:00
|
|
|
ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE;
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE;
|
|
|
|
ctx->Extensions.EXT_point_parameters = GL_TRUE;
|
2009-06-09 22:01:55 -06:00
|
|
|
ctx->Extensions.EXT_provoking_vertex = GL_TRUE;
|
2013-06-12 21:38:28 +02:00
|
|
|
|
|
|
|
/* IMPORTANT:
|
|
|
|
* Don't enable EXT_separate_shader_objects. It disallows a certain
|
|
|
|
* optimization in the GLSL compiler and therefore is considered
|
|
|
|
* harmful.
|
|
|
|
*/
|
|
|
|
ctx->Extensions.EXT_separate_shader_objects = GL_FALSE;
|
|
|
|
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
|
2009-05-21 08:15:22 -06:00
|
|
|
ctx->Extensions.EXT_vertex_array_bgra = GL_TRUE;
|
2007-11-05 18:04:30 -07:00
|
|
|
|
2010-06-05 19:33:29 +02:00
|
|
|
ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
|
|
|
|
|
2010-03-06 17:36:44 +01:00
|
|
|
ctx->Extensions.MESA_pack_invert = GL_TRUE;
|
|
|
|
|
2011-09-19 23:17:01 -07:00
|
|
|
ctx->Extensions.NV_fog_distance = GL_TRUE;
|
2009-06-12 10:18:15 -06:00
|
|
|
ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
|
2010-03-06 18:09:16 +01:00
|
|
|
ctx->Extensions.NV_texture_rectangle = GL_TRUE;
|
2013-05-15 15:10:11 +02:00
|
|
|
ctx->Extensions.NV_vdpau_interop = GL_TRUE;
|
2007-11-05 18:04:30 -07:00
|
|
|
|
2010-04-06 17:46:17 +08:00
|
|
|
ctx->Extensions.OES_EGL_image = GL_TRUE;
|
2013-05-29 17:32:44 +02:00
|
|
|
ctx->Extensions.OES_EGL_image_external = GL_TRUE;
|
2009-09-22 15:00:24 +08:00
|
|
|
ctx->Extensions.OES_draw_texture = GL_TRUE;
|
|
|
|
|
2012-01-24 23:16:50 +01:00
|
|
|
/* Expose the extensions which directly correspond to gallium caps. */
|
|
|
|
for (i = 0; i < Elements(cap_mapping); i++) {
|
|
|
|
if (screen->get_param(screen, cap_mapping[i].cap)) {
|
|
|
|
extensions[cap_mapping[i].extension_offset] = GL_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-25 01:01:54 +01:00
|
|
|
/* Expose the extensions which directly correspond to gallium formats. */
|
|
|
|
init_format_extensions(st, rendertarget_mapping,
|
|
|
|
Elements(rendertarget_mapping), PIPE_TEXTURE_2D,
|
|
|
|
PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW);
|
|
|
|
init_format_extensions(st, depthstencil_mapping,
|
|
|
|
Elements(depthstencil_mapping), PIPE_TEXTURE_2D,
|
|
|
|
PIPE_BIND_DEPTH_STENCIL | PIPE_BIND_SAMPLER_VIEW);
|
|
|
|
init_format_extensions(st, texture_mapping, Elements(texture_mapping),
|
|
|
|
PIPE_TEXTURE_2D, PIPE_BIND_SAMPLER_VIEW);
|
|
|
|
init_format_extensions(st, vertex_mapping, Elements(vertex_mapping),
|
|
|
|
PIPE_BUFFER, PIPE_BIND_VERTEX_BUFFER);
|
|
|
|
|
2012-01-24 22:23:01 +01:00
|
|
|
/* Figure out GLSL support. */
|
|
|
|
glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL);
|
|
|
|
|
2013-10-22 09:06:37 +01:00
|
|
|
ctx->Const.GLSLVersion = glsl_feature_level;
|
|
|
|
if (glsl_feature_level >= 330)
|
|
|
|
ctx->Const.GLSLVersion = 330;
|
2012-01-24 22:23:01 +01:00
|
|
|
|
|
|
|
_mesa_override_glsl_version(st->ctx);
|
|
|
|
|
2013-07-30 22:29:24 +02:00
|
|
|
if (st->options.force_glsl_version > 0 &&
|
|
|
|
st->options.force_glsl_version <= ctx->Const.GLSLVersion) {
|
|
|
|
ctx->Const.ForceGLSLVersion = st->options.force_glsl_version;
|
|
|
|
}
|
|
|
|
|
2013-11-21 15:25:55 +01:00
|
|
|
/* This extension needs full OpenGL 3.2, but we don't know if that's
|
|
|
|
* supported at this point. Only check the GLSL version. */
|
|
|
|
if (ctx->Const.GLSLVersion >= 150 &&
|
|
|
|
screen->get_param(screen, PIPE_CAP_TGSI_VS_LAYER)) {
|
|
|
|
ctx->Extensions.AMD_vertex_shader_layer = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2012-01-24 22:23:01 +01:00
|
|
|
if (ctx->Const.GLSLVersion >= 130) {
|
|
|
|
ctx->Const.NativeIntegers = GL_TRUE;
|
|
|
|
ctx->Const.MaxClipPlanes = 8;
|
|
|
|
|
2013-01-21 18:07:39 +01:00
|
|
|
/* Extensions that either depend on GLSL 1.30 or are a subset thereof. */
|
2012-01-24 22:23:01 +01:00
|
|
|
ctx->Extensions.ARB_conservative_depth = GL_TRUE;
|
2013-01-31 23:52:14 +01:00
|
|
|
ctx->Extensions.ARB_shading_language_packing = GL_TRUE;
|
2013-01-21 18:07:39 +01:00
|
|
|
ctx->Extensions.OES_depth_texture_cube_map = GL_TRUE;
|
2013-07-18 11:49:44 -07:00
|
|
|
ctx->Extensions.ARB_shading_language_420pack = GL_TRUE;
|
2013-07-30 22:29:27 +02:00
|
|
|
|
|
|
|
if (!st->options.disable_shader_bit_encoding) {
|
|
|
|
ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE;
|
|
|
|
}
|
2012-01-24 22:23:01 +01:00
|
|
|
} else {
|
|
|
|
/* Optional integer support for GLSL 1.2. */
|
|
|
|
if (screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
|
|
|
|
PIPE_SHADER_CAP_INTEGERS) &&
|
|
|
|
screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
|
|
|
|
PIPE_SHADER_CAP_INTEGERS)) {
|
|
|
|
ctx->Const.NativeIntegers = GL_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-25 01:01:54 +01:00
|
|
|
/* Below are the cases which cannot be moved into tables easily. */
|
2011-04-28 20:01:02 +02:00
|
|
|
|
2013-07-30 22:29:18 +02:00
|
|
|
if (!ctx->Mesa_DXTn && !st->options.force_s3tc_enable) {
|
2012-01-25 01:01:54 +01:00
|
|
|
ctx->Extensions.EXT_texture_compression_s3tc = GL_FALSE;
|
2012-12-01 12:02:04 -08:00
|
|
|
ctx->Extensions.ANGLE_texture_compression_dxt = GL_FALSE;
|
2011-02-20 07:04:19 +10:00
|
|
|
}
|
|
|
|
|
2011-11-04 18:10:16 +01:00
|
|
|
if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY,
|
|
|
|
PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) {
|
2010-12-13 17:01:30 -07:00
|
|
|
#if 0 /* XXX re-enable when GLSL compiler again supports geometry shaders */
|
2010-06-28 17:31:21 -04:00
|
|
|
ctx->Extensions.ARB_geometry_shader4 = GL_TRUE;
|
2010-12-13 17:01:30 -07:00
|
|
|
#endif
|
2010-06-28 17:31:21 -04:00
|
|
|
}
|
2010-07-21 09:14:43 +02:00
|
|
|
|
2011-04-15 21:13:04 +01:00
|
|
|
ctx->Extensions.NV_primitive_restart = GL_TRUE;
|
|
|
|
if (!screen->get_param(screen, PIPE_CAP_PRIMITIVE_RESTART)) {
|
2012-05-07 15:44:34 -07:00
|
|
|
ctx->Const.PrimitiveRestartInSoftware = GL_TRUE;
|
2010-10-21 19:03:38 -06:00
|
|
|
}
|
|
|
|
|
2013-03-28 03:16:25 +01:00
|
|
|
/* ARB_color_buffer_float. */
|
2012-01-23 03:11:17 +01:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_UNCLAMPED)) {
|
2011-02-16 00:14:49 +01:00
|
|
|
ctx->Extensions.ARB_color_buffer_float = GL_TRUE;
|
2012-01-23 03:11:17 +01:00
|
|
|
|
|
|
|
if (!screen->get_param(screen, PIPE_CAP_VERTEX_COLOR_CLAMPED)) {
|
|
|
|
st->clamp_vert_color_in_shader = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!screen->get_param(screen, PIPE_CAP_FRAGMENT_COLOR_CLAMPED)) {
|
|
|
|
st->clamp_frag_color_in_shader = TRUE;
|
|
|
|
}
|
2013-03-28 03:16:25 +01:00
|
|
|
|
|
|
|
/* For drivers which cannot do color clamping, it's better to just
|
|
|
|
* disable ARB_color_buffer_float in the core profile, because
|
|
|
|
* the clamping is deprecated there anyway. */
|
|
|
|
if (ctx->API == API_OPENGL_CORE &&
|
|
|
|
(st->clamp_frag_color_in_shader || st->clamp_vert_color_in_shader)) {
|
|
|
|
st->clamp_vert_color_in_shader = GL_FALSE;
|
|
|
|
st->clamp_frag_color_in_shader = GL_FALSE;
|
|
|
|
ctx->Extensions.ARB_color_buffer_float = GL_FALSE;
|
|
|
|
}
|
2011-03-26 13:19:23 +01:00
|
|
|
}
|
2011-02-16 00:14:49 +01:00
|
|
|
|
2011-03-05 20:32:28 +01:00
|
|
|
if (screen->fence_finish) {
|
|
|
|
ctx->Extensions.ARB_sync = GL_TRUE;
|
|
|
|
}
|
2011-03-08 11:32:35 +01:00
|
|
|
|
2011-07-28 15:26:01 +02:00
|
|
|
/* Maximum sample count. */
|
|
|
|
for (i = 16; i > 0; --i) {
|
2013-03-04 06:17:11 +10:00
|
|
|
enum pipe_format pformat = st_choose_format(st, GL_RGBA,
|
|
|
|
GL_NONE, GL_NONE,
|
|
|
|
PIPE_TEXTURE_2D, i,
|
|
|
|
PIPE_BIND_RENDER_TARGET, FALSE);
|
|
|
|
if (pformat != PIPE_FORMAT_NONE) {
|
2011-07-28 15:26:01 +02:00
|
|
|
ctx->Const.MaxSamples = i;
|
2013-03-04 06:17:11 +10:00
|
|
|
ctx->Const.MaxColorTextureSamples = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = ctx->Const.MaxSamples; i > 0; --i) {
|
|
|
|
enum pipe_format pformat = st_choose_format(st, GL_DEPTH_STENCIL,
|
|
|
|
GL_NONE, GL_NONE,
|
|
|
|
PIPE_TEXTURE_2D, i,
|
|
|
|
PIPE_BIND_DEPTH_STENCIL, FALSE);
|
|
|
|
if (pformat != PIPE_FORMAT_NONE) {
|
|
|
|
ctx->Const.MaxDepthTextureSamples = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = ctx->Const.MaxSamples; i > 0; --i) {
|
|
|
|
enum pipe_format pformat = st_choose_format(st, GL_RGBA_INTEGER,
|
|
|
|
GL_NONE, GL_NONE,
|
|
|
|
PIPE_TEXTURE_2D, i,
|
|
|
|
PIPE_BIND_RENDER_TARGET, FALSE);
|
|
|
|
if (pformat != PIPE_FORMAT_NONE) {
|
|
|
|
ctx->Const.MaxIntegerSamples = i;
|
2011-07-28 15:26:01 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-01-26 10:09:37 -07:00
|
|
|
if (ctx->Const.MaxSamples == 1) {
|
|
|
|
/* one sample doesn't really make sense */
|
|
|
|
ctx->Const.MaxSamples = 0;
|
|
|
|
}
|
2013-01-28 11:32:13 -07:00
|
|
|
else if (ctx->Const.MaxSamples >= 2) {
|
|
|
|
ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
|
2013-07-30 22:29:06 +02:00
|
|
|
ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE;
|
2013-01-28 11:32:13 -07:00
|
|
|
}
|
2012-03-24 13:36:17 +00:00
|
|
|
|
2013-07-30 22:29:16 +02:00
|
|
|
if (ctx->Const.MaxDualSourceDrawBuffers > 0 &&
|
|
|
|
!st->options.disable_blend_func_extended)
|
2012-03-24 13:36:17 +00:00
|
|
|
ctx->Extensions.ARB_blend_func_extended = GL_TRUE;
|
2012-07-05 20:27:01 +02:00
|
|
|
|
2012-12-09 10:08:13 +00:00
|
|
|
st->has_time_elapsed =
|
|
|
|
screen->get_param(screen, PIPE_CAP_QUERY_TIME_ELAPSED);
|
|
|
|
|
|
|
|
if (st->has_time_elapsed ||
|
|
|
|
ctx->Extensions.ARB_timer_query) {
|
|
|
|
ctx->Extensions.EXT_timer_query = GL_TRUE;
|
2012-07-05 20:27:01 +02:00
|
|
|
}
|
2011-12-18 04:57:31 +01:00
|
|
|
|
|
|
|
if (ctx->Extensions.ARB_transform_feedback2 &&
|
|
|
|
ctx->Extensions.ARB_draw_instanced) {
|
|
|
|
ctx->Extensions.ARB_transform_feedback_instanced = GL_TRUE;
|
|
|
|
}
|
2012-04-12 04:30:03 +04:00
|
|
|
if (st->options.force_glsl_extensions_warn)
|
2013-04-22 10:08:06 -06:00
|
|
|
ctx->Const.ForceGLSLExtensionsWarn = 1;
|
2012-10-28 17:52:48 +01:00
|
|
|
|
2013-04-19 01:04:51 +04:00
|
|
|
if (st->options.disable_glsl_line_continuations)
|
2013-04-22 10:08:06 -06:00
|
|
|
ctx->Const.DisableGLSLLineContinuations = 1;
|
2013-04-19 01:04:51 +04:00
|
|
|
|
2012-10-28 17:52:48 +01:00
|
|
|
ctx->Const.MinMapBufferAlignment =
|
|
|
|
screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT);
|
2013-11-28 12:26:35 +03:30
|
|
|
|
2012-12-15 13:03:54 +10:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) {
|
2012-12-06 16:12:11 +10:00
|
|
|
ctx->Extensions.ARB_texture_buffer_object = GL_TRUE;
|
2012-12-22 13:46:27 +01:00
|
|
|
|
2013-05-02 03:24:33 +02:00
|
|
|
ctx->Const.MaxTextureBufferSize =
|
|
|
|
_min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE),
|
|
|
|
(1u << 31) - 1);
|
2012-12-22 13:46:27 +01:00
|
|
|
ctx->Const.TextureBufferOffsetAlignment =
|
|
|
|
screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT);
|
|
|
|
|
|
|
|
if (ctx->Const.TextureBufferOffsetAlignment)
|
|
|
|
ctx->Extensions.ARB_texture_buffer_range = GL_TRUE;
|
|
|
|
|
2012-12-15 13:03:54 +10:00
|
|
|
init_format_extensions(st, tbo_rgb32, Elements(tbo_rgb32),
|
|
|
|
PIPE_BUFFER, PIPE_BIND_SAMPLER_VIEW);
|
|
|
|
}
|
|
|
|
|
2013-11-13 14:10:34 -08:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_MIXED_FRAMEBUFFER_SIZES)) {
|
2013-10-04 04:32:16 -04:00
|
|
|
ctx->Extensions.ARB_framebuffer_object = GL_TRUE;
|
|
|
|
}
|
2012-12-13 12:45:54 -08:00
|
|
|
|
|
|
|
/* Unpacking a varying in the fragment shader costs 1 texture indirection.
|
|
|
|
* If the number of available texture indirections is very limited, then we
|
|
|
|
* prefer to disable varying packing rather than run the risk of varying
|
|
|
|
* packing preventing a shader from running.
|
|
|
|
*/
|
|
|
|
if (screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
|
|
|
|
PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS) <= 8) {
|
|
|
|
/* We can't disable varying packing if transform feedback is available,
|
|
|
|
* because transform feedback code assumes a packed varying layout.
|
|
|
|
*/
|
|
|
|
if (!ctx->Extensions.EXT_transform_feedback)
|
|
|
|
ctx->Const.DisableVaryingPacking = GL_TRUE;
|
|
|
|
}
|
2007-11-05 18:04:30 -07:00
|
|
|
}
|