summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2015-10-08 12:25:34 -0700
committerKristian Høgsberg Kristensen <[email protected]>2015-10-08 17:20:24 -0700
commitfc2a66cfcddea34af0e93dd2221ae1fd3fdd9e87 (patch)
tree3aa60e04c953b6f25e019cfef00aecb9c11bc4fa /src/mesa
parent48a87f4ba062e572a66f546997366d8896a4ecd1 (diff)
parentc71f0d45e6d0081ea814fb0b16baec4e75a07bcb (diff)
Merge ../mesa into vulkan
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/common/driverfuncs.c42
-rw-r--r--src/mesa/drivers/common/meta_generate_mipmap.c3
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c3
-rw-r--r--src/mesa/drivers/dri/common/utils.c30
-rw-r--r--src/mesa/drivers/dri/common/utils.h8
-rw-r--r--src/mesa/drivers/dri/i915/i830_state.c2
-rw-r--r--src/mesa/drivers/dri/i915/i915_vtbl.c1
-rw-r--r--src/mesa/drivers/dri/i915/intel_buffers.c28
-rw-r--r--src/mesa/drivers/dri/i915/intel_buffers.h1
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.c21
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.h16
-rw-r--r--src/mesa/drivers/dri/i915/intel_fbo.c14
-rw-r--r--src/mesa/drivers/dri/i915/intel_pixel.c1
-rw-r--r--src/mesa/drivers/dri/i915/intel_render.c64
-rw-r--r--src/mesa/drivers/dri/i915/intel_state.c1
-rw-r--r--src/mesa/drivers/dri/i915/intel_tris.c81
-rw-r--r--src/mesa/drivers/dri/i965/Makefile.am22
-rw-r--r--src/mesa/drivers/dri/i965/Makefile.sources153
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip.c1
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip.h1
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip_unfilled.c14
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c33
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h22
-rw-r--r--src/mesa/drivers/dri/i965/brw_cs.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_cs.h6
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c51
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp115
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp21
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs.c54
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs.h18
-rw-r--r--src/mesa/drivers/dri/i965/brw_inst.h6
-rw-r--r--src/mesa/drivers/dri/i965/brw_link.cpp280
-rw-r--r--src/mesa/drivers/dri/i965/brw_misc_state.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_nir.c13
-rw-r--r--src/mesa/drivers/dri/i965/brw_predicated_break.cpp (renamed from src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp)39
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c22
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.cpp287
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.h8
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.cpp17
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.h10
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp58
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp22
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h4
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp14
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c34
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.h6
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c13
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.h10
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_state.c11
-rw-r--r--src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp30
-rw-r--r--src/mesa/drivers/dri/i965/gen6_gs_visitor.h9
-rw-r--r--src/mesa/drivers/dri/i965/gen7_cs_state.c80
-rw-r--r--src/mesa/drivers/dri/i965/intel_blit.c1
-rw-r--r--src/mesa/drivers/dri/i965/intel_buffers.c24
-rw-r--r--src/mesa/drivers/dri/i965/intel_buffers.h5
-rw-r--r--src/mesa/drivers/dri/i965/intel_debug.c19
-rw-r--r--src/mesa/drivers/dri/i965/intel_debug.h4
-rw-r--r--src/mesa/drivers/dri/i965/intel_extensions.c2
-rw-r--r--src/mesa/drivers/dri/i965/intel_fbo.c14
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c28
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.h6
-rw-r--r--src/mesa/drivers/dri/i965/intel_pixel.c1
-rw-r--r--src/mesa/drivers/dri/i965/intel_screen.c14
-rw-r--r--src/mesa/drivers/dri/i965/intel_state.c1
-rw-r--r--src/mesa/drivers/dri/r200/r200_context.h1
-rw-r--r--src/mesa/drivers/dri/r200/r200_maos_arrays.c1
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_state_init.c1
-rw-r--r--src/mesa/drivers/dri/r200/r200_swtcl.c1
-rw-r--r--src/mesa/drivers/dri/r200/r200_tcl.c1
-rw-r--r--src/mesa/drivers/dri/r200/r200_tex.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_context.h1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_debug.c6
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_fbo.c7
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_swtcl.c41
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tex.c1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texstate.c1
-rw-r--r--src/mesa/main/arrayobj.c15
-rw-r--r--src/mesa/main/blend.c14
-rw-r--r--src/mesa/main/context.h5
-rw-r--r--src/mesa/main/dd.h98
-rw-r--r--src/mesa/main/dlist.c17
-rw-r--r--src/mesa/main/ff_fragment_shader.cpp3
-rw-r--r--src/mesa/main/framebuffer.c22
-rw-r--r--src/mesa/main/framebuffer.h6
-rw-r--r--src/mesa/main/get_hash_params.py18
-rw-r--r--src/mesa/main/glformats.c21
-rw-r--r--src/mesa/main/hint.c5
-rw-r--r--src/mesa/main/pack.c4
-rw-r--r--src/mesa/main/samplerobj.c56
-rw-r--r--src/mesa/main/shader_query.cpp2
-rw-r--r--src/mesa/main/shaderapi.c4
-rw-r--r--src/mesa/main/shaderimage.c9
-rw-r--r--src/mesa/main/shaderobj.c21
-rw-r--r--src/mesa/main/shaderobj.h9
-rw-r--r--src/mesa/main/shared.c4
-rw-r--r--src/mesa/main/streaming-load-memcpy.c3
-rw-r--r--src/mesa/main/tests/dispatch_sanity.cpp25
-rw-r--r--src/mesa/main/uniform_query.cpp8
-rw-r--r--src/mesa/main/varray.c2
-rw-r--r--src/mesa/program/ir_to_mesa.cpp5
-rw-r--r--src/mesa/program/sampler.cpp4
-rw-r--r--src/mesa/state_tracker/st_atom_rasterizer.c8
-rw-r--r--src/mesa/state_tracker/st_atom_shader.c9
-rw-r--r--src/mesa/state_tracker/st_cb_bufferobjects.c4
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c13
-rw-r--r--src/mesa/state_tracker/st_context.c4
-rw-r--r--src/mesa/state_tracker/st_context.h1
-rw-r--r--src/mesa/state_tracker/st_program.c24
-rw-r--r--src/mesa/tnl_dd/t_dd_dmatmp.h76
-rw-r--r--src/mesa/vbo/vbo.h8
-rw-r--r--src/mesa/vbo/vbo_exec.c2
-rw-r--r--src/mesa/vbo/vbo_exec.h1
-rw-r--r--src/mesa/vbo/vbo_exec_api.c13
-rw-r--r--src/mesa/vbo/vbo_save.c13
-rw-r--r--src/mesa/vbo/vbo_save.h7
-rw-r--r--src/mesa/vbo/vbo_save_api.c7
120 files changed, 1150 insertions, 1428 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 6fe42b1775c..3d1fccb3ab4 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -75,14 +75,12 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->GetString = NULL; /* REQUIRED! */
driver->UpdateState = NULL; /* REQUIRED! */
- driver->ResizeBuffers = _mesa_resize_framebuffer;
driver->Finish = NULL;
driver->Flush = NULL;
/* framebuffer/image functions */
driver->Clear = _swrast_Clear;
- driver->Accum = _mesa_accum;
driver->RasterPos = _tnl_RasterPos;
driver->DrawPixels = _swrast_DrawPixels;
driver->ReadPixels = _mesa_readpixels;
@@ -135,7 +133,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->DepthRange = NULL;
driver->Enable = NULL;
driver->Fogfv = NULL;
- driver->Hint = NULL;
driver->Lightfv = NULL;
driver->LightModelfv = NULL;
driver->LineStipple = NULL;
@@ -179,16 +176,8 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->DiscardFramebuffer = NULL;
_mesa_init_texture_barrier_functions(driver);
-
- /* APPLE_vertex_array_object */
- driver->NewArrayObject = _mesa_new_vao;
- driver->DeleteArrayObject = _mesa_delete_vao;
- driver->BindArrayObject = NULL;
-
_mesa_init_shader_object_functions(driver);
-
_mesa_init_transform_feedback_functions(driver);
-
_mesa_init_sampler_object_functions(driver);
/* T&L stuff */
@@ -198,17 +187,8 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->SaveNeedFlush = 0;
driver->ProgramStringNotify = _tnl_program_string;
- driver->FlushVertices = NULL;
- driver->SaveFlushVertices = NULL;
- driver->NotifySaveBegin = NULL;
driver->LightingSpaceChange = NULL;
- /* display list */
- driver->NewList = NULL;
- driver->EndList = NULL;
- driver->BeginCallList = NULL;
- driver->EndCallList = NULL;
-
/* GL_ARB_texture_storage */
driver->AllocTextureStorage = _mesa_AllocTextureStorage_sw;
@@ -242,23 +222,11 @@ _mesa_init_driver_state(struct gl_context *ctx)
ctx->Color.Blend[0].SrcA,
ctx->Color.Blend[0].DstA);
- if (ctx->Driver.ColorMaskIndexed) {
- GLuint i;
- for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) {
- ctx->Driver.ColorMaskIndexed(ctx, i,
- ctx->Color.ColorMask[i][RCOMP],
- ctx->Color.ColorMask[i][GCOMP],
- ctx->Color.ColorMask[i][BCOMP],
- ctx->Color.ColorMask[i][ACOMP]);
- }
- }
- else {
- ctx->Driver.ColorMask(ctx,
- ctx->Color.ColorMask[0][RCOMP],
- ctx->Color.ColorMask[0][GCOMP],
- ctx->Color.ColorMask[0][BCOMP],
- ctx->Color.ColorMask[0][ACOMP]);
- }
+ ctx->Driver.ColorMask(ctx,
+ ctx->Color.ColorMask[0][RCOMP],
+ ctx->Color.ColorMask[0][GCOMP],
+ ctx->Color.ColorMask[0][BCOMP],
+ ctx->Color.ColorMask[0][ACOMP]);
ctx->Driver.CullFace(ctx, ctx->Polygon.CullFaceMode);
ctx->Driver.DepthFunc(ctx, ctx->Depth.Func);
diff --git a/src/mesa/drivers/common/meta_generate_mipmap.c b/src/mesa/drivers/common/meta_generate_mipmap.c
index 5dc40a2aa33..4800278a467 100644
--- a/src/mesa/drivers/common/meta_generate_mipmap.c
+++ b/src/mesa/drivers/common/meta_generate_mipmap.c
@@ -150,8 +150,7 @@ prepare_mipmap_level(struct gl_context *ctx,
/**
* Called via ctx->Driver.GenerateMipmap()
- * Note: We don't yet support 3D textures, 1D/2D array textures or texture
- * borders.
+ * Note: We don't yet support 3D textures, or texture borders.
*/
void
_mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index d35ac263a45..5cfa2f8ca4f 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -44,6 +44,7 @@
#include "utils.h"
#include "xmlpool.h"
#include "main/mtypes.h"
+#include "main/framebuffer.h"
#include "main/version.h"
#include "main/errors.h"
#include "main/macros.h"
@@ -793,7 +794,7 @@ driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv)
{
struct gl_framebuffer *fb = (struct gl_framebuffer *) dPriv->driverPrivate;
if (fb && (dPriv->w != fb->Width || dPriv->h != fb->Height)) {
- ctx->Driver.ResizeBuffers(ctx, fb, dPriv->w, dPriv->h);
+ _mesa_resize_framebuffer(ctx, fb, dPriv->w, dPriv->h);
/* if the driver needs the hw lock for ResizeBuffers, the drawable
might have changed again by now */
assert(fb->Width == dPriv->w);
diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c
index 1246bec6e02..ae8fcabc14e 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -41,36 +41,6 @@
#include "utils.h"
#include "dri_util.h"
-
-uint64_t
-driParseDebugString(const char *debug,
- const struct dri_debug_control *control)
-{
- uint64_t flag = 0;
-
- if (debug != NULL) {
- for (; control->string != NULL; control++) {
- if (!strcmp(debug, "all")) {
- flag |= control->flag;
-
- } else {
- const char *s = debug;
- unsigned n;
-
- for (; n = strcspn(s, ", "), *s; s += MAX2(1, n)) {
- if (strlen(control->string) == n &&
- !strncmp(control->string, s, n))
- flag |= control->flag;
- }
- }
- }
- }
-
- return flag;
-}
-
-
-
/**
* Create the \c GL_RENDERER string for DRI drivers.
*
diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h
index 3760c38fcaf..f6b8d7c3a21 100644
--- a/src/mesa/drivers/dri/common/utils.h
+++ b/src/mesa/drivers/dri/common/utils.h
@@ -32,14 +32,6 @@
#include <GL/internal/dri_interface.h>
#include "main/context.h"
-struct dri_debug_control {
- const char * string;
- uint64_t flag;
-};
-
-extern uint64_t driParseDebugString( const char * debug,
- const struct dri_debug_control * control );
-
extern unsigned driGetRendererString( char * buffer,
const char * hardware_name, GLuint agp_mode );
diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c
index 906e942b020..7ce5ef7e41a 100644
--- a/src/mesa/drivers/dri/i915/i830_state.c
+++ b/src/mesa/drivers/dri/i915/i830_state.c
@@ -601,6 +601,8 @@ i830CullFaceFrontFace(struct gl_context * ctx, GLenum unused)
else if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
mode = CULLMODE_CW;
+ if (ctx->DrawBuffer && _mesa_is_user_fbo(ctx->DrawBuffer))
+ mode ^= (CULLMODE_CW ^ CULLMODE_CCW);
if (ctx->Polygon.CullFaceMode == GL_FRONT)
mode ^= (CULLMODE_CW ^ CULLMODE_CCW);
if (ctx->Polygon.FrontFace != GL_CCW)
diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c
index 80bd249fa7b..c41cd37bcc2 100644
--- a/src/mesa/drivers/dri/i915/i915_vtbl.c
+++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
@@ -31,7 +31,6 @@
#include "main/mtypes.h"
#include "main/imports.h"
#include "main/macros.h"
-#include "main/colormac.h"
#include "main/renderbuffer.h"
#include "main/framebuffer.h"
diff --git a/src/mesa/drivers/dri/i915/intel_buffers.c b/src/mesa/drivers/dri/i915/intel_buffers.c
index 51eaea43a50..386e032443a 100644
--- a/src/mesa/drivers/dri/i915/intel_buffers.c
+++ b/src/mesa/drivers/dri/i915/intel_buffers.c
@@ -55,20 +55,14 @@ intel_check_front_buffer_rendering(struct intel_context *intel)
static void
intelDrawBuffer(struct gl_context * ctx, GLenum mode)
{
- if (ctx->DrawBuffer && _mesa_is_winsys_fbo(ctx->DrawBuffer)) {
+ if (_mesa_is_front_buffer_drawing(ctx->DrawBuffer)) {
struct intel_context *const intel = intel_context(ctx);
- const bool was_front_buffer_rendering =
- intel->is_front_buffer_rendering;
- intel->is_front_buffer_rendering = (mode == GL_FRONT_LEFT)
- || (mode == GL_FRONT) || (mode == GL_FRONT_AND_BACK);
-
- /* If we weren't front-buffer rendering before but we are now,
- * invalidate our DRI drawable so we'll ask for new buffers
+ /* If we might be front-buffer rendering on this buffer for the first
+ * time, invalidate our DRI drawable so we'll ask for new buffers
* (including the fake front) before we start rendering again.
*/
- if (!was_front_buffer_rendering && intel->is_front_buffer_rendering)
- dri2InvalidateDrawable(intel->driContext->driDrawablePriv);
+ dri2InvalidateDrawable(intel->driContext->driDrawablePriv);
}
intel_draw_buffer(ctx);
@@ -78,20 +72,14 @@ intelDrawBuffer(struct gl_context * ctx, GLenum mode)
static void
intelReadBuffer(struct gl_context * ctx, GLenum mode)
{
- if (ctx->ReadBuffer && _mesa_is_winsys_fbo(ctx->ReadBuffer)) {
+ if (_mesa_is_front_buffer_reading(ctx->ReadBuffer)) {
struct intel_context *const intel = intel_context(ctx);
- const bool was_front_buffer_reading =
- intel->is_front_buffer_reading;
-
- intel->is_front_buffer_reading = (mode == GL_FRONT_LEFT)
- || (mode == GL_FRONT);
- /* If we weren't front-buffer reading before but we are now,
- * invalidate our DRI drawable so we'll ask for new buffers
+ /* If we might be front-buffer reading on this buffer for the first
+ * time, invalidate our DRI drawable so we'll ask for new buffers
* (including the fake front) before we start reading again.
*/
- if (!was_front_buffer_reading && intel->is_front_buffer_reading)
- dri2InvalidateDrawable(intel->driContext->driReadablePriv);
+ dri2InvalidateDrawable(intel->driContext->driReadablePriv);
}
}
diff --git a/src/mesa/drivers/dri/i915/intel_buffers.h b/src/mesa/drivers/dri/i915/intel_buffers.h
index 42d84bcfcb7..6e22f5125b9 100644
--- a/src/mesa/drivers/dri/i915/intel_buffers.h
+++ b/src/mesa/drivers/dri/i915/intel_buffers.h
@@ -34,7 +34,6 @@
#include "intel_context.h"
struct intel_context;
-struct intel_framebuffer;
extern void intel_check_front_buffer_rendering(struct intel_context *intel);
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index c780103228f..3f429f25d10 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -56,6 +56,7 @@
#include "intel_mipmap_tree.h"
#include "utils.h"
+#include "util/debug.h"
#include "util/ralloc.h"
int INTEL_DEBUG = (0);
@@ -243,7 +244,7 @@ intel_prepare_render(struct intel_context *intel)
* that will happen next will probably dirty the front buffer. So
* mark it as dirty here.
*/
- if (intel->is_front_buffer_rendering)
+ if (_mesa_is_front_buffer_drawing(intel->ctx.DrawBuffer))
intel->front_buffer_dirty = true;
/* Wait for the swapbuffers before the one we just emitted, so we
@@ -290,7 +291,7 @@ intel_viewport(struct gl_context *ctx)
intelCalcViewport(ctx);
}
-static const struct dri_debug_control debug_control[] = {
+static const struct debug_control debug_control[] = {
{ "tex", DEBUG_TEXTURE},
{ "state", DEBUG_STATE},
{ "blit", DEBUG_BLIT},
@@ -356,7 +357,7 @@ intel_glFlush(struct gl_context *ctx)
intel_flush(ctx);
intel_flush_front(ctx);
- if (intel->is_front_buffer_rendering)
+ if (_mesa_is_front_buffer_drawing(ctx->DrawBuffer))
intel->need_throttle = true;
}
@@ -474,8 +475,8 @@ intelInitContext(struct intel_context *intel,
ctx->Const.MinLineWidth = 1.0;
ctx->Const.MinLineWidthAA = 1.0;
- ctx->Const.MaxLineWidth = 5.0;
- ctx->Const.MaxLineWidthAA = 5.0;
+ ctx->Const.MaxLineWidth = 7.0;
+ ctx->Const.MaxLineWidthAA = 7.0;
ctx->Const.LineWidthGranularity = 0.5;
ctx->Const.MinPointSize = 1.0;
@@ -512,7 +513,7 @@ intelInitContext(struct intel_context *intel,
intelInitExtensions(ctx);
- INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
+ INTEL_DEBUG = parse_debug_string(getenv("INTEL_DEBUG"), debug_control);
if (INTEL_DEBUG & DEBUG_BUFMGR)
dri_bufmgr_set_debug(intel->bufmgr, true);
if (INTEL_DEBUG & DEBUG_PERF)
@@ -700,8 +701,8 @@ intel_query_dri2_buffers(struct intel_context *intel,
back_rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT);
memset(attachments, 0, sizeof(attachments));
- if ((intel->is_front_buffer_rendering ||
- intel->is_front_buffer_reading ||
+ if ((_mesa_is_front_buffer_drawing(fb) ||
+ _mesa_is_front_buffer_reading(fb) ||
!back_rb) && front_rb) {
/* If a fake front buffer is in use, then querying for
* __DRI_BUFFER_FRONT_LEFT will cause the server to copy the image from
@@ -866,8 +867,10 @@ intel_update_image_buffers(struct intel_context *intel, __DRIdrawable *drawable)
else
return;
- if ((intel->is_front_buffer_rendering || intel->is_front_buffer_reading || !back_rb) && front_rb)
+ if (front_rb && (_mesa_is_front_buffer_drawing(fb) ||
+ _mesa_is_front_buffer_reading(fb) || !back_rb)) {
buffer_mask |= __DRI_IMAGE_BUFFER_FRONT;
+ }
if (back_rb)
buffer_mask |= __DRI_IMAGE_BUFFER_BACK;
diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h
index 4ec4015d453..aecd7c23f45 100644
--- a/src/mesa/drivers/dri/i915/intel_context.h
+++ b/src/mesa/drivers/dri/i915/intel_context.h
@@ -255,22 +255,6 @@ struct intel_context
*/
bool front_buffer_dirty;
- /**
- * Track whether front-buffer rendering is currently enabled
- *
- * A separate flag is used to track this in order to support MRT more
- * easily.
- */
- bool is_front_buffer_rendering;
- /**
- * Track whether front-buffer is the current read target.
- *
- * This is closely associated with is_front_buffer_rendering, but may
- * be set separately. The DRI2 fake front buffer must be referenced
- * either way.
- */
- bool is_front_buffer_reading;
-
bool use_early_z;
__DRIcontext *driContext;
diff --git a/src/mesa/drivers/dri/i915/intel_fbo.c b/src/mesa/drivers/dri/i915/intel_fbo.c
index 12cc7e3a71b..8750c601b84 100644
--- a/src/mesa/drivers/dri/i915/intel_fbo.c
+++ b/src/mesa/drivers/dri/i915/intel_fbo.c
@@ -64,19 +64,6 @@ intel_get_rb_region(struct gl_framebuffer *fb, GLuint attIndex)
return NULL;
}
-/**
- * Create a new framebuffer object.
- */
-static struct gl_framebuffer *
-intel_new_framebuffer(struct gl_context * ctx, GLuint name)
-{
- /* Only drawable state in intel_framebuffer at this time, just use Mesa's
- * class
- */
- return _mesa_new_framebuffer(ctx, name);
-}
-
-
/** Called by gl_renderbuffer::Delete() */
static void
intel_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
@@ -770,7 +757,6 @@ intel_blit_framebuffer(struct gl_context *ctx,
void
intel_fbo_init(struct intel_context *intel)
{
- intel->ctx.Driver.NewFramebuffer = intel_new_framebuffer;
intel->ctx.Driver.NewRenderbuffer = intel_new_renderbuffer;
intel->ctx.Driver.MapRenderbuffer = intel_map_renderbuffer;
intel->ctx.Driver.UnmapRenderbuffer = intel_unmap_renderbuffer;
diff --git a/src/mesa/drivers/dri/i915/intel_pixel.c b/src/mesa/drivers/dri/i915/intel_pixel.c
index 6f139e19e11..feb1a3f97e8 100644
--- a/src/mesa/drivers/dri/i915/intel_pixel.c
+++ b/src/mesa/drivers/dri/i915/intel_pixel.c
@@ -126,7 +126,6 @@ intel_check_blit_fragment_ops(struct gl_context * ctx, bool src_alpha_is_one)
void
intelInitPixelFuncs(struct dd_function_table *functions)
{
- functions->Accum = _mesa_accum;
functions->Bitmap = intelBitmap;
functions->CopyPixels = intelCopyPixels;
functions->DrawPixels = intelDrawPixels;
diff --git a/src/mesa/drivers/dri/i915/intel_render.c b/src/mesa/drivers/dri/i915/intel_render.c
index 6c2ad6c6c95..c1603565cc2 100644
--- a/src/mesa/drivers/dri/i915/intel_render.c
+++ b/src/mesa/drivers/dri/i915/intel_render.c
@@ -54,9 +54,7 @@
* dma buffers. Use strip/fan hardware primitives where possible.
* Try to simulate missing primitives with indexed vertices.
*/
-#define HAVE_POINTS 0 /* Has it, but can't use because subpixel has to
- * be adjusted for points on the INTEL/I845G
- */
+#define HAVE_POINTS 1
#define HAVE_LINES 1
#define HAVE_LINE_STRIPS 1
#define HAVE_TRIANGLES 1
@@ -67,42 +65,42 @@
#define HAVE_ELTS 0
static const uint32_t hw_prim[GL_POLYGON + 1] = {
- 0,
- PRIM3D_LINELIST,
- PRIM3D_LINESTRIP,
- PRIM3D_LINESTRIP,
- PRIM3D_TRILIST,
- PRIM3D_TRISTRIP,
- PRIM3D_TRIFAN,
- 0,
- 0,
- PRIM3D_POLY
+ [GL_POINTS] = PRIM3D_POINTLIST,
+ [GL_LINES ] = PRIM3D_LINELIST,
+ [GL_LINE_LOOP] = PRIM3D_LINESTRIP,
+ [GL_LINE_STRIP] = PRIM3D_LINESTRIP,
+ [GL_TRIANGLES] = PRIM3D_TRILIST,
+ [GL_TRIANGLE_STRIP] = PRIM3D_TRISTRIP,
+ [GL_TRIANGLE_FAN] = PRIM3D_TRIFAN,
+ [GL_QUADS] = 0,
+ [GL_QUAD_STRIP] = 0,
+ [GL_POLYGON] = PRIM3D_POLY,
};
static const GLenum reduced_prim[GL_POLYGON + 1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
+ [GL_POINTS] = GL_POINTS,
+ [GL_LINES] = GL_LINES,
+ [GL_LINE_LOOP] = GL_LINES,
+ [GL_LINE_STRIP] = GL_LINES,
+ [GL_TRIANGLES] = GL_TRIANGLES,
+ [GL_TRIANGLE_STRIP] = GL_TRIANGLES,
+ [GL_TRIANGLE_FAN] = GL_TRIANGLES,
+ [GL_QUADS] = GL_TRIANGLES,
+ [GL_QUAD_STRIP] = GL_TRIANGLES,
+ [GL_POLYGON] = GL_TRIANGLES,
};
static const int scale_prim[GL_POLYGON + 1] = {
- 0, /* fallback case */
- 1,
- 2,
- 2,
- 1,
- 3,
- 3,
- 0, /* fallback case */
- 0, /* fallback case */
- 3
+ [GL_POINTS] = 1,
+ [GL_LINES] = 1,
+ [GL_LINE_LOOP] = 2,
+ [GL_LINE_STRIP] = 2,
+ [GL_TRIANGLES] = 1,
+ [GL_TRIANGLE_STRIP] = 3,
+ [GL_TRIANGLE_FAN] = 3,
+ [GL_QUADS] = 0, /* fallback case */
+ [GL_QUAD_STRIP] = 0, /* fallback case */
+ [GL_POLYGON] = 3,
};
diff --git a/src/mesa/drivers/dri/i915/intel_state.c b/src/mesa/drivers/dri/i915/intel_state.c
index c951ff731b8..3de9d50a4d7 100644
--- a/src/mesa/drivers/dri/i915/intel_state.c
+++ b/src/mesa/drivers/dri/i915/intel_state.c
@@ -30,7 +30,6 @@
#include "main/context.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "main/colormac.h"
#include "main/dd.h"
#include "intel_screen.h"
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c
index ae62a800fb7..a093a0a7bd2 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -426,11 +426,7 @@ intel_draw_point(struct intel_context *intel, intelVertexPtr v0)
GLuint *vb = intel_get_prim_space(intel, 1);
int j;
- /* Adjust for sub pixel position -- still required for conform. */
- *(float *) &vb[0] = v0->v.x;
- *(float *) &vb[1] = v0->v.y;
- for (j = 2; j < vertsize; j++)
- vb[j] = v0->ui[j];
+ COPY_DWORDS(j, vb, vertsize, v0);
}
@@ -670,16 +666,16 @@ do { \
***********************************************************************/
static const GLuint hw_prim[GL_POLYGON + 1] = {
- PRIM3D_POINTLIST,
- PRIM3D_LINELIST,
- PRIM3D_LINELIST,
- PRIM3D_LINELIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST,
- PRIM3D_TRILIST
+ [GL_POINTS] = PRIM3D_POINTLIST,
+ [GL_LINES] = PRIM3D_LINELIST,
+ [GL_LINE_LOOP] = PRIM3D_LINELIST,
+ [GL_LINE_STRIP] = PRIM3D_LINELIST,
+ [GL_TRIANGLES] = PRIM3D_TRILIST,
+ [GL_TRIANGLE_STRIP] = PRIM3D_TRILIST,
+ [GL_TRIANGLE_FAN] = PRIM3D_TRILIST,
+ [GL_QUADS] = PRIM3D_TRILIST,
+ [GL_QUAD_STRIP] = PRIM3D_TRILIST,
+ [GL_POLYGON] = PRIM3D_TRILIST,
};
#define RASTERIZE(x) intelRasterPrimitive( ctx, x, hw_prim[x] )
@@ -891,18 +887,11 @@ intelRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint n)
{
struct intel_context *intel = intel_context(ctx);
TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
GLuint prim = intel->render_primitive;
/* Render the new vertices as an unclipped polygon.
*/
- {
- GLuint *tmp = VB->Elts;
- VB->Elts = (GLuint *) elts;
- tnl->Driver.Render.PrimTabElts[GL_POLYGON] (ctx, 0, n,
- PRIM_BEGIN | PRIM_END);
- VB->Elts = tmp;
- }
+ _tnl_RenderClippedPolygon(ctx, elts, n);
/* Restore the render primitive
*/
@@ -911,14 +900,6 @@ intelRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint n)
}
static void
-intelRenderClippedLine(struct gl_context * ctx, GLuint ii, GLuint jj)
-{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
-
- tnl->Driver.Render.Line(ctx, ii, jj);
-}
-
-static void
intelFastRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint n)
{
struct intel_context *intel = intel_context(ctx);
@@ -928,10 +909,18 @@ intelFastRenderClippedPoly(struct gl_context * ctx, const GLuint * elts, GLuint
const GLuint *start = (const GLuint *) V(elts[0]);
int i, j;
- for (i = 2; i < n; i++) {
- COPY_DWORDS(j, vb, vertsize, V(elts[i - 1]));
- COPY_DWORDS(j, vb, vertsize, V(elts[i]));
- COPY_DWORDS(j, vb, vertsize, start);
+ if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION) {
+ for (i = 2; i < n; i++) {
+ COPY_DWORDS(j, vb, vertsize, V(elts[i - 1]));
+ COPY_DWORDS(j, vb, vertsize, V(elts[i]));
+ COPY_DWORDS(j, vb, vertsize, start);
+ }
+ } else {
+ for (i = 2; i < n; i++) {
+ COPY_DWORDS(j, vb, vertsize, start);
+ COPY_DWORDS(j, vb, vertsize, V(elts[i - 1]));
+ COPY_DWORDS(j, vb, vertsize, V(elts[i]));
+ }
}
}
@@ -1036,23 +1025,23 @@ intelChooseRenderState(struct gl_context * ctx)
else {
tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
- tnl->Driver.Render.ClippedLine = intelRenderClippedLine;
+ tnl->Driver.Render.ClippedLine = _tnl_RenderClippedLine;
tnl->Driver.Render.ClippedPolygon = intelRenderClippedPoly;
}
}
}
static const GLenum reduced_prim[GL_POLYGON + 1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
+ [GL_POINTS] = GL_POINTS,
+ [GL_LINES] = GL_LINES,
+ [GL_LINE_LOOP] = GL_LINES,
+ [GL_LINE_STRIP] = GL_LINES,
+ [GL_TRIANGLES] = GL_TRIANGLES,
+ [GL_TRIANGLE_STRIP] = GL_TRIANGLES,
+ [GL_TRIANGLE_FAN] = GL_TRIANGLES,
+ [GL_QUADS] = GL_TRIANGLES,
+ [GL_QUAD_STRIP] = GL_TRIANGLES,
+ [GL_POLYGON] = GL_TRIANGLES
};
diff --git a/src/mesa/drivers/dri/i965/Makefile.am b/src/mesa/drivers/dri/i965/Makefile.am
index 3c8197226fe..2e241511049 100644
--- a/src/mesa/drivers/dri/i965/Makefile.am
+++ b/src/mesa/drivers/dri/i965/Makefile.am
@@ -43,28 +43,16 @@ AM_CXXFLAGS = $(AM_CFLAGS)
noinst_LTLIBRARIES = libi965_dri.la libi965_compiler.la
libi965_dri_la_SOURCES = $(i965_FILES)
-libi965_dri_la_LIBADD = $(INTEL_LIBS)
+libi965_dri_la_LIBADD = libi965_compiler.la $(INTEL_LIBS)
+
+libi965_compiler_la_SOURCES = $(i965_compiler_FILES)
TEST_LIBS = \
- libi965_dri.la \
- ../common/libdricommon.la \
- ../common/libxmlconfig.la \
- ../common/libmegadriver_stub.la \
+ libi965_compiler.la \
../../../libmesa.la \
- $(DRI_LIB_DEPS) \
- $(CLOCK_LIB) \
+ -lpthread -ldl \
../common/libdri_test_stubs.la
-libi965_compiler_la_SOURCES = $(i965_FILES)
-libi965_compiler_la_LIBADD = $(INTEL_LIBS) \
- ../common/libdricommon.la \
- ../common/libxmlconfig.la \
- ../common/libmegadriver_stub.la \
- ../../../libmesa.la \
- $(DRI_LIB_DEPS) \
- $(CLOCK_LIB) \
- ../common/libdri_test_stubs.la -lm
-
TESTS = \
test_fs_cmod_propagation \
test_fs_saturate_propagation \
diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources
index eb8196d4845..81ef6283fa1 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -1,47 +1,18 @@
-i965_FILES = \
- brw_binding_tables.c \
- brw_blorp_blit.cpp \
- brw_blorp_blit_eu.cpp \
- brw_blorp_blit_eu.h \
- brw_blorp.cpp \
- brw_blorp.h \
- brw_cc.c \
+i965_compiler_FILES = \
brw_cfg.cpp \
brw_cfg.h \
- brw_clear.c \
- brw_clip.c \
- brw_clip.h \
- brw_clip_line.c \
- brw_clip_point.c \
- brw_clip_state.c \
- brw_clip_tri.c \
- brw_clip_unfilled.c \
- brw_clip_util.c \
- brw_compute.c \
- brw_conditional_render.c \
- brw_context.c \
- brw_context.h \
- brw_cs.c \
- brw_cs.h \
brw_cubemap_normalize.cpp \
- brw_curbe.c \
brw_dead_control_flow.cpp \
brw_dead_control_flow.h \
brw_defines.h \
brw_device_info.c \
brw_device_info.h \
brw_disasm.c \
- brw_draw.c \
- brw_draw.h \
- brw_draw_upload.c \
brw_eu.c \
brw_eu_compact.c \
brw_eu_emit.c \
brw_eu.h \
brw_eu_util.c \
- brw_ff_gs.c \
- brw_ff_gs_emit.c \
- brw_ff_gs.h \
brw_fs_builder.h \
brw_fs_channel_expressions.cpp \
brw_fs_cmod_propagation.cpp \
@@ -55,7 +26,6 @@ i965_FILES = \
brw_fs_live_variables.cpp \
brw_fs_live_variables.h \
brw_fs_nir.cpp \
- brw_fs_peephole_predicated_break.cpp \
brw_fs_reg_allocate.cpp \
brw_fs_register_coalesce.cpp \
brw_fs_saturate_propagation.cpp \
@@ -65,10 +35,6 @@ i965_FILES = \
brw_fs_validate.cpp \
brw_fs_vector_splitting.cpp \
brw_fs_visitor.cpp \
- brw_gs.c \
- brw_gs.h \
- brw_gs_state.c \
- brw_gs_surface_state.c \
brw_inst.h \
brw_interpolation_map.c \
brw_ir_allocator.h \
@@ -76,45 +42,17 @@ i965_FILES = \
brw_ir_vec4.h \
brw_lower_texture_gradients.cpp \
brw_lower_unnormalized_offset.cpp \
- brw_meta_fast_clear.c \
- brw_meta_stencil_blit.c \
- brw_meta_updownsample.c \
- brw_meta_util.c \
- brw_meta_util.h \
- brw_misc_state.c \
- brw_multisample_state.h \
brw_nir.h \
brw_nir.c \
brw_nir_analyze_boolean_resolves.c \
brw_nir_uniforms.cpp \
- brw_object_purgeable.c \
brw_packed_float.c \
- brw_performance_monitor.c \
- brw_pipe_control.c \
- brw_primitive_restart.c \
- brw_program.c \
- brw_program.h \
- brw_queryobj.c \
+ brw_predicated_break.cpp \
brw_reg.h \
- brw_reset.c \
- brw_sampler_state.c \
brw_schedule_instructions.cpp \
- brw_sf.c \
- brw_sf_emit.c \
- brw_sf.h \
- brw_sf_state.c \
brw_shader.cpp \
brw_shader.h \
- brw_state_batch.c \
- brw_state_cache.c \
- brw_state_dump.c \
- brw_state.h \
- brw_state_upload.c \
- brw_structs.h \
brw_surface_formats.c \
- brw_tex.c \
- brw_tex_layout.c \
- brw_urb.c \
brw_util.c \
brw_util.h \
brw_vec4_builder.h \
@@ -135,14 +73,88 @@ i965_FILES = \
brw_vec4_surface_builder.h \
brw_vec4_visitor.cpp \
brw_vec4_vs_visitor.cpp \
+ brw_vue_map.c \
+ brw_wm_iz.cpp \
+ gen6_gs_visitor.cpp \
+ gen6_gs_visitor.h \
+ intel_asm_annotation.c \
+ intel_asm_annotation.h \
+ intel_debug.c \
+ intel_debug.h \
+ intel_reg.h \
+ intel_resolve_map.c \
+ intel_resolve_map.h
+
+i965_FILES = \
+ brw_binding_tables.c \
+ brw_blorp_blit.cpp \
+ brw_blorp_blit_eu.cpp \
+ brw_blorp_blit_eu.h \
+ brw_blorp.cpp \
+ brw_blorp.h \
+ brw_cc.c \
+ brw_clear.c \
+ brw_clip.c \
+ brw_clip.h \
+ brw_clip_line.c \
+ brw_clip_point.c \
+ brw_clip_state.c \
+ brw_clip_tri.c \
+ brw_clip_unfilled.c \
+ brw_clip_util.c \
+ brw_compute.c \
+ brw_conditional_render.c \
+ brw_context.c \
+ brw_context.h \
+ brw_cs.c \
+ brw_cs.h \
+ brw_curbe.c \
+ brw_draw.c \
+ brw_draw.h \
+ brw_draw_upload.c \
+ brw_ff_gs.c \
+ brw_ff_gs_emit.c \
+ brw_ff_gs.h \
+ brw_gs.c \
+ brw_gs.h \
+ brw_gs_state.c \
+ brw_gs_surface_state.c \
+ brw_link.cpp \
+ brw_meta_fast_clear.c \
+ brw_meta_stencil_blit.c \
+ brw_meta_updownsample.c \
+ brw_meta_util.c \
+ brw_meta_util.h \
+ brw_misc_state.c \
+ brw_multisample_state.h \
+ brw_object_purgeable.c \
+ brw_performance_monitor.c \
+ brw_pipe_control.c \
+ brw_program.c \
+ brw_program.h \
+ brw_primitive_restart.c \
+ brw_queryobj.c \
+ brw_reset.c \
+ brw_sampler_state.c \
+ brw_sf.c \
+ brw_sf_emit.c \
+ brw_sf.h \
+ brw_sf_state.c \
+ brw_state_batch.c \
+ brw_state_cache.c \
+ brw_state_dump.c \
+ brw_state.h \
+ brw_state_upload.c \
+ brw_structs.h \
+ brw_tex.c \
+ brw_tex_layout.c \
+ brw_urb.c \
brw_vs.c \
brw_vs.h \
brw_vs_state.c \
brw_vs_surface_state.c \
- brw_vue_map.c \
brw_wm.c \
brw_wm.h \
- brw_wm_iz.cpp \
brw_wm_state.c \
brw_wm_surface_state.c \
gen6_blorp.cpp \
@@ -152,8 +164,6 @@ i965_FILES = \
gen6_depth_state.c \
gen6_depthstencil.c \
gen6_gs_state.c \
- gen6_gs_visitor.cpp \
- gen6_gs_visitor.h \
gen6_multisample_state.c \
gen6_queryobj.c \
gen6_sampler_state.c \
@@ -192,8 +202,6 @@ i965_FILES = \
gen8_viewport_state.c \
gen8_vs_state.c \
gen8_wm_depth_stencil.c \
- intel_asm_annotation.c \
- intel_asm_annotation.h \
intel_batchbuffer.c \
intel_batchbuffer.h \
intel_blit.c \
@@ -203,8 +211,6 @@ i965_FILES = \
intel_buffers.c \
intel_buffers.h \
intel_copy_image.c \
- intel_debug.c \
- intel_debug.h \
intel_extensions.c \
intel_fbo.c \
intel_fbo.h \
@@ -217,9 +223,6 @@ i965_FILES = \
intel_pixel_draw.c \
intel_pixel.h \
intel_pixel_read.c \
- intel_reg.h \
- intel_resolve_map.c \
- intel_resolve_map.h \
intel_screen.c \
intel_screen.h \
intel_state.c \
diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c
index 3a73c64a88b..2d5abc70cb9 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -223,6 +223,7 @@ brw_upload_clip_prog(struct brw_context *brw)
/* _NEW_POLYGON, _NEW_BUFFERS */
key.offset_units = ctx->Polygon.OffsetUnits * ctx->DrawBuffer->_MRD * 2;
key.offset_factor = ctx->Polygon.OffsetFactor * ctx->DrawBuffer->_MRD;
+ key.offset_clamp = ctx->Polygon.OffsetClamp * ctx->DrawBuffer->_MRD;
}
if (!ctx->Polygon._FrontBit) {
diff --git a/src/mesa/drivers/dri/i965/brw_clip.h b/src/mesa/drivers/dri/i965/brw_clip.h
index 4e38f2f2ed6..54c76822e22 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.h
+++ b/src/mesa/drivers/dri/i965/brw_clip.h
@@ -62,6 +62,7 @@ struct brw_clip_prog_key {
GLfloat offset_factor;
GLfloat offset_units;
+ GLfloat offset_clamp;
};
diff --git a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
index 6baf620a1a7..9a4d2a9d6f9 100644
--- a/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
+++ b/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
@@ -188,6 +188,12 @@ static void copy_bfc( struct brw_clip_compile *c )
GLfloat bc = dir.y * iz;
offset = ctx->Polygon.OffsetUnits * DEPTH_SCALE;
offset += MAX2( abs(ac), abs(bc) ) * ctx->Polygon.OffsetFactor;
+ if (ctx->Polygon.OffsetClamp && isfinite(ctx->Polygon.OffsetClamp)) {
+ if (ctx->Polygon.OffsetClamp < 0)
+ offset = MAX2( offset, ctx->Polygon.OffsetClamp );
+ else
+ offset = MIN2( offset, ctx->Polygon.OffsetClamp );
+ }
offset *= MRD;
*/
static void compute_offset( struct brw_clip_compile *c )
@@ -211,6 +217,14 @@ static void compute_offset( struct brw_clip_compile *c )
brw_MUL(p, vec1(off), vec1(off), brw_imm_f(c->key.offset_factor));
brw_ADD(p, vec1(off), vec1(off), brw_imm_f(c->key.offset_units));
+ if (c->key.offset_clamp && isfinite(c->key.offset_clamp)) {
+ brw_CMP(p,
+ vec1(brw_null_reg()),
+ c->key.offset_clamp < 0 ? BRW_CONDITIONAL_GE : BRW_CONDITIONAL_L,
+ vec1(off),
+ brw_imm_f(c->key.offset_clamp));
+ brw_SEL(p, vec1(off), vec1(off), brw_imm_f(c->key.offset_clamp));
+ }
}
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 4d499295730..6b2bbd21703 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -41,6 +41,7 @@
#include "main/version.h"
#include "main/vtxfmt.h"
#include "main/texobj.h"
+#include "main/framebuffer.h"
#include "vbo/vbo_context.h"
@@ -326,7 +327,7 @@ brw_initialize_context_constants(struct brw_context *brw)
ctx->Const.MaxUniformBlockSize = 65536;
for (int i = 0; i < MESA_SHADER_STAGES; i++) {
struct gl_program_constants *prog = &ctx->Const.Program[i];
- prog->MaxUniformBlocks = 12;
+ prog->MaxUniformBlocks = BRW_MAX_UBO;
prog->MaxCombinedUniformComponents =
prog->MaxUniformComponents +
ctx->Const.MaxUniformBlockSize / 4 * prog->MaxUniformBlocks;
@@ -346,7 +347,7 @@ brw_initialize_context_constants(struct brw_context *brw)
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = 0;
if (_mesa_extension_override_enables.ARB_compute_shader) {
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
- ctx->Const.MaxUniformBufferBindings += 12;
+ ctx->Const.MaxUniformBufferBindings += BRW_MAX_UBO;
} else {
ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits = 0;
}
@@ -582,17 +583,17 @@ brw_initialize_context_constants(struct brw_context *brw)
/* FIXME: Tessellation stages are not yet supported in i965, so
* MaxCombinedShaderStorageBlocks doesn't take them into account.
*/
- ctx->Const.Program[MESA_SHADER_VERTEX].MaxShaderStorageBlocks = 12;
- ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxShaderStorageBlocks = 12;
+ ctx->Const.Program[MESA_SHADER_VERTEX].MaxShaderStorageBlocks = BRW_MAX_SSBO;
+ ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxShaderStorageBlocks = BRW_MAX_SSBO;
ctx->Const.Program[MESA_SHADER_TESS_EVAL].MaxShaderStorageBlocks = 0;
ctx->Const.Program[MESA_SHADER_TESS_CTRL].MaxShaderStorageBlocks = 0;
- ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxShaderStorageBlocks = 12;
- ctx->Const.Program[MESA_SHADER_COMPUTE].MaxShaderStorageBlocks = 12;
- ctx->Const.MaxCombinedShaderStorageBlocks = 12 * 3;
- ctx->Const.MaxShaderStorageBufferBindings = 36;
+ ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxShaderStorageBlocks = BRW_MAX_SSBO;
+ ctx->Const.Program[MESA_SHADER_COMPUTE].MaxShaderStorageBlocks = BRW_MAX_SSBO;
+ ctx->Const.MaxCombinedShaderStorageBlocks = BRW_MAX_SSBO * 3;
+ ctx->Const.MaxShaderStorageBufferBindings = BRW_MAX_SSBO * 3;
if (_mesa_extension_override_enables.ARB_compute_shader)
- ctx->Const.MaxShaderStorageBufferBindings += 12;
+ ctx->Const.MaxShaderStorageBufferBindings += BRW_MAX_SSBO;
if (brw->gen >= 6) {
ctx->Const.MaxVarying = 32;
@@ -1298,7 +1299,7 @@ intel_prepare_render(struct brw_context *brw)
* that will happen next will probably dirty the front buffer. So
* mark it as dirty here.
*/
- if (brw_is_front_buffer_drawing(ctx->DrawBuffer))
+ if (_mesa_is_front_buffer_drawing(ctx->DrawBuffer))
brw->front_buffer_dirty = true;
}
@@ -1337,8 +1338,8 @@ intel_query_dri2_buffers(struct brw_context *brw,
back_rb = intel_get_renderbuffer(fb, BUFFER_BACK_LEFT);
memset(attachments, 0, sizeof(attachments));
- if ((brw_is_front_buffer_drawing(fb) ||
- brw_is_front_buffer_reading(fb) ||
+ if ((_mesa_is_front_buffer_drawing(fb) ||
+ _mesa_is_front_buffer_reading(fb) ||
!back_rb) && front_rb) {
/* If a fake front buffer is in use, then querying for
* __DRI_BUFFER_FRONT_LEFT will cause the server to copy the image from
@@ -1452,7 +1453,7 @@ intel_process_dri2_buffer(struct brw_context *brw,
drawable->w, drawable->h,
buffer->pitch);
- if (brw_is_front_buffer_drawing(fb) &&
+ if (_mesa_is_front_buffer_drawing(fb) &&
(buffer->attachment == __DRI_BUFFER_FRONT_LEFT ||
buffer->attachment == __DRI_BUFFER_FAKE_FRONT_LEFT) &&
rb->Base.Base.NumSamples > 1) {
@@ -1510,7 +1511,7 @@ intel_update_image_buffer(struct brw_context *intel,
buffer->width, buffer->height,
buffer->pitch);
- if (brw_is_front_buffer_drawing(fb) &&
+ if (_mesa_is_front_buffer_drawing(fb) &&
buffer_type == __DRI_IMAGE_BUFFER_FRONT &&
rb->Base.Base.NumSamples > 1) {
intel_renderbuffer_upsample(intel, rb);
@@ -1538,8 +1539,8 @@ intel_update_image_buffers(struct brw_context *brw, __DRIdrawable *drawable)
else
return;
- if (front_rb && (brw_is_front_buffer_drawing(fb) ||
- brw_is_front_buffer_reading(fb) || !back_rb)) {
+ if (front_rb && (_mesa_is_front_buffer_drawing(fb) ||
+ _mesa_is_front_buffer_reading(fb) || !back_rb)) {
buffer_mask |= __DRI_IMAGE_BUFFER_FRONT;
}
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index d921a9bb7dd..a66c61e58f3 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -490,6 +490,7 @@ struct brw_cs_prog_data {
unsigned simd_size;
bool uses_barrier;
bool uses_num_work_groups;
+ unsigned local_invocation_id_regs;
struct {
/** @{
@@ -714,6 +715,15 @@ struct brw_vs_prog_data {
/** Max number of render targets in a shader */
#define BRW_MAX_DRAW_BUFFERS 8
+/** Max number of UBOs in a shader */
+#define BRW_MAX_UBO 12
+
+/** Max number of SSBOs in a shader */
+#define BRW_MAX_SSBO 12
+
+/** Max number of combined UBOs and SSBOs in a shader */
+#define BRW_MAX_COMBINED_UBO_SSBO (BRW_MAX_UBO + BRW_MAX_SSBO)
+
/** Max number of atomic counter buffer objects in a shader */
#define BRW_MAX_ABO 16
@@ -750,7 +760,8 @@ struct brw_vs_prog_data {
#define BRW_MAX_SURFACES (BRW_MAX_DRAW_BUFFERS + \
BRW_MAX_TEX_UNIT * 2 + /* normal, gather */ \
- 12 + /* ubo */ \
+ BRW_MAX_UBO + \
+ BRW_MAX_SSBO + \
BRW_MAX_ABO + \
BRW_MAX_IMAGES + \
2 + /* shader time, pull constants */ \
@@ -1453,6 +1464,8 @@ struct brw_context
*/
drm_intel_bo *multisampled_null_render_target_bo;
uint32_t fast_clear_op;
+
+ float offset_clamp;
} wm;
struct {
@@ -1716,7 +1729,12 @@ void brw_validate_textures( struct brw_context *brw );
*/
void brwInitFragProgFuncs( struct dd_function_table *functions );
-int brw_get_scratch_size(int size);
+/* Per-thread scratch space is a power-of-two multiple of 1KB. */
+static inline int
+brw_get_scratch_size(int size)
+{
+ return util_next_power_of_two(size | 1023);
+}
void brw_get_scratch_bo(struct brw_context *brw,
drm_intel_bo **scratch_bo, int size);
void brw_init_shader_time(struct brw_context *brw);
diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c
index 6b64030a868..45fb816c160 100644
--- a/src/mesa/drivers/dri/i965/brw_cs.c
+++ b/src/mesa/drivers/dri/i965/brw_cs.c
@@ -98,8 +98,15 @@ brw_codegen_cs_prog(struct brw_context *brw,
start_time = get_time();
}
+ if (unlikely(INTEL_DEBUG & DEBUG_CS))
+ brw_dump_ir("compute", prog, &cs->base, &cp->program.Base);
+
+ int st_index = -1;
+ if (INTEL_DEBUG & DEBUG_SHADER_TIME)
+ st_index = brw_get_shader_time_index(brw, prog, &cp->program.Base, ST_CS);
+
program = brw_cs_emit(brw, mem_ctx, key, &prog_data,
- &cp->program, prog, &program_size);
+ &cp->program, prog, st_index, &program_size);
if (program == NULL) {
ralloc_free(mem_ctx);
return false;
diff --git a/src/mesa/drivers/dri/i965/brw_cs.h b/src/mesa/drivers/dri/i965/brw_cs.h
index 0c0ed2bc909..17c2ff9871a 100644
--- a/src/mesa/drivers/dri/i965/brw_cs.h
+++ b/src/mesa/drivers/dri/i965/brw_cs.h
@@ -46,10 +46,12 @@ brw_cs_emit(struct brw_context *brw,
struct brw_cs_prog_data *prog_data,
struct gl_compute_program *cp,
struct gl_shader_program *prog,
+ int shader_time_index,
unsigned *final_assembly_size);
-unsigned
-brw_cs_prog_local_id_payload_dwords(unsigned dispatch_width);
+void
+brw_cs_fill_local_id_payload(const struct brw_cs_prog_data *cs_prog_data,
+ void *buffer, uint32_t threads, uint32_t stride);
#ifdef __cplusplus
}
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 6a75e067915..39a26b05201 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -33,6 +33,7 @@
#include "main/enums.h"
#include "main/macros.h"
#include "main/transformfeedback.h"
+#include "main/framebuffer.h"
#include "tnl/tnl.h"
#include "vbo/vbo_context.h"
#include "swrast/swrast.h"
@@ -55,34 +56,34 @@
#define FILE_DEBUG_FLAG DEBUG_PRIMS
static const GLuint prim_to_hw_prim[GL_TRIANGLE_STRIP_ADJACENCY+1] = {
- _3DPRIM_POINTLIST,
- _3DPRIM_LINELIST,
- _3DPRIM_LINELOOP,
- _3DPRIM_LINESTRIP,
- _3DPRIM_TRILIST,
- _3DPRIM_TRISTRIP,
- _3DPRIM_TRIFAN,
- _3DPRIM_QUADLIST,
- _3DPRIM_QUADSTRIP,
- _3DPRIM_POLYGON,
- _3DPRIM_LINELIST_ADJ,
- _3DPRIM_LINESTRIP_ADJ,
- _3DPRIM_TRILIST_ADJ,
- _3DPRIM_TRISTRIP_ADJ,
+ [GL_POINTS] =_3DPRIM_POINTLIST,
+ [GL_LINES] = _3DPRIM_LINELIST,
+ [GL_LINE_LOOP] = _3DPRIM_LINELOOP,
+ [GL_LINE_STRIP] = _3DPRIM_LINESTRIP,
+ [GL_TRIANGLES] = _3DPRIM_TRILIST,
+ [GL_TRIANGLE_STRIP] = _3DPRIM_TRISTRIP,
+ [GL_TRIANGLE_FAN] = _3DPRIM_TRIFAN,
+ [GL_QUADS] = _3DPRIM_QUADLIST,
+ [GL_QUAD_STRIP] = _3DPRIM_QUADSTRIP,
+ [GL_POLYGON] = _3DPRIM_POLYGON,
+ [GL_LINES_ADJACENCY] = _3DPRIM_LINELIST_ADJ,
+ [GL_LINE_STRIP_ADJACENCY] = _3DPRIM_LINESTRIP_ADJ,
+ [GL_TRIANGLES_ADJACENCY] = _3DPRIM_TRILIST_ADJ,
+ [GL_TRIANGLE_STRIP_ADJACENCY] = _3DPRIM_TRISTRIP_ADJ,
};
static const GLenum reduced_prim[GL_POLYGON+1] = {
- GL_POINTS,
- GL_LINES,
- GL_LINES,
- GL_LINES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES,
- GL_TRIANGLES
+ [GL_POINTS] = GL_POINTS,
+ [GL_LINES] = GL_LINES,
+ [GL_LINE_LOOP] = GL_LINES,
+ [GL_LINE_STRIP] = GL_LINES,
+ [GL_TRIANGLES] = GL_TRIANGLES,
+ [GL_TRIANGLE_STRIP] = GL_TRIANGLES,
+ [GL_TRIANGLE_FAN] = GL_TRIANGLES,
+ [GL_QUADS] = GL_TRIANGLES,
+ [GL_QUAD_STRIP] = GL_TRIANGLES,
+ [GL_POLYGON] = GL_TRIANGLES
};
uint32_t
@@ -364,7 +365,7 @@ brw_postdraw_set_buffers_need_resolve(struct brw_context *brw)
struct intel_renderbuffer *stencil_irb = intel_get_renderbuffer(fb, BUFFER_STENCIL);
struct gl_renderbuffer_attachment *depth_att = &fb->Attachment[BUFFER_DEPTH];
- if (brw_is_front_buffer_drawing(fb))
+ if (_mesa_is_front_buffer_drawing(fb))
front_irb = intel_get_renderbuffer(fb, BUFFER_FRONT_LEFT);
if (front_irb)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 0a6b23284d9..5049851c617 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -210,7 +210,7 @@ fs_visitor::VARYING_PULL_CONSTANT_LOAD(const fs_builder &bld,
inst->regs_written = regs_written;
if (devinfo->gen < 7) {
- inst->base_mrf = 13;
+ inst->base_mrf = FIRST_PULL_LOAD_MRF(devinfo->gen);
inst->header_size = 1;
if (devinfo->gen == 4)
inst->mlen = 3;
@@ -2698,7 +2698,7 @@ fs_visitor::emit_repclear_shader()
bool
fs_visitor::remove_duplicate_mrf_writes()
{
- fs_inst *last_mrf_move[16];
+ fs_inst *last_mrf_move[BRW_MAX_MRF(devinfo->gen)];
bool progress = false;
/* Need to update the MRF tracking for compressed instructions. */
@@ -3019,7 +3019,7 @@ fs_visitor::lower_uniform_pull_constant_loads()
* else does except for register spill/unspill, which generates and
* uses its MRF within a single IR instruction.
*/
- inst->base_mrf = 14;
+ inst->base_mrf = FIRST_PULL_LOAD_MRF(devinfo->gen) + 1;
inst->mlen = 1;
}
}
@@ -4738,20 +4738,43 @@ fs_visitor::setup_vs_payload()
payload.num_regs = 2;
}
+/**
+ * We are building the local ID push constant data using the simplest possible
+ * method. We simply push the local IDs directly as they should appear in the
+ * registers for the uvec3 gl_LocalInvocationID variable.
+ *
+ * Therefore, for SIMD8, we use 3 full registers, and for SIMD16 we use 6
+ * registers worth of push constant space.
+ *
+ * Note: Any updates to brw_cs_prog_local_id_payload_dwords,
+ * fill_local_id_payload or fs_visitor::emit_cs_local_invocation_id_setup need
+ * to coordinated.
+ *
+ * FINISHME: There are a few easy optimizations to consider.
+ *
+ * 1. If gl_WorkGroupSize x, y or z is 1, we can just use zero, and there is
+ * no need for using push constant space for that dimension.
+ *
+ * 2. Since GL_MAX_COMPUTE_WORK_GROUP_SIZE is currently 1024 or less, we can
+ * easily use 16-bit words rather than 32-bit dwords in the push constant
+ * data.
+ *
+ * 3. If gl_WorkGroupSize x, y or z is small, then we can use bytes for
+ * conveying the data, and thereby reduce push constant usage.
+ *
+ */
void
fs_visitor::setup_cs_payload()
{
assert(devinfo->gen >= 7);
+ brw_cs_prog_data *prog_data = (brw_cs_prog_data*) this->prog_data;
payload.num_regs = 1;
if (nir->info.system_values_read & SYSTEM_BIT_LOCAL_INVOCATION_ID) {
- const unsigned local_id_dwords =
- brw_cs_prog_local_id_payload_dwords(dispatch_width);
- assert((local_id_dwords & 0x7) == 0);
- const unsigned local_id_regs = local_id_dwords / 8;
+ prog_data->local_invocation_id_regs = dispatch_width * 3 / 8;
payload.local_invocation_id_reg = payload.num_regs;
- payload.num_regs += local_id_regs;
+ payload.num_regs += prog_data->local_invocation_id_regs;
}
}
@@ -4843,7 +4866,7 @@ fs_visitor::optimize()
OPT(opt_algebraic);
OPT(opt_cse);
OPT(opt_copy_propagate);
- OPT(opt_peephole_predicated_break);
+ OPT(opt_predicated_break, this);
OPT(opt_cmod_propagation);
OPT(dead_code_eliminate);
OPT(opt_peephole_sel);
@@ -5118,25 +5141,13 @@ brw_wm_fs_emit(struct brw_context *brw,
struct brw_wm_prog_data *prog_data,
struct gl_fragment_program *fp,
struct gl_shader_program *prog,
+ int shader_time_index8, int shader_time_index16,
unsigned *final_assembly_size)
{
- struct brw_shader *shader = NULL;
- if (prog)
- shader = (brw_shader *) prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
-
- if (unlikely(INTEL_DEBUG & DEBUG_WM) && shader->base.ir)
- brw_dump_ir("fragment", prog, &shader->base, &fp->Base);
-
- int st_index8 = -1, st_index16 = -1;
- if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
- st_index8 = brw_get_shader_time_index(brw, prog, &fp->Base, ST_FS8);
- st_index16 = brw_get_shader_time_index(brw, prog, &fp->Base, ST_FS16);
- }
-
/* Now the main event: Visit the shader IR and generate our FS IR for it.
*/
fs_visitor v(brw->intelScreen->compiler, brw, mem_ctx, key,
- &prog_data->base, &fp->Base, fp->Base.nir, 8, st_index8);
+ &prog_data->base, &fp->Base, fp->Base.nir, 8, shader_time_index8);
if (!v.run_fs(false /* do_rep_send */)) {
if (prog) {
prog->LinkStatus = false;
@@ -5151,7 +5162,7 @@ brw_wm_fs_emit(struct brw_context *brw,
cfg_t *simd16_cfg = NULL;
fs_visitor v2(brw->intelScreen->compiler, brw, mem_ctx, key,
- &prog_data->base, &fp->Base, fp->Base.nir, 16, st_index16);
+ &prog_data->base, &fp->Base, fp->Base.nir, 16, shader_time_index16);
if (likely(!(INTEL_DEBUG & DEBUG_NO16) || brw->use_rep_send)) {
if (!v.simd16_unsupported) {
/* Try a SIMD16 compile */
@@ -5198,6 +5209,42 @@ brw_wm_fs_emit(struct brw_context *brw,
return g.get_assembly(final_assembly_size);
}
+void
+brw_cs_fill_local_id_payload(const struct brw_cs_prog_data *prog_data,
+ void *buffer, uint32_t threads, uint32_t stride)
+{
+ if (prog_data->local_invocation_id_regs == 0)
+ return;
+
+ /* 'stride' should be an integer number of registers, that is, a multiple
+ * of 32 bytes.
+ */
+ assert(stride % 32 == 0);
+
+ unsigned x = 0, y = 0, z = 0;
+ for (unsigned t = 0; t < threads; t++) {
+ uint32_t *param = (uint32_t *) buffer + stride * t / 4;
+
+ for (unsigned i = 0; i < prog_data->simd_size; i++) {
+ param[0 * prog_data->simd_size + i] = x;
+ param[1 * prog_data->simd_size + i] = y;
+ param[2 * prog_data->simd_size + i] = z;
+
+ x++;
+ if (x == prog_data->local_size[0]) {
+ x = 0;
+ y++;
+ if (y == prog_data->local_size[1]) {
+ y = 0;
+ z++;
+ if (z == prog_data->local_size[2])
+ z = 0;
+ }
+ }
+ }
+ }
+}
+
fs_reg *
fs_visitor::emit_cs_local_invocation_id_setup()
{
@@ -5242,43 +5289,35 @@ brw_cs_emit(struct brw_context *brw,
struct brw_cs_prog_data *prog_data,
struct gl_compute_program *cp,
struct gl_shader_program *prog,
+ int shader_time_index,
unsigned *final_assembly_size)
{
- struct brw_shader *shader =
- (struct brw_shader *) prog->_LinkedShaders[MESA_SHADER_COMPUTE];
-
- if (unlikely(INTEL_DEBUG & DEBUG_CS))
- brw_dump_ir("compute", prog, &shader->base, &cp->Base);
-
prog_data->local_size[0] = cp->LocalSize[0];
prog_data->local_size[1] = cp->LocalSize[1];
prog_data->local_size[2] = cp->LocalSize[2];
unsigned local_workgroup_size =
cp->LocalSize[0] * cp->LocalSize[1] * cp->LocalSize[2];
+ unsigned max_cs_threads = brw->intelScreen->compiler->devinfo->max_cs_threads;
cfg_t *cfg = NULL;
const char *fail_msg = NULL;
- int st_index = -1;
- if (INTEL_DEBUG & DEBUG_SHADER_TIME)
- st_index = brw_get_shader_time_index(brw, prog, &cp->Base, ST_CS);
-
/* Now the main event: Visit the shader IR and generate our CS IR for it.
*/
fs_visitor v8(brw->intelScreen->compiler, brw, mem_ctx, key,
- &prog_data->base, &cp->Base, cp->Base.nir, 8, st_index);
+ &prog_data->base, &cp->Base, cp->Base.nir, 8, shader_time_index);
if (!v8.run_cs()) {
fail_msg = v8.fail_msg;
- } else if (local_workgroup_size <= 8 * brw->max_cs_threads) {
+ } else if (local_workgroup_size <= 8 * max_cs_threads) {
cfg = v8.cfg;
prog_data->simd_size = 8;
}
fs_visitor v16(brw->intelScreen->compiler, brw, mem_ctx, key,
- &prog_data->base, &cp->Base, cp->Base.nir, 16, st_index);
+ &prog_data->base, &cp->Base, cp->Base.nir, 16, shader_time_index);
if (likely(!(INTEL_DEBUG & DEBUG_NO16)) &&
!fail_msg && !v8.simd16_unsupported &&
- local_workgroup_size <= 16 * brw->max_cs_threads) {
+ local_workgroup_size <= 16 * max_cs_threads) {
/* Try a SIMD16 compile */
v16.import_uniforms(&v8);
if (!v16.run_cs()) {
diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
index 6900cee86f4..c3a037be4b1 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
@@ -30,8 +30,6 @@
#include "glsl/glsl_types.h"
#include "glsl/ir_optimization.h"
-#define FIRST_SPILL_MRF(gen) (gen == 6 ? 21 : 13)
-
using namespace brw;
static void
diff --git a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
index d190d8eb6b4..8613725f6b9 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
@@ -155,18 +155,6 @@ fs_visitor::opt_peephole_sel()
if (movs == 0)
continue;
- enum brw_predicate predicate;
- bool predicate_inverse;
- if (devinfo->gen == 6 && if_inst->conditional_mod) {
- /* For Sandybridge with IF with embedded comparison */
- predicate = BRW_PREDICATE_NORMAL;
- predicate_inverse = false;
- } else {
- /* Separate CMP and IF instructions */
- predicate = if_inst->predicate;
- predicate_inverse = if_inst->predicate_inverse;
- }
-
/* Generate SEL instructions for pairs of MOVs to a common destination. */
for (int i = 0; i < movs; i++) {
if (!then_mov[i] || !else_mov[i])
@@ -195,13 +183,6 @@ fs_visitor::opt_peephole_sel()
if (movs == 0)
continue;
- /* Emit a CMP if our IF used the embedded comparison */
- if (devinfo->gen == 6 && if_inst->conditional_mod) {
- const fs_builder ibld(this, block, if_inst);
- ibld.CMP(ibld.null_reg_d(), if_inst->src[0], if_inst->src[1],
- if_inst->conditional_mod);
- }
-
for (int i = 0; i < movs; i++) {
const fs_builder ibld = fs_builder(this, then_block, then_mov[i])
.at(block, if_inst);
@@ -220,7 +201,7 @@ fs_visitor::opt_peephole_sel()
ibld.MOV(src0, then_mov[i]->src[0]);
}
- set_predicate_inv(predicate, predicate_inverse,
+ set_predicate_inv(if_inst->predicate, if_inst->predicate_inverse,
ibld.SEL(then_mov[i]->dst, src0,
else_mov[i]->src[0]));
}
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index 4d0b125ffe4..e0165fb4a23 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -52,22 +52,17 @@ assign_gs_binding_table_offsets(const struct brw_device_info *devinfo,
}
bool
-brw_compile_gs_prog(struct brw_context *brw,
+brw_codegen_gs_prog(struct brw_context *brw,
struct gl_shader_program *prog,
struct brw_geometry_program *gp,
- struct brw_gs_prog_key *key,
- struct brw_gs_compile_output *output)
+ struct brw_gs_prog_key *key)
{
+ struct brw_stage_state *stage_state = &brw->gs.base;
struct brw_gs_compile c;
memset(&c, 0, sizeof(c));
c.key = *key;
c.gp = gp;
- /* We get the bind map as input in the output struct...*/
- c.prog_data.base.base.map_entries = output->prog_data.base.base.map_entries;
- memcpy(c.prog_data.base.base.bind_map, output->prog_data.base.base.bind_map,
- sizeof(c.prog_data.base.base.bind_map));
-
c.prog_data.include_primitive_id =
(gp->program.Base.InputsRead & VARYING_BIT_PRIMITIVE_ID) != 0;
@@ -296,48 +291,35 @@ brw_compile_gs_prog(struct brw_context *brw,
*/
c.prog_data.base.urb_read_length = (c.input_vue_map.num_slots + 1) / 2;
+ if (unlikely(INTEL_DEBUG & DEBUG_GS))
+ brw_dump_ir("geometry", prog, gs, NULL);
+
+ int st_index = -1;
+ if (INTEL_DEBUG & DEBUG_SHADER_TIME)
+ st_index = brw_get_shader_time_index(brw, prog, NULL, ST_GS);
+
void *mem_ctx = ralloc_context(NULL);
unsigned program_size;
const unsigned *program =
- brw_gs_emit(brw, prog, &c, mem_ctx, &program_size);
+ brw_gs_emit(brw, prog, &c, mem_ctx, st_index, &program_size);
if (program == NULL) {
ralloc_free(mem_ctx);
return false;
}
- output->mem_ctx = mem_ctx;
- output->program = program;
- output->program_size = program_size;
- memcpy(&output->prog_data, &c.prog_data,
- sizeof(output->prog_data));
-
- return true;
-}
-
-bool
-brw_codegen_gs_prog(struct brw_context *brw,
- struct gl_shader_program *prog,
- struct brw_geometry_program *gp,
- struct brw_gs_prog_key *key)
-{
- struct brw_gs_compile_output output;
- struct brw_stage_state *stage_state = &brw->gs.base;
-
- if (brw_compile_gs_prog(brw, prog, gp, key, &output))
- return false;
-
- if (output.prog_data.base.base.total_scratch) {
+ /* Scratch space is used for register spilling */
+ if (c.prog_data.base.base.total_scratch) {
brw_get_scratch_bo(brw, &stage_state->scratch_bo,
- output.prog_data.base.base.total_scratch *
+ c.prog_data.base.base.total_scratch *
brw->max_gs_threads);
}
brw_upload_cache(&brw->cache, BRW_CACHE_GS_PROG,
- key, sizeof(*key),
- output.program, output.program_size,
- &output.prog_data, sizeof(output.prog_data),
+ &c.key, sizeof(c.key),
+ program, program_size,
+ &c.prog_data, sizeof(c.prog_data),
&stage_state->prog_offset, &brw->gs.prog_data);
- ralloc_free(output.mem_ctx);
+ ralloc_free(mem_ctx);
return true;
}
diff --git a/src/mesa/drivers/dri/i965/brw_gs.h b/src/mesa/drivers/dri/i965/brw_gs.h
index 573bbdb16f8..9879f3d6464 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.h
+++ b/src/mesa/drivers/dri/i965/brw_gs.h
@@ -37,24 +37,6 @@ struct gl_context;
struct gl_shader_program;
struct gl_program;
-struct brw_gs_compile_output {
- void *mem_ctx;
- const void *program;
- uint32_t program_size;
- struct brw_gs_prog_data prog_data;
-};
-
-struct brw_gs_prog_key;
-
-bool
-brw_compile_gs_prog(struct brw_context *brw,
- struct gl_shader_program *prog,
- struct brw_geometry_program *gp,
- struct brw_gs_prog_key *key,
- struct brw_gs_compile_output *output);
-
-bool brw_gs_prog_data_compare(const void *a, const void *b);
-
void
brw_upload_gs_prog(struct brw_context *brw);
diff --git a/src/mesa/drivers/dri/i965/brw_inst.h b/src/mesa/drivers/dri/i965/brw_inst.h
index c5132ba15ed..ab37b709d65 100644
--- a/src/mesa/drivers/dri/i965/brw_inst.h
+++ b/src/mesa/drivers/dri/i965/brw_inst.h
@@ -42,6 +42,12 @@ extern "C" {
/** Maximum SEND message length */
#define BRW_MAX_MSG_LENGTH 15
+/** First MRF register used by pull loads */
+#define FIRST_SPILL_MRF(gen) ((gen) == 6 ? 21 : 13)
+
+/** First MRF register used by spills */
+#define FIRST_PULL_LOAD_MRF(gen) ((gen) == 6 ? 16 : 13)
+
/* brw_context.h has a forward declaration of brw_inst, so name the struct. */
typedef struct brw_inst {
uint64_t data[2];
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
new file mode 100644
index 00000000000..fc9bee43d80
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -0,0 +1,280 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * 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 NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS 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 "main/macros.h"
+#include "brw_context.h"
+#include "brw_vs.h"
+#include "brw_gs.h"
+#include "brw_fs.h"
+#include "brw_cfg.h"
+#include "brw_nir.h"
+#include "glsl/ir_optimization.h"
+#include "glsl/glsl_parser_extras.h"
+#include "main/shaderapi.h"
+
+/**
+ * Performs a compile of the shader stages even when we don't know
+ * what non-orthogonal state will be set, in the hope that it reflects
+ * the eventual NOS used, and thus allows us to produce link failures.
+ */
+static bool
+brw_shader_precompile(struct gl_context *ctx,
+ struct gl_shader_program *sh_prog)
+{
+ struct gl_shader *vs = sh_prog->_LinkedShaders[MESA_SHADER_VERTEX];
+ struct gl_shader *gs = sh_prog->_LinkedShaders[MESA_SHADER_GEOMETRY];
+ struct gl_shader *fs = sh_prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
+ struct gl_shader *cs = sh_prog->_LinkedShaders[MESA_SHADER_COMPUTE];
+
+ if (fs && !brw_fs_precompile(ctx, sh_prog, fs->Program))
+ return false;
+
+ if (gs && !brw_gs_precompile(ctx, sh_prog, gs->Program))
+ return false;
+
+ if (vs && !brw_vs_precompile(ctx, sh_prog, vs->Program))
+ return false;
+
+ if (cs && !brw_cs_precompile(ctx, sh_prog, cs->Program))
+ return false;
+
+ return true;
+}
+
+static void
+brw_lower_packing_builtins(struct brw_context *brw,
+ gl_shader_stage shader_type,
+ exec_list *ir)
+{
+ int ops = LOWER_PACK_SNORM_2x16
+ | LOWER_UNPACK_SNORM_2x16
+ | LOWER_PACK_UNORM_2x16
+ | LOWER_UNPACK_UNORM_2x16;
+
+ if (is_scalar_shader_stage(brw->intelScreen->compiler, shader_type)) {
+ ops |= LOWER_UNPACK_UNORM_4x8
+ | LOWER_UNPACK_SNORM_4x8
+ | LOWER_PACK_UNORM_4x8
+ | LOWER_PACK_SNORM_4x8;
+ }
+
+ if (brw->gen >= 7) {
+ /* Gen7 introduced the f32to16 and f16to32 instructions, which can be
+ * used to execute packHalf2x16 and unpackHalf2x16. For AOS code, no
+ * lowering is needed. For SOA code, the Half2x16 ops must be
+ * scalarized.
+ */
+ if (is_scalar_shader_stage(brw->intelScreen->compiler, shader_type)) {
+ ops |= LOWER_PACK_HALF_2x16_TO_SPLIT
+ | LOWER_UNPACK_HALF_2x16_TO_SPLIT;
+ }
+ } else {
+ ops |= LOWER_PACK_HALF_2x16
+ | LOWER_UNPACK_HALF_2x16;
+ }
+
+ lower_packing_builtins(ir, ops);
+}
+
+static void
+process_glsl_ir(gl_shader_stage stage,
+ struct brw_context *brw,
+ struct gl_shader_program *shader_prog,
+ struct gl_shader *shader)
+{
+ struct gl_context *ctx = &brw->ctx;
+ const struct gl_shader_compiler_options *options =
+ &ctx->Const.ShaderCompilerOptions[shader->Stage];
+
+ /* Temporary memory context for any new IR. */
+ void *mem_ctx = ralloc_context(NULL);
+
+ ralloc_adopt(mem_ctx, shader->ir);
+
+ /* lower_packing_builtins() inserts arithmetic instructions, so it
+ * must precede lower_instructions().
+ */
+ brw_lower_packing_builtins(brw, shader->Stage, shader->ir);
+ do_mat_op_to_vec(shader->ir);
+ const int bitfield_insert = brw->gen >= 7 ? BITFIELD_INSERT_TO_BFM_BFI : 0;
+ lower_instructions(shader->ir,
+ MOD_TO_FLOOR |
+ DIV_TO_MUL_RCP |
+ SUB_TO_ADD_NEG |
+ EXP_TO_EXP2 |
+ LOG_TO_LOG2 |
+ bitfield_insert |
+ LDEXP_TO_ARITH |
+ CARRY_TO_ARITH |
+ BORROW_TO_ARITH);
+
+ /* Pre-gen6 HW can only nest if-statements 16 deep. Beyond this,
+ * if-statements need to be flattened.
+ */
+ if (brw->gen < 6)
+ lower_if_to_cond_assign(shader->ir, 16);
+
+ do_lower_texture_projection(shader->ir);
+ brw_lower_texture_gradients(brw, shader->ir);
+ do_vec_index_to_cond_assign(shader->ir);
+ lower_vector_insert(shader->ir, true);
+ lower_offset_arrays(shader->ir);
+ brw_do_lower_unnormalized_offset(shader->ir);
+ lower_noise(shader->ir);
+ lower_quadop_vector(shader->ir, false);
+
+ bool lowered_variable_indexing =
+ lower_variable_index_to_cond_assign((gl_shader_stage)stage,
+ shader->ir,
+ options->EmitNoIndirectInput,
+ options->EmitNoIndirectOutput,
+ options->EmitNoIndirectTemp,
+ options->EmitNoIndirectUniform);
+
+ if (unlikely(brw->perf_debug && lowered_variable_indexing)) {
+ perf_debug("Unsupported form of variable indexing in %s; falling "
+ "back to very inefficient code generation\n",
+ _mesa_shader_stage_to_abbrev(shader->Stage));
+ }
+
+ lower_ubo_reference(shader, shader->ir);
+
+ bool progress;
+ do {
+ progress = false;
+
+ if (is_scalar_shader_stage(brw->intelScreen->compiler, shader->Stage)) {
+ brw_do_channel_expressions(shader->ir);
+ brw_do_vector_splitting(shader->ir);
+ }
+
+ progress = do_lower_jumps(shader->ir, true, true,
+ true, /* main return */
+ false, /* continue */
+ false /* loops */
+ ) || progress;
+
+ progress = do_common_optimization(shader->ir, true, true,
+ options, ctx->Const.NativeIntegers) || progress;
+ } while (progress);
+
+ validate_ir_tree(shader->ir);
+
+ /* Now that we've finished altering the linked IR, reparent any live IR back
+ * to the permanent memory context, and free the temporary one (discarding any
+ * junk we optimized away).
+ */
+ reparent_ir(shader->ir, shader->ir);
+ ralloc_free(mem_ctx);
+
+ if (ctx->_Shader->Flags & GLSL_DUMP) {
+ fprintf(stderr, "\n");
+ fprintf(stderr, "GLSL IR for linked %s program %d:\n",
+ _mesa_shader_stage_to_string(shader->Stage),
+ shader_prog->Name);
+ _mesa_print_ir(stderr, shader->ir, NULL);
+ fprintf(stderr, "\n");
+ }
+}
+
+GLboolean
+brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
+{
+ struct brw_context *brw = brw_context(ctx);
+ const struct brw_compiler *compiler = brw->intelScreen->compiler;
+ unsigned int stage;
+
+ for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) {
+ struct gl_shader *shader = shProg->_LinkedShaders[stage];
+ if (!shader)
+ continue;
+
+ struct gl_program *prog =
+ ctx->Driver.NewProgram(ctx, _mesa_shader_stage_to_program(stage),
+ shader->Name);
+ if (!prog)
+ return false;
+ prog->Parameters = _mesa_new_parameter_list();
+
+ _mesa_copy_linked_program_data((gl_shader_stage) stage, shProg, prog);
+
+ process_glsl_ir((gl_shader_stage) stage, brw, shProg, shader);
+
+ /* Make a pass over the IR to add state references for any built-in
+ * uniforms that are used. This has to be done now (during linking).
+ * Code generation doesn't happen until the first time this shader is
+ * used for rendering. Waiting until then to generate the parameters is
+ * too late. At that point, the values for the built-in uniforms won't
+ * get sent to the shader.
+ */
+ foreach_in_list(ir_instruction, node, shader->ir) {
+ ir_variable *var = node->as_variable();
+
+ if ((var == NULL) || (var->data.mode != ir_var_uniform)
+ || (strncmp(var->name, "gl_", 3) != 0))
+ continue;
+
+ const ir_state_slot *const slots = var->get_state_slots();
+ assert(slots != NULL);
+
+ for (unsigned int i = 0; i < var->get_num_state_slots(); i++) {
+ _mesa_add_state_reference(prog->Parameters,
+ (gl_state_index *) slots[i].tokens);
+ }
+ }
+
+ do_set_program_inouts(shader->ir, prog, shader->Stage);
+
+ prog->SamplersUsed = shader->active_samplers;
+ prog->ShadowSamplers = shader->shadow_samplers;
+ _mesa_update_shader_textures_used(shProg, prog);
+
+ _mesa_reference_program(ctx, &shader->Program, prog);
+
+ brw_add_texrect_params(prog);
+
+ prog->nir = brw_create_nir(brw, shProg, prog, (gl_shader_stage) stage,
+ is_scalar_shader_stage(compiler, stage));
+
+ _mesa_reference_program(ctx, &prog, NULL);
+ }
+
+ if ((ctx->_Shader->Flags & GLSL_DUMP) && shProg->Name != 0) {
+ for (unsigned i = 0; i < shProg->NumShaders; i++) {
+ const struct gl_shader *sh = shProg->Shaders[i];
+ if (!sh)
+ continue;
+
+ fprintf(stderr, "GLSL %s shader %d source for linked program %d:\n",
+ _mesa_shader_stage_to_string(sh->Stage),
+ i, shProg->Name);
+ fprintf(stderr, "%s", sh->Source);
+ fprintf(stderr, "\n");
+ }
+ }
+
+ if (brw->precompile && !brw_shader_precompile(ctx, shProg))
+ return false;
+
+ return true;
+}
diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c
index 7d17edb9023..cf6ba5b4aeb 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -887,14 +887,6 @@ brw_upload_invariant_state(struct brw_context *brw)
brw_emit_select_pipeline(brw, BRW_RENDER_PIPELINE);
brw->last_pipeline = BRW_RENDER_PIPELINE;
- if (brw->gen < 6) {
- /* Disable depth offset clamping. */
- BEGIN_BATCH(2);
- OUT_BATCH(_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP << 16 | (2 - 2));
- OUT_BATCH_F(0.0);
- ADVANCE_BATCH();
- }
-
if (brw->gen >= 8) {
BEGIN_BATCH(3);
OUT_BATCH(CMD_STATE_SIP << 16 | (3 - 2));
diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
index 7ab6afa8458..19206600e64 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -30,8 +30,17 @@
static void
brw_nir_lower_inputs(nir_shader *nir, bool is_scalar)
{
- nir_assign_var_locations(&nir->inputs, &nir->num_inputs,
- is_scalar ? type_size_scalar : type_size_vec4);
+ switch (nir->stage) {
+ case MESA_SHADER_GEOMETRY:
+ foreach_list_typed(nir_variable, var, node, &nir->inputs) {
+ var->data.driver_location = var->data.location;
+ }
+ break;
+ default:
+ nir_assign_var_locations(&nir->inputs, &nir->num_inputs,
+ is_scalar ? type_size_scalar : type_size_vec4);
+ break;
+ }
}
static void
diff --git a/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp b/src/mesa/drivers/dri/i965/brw_predicated_break.cpp
index b75f40ba5a1..607715dace4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
+++ b/src/mesa/drivers/dri/i965/brw_predicated_break.cpp
@@ -21,12 +21,11 @@
* IN THE SOFTWARE.
*/
-#include "brw_fs.h"
#include "brw_cfg.h"
using namespace brw;
-/** @file brw_fs_peephole_predicated_break.cpp
+/** @file brw_predicated_break.cpp
*
* Loops are often structured as
*
@@ -55,27 +54,27 @@ using namespace brw;
*/
bool
-fs_visitor::opt_peephole_predicated_break()
+opt_predicated_break(backend_shader *s)
{
bool progress = false;
- foreach_block (block, cfg) {
+ foreach_block (block, s->cfg) {
if (block->start_ip != block->end_ip)
continue;
/* BREAK and CONTINUE instructions, by definition, can only be found at
* the ends of basic blocks.
*/
- fs_inst *jump_inst = (fs_inst *)block->end();
+ backend_instruction *jump_inst = block->end();
if (jump_inst->opcode != BRW_OPCODE_BREAK &&
jump_inst->opcode != BRW_OPCODE_CONTINUE)
continue;
- fs_inst *if_inst = (fs_inst *)block->prev()->end();
+ backend_instruction *if_inst = block->prev()->end();
if (if_inst->opcode != BRW_OPCODE_IF)
continue;
- fs_inst *endif_inst = (fs_inst *)block->next()->start();
+ backend_instruction *endif_inst = block->next()->start();
if (endif_inst->opcode != BRW_OPCODE_ENDIF)
continue;
@@ -83,18 +82,8 @@ fs_visitor::opt_peephole_predicated_break()
bblock_t *if_block = jump_block->prev();
bblock_t *endif_block = jump_block->next();
- /* For Sandybridge with IF with embedded comparison we need to emit an
- * instruction to set the flag register.
- */
- if (devinfo->gen == 6 && if_inst->conditional_mod) {
- const fs_builder ibld(this, if_block, if_inst);
- ibld.CMP(ibld.null_reg_d(), if_inst->src[0], if_inst->src[1],
- if_inst->conditional_mod);
- jump_inst->predicate = BRW_PREDICATE_NORMAL;
- } else {
- jump_inst->predicate = if_inst->predicate;
- jump_inst->predicate_inverse = if_inst->predicate_inverse;
- }
+ jump_inst->predicate = if_inst->predicate;
+ jump_inst->predicate_inverse = if_inst->predicate_inverse;
bblock_t *earlier_block = if_block;
if (if_block->start_ip == if_block->end_ip) {
@@ -111,13 +100,13 @@ fs_visitor::opt_peephole_predicated_break()
if (!earlier_block->ends_with_control_flow()) {
earlier_block->children.make_empty();
- earlier_block->add_successor(cfg->mem_ctx, jump_block);
+ earlier_block->add_successor(s->cfg->mem_ctx, jump_block);
}
if (!later_block->starts_with_control_flow()) {
later_block->parents.make_empty();
}
- jump_block->add_successor(cfg->mem_ctx, later_block);
+ jump_block->add_successor(s->cfg->mem_ctx, later_block);
if (earlier_block->can_combine_with(jump_block)) {
earlier_block->combine_with(jump_block);
@@ -130,7 +119,7 @@ fs_visitor::opt_peephole_predicated_break()
* the two basic blocks.
*/
bblock_t *while_block = earlier_block->next();
- fs_inst *while_inst = (fs_inst *)while_block->start();
+ backend_instruction *while_inst = while_block->start();
if (jump_inst->opcode == BRW_OPCODE_BREAK &&
while_inst->opcode == BRW_OPCODE_WHILE &&
@@ -140,20 +129,20 @@ fs_visitor::opt_peephole_predicated_break()
while_inst->predicate_inverse = !jump_inst->predicate_inverse;
earlier_block->children.make_empty();
- earlier_block->add_successor(cfg->mem_ctx, while_block);
+ earlier_block->add_successor(s->cfg->mem_ctx, while_block);
assert(earlier_block->can_combine_with(while_block));
earlier_block->combine_with(while_block);
earlier_block->next()->parents.make_empty();
- earlier_block->add_successor(cfg->mem_ctx, earlier_block->next());
+ earlier_block->add_successor(s->cfg->mem_ctx, earlier_block->next());
}
progress = true;
}
if (progress)
- invalidate_live_intervals();
+ s->invalidate_live_intervals();
return progress;
}
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 0a9a99edf2d..dbd0e50228b 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -242,18 +242,6 @@ brw_add_texrect_params(struct gl_program *prog)
}
}
-/* Per-thread scratch space is a power-of-two multiple of 1KB. */
-int
-brw_get_scratch_size(int size)
-{
- int i;
-
- for (i = 1024; i < size; i *= 2)
- ;
-
- return i;
-}
-
void
brw_get_scratch_bo(struct brw_context *brw,
drm_intel_bo **scratch_bo, int size)
@@ -531,16 +519,6 @@ brw_destroy_shader_time(struct brw_context *brw)
}
void
-brw_mark_surface_used(struct brw_stage_prog_data *prog_data,
- unsigned surf_index)
-{
- assert(surf_index < BRW_MAX_SURFACES);
-
- prog_data->binding_table.size_bytes =
- MAX2(prog_data->binding_table.size_bytes, (surf_index + 1) * 4);
-}
-
-void
brw_stage_prog_data_free(const void *p)
{
struct brw_stage_prog_data *prog_data = (struct brw_stage_prog_data *)p;
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 8bc7d9d6aac..3a58a58a00b 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -72,7 +72,7 @@ shader_perf_log_mesa(void *data, const char *fmt, ...)
va_end(args);
}
-static bool
+bool
is_scalar_shader_stage(const struct brw_compiler *compiler, int stage)
{
switch (stage) {
@@ -166,254 +166,16 @@ brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type)
return &shader->base;
}
-/**
- * Performs a compile of the shader stages even when we don't know
- * what non-orthogonal state will be set, in the hope that it reflects
- * the eventual NOS used, and thus allows us to produce link failures.
- */
-static bool
-brw_shader_precompile(struct gl_context *ctx,
- struct gl_shader_program *sh_prog)
-{
- struct gl_shader *vs = sh_prog->_LinkedShaders[MESA_SHADER_VERTEX];
- struct gl_shader *gs = sh_prog->_LinkedShaders[MESA_SHADER_GEOMETRY];
- struct gl_shader *fs = sh_prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
- struct gl_shader *cs = sh_prog->_LinkedShaders[MESA_SHADER_COMPUTE];
-
- if (fs && !brw_fs_precompile(ctx, sh_prog, fs->Program))
- return false;
-
- if (gs && !brw_gs_precompile(ctx, sh_prog, gs->Program))
- return false;
-
- if (vs && !brw_vs_precompile(ctx, sh_prog, vs->Program))
- return false;
-
- if (cs && !brw_cs_precompile(ctx, sh_prog, cs->Program))
- return false;
-
- return true;
-}
-
-static void
-brw_lower_packing_builtins(struct brw_context *brw,
- gl_shader_stage shader_type,
- exec_list *ir)
-{
- int ops = LOWER_PACK_SNORM_2x16
- | LOWER_UNPACK_SNORM_2x16
- | LOWER_PACK_UNORM_2x16
- | LOWER_UNPACK_UNORM_2x16;
-
- if (is_scalar_shader_stage(brw->intelScreen->compiler, shader_type)) {
- ops |= LOWER_UNPACK_UNORM_4x8
- | LOWER_UNPACK_SNORM_4x8
- | LOWER_PACK_UNORM_4x8
- | LOWER_PACK_SNORM_4x8;
- }
-
- if (brw->gen >= 7) {
- /* Gen7 introduced the f32to16 and f16to32 instructions, which can be
- * used to execute packHalf2x16 and unpackHalf2x16. For AOS code, no
- * lowering is needed. For SOA code, the Half2x16 ops must be
- * scalarized.
- */
- if (is_scalar_shader_stage(brw->intelScreen->compiler, shader_type)) {
- ops |= LOWER_PACK_HALF_2x16_TO_SPLIT
- | LOWER_UNPACK_HALF_2x16_TO_SPLIT;
- }
- } else {
- ops |= LOWER_PACK_HALF_2x16
- | LOWER_UNPACK_HALF_2x16;
- }
-
- lower_packing_builtins(ir, ops);
-}
-
-static void
-process_glsl_ir(gl_shader_stage stage,
- struct brw_context *brw,
- struct gl_shader_program *shader_prog,
- struct gl_shader *shader)
-{
- struct gl_context *ctx = &brw->ctx;
- const struct gl_shader_compiler_options *options =
- &ctx->Const.ShaderCompilerOptions[shader->Stage];
-
- /* Temporary memory context for any new IR. */
- void *mem_ctx = ralloc_context(NULL);
-
- ralloc_adopt(mem_ctx, shader->ir);
-
- /* lower_packing_builtins() inserts arithmetic instructions, so it
- * must precede lower_instructions().
- */
- brw_lower_packing_builtins(brw, shader->Stage, shader->ir);
- do_mat_op_to_vec(shader->ir);
- const int bitfield_insert = brw->gen >= 7 ? BITFIELD_INSERT_TO_BFM_BFI : 0;
- lower_instructions(shader->ir,
- MOD_TO_FLOOR |
- DIV_TO_MUL_RCP |
- SUB_TO_ADD_NEG |
- EXP_TO_EXP2 |
- LOG_TO_LOG2 |
- bitfield_insert |
- LDEXP_TO_ARITH |
- CARRY_TO_ARITH |
- BORROW_TO_ARITH);
-
- /* Pre-gen6 HW can only nest if-statements 16 deep. Beyond this,
- * if-statements need to be flattened.
- */
- if (brw->gen < 6)
- lower_if_to_cond_assign(shader->ir, 16);
-
- do_lower_texture_projection(shader->ir);
- brw_lower_texture_gradients(brw, shader->ir);
- do_vec_index_to_cond_assign(shader->ir);
- lower_vector_insert(shader->ir, true);
- lower_offset_arrays(shader->ir);
- brw_do_lower_unnormalized_offset(shader->ir);
- lower_noise(shader->ir);
- lower_quadop_vector(shader->ir, false);
-
- bool lowered_variable_indexing =
- lower_variable_index_to_cond_assign((gl_shader_stage)stage,
- shader->ir,
- options->EmitNoIndirectInput,
- options->EmitNoIndirectOutput,
- options->EmitNoIndirectTemp,
- options->EmitNoIndirectUniform);
-
- if (unlikely(brw->perf_debug && lowered_variable_indexing)) {
- perf_debug("Unsupported form of variable indexing in %s; falling "
- "back to very inefficient code generation\n",
- _mesa_shader_stage_to_abbrev(shader->Stage));
- }
-
- lower_ubo_reference(shader, shader->ir);
-
- bool progress;
- do {
- progress = false;
-
- if (is_scalar_shader_stage(brw->intelScreen->compiler, shader->Stage)) {
- brw_do_channel_expressions(shader->ir);
- brw_do_vector_splitting(shader->ir);
- }
-
- progress = do_lower_jumps(shader->ir, true, true,
- true, /* main return */
- false, /* continue */
- false /* loops */
- ) || progress;
-
- progress = do_common_optimization(shader->ir, true, true,
- options, ctx->Const.NativeIntegers) || progress;
- } while (progress);
-
- validate_ir_tree(shader->ir);
-
- /* Now that we've finished altering the linked IR, reparent any live IR back
- * to the permanent memory context, and free the temporary one (discarding any
- * junk we optimized away).
- */
- reparent_ir(shader->ir, shader->ir);
- ralloc_free(mem_ctx);
-
- if (ctx->_Shader->Flags & GLSL_DUMP) {
- fprintf(stderr, "\n");
- fprintf(stderr, "GLSL IR for linked %s program %d:\n",
- _mesa_shader_stage_to_string(shader->Stage),
- shader_prog->Name);
- _mesa_print_ir(stderr, shader->ir, NULL);
- fprintf(stderr, "\n");
- }
-}
-
-GLboolean
-brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
+void
+brw_mark_surface_used(struct brw_stage_prog_data *prog_data,
+ unsigned surf_index)
{
- struct brw_context *brw = brw_context(ctx);
- const struct brw_compiler *compiler = brw->intelScreen->compiler;
- unsigned int stage;
-
- for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) {
- struct gl_shader *shader = shProg->_LinkedShaders[stage];
- if (!shader)
- continue;
-
- struct gl_program *prog =
- ctx->Driver.NewProgram(ctx, _mesa_shader_stage_to_program(stage),
- shader->Name);
- if (!prog)
- return false;
- prog->Parameters = _mesa_new_parameter_list();
-
- _mesa_copy_linked_program_data((gl_shader_stage) stage, shProg, prog);
-
- process_glsl_ir((gl_shader_stage) stage, brw, shProg, shader);
-
- /* Make a pass over the IR to add state references for any built-in
- * uniforms that are used. This has to be done now (during linking).
- * Code generation doesn't happen until the first time this shader is
- * used for rendering. Waiting until then to generate the parameters is
- * too late. At that point, the values for the built-in uniforms won't
- * get sent to the shader.
- */
- foreach_in_list(ir_instruction, node, shader->ir) {
- ir_variable *var = node->as_variable();
-
- if ((var == NULL) || (var->data.mode != ir_var_uniform)
- || (strncmp(var->name, "gl_", 3) != 0))
- continue;
-
- const ir_state_slot *const slots = var->get_state_slots();
- assert(slots != NULL);
-
- for (unsigned int i = 0; i < var->get_num_state_slots(); i++) {
- _mesa_add_state_reference(prog->Parameters,
- (gl_state_index *) slots[i].tokens);
- }
- }
-
- do_set_program_inouts(shader->ir, prog, shader->Stage);
-
- prog->SamplersUsed = shader->active_samplers;
- prog->ShadowSamplers = shader->shadow_samplers;
- _mesa_update_shader_textures_used(shProg, prog);
-
- _mesa_reference_program(ctx, &shader->Program, prog);
-
- brw_add_texrect_params(prog);
+ assert(surf_index < BRW_MAX_SURFACES);
- prog->nir = brw_create_nir(brw, shProg, prog, (gl_shader_stage) stage,
- is_scalar_shader_stage(compiler, stage));
-
- _mesa_reference_program(ctx, &prog, NULL);
- }
-
- if ((ctx->_Shader->Flags & GLSL_DUMP) && shProg->Name != 0) {
- for (unsigned i = 0; i < shProg->NumShaders; i++) {
- const struct gl_shader *sh = shProg->Shaders[i];
- if (!sh)
- continue;
-
- fprintf(stderr, "GLSL %s shader %d source for linked program %d:\n",
- _mesa_shader_stage_to_string(sh->Stage),
- i, shProg->Name);
- fprintf(stderr, "%s", sh->Source);
- fprintf(stderr, "\n");
- }
- }
-
- if (brw->precompile && !brw_shader_precompile(ctx, shProg))
- return false;
-
- return true;
+ prog_data->binding_table.size_bytes =
+ MAX2(prog_data->binding_table.size_bytes, (surf_index + 1) * 4);
}
-
enum brw_reg_type
brw_type_for_base_type(const struct glsl_type *type)
{
@@ -1310,13 +1072,15 @@ backend_shader::dump_instructions(const char *name)
if (cfg) {
int ip = 0;
foreach_block_and_inst(block, backend_instruction, inst, cfg) {
- fprintf(file, "%4d: ", ip++);
+ if (!unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER))
+ fprintf(file, "%4d: ", ip++);
dump_instruction(inst, file);
}
} else {
int ip = 0;
foreach_in_list(backend_instruction, inst, &instructions) {
- fprintf(file, "%4d: ", ip++);
+ if (!unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER))
+ fprintf(file, "%4d: ", ip++);
dump_instruction(inst, file);
}
}
@@ -1367,6 +1131,7 @@ brw_assign_common_binding_table_offsets(gl_shader_stage stage,
next_binding_table_offset += num_textures;
if (shader) {
+ assert(shader->NumUniformBlocks <= BRW_MAX_COMBINED_UBO_SSBO);
stage_prog_data->binding_table.ubo_start = next_binding_table_offset;
next_binding_table_offset += shader->NumUniformBlocks;
} else {
@@ -1439,7 +1204,7 @@ brw_setup_image_uniform_values(gl_shader_stage stage,
&stage_prog_data->param[param_start_index];
for (unsigned i = 0; i < MAX2(storage->array_elements, 1); i++) {
- const unsigned image_idx = storage->image[stage].index + i;
+ const unsigned image_idx = storage->opaque[stage].index + i;
const brw_image_param *image_param =
&stage_prog_data->image_param[image_idx];
@@ -1465,3 +1230,29 @@ brw_setup_image_uniform_values(gl_shader_stage stage,
stage_prog_data->binding_table.image_start + image_idx);
}
}
+
+/**
+ * Decide which set of clip planes should be used when clipping via
+ * gl_Position or gl_ClipVertex.
+ */
+gl_clip_plane *brw_select_clip_planes(struct gl_context *ctx)
+{
+ if (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]) {
+ /* There is currently a GLSL vertex shader, so clip according to GLSL
+ * rules, which means compare gl_ClipVertex (or gl_Position, if
+ * gl_ClipVertex wasn't assigned) against the eye-coordinate clip planes
+ * that were stored in EyeUserPlane at the time the clip planes were
+ * specified.
+ */
+ return ctx->Transform.EyeUserPlane;
+ } else {
+ /* Either we are using fixed function or an ARB vertex program. In
+ * either case the clip planes are going to be compared against
+ * gl_Position (which is in clip coordinates) so we have to clip using
+ * _ClipUserPlane, which was transformed into clip coordinates by Mesa
+ * core.
+ */
+ return ctx->Transform._ClipUserPlane;
+ }
+}
+
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index fd96740526b..ad2de5eae2d 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -219,7 +219,7 @@ enum instruction_scheduler_mode {
SCHEDULE_POST,
};
-class backend_shader {
+struct backend_shader {
protected:
backend_shader(const struct brw_compiler *compiler,
@@ -273,6 +273,8 @@ void brw_setup_image_uniform_values(gl_shader_stage stage,
unsigned param_start_index,
const gl_uniform_storage *storage);
+#else
+struct backend_shader;
#endif /* __cplusplus */
enum brw_reg_type brw_type_for_base_type(const struct glsl_type *type);
@@ -283,6 +285,8 @@ bool brw_saturate_immediate(enum brw_reg_type type, struct brw_reg *reg);
bool brw_negate_immediate(enum brw_reg_type type, struct brw_reg *reg);
bool brw_abs_immediate(enum brw_reg_type type, struct brw_reg *reg);
+bool opt_predicated_break(struct backend_shader *s);
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -314,6 +318,8 @@ bool brw_cs_precompile(struct gl_context *ctx,
int type_size_scalar(const struct glsl_type *type);
int type_size_vec4(const struct glsl_type *type);
+bool is_scalar_shader_stage(const struct brw_compiler *compiler, int stage);
+
#ifdef __cplusplus
}
#endif
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 689c767d2d7..e966b96a5ca 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1862,6 +1862,7 @@ vec4_visitor::run()
pass_num = 0;
iteration++;
+ OPT(opt_predicated_break, this);
OPT(opt_reduce_swizzle);
OPT(dead_code_eliminate);
OPT(dead_control_flow_eliminate, this);
@@ -1942,28 +1943,18 @@ brw_vs_emit(struct brw_context *brw,
struct brw_vs_prog_data *prog_data,
struct gl_vertex_program *vp,
struct gl_shader_program *prog,
+ int shader_time_index,
unsigned *final_assembly_size)
{
const unsigned *assembly = NULL;
- struct brw_shader *shader = NULL;
- if (prog)
- shader = (brw_shader *) prog->_LinkedShaders[MESA_SHADER_VERTEX];
-
- int st_index = -1;
- if (INTEL_DEBUG & DEBUG_SHADER_TIME)
- st_index = brw_get_shader_time_index(brw, prog, &vp->Base, ST_VS);
-
- if (unlikely(INTEL_DEBUG & DEBUG_VS) && shader->base.ir)
- brw_dump_ir("vertex", prog, &shader->base, &vp->Base);
-
if (brw->intelScreen->compiler->scalar_vs) {
prog_data->base.dispatch_mode = DISPATCH_MODE_SIMD8;
fs_visitor v(brw->intelScreen->compiler, brw,
mem_ctx, key, &prog_data->base.base,
NULL, /* prog; Only used for TEXTURE_RECTANGLE on gen < 8 */
- vp->Base.nir, 8, st_index);
+ vp->Base.nir, 8, shader_time_index);
if (!v.run_vs(brw_select_clip_planes(&brw->ctx))) {
if (prog) {
prog->LinkStatus = false;
@@ -2001,7 +1992,7 @@ brw_vs_emit(struct brw_context *brw,
vec4_vs_visitor v(brw->intelScreen->compiler, brw, key, prog_data,
vp->Base.nir, brw_select_clip_planes(&brw->ctx),
- mem_ctx, st_index,
+ mem_ctx, shader_time_index,
!_mesa_is_gles3(&brw->ctx));
if (!v.run()) {
if (prog) {
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 51b3161f659..5e3500c0c9a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -76,7 +76,7 @@ public:
void *mem_ctx,
bool no_spills,
int shader_time_index);
- ~vec4_visitor();
+ virtual ~vec4_visitor();
dst_reg dst_null_f()
{
@@ -223,9 +223,6 @@ public:
int implied_mrf_writes(vec4_instruction *inst);
- void emit_vp_sop(enum brw_conditional_mod condmod, dst_reg dst,
- src_reg src0, src_reg src1, src_reg one);
-
vec4_instruction *emit_minmax(enum brw_conditional_mod conditionalmod, dst_reg dst,
src_reg src0, src_reg src1);
@@ -238,11 +235,6 @@ public:
*/
src_reg emit_uniformize(const src_reg &src);
- /**
- * Emit the correct dot-product instruction for the type of arguments
- */
- void emit_dp(dst_reg dst, src_reg src0, src_reg src1, unsigned elements);
-
src_reg fix_3src_operand(const src_reg &src);
src_reg resolve_source_modifiers(const src_reg &src);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
index af4c102c026..1b929b3df2c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_nir.cpp
@@ -29,41 +29,6 @@ namespace brw {
void
vec4_gs_visitor::nir_setup_inputs()
{
- nir_inputs = ralloc_array(mem_ctx, src_reg, nir->num_inputs);
-
- foreach_list_typed(nir_variable, var, node, &nir->inputs) {
- int offset = var->data.driver_location;
- if (var->type->base_type == GLSL_TYPE_ARRAY) {
- /* Geometry shader inputs are arrays, but they use an unusual array
- * layout: instead of all array elements for a given geometry shader
- * input being stored consecutively, all geometry shader inputs are
- * interleaved into one giant array. At this stage of compilation, we
- * assume that the stride of the array is BRW_VARYING_SLOT_COUNT.
- * Later, setup_attributes() will remap our accesses to the actual
- * input array.
- */
- assert(var->type->length > 0);
- int length = var->type->length;
- int size = type_size_vec4(var->type) / length;
- for (int i = 0; i < length; i++) {
- int location = var->data.location + i * BRW_VARYING_SLOT_COUNT;
- for (int j = 0; j < size; j++) {
- src_reg src = src_reg(ATTR, location + j, var->type);
- src = retype(src, brw_type_for_base_type(var->type));
- nir_inputs[offset] = src;
- offset++;
- }
- }
- } else {
- int size = type_size_vec4(var->type);
- for (int i = 0; i < size; i++) {
- src_reg src = src_reg(ATTR, var->data.location + i, var->type);
- src = retype(src, brw_type_for_base_type(var->type));
- nir_inputs[offset] = src;
- offset++;
- }
- }
- }
}
void
@@ -96,6 +61,29 @@ vec4_gs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
src_reg src;
switch (instr->intrinsic) {
+ case nir_intrinsic_load_per_vertex_input_indirect:
+ assert(!"EmitNoIndirectInput should prevent this.");
+ case nir_intrinsic_load_per_vertex_input: {
+ /* The EmitNoIndirectInput flag guarantees our vertex index will
+ * be constant. We should handle indirects someday.
+ */
+ nir_const_value *vertex = nir_src_as_const_value(instr->src[0]);
+
+ /* Make up a type...we have no way of knowing... */
+ const glsl_type *const type = glsl_type::ivec(instr->num_components);
+
+ src = src_reg(ATTR, BRW_VARYING_SLOT_COUNT * vertex->u[0] +
+ instr->const_index[0], type);
+ dest = get_nir_dest(instr->dest, src.type);
+ dest.writemask = brw_writemask_for_size(instr->num_components);
+ emit(MOV(dest, src));
+ break;
+ }
+
+ case nir_intrinsic_load_input:
+ case nir_intrinsic_load_input_indirect:
+ unreachable("nir_lower_io should have produced per_vertex intrinsics");
+
case nir_intrinsic_emit_vertex_with_counter: {
this->vertex_count =
retype(get_nir_src(instr->src[0], 1), BRW_REGISTER_TYPE_UD);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
index c673ccd137c..4ce471e0669 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
@@ -37,7 +37,6 @@ namespace brw {
vec4_gs_visitor::vec4_gs_visitor(const struct brw_compiler *compiler,
void *log_data,
struct brw_gs_compile *c,
- struct gl_shader_program *prog,
nir_shader *shader,
void *mem_ctx,
bool no_spills,
@@ -45,7 +44,6 @@ vec4_gs_visitor::vec4_gs_visitor(const struct brw_compiler *compiler,
: vec4_visitor(compiler, log_data, &c->key.tex,
&c->prog_data.base, shader, mem_ctx,
no_spills, shader_time_index),
- shader_prog(prog),
c(c)
{
}
@@ -473,7 +471,7 @@ vec4_gs_visitor::gs_emit_vertex(int stream_id)
* be recorded by transform feedback, we can simply discard all geometry
* bound to these streams when transform feedback is disabled.
*/
- if (stream_id > 0 && shader_prog->TransformFeedback.NumVarying == 0)
+ if (stream_id > 0 && !nir->info.has_transform_feedback_varyings)
return;
/* If we're outputting 32 control data bits or less, then we can wait
@@ -620,17 +618,11 @@ brw_gs_emit(struct brw_context *brw,
struct gl_shader_program *prog,
struct brw_gs_compile *c,
void *mem_ctx,
+ int shader_time_index,
unsigned *final_assembly_size)
{
struct gl_shader *shader = prog->_LinkedShaders[MESA_SHADER_GEOMETRY];
- if (unlikely(INTEL_DEBUG & DEBUG_GS))
- brw_dump_ir("geometry", prog, shader, NULL);
-
- int st_index = -1;
- if (INTEL_DEBUG & DEBUG_SHADER_TIME)
- st_index = brw_get_shader_time_index(brw, prog, NULL, ST_GS);
-
if (brw->gen >= 7) {
/* Compile the geometry shader in DUAL_OBJECT dispatch mode, if we can do
* so without spilling. If the GS invocations count > 1, then we can't use
@@ -641,8 +633,8 @@ brw_gs_emit(struct brw_context *brw,
c->prog_data.base.dispatch_mode = DISPATCH_MODE_4X2_DUAL_OBJECT;
vec4_gs_visitor v(brw->intelScreen->compiler, brw,
- c, prog, shader->Program->nir,
- mem_ctx, true /* no_spills */, st_index);
+ c, shader->Program->nir,
+ mem_ctx, true /* no_spills */, shader_time_index);
if (v.run()) {
return generate_assembly(brw, prog, &c->gp->program.Base,
&c->prog_data.base, mem_ctx, v.cfg,
@@ -684,14 +676,14 @@ brw_gs_emit(struct brw_context *brw,
if (brw->gen >= 7)
gs = new vec4_gs_visitor(brw->intelScreen->compiler, brw,
- c, prog, shader->Program->nir,
+ c, shader->Program->nir,
mem_ctx, false /* no_spills */,
- st_index);
+ shader_time_index);
else
gs = new gen6_gs_visitor(brw->intelScreen->compiler, brw,
c, prog, shader->Program->nir,
mem_ctx, false /* no_spills */,
- st_index);
+ shader_time_index);
if (!gs->run()) {
prog->LinkStatus = false;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
index 85d80b8fc63..3ff195c3e68 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.h
@@ -55,6 +55,7 @@ const unsigned *brw_gs_emit(struct brw_context *brw,
struct gl_shader_program *prog,
struct brw_gs_compile *c,
void *mem_ctx,
+ int shader_time_index,
unsigned *final_assembly_size);
#ifdef __cplusplus
@@ -70,7 +71,6 @@ public:
vec4_gs_visitor(const struct brw_compiler *compiler,
void *log_data,
struct brw_gs_compile *c,
- struct gl_shader_program *prog,
nir_shader *shader,
void *mem_ctx,
bool no_spills,
@@ -97,8 +97,6 @@ protected:
void emit_control_data_bits();
void set_stream_control_data_bits(unsigned stream_id);
- struct gl_shader_program *shader_prog;
-
src_reg vertex_count;
src_reg control_data_bits;
const struct brw_gs_compile * const c;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index f80425a5b00..98ea9be6ee4 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -26,8 +26,6 @@
#include "glsl/ir_uniform.h"
#include "program/sampler.h"
-#define FIRST_SPILL_MRF(gen) (gen == 6 ? 21 : 13)
-
namespace brw {
vec4_instruction::vec4_instruction(enum opcode opcode, const dst_reg &dst,
@@ -278,16 +276,6 @@ vec4_visitor::SCRATCH_WRITE(const dst_reg &dst, const src_reg &src,
return inst;
}
-void
-vec4_visitor::emit_dp(dst_reg dst, src_reg src0, src_reg src1, unsigned elements)
-{
- static enum opcode dot_opcodes[] = {
- BRW_OPCODE_DP2, BRW_OPCODE_DP3, BRW_OPCODE_DP4
- };
-
- emit(dot_opcodes[elements - 2], dst, src0, src1);
-}
-
src_reg
vec4_visitor::fix_3src_operand(const src_reg &src)
{
@@ -803,7 +791,7 @@ vec4_visitor::emit_pull_constant_load_reg(dst_reg dst,
dst,
surf_index,
offset_reg);
- pull->base_mrf = FIRST_SPILL_MRF(devinfo->gen) + 1;
+ pull->base_mrf = FIRST_PULL_LOAD_MRF(devinfo->gen) + 1;
pull->mlen = 1;
}
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index 3c6ee0a7a03..38de98fab86 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -41,31 +41,6 @@
#include "util/ralloc.h"
-/**
- * Decide which set of clip planes should be used when clipping via
- * gl_Position or gl_ClipVertex.
- */
-gl_clip_plane *brw_select_clip_planes(struct gl_context *ctx)
-{
- if (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]) {
- /* There is currently a GLSL vertex shader, so clip according to GLSL
- * rules, which means compare gl_ClipVertex (or gl_Position, if
- * gl_ClipVertex wasn't assigned) against the eye-coordinate clip planes
- * that were stored in EyeUserPlane at the time the clip planes were
- * specified.
- */
- return ctx->Transform.EyeUserPlane;
- } else {
- /* Either we are using fixed function or an ARB vertex program. In
- * either case the clip planes are going to be compared against
- * gl_Position (which is in clip coordinates) so we have to clip using
- * _ClipUserPlane, which was transformed into clip coordinates by Mesa
- * core.
- */
- return ctx->Transform._ClipUserPlane;
- }
-}
-
bool
brw_codegen_vs_prog(struct brw_context *brw,
struct gl_shader_program *prog,
@@ -195,10 +170,17 @@ brw_codegen_vs_prog(struct brw_context *brw,
start_time = get_time();
}
+ if (unlikely(INTEL_DEBUG & DEBUG_VS))
+ brw_dump_ir("vertex", prog, &vs->base, &vp->program.Base);
+
+ int st_index = -1;
+ if (INTEL_DEBUG & DEBUG_SHADER_TIME)
+ st_index = brw_get_shader_time_index(brw, prog, &vp->program.Base, ST_VS);
+
/* Emit GEN4 code.
*/
program = brw_vs_emit(brw, mem_ctx, key, &prog_data,
- &vp->program, prog, &program_size);
+ &vp->program, prog, st_index, &program_size);
if (program == NULL) {
ralloc_free(mem_ctx);
return false;
diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h
index 96d2435a515..f1242f61b33 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.h
+++ b/src/mesa/drivers/dri/i965/brw_vs.h
@@ -60,6 +60,7 @@ const unsigned *brw_vs_emit(struct brw_context *brw,
struct brw_vs_prog_data *prog_data,
struct gl_vertex_program *vp,
struct gl_shader_program *shader_prog,
+ int shader_time_index,
unsigned *program_size);
void brw_vs_debug_recompile(struct brw_context *brw,
struct gl_shader_program *prog,
@@ -105,16 +106,11 @@ protected:
private:
int setup_attributes(int payload_reg);
- void setup_vp_regs();
void setup_uniform_clipplane_values();
void emit_clip_distances(dst_reg reg, int offset);
- dst_reg get_vp_dst_reg(const prog_dst_register &dst);
- src_reg get_vp_src_reg(const prog_src_register &src);
const struct brw_vs_prog_key *const key;
struct brw_vs_prog_data * const vs_prog_data;
- src_reg *vp_temp_regs;
- src_reg vp_addr_reg;
gl_clip_plane *clip_planes;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 21048885755..4d5e7f67bd6 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -43,7 +43,7 @@
* Return a bitfield where bit n is set if barycentric interpolation mode n
* (see enum brw_wm_barycentric_interp_mode) is needed by the fragment shader.
*/
-unsigned
+static unsigned
brw_compute_barycentric_interp_modes(const struct brw_device_info *devinfo,
bool shade_model_flat,
bool persample_shading,
@@ -221,8 +221,17 @@ brw_codegen_wm_prog(struct brw_context *brw,
start_time = get_time();
}
+ if (unlikely(INTEL_DEBUG & DEBUG_WM))
+ brw_dump_ir("fragment", prog, &fs->base, &fp->program.Base);
+
+ int st_index8 = -1, st_index16 = -1;
+ if (INTEL_DEBUG & DEBUG_SHADER_TIME) {
+ st_index8 = brw_get_shader_time_index(brw, prog, &fp->program.Base, ST_FS8);
+ st_index16 = brw_get_shader_time_index(brw, prog, &fp->program.Base, ST_FS16);
+ }
+
program = brw_wm_fs_emit(brw, mem_ctx, key, &prog_data,
- &fp->program, prog, &program_size);
+ &fp->program, prog, st_index8, st_index16, &program_size);
if (program == NULL) {
ralloc_free(mem_ctx);
return false;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index 053f2ee62dd..6ee22b2f907 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -72,6 +72,8 @@ const unsigned *brw_wm_fs_emit(struct brw_context *brw,
struct brw_wm_prog_data *prog_data,
struct gl_fragment_program *fp,
struct gl_shader_program *prog,
+ int shader_time_index8,
+ int shader_time_index16,
unsigned *final_assembly_size);
GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
@@ -89,14 +91,6 @@ void brw_wm_debug_recompile(struct brw_context *brw,
void
brw_upload_wm_prog(struct brw_context *brw);
-struct nir_shader;
-
-unsigned
-brw_compute_barycentric_interp_modes(const struct brw_device_info *devinfo,
- bool shade_model_flat,
- bool persample_shading,
- struct nir_shader *shader);
-
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c
index cd0b56ba60c..ec54ef2acd9 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_state.c
@@ -31,6 +31,7 @@
+#include "intel_batchbuffer.h"
#include "intel_fbo.h"
#include "brw_context.h"
#include "brw_state.h"
@@ -251,6 +252,16 @@ brw_upload_wm_unit(struct brw_context *brw)
}
brw->ctx.NewDriverState |= BRW_NEW_GEN4_UNIT_STATE;
+
+ /* _NEW_POLGYON */
+ if (brw->wm.offset_clamp != ctx->Polygon.OffsetClamp) {
+ BEGIN_BATCH(2);
+ OUT_BATCH(_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP << 16 | (2 - 2));
+ OUT_BATCH_F(ctx->Polygon.OffsetClamp);
+ ADVANCE_BATCH();
+
+ brw->wm.offset_clamp = ctx->Polygon.OffsetClamp;
+ }
}
const struct brw_tracked_state brw_wm_unit = {
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp b/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
index def21d80b24..59a76559103 100644
--- a/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_gs_visitor.cpp
@@ -273,6 +273,18 @@ gen6_gs_visitor::emit_urb_write_header(int mrf)
emit(GS_OPCODE_SET_DWORD_2, dst_reg(MRF, mrf), flags_data);
}
+static int
+align_interleaved_urb_mlen(int mlen)
+{
+ /* URB data written (does not include the message header reg) must
+ * be a multiple of 256 bits, or 2 VS registers. See vol5c.5,
+ * section 5.4.3.2.2: URB_INTERLEAVED.
+ */
+ if ((mlen % 2) != 1)
+ mlen++;
+ return mlen;
+}
+
void
gen6_gs_visitor::emit_urb_write_opcode(bool complete, int base_mrf,
int last_mrf, int urb_offset)
@@ -299,14 +311,7 @@ gen6_gs_visitor::emit_urb_write_opcode(bool complete, int base_mrf,
}
inst->base_mrf = base_mrf;
- /* URB data written (does not include the message header reg) must
- * be a multiple of 256 bits, or 2 VS registers. See vol5c.5,
- * section 5.4.3.2.2: URB_INTERLEAVED.
- */
- int mlen = last_mrf - base_mrf;
- if ((mlen % 2) != 1)
- mlen++;
- inst->mlen = mlen;
+ inst->mlen = align_interleaved_urb_mlen(last_mrf - base_mrf);
inst->offset = urb_offset;
}
@@ -339,9 +344,9 @@ gen6_gs_visitor::emit_thread_end()
/* In the process of generating our URB write message contents, we
* may need to unspill a register or load from an array. Those
- * reads would use MRFs 14-15.
+ * reads would use MRFs 21..23
*/
- int max_usable_mrf = 13;
+ int max_usable_mrf = FIRST_SPILL_MRF(devinfo->gen);
/* Issue the FF_SYNC message and obtain the initial VUE handle. */
emit(CMP(dst_null_d(), this->vertex_count, 0u, BRW_CONDITIONAL_G));
@@ -416,9 +421,10 @@ gen6_gs_visitor::emit_thread_end()
this->vertex_output_offset, 1u));
/* If this was max_usable_mrf, we can't fit anything more into
- * this URB WRITE.
+ * this URB WRITE. Same if we reached the max. message length.
*/
- if (mrf > max_usable_mrf) {
+ if (mrf > max_usable_mrf ||
+ align_interleaved_urb_mlen(mrf - base_mrf + 1) > BRW_MAX_MSG_LENGTH) {
slot++;
break;
}
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_visitor.h b/src/mesa/drivers/dri/i965/gen6_gs_visitor.h
index 41c6d183acd..e75d6aa10b8 100644
--- a/src/mesa/drivers/dri/i965/gen6_gs_visitor.h
+++ b/src/mesa/drivers/dri/i965/gen6_gs_visitor.h
@@ -43,8 +43,11 @@ public:
void *mem_ctx,
bool no_spills,
int shader_time_index) :
- vec4_gs_visitor(comp, log_data, c, prog, shader, mem_ctx, no_spills,
- shader_time_index) {}
+ vec4_gs_visitor(comp, log_data, c, shader, mem_ctx, no_spills,
+ shader_time_index),
+ shader_prog(prog)
+ {
+ }
protected:
virtual void emit_prolog();
@@ -64,6 +67,8 @@ private:
void xfb_setup();
int get_vertex_output_offset_for_varying(int vertex, int varying);
+ const struct gl_shader_program *shader_prog;
+
src_reg vertex_output;
src_reg vertex_output_offset;
src_reg temp;
diff --git a/src/mesa/drivers/dri/i965/gen7_cs_state.c b/src/mesa/drivers/dri/i965/gen7_cs_state.c
index 5edc4fc9842..6aeb0cb243f 100644
--- a/src/mesa/drivers/dri/i965/gen7_cs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_cs_state.c
@@ -70,10 +70,8 @@ brw_upload_cs_state(struct brw_context *brw)
unsigned local_id_dwords = 0;
- if (prog->SystemValuesRead & SYSTEM_BIT_LOCAL_INVOCATION_ID) {
- local_id_dwords =
- brw_cs_prog_local_id_payload_dwords(cs_prog_data->simd_size);
- }
+ if (prog->SystemValuesRead & SYSTEM_BIT_LOCAL_INVOCATION_ID)
+ local_id_dwords = cs_prog_data->local_invocation_id_regs * 8;
unsigned push_constant_data_size =
(prog_data->nr_params + local_id_dwords) * sizeof(gl_constant_value);
@@ -191,63 +189,6 @@ const struct brw_tracked_state brw_cs_state = {
/**
- * We are building the local ID push constant data using the simplest possible
- * method. We simply push the local IDs directly as they should appear in the
- * registers for the uvec3 gl_LocalInvocationID variable.
- *
- * Therefore, for SIMD8, we use 3 full registers, and for SIMD16 we use 6
- * registers worth of push constant space.
- *
- * Note: Any updates to brw_cs_prog_local_id_payload_dwords,
- * fill_local_id_payload or fs_visitor::emit_cs_local_invocation_id_setup need
- * to coordinated.
- *
- * FINISHME: There are a few easy optimizations to consider.
- *
- * 1. If gl_WorkGroupSize x, y or z is 1, we can just use zero, and there is
- * no need for using push constant space for that dimension.
- *
- * 2. Since GL_MAX_COMPUTE_WORK_GROUP_SIZE is currently 1024 or less, we can
- * easily use 16-bit words rather than 32-bit dwords in the push constant
- * data.
- *
- * 3. If gl_WorkGroupSize x, y or z is small, then we can use bytes for
- * conveying the data, and thereby reduce push constant usage.
- *
- */
-unsigned
-brw_cs_prog_local_id_payload_dwords(unsigned dispatch_width)
-{
- return 3 * dispatch_width;
-}
-
-
-static void
-fill_local_id_payload(const struct brw_cs_prog_data *cs_prog_data,
- void *buffer, unsigned *x, unsigned *y, unsigned *z)
-{
- uint32_t *param = (uint32_t *)buffer;
- for (unsigned i = 0; i < cs_prog_data->simd_size; i++) {
- param[0 * cs_prog_data->simd_size + i] = *x;
- param[1 * cs_prog_data->simd_size + i] = *y;
- param[2 * cs_prog_data->simd_size + i] = *z;
-
- (*x)++;
- if (*x == cs_prog_data->local_size[0]) {
- *x = 0;
- (*y)++;
- if (*y == cs_prog_data->local_size[1]) {
- *y = 0;
- (*z)++;
- if (*z == cs_prog_data->local_size[2])
- *z = 0;
- }
- }
- }
-}
-
-
-/**
* Creates a region containing the push constants for the CS on gen7+.
*
* Push constants are constant values (such as GLSL uniforms) that are
@@ -269,10 +210,8 @@ brw_upload_cs_push_constants(struct brw_context *brw,
(struct brw_stage_prog_data*) cs_prog_data;
unsigned local_id_dwords = 0;
- if (prog->SystemValuesRead & SYSTEM_BIT_LOCAL_INVOCATION_ID) {
- local_id_dwords =
- brw_cs_prog_local_id_payload_dwords(cs_prog_data->simd_size);
- }
+ if (prog->SystemValuesRead & SYSTEM_BIT_LOCAL_INVOCATION_ID)
+ local_id_dwords = cs_prog_data->local_invocation_id_regs * 8;
/* Updates the ParamaterValues[i] pointers for all parameters of the
* basic type of PROGRAM_STATE_VAR.
@@ -302,14 +241,13 @@ brw_upload_cs_push_constants(struct brw_context *brw,
STATIC_ASSERT(sizeof(gl_constant_value) == sizeof(float));
+ brw_cs_fill_local_id_payload(cs_prog_data, param, threads,
+ reg_aligned_constant_size);
+
/* _NEW_PROGRAM_CONSTANTS */
- unsigned x = 0, y = 0, z = 0;
for (t = 0; t < threads; t++) {
- gl_constant_value *next_param = &param[t * param_aligned_count];
- if (local_id_dwords > 0) {
- fill_local_id_payload(cs_prog_data, (void*)next_param, &x, &y, &z);
- next_param += local_id_dwords;
- }
+ gl_constant_value *next_param =
+ &param[t * param_aligned_count + local_id_dwords];
for (i = 0; i < prog_data->nr_params; i++) {
next_param[i] = *prog_data->param[i];
}
diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c
index 46fccc8d6ce..bd204aa3ce8 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -27,7 +27,6 @@
#include "main/blit.h"
#include "main/context.h"
#include "main/enums.h"
-#include "main/colormac.h"
#include "main/fbobject.h"
#include "brw_context.h"
diff --git a/src/mesa/drivers/dri/i965/intel_buffers.c b/src/mesa/drivers/dri/i965/intel_buffers.c
index c98e19382c3..fd522cc4f4d 100644
--- a/src/mesa/drivers/dri/i965/intel_buffers.c
+++ b/src/mesa/drivers/dri/i965/intel_buffers.c
@@ -32,30 +32,10 @@
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
-
-bool
-brw_is_front_buffer_reading(struct gl_framebuffer *fb)
-{
- if (!fb || _mesa_is_user_fbo(fb))
- return false;
-
- return fb->_ColorReadBufferIndex == BUFFER_FRONT_LEFT;
-}
-
-bool
-brw_is_front_buffer_drawing(struct gl_framebuffer *fb)
-{
- if (!fb || _mesa_is_user_fbo(fb))
- return false;
-
- return (fb->_NumColorDrawBuffers >= 1 &&
- fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT);
-}
-
static void
intelDrawBuffer(struct gl_context * ctx, GLenum mode)
{
- if (brw_is_front_buffer_drawing(ctx->DrawBuffer)) {
+ if (_mesa_is_front_buffer_drawing(ctx->DrawBuffer)) {
struct brw_context *const brw = brw_context(ctx);
/* If we might be front-buffer rendering on this buffer for the first
@@ -71,7 +51,7 @@ intelDrawBuffer(struct gl_context * ctx, GLenum mode)
static void
intelReadBuffer(struct gl_context * ctx, GLenum mode)
{
- if (brw_is_front_buffer_reading(ctx->ReadBuffer)) {
+ if (_mesa_is_front_buffer_reading(ctx->ReadBuffer)) {
struct brw_context *const brw = brw_context(ctx);
/* If we might be front-buffer reading on this buffer for the first
diff --git a/src/mesa/drivers/dri/i965/intel_buffers.h b/src/mesa/drivers/dri/i965/intel_buffers.h
index 85f54b2c653..0e0d9c31f2b 100644
--- a/src/mesa/drivers/dri/i965/intel_buffers.h
+++ b/src/mesa/drivers/dri/i965/intel_buffers.h
@@ -30,11 +30,6 @@
#include "drm.h"
#include "brw_context.h"
-struct intel_framebuffer;
-
extern void intelInitBufferFuncs(struct dd_function_table *functions);
-bool brw_is_front_buffer_reading(struct gl_framebuffer *fb);
-bool brw_is_front_buffer_drawing(struct gl_framebuffer *fb);
-
#endif /* INTEL_BUFFERS_H */
diff --git a/src/mesa/drivers/dri/i965/intel_debug.c b/src/mesa/drivers/dri/i965/intel_debug.c
index 5a9c9533fde..f7c02c8a38d 100644
--- a/src/mesa/drivers/dri/i965/intel_debug.c
+++ b/src/mesa/drivers/dri/i965/intel_debug.c
@@ -33,10 +33,11 @@
#include "intel_debug.h"
#include "utils.h"
#include "util/u_atomic.h" /* for p_atomic_cmpxchg */
+#include "util/debug.h"
uint64_t INTEL_DEBUG = 0;
-static const struct dri_debug_control debug_control[] = {
+static const struct debug_control debug_control[] = {
{ "tex", DEBUG_TEXTURE},
{ "state", DEBUG_STATE},
{ "blit", DEBUG_BLIT},
@@ -91,22 +92,10 @@ intel_debug_flag_for_shader_stage(gl_shader_stage stage)
}
void
-brw_process_intel_debug_variable(struct intel_screen *screen)
+brw_process_intel_debug_variable(void)
{
- uint64_t intel_debug = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
+ uint64_t intel_debug = parse_debug_string(getenv("INTEL_DEBUG"), debug_control);
(void) p_atomic_cmpxchg(&INTEL_DEBUG, 0, intel_debug);
-
- if (INTEL_DEBUG & DEBUG_BUFMGR)
- dri_bufmgr_set_debug(screen->bufmgr, true);
-
- if ((INTEL_DEBUG & DEBUG_SHADER_TIME) && screen->devinfo->gen < 7) {
- fprintf(stderr,
- "shader_time debugging requires gen7 (Ivybridge) or better.\n");
- INTEL_DEBUG &= ~DEBUG_SHADER_TIME;
- }
-
- if (INTEL_DEBUG & DEBUG_AUB)
- drm_intel_bufmgr_gem_set_aub_dump(screen->bufmgr, true);
}
/**
diff --git a/src/mesa/drivers/dri/i965/intel_debug.h b/src/mesa/drivers/dri/i965/intel_debug.h
index b7d0c823fa8..0a6e1b90b98 100644
--- a/src/mesa/drivers/dri/i965/intel_debug.h
+++ b/src/mesa/drivers/dri/i965/intel_debug.h
@@ -115,8 +115,6 @@ extern uint64_t INTEL_DEBUG;
extern uint64_t intel_debug_flag_for_shader_stage(gl_shader_stage stage);
-struct intel_screen;
-
-extern void brw_process_intel_debug_variable(struct intel_screen *);
+extern void brw_process_intel_debug_variable(void);
extern bool brw_env_var_as_boolean(const char *var_name, bool default_value);
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index 3c77f4773c6..3f9afd16c71 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -229,6 +229,7 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.EXT_packed_float = true;
ctx->Extensions.EXT_pixel_buffer_object = true;
ctx->Extensions.EXT_point_parameters = true;
+ ctx->Extensions.EXT_polygon_offset_clamp = true;
ctx->Extensions.EXT_provoking_vertex = true;
ctx->Extensions.EXT_stencil_two_side = true;
ctx->Extensions.EXT_texture_array = true;
@@ -300,7 +301,6 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.AMD_vertex_shader_layer = true;
ctx->Extensions.EXT_framebuffer_multisample = true;
ctx->Extensions.EXT_framebuffer_multisample_blit_scaled = true;
- ctx->Extensions.EXT_polygon_offset_clamp = true;
ctx->Extensions.EXT_transform_feedback = true;
ctx->Extensions.OES_depth_texture_cube_map = true;
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index 6b2349e8b69..5a6b0dd1ec5 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -52,19 +52,6 @@
#define FILE_DEBUG_FLAG DEBUG_FBO
-/**
- * Create a new framebuffer object.
- */
-static struct gl_framebuffer *
-intel_new_framebuffer(struct gl_context * ctx, GLuint name)
-{
- /* Only drawable state in intel_framebuffer at this time, just use Mesa's
- * class
- */
- return _mesa_new_framebuffer(ctx, name);
-}
-
-
/** Called by gl_renderbuffer::Delete() */
static void
intel_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
@@ -1093,7 +1080,6 @@ void
intel_fbo_init(struct brw_context *brw)
{
struct dd_function_table *dd = &brw->ctx.Driver;
- dd->NewFramebuffer = intel_new_framebuffer;
dd->NewRenderbuffer = intel_new_renderbuffer;
dd->MapRenderbuffer = intel_map_renderbuffer;
dd->UnmapRenderbuffer = intel_unmap_renderbuffer;
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index ffc356c9240..a169c41790e 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -160,7 +160,7 @@ intel_get_non_msrt_mcs_alignment(struct intel_mipmap_tree *mt,
}
}
-bool
+static bool
intel_tiling_supports_non_msrt_mcs(struct brw_context *brw, unsigned tiling)
{
/* From the Ivy Bridge PRM, Vol2 Part1 11.7 "MCS Buffer for Render
@@ -193,9 +193,9 @@ intel_tiling_supports_non_msrt_mcs(struct brw_context *brw, unsigned tiling)
* - MCS buffer for non-MSRT is supported only for RT formats 32bpp,
* 64bpp, and 128bpp.
*/
-bool
-intel_miptree_is_fast_clear_capable(struct brw_context *brw,
- struct intel_mipmap_tree *mt)
+static bool
+intel_miptree_supports_non_msrt_fast_clear(struct brw_context *brw,
+ struct intel_mipmap_tree *mt)
{
/* MCS support does not exist prior to Gen7 */
if (brw->gen < 7)
@@ -204,6 +204,10 @@ intel_miptree_is_fast_clear_capable(struct brw_context *brw,
if (mt->disable_aux_buffers)
return false;
+ /* This function applies only to non-multisampled render targets. */
+ if (mt->num_samples > 1)
+ return false;
+
/* MCS is only supported for color buffers */
switch (_mesa_get_format_base_format(mt->format)) {
case GL_DEPTH_COMPONENT:
@@ -222,7 +226,16 @@ intel_miptree_is_fast_clear_capable(struct brw_context *brw,
return false;
}
+
+ /* Check for layered surfaces. */
if (mt->physical_depth0 != 1) {
+ /* Multisample surfaces with the CMS layout are not layered surfaces,
+ * yet still have physical_depth0 > 1. Assert that we don't
+ * accidentally reject a multisampled surface here. We should have
+ * rejected it earlier by explicitly checking the sample count.
+ */
+ assert(mt->num_samples <= 1);
+
if (brw->gen >= 8) {
perf_debug("Layered fast clear - giving up. (%dx%d%d)\n",
mt->logical_width0, mt->logical_height0,
@@ -494,7 +507,7 @@ intel_miptree_create_layout(struct brw_context *brw,
* 7 | ? | ?
* 6 | ? | ?
*/
- if (intel_miptree_is_fast_clear_capable(brw, mt)) {
+ if (intel_miptree_supports_non_msrt_fast_clear(brw, mt)) {
if (brw->gen >= 9 || (brw->gen == 8 && num_samples <= 1))
layout_flags |= MIPTREE_LAYOUT_FORCE_HALIGN16;
} else if (brw->gen >= 9 && num_samples > 1) {
@@ -692,7 +705,7 @@ intel_miptree_create(struct brw_context *brw,
* clear actually occurs.
*/
if (intel_tiling_supports_non_msrt_mcs(brw, mt->tiling) &&
- intel_miptree_is_fast_clear_capable(brw, mt)) {
+ intel_miptree_supports_non_msrt_fast_clear(brw, mt)) {
mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
assert(brw->gen < 8 || mt->halign == 16 || num_samples <= 1);
}
@@ -800,8 +813,9 @@ intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
* clear actually occurs.
*/
if (intel_tiling_supports_non_msrt_mcs(intel, singlesample_mt->tiling) &&
- intel_miptree_is_fast_clear_capable(intel, singlesample_mt))
+ intel_miptree_supports_non_msrt_fast_clear(intel, singlesample_mt)) {
singlesample_mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_RESOLVED;
+ }
if (num_samples == 0) {
intel_miptree_release(&irb->mt);
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index 486e5c6f43b..805cd714d88 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -658,11 +658,7 @@ struct intel_mipmap_tree
void
intel_get_non_msrt_mcs_alignment(struct intel_mipmap_tree *mt,
unsigned *width_px, unsigned *height);
-bool
-intel_tiling_supports_non_msrt_mcs(struct brw_context *brw, unsigned tiling);
-bool
-intel_miptree_is_fast_clear_capable(struct brw_context *brw,
- struct intel_mipmap_tree *mt);
+
bool
intel_miptree_alloc_non_msrt_mcs(struct brw_context *brw,
struct intel_mipmap_tree *mt);
diff --git a/src/mesa/drivers/dri/i965/intel_pixel.c b/src/mesa/drivers/dri/i965/intel_pixel.c
index 30d3a521ec8..d4f86fdffe0 100644
--- a/src/mesa/drivers/dri/i965/intel_pixel.c
+++ b/src/mesa/drivers/dri/i965/intel_pixel.c
@@ -128,7 +128,6 @@ intel_check_blit_fragment_ops(struct gl_context * ctx, bool src_alpha_is_one)
void
intelInitPixelFuncs(struct dd_function_table *functions)
{
- functions->Accum = _mesa_accum;
functions->Bitmap = intelBitmap;
functions->CopyPixels = intelCopyPixels;
functions->DrawPixels = intelDrawPixels;
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 17838350cda..590c45d93ea 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -1421,7 +1421,19 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
if (!intelScreen->devinfo)
return false;
- brw_process_intel_debug_variable(intelScreen);
+ brw_process_intel_debug_variable();
+
+ if (INTEL_DEBUG & DEBUG_BUFMGR)
+ dri_bufmgr_set_debug(intelScreen->bufmgr, true);
+
+ if ((INTEL_DEBUG & DEBUG_SHADER_TIME) && intelScreen->devinfo->gen < 7) {
+ fprintf(stderr,
+ "shader_time debugging requires gen7 (Ivybridge) or better.\n");
+ INTEL_DEBUG &= ~DEBUG_SHADER_TIME;
+ }
+
+ if (INTEL_DEBUG & DEBUG_AUB)
+ drm_intel_bufmgr_gem_set_aub_dump(intelScreen->bufmgr, true);
intelScreen->hw_must_use_separate_stencil = intelScreen->devinfo->gen >= 7;
diff --git a/src/mesa/drivers/dri/i965/intel_state.c b/src/mesa/drivers/dri/i965/intel_state.c
index 498cab49ec4..2f5c901fdf8 100644
--- a/src/mesa/drivers/dri/i965/intel_state.c
+++ b/src/mesa/drivers/dri/i965/intel_state.c
@@ -27,7 +27,6 @@
#include "main/context.h"
#include "main/macros.h"
#include "main/enums.h"
-#include "main/colormac.h"
#include "main/dd.h"
#include "intel_screen.h"
diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h
index c02a4f399ee..7c6f48008a1 100644
--- a/src/mesa/drivers/dri/r200/r200_context.h
+++ b/src/mesa/drivers/dri/r200/r200_context.h
@@ -42,7 +42,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/macros.h"
#include "main/mtypes.h"
-#include "main/colormac.h"
#include "r200_reg.h"
#include "r200_vertprog.h"
diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c
index 3cfc03d10cc..9b16cf84cf5 100644
--- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c
+++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c
@@ -34,7 +34,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/glheader.h"
#include "main/mtypes.h"
-#include "main/colormac.h"
#include "main/imports.h"
#include "main/macros.h"
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index cca176d7f9b..b4acf985ee8 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -37,7 +37,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/imports.h"
#include "main/api_arrayelt.h"
#include "main/enums.h"
-#include "main/colormac.h"
#include "main/light.h"
#include "main/framebuffer.h"
#include "main/fbobject.h"
@@ -2389,7 +2388,6 @@ void r200InitStateFuncs( radeonContextPtr radeon, struct dd_function_table *func
functions->Enable = r200Enable;
functions->Fogfv = r200Fogfv;
functions->FrontFace = r200FrontFace;
- functions->Hint = NULL;
functions->LightModelfv = r200LightModelfv;
functions->Lightfv = r200Lightfv;
functions->LineStipple = r200LineStipple;
diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c
index ad64f788b9f..8cffa92c10b 100644
--- a/src/mesa/drivers/dri/r200/r200_state_init.c
+++ b/src/mesa/drivers/dri/r200/r200_state_init.c
@@ -34,7 +34,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/glheader.h"
#include "main/imports.h"
#include "main/enums.h"
-#include "main/colormac.h"
#include "main/api_arrayelt.h"
#include "swrast/swrast.h"
diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c
index bb9be210567..72f09ae4056 100644
--- a/src/mesa/drivers/dri/r200/r200_swtcl.c
+++ b/src/mesa/drivers/dri/r200/r200_swtcl.c
@@ -34,7 +34,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/glheader.h"
#include "main/mtypes.h"
-#include "main/colormac.h"
#include "main/enums.h"
#include "main/image.h"
#include "main/imports.h"
diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c
index 747275334b6..c042aae0ef3 100644
--- a/src/mesa/drivers/dri/r200/r200_tcl.c
+++ b/src/mesa/drivers/dri/r200/r200_tcl.c
@@ -36,7 +36,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/imports.h"
#include "main/mtypes.h"
#include "main/enums.h"
-#include "main/colormac.h"
#include "main/light.h"
#include "main/state.h"
diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c
index feee0b2ba3f..ca921100c12 100644
--- a/src/mesa/drivers/dri/r200/r200_tex.c
+++ b/src/mesa/drivers/dri/r200/r200_tex.c
@@ -33,7 +33,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/glheader.h"
#include "main/imports.h"
-#include "main/colormac.h"
#include "main/context.h"
#include "main/enums.h"
#include "main/image.h"
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index a9e2ab563d3..5e15b46fb32 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -341,8 +341,8 @@ r100CreateContext( gl_api api,
#if DO_DEBUG
- RADEON_DEBUG = driParseDebugString( getenv( "RADEON_DEBUG" ),
- debug_control );
+ RADEON_DEBUG = parse_debug_string( getenv( "RADEON_DEBUG" ),
+ debug_control );
#endif
tcl_mode = driQueryOptioni(&rmesa->radeon.optionCache, "tcl_mode");
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h
index badabd9508c..88a295386ca 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_context.h
@@ -49,7 +49,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_drm.h"
#include "main/macros.h"
#include "main/mtypes.h"
-#include "main/colormac.h"
#include "radeon_screen.h"
#include "radeon_common.h"
diff --git a/src/mesa/drivers/dri/radeon/radeon_debug.c b/src/mesa/drivers/dri/radeon/radeon_debug.c
index 7ddba1ae85f..383a5df6749 100644
--- a/src/mesa/drivers/dri/radeon/radeon_debug.c
+++ b/src/mesa/drivers/dri/radeon/radeon_debug.c
@@ -27,7 +27,7 @@
* Pauli Nieminen <[email protected]>
*/
-#include "utils.h"
+#include "util/debug.h"
#include "radeon_common_context.h"
#include "radeon_debug.h"
@@ -35,7 +35,7 @@
#include <stdarg.h>
#include <stdio.h>
-static const struct dri_debug_control debug_control[] = {
+static const struct debug_control debug_control[] = {
{"fall", RADEON_FALLBACKS},
{"tex", RADEON_TEXTURE},
{"ioctl", RADEON_IOCTL},
@@ -61,7 +61,7 @@ radeon_debug_type_t radeon_enabled_debug_types;
void radeon_init_debug(void)
{
- radeon_enabled_debug_types = driParseDebugString(getenv("RADEON_DEBUG"), debug_control);
+ radeon_enabled_debug_types = parse_debug_string(getenv("RADEON_DEBUG"), debug_control);
radeon_enabled_debug_types |= RADEON_GENERAL;
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index 5eece518c95..4d75d149b27 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -46,12 +46,6 @@
printf(__VA_ARGS__); \
} while(0)
-static struct gl_framebuffer *
-radeon_new_framebuffer(struct gl_context *ctx, GLuint name)
-{
- return _mesa_new_framebuffer(ctx, name);
-}
-
static void
radeon_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
{
@@ -868,7 +862,6 @@ radeon_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
void radeon_fbo_init(struct radeon_context *radeon)
{
- radeon->glCtx.Driver.NewFramebuffer = radeon_new_framebuffer;
radeon->glCtx.Driver.NewRenderbuffer = radeon_new_renderbuffer;
radeon->glCtx.Driver.MapRenderbuffer = radeon_map_renderbuffer;
radeon->glCtx.Driver.UnmapRenderbuffer = radeon_unmap_renderbuffer;
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index 74c1fc6c902..8a1b81d8f32 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -2148,7 +2148,6 @@ void radeonInitStateFuncs( struct gl_context *ctx )
ctx->Driver.Enable = radeonEnable;
ctx->Driver.Fogfv = radeonFogfv;
ctx->Driver.FrontFace = radeonFrontFace;
- ctx->Driver.Hint = NULL;
ctx->Driver.LightModelfv = radeonLightModelfv;
ctx->Driver.Lightfv = radeonLightfv;
ctx->Driver.LineStipple = radeonLineStipple;
diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
index b671a3be143..1e19cf7c7c0 100644
--- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c
+++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c
@@ -34,7 +34,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/glheader.h"
#include "main/mtypes.h"
-#include "main/colormac.h"
#include "main/enums.h"
#include "main/imports.h"
#include "main/macros.h"
@@ -359,16 +358,16 @@ void r100_swtcl_flush(struct gl_context *ctx, uint32_t current_offset)
#define HAVE_ELTS 0
static const GLuint hw_prim[GL_POLYGON+1] = {
- RADEON_CP_VC_CNTL_PRIM_TYPE_POINT,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
- 0,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN,
- 0,
- 0,
- 0
+ [GL_POINTS] = RADEON_CP_VC_CNTL_PRIM_TYPE_POINT,
+ [GL_LINES] = RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
+ [GL_LINE_LOOP] = 0,
+ [GL_LINE_STRIP] = RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP,
+ [GL_TRIANGLES] = RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
+ [GL_TRIANGLE_STRIP] = RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP,
+ [GL_TRIANGLE_FAN] = RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN,
+ [GL_QUADS] = 0,
+ [GL_QUAD_STRIP] = 0,
+ [GL_POLYGON] = 0
};
static inline void
@@ -468,16 +467,16 @@ const struct tnl_pipeline_stage _radeon_render_stage =
static const GLuint reduced_hw_prim[GL_POLYGON+1] = {
- RADEON_CP_VC_CNTL_PRIM_TYPE_POINT,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
- RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
- RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST
+ [GL_POINTS] = RADEON_CP_VC_CNTL_PRIM_TYPE_POINT,
+ [GL_LINES] = RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
+ [GL_LINE_LOOP] = RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
+ [GL_LINE_STRIP] = RADEON_CP_VC_CNTL_PRIM_TYPE_LINE,
+ [GL_TRIANGLES] = RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
+ [GL_TRIANGLE_STRIP] = RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
+ [GL_TRIANGLE_FAN] = RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
+ [GL_QUADS] = RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
+ [GL_QUAD_STRIP] = RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST,
+ [GL_POLYGON] = RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST
};
static void radeonRasterPrimitive( struct gl_context *ctx, GLuint hwprim );
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c
index 0955a135de8..d1aa1a18737 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tex.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tex.c
@@ -33,7 +33,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/glheader.h"
#include "main/imports.h"
-#include "main/colormac.h"
#include "main/context.h"
#include "main/enums.h"
#include "main/image.h"
diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c
index ec835f248eb..35b1538d9e1 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texstate.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c
@@ -35,7 +35,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/glheader.h"
#include "main/imports.h"
-#include "main/colormac.h"
#include "main/context.h"
#include "main/macros.h"
#include "main/teximage.h"
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 28851434133..061e557a397 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -151,7 +151,6 @@ unbind_array_object_vbos(struct gl_context *ctx, struct gl_vertex_array_object *
* Allocate and initialize a new vertex array object.
*
* This function is intended to be called via
- * \c dd_function_table::NewArrayObject.
*/
struct gl_vertex_array_object *
_mesa_new_vao(struct gl_context *ctx, GLuint name)
@@ -203,10 +202,8 @@ _mesa_reference_vao_(struct gl_context *ctx,
deleteFlag = (oldObj->RefCount == 0);
mtx_unlock(&oldObj->Mutex);
- if (deleteFlag) {
- assert(ctx->Driver.DeleteArrayObject);
- ctx->Driver.DeleteArrayObject(ctx, oldObj);
- }
+ if (deleteFlag)
+ _mesa_delete_vao(ctx, oldObj);
*ptr = NULL;
}
@@ -408,7 +405,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
}
/* For APPLE version, generate a new array object now */
- newObj = (*ctx->Driver.NewArrayObject)(ctx, id);
+ newObj = _mesa_new_vao(ctx, id);
if (!newObj) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindVertexArrayAPPLE");
return;
@@ -446,10 +443,6 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired)
ctx->NewState |= _NEW_ARRAY;
_mesa_reference_vao(ctx, &ctx->Array.VAO, newObj);
-
- /* Pass BindVertexArray call to device driver */
- if (ctx->Driver.BindArrayObject && newObj)
- ctx->Driver.BindArrayObject(ctx, newObj);
}
@@ -565,7 +558,7 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays,
struct gl_vertex_array_object *obj;
GLuint name = first + i;
- obj = (*ctx->Driver.NewArrayObject)( ctx, name );
+ obj = _mesa_new_vao(ctx, name);
if (!obj) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
return;
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 4fc32962425..dee5e29d5b8 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -303,11 +303,6 @@ _mesa_BlendFuncSeparateiARB(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB,
ctx->Color.Blend[buf].DstA = dfactorA;
update_uses_dual_src(ctx, buf);
ctx->Color._BlendFuncPerBuffer = GL_TRUE;
-
- if (ctx->Driver.BlendFuncSeparatei) {
- ctx->Driver.BlendFuncSeparatei(ctx, buf, sfactorRGB, dfactorRGB,
- sfactorA, dfactorA);
- }
}
@@ -406,9 +401,6 @@ _mesa_BlendEquationiARB(GLuint buf, GLenum mode)
ctx->Color.Blend[buf].EquationRGB = mode;
ctx->Color.Blend[buf].EquationA = mode;
ctx->Color._BlendEquationPerBuffer = GL_TRUE;
-
- if (ctx->Driver.BlendEquationSeparatei)
- ctx->Driver.BlendEquationSeparatei(ctx, buf, mode, mode);
}
@@ -503,9 +495,6 @@ _mesa_BlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum modeA)
ctx->Color.Blend[buf].EquationRGB = modeRGB;
ctx->Color.Blend[buf].EquationA = modeA;
ctx->Color._BlendEquationPerBuffer = GL_TRUE;
-
- if (ctx->Driver.BlendEquationSeparatei)
- ctx->Driver.BlendEquationSeparatei(ctx, buf, modeRGB, modeA);
}
@@ -745,9 +734,6 @@ _mesa_ColorMaski( GLuint buf, GLboolean red, GLboolean green,
FLUSH_VERTICES(ctx, _NEW_COLOR);
COPY_4UBV(ctx->Color.ColorMask[buf], tmp);
-
- if (ctx->Driver.ColorMaskIndexed)
- ctx->Driver.ColorMaskIndexed(ctx, buf, red, green, blue, alpha);
}
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 0f7529ad975..1e7a12c8a84 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -51,6 +51,7 @@
#include "imports.h"
#include "mtypes.h"
+#include "vbo/vbo.h"
#ifdef __cplusplus
@@ -227,7 +228,7 @@ do { \
if (MESA_VERBOSE & VERBOSE_STATE) \
_mesa_debug(ctx, "FLUSH_VERTICES in %s\n", MESA_FUNCTION);\
if (ctx->Driver.NeedFlush & FLUSH_STORED_VERTICES) \
- ctx->Driver.FlushVertices(ctx, FLUSH_STORED_VERTICES); \
+ vbo_exec_FlushVertices(ctx, FLUSH_STORED_VERTICES); \
ctx->NewState |= newstate; \
} while (0)
@@ -246,7 +247,7 @@ do { \
if (MESA_VERBOSE & VERBOSE_STATE) \
_mesa_debug(ctx, "FLUSH_CURRENT in %s\n", MESA_FUNCTION); \
if (ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT) \
- ctx->Driver.FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
+ vbo_exec_FlushVertices(ctx, FLUSH_UPDATE_CURRENT); \
ctx->NewState |= newstate; \
} while (0)
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 88f37273e1e..496a14f8dad 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -94,13 +94,6 @@ struct dd_function_table {
void (*UpdateState)( struct gl_context *ctx, GLbitfield new_state );
/**
- * Resize the given framebuffer to the given size.
- * XXX OBSOLETE: this function will be removed in the future.
- */
- void (*ResizeBuffers)( struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint width, GLuint height);
-
- /**
* This is called whenever glFinish() is called.
*/
void (*Finish)( struct gl_context *ctx );
@@ -118,12 +111,6 @@ struct dd_function_table {
void (*Clear)( struct gl_context *ctx, GLbitfield buffers );
/**
- * Execute glAccum command.
- */
- void (*Accum)( struct gl_context *ctx, GLenum op, GLfloat value );
-
-
- /**
* Execute glRasterPos, updating the ctx->Current.Raster fields
*/
void (*RasterPos)( struct gl_context *ctx, const GLfloat v[4] );
@@ -529,22 +516,15 @@ struct dd_function_table {
/** Set the blend equation */
void (*BlendEquationSeparate)(struct gl_context *ctx,
GLenum modeRGB, GLenum modeA);
- void (*BlendEquationSeparatei)(struct gl_context *ctx, GLuint buffer,
- GLenum modeRGB, GLenum modeA);
/** Specify pixel arithmetic */
void (*BlendFuncSeparate)(struct gl_context *ctx,
GLenum sfactorRGB, GLenum dfactorRGB,
GLenum sfactorA, GLenum dfactorA);
- void (*BlendFuncSeparatei)(struct gl_context *ctx, GLuint buffer,
- GLenum sfactorRGB, GLenum dfactorRGB,
- GLenum sfactorA, GLenum dfactorA);
/** Specify a plane against which all geometry is clipped */
void (*ClipPlane)(struct gl_context *ctx, GLenum plane, const GLfloat *eq);
/** Enable and disable writing of frame buffer color components */
void (*ColorMask)(struct gl_context *ctx, GLboolean rmask, GLboolean gmask,
GLboolean bmask, GLboolean amask );
- void (*ColorMaskIndexed)(struct gl_context *ctx, GLuint buf, GLboolean rmask,
- GLboolean gmask, GLboolean bmask, GLboolean amask);
/** Cause a material color to track the current color */
void (*ColorMaterial)(struct gl_context *ctx, GLenum face, GLenum mode);
/** Specify whether front- or back-facing facets can be culled */
@@ -565,8 +545,6 @@ struct dd_function_table {
void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state);
/** Specify fog parameters */
void (*Fogfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params);
- /** Specify implementation-specific hints */
- void (*Hint)(struct gl_context *ctx, GLenum target, GLenum mode);
/** Set light source parameters.
* Note: for GL_POSITION and GL_SPOT_DIRECTION, params will have already
* been transformed to eye-space.
@@ -769,26 +747,12 @@ struct dd_function_table {
GLint *bytesWritten);
/*@}*/
-
- /**
- * \name Vertex Array objects
- */
- /*@{*/
- struct gl_vertex_array_object * (*NewArrayObject)(struct gl_context *ctx, GLuint id);
- void (*DeleteArrayObject)(struct gl_context *ctx, struct gl_vertex_array_object *);
- void (*BindArrayObject)(struct gl_context *ctx, struct gl_vertex_array_object *);
- /*@}*/
-
/**
* \name GLSL-related functions (ARB extensions and OpenGL 2.x)
*/
/*@{*/
struct gl_shader *(*NewShader)(struct gl_context *ctx,
GLuint name, GLenum type);
- void (*DeleteShader)(struct gl_context *ctx, struct gl_shader *shader);
- struct gl_shader_program *(*NewShaderProgram)(GLuint name);
- void (*DeleteShaderProgram)(struct gl_context *ctx,
- struct gl_shader_program *shProg);
void (*UseProgram)(struct gl_context *ctx, struct gl_shader_program *shProg);
/*@}*/
@@ -825,67 +789,15 @@ struct dd_function_table {
*/
GLbitfield NeedFlush;
- /** Need to call SaveFlushVertices() upon state change? */
+ /** Need to call vbo_save_SaveFlushVertices() upon state change? */
GLboolean SaveNeedFlush;
- /* Called prior to any of the GLvertexformat functions being
- * called. Paired with Driver.FlushVertices().
- */
- void (*BeginVertices)( struct gl_context *ctx );
-
- /**
- * If inside glBegin()/glEnd(), it should assert(0). Otherwise, if
- * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
- * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
- * __struct gl_contextRec::Current and gl_light_attrib::Material
- *
- * Note that the default T&L engine never clears the
- * FLUSH_UPDATE_CURRENT bit, even after performing the update.
- */
- void (*FlushVertices)( struct gl_context *ctx, GLuint flags );
- void (*SaveFlushVertices)( struct gl_context *ctx );
-
- /**
- * Give the driver the opportunity to hook in its own vtxfmt for
- * compiling optimized display lists. This is called on each valid
- * glBegin() during list compilation.
- */
- GLboolean (*NotifySaveBegin)( struct gl_context *ctx, GLenum mode );
-
/**
* Notify driver that the special derived value _NeedEyeCoords has
* changed.
*/
void (*LightingSpaceChange)( struct gl_context *ctx );
- /**
- * Called by glNewList().
- *
- * Let the T&L component know what is going on with display lists
- * in time to make changes to dispatch tables, etc.
- */
- void (*NewList)( struct gl_context *ctx, GLuint list, GLenum mode );
- /**
- * Called by glEndList().
- *
- * \sa dd_function_table::NewList.
- */
- void (*EndList)( struct gl_context *ctx );
-
- /**
- * Called by glCallList(s).
- *
- * Notify the T&L component before and after calling a display list.
- */
- void (*BeginCallList)( struct gl_context *ctx,
- struct gl_display_list *dlist );
- /**
- * Called by glEndCallList().
- *
- * \sa dd_function_table::BeginCallList.
- */
- void (*EndCallList)( struct gl_context *ctx );
-
/**@}*/
/**
@@ -963,8 +875,6 @@ struct dd_function_table {
*/
struct gl_sampler_object * (*NewSamplerObject)(struct gl_context *ctx,
GLuint name);
- void (*DeleteSamplerObject)(struct gl_context *ctx,
- struct gl_sampler_object *samp);
/**
* \name Return a timestamp in nanoseconds as defined by GL_ARB_timer_query.
@@ -1007,12 +917,6 @@ struct dd_function_table {
* \name GL_ARB_shader_image_load_store interface.
*/
/** @{ */
- void (*BindImageTexture)(struct gl_context *ctx,
- struct gl_image_unit *unit,
- struct gl_texture_object *texObj,
- GLint level, GLboolean layered, GLint layer,
- GLenum access, GLenum format);
-
void (*MemoryBarrier)(struct gl_context *ctx, GLbitfield barriers);
/** @} */
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 5554738d1a3..e8059c7b260 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -105,13 +105,12 @@ struct gl_list_extensions
* \param ctx GL context.
*
* Checks if dd_function_table::SaveNeedFlush is marked to flush
- * stored (save) vertices, and calls
- * dd_function_table::SaveFlushVertices if so.
+ * stored (save) vertices, and calls vbo_save_SaveFlushVertices if so.
*/
#define SAVE_FLUSH_VERTICES(ctx) \
do { \
if (ctx->Driver.SaveNeedFlush) \
- ctx->Driver.SaveFlushVertices(ctx); \
+ vbo_save_SaveFlushVertices(ctx); \
} while (0)
@@ -5466,7 +5465,7 @@ save_Begin(GLenum mode)
/* Give the driver an opportunity to hook in an optimized
* display list compiler.
*/
- if (ctx->Driver.NotifySaveBegin(ctx, mode))
+ if (vbo_save_NotifyBegin(ctx, mode))
return;
SAVE_FLUSH_VERTICES(ctx);
@@ -7743,8 +7742,7 @@ execute_list(struct gl_context *ctx, GLuint list)
ctx->ListState.CallDepth++;
- if (ctx->Driver.BeginCallList)
- ctx->Driver.BeginCallList(ctx, dlist);
+ vbo_save_BeginCallList(ctx, dlist);
n = dlist->Head;
@@ -8900,8 +8898,7 @@ execute_list(struct gl_context *ctx, GLuint list)
}
}
- if (ctx->Driver.EndCallList)
- ctx->Driver.EndCallList(ctx);
+ vbo_save_EndCallList(ctx);
ctx->ListState.CallDepth--;
}
@@ -9029,7 +9026,7 @@ _mesa_NewList(GLuint name, GLenum mode)
ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head;
ctx->ListState.CurrentPos = 0;
- ctx->Driver.NewList(ctx, name, mode);
+ vbo_save_NewList(ctx, name, mode);
ctx->CurrentDispatch = ctx->Save;
_glapi_set_dispatch(ctx->CurrentDispatch);
@@ -9063,7 +9060,7 @@ _mesa_EndList(void)
/* Call before emitting END_OF_LIST, in case the driver wants to
* emit opcodes itself.
*/
- ctx->Driver.EndList(ctx);
+ vbo_save_EndList(ctx);
(void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0);
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index c0030bc5687..e4e2a18c1da 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -32,6 +32,7 @@
#include "main/imports.h"
#include "main/macros.h"
#include "main/samplerobj.h"
+#include "main/shaderobj.h"
#include "main/texenvprogram.h"
#include "main/texobj.h"
#include "main/uniforms.h"
@@ -1208,7 +1209,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
p.top_instructions = p.shader->ir;
p.instructions = p.shader->ir;
p.state = key;
- p.shader_program = ctx->Driver.NewShaderProgram(0);
+ p.shader_program = _mesa_new_shader_program(0);
/* Tell the linker to ignore the fact that we're building a
* separate shader, in case we're in a GLES2 context that would
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 37e2c29c89c..d18166d528e 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -271,8 +271,7 @@ _mesa_reference_framebuffer_(struct gl_framebuffer **ptr,
* Resize the given framebuffer's renderbuffers to the new width and height.
* This should only be used for window-system framebuffers, not
* user-created renderbuffers (i.e. made with GL_EXT_framebuffer_object).
- * This will typically be called via ctx->Driver.ResizeBuffers() or directly
- * from a device driver.
+ * This will typically be called directly from a device driver.
*
* \note it's possible for ctx to be null since a window can be resized
* without a currently bound rendering context.
@@ -965,3 +964,22 @@ _mesa_print_framebuffer(const struct gl_framebuffer *fb)
}
}
}
+
+bool
+_mesa_is_front_buffer_reading(const struct gl_framebuffer *fb)
+{
+ if (!fb || _mesa_is_user_fbo(fb))
+ return false;
+
+ return fb->_ColorReadBufferIndex == BUFFER_FRONT_LEFT;
+}
+
+bool
+_mesa_is_front_buffer_drawing(const struct gl_framebuffer *fb)
+{
+ if (!fb || _mesa_is_user_fbo(fb))
+ return false;
+
+ return (fb->_NumColorDrawBuffers >= 1 &&
+ fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT);
+}
diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h
index 08e43222045..bfc8a0836e7 100644
--- a/src/mesa/main/framebuffer.h
+++ b/src/mesa/main/framebuffer.h
@@ -139,4 +139,10 @@ _mesa_get_read_renderbuffer_for_format(const struct gl_context *ctx,
extern void
_mesa_print_framebuffer(const struct gl_framebuffer *fb);
+extern bool
+_mesa_is_front_buffer_reading(const struct gl_framebuffer *fb);
+
+extern bool
+_mesa_is_front_buffer_drawing(const struct gl_framebuffer *fb);
+
#endif /* FRAMEBUFFER_H */
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 38b08b02a65..c295615b475 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -124,6 +124,15 @@ descriptor=[
# GL_EXT_texture_filter_anisotropic
[ "MAX_TEXTURE_MAX_ANISOTROPY_EXT", "CONTEXT_FLOAT(Const.MaxTextureMaxAnisotropy), extra_EXT_texture_filter_anisotropic" ],
+
+# GL_KHR_debug (GL 4.3)/ GL_ARB_debug_output
+ [ "DEBUG_LOGGED_MESSAGES", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
+ [ "DEBUG_NEXT_LOGGED_MESSAGE_LENGTH", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
+ [ "MAX_DEBUG_LOGGED_MESSAGES", "CONST(MAX_DEBUG_LOGGED_MESSAGES), NO_EXTRA" ],
+ [ "MAX_DEBUG_MESSAGE_LENGTH", "CONST(MAX_DEBUG_MESSAGE_LENGTH), NO_EXTRA" ],
+ [ "MAX_LABEL_LENGTH", "CONST(MAX_LABEL_LENGTH), NO_EXTRA" ],
+ [ "MAX_DEBUG_GROUP_STACK_DEPTH", "CONST(MAX_DEBUG_GROUP_STACK_DEPTH), NO_EXTRA" ],
+ [ "DEBUG_GROUP_STACK_DEPTH", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
]},
# Enums in OpenGL and GLES1
@@ -791,15 +800,6 @@ descriptor=[
# GL_ARB_robustness
[ "RESET_NOTIFICATION_STRATEGY_ARB", "CONTEXT_ENUM(Const.ResetStrategy), NO_EXTRA" ],
-# GL_KHR_debug (GL 4.3)/ GL_ARB_debug_output
- [ "DEBUG_LOGGED_MESSAGES", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
- [ "DEBUG_NEXT_LOGGED_MESSAGE_LENGTH", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
- [ "MAX_DEBUG_LOGGED_MESSAGES", "CONST(MAX_DEBUG_LOGGED_MESSAGES), NO_EXTRA" ],
- [ "MAX_DEBUG_MESSAGE_LENGTH", "CONST(MAX_DEBUG_MESSAGE_LENGTH), NO_EXTRA" ],
- [ "MAX_LABEL_LENGTH", "CONST(MAX_LABEL_LENGTH), NO_EXTRA" ],
- [ "MAX_DEBUG_GROUP_STACK_DEPTH", "CONST(MAX_DEBUG_GROUP_STACK_DEPTH), NO_EXTRA" ],
- [ "DEBUG_GROUP_STACK_DEPTH", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
-
[ "MAX_DUAL_SOURCE_DRAW_BUFFERS", "CONTEXT_INT(Const.MaxDualSourceDrawBuffers), extra_ARB_blend_func_extended" ],
# GL_ARB_uniform_buffer_object
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index 7dab33c0051..faa63825380 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -2678,6 +2678,7 @@ _mesa_es3_effective_internal_format_for_format_and_type(GLenum format,
* internal formats, they do not correspond to GL constants, so the base
* format is returned instead.
*/
+ case GL_BGRA_EXT:
case GL_LUMINANCE_ALPHA:
case GL_LUMINANCE:
case GL_ALPHA:
@@ -2797,8 +2798,19 @@ _mesa_es3_error_check_format_and_type(const struct gl_context *ctx,
if (effectiveInternalFormat == GL_NONE)
return GL_INVALID_OPERATION;
- GLenum baseInternalFormat =
- _mesa_base_tex_format(ctx, effectiveInternalFormat);
+ GLenum baseInternalFormat;
+ if (internalFormat == GL_BGRA_EXT) {
+ /* Unfortunately, _mesa_base_tex_format returns a base format of
+ * GL_RGBA for GL_BGRA_EXT. This makes perfect sense if you're
+ * asking the question, "what channels does this format have?"
+ * However, if we're trying to determine if two internal formats
+ * match in the ES3 sense, we actually want GL_BGRA.
+ */
+ baseInternalFormat = GL_BGRA_EXT;
+ } else {
+ baseInternalFormat =
+ _mesa_base_tex_format(ctx, effectiveInternalFormat);
+ }
if (internalFormat != baseInternalFormat)
return GL_INVALID_OPERATION;
@@ -2807,6 +2819,11 @@ _mesa_es3_error_check_format_and_type(const struct gl_context *ctx,
}
switch (format) {
+ case GL_BGRA_EXT:
+ if (type != GL_UNSIGNED_BYTE || internalFormat != GL_BGRA)
+ return GL_INVALID_OPERATION;
+ break;
+
case GL_RGBA:
switch (type) {
case GL_UNSIGNED_BYTE:
diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c
index 984239a7276..5d0c15d35ab 100644
--- a/src/mesa/main/hint.c
+++ b/src/mesa/main/hint.c
@@ -123,11 +123,6 @@ _mesa_Hint( GLenum target, GLenum mode )
default:
goto invalid_target;
}
-
- if (ctx->Driver.Hint) {
- (*ctx->Driver.Hint)( ctx, target, mode );
- }
-
return;
invalid_target:
diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 7147fd6e4fe..00e31b05c99 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -43,7 +43,6 @@
#include "glheader.h"
-#include "colormac.h"
#include "enums.h"
#include "image.h"
#include "imports.h"
@@ -1124,7 +1123,8 @@ _mesa_pack_depth_span( struct gl_context *ctx, GLuint n, GLvoid *dest,
}
break;
default:
- _mesa_problem(ctx, "bad type in _mesa_pack_depth_span");
+ _mesa_problem(ctx, "bad type in _mesa_pack_depth_span (%s)",
+ _mesa_enum_to_string(dstType));
}
free(depthCopy);
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index c7b96664c21..676dd367b3f 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -72,6 +72,14 @@ lookup_samplerobj_locked(struct gl_context *ctx, GLuint name)
_mesa_HashLookupLocked(ctx->Shared->SamplerObjects, name);
}
+static void
+delete_sampler_object(struct gl_context *ctx,
+ struct gl_sampler_object *sampObj)
+{
+ mtx_destroy(&sampObj->Mutex);
+ free(sampObj->Label);
+ free(sampObj);
+}
/**
* Handle reference counting.
@@ -94,10 +102,8 @@ _mesa_reference_sampler_object_(struct gl_context *ctx,
deleteFlag = (oldSamp->RefCount == 0);
mtx_unlock(&oldSamp->Mutex);
- if (deleteFlag) {
- assert(ctx->Driver.DeleteSamplerObject);
- ctx->Driver.DeleteSamplerObject(ctx, oldSamp);
- }
+ if (deleteFlag)
+ delete_sampler_object(ctx, oldSamp);
*ptr = NULL;
}
@@ -162,19 +168,6 @@ _mesa_new_sampler_object(struct gl_context *ctx, GLuint name)
return sampObj;
}
-
-/**
- * Fallback for ctx->Driver.DeleteSamplerObject();
- */
-static void
-_mesa_delete_sampler_object(struct gl_context *ctx,
- struct gl_sampler_object *sampObj)
-{
- mtx_destroy(&sampObj->Mutex);
- free(sampObj->Label);
- free(sampObj);
-}
-
static void
create_samplers(struct gl_context *ctx, GLsizei count, GLuint *samplers,
const char *caller)
@@ -628,8 +621,12 @@ static GLuint
set_sampler_compare_mode(struct gl_context *ctx,
struct gl_sampler_object *samp, GLint param)
{
+ /* If GL_ARB_shadow is not supported, don't report an error. The
+ * sampler object extension spec isn't clear on this extension interaction.
+ * Silences errors with Wine on older GPUs such as R200.
+ */
if (!ctx->Extensions.ARB_shadow)
- return INVALID_PNAME;
+ return GL_FALSE;
if (samp->CompareMode == param)
return GL_FALSE;
@@ -649,8 +646,12 @@ static GLuint
set_sampler_compare_func(struct gl_context *ctx,
struct gl_sampler_object *samp, GLint param)
{
+ /* If GL_ARB_shadow is not supported, don't report an error. The
+ * sampler object extension spec isn't clear on this extension interaction.
+ * Silences errors with Wine on older GPUs such as R200.
+ */
if (!ctx->Extensions.ARB_shadow)
- return INVALID_PNAME;
+ return GL_FALSE;
if (samp->CompareFunc == param)
return GL_FALSE;
@@ -1336,13 +1337,9 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
*params = IROUND(sampObj->LodBias);
break;
case GL_TEXTURE_COMPARE_MODE:
- if (!ctx->Extensions.ARB_shadow)
- goto invalid_pname;
*params = sampObj->CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC:
- if (!ctx->Extensions.ARB_shadow)
- goto invalid_pname;
*params = sampObj->CompareFunc;
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
@@ -1425,13 +1422,9 @@ _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
*params = sampObj->LodBias;
break;
case GL_TEXTURE_COMPARE_MODE:
- if (!ctx->Extensions.ARB_shadow)
- goto invalid_pname;
*params = (GLfloat) sampObj->CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC:
- if (!ctx->Extensions.ARB_shadow)
- goto invalid_pname;
*params = (GLfloat) sampObj->CompareFunc;
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
@@ -1504,13 +1497,9 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
*params = (GLint) sampObj->LodBias;
break;
case GL_TEXTURE_COMPARE_MODE:
- if (!ctx->Extensions.ARB_shadow)
- goto invalid_pname;
*params = sampObj->CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC:
- if (!ctx->Extensions.ARB_shadow)
- goto invalid_pname;
*params = sampObj->CompareFunc;
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
@@ -1583,13 +1572,9 @@ _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
*params = (GLuint) sampObj->LodBias;
break;
case GL_TEXTURE_COMPARE_MODE:
- if (!ctx->Extensions.ARB_shadow)
- goto invalid_pname;
*params = sampObj->CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC:
- if (!ctx->Extensions.ARB_shadow)
- goto invalid_pname;
*params = sampObj->CompareFunc;
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
@@ -1626,5 +1611,4 @@ void
_mesa_init_sampler_object_functions(struct dd_function_table *driver)
{
driver->NewSamplerObject = _mesa_new_sampler_object;
- driver->DeleteSamplerObject = _mesa_delete_sampler_object;
}
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 718967605b5..6d73e3bdcf2 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -996,7 +996,7 @@ program_resource_top_level_array_stride(struct gl_shader_program *shProg,
const glsl_type *array_type = field->type->fields.array;
if (interface->interface_packing != GLSL_INTERFACE_PACKING_STD430) {
- if (array_type->is_record()) {
+ if (array_type->is_record() || array_type->is_array()) {
array_stride = array_type->std140_size(row_major);
array_stride = glsl_align(array_stride, 16);
} else {
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 82a1ec37130..9dd1054c8ee 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -320,7 +320,7 @@ create_shader_program(struct gl_context *ctx)
name = _mesa_HashFindFreeKeyBlock(ctx->Shared->ShaderObjects, 1);
- shProg = ctx->Driver.NewShaderProgram(name);
+ shProg = _mesa_new_shader_program(name);
_mesa_HashInsert(ctx->Shared->ShaderObjects, name, shProg);
@@ -2597,7 +2597,7 @@ _mesa_GetUniformSubroutineuiv(GLenum shadertype, GLint location,
{
struct gl_uniform_storage *uni = sh->SubroutineUniformRemapTable[location];
- int offset = location - uni->subroutine[stage].index;
+ int offset = location - uni->opaque[stage].index;
memcpy(params, &uni->storage[offset],
sizeof(GLuint));
}
diff --git a/src/mesa/main/shaderimage.c b/src/mesa/main/shaderimage.c
index c4bba842ca7..bd4b7c7be3b 100644
--- a/src/mesa/main/shaderimage.c
+++ b/src/mesa/main/shaderimage.c
@@ -577,10 +577,6 @@ _mesa_BindImageTexture(GLuint unit, GLuint texture, GLint level,
u->Layered = GL_FALSE;
u->Layer = 0;
}
-
- if (ctx->Driver.BindImageTexture)
- ctx->Driver.BindImageTexture(ctx, u, u->TexObj, level, layered,
- layer, access, format);
}
void GLAPIENTRY
@@ -719,11 +715,6 @@ _mesa_BindImageTextures(GLuint first, GLsizei count, const GLuint *textures)
u->_ActualFormat = MESA_FORMAT_R_UNORM8;
u->_Valid = GL_FALSE;
}
-
- /* Pass the BindImageTexture call down to the device driver */
- if (ctx->Driver.BindImageTexture)
- ctx->Driver.BindImageTexture(ctx, u, u->TexObj, u->Level, u->Layered,
- u->Layer, u->Access, u->Format);
}
_mesa_end_texture_lookups(ctx);
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 5cd37d7e4c4..4e85fda24b4 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -74,7 +74,7 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
if (deleteFlag) {
if (old->Name != 0)
_mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
- ctx->Driver.DeleteShader(ctx, old);
+ _mesa_delete_shader(ctx, old);
}
*ptr = NULL;
@@ -116,9 +116,8 @@ _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
/**
* Delete a shader object.
- * Called via ctx->Driver.DeleteShader().
*/
-static void
+void
_mesa_delete_shader(struct gl_context *ctx, struct gl_shader *sh)
{
free((void *)sh->Source);
@@ -210,7 +209,7 @@ _mesa_reference_shader_program_(struct gl_context *ctx,
if (deleteFlag) {
if (old->Name != 0)
_mesa_HashRemove(ctx->Shared->ShaderObjects, old->Name);
- ctx->Driver.DeleteShaderProgram(ctx, old);
+ _mesa_delete_shader_program(ctx, old);
}
*ptr = NULL;
@@ -246,9 +245,8 @@ init_shader_program(struct gl_shader_program *prog)
/**
* Allocate a new gl_shader_program object, initialize it.
- * Called via ctx->Driver.NewShaderProgram()
*/
-static struct gl_shader_program *
+struct gl_shader_program *
_mesa_new_shader_program(GLuint name)
{
struct gl_shader_program *shProg;
@@ -362,7 +360,7 @@ _mesa_free_shader_program_data(struct gl_context *ctx,
for (sh = 0; sh < MESA_SHADER_STAGES; sh++) {
if (shProg->_LinkedShaders[sh] != NULL) {
- ctx->Driver.DeleteShader(ctx, shProg->_LinkedShaders[sh]);
+ _mesa_delete_shader(ctx, shProg->_LinkedShaders[sh]);
shProg->_LinkedShaders[sh] = NULL;
}
}
@@ -374,10 +372,10 @@ _mesa_free_shader_program_data(struct gl_context *ctx,
/**
* Free/delete a shader program object.
- * Called via ctx->Driver.DeleteShaderProgram().
*/
-static void
-_mesa_delete_shader_program(struct gl_context *ctx, struct gl_shader_program *shProg)
+void
+_mesa_delete_shader_program(struct gl_context *ctx,
+ struct gl_shader_program *shProg)
{
_mesa_free_shader_program_data(ctx, shProg);
@@ -439,8 +437,5 @@ void
_mesa_init_shader_object_functions(struct dd_function_table *driver)
{
driver->NewShader = _mesa_new_shader;
- driver->DeleteShader = _mesa_delete_shader;
- driver->NewShaderProgram = _mesa_new_shader_program;
- driver->DeleteShaderProgram = _mesa_delete_shader_program;
driver->LinkShader = _mesa_ir_link_shader;
}
diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h
index 943044e37cd..796de470735 100644
--- a/src/mesa/main/shaderobj.h
+++ b/src/mesa/main/shaderobj.h
@@ -82,6 +82,9 @@ _mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader);
extern struct gl_shader *
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
+extern void
+_mesa_delete_shader(struct gl_context *ctx, struct gl_shader *sh);
+
extern struct gl_shader_program *
_mesa_lookup_shader_program(struct gl_context *ctx, GLuint name);
@@ -89,6 +92,9 @@ extern struct gl_shader_program *
_mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name,
const char *caller);
+extern struct gl_shader_program *
+_mesa_new_shader_program(GLuint name);
+
extern void
_mesa_clear_shader_program_data(struct gl_shader_program *shProg);
@@ -96,6 +102,9 @@ extern void
_mesa_free_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg);
+extern void
+_mesa_delete_shader_program(struct gl_context *ctx,
+ struct gl_shader_program *shProg);
extern void
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index d5ac9f1fb13..1acaf59f432 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -219,12 +219,12 @@ delete_shader_cb(GLuint id, void *data, void *userData)
struct gl_context *ctx = (struct gl_context *) userData;
struct gl_shader *sh = (struct gl_shader *) data;
if (_mesa_validate_shader_target(ctx, sh->Type)) {
- ctx->Driver.DeleteShader(ctx, sh);
+ _mesa_delete_shader(ctx, sh);
}
else {
struct gl_shader_program *shProg = (struct gl_shader_program *) data;
assert(shProg->Type == GL_SHADER_PROGRAM_MESA);
- ctx->Driver.DeleteShaderProgram(ctx, shProg);
+ _mesa_delete_shader_program(ctx, shProg);
}
}
diff --git a/src/mesa/main/streaming-load-memcpy.c b/src/mesa/main/streaming-load-memcpy.c
index d7147afdc5c..32854b60eb2 100644
--- a/src/mesa/main/streaming-load-memcpy.c
+++ b/src/mesa/main/streaming-load-memcpy.c
@@ -59,6 +59,9 @@ _mesa_streaming_load_memcpy(void *restrict dst, void *restrict src, size_t len)
len -= MIN2(bytes_before_alignment_boundary, len);
}
+ if (len >= 64)
+ _mm_mfence();
+
while (len >= 64) {
__m128i *dst_cacheline = (__m128i *)d;
__m128i *src_cacheline = (__m128i *)s;
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index b19c6d74bc0..ac2d2332df8 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -2039,6 +2039,19 @@ const struct function gles11_functions_possible[] = {
{ "glUnmapBufferOES", 11, -1 },
{ "glVertexPointer", 11, _gloffset_VertexPointer },
{ "glViewport", 11, _gloffset_Viewport },
+
+ /* GL_KHR_debug */
+ { "glPushDebugGroupKHR", 11, -1 },
+ { "glPopDebugGroupKHR", 11, -1 },
+ { "glDebugMessageCallbackKHR", 11, -1 },
+ { "glDebugMessageControlKHR", 11, -1 },
+ { "glDebugMessageInsertKHR", 11, -1 },
+ { "glGetDebugMessageLogKHR", 11, -1 },
+ { "glGetObjectLabelKHR", 11, -1 },
+ { "glGetObjectPtrLabelKHR", 11, -1 },
+ { "glObjectLabelKHR", 11, -1 },
+ { "glObjectPtrLabelKHR", 11, -1 },
+
{ NULL, 0, -1 }
};
@@ -2262,6 +2275,18 @@ const struct function gles2_functions_possible[] = {
{ "glEndPerfQueryINTEL", 20, -1 },
{ "glGetPerfQueryDataINTEL", 20, -1 },
+ /* GL_KHR_debug */
+ { "glPushDebugGroupKHR", 20, -1 },
+ { "glPopDebugGroupKHR", 20, -1 },
+ { "glDebugMessageCallbackKHR", 20, -1 },
+ { "glDebugMessageControlKHR", 20, -1 },
+ { "glDebugMessageInsertKHR", 20, -1 },
+ { "glGetDebugMessageLogKHR", 20, -1 },
+ { "glGetObjectLabelKHR", 20, -1 },
+ { "glGetObjectPtrLabelKHR", 20, -1 },
+ { "glObjectLabelKHR", 20, -1 },
+ { "glObjectPtrLabelKHR", 20, -1 },
+
{ NULL, 0, -1 }
};
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 33c959dc1a5..d48729778ae 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -804,11 +804,11 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
/* If the shader stage doesn't use the sampler uniform, skip this.
*/
- if (sh == NULL || !uni->sampler[i].active)
+ if (sh == NULL || !uni->opaque[i].active)
continue;
for (int j = 0; j < count; j++) {
- sh->SamplerUnits[uni->sampler[i].index + offset + j] =
+ sh->SamplerUnits[uni->opaque[i].index + offset + j] =
((unsigned *) values)[j];
}
@@ -850,11 +850,11 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
*/
if (uni->type->is_image()) {
for (int i = 0; i < MESA_SHADER_STAGES; i++) {
- if (uni->image[i].active) {
+ if (uni->opaque[i].active) {
struct gl_shader *sh = shProg->_LinkedShaders[i];
for (int j = 0; j < count; j++)
- sh->ImageUnits[uni->image[i].index + offset + j] =
+ sh->ImageUnits[uni->opaque[i].index + offset + j] =
((GLint *) values)[j];
}
}
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 4df57c148c7..887d0c03a50 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -2354,7 +2354,7 @@ _mesa_print_arrays(struct gl_context *ctx)
void
_mesa_init_varray(struct gl_context *ctx)
{
- ctx->Array.DefaultVAO = ctx->Driver.NewArrayObject(ctx, 0);
+ ctx->Array.DefaultVAO = _mesa_new_vao(ctx, 0);
_mesa_reference_vao(ctx, &ctx->Array.VAO, ctx->Array.DefaultVAO);
ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 98032456662..0214b8e684c 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -2353,11 +2353,12 @@ add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,
struct gl_uniform_storage *storage =
&this->shader_program->UniformStorage[location];
- assert(storage->sampler[shader_type].active);
+ assert(storage->type->is_sampler() &&
+ storage->opaque[shader_type].active);
for (unsigned int j = 0; j < size / 4; j++)
params->ParameterValues[index + j][0].f =
- storage->sampler[shader_type].index + j;
+ storage->opaque[shader_type].index + j;
}
}
diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp
index b1168fdade8..1198a3c45f1 100644
--- a/src/mesa/program/sampler.cpp
+++ b/src/mesa/program/sampler.cpp
@@ -119,7 +119,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
return 0;
}
- if (!shader_program->UniformStorage[location].sampler[shader].active) {
+ if (!shader_program->UniformStorage[location].opaque[shader].active) {
assert(0 && "cannot return a sampler");
linker_error(shader_program,
"cannot return a sampler named %s, because it is not "
@@ -128,7 +128,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler,
return 0;
}
- return shader_program->UniformStorage[location].sampler[shader].index +
+ return shader_program->UniformStorage[location].opaque[shader].index +
getname.offset;
}
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c
index cceed42c828..0f01e9939de 100644
--- a/src/mesa/state_tracker/st_atom_rasterizer.c
+++ b/src/mesa/state_tracker/st_atom_rasterizer.c
@@ -237,6 +237,14 @@ static void update_raster_state( struct st_context *st )
/* _NEW_MULTISAMPLE */
raster->multisample = ctx->Multisample._Enabled;
+ /* _NEW_MULTISAMPLE | _NEW_BUFFERS */
+ raster->force_persample_interp =
+ st->can_force_persample_interp &&
+ ctx->Multisample._Enabled &&
+ ctx->Multisample.SampleShading &&
+ ctx->Multisample.MinSampleShadingValue *
+ ctx->DrawBuffer->Visual.samples > 1;
+
/* _NEW_SCISSOR */
raster->scissor = ctx->Scissor.EnableFlags;
diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c
index fee15a980f3..1e880a107c0 100644
--- a/src/mesa/state_tracker/st_atom_shader.c
+++ b/src/mesa/state_tracker/st_atom_shader.c
@@ -70,8 +70,15 @@ update_fp( struct st_context *st )
key.clamp_color = st->clamp_frag_color_in_shader &&
st->ctx->Color._ClampFragmentColor;
- /* Ignore sample qualifier while computing this flag. */
+ /* Don't set it if the driver can force the interpolation by itself.
+ * If SAMPLE_ID or SAMPLE_POS are used, the interpolation is set
+ * automatically.
+ * Ignore sample qualifier while computing this flag.
+ */
key.persample_shading =
+ !st->can_force_persample_interp &&
+ !(stfp->Base.Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
+ SYSTEM_BIT_SAMPLE_POS)) &&
_mesa_get_min_invocations_per_fragment(st->ctx, &stfp->Base, true) > 1;
st->fp_variant = st_get_fp_variant(st, stfp, &key);
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index db254c2144e..8afd336779f 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -527,8 +527,4 @@ st_init_bufferobject_functions(struct dd_function_table *functions)
functions->UnmapBuffer = st_bufferobj_unmap;
functions->CopyBufferSubData = st_copy_buffer_subdata;
functions->ClearBufferSubData = st_clear_buffer_subdata;
-
- /* For GL_APPLE_vertex_array_object */
- functions->NewArrayObject = _mesa_new_vao;
- functions->DeleteArrayObject = _mesa_delete_vao;
}
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 9d06a232bfa..ff703fa41cb 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -246,17 +246,6 @@ st_renderbuffer_delete(struct gl_context *ctx, struct gl_renderbuffer *rb)
/**
- * Called via ctx->Driver.NewFramebuffer()
- */
-static struct gl_framebuffer *
-st_new_framebuffer(struct gl_context *ctx, GLuint name)
-{
- /* XXX not sure we need to subclass gl_framebuffer for pipe */
- return _mesa_new_framebuffer(ctx, name);
-}
-
-
-/**
* Called via ctx->Driver.NewRenderbuffer()
*/
static struct gl_renderbuffer *
@@ -826,7 +815,7 @@ st_UnmapRenderbuffer(struct gl_context *ctx,
void st_init_fbo_functions(struct dd_function_table *functions)
{
- functions->NewFramebuffer = st_new_framebuffer;
+ functions->NewFramebuffer = _mesa_new_framebuffer;
functions->NewRenderbuffer = st_new_renderbuffer;
functions->FramebufferRenderbuffer = _mesa_FramebufferRenderbuffer_sw;
functions->RenderTexture = st_render_texture;
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 72c23cad4bc..a9ab5edcf49 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -237,6 +237,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
PIPE_BIND_SAMPLER_VIEW);
st->prefer_blit_based_texture_transfer = screen->get_param(screen,
PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER);
+ st->can_force_persample_interp = screen->get_param(screen,
+ PIPE_CAP_FORCE_PERSAMPLE_INTERP);
st->needs_texcoord_semantic =
screen->get_param(screen, PIPE_CAP_TGSI_TEXCOORD);
@@ -410,8 +412,6 @@ void st_init_driver_functions(struct pipe_screen *screen,
_mesa_init_shader_object_functions(functions);
_mesa_init_sampler_object_functions(functions);
- functions->Accum = _mesa_accum;
-
st_init_blit_functions(functions);
st_init_bufferobject_functions(functions);
st_init_clear_functions(functions);
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 81d5480431a..a4cda29059d 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -98,6 +98,7 @@ struct st_context
boolean has_etc1;
boolean has_etc2;
boolean prefer_blit_based_texture_transfer;
+ boolean can_force_persample_interp;
boolean needs_texcoord_semantic;
boolean apply_texture_swizzle_to_border_color;
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index e62dd7aab80..a07f8fec309 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -619,7 +619,9 @@ st_translate_fragment_program(struct st_context *st,
else
interpLocation[slot] = TGSI_INTERPOLATE_LOC_CENTER;
- if (key->persample_shading)
+ if (stfp->Base.Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
+ SYSTEM_BIT_SAMPLE_POS) ||
+ key->persample_shading)
interpLocation[slot] = TGSI_INTERPOLATE_LOC_SAMPLE;
switch (attr) {
@@ -1681,6 +1683,26 @@ st_precompile_shader_variant(struct st_context *st,
break;
}
+ case GL_TESS_CONTROL_PROGRAM_NV: {
+ struct st_tessctrl_program *p = (struct st_tessctrl_program *)prog;
+ struct st_tcp_variant_key key;
+
+ memset(&key, 0, sizeof(key));
+ key.st = st;
+ st_get_tcp_variant(st, p, &key);
+ break;
+ }
+
+ case GL_TESS_EVALUATION_PROGRAM_NV: {
+ struct st_tesseval_program *p = (struct st_tesseval_program *)prog;
+ struct st_tep_variant_key key;
+
+ memset(&key, 0, sizeof(key));
+ key.st = st;
+ st_get_tep_variant(st, p, &key);
+ break;
+ }
+
case GL_GEOMETRY_PROGRAM_NV: {
struct st_geometry_program *p = (struct st_geometry_program *)prog;
struct st_gp_variant_key key;
diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index e7e19a03597..56fa1a382f7 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -85,8 +85,8 @@ static void TAG(render_points_verts)(struct gl_context *ctx,
currentsz = dmasz;
}
} else {
- fprintf(stderr, "%s - cannot draw primitive\n", __func__);
- return;
+ unreachable("Cannot draw primitive; validate_render should have "
+ "prevented this");
}
}
@@ -316,11 +316,12 @@ static void TAG(render_poly_verts)(struct gl_context *ctx,
}
FLUSH();
- } else if (ctx->Light.ShadeModel == GL_SMOOTH) {
+ } else if (ctx->Light.ShadeModel == GL_SMOOTH ||
+ ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION) {
TAG(render_tri_fan_verts)( ctx, start, count, flags );
} else {
- fprintf(stderr, "%s - cannot draw primitive\n", __func__);
- return;
+ unreachable("Cannot draw primitive; validate_render should have "
+ "prevented this");
}
}
@@ -331,14 +332,7 @@ static void TAG(render_quad_strip_verts)(struct gl_context *ctx,
{
GLuint j, nr;
- if (ctx->Light.ShadeModel == GL_FLAT &&
- TNL_CONTEXT(ctx)->vb.AttribPtr[_TNL_ATTRIB_COLOR0]->stride) {
- /* Vertices won't fit in a single buffer or elts not available - should
- * never happen.
- */
- fprintf(stderr, "%s - cannot draw primitive\n", __func__);
- return;
- } else {
+ if (ctx->Light.ShadeModel == GL_SMOOTH) {
LOCAL_VARS;
const unsigned dmasz = GET_SUBSEQUENT_VB_MAX_VERTS() & ~1;
unsigned currentsz;
@@ -364,6 +358,9 @@ static void TAG(render_quad_strip_verts)(struct gl_context *ctx,
}
FLUSH();
+ } else {
+ unreachable("Cannot draw primitive; validate_render should have "
+ "prevented this");
}
}
@@ -373,28 +370,33 @@ static void TAG(render_quads_verts)(struct gl_context *ctx,
GLuint count,
GLuint flags)
{
- LOCAL_VARS;
- GLuint j;
+ if (ctx->Light.ShadeModel == GL_SMOOTH ||
+ ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION) {
+ LOCAL_VARS;
+ GLuint j;
- /* Emit whole number of quads in total. */
- count -= count & 3;
+ /* Emit whole number of quads in total. */
+ count -= count & 3;
- /* Hardware doesn't have a quad primitive type -- try to simulate it using
- * triangle primitive. This is a win for gears, but is it useful in the
- * broader world?
- */
- INIT(GL_TRIANGLES);
-
- for (j = 0; j + 3 < count; j += 4) {
- void *tmp = ALLOC_VERTS(6);
- /* Send v0, v1, v3
- */
- tmp = EMIT_VERTS(ctx, start + j, 2, tmp);
- tmp = EMIT_VERTS(ctx, start + j + 3, 1, tmp);
- /* Send v1, v2, v3
+ /* Hardware doesn't have a quad primitive type -- try to simulate it using
+ * triangle primitive. This is a win for gears, but is it useful in the
+ * broader world?
*/
- tmp = EMIT_VERTS(ctx, start + j + 1, 3, tmp);
- (void) tmp;
+ INIT(GL_TRIANGLES);
+
+ for (j = 0; j + 3 < count; j += 4) {
+ void *tmp = ALLOC_VERTS(6);
+ /* Send v0, v1, v3
+ */
+ tmp = EMIT_VERTS(ctx, start + j, 2, tmp);
+ tmp = EMIT_VERTS(ctx, start + j + 3, 1, tmp);
+ /* Send v1, v2, v3
+ */
+ tmp = EMIT_VERTS(ctx, start + j + 1, 3, tmp);
+ (void) tmp;
+ }
+ } else {
+ unreachable("Cannot draw primitive");
}
}
@@ -461,15 +463,15 @@ static bool TAG(validate_render)(struct gl_context *ctx,
ok = true;
break;
case GL_POLYGON:
- ok = (HAVE_POLYGONS) || ctx->Light.ShadeModel == GL_SMOOTH;
+ ok = (HAVE_POLYGONS) || ctx->Light.ShadeModel == GL_SMOOTH ||
+ ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION;
break;
case GL_QUAD_STRIP:
- ok = VB->Elts ||
- (ctx->Light.ShadeModel != GL_FLAT ||
- VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride == 0);
+ ok = VB->Elts || ctx->Light.ShadeModel == GL_SMOOTH;
break;
case GL_QUADS:
- ok = true; /* flatshading is ok. */
+ ok = ctx->Light.ShadeModel == GL_SMOOTH ||
+ ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION;
break;
default:
break;
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index 2aaff5df019..00e843c9a0f 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -88,6 +88,14 @@ void
vbo_initialize_save_dispatch(const struct gl_context *ctx,
struct _glapi_table *exec);
+void vbo_exec_FlushVertices(struct gl_context *ctx, GLuint flags);
+void vbo_save_SaveFlushVertices(struct gl_context *ctx);
+GLboolean vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode);
+void vbo_save_NewList(struct gl_context *ctx, GLuint list, GLenum mode);
+void vbo_save_EndList(struct gl_context *ctx);
+void vbo_save_BeginCallList(struct gl_context *ctx, struct gl_display_list *list);
+void vbo_save_EndCallList(struct gl_context *ctx);
+
typedef void (*vbo_draw_func)( struct gl_context *ctx,
const struct _mesa_prim *prims,
diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c
index eb903504328..a301c6c9a22 100644
--- a/src/mesa/vbo/vbo_exec.c
+++ b/src/mesa/vbo/vbo_exec.c
@@ -50,8 +50,6 @@ void vbo_exec_init( struct gl_context *ctx )
ctx->Driver.NeedFlush = 0;
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
- ctx->Driver.BeginVertices = vbo_exec_BeginVertices;
- ctx->Driver.FlushVertices = vbo_exec_FlushVertices;
vbo_exec_invalidate_state( ctx, ~0 );
}
diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
index f17fe684cc3..80f3015925d 100644
--- a/src/mesa/vbo/vbo_exec.h
+++ b/src/mesa/vbo/vbo_exec.h
@@ -148,7 +148,6 @@ void vbo_exec_destroy( struct gl_context *ctx );
void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state );
void vbo_exec_BeginVertices( struct gl_context *ctx );
-void vbo_exec_FlushVertices( struct gl_context *ctx, GLuint flags );
/* Internal functions:
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 138cd60513d..583a2f9b79f 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -419,7 +419,7 @@ do { \
struct vbo_exec_context *exec = &vbo_context(ctx)->exec; \
int sz = (sizeof(C) / sizeof(GLfloat)); \
if (unlikely(!(ctx->Driver.NeedFlush & FLUSH_UPDATE_CURRENT))) \
- ctx->Driver.BeginVertices( ctx ); \
+ vbo_exec_BeginVertices(ctx); \
\
if (unlikely(exec->vtx.active_sz[A] != N * sz) || \
unlikely(exec->vtx.attrtype[A] != T)) \
@@ -1165,7 +1165,14 @@ void vbo_exec_BeginVertices( struct gl_context *ctx )
/**
- * Called via ctx->Driver.FlushVertices()
+ * If inside glBegin()/glEnd(), it should assert(0). Otherwise, if
+ * FLUSH_STORED_VERTICES bit in \p flags is set flushes any buffered
+ * vertices, if FLUSH_UPDATE_CURRENT bit is set updates
+ * __struct gl_contextRec::Current and gl_light_attrib::Material
+ *
+ * Note that the default T&L engine never clears the
+ * FLUSH_UPDATE_CURRENT bit, even after performing the update.
+ *
* \param flags bitmask of FLUSH_STORED_VERTICES, FLUSH_UPDATE_CURRENT
*/
void vbo_exec_FlushVertices( struct gl_context *ctx, GLuint flags )
@@ -1190,7 +1197,7 @@ void vbo_exec_FlushVertices( struct gl_context *ctx, GLuint flags )
/* Flush (draw), and make sure VBO is left unmapped when done */
vbo_exec_FlushVertices_internal(exec, GL_TRUE);
- /* Need to do this to ensure BeginVertices gets called again:
+ /* Need to do this to ensure vbo_exec_BeginVertices gets called again:
*/
ctx->Driver.NeedFlush &= ~(FLUSH_UPDATE_CURRENT | flags);
diff --git a/src/mesa/vbo/vbo_save.c b/src/mesa/vbo/vbo_save.c
index a177660c0f2..79603e9b32e 100644
--- a/src/mesa/vbo/vbo_save.c
+++ b/src/mesa/vbo/vbo_save.c
@@ -33,18 +33,6 @@
#include "vbo_context.h"
-static void vbo_save_callback_init( struct gl_context *ctx )
-{
- ctx->Driver.NewList = vbo_save_NewList;
- ctx->Driver.EndList = vbo_save_EndList;
- ctx->Driver.SaveFlushVertices = vbo_save_SaveFlushVertices;
- ctx->Driver.BeginCallList = vbo_save_BeginCallList;
- ctx->Driver.EndCallList = vbo_save_EndCallList;
- ctx->Driver.NotifySaveBegin = vbo_save_NotifyBegin;
-}
-
-
-
/**
* Called at context creation time.
*/
@@ -56,7 +44,6 @@ void vbo_save_init( struct gl_context *ctx )
save->ctx = ctx;
vbo_save_api_init( save );
- vbo_save_callback_init(ctx);
{
struct gl_client_array *arrays = save->arrays;
diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h
index 5b1ac81771e..8032db8a9e0 100644
--- a/src/mesa/vbo/vbo_save.h
+++ b/src/mesa/vbo/vbo_save.h
@@ -175,13 +175,6 @@ void vbo_loopback_vertex_list( struct gl_context *ctx,
/* Callbacks:
*/
-void vbo_save_EndList( struct gl_context *ctx );
-void vbo_save_NewList( struct gl_context *ctx, GLuint list, GLenum mode );
-void vbo_save_EndCallList( struct gl_context *ctx );
-void vbo_save_BeginCallList( struct gl_context *ctx, struct gl_display_list *list );
-void vbo_save_SaveFlushVertices( struct gl_context *ctx );
-GLboolean vbo_save_NotifyBegin( struct gl_context *ctx, GLenum mode );
-
void vbo_save_playback_vertex_list( struct gl_context *ctx, void *data );
void vbo_save_api_init( struct vbo_save_context *save );
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 29de3d38aaa..1a70d168c55 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -970,8 +970,7 @@ _save_CallLists(GLsizei n, GLenum type, const GLvoid * v)
/**
- * Called via ctx->Driver.NotifySaveBegin() when a glBegin is getting
- * compiled into a display list.
+ * Called when a glBegin is getting compiled into a display list.
* Updating of ctx->Driver.CurrentSavePrimitive is already taken care of.
*/
GLboolean
@@ -1001,7 +1000,7 @@ vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode)
_mesa_install_save_vtxfmt(ctx, &save->vtxfmt);
}
- /* We need to call SaveFlushVertices() if there's state change */
+ /* We need to call vbo_save_SaveFlushVertices() if there's state change */
ctx->Driver.SaveNeedFlush = GL_TRUE;
/* GL_TRUE means we've handled this glBegin here; don't compile a BEGIN
@@ -1604,8 +1603,6 @@ vbo_save_api_init(struct vbo_save_context *save)
vbo_destroy_vertex_list,
vbo_print_vertex_list);
- ctx->Driver.NotifySaveBegin = vbo_save_NotifyBegin;
-
_save_vtxfmt_init(ctx);
_save_current_init(ctx);
_mesa_noop_vtxfmt_init(&save->vtxfmt_noop);