const struct brw_tracked_state gen6_vs_state;
const struct brw_tracked_state gen6_wm_state;
-/**
- * Use same key for WM and VS surfaces.
- */
-struct brw_surface_key {
- GLenum target, depthmode;
- drm_intel_bo *bo;
- GLint format, internal_format;
- GLint first_level, last_level;
- GLint width, height, depth;
- GLint pitch, cpp;
- uint32_t tiling;
- GLuint offset;
-};
-
/***********************************************************************
* brw_state.c
*/
/* brw_wm_surface_state.c */
void brw_create_constant_surface(struct brw_context *brw,
- struct brw_surface_key *key,
+ drm_intel_bo *bo,
+ int width,
drm_intel_bo **out_bo,
uint32_t *out_offset);
GLuint surf)
{
struct brw_context *brw = brw_context(ctx);
- struct brw_surface_key key;
struct brw_vertex_program *vp =
(struct brw_vertex_program *) brw->vertex_program;
const struct gl_program_parameter_list *params = vp->program.Base.Parameters;
return;
}
- memset(&key, 0, sizeof(key));
-
- key.format = MESA_FORMAT_RGBA_FLOAT32;
- key.internal_format = GL_RGBA;
- key.bo = brw->vs.const_bo;
- key.depthmode = GL_NONE;
- key.pitch = params->NumParameters;
- key.width = params->NumParameters;
- key.height = 1;
- key.depth = 1;
- key.cpp = 16;
-
- /*
- printf("%s:\n", __FUNCTION__);
- printf(" width %d height %d depth %d cpp %d pitch %d\n",
- key.width, key.height, key.depth, key.cpp, key.pitch);
- */
-
- brw_create_constant_surface(brw, &key, &brw->vs.surf_bo[surf],
+ brw_create_constant_surface(brw, brw->vs.const_bo, params->NumParameters,
+ &brw->vs.surf_bo[surf],
&brw->vs.surf_offset[surf]);
}
*/
void
brw_create_constant_surface(struct brw_context *brw,
- struct brw_surface_key *key,
+ drm_intel_bo *bo,
+ int width,
drm_intel_bo **out_bo,
uint32_t *out_offset)
{
- const GLint w = key->width - 1;
+ const GLint w = width - 1;
struct brw_surface_state surf;
void *map;
surf.ss0.surface_type = BRW_SURFACE_BUFFER;
surf.ss0.surface_format = BRW_SURFACEFORMAT_R32G32B32A32_FLOAT;
- assert(key->bo);
- surf.ss1.base_addr = key->bo->offset; /* reloc */
+ assert(bo);
+ surf.ss1.base_addr = bo->offset; /* reloc */
surf.ss2.width = w & 0x7f; /* bits 6:0 of size or width */
surf.ss2.height = (w >> 7) & 0x1fff; /* bits 19:7 of size or width */
surf.ss3.depth = (w >> 20) & 0x7f; /* bits 26:20 of size or width */
- surf.ss3.pitch = (key->pitch * key->cpp) - 1; /* ignored?? */
- brw_set_surface_tiling(&surf, key->tiling); /* tiling now allowed */
+ surf.ss3.pitch = (width * 16) - 1; /* ignored?? */
+ brw_set_surface_tiling(&surf, I915_TILING_NONE); /* tiling now allowed */
map = brw_state_batch(brw, sizeof(surf), 32, out_bo, out_offset);
memcpy(map, &surf, sizeof(surf));
*/
drm_intel_bo_emit_reloc(*out_bo, (*out_offset +
offsetof(struct brw_surface_state, ss1)),
- key->bo, 0,
+ bo, 0,
I915_GEM_DOMAIN_SAMPLER, 0);
}
static void upload_wm_constant_surface(struct brw_context *brw )
{
GLuint surf = SURF_INDEX_FRAG_CONST_BUFFER;
- struct brw_surface_key key;
struct brw_fragment_program *fp =
(struct brw_fragment_program *) brw->fragment_program;
const struct gl_program_parameter_list *params =
return;
}
- memset(&key, 0, sizeof(key));
-
- key.format = MESA_FORMAT_RGBA_FLOAT32;
- key.internal_format = GL_RGBA;
- key.bo = brw->wm.const_bo;
- key.depthmode = GL_NONE;
- key.pitch = params->NumParameters;
- key.width = params->NumParameters;
- key.height = 1;
- key.depth = 1;
- key.cpp = 16;
-
- /*
- printf("%s:\n", __FUNCTION__);
- printf(" width %d height %d depth %d cpp %d pitch %d\n",
- key.width, key.height, key.depth, key.cpp, key.pitch);
- */
-
- brw_create_constant_surface(brw, &key, &brw->wm.surf_bo[surf],
+ brw_create_constant_surface(brw, brw->wm.const_bo, params->NumParameters,
+ &brw->wm.surf_bo[surf],
&brw->wm.surf_offset[surf]);
brw->state.dirty.brw |= BRW_NEW_WM_SURFACES;
}