i965/gs: Add GS_OPCODE_SET_DWORD_2_IMMED.
[mesa.git] / src / mesa / drivers / dri / i915 / i915_context.c
index c5e589d8e6e303dc0fbcfa8aaf4a8a556f9d98e8..b82fc9c25e0db4eec6f42728e6e5c7bb7757e6a2 100644 (file)
  **************************************************************************/
 
 #include "i915_context.h"
+#include "main/api_exec.h"
 #include "main/imports.h"
 #include "main/macros.h"
+#include "main/version.h"
+#include "main/vtxfmt.h"
+#include "intel_chipset.h"
 #include "intel_tris.h"
 #include "tnl/t_context.h"
 #include "tnl/t_pipeline.h"
@@ -41,8 +45,6 @@
 #include "i915_reg.h"
 #include "i915_program.h"
 
-#include "intel_span.h"
-
 /***************************************
  * Mesa's Driver Functions
  ***************************************/
@@ -76,6 +78,8 @@ i915InvalidateState(struct gl_context * ctx, GLuint new_state)
        i915_update_provoking_vertex(ctx);
    if (new_state & (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))
        i915_update_program(ctx);
+   if (new_state & (_NEW_PROGRAM | _NEW_POINT))
+       i915_update_sprite_point_enable(ctx);
 }
 
 
@@ -99,6 +103,8 @@ intel_init_texture_formats(struct gl_context *ctx)
    if (intel_screen->deviceID != PCI_CHIP_I830_M &&
        intel_screen->deviceID != PCI_CHIP_845_G)
       ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = true;
+   if (intel->gen == 3)
+      ctx->TextureFormatSupported[MESA_FORMAT_SARGB8] = true;
    ctx->TextureFormatSupported[MESA_FORMAT_ARGB4444] = true;
    ctx->TextureFormatSupported[MESA_FORMAT_ARGB1555] = true;
    ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true;
@@ -110,7 +116,6 @@ intel_init_texture_formats(struct gl_context *ctx)
    /* Depth and stencil */
    ctx->TextureFormatSupported[MESA_FORMAT_S8_Z24] = true;
    ctx->TextureFormatSupported[MESA_FORMAT_X8_Z24] = true;
-   ctx->TextureFormatSupported[MESA_FORMAT_S8] = intel->has_separate_stencil;
 
    /*
     * This was disabled in initial FBO enabling to avoid combinations
@@ -144,6 +149,9 @@ bool
 i915CreateContext(int api,
                  const struct gl_config * mesaVis,
                   __DRIcontext * driContextPriv,
+                  unsigned major_version,
+                  unsigned minor_version,
+                  unsigned *error,
                   void *sharedContextPrivate)
 {
    struct dd_function_table functions;
@@ -151,23 +159,28 @@ i915CreateContext(int api,
    struct intel_context *intel = &i915->intel;
    struct gl_context *ctx = &intel->ctx;
 
-   if (!i915)
+   if (!i915) {
+      *error = __DRI_CTX_ERROR_NO_MEMORY;
       return false;
+   }
 
    i915InitVtbl(i915);
 
    i915InitDriverFunctions(&functions);
 
-   if (!intelInitContext(intel, api, mesaVis, driContextPriv,
-                         sharedContextPrivate, &functions)) {
-      FREE(i915);
+   if (!intelInitContext(intel, api, major_version, minor_version,
+                         mesaVis, driContextPriv,
+                         sharedContextPrivate, &functions,
+                         error)) {
+      ralloc_free(i915);
       return false;
    }
 
+   intel_init_texture_formats(ctx);
+
    _math_matrix_ctr(&intel->ViewportMatrix);
 
    /* Initialize swrast, tnl driver tables: */
-   intelInitSpanFuncs(ctx);
    intelInitTriFuncs(ctx);
 
    /* Install the customized pipeline: */
@@ -178,12 +191,12 @@ i915CreateContext(int api,
       FALLBACK(intel, INTEL_FALLBACK_USER, 1);
 
    ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
-   ctx->Const.MaxTextureImageUnits = I915_TEX_UNITS;
+   ctx->Const.FragmentProgram.MaxTextureImageUnits = I915_TEX_UNITS;
    ctx->Const.MaxTextureCoordUnits = I915_TEX_UNITS;
    ctx->Const.MaxVarying = I915_TEX_UNITS;
    ctx->Const.MaxCombinedTextureImageUnits =
-      ctx->Const.MaxVertexTextureImageUnits +
-      ctx->Const.MaxTextureImageUnits;
+      ctx->Const.VertexProgram.MaxTextureImageUnits +
+      ctx->Const.FragmentProgram.MaxTextureImageUnits;
 
    /* Advertise the full hardware capabilities.  The new memory
     * manager should cope much better with overload situations:
@@ -248,6 +261,7 @@ i915CreateContext(int api,
    fs_options->EmitNoIndirectTemp = true;
 
    ctx->Const.MaxDrawBuffers = 1;
+   ctx->Const.QueryCounterBits.SamplesPassed = 0;
 
    _tnl_init_vertices(ctx, ctx->Const.MaxArrayLockSize + 12,
                       36 * sizeof(GLfloat));
@@ -262,5 +276,10 @@ i915CreateContext(int api,
    _tnl_allow_vertex_fog(ctx, 0);
    _tnl_allow_pixel_fog(ctx, 1);
 
+   _mesa_compute_version(ctx);
+
+   _mesa_initialize_dispatch_tables(ctx);
+   _mesa_initialize_vbo_vtxfmt(ctx);
+
    return true;
 }