/**************************************************************************
*
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2003 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* 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
+ * IN NO EVENT SHALL VMWARE 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 "i915_context.h"
#include "main/api_exec.h"
+#include "main/framebuffer.h"
+#include "main/extensions.h"
#include "main/imports.h"
#include "main/macros.h"
#include "main/version.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
-#include "../glsl/ralloc.h"
+#include "util/ralloc.h"
#include "i915_reg.h"
#include "i915_program.h"
/* Override intel default.
*/
static void
-i915InvalidateState(struct gl_context * ctx, GLuint new_state)
+i915InvalidateState(struct gl_context * ctx)
{
+ GLuint new_state = ctx->NewState;
+
_swrast_InvalidateState(ctx, new_state);
_swsetup_InvalidateState(ctx, new_state);
- _vbo_InvalidateState(ctx, new_state);
_tnl_InvalidateState(ctx, new_state);
_tnl_invalidate_vertex_state(ctx, new_state);
intel_context(ctx)->NewGLState |= new_state;
+ if (new_state & (_NEW_SCISSOR | _NEW_BUFFERS | _NEW_VIEWPORT))
+ _mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
+
/* Todo: gather state values under which tracked parameters become
* invalidated, add callbacks for things like
* ProgramLocalParameters, etc.
struct intel_context *intel = intel_context(ctx);
struct intel_screen *intel_screen = intel->intelScreen;
- ctx->TextureFormatSupported[MESA_FORMAT_ARGB8888] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_B8G8R8A8_UNORM] = 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_B8G8R8X8_UNORM] = true;
+ if (intel->gen == 3)
+ ctx->TextureFormatSupported[MESA_FORMAT_B8G8R8A8_SRGB] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_B4G4R4A4_UNORM] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_B5G5R5A1_UNORM] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_B5G6R5_UNORM] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_L_UNORM8] = 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;
- ctx->TextureFormatSupported[MESA_FORMAT_L8] = true;
- ctx->TextureFormatSupported[MESA_FORMAT_A8] = true;
- ctx->TextureFormatSupported[MESA_FORMAT_I8] = true;
- ctx->TextureFormatSupported[MESA_FORMAT_AL88] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_A_UNORM8] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_I_UNORM8] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_L8A8_UNORM] = true;
/* Depth and stencil */
- ctx->TextureFormatSupported[MESA_FORMAT_S8_Z24] = true;
- ctx->TextureFormatSupported[MESA_FORMAT_X8_Z24] = true;
-
- /*
- * 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;
- */
+ if (intel->gen == 3) {
+ ctx->TextureFormatSupported[MESA_FORMAT_Z24_UNORM_S8_UINT] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_Z24_UNORM_X8_UINT] = true;
+
+ /*
+ * 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_Z_UNORM16] = true;
+ ctx->TextureFormatSupported[MESA_FORMAT_Z24] = true;
+ */
+ }
/* ctx->Extensions.MESA_ycbcr_texture */
ctx->TextureFormatSupported[MESA_FORMAT_YCBCR] = true;
__DRIcontext * driContextPriv,
unsigned major_version,
unsigned minor_version,
+ uint32_t flags,
unsigned *error,
void *sharedContextPrivate)
{
i915InitDriverFunctions(&functions);
- if (!intelInitContext(intel, api, major_version, minor_version,
+ if (!intelInitContext(intel, api, major_version, minor_version, flags,
mesaVis, driContextPriv,
sharedContextPrivate, &functions,
error)) {
FALLBACK(intel, INTEL_FALLBACK_USER, 1);
ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
- ctx->Const.FragmentProgram.MaxTextureImageUnits = I915_TEX_UNITS;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = I915_TEX_UNITS;
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = I915_TEX_UNITS;
ctx->Const.MaxTextureCoordUnits = I915_TEX_UNITS;
ctx->Const.MaxVarying = I915_TEX_UNITS;
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxOutputComponents =
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents = ctx->Const.MaxVarying * 4;
ctx->Const.MaxCombinedTextureImageUnits =
- ctx->Const.VertexProgram.MaxTextureImageUnits +
- ctx->Const.FragmentProgram.MaxTextureImageUnits;
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits +
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits;
/* Advertise the full hardware capabilities. The new memory
* manager should cope much better with overload situations:
* instruction can translate to more than one HW instruction, so
* we'll still have to check and fallback each time.
*/
- ctx->Const.FragmentProgram.MaxNativeTemps = I915_MAX_TEMPORARY;
- ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* 8 tex, 2 color, fog */
- ctx->Const.FragmentProgram.MaxNativeParameters = I915_MAX_CONSTANT;
- ctx->Const.FragmentProgram.MaxNativeAluInstructions = I915_MAX_ALU_INSN;
- ctx->Const.FragmentProgram.MaxNativeTexInstructions = I915_MAX_TEX_INSN;
- ctx->Const.FragmentProgram.MaxNativeInstructions = (I915_MAX_ALU_INSN +
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeTemps = I915_MAX_TEMPORARY;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeAttribs = 11; /* 8 tex, 2 color, fog */
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeParameters = I915_MAX_CONSTANT;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeAluInstructions = I915_MAX_ALU_INSN;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeTexInstructions = I915_MAX_TEX_INSN;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeInstructions = (I915_MAX_ALU_INSN +
I915_MAX_TEX_INSN);
- ctx->Const.FragmentProgram.MaxNativeTexIndirections =
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeTexIndirections =
I915_MAX_TEX_INDIRECT;
- ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* I don't think we have one */
- ctx->Const.FragmentProgram.MaxEnvParams =
- MIN2(ctx->Const.FragmentProgram.MaxNativeParameters,
- ctx->Const.FragmentProgram.MaxEnvParams);
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeAddressRegs = 0; /* I don't think we have one */
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxEnvParams =
+ MIN2(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxNativeParameters,
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxEnvParams);
/* 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->Const.Program[MESA_SHADER_FRAGMENT].MediumFloat.RangeMin = 127;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumFloat.RangeMax = 127;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumFloat.Precision = 23;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].LowFloat = ctx->Const.Program[MESA_SHADER_FRAGMENT].HighFloat =
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumFloat;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumInt.RangeMin = 24;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumInt.RangeMax = 24;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MediumInt.Precision = 0;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].LowInt = ctx->Const.Program[MESA_SHADER_FRAGMENT].HighInt =
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].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;
+ ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitNoIndirectSampler =
+ true;
struct gl_shader_compiler_options *const fs_options =
- & ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT];
+ & ctx->Const.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;
+ fs_options->EmitNoIndirectSampler = true;
ctx->Const.MaxDrawBuffers = 1;
ctx->Const.QueryCounterBits.SamplesPassed = 0;
_tnl_allow_vertex_fog(ctx, 0);
_tnl_allow_pixel_fog(ctx, 1);
+ _mesa_override_extensions(ctx);
_mesa_compute_version(ctx);
_mesa_initialize_dispatch_tables(ctx);