#include "i915_context.h"
#include "main/imports.h"
#include "main/macros.h"
-#include "intel_tex.h"
#include "intel_tris.h"
#include "tnl/t_context.h"
#include "tnl/t_pipeline.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
+#include "../glsl/ralloc.h"
-#include "utils.h"
#include "i915_reg.h"
#include "i915_program.h"
-#include "intel_regions.h"
-#include "intel_batchbuffer.h"
-#include "intel_tris.h"
#include "intel_span.h"
-#include "intel_pixel.h"
/***************************************
* Mesa's Driver Functions
/* Override intel default.
*/
static void
-i915InvalidateState(GLcontext * ctx, GLuint new_state)
+i915InvalidateState(struct gl_context * ctx, GLuint new_state)
{
_swrast_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
p->params_uptodate = 0;
}
- if (new_state & (_NEW_FOG | _NEW_HINT | _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS))
- i915_update_fog(ctx);
if (new_state & (_NEW_STENCIL | _NEW_BUFFERS | _NEW_POLYGON))
i915_update_stencil(ctx);
if (new_state & (_NEW_LIGHT))
functions->UpdateState = i915InvalidateState;
}
+/* Note: this is shared with i830. */
+void
+intel_init_texture_formats(struct gl_context *ctx)
+{
+ struct intel_context *intel = intel_context(ctx);
+ struct intel_screen *intel_screen = intel->intelScreen;
+
+ ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = true;
+ if (intel_screen->deviceID != PCI_CHIP_I830_M &&
+ intel_screen->deviceID != PCI_CHIP_845_G)
+ ctx->TextureFormatSupported[MESA_FORMAT_XRGB8888] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_ARGB4444] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_ARGB1555] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_RGB565] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_L8] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_A8] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_I8] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_AL88] = true;
+
+ /* 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
+ * of depth+stencil that wouldn't work together. We since decided
+ * that it was OK, since it's up to the app to come up with the
+ * combo that actually works, so this can probably be re-enabled.
+ */
+ /*
+ ctx->TextureFormatSupported[MESA_FORMAT_Z16] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_Z24] = true;
+ */
+
+ /* ctx->Extensions.MESA_ycbcr_texture */
+ ctx->TextureFormatSupported[MESA_FORMAT_YCBCR] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_YCBCR_REV] = true;
+
+ /* GL_3DFX_texture_compression_FXT1 */
+ ctx->TextureFormatSupported[MESA_FORMAT_RGB_FXT1] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_RGBA_FXT1] = true;
+
+ /* GL_EXT_texture_compression_s3tc */
+ ctx->TextureFormatSupported[MESA_FORMAT_RGB_DXT1] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_RGBA_DXT1] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_RGBA_DXT3] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_RGBA_DXT5] = true;
+}
extern const struct tnl_pipeline_stage *intel_pipeline[];
-GLboolean
-i915CreateContext(const __GLcontextModes * mesaVis,
+bool
+i915CreateContext(int api,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
struct dd_function_table functions;
- struct i915_context *i915 =
- (struct i915_context *) CALLOC_STRUCT(i915_context);
+ struct i915_context *i915 = rzalloc(NULL, struct i915_context);
struct intel_context *intel = &i915->intel;
- GLcontext *ctx = &intel->ctx;
+ struct gl_context *ctx = &intel->ctx;
if (!i915)
- return GL_FALSE;
-
- if (0)
- _mesa_printf("\ntexmem-0-3 branch\n\n");
+ return false;
i915InitVtbl(i915);
- i915InitMetaFuncs(i915);
i915InitDriverFunctions(&functions);
- if (!intelInitContext(intel, mesaVis, driContextPriv,
+ if (!intelInitContext(intel, api, mesaVis, driContextPriv,
sharedContextPrivate, &functions)) {
FREE(i915);
- return GL_FALSE;
+ return false;
}
+ intel_init_texture_formats(ctx);
+
_math_matrix_ctr(&intel->ViewportMatrix);
/* Initialize swrast, tnl driver tables: */
MIN2(ctx->Const.FragmentProgram.MaxNativeParameters,
ctx->Const.FragmentProgram.MaxEnvParams);
- ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
+ /* i915 stores all values in single-precision floats. Values aren't set
+ * for other program targets because software is used for those targets.
+ */
+ ctx->Const.FragmentProgram.MediumFloat.RangeMin = 127;
+ ctx->Const.FragmentProgram.MediumFloat.RangeMax = 127;
+ ctx->Const.FragmentProgram.MediumFloat.Precision = 23;
+ ctx->Const.FragmentProgram.LowFloat = ctx->Const.FragmentProgram.HighFloat =
+ ctx->Const.FragmentProgram.MediumFloat;
+ ctx->Const.FragmentProgram.MediumInt.RangeMin = 24;
+ ctx->Const.FragmentProgram.MediumInt.RangeMax = 24;
+ ctx->Const.FragmentProgram.MediumInt.Precision = 0;
+ ctx->Const.FragmentProgram.LowInt = ctx->Const.FragmentProgram.HighInt =
+ ctx->Const.FragmentProgram.MediumInt;
+
+ ctx->FragmentProgram._MaintainTexEnvProgram = true;
+
+ /* FINISHME: Are there other options that should be enabled for software
+ * FINISHME: vertex shaders?
+ */
+ ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitCondCodes = true;
+
+ struct gl_shader_compiler_options *const fs_options =
+ & ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT];
+ fs_options->MaxIfDepth = 0;
+ fs_options->EmitNoNoise = true;
+ fs_options->EmitNoPow = true;
+ fs_options->EmitNoMainReturn = true;
+ fs_options->EmitNoIndirectInput = true;
+ fs_options->EmitNoIndirectOutput = true;
+ fs_options->EmitNoIndirectUniform = true;
+ fs_options->EmitNoIndirectTemp = true;
ctx->Const.MaxDrawBuffers = 1;
i915InitState(i915);
- return GL_TRUE;
+ /* Always enable pixel fog. Vertex fog using fog coord will conflict
+ * with fog code appended onto fragment program.
+ */
+ _tnl_allow_vertex_fog(ctx, 0);
+ _tnl_allow_pixel_fog(ctx, 1);
+
+ return true;
}