mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 08:50:13 +01:00
r300g: fix breakage after gallium-userbuf merge
This commit is contained in:
parent
550de24c17
commit
bdba35befa
2 changed files with 32 additions and 18 deletions
|
|
@ -103,9 +103,6 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
|
|||
case PIPE_CAP_TGSI_CAN_COMPACT_VARYINGS:
|
||||
case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
|
||||
case PIPE_CAP_VERTEX_COLOR_CLAMPED:
|
||||
case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
|
||||
case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
|
||||
case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
|
||||
case PIPE_CAP_USER_INDEX_BUFFERS:
|
||||
case PIPE_CAP_USER_CONSTANT_BUFFERS:
|
||||
return 1;
|
||||
|
|
@ -149,13 +146,19 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
|
|||
case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
|
||||
case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
|
||||
case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
|
||||
case PIPE_CAP_USER_VERTEX_BUFFERS:
|
||||
return 0;
|
||||
|
||||
/* SWTCL-only features. */
|
||||
case PIPE_CAP_PRIMITIVE_RESTART:
|
||||
case PIPE_CAP_USER_VERTEX_BUFFERS:
|
||||
return !r300screen->caps.has_tcl;
|
||||
|
||||
/* HWTCL-only features / limitations. */
|
||||
case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
|
||||
case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
|
||||
case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
|
||||
return r300screen->caps.has_tcl;
|
||||
|
||||
/* Texturing. */
|
||||
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
|
||||
return r300screen->caps.num_tex_units;
|
||||
|
|
@ -426,11 +429,19 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
|
|||
}
|
||||
|
||||
/* Check vertex buffer format support. */
|
||||
if (usage & PIPE_BIND_VERTEX_BUFFER &&
|
||||
/* Half float is supported on >= R400. */
|
||||
(is_r400 || is_r500 || !is_half_float) &&
|
||||
r300_translate_vertex_data_type(format) != R300_INVALID_FORMAT) {
|
||||
retval |= PIPE_BIND_VERTEX_BUFFER;
|
||||
if (usage & PIPE_BIND_VERTEX_BUFFER) {
|
||||
if (r300_screen(screen)->caps.has_tcl) {
|
||||
/* Half float is supported on >= R400. */
|
||||
if ((is_r400 || is_r500 || !is_half_float) &&
|
||||
r300_translate_vertex_data_type(format) != R300_INVALID_FORMAT) {
|
||||
retval |= PIPE_BIND_VERTEX_BUFFER;
|
||||
}
|
||||
} else {
|
||||
/* SW TCL */
|
||||
if (!util_format_is_pure_integer(format)) {
|
||||
retval |= PIPE_BIND_VERTEX_BUFFER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Transfers are always supported. */
|
||||
|
|
|
|||
|
|
@ -1822,11 +1822,12 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
|
|||
struct pipe_constant_buffer *cb)
|
||||
{
|
||||
struct r300_context* r300 = r300_context(pipe);
|
||||
struct pipe_resource *buf = cb ? cb->buffer : NULL;
|
||||
struct r300_constant_buffer *cbuf;
|
||||
struct r300_resource *rbuf = r300_resource(buf);
|
||||
uint32_t *mapped;
|
||||
|
||||
if (!cb)
|
||||
return;
|
||||
|
||||
switch (shader) {
|
||||
case PIPE_SHADER_VERTEX:
|
||||
cbuf = (struct r300_constant_buffer*)r300->vs_constants.state;
|
||||
|
|
@ -1838,15 +1839,17 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
|
|||
return;
|
||||
}
|
||||
|
||||
if (buf == NULL || buf->width0 == 0)
|
||||
return;
|
||||
|
||||
if (cb->user_buffer)
|
||||
mapped = (uint32_t*)cb->user_buffer;
|
||||
else if (rbuf->constant_buffer)
|
||||
mapped = (uint32_t*)rbuf->constant_buffer;
|
||||
else
|
||||
return;
|
||||
else {
|
||||
struct r300_resource *rbuf = r300_resource(cb->buffer);
|
||||
|
||||
if (rbuf && rbuf->constant_buffer)
|
||||
mapped = (uint32_t*)rbuf->constant_buffer;
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
if (shader == PIPE_SHADER_FRAGMENT ||
|
||||
(shader == PIPE_SHADER_VERTEX && r300->screen->caps.has_tcl)) {
|
||||
|
|
@ -1873,7 +1876,7 @@ static void r300_set_constant_buffer(struct pipe_context *pipe,
|
|||
r300_mark_atom_dirty(r300, &r300->vs_constants);
|
||||
} else if (r300->draw) {
|
||||
draw_set_mapped_constant_buffer(r300->draw, PIPE_SHADER_VERTEX,
|
||||
0, mapped, buf->width0);
|
||||
0, mapped, cb->buffer_size);
|
||||
}
|
||||
} else if (shader == PIPE_SHADER_FRAGMENT) {
|
||||
r300_mark_atom_dirty(r300, &r300->fs_constants);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue