diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_context.c | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 9 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_queryobj.c | 8 | ||||
-rw-r--r-- | src/mesa/main/context.c | 13 | ||||
-rw-r--r-- | src/mesa/main/enable.c | 11 | ||||
-rw-r--r-- | src/mesa/main/get.c | 5 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 5 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 1 |
8 files changed, 62 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index f32f3cf6020..474252b640d 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -168,6 +168,20 @@ i915CreateContext(int api, MIN2(ctx->Const.FragmentProgram.MaxNativeParameters, ctx->Const.FragmentProgram.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->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; /* FINISHME: Are there other options that should be enabled for software diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 8fc322fd82e..9483ec69d96 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -151,6 +151,15 @@ GLboolean brwCreateContext( int api, MIN2(ctx->Const.FragmentProgram.MaxNativeParameters, ctx->Const.FragmentProgram.MaxEnvParams); + /* Fragment shaders use real, 32-bit twos-complement integers for all + * integer types. + */ + ctx->Const.FragmentProgram.LowInt.RangeMin = 31; + ctx->Const.FragmentProgram.LowInt.RangeMax = 30; + ctx->Const.FragmentProgram.LowInt.Precision = 0; + ctx->Const.FragmentProgram.HighInt = ctx->Const.FragmentProgram.MediumInt + = ctx->Const.FragmentProgram.LowInt; + /* Gen6 converts quads to polygon in beginning of 3D pipeline, but we're not sure how it's actually done for vertex order, that affect provoking vertex decision. Always use last vertex diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c index a45ca7cad0d..cc395e9eab4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c +++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c @@ -38,7 +38,7 @@ static void radeonQueryGetResult(struct gl_context *ctx, struct gl_query_object radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = (struct radeon_query_object *)q; uint32_t *result; - int i; + int i, max_idx; radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s: query id %d, result %d\n", @@ -56,7 +56,11 @@ static void radeonQueryGetResult(struct gl_context *ctx, struct gl_query_object * hw writes zpass end counts to qwords 1, 3, 5, 7. * then we substract. MSB is the valid bit. */ - for (i = 0; i < 32; i += 4) { + if (radeon->radeonScreen->chip_family >= CHIP_FAMILY_CEDAR) + max_idx = 8 * 4; /* 8 DB's */ + else + max_idx = 4 * 4; /* 4 DB's for r600, r700 */ + for (i = 0; i < max_idx; i += 4) { uint64_t start = (uint64_t)LE32_TO_CPU(result[i]) | (uint64_t)LE32_TO_CPU(result[i + 1]) << 32; uint64_t end = (uint64_t)LE32_TO_CPU(result[i + 2]) | diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index fe370fa369b..e017939a45c 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -534,8 +534,17 @@ init_program_limits(GLenum type, struct gl_program_constants *prog) prog->MediumFloat.RangeMax = 127; prog->MediumFloat.Precision = 23; prog->LowFloat = prog->HighFloat = prog->MediumFloat; - /* assume ints are stored as floats for now */ - prog->LowInt = prog->MediumInt = prog->HighInt = prog->MediumFloat; + + /* Assume ints are stored as floats for now, since this is the least-common + * denominator. The OpenGL ES spec implies (page 132) that the precision + * of integer types should be 0. Practically speaking, IEEE + * single-precision floating point values can only store integers in the + * range [-0x01000000, 0x01000000] without loss of precision. + */ + prog->MediumInt.RangeMin = 24; + prog->MediumInt.RangeMax = 24; + prog->MediumInt.Precision = 0; + prog->LowInt = prog->HighInt = prog->MediumInt; } diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index d047586eb35..c4c4e1bb29d 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -968,6 +968,12 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) } break; + /* GL3.0 - GL_framebuffer_sRGB */ + case GL_FRAMEBUFFER_SRGB_EXT: + CHECK_EXTENSION(EXT_framebuffer_sRGB, cap); + ctx->Color.sRGBEnabled = state; + break; + default: goto invalid_enum_error; } @@ -1480,6 +1486,11 @@ _mesa_IsEnabled( GLenum cap ) } return ctx->Array.PrimitiveRestart; + /* GL3.0 - GL_framebuffer_sRGB */ + case GL_FRAMEBUFFER_SRGB_EXT: + CHECK_EXTENSION(EXT_framebuffer_sRGB); + return ctx->Color.sRGBEnabled; + default: goto invalid_enum_error; } diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index e223cf425ab..fa7aa1121aa 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -317,6 +317,7 @@ EXTRA_EXT2(ARB_vertex_program, ARB_fragment_program); EXTRA_EXT(ARB_vertex_buffer_object); EXTRA_EXT(ARB_geometry_shader4); EXTRA_EXT(ARB_copy_buffer); +EXTRA_EXT(EXT_framebuffer_sRGB); static const int extra_ARB_vertex_program_ARB_fragment_program_NV_vertex_program[] = { @@ -1238,6 +1239,10 @@ static const struct value_desc values[] = { { GL_MINOR_VERSION, CONTEXT_INT(VersionMinor), extra_version_30 }, { GL_CONTEXT_FLAGS, CONTEXT_INT(Const.ContextFlags), extra_version_30 }, + /* GL3.0 / GL_EXT_framebuffer_sRGB */ + { GL_FRAMEBUFFER_SRGB_EXT, CONTEXT_BOOL(Color.sRGBEnabled), extra_EXT_framebuffer_sRGB }, + { GL_FRAMEBUFFER_SRGB_CAPABLE_EXT, BUFFER_INT(Visual.sRGBCapable), extra_EXT_framebuffer_sRGB }, + /* GL 3.1 */ /* NOTE: different enum values for GL_PRIMITIVE_RESTART_NV * vs. GL_PRIMITIVE_RESTART! diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 49dad4d4024..34003b4b6fb 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -524,6 +524,9 @@ struct gl_config GLint bindToMipmapTexture; GLint bindToTextureTargets; GLint yInverted; + + /* EXT_framebuffer_sRGB */ + GLint sRGBCapable; }; @@ -754,6 +757,8 @@ struct gl_colorbuffer_attrib GLenum ClampFragmentColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */ GLenum ClampReadColor; /**< GL_TRUE, GL_FALSE or GL_FIXED_ONLY_ARB */ + + GLboolean sRGBEnabled; /**< Framebuffer sRGB blending/updating requested */ }; diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index e831175235e..a5e90d7cbd1 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -1924,6 +1924,7 @@ _mesa_init_shader_dispatch(struct _glapi_table *exec) /* GL_ARB_ES2_compatibility */ SET_ReleaseShaderCompiler(exec, _mesa_ReleaseShaderCompiler); + SET_GetShaderPrecisionFormat(exec, _mesa_GetShaderPrecisionFormat); #endif /* FEATURE_GL */ } |