aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2015-06-03 23:03:29 -0700
committerKristian Høgsberg Kristensen <[email protected]>2015-06-08 08:51:40 -0700
commit9eab70e54f40a13f55b29974ca7f765c1164f1be (patch)
treef9f8fd5bd7ac98db08a3688619b7d39f759f645a /src/mesa/drivers/dri
parentce00233c137f272263f28e531cb70eb68250f5ca (diff)
vk: Create a minimal context for the compiler
This avoids the full brw context initialization and just sets up context constants, initializes extensions and sets a few driver vfuncs for the front-end GLSL compiler.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h3
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c2
-rw-r--r--src/mesa/drivers/dri/i965/intel_extensions.c18
4 files changed, 19 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index e01a7dbabee..23838056690 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -310,7 +310,7 @@ brw_init_driver_functions(struct brw_context *brw,
functions->GetSamplePosition = gen6_get_sample_position;
}
-static void
+void
brw_initialize_context_constants(struct brw_context *brw)
{
struct gl_context *ctx = &brw->ctx;
@@ -389,7 +389,8 @@ brw_initialize_context_constants(struct brw_context *brw)
int max_samples;
const int *msaa_modes = intel_supported_msaa_modes(brw->intelScreen);
const int clamp_max_samples =
- driQueryOptioni(&brw->optionCache, "clamp_max_samples");
+ brw->optionCache.info != NULL ?
+ driQueryOptioni(&brw->optionCache, "clamp_max_samples") : -1;
if (clamp_max_samples < 0) {
max_samples = msaa_modes[0];
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 5a35e48a481..cb4cc7fb36b 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1988,6 +1988,9 @@ void intel_screen_destroy(struct intel_screen *screen);
struct brw_context *intel_context_create(struct intel_screen *screen);
void intel_context_destroy(struct brw_context *brw);
+void
+brw_initialize_context_constants(struct brw_context *brw);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index e5c0d3c7604..b056fbfc427 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -275,7 +275,7 @@ brw_get_scratch_bo(struct brw_context *brw,
void brwInitFragProgFuncs( struct dd_function_table *functions )
{
- assert(functions->ProgramStringNotify == _tnl_program_string);
+ /* assert(functions->ProgramStringNotify == _tnl_program_string); */
functions->NewProgram = brwNewProgram;
functions->DeleteProgram = brwDeleteProgram;
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index c3eee31d017..d6da34c7065 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -275,9 +275,11 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.EXT_shader_integer_mix = ctx->Const.GLSLVersion >= 130;
ctx->Extensions.EXT_timer_query = true;
- if (brw->gen == 5 || can_write_oacontrol(brw)) {
- ctx->Extensions.AMD_performance_monitor = true;
- ctx->Extensions.INTEL_performance_query = true;
+ if (brw->bufmgr) {
+ if (brw->gen == 5 || can_write_oacontrol(brw)) {
+ ctx->Extensions.AMD_performance_monitor = true;
+ ctx->Extensions.INTEL_performance_query = true;
+ }
}
}
@@ -285,6 +287,7 @@ intelInitExtensions(struct gl_context *ctx)
uint64_t dummy;
ctx->Extensions.ARB_blend_func_extended =
+ brw->optionCache.info == NULL ||
!driQueryOptionb(&brw->optionCache, "disable_blend_func_extended");
ctx->Extensions.ARB_conditional_render_inverted = true;
ctx->Extensions.ARB_draw_buffers_blend = true;
@@ -308,7 +311,7 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.OES_depth_texture_cube_map = true;
/* Test if the kernel has the ioctl. */
- if (drm_intel_reg_read(brw->bufmgr, TIMESTAMP, &dummy) == 0)
+ if (brw->bufmgr && drm_intel_reg_read(brw->bufmgr, TIMESTAMP, &dummy) == 0)
ctx->Extensions.ARB_timer_query = true;
/* Only enable this in core profile because other parts of Mesa behave
@@ -328,7 +331,8 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.ARB_texture_compression_bptc = true;
ctx->Extensions.ARB_texture_view = true;
- if (can_do_pipelined_register_writes(brw)) {
+ if (brw->bufmgr &&
+ can_do_pipelined_register_writes(brw)) {
ctx->Extensions.ARB_draw_indirect = true;
ctx->Extensions.ARB_transform_feedback2 = true;
ctx->Extensions.ARB_transform_feedback3 = true;
@@ -353,7 +357,9 @@ intelInitExtensions(struct gl_context *ctx)
if (ctx->API != API_OPENGL_CORE)
ctx->Extensions.ARB_color_buffer_float = true;
- if (ctx->Mesa_DXTn || driQueryOptionb(&brw->optionCache, "force_s3tc_enable"))
+ if (ctx->Mesa_DXTn ||
+ (brw->optionCache.info != NULL &&
+ driQueryOptionb(&brw->optionCache, "force_s3tc_enable")))
ctx->Extensions.EXT_texture_compression_s3tc = true;
ctx->Extensions.ANGLE_texture_compression_dxt = true;