2007-11-05 18:04:30 -07:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
|
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.
|
|
|
|
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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 "main/imports.h"
|
|
|
|
#include "main/context.h"
|
|
|
|
#include "main/macros.h"
|
2011-01-09 01:04:19 -08:00
|
|
|
#include "main/mfeatures.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"
|
|
|
|
|
|
|
|
|
2008-05-02 10:08:03 +00:00
|
|
|
static int _min(int a, int 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;
|
2010-11-23 10:28:43 -07:00
|
|
|
gl_shader_type sh;
|
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);
|
|
|
|
|
2009-01-02 16:54:11 -07:00
|
|
|
c->MaxTextureImageUnits
|
2011-09-27 22:22:06 +02:00
|
|
|
= _min(screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT,
|
|
|
|
PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS),
|
2007-11-06 09:41:45 -07:00
|
|
|
MAX_TEXTURE_IMAGE_UNITS);
|
2007-11-05 18:04:30 -07:00
|
|
|
|
2008-12-02 22:37:35 -07:00
|
|
|
c->MaxVertexTextureImageUnits
|
2011-09-27 22:22:06 +02:00
|
|
|
= _min(screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
|
|
|
|
PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS),
|
2009-01-02 16:15:43 -07:00
|
|
|
MAX_VERTEX_TEXTURE_IMAGE_UNITS);
|
2008-12-02 22:37:35 -07:00
|
|
|
|
2009-12-01 11:19:33 +01:00
|
|
|
c->MaxCombinedTextureImageUnits
|
|
|
|
= _min(screen->get_param(screen, PIPE_CAP_MAX_COMBINED_SAMPLERS),
|
|
|
|
MAX_COMBINED_TEXTURE_IMAGE_UNITS);
|
|
|
|
|
2009-01-04 10:04:44 -07:00
|
|
|
c->MaxTextureCoordUnits
|
|
|
|
= _min(c->MaxTextureImageUnits, MAX_TEXTURE_COORD_UNITS);
|
2009-01-02 16:54:11 -07:00
|
|
|
|
2009-01-04 10:04:44 -07:00
|
|
|
c->MaxTextureUnits = _min(c->MaxTextureImageUnits, c->MaxTextureCoordUnits);
|
2009-01-02 16:54:11 -07:00
|
|
|
|
2007-11-06 09:41:45 -07:00
|
|
|
c->MaxDrawBuffers
|
2008-05-02 10:08:03 +00:00
|
|
|
= _clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
|
2007-11-06 09:41:45 -07:00
|
|
|
1, 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
|
|
|
|
2008-04-14 20:56:08 -06:00
|
|
|
c->MaxDrawBuffers
|
|
|
|
= CLAMP(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
|
|
|
|
1, MAX_DRAW_BUFFERS);
|
2009-06-23 14:28:43 -06:00
|
|
|
|
2010-02-10 10:39:18 -08:00
|
|
|
/* Quads always follow GL provoking rules. */
|
|
|
|
c->QuadsFollowProvokingVertexConvention = GL_FALSE;
|
2010-05-04 15:41:19 +01:00
|
|
|
|
2010-11-23 10:28:43 -07:00
|
|
|
for (sh = 0; sh < MESA_SHADER_TYPES; ++sh) {
|
|
|
|
struct gl_shader_compiler_options *options =
|
|
|
|
&st->ctx->ShaderCompilerOptions[sh];
|
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:
|
|
|
|
pc = &c->FragmentProgram;
|
|
|
|
break;
|
|
|
|
case PIPE_SHADER_VERTEX:
|
|
|
|
pc = &c->VertexProgram;
|
|
|
|
break;
|
|
|
|
case PIPE_SHADER_GEOMETRY:
|
|
|
|
pc = &c->GeometryProgram;
|
|
|
|
break;
|
2010-09-15 18:47:17 -07:00
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2010-11-23 10:28:43 -07:00
|
|
|
pc->MaxNativeInstructions = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS);
|
|
|
|
pc->MaxNativeAluInstructions = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS);
|
|
|
|
pc->MaxNativeTexInstructions = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS);
|
|
|
|
pc->MaxNativeTexIndirections = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS);
|
|
|
|
pc->MaxNativeAttribs = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INPUTS);
|
|
|
|
pc->MaxNativeTemps = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEMPS);
|
|
|
|
pc->MaxNativeAddressRegs = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_ADDRS);
|
|
|
|
pc->MaxNativeParameters = screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_CONSTS);
|
2010-11-21 22:02:02 +01:00
|
|
|
pc->MaxUniformComponents = 4 * MIN2(pc->MaxNativeParameters, MAX_UNIFORMS);
|
2011-04-27 09:31:30 -06:00
|
|
|
/* raise MaxParameters if native support is higher */
|
|
|
|
pc->MaxParameters = MAX2(pc->MaxParameters, pc->MaxNativeParameters);
|
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);
|
|
|
|
|
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);
|
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
|
|
|
|
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);
|
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-09 18:33:58 +01:00
|
|
|
c->MaxTransformFeedbackSeparateAttribs =
|
2011-12-17 21:09:30 +01:00
|
|
|
screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_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);
|
|
|
|
|
|
|
|
c->GLSLSkipStrictMaxVaryingLimitCheck =
|
|
|
|
screen->get_param(screen, PIPE_CAP_TGSI_CAN_COMPACT_VARYINGS);
|
2007-11-05 18:04:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-07-25 13:30:17 -05:00
|
|
|
static GLboolean st_get_s3tc_override(void)
|
|
|
|
{
|
|
|
|
const char *override = _mesa_getenv("force_s3tc_enable");
|
|
|
|
if (override && !strcmp(override, "true"))
|
|
|
|
return GL_TRUE;
|
|
|
|
return GL_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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;
|
2011-11-18 15:51:47 +01:00
|
|
|
|
2007-11-05 18:04:30 -07:00
|
|
|
/*
|
|
|
|
* Extensions that are supported by all Gallium drivers:
|
|
|
|
*/
|
2009-06-02 21:24:28 -06:00
|
|
|
ctx->Extensions.ARB_copy_buffer = 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;
|
2009-06-08 17:07:21 -06:00
|
|
|
ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
|
2011-04-10 12:48:28 -06:00
|
|
|
ctx->Extensions.ARB_sampler_objects = GL_TRUE;
|
2011-11-18 15:51:47 +01:00
|
|
|
ctx->Extensions.ARB_shader_objects = GL_TRUE;
|
|
|
|
ctx->Extensions.ARB_shading_language_100 = 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;
|
2011-10-31 10:52:57 -06:00
|
|
|
ctx->Extensions.ARB_texture_storage = GL_TRUE;
|
2009-06-22 17:01:00 -06:00
|
|
|
ctx->Extensions.ARB_vertex_array_object = 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;
|
2010-03-06 17:36:44 +01:00
|
|
|
ctx->Extensions.ARB_window_pos = 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;
|
2008-03-18 17:16:23 -06:00
|
|
|
ctx->Extensions.EXT_framebuffer_blit = GL_TRUE;
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.EXT_framebuffer_object = GL_TRUE;
|
2010-01-06 14:27:50 +01:00
|
|
|
ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.EXT_fog_coord = 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;
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.EXT_secondary_color = GL_TRUE;
|
2011-11-18 15:51:47 +01:00
|
|
|
ctx->Extensions.EXT_separate_shader_objects = GL_TRUE;
|
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
|
|
|
|
2009-05-13 11:15:00 -06:00
|
|
|
ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
|
|
|
|
|
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;
|
|
|
|
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.NV_blend_square = GL_TRUE;
|
2011-09-19 23:17:01 -07:00
|
|
|
ctx->Extensions.NV_fog_distance = GL_TRUE;
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.NV_texgen_reflection = 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;
|
2010-03-11 18:54:14 +01:00
|
|
|
#if 0
|
|
|
|
/* possibly could support the following two */
|
2010-03-06 17:36:44 +01:00
|
|
|
ctx->Extensions.NV_vertex_program = GL_TRUE;
|
|
|
|
ctx->Extensions.NV_vertex_program1_1 = GL_TRUE;
|
2010-03-11 18:54:14 +01:00
|
|
|
#endif
|
2007-11-05 18:04:30 -07:00
|
|
|
|
2010-04-06 17:46:17 +08:00
|
|
|
#if FEATURE_OES_EGL_image
|
|
|
|
ctx->Extensions.OES_EGL_image = GL_TRUE;
|
2011-10-23 00:53:21 +08:00
|
|
|
if (ctx->API != API_OPENGL)
|
|
|
|
ctx->Extensions.OES_EGL_image_external = GL_TRUE;
|
2010-04-06 17:46:17 +08:00
|
|
|
#endif
|
2009-09-22 15:00:24 +08:00
|
|
|
#if FEATURE_OES_draw_texture
|
|
|
|
ctx->Extensions.OES_draw_texture = GL_TRUE;
|
|
|
|
#endif
|
|
|
|
|
2012-01-24 22:23:01 +01:00
|
|
|
/* Figure out GLSL support. */
|
|
|
|
glsl_feature_level = screen->get_param(screen, PIPE_CAP_GLSL_FEATURE_LEVEL);
|
|
|
|
|
|
|
|
if (glsl_feature_level >= 130) {
|
|
|
|
ctx->Const.GLSLVersion = 130;
|
|
|
|
} else {
|
|
|
|
ctx->Const.GLSLVersion = 120;
|
|
|
|
}
|
|
|
|
|
|
|
|
_mesa_override_glsl_version(st->ctx);
|
|
|
|
|
|
|
|
if (ctx->Const.GLSLVersion >= 130) {
|
|
|
|
ctx->Const.NativeIntegers = GL_TRUE;
|
|
|
|
ctx->Const.MaxClipPlanes = 8;
|
|
|
|
|
|
|
|
/* Extensions that only depend on GLSL 1.3. */
|
|
|
|
ctx->Extensions.ARB_conservative_depth = GL_TRUE;
|
|
|
|
} 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-05 18:04:30 -07:00
|
|
|
/*
|
|
|
|
* Extensions that depend on the driver/hardware:
|
|
|
|
*/
|
2010-04-27 21:06:44 +10:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_TEXTURE_SWIZZLE) > 0) {
|
|
|
|
ctx->Extensions.EXT_texture_swizzle = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2009-07-14 09:44:49 +02:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_BLEND_EQUATION_SEPARATE)) {
|
|
|
|
ctx->Extensions.EXT_blend_equation_separate = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-08-06 17:22:29 -06:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_TEXTURE_MIRROR_CLAMP) > 0) {
|
|
|
|
ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE;
|
2010-04-14 12:49:20 +02:00
|
|
|
ctx->Extensions.ATI_texture_mirror_once = GL_TRUE;
|
2008-08-06 17:22:29 -06:00
|
|
|
}
|
|
|
|
|
2008-02-27 11:24:35 -07:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES)) {
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-02-27 11:24:35 -07:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_TWO_SIDED_STENCIL)) {
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.ATI_separate_stencil = GL_TRUE;
|
2009-02-19 14:37:43 -07:00
|
|
|
ctx->Extensions.EXT_stencil_two_side = GL_TRUE;
|
2007-11-05 18:04:30 -07:00
|
|
|
}
|
|
|
|
|
2008-02-27 11:24:35 -07:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_ANISOTROPIC_FILTER)) {
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.EXT_texture_filter_anisotropic = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2008-02-27 11:24:35 -07:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_POINT_SPRITE)) {
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.ARB_point_sprite = GL_TRUE;
|
2009-08-03 11:16:23 -06:00
|
|
|
/* GL_NV_point_sprite is not supported by gallium because we don't
|
|
|
|
* support the GL_POINT_SPRITE_R_MODE_NV option.
|
|
|
|
*/
|
2007-11-05 18:04:30 -07:00
|
|
|
}
|
|
|
|
|
2008-02-27 11:24:35 -07:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_OCCLUSION_QUERY)) {
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.ARB_occlusion_query = GL_TRUE;
|
2010-09-12 06:31:30 +10:00
|
|
|
ctx->Extensions.ARB_occlusion_query2 = GL_TRUE;
|
2007-11-05 18:04:30 -07:00
|
|
|
}
|
2010-05-17 11:48:56 -07:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_TIMER_QUERY)) {
|
2011-11-30 07:09:46 -07:00
|
|
|
ctx->Extensions.EXT_timer_query = GL_TRUE;
|
2010-05-17 11:48:56 -07:00
|
|
|
}
|
2007-11-05 18:04:30 -07:00
|
|
|
|
2008-02-27 11:24:35 -07:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_TEXTURE_SHADOW_MAP)) {
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.ARB_depth_texture = GL_TRUE;
|
2010-06-06 20:49:14 +02:00
|
|
|
ctx->Extensions.ARB_fragment_program_shadow = GL_TRUE;
|
2007-11-05 18:04:30 -07:00
|
|
|
ctx->Extensions.ARB_shadow = GL_TRUE;
|
2007-11-08 09:33:33 -07:00
|
|
|
ctx->Extensions.EXT_shadow_funcs = GL_TRUE;
|
2007-11-05 18:04:30 -07:00
|
|
|
/*ctx->Extensions.ARB_shadow_ambient = GL_TRUE;*/
|
|
|
|
}
|
|
|
|
|
2008-08-14 10:53:59 -06:00
|
|
|
/* GL_EXT_packed_depth_stencil requires both the ability to render to
|
|
|
|
* a depth/stencil buffer and texture from depth/stencil source.
|
|
|
|
*/
|
2011-09-11 09:45:10 +01:00
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_S8_UINT_Z24_UNORM,
|
2010-05-17 21:19:03 +02:00
|
|
|
PIPE_TEXTURE_2D, 0,
|
2012-01-22 18:27:40 +01:00
|
|
|
PIPE_BIND_DEPTH_STENCIL |
|
|
|
|
PIPE_BIND_SAMPLER_VIEW) ||
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_UINT,
|
2010-05-17 21:19:03 +02:00
|
|
|
PIPE_TEXTURE_2D, 0,
|
2012-01-22 18:27:40 +01:00
|
|
|
PIPE_BIND_DEPTH_STENCIL |
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW)) {
|
2008-08-14 10:53:59 -06:00
|
|
|
ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
|
2012-01-22 18:27:40 +01:00
|
|
|
ctx->Extensions.ARB_framebuffer_object = GL_TRUE;
|
2008-08-14 10:53:59 -06:00
|
|
|
}
|
|
|
|
|
2011-02-16 00:40:37 +01:00
|
|
|
/* float support - assume nothing exclusively supports 64-bit floats */
|
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_R32G32B32A32_FLOAT,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_SAMPLER_VIEW |
|
|
|
|
PIPE_BIND_RENDER_TARGET) &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_R16G16B16A16_FLOAT,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_SAMPLER_VIEW |
|
|
|
|
PIPE_BIND_RENDER_TARGET)) {
|
|
|
|
ctx->Extensions.ARB_texture_float = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2009-01-26 12:31:02 -07:00
|
|
|
/* sRGB support */
|
2010-03-01 18:10:23 +00:00
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_A8B8G8R8_SRGB,
|
2010-05-17 21:19:03 +02:00
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW) ||
|
2010-03-01 18:10:23 +00:00
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_SRGB,
|
2010-05-17 21:19:03 +02:00
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW)) {
|
2008-03-21 10:51:21 -06:00
|
|
|
ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
|
2011-01-13 17:22:54 +10:00
|
|
|
ctx->Extensions.EXT_texture_sRGB_decode = GL_TRUE;
|
2011-02-06 19:01:58 +10:00
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_A8B8G8R8_SRGB,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_RENDER_TARGET) ||
|
2011-02-06 19:01:58 +10:00
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_SRGB,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_RENDER_TARGET)) {
|
2011-02-06 19:01:58 +10:00
|
|
|
ctx->Extensions.EXT_framebuffer_sRGB = GL_TRUE;
|
|
|
|
}
|
2008-03-21 10:51:21 -06:00
|
|
|
}
|
2008-03-21 11:05:02 -06:00
|
|
|
|
2010-08-11 19:04:05 +10:00
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW)) {
|
2010-08-11 19:04:05 +10:00
|
|
|
ctx->Extensions.ARB_texture_rg = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2009-01-26 12:31:02 -07:00
|
|
|
/* s3tc support */
|
2012-01-22 18:47:21 +01:00
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGB,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_SAMPLER_VIEW) &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_DXT1_RGBA,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_SAMPLER_VIEW) &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_DXT3_RGBA,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_SAMPLER_VIEW) &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
|
2010-05-17 21:19:03 +02:00
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW) &&
|
2011-07-25 13:30:17 -05:00
|
|
|
(ctx->Mesa_DXTn || st_get_s3tc_override())) {
|
2008-03-21 11:05:02 -06:00
|
|
|
ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE;
|
2009-11-06 12:05:43 +00:00
|
|
|
ctx->Extensions.S3_s3tc = GL_TRUE;
|
2008-03-21 11:05:02 -06:00
|
|
|
}
|
2009-01-26 12:31:02 -07:00
|
|
|
|
2011-02-25 09:24:15 +10:00
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_UNORM,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW) &&
|
2011-02-25 09:24:15 +10:00
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_RGTC1_SNORM,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW) &&
|
2011-02-25 09:24:15 +10:00
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_UNORM,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW) &&
|
2011-02-25 09:24:15 +10:00
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_RGTC2_SNORM,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW)
|
2011-02-25 09:24:15 +10:00
|
|
|
) {
|
|
|
|
ctx->Extensions.ARB_texture_compression_rgtc = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2011-03-07 02:24:43 +01:00
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_LATC1_UNORM,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW) &&
|
2011-03-07 02:24:43 +01:00
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_LATC1_SNORM,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW) &&
|
2011-03-07 02:24:43 +01:00
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_LATC2_UNORM,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW) &&
|
2011-03-07 02:24:43 +01:00
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_LATC2_SNORM,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW)) {
|
2011-03-07 02:24:43 +01:00
|
|
|
ctx->Extensions.EXT_texture_compression_latc = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_LATC2_UNORM,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW)) {
|
2011-03-07 02:24:43 +01:00
|
|
|
ctx->Extensions.ATI_texture_compression_3dc = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2011-11-29 12:49:36 +08:00
|
|
|
if (ctx->API != API_OPENGL) {
|
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_ETC1_RGB8,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_SAMPLER_VIEW)) {
|
|
|
|
ctx->Extensions.OES_compressed_ETC1_RGB8_texture = GL_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-14 10:04:36 +01:00
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_SNORM,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_SAMPLER_VIEW)) {
|
|
|
|
ctx->Extensions.EXT_texture_snorm = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2009-01-26 12:31:02 -07:00
|
|
|
/* ycbcr support */
|
2010-03-01 18:10:23 +00:00
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_UYVY,
|
2010-05-17 21:19:03 +02:00
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW) ||
|
2010-03-01 18:10:23 +00:00
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_YUYV,
|
2010-05-17 21:19:03 +02:00
|
|
|
PIPE_TEXTURE_2D, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_SAMPLER_VIEW)) {
|
2008-04-03 16:37:30 -06:00
|
|
|
ctx->Extensions.MESA_ycbcr_texture = GL_TRUE;
|
|
|
|
}
|
2009-06-29 15:13:02 -06:00
|
|
|
|
2011-01-25 20:26:22 -07:00
|
|
|
/* GL_EXT_texture_array */
|
2011-09-05 22:52:21 +02:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS) > 1) {
|
2011-01-25 20:26:22 -07:00
|
|
|
ctx->Extensions.EXT_texture_array = GL_TRUE;
|
|
|
|
ctx->Extensions.MESA_texture_array = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2011-09-27 23:08:04 +02:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_CONDITIONAL_RENDER)) {
|
2009-12-31 14:47:21 -07:00
|
|
|
ctx->Extensions.NV_conditional_render = GL_TRUE;
|
|
|
|
}
|
2010-01-25 19:27:05 +01:00
|
|
|
|
|
|
|
if (screen->get_param(screen, PIPE_CAP_INDEP_BLEND_ENABLE)) {
|
|
|
|
ctx->Extensions.EXT_draw_buffers2 = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2011-01-17 16:29:28 -07:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_INDEP_BLEND_FUNC)) {
|
|
|
|
ctx->Extensions.ARB_draw_buffers_blend = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2010-05-26 01:54:58 +02:00
|
|
|
/* GL_ARB_half_float_vertex */
|
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_R16G16B16A16_FLOAT,
|
|
|
|
PIPE_BUFFER, 0,
|
2011-03-08 00:01:58 +01:00
|
|
|
PIPE_BIND_VERTEX_BUFFER)) {
|
2010-05-26 01:54:58 +02:00
|
|
|
ctx->Extensions.ARB_half_float_vertex = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2011-04-28 20:01:02 +02:00
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_R32G32B32A32_FIXED,
|
|
|
|
PIPE_BUFFER, 0,
|
|
|
|
PIPE_BIND_VERTEX_BUFFER)) {
|
|
|
|
ctx->Extensions.ARB_ES2_compatibility = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
2011-02-20 07:04:19 +10:00
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_R10G10B10A2_UNORM,
|
|
|
|
PIPE_BUFFER, 0,
|
|
|
|
PIPE_BIND_VERTEX_BUFFER) &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_B10G10R10A2_UNORM,
|
|
|
|
PIPE_BUFFER, 0,
|
|
|
|
PIPE_BIND_VERTEX_BUFFER) &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_R10G10B10A2_SNORM,
|
|
|
|
PIPE_BUFFER, 0,
|
|
|
|
PIPE_BIND_VERTEX_BUFFER) &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_B10G10R10A2_SNORM,
|
|
|
|
PIPE_BUFFER, 0,
|
|
|
|
PIPE_BIND_VERTEX_BUFFER) &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_R10G10B10A2_USCALED,
|
|
|
|
PIPE_BUFFER, 0,
|
|
|
|
PIPE_BIND_VERTEX_BUFFER) &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_B10G10R10A2_USCALED,
|
|
|
|
PIPE_BUFFER, 0,
|
|
|
|
PIPE_BIND_VERTEX_BUFFER) &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_R10G10B10A2_SSCALED,
|
|
|
|
PIPE_BUFFER, 0,
|
|
|
|
PIPE_BIND_VERTEX_BUFFER) &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_B10G10R10A2_SSCALED,
|
|
|
|
PIPE_BUFFER, 0,
|
|
|
|
PIPE_BIND_VERTEX_BUFFER)) {
|
|
|
|
ctx->Extensions.ARB_vertex_type_2_10_10_10_rev = GL_TRUE;
|
|
|
|
}
|
|
|
|
|
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)) {
|
|
|
|
st->sw_primitive_restart = GL_TRUE;
|
2010-10-21 19:03:38 -06:00
|
|
|
}
|
|
|
|
|
2012-01-10 00:19:00 +01:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_DEPTH_CLIP_DISABLE)) {
|
2010-07-21 09:14:43 +02:00
|
|
|
ctx->Extensions.ARB_depth_clamp = GL_TRUE;
|
|
|
|
}
|
2010-10-06 09:36:56 +10:00
|
|
|
|
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;
|
|
|
|
}
|
2011-03-26 13:19:23 +01:00
|
|
|
}
|
2011-02-16 00:14:49 +01:00
|
|
|
|
2010-10-06 09:36:56 +10:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT)) {
|
|
|
|
ctx->Extensions.ARB_shader_stencil_export = GL_TRUE;
|
|
|
|
}
|
2010-12-05 13:34:02 -07:00
|
|
|
|
2011-03-05 16:06:10 +01:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_TGSI_INSTANCEID)) {
|
2010-12-05 13:34:02 -07:00
|
|
|
ctx->Extensions.ARB_draw_instanced = GL_TRUE;
|
2011-03-05 16:06:10 +01:00
|
|
|
}
|
|
|
|
if (screen->get_param(screen, PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR)) {
|
2011-01-15 17:35:08 -07:00
|
|
|
ctx->Extensions.ARB_instanced_arrays = GL_TRUE;
|
2010-12-05 13:34:02 -07: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-09-27 23:18:17 +02:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_TEXTURE_BARRIER)) {
|
2011-03-08 11:32:35 +01:00
|
|
|
ctx->Extensions.NV_texture_barrier = GL_TRUE;
|
|
|
|
}
|
2011-04-26 02:23:33 +02:00
|
|
|
|
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_R9G9B9E5_FLOAT,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_SAMPLER_VIEW)) {
|
|
|
|
ctx->Extensions.EXT_texture_shared_exponent = GL_TRUE;
|
|
|
|
}
|
2011-04-26 02:28:33 +02:00
|
|
|
|
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_R11G11B10_FLOAT,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_RENDER_TARGET |
|
|
|
|
PIPE_BIND_SAMPLER_VIEW)) {
|
|
|
|
ctx->Extensions.EXT_packed_float = GL_TRUE;
|
|
|
|
}
|
2011-05-02 02:37:46 +02:00
|
|
|
|
2011-07-28 15:26:01 +02:00
|
|
|
/* Maximum sample count. */
|
|
|
|
for (i = 16; i > 0; --i) {
|
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_UNORM,
|
|
|
|
PIPE_TEXTURE_2D, i,
|
|
|
|
PIPE_BIND_RENDER_TARGET)) {
|
|
|
|
ctx->Const.MaxSamples = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-02 02:37:46 +02:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE)) {
|
|
|
|
ctx->Extensions.ARB_seamless_cube_map = GL_TRUE;
|
|
|
|
ctx->Extensions.AMD_seamless_cubemap_per_texture = GL_TRUE;
|
|
|
|
}
|
|
|
|
else if (screen->get_param(screen, PIPE_CAP_SEAMLESS_CUBE_MAP)) {
|
|
|
|
ctx->Extensions.ARB_seamless_cube_map = GL_TRUE;
|
|
|
|
}
|
2011-05-06 21:59:23 +02:00
|
|
|
|
|
|
|
if (screen->get_param(screen, PIPE_CAP_SM3)) {
|
|
|
|
ctx->Extensions.ARB_shader_texture_lod = GL_TRUE;
|
|
|
|
}
|
2011-06-01 15:49:33 +02:00
|
|
|
|
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_Z32_FLOAT,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_DEPTH_STENCIL |
|
|
|
|
PIPE_BIND_SAMPLER_VIEW) &&
|
2011-09-11 09:45:10 +01:00
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_Z32_FLOAT_S8X24_UINT,
|
2011-06-01 15:49:33 +02:00
|
|
|
PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_DEPTH_STENCIL |
|
|
|
|
PIPE_BIND_SAMPLER_VIEW)) {
|
|
|
|
ctx->Extensions.ARB_depth_buffer_float = GL_TRUE;
|
|
|
|
}
|
2011-11-27 16:23:56 +00:00
|
|
|
|
|
|
|
if (screen->is_format_supported(screen, PIPE_FORMAT_B10G10R10A2_UINT,
|
|
|
|
PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_SAMPLER_VIEW))
|
|
|
|
ctx->Extensions.ARB_texture_rgb10_a2ui = GL_TRUE;
|
|
|
|
|
2011-12-09 18:33:58 +01:00
|
|
|
if (screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS) != 0) {
|
|
|
|
ctx->Extensions.EXT_transform_feedback = GL_TRUE;
|
|
|
|
|
|
|
|
if (screen->get_param(screen,
|
|
|
|
PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME) != 0) {
|
|
|
|
ctx->Extensions.ARB_transform_feedback2 = GL_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2012-01-05 14:35:54 +00:00
|
|
|
|
|
|
|
if (ctx->Const.NativeIntegers &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_R32G32B32A32_UINT, PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET) &&
|
|
|
|
screen->is_format_supported(screen, PIPE_FORMAT_R32G32B32A32_SINT, PIPE_TEXTURE_2D, 0,
|
|
|
|
PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET))
|
|
|
|
ctx->Extensions.EXT_texture_integer = GL_TRUE;
|
|
|
|
|
2007-11-05 18:04:30 -07:00
|
|
|
}
|