i915_context.c revision 4c1dc1c4d772b06578567f14419fdd4f27843825
16d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane/**************************************************************************
26d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane *
36d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
46d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * All Rights Reserved.
56d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane *
66d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * Permission is hereby granted, free of charge, to any person obtaining a
76d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * copy of this software and associated documentation files (the
86d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * "Software"), to deal in the Software without restriction, including
96d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * without limitation the rights to use, copy, modify, merge, publish,
106d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * distribute, sub license, and/or sell copies of the Software, and to
116d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * permit persons to whom the Software is furnished to do so, subject to
126d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * the following conditions:
136d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane *
146d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * The above copyright notice and this permission notice (including the
156d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * next paragraph) shall be included in all copies or substantial portions
166d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * of the Software.
176d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane *
186d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
196d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
206d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
216d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
226d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
236d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
246d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
256d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane *
266d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane **************************************************************************/
276d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
286d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane#include "i915_context.h"
29ecadb51bbcb972a79f3ed79e65a7986b9396e757Brian Paul#include "main/imports.h"
30c2ef10803d6c30e13f8f762cc874e3bccc8a2881Eric Anholt#include "main/macros.h"
316d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane#include "intel_tris.h"
326d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane#include "tnl/t_context.h"
336d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane#include "tnl/t_pipeline.h"
346d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane#include "tnl/t_vertex.h"
356d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
366d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane#include "swrast/swrast.h"
376d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane#include "swrast_setup/swrast_setup.h"
386d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane#include "tnl/tnl.h"
396d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
406d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane#include "i915_reg.h"
4161b512c47c9888f3ff117faf3aceccfb52d59c3aEric Anholt#include "i915_program.h"
426d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
43dd1d66fc4ab5d7064113a2017a431c3461598b91Kristian Høgsberg#include "intel_span.h"
446d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
456d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane/***************************************
466d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane * Mesa's Driver Functions
476d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane ***************************************/
486d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
496d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane/* Override intel default.
506d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane */
516d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihanestatic void
52f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergi915InvalidateState(struct gl_context * ctx, GLuint new_state)
536d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane{
546d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   _swrast_InvalidateState(ctx, new_state);
556d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   _swsetup_InvalidateState(ctx, new_state);
566a3fdc3a1ea6c306d9543791bf172dd1052d7382Keith Whitwell   _vbo_InvalidateState(ctx, new_state);
576d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   _tnl_InvalidateState(ctx, new_state);
586d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   _tnl_invalidate_vertex_state(ctx, new_state);
596d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   intel_context(ctx)->NewGLState |= new_state;
606d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
616d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   /* Todo: gather state values under which tracked parameters become
626d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane    * invalidated, add callbacks for things like
636d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane    * ProgramLocalParameters, etc.
646d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane    */
656d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   {
666d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane      struct i915_fragment_program *p =
676d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane         (struct i915_fragment_program *) ctx->FragmentProgram._Current;
686d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane      if (p && p->nr_params)
696d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane         p->params_uptodate = 0;
706d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   }
716d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
72a36dd5d54e3de5662c694e764d1c49795ddb6814Brian Paul   if (new_state & (_NEW_FOG | _NEW_HINT | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))
736d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane      i915_update_fog(ctx);
74246729162ccc7e2672aa6cc957053ce3a8975a2cEric Anholt   if (new_state & (_NEW_STENCIL | _NEW_BUFFERS | _NEW_POLYGON))
75246729162ccc7e2672aa6cc957053ce3a8975a2cEric Anholt      i915_update_stencil(ctx);
76de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt   if (new_state & (_NEW_LIGHT))
77de80eeea0eebf00ee678b1a0fbd5fe67b00a8636Eric Anholt       i915_update_provoking_vertex(ctx);
7861b512c47c9888f3ff117faf3aceccfb52d59c3aEric Anholt   if (new_state & (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))
7961b512c47c9888f3ff117faf3aceccfb52d59c3aEric Anholt       i915_update_program(ctx);
806d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane}
816d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
826d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
836d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihanestatic void
846d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihanei915InitDriverFunctions(struct dd_function_table *functions)
856d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane{
866d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   intelInitDriverFunctions(functions);
876d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   i915InitStateFunctions(functions);
886d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   i915InitFragProgFuncs(functions);
896d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   functions->UpdateState = i915InvalidateState;
906d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane}
916d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
926d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
93dd1d66fc4ab5d7064113a2017a431c3461598b91Kristian Høgsbergextern const struct tnl_pipeline_stage *intel_pipeline[];
946d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
956d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan HourihaneGLboolean
964b69100bdcf26dbb5be4d600b7ca5f5cdf6e8f20Kristian Høgsbergi915CreateContext(int api,
97d3491e775fb07f891463b2185d74bbad62f3ed24Kristian Høgsberg		  const struct gl_config * mesaVis,
98d61f07318c8678901b948fdaa8ccdf37aa3203e9Kristian Høgsberg                  __DRIcontext * driContextPriv,
996d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane                  void *sharedContextPrivate)
1006d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane{
1016d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   struct dd_function_table functions;
1026d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   struct i915_context *i915 =
1036d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane      (struct i915_context *) CALLOC_STRUCT(i915_context);
1046d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   struct intel_context *intel = &i915->intel;
105f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg   struct gl_context *ctx = &intel->ctx;
1066d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
1076d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   if (!i915)
1086d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane      return GL_FALSE;
1096d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
1106d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   i915InitVtbl(i915);
1116d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
1126d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   i915InitDriverFunctions(&functions);
1136d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
1144b69100bdcf26dbb5be4d600b7ca5f5cdf6e8f20Kristian Høgsberg   if (!intelInitContext(intel, api, mesaVis, driContextPriv,
1156d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane                         sharedContextPrivate, &functions)) {
1166d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane      FREE(i915);
1176d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane      return GL_FALSE;
1186d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   }
1196d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
12060953059ea2319eae4d737831824dbce08ee1725Eric Anholt   _math_matrix_ctr(&intel->ViewportMatrix);
12160953059ea2319eae4d737831824dbce08ee1725Eric Anholt
122dd1d66fc4ab5d7064113a2017a431c3461598b91Kristian Høgsberg   /* Initialize swrast, tnl driver tables: */
123dd1d66fc4ab5d7064113a2017a431c3461598b91Kristian Høgsberg   intelInitSpanFuncs(ctx);
124dd1d66fc4ab5d7064113a2017a431c3461598b91Kristian Høgsberg   intelInitTriFuncs(ctx);
125dd1d66fc4ab5d7064113a2017a431c3461598b91Kristian Høgsberg
126dd1d66fc4ab5d7064113a2017a431c3461598b91Kristian Høgsberg   /* Install the customized pipeline: */
127dd1d66fc4ab5d7064113a2017a431c3461598b91Kristian Høgsberg   _tnl_destroy_pipeline(ctx);
128dd1d66fc4ab5d7064113a2017a431c3461598b91Kristian Høgsberg   _tnl_install_pipeline(ctx, intel_pipeline);
129dd1d66fc4ab5d7064113a2017a431c3461598b91Kristian Høgsberg
130f75843a517bd188639e6866db2a7b04de3524e16Dave Airlie   if (intel->no_rast)
131f75843a517bd188639e6866db2a7b04de3524e16Dave Airlie      FALLBACK(intel, INTEL_FALLBACK_USER, 1);
132f75843a517bd188639e6866db2a7b04de3524e16Dave Airlie
1336d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
1346d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.MaxTextureImageUnits = I915_TEX_UNITS;
1356d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.MaxTextureCoordUnits = I915_TEX_UNITS;
136f9f31b25740887373806cb489e5480dc9b261805Eric Anholt   ctx->Const.MaxVarying = I915_TEX_UNITS;
13751e945ec9c0b803f5e998f87449fb02a7c39ae65Eric Anholt   ctx->Const.MaxCombinedTextureImageUnits =
13851e945ec9c0b803f5e998f87449fb02a7c39ae65Eric Anholt      ctx->Const.MaxVertexTextureImageUnits +
13951e945ec9c0b803f5e998f87449fb02a7c39ae65Eric Anholt      ctx->Const.MaxTextureImageUnits;
1406d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
1416d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   /* Advertise the full hardware capabilities.  The new memory
1426d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane    * manager should cope much better with overload situations:
1436d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane    */
1446d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.MaxTextureLevels = 12;
1456d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.Max3DTextureLevels = 9;
1466d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.MaxCubeTextureLevels = 12;
1476d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.MaxTextureRectSize = (1 << 11);
1486d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
1496d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
15050853be894aa3edd1e9271f7d625f319209e340fRoland Scheidegger   ctx->Const.MaxTextureMaxAnisotropy = 4.0;
15150853be894aa3edd1e9271f7d625f319209e340fRoland Scheidegger
1526d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   /* GL_ARB_fragment_program limits - don't think Mesa actually
1536d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane    * validates programs against these, and in any case one ARB
1546d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane    * instruction can translate to more than one HW instruction, so
1556d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane    * we'll still have to check and fallback each time.
1566d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane    */
1576d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.FragmentProgram.MaxNativeTemps = I915_MAX_TEMPORARY;
1586d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.FragmentProgram.MaxNativeAttribs = 11;    /* 8 tex, 2 color, fog */
1596d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.FragmentProgram.MaxNativeParameters = I915_MAX_CONSTANT;
1606d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.FragmentProgram.MaxNativeAluInstructions = I915_MAX_ALU_INSN;
1616d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.FragmentProgram.MaxNativeTexInstructions = I915_MAX_TEX_INSN;
1626d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.FragmentProgram.MaxNativeInstructions = (I915_MAX_ALU_INSN +
1636d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane                                                       I915_MAX_TEX_INSN);
1646d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.FragmentProgram.MaxNativeTexIndirections =
1656d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane      I915_MAX_TEX_INDIRECT;
1666d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */
167eabe12df44a41e97fb5736959e8864ddbd01be14Ian Romanick   ctx->Const.FragmentProgram.MaxEnvParams =
168eabe12df44a41e97fb5736959e8864ddbd01be14Ian Romanick      MIN2(ctx->Const.FragmentProgram.MaxNativeParameters,
169eabe12df44a41e97fb5736959e8864ddbd01be14Ian Romanick	   ctx->Const.FragmentProgram.MaxEnvParams);
1706d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
171790ff232e2607a83e6207d06900a5e3de613d161Ian Romanick   /* i915 stores all values in single-precision floats.  Values aren't set
172790ff232e2607a83e6207d06900a5e3de613d161Ian Romanick    * for other program targets because software is used for those targets.
173790ff232e2607a83e6207d06900a5e3de613d161Ian Romanick    */
1742fb0aebd4a248d2a0725099cd5646253c30c1dc3Ian Romanick   ctx->Const.FragmentProgram.MediumFloat.RangeMin = 127;
1752fb0aebd4a248d2a0725099cd5646253c30c1dc3Ian Romanick   ctx->Const.FragmentProgram.MediumFloat.RangeMax = 127;
1762fb0aebd4a248d2a0725099cd5646253c30c1dc3Ian Romanick   ctx->Const.FragmentProgram.MediumFloat.Precision = 23;
1772fb0aebd4a248d2a0725099cd5646253c30c1dc3Ian Romanick   ctx->Const.FragmentProgram.LowFloat = ctx->Const.FragmentProgram.HighFloat =
1782fb0aebd4a248d2a0725099cd5646253c30c1dc3Ian Romanick      ctx->Const.FragmentProgram.MediumFloat;
1792fb0aebd4a248d2a0725099cd5646253c30c1dc3Ian Romanick   ctx->Const.FragmentProgram.MediumInt.RangeMin = 24;
1802fb0aebd4a248d2a0725099cd5646253c30c1dc3Ian Romanick   ctx->Const.FragmentProgram.MediumInt.RangeMax = 24;
1812fb0aebd4a248d2a0725099cd5646253c30c1dc3Ian Romanick   ctx->Const.FragmentProgram.MediumInt.Precision = 0;
1822fb0aebd4a248d2a0725099cd5646253c30c1dc3Ian Romanick   ctx->Const.FragmentProgram.LowInt = ctx->Const.FragmentProgram.HighInt =
1832fb0aebd4a248d2a0725099cd5646253c30c1dc3Ian Romanick      ctx->Const.FragmentProgram.MediumInt;
184790ff232e2607a83e6207d06900a5e3de613d161Ian Romanick
185064ae479a770bf434958d673baf6f7530f642697Brian Paul   ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
1866d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
1876d3a2c97f4a78e85545286e0e126cd3a27bd1cbdLuca Barbieri   /* FINISHME: Are there other options that should be enabled for software
1886d3a2c97f4a78e85545286e0e126cd3a27bd1cbdLuca Barbieri    * FINISHME: vertex shaders?
1896d3a2c97f4a78e85545286e0e126cd3a27bd1cbdLuca Barbieri    */
1906d3a2c97f4a78e85545286e0e126cd3a27bd1cbdLuca Barbieri   ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitCondCodes = GL_TRUE;
1914c1dc1c4d772b06578567f14419fdd4f27843825Ian Romanick
1924c1dc1c4d772b06578567f14419fdd4f27843825Ian Romanick   struct gl_shader_compiler_options *const fs_options =
1934c1dc1c4d772b06578567f14419fdd4f27843825Ian Romanick      & ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT];
1944c1dc1c4d772b06578567f14419fdd4f27843825Ian Romanick   fs_options->EmitNoIfs = GL_TRUE;
1954c1dc1c4d772b06578567f14419fdd4f27843825Ian Romanick   fs_options->EmitNoNoise = GL_TRUE;
1964c1dc1c4d772b06578567f14419fdd4f27843825Ian Romanick   fs_options->EmitNoPow = GL_TRUE;
1974c1dc1c4d772b06578567f14419fdd4f27843825Ian Romanick   fs_options->EmitNoMainReturn = GL_TRUE;
1984c1dc1c4d772b06578567f14419fdd4f27843825Ian Romanick   fs_options->EmitNoIndirectInput = GL_TRUE;
1994c1dc1c4d772b06578567f14419fdd4f27843825Ian Romanick   fs_options->EmitNoIndirectOutput = GL_TRUE;
2004c1dc1c4d772b06578567f14419fdd4f27843825Ian Romanick   fs_options->EmitNoIndirectUniform = GL_TRUE;
2014c1dc1c4d772b06578567f14419fdd4f27843825Ian Romanick   fs_options->EmitNoIndirectTemp = GL_TRUE;
20295c08920ea3d040360e5cc51d8a852d21a0329eeEric Anholt
2038aa209c766b79144db499063dd1c8482562b07bfIan Romanick   ctx->Const.MaxDrawBuffers = 1;
2048aa209c766b79144db499063dd1c8482562b07bfIan Romanick
2056d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   _tnl_init_vertices(ctx, ctx->Const.MaxArrayLockSize + 12,
2066d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane                      36 * sizeof(GLfloat));
2076d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
2086d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   intel->verts = TNL_CONTEXT(ctx)->clipspace.vertex_buf;
2096d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
2106d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   i915InitState(i915);
2116d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane
2126d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane   return GL_TRUE;
2136d104cb932080c5c0d951fbc0ec6d30fb7ebef45Alan Hourihane}
214