* \author Nicolai Haehnle <prefect_@gmx.net>
*/
+#include <stdbool.h>
#include "main/glheader.h"
#include "main/api_arrayelt.h"
#include "main/context.h"
#include "main/simple_list.h"
#include "main/imports.h"
-#include "main/matrix.h"
#include "main/extensions.h"
-#include "main/state.h"
#include "main/bufferobj.h"
#include "main/texobj.h"
+#include "main/mfeatures.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
-#include "tnl/t_vp_build.h"
#include "drivers/common/driverfuncs.h"
#include "drivers/common/meta.h"
#include "r300_context.h"
-#include "radeon_context.h"
#include "radeon_span.h"
#include "r300_blit.h"
#include "r300_cmdbuf.h"
#include "r300_state.h"
#include "r300_tex.h"
#include "r300_emit.h"
+#include "r300_render.h"
#include "r300_swtcl.h"
#include "radeon_bocs_wrapper.h"
#include "radeon_buffer_objects.h"
#include "radeon_queryobj.h"
-#include "vblank.h"
#include "utils.h"
#include "xmlpool.h" /* for symbolic values of enum-type options */
-#define need_GL_VERSION_2_0
-#define need_GL_ARB_occlusion_query
-#define need_GL_ARB_point_parameters
-#define need_GL_ARB_vertex_program
-#define need_GL_EXT_blend_equation_separate
-#define need_GL_EXT_blend_func_separate
-#define need_GL_EXT_blend_minmax
-#define need_GL_EXT_framebuffer_blit
-#define need_GL_EXT_framebuffer_object
-#define need_GL_EXT_fog_coord
-#define need_GL_EXT_gpu_program_parameters
-#define need_GL_EXT_provoking_vertex
-#define need_GL_EXT_secondary_color
-#define need_GL_EXT_stencil_two_side
-#define need_GL_ATI_separate_stencil
-#define need_GL_NV_vertex_program
-
-#include "main/remap_helper.h"
-
-static const struct dri_extension card_extensions[] = {
- /* *INDENT-OFF* */
- {"GL_ARB_depth_texture", NULL},
- {"GL_ARB_fragment_program", NULL},
- {"GL_ARB_half_float_vertex", NULL},
- {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions},
- {"GL_ARB_multitexture", NULL},
- {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
- {"GL_ARB_shadow", NULL},
- {"GL_ARB_shadow_ambient", NULL},
- {"GL_ARB_texture_border_clamp", NULL},
- {"GL_ARB_texture_cube_map", NULL},
- {"GL_ARB_texture_env_add", NULL},
- {"GL_ARB_texture_env_combine", NULL},
- {"GL_ARB_texture_env_crossbar", NULL},
- {"GL_ARB_texture_env_dot3", NULL},
- {"GL_ARB_texture_mirrored_repeat", NULL},
- {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
- {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
- {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
- {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
- {"GL_EXT_blend_subtract", NULL},
- {"GL_EXT_packed_depth_stencil", NULL},
- {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
- {"GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions},
- {"GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions },
- {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
- {"GL_EXT_shadow_funcs", NULL},
- {"GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions},
- {"GL_EXT_stencil_wrap", NULL},
- {"GL_EXT_texture_edge_clamp", NULL},
- {"GL_EXT_texture_env_combine", NULL},
- {"GL_EXT_texture_env_dot3", NULL},
- {"GL_EXT_texture_filter_anisotropic", NULL},
- {"GL_EXT_texture_lod_bias", NULL},
- {"GL_EXT_texture_mirror_clamp", NULL},
- {"GL_EXT_texture_rectangle", NULL},
- {"GL_EXT_texture_sRGB", NULL},
- {"GL_EXT_vertex_array_bgra", NULL},
- {"GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions},
- {"GL_ATI_texture_env_combine3", NULL},
- {"GL_ATI_texture_mirror_once", NULL},
- {"GL_MESA_pack_invert", NULL},
- {"GL_MESA_ycbcr_texture", NULL},
- {"GL_MESAX_texture_float", NULL},
- {"GL_NV_blend_square", NULL},
- {"GL_NV_vertex_program", GL_NV_vertex_program_functions},
- {"GL_SGIS_generate_mipmap", NULL},
- {NULL, NULL}
- /* *INDENT-ON* */
-};
-
-
-static const struct dri_extension mm_extensions[] = {
- { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions },
- { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
- { NULL, NULL }
-};
-
-/**
- * The GL 2.0 functions are needed to make display lists work with
- * functions added by GL_ATI_separate_stencil.
- */
-static const struct dri_extension gl_20_extension[] = {
- {"GL_VERSION_2_0", GL_VERSION_2_0_functions },
-};
static const struct tnl_pipeline_stage *r300_pipeline[] = {
/* Catch any t&l fallbacks
end_3d(radeon);
}
-static void r300_fallback(GLcontext *ctx, GLuint bit, GLboolean mode)
+static void r300_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
if (mode)
r300->radeon.Fallback |= bit;
else
r300->radeon.Fallback &= ~bit;
+
+ r300SwitchFallback(ctx, R300_FALLBACK_RADEON_COMMON, mode);
}
static void r300_emit_query_finish(radeonContextPtr radeon)
} else
radeon->vtbl.emit_query_finish = r300_emit_query_finish;
- radeon->vtbl.blit = r300_blit;
+ radeon->vtbl.check_blit = r300_check_blit;
+ radeon->vtbl.blit = r300_blit;
+
+ if (radeon->radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
+ radeon->vtbl.is_format_renderable = r500IsFormatRenderable;
+ } else {
+ radeon->vtbl.is_format_renderable = r300IsFormatRenderable;
+ }
}
-static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
+static void r300InitConstValues(struct gl_context *ctx, radeonScreenPtr screen)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
driQueryOptioni(&r300->radeon.optionCache, "texture_coord_units");
ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureImageUnits,
ctx->Const.MaxTextureCoordUnits);
+ ctx->Const.MaxCombinedTextureImageUnits =
+ ctx->Const.MaxVertexTextureImageUnits +
+ ctx->Const.MaxTextureImageUnits;
+
ctx->Const.MaxTextureMaxAnisotropy = 16.0;
ctx->Const.MaxTextureLodBias = 16.0;
ctx->Const.MaxTextureLevels = 13;
ctx->Const.MaxCubeTextureLevels = 13;
ctx->Const.MaxTextureRectSize = 4096;
+ ctx->Const.MaxRenderbufferSize = 4096;
}
else {
ctx->Const.MaxTextureLevels = 12;
ctx->Const.MaxCubeTextureLevels = 12;
ctx->Const.MaxTextureRectSize = 2048;
+ ctx->Const.MaxRenderbufferSize = 2048;
}
ctx->Const.MinPointSize = 1.0;
ctx->Const.MaxLineWidthAA = R300_LINESIZE_MAX;
ctx->Const.MaxDrawBuffers = 1;
+ ctx->Const.MaxColorAttachments = 1;
- /* currently bogus data */
if (r300->options.hw_tcl_enabled) {
- ctx->Const.VertexProgram.MaxNativeInstructions = VSF_MAX_FRAGMENT_LENGTH / 4;
- ctx->Const.VertexProgram.MaxNativeAluInstructions = VSF_MAX_FRAGMENT_LENGTH / 4;
- ctx->Const.VertexProgram.MaxNativeAttribs = 16; /* r420 */
+ ctx->Const.VertexProgram.MaxNativeInstructions = 255;
+ ctx->Const.VertexProgram.MaxNativeAluInstructions = 255;
+ ctx->Const.VertexProgram.MaxNativeAttribs = 16;
ctx->Const.VertexProgram.MaxNativeTemps = 32;
- ctx->Const.VertexProgram.MaxNativeParameters = 256; /* r420 */
+ ctx->Const.VertexProgram.MaxNativeParameters = 256;
ctx->Const.VertexProgram.MaxNativeAddressRegs = 1;
}
r300->options = options;
}
-static void r300InitGLExtensions(GLcontext *ctx)
+static void r300InitGLExtensions(struct gl_context *ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
- driInitExtensions(ctx, card_extensions, GL_TRUE);
- if (r300->radeon.radeonScreen->kernel_mm)
- driInitExtensions(ctx, mm_extensions, GL_FALSE);
+ ctx->Extensions.ARB_depth_texture = true;
+ ctx->Extensions.ARB_fragment_program = true;
+ ctx->Extensions.ARB_shadow = true;
+ ctx->Extensions.ARB_shadow_ambient = true;
+ ctx->Extensions.ARB_texture_border_clamp = true;
+ ctx->Extensions.ARB_texture_cube_map = true;
+ ctx->Extensions.ARB_texture_env_combine = true;
+ ctx->Extensions.ARB_texture_env_crossbar = true;
+ ctx->Extensions.ARB_texture_env_dot3 = true;
+ ctx->Extensions.ARB_vertex_program = true;
+ ctx->Extensions.EXT_blend_color = true;
+ ctx->Extensions.EXT_blend_equation_separate = true;
+ ctx->Extensions.EXT_blend_func_separate = true;
+ ctx->Extensions.EXT_blend_minmax = true;
+ ctx->Extensions.EXT_fog_coord = true;
+ ctx->Extensions.EXT_gpu_program_parameters = true;
+ ctx->Extensions.EXT_point_parameters = true;
+ ctx->Extensions.EXT_provoking_vertex = true;
+ ctx->Extensions.EXT_secondary_color = true;
+ ctx->Extensions.EXT_shadow_funcs = true;
+ ctx->Extensions.EXT_texture_env_dot3 = true;
+ ctx->Extensions.EXT_texture_filter_anisotropic = true;
+ ctx->Extensions.EXT_texture_mirror_clamp = true;
+ ctx->Extensions.EXT_texture_sRGB = true;
+ ctx->Extensions.EXT_vertex_array_bgra = true;
+ ctx->Extensions.ATI_separate_stencil = true;
+ ctx->Extensions.ATI_texture_env_combine3 = true;
+ ctx->Extensions.ATI_texture_mirror_once = true;
+ ctx->Extensions.MESA_pack_invert = true;
+ ctx->Extensions.MESA_ycbcr_texture = true;
+ ctx->Extensions.NV_blend_square = true;
+ ctx->Extensions.NV_texture_rectangle = true;
+ ctx->Extensions.NV_vertex_program = true;
+#if FEATURE_OES_EGL_image
+ ctx->Extensions.OES_EGL_image = true;
+#endif
+
+ if (r300->radeon.radeonScreen->kernel_mm) {
+ ctx->Extensions.EXT_framebuffer_blit = true;
+ ctx->Extensions.EXT_framebuffer_object = true;
+ }
- if (r300->options.stencil_two_side_disabled)
- _mesa_disable_extension(ctx, "GL_EXT_stencil_two_side");
+ ctx->Extensions.EXT_stencil_two_side =
+ !r300->options.stencil_two_side_disabled;
if (r300->options.s3tc_force_disabled) {
- _mesa_disable_extension(ctx, "GL_EXT_texture_compression_s3tc");
+ ctx->Extensions.EXT_texture_compression_s3tc = false;
} else if (ctx->Mesa_DXTn || r300->options.s3tc_force_enabled) {
- _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
- _mesa_enable_extension(ctx, "GL_S3_s3tc");
+ ctx->Extensions.EXT_texture_compression_s3tc = true;
+ ctx->Extensions.S3_s3tc = true;
}
- if (!r300->radeon.radeonScreen->drmSupportsOcclusionQueries) {
- _mesa_disable_extension(ctx, "GL_ARB_occlusion_query");
- }
+ ctx->Extensions.ARB_occlusion_query =
+ r300->radeon.radeonScreen->drmSupportsOcclusionQueries;
+
+ ctx->Extensions.ARB_half_float_vertex =
+ (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_R420);
+
+ ctx->Extensions.EXT_packed_depth_stencil =
+ (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515);
}
static void r300InitIoctlFuncs(struct dd_function_table *functions)
/* Create the device specific rendering context.
*/
-GLboolean r300CreateContext(const __GLcontextModes * glVisual,
+GLboolean r300CreateContext(gl_api api,
+ const struct gl_config * glVisual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
struct dd_function_table functions;
r300ContextPtr r300;
- GLcontext *ctx;
+ struct gl_context *ctx;
assert(glVisual);
assert(driContextPriv);
_mesa_init_driver_functions(&functions);
r300InitIoctlFuncs(&functions);
- r300InitStateFuncs(&functions);
+ r300InitStateFuncs(&r300->radeon, &functions);
r300InitTextureFuncs(&r300->radeon, &functions);
r300InitShaderFuncs(&functions);
radeonInitQueryObjFunctions(&functions);