X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fsvga%2Fsvga_state_constants.c;h=2c1b7048673ece9546b0699967a67cb064032178;hb=acecee4c2db48fb36bce1170d8747c7345ba3541;hp=31e4be0624c03a71dd6f03d18ffcd6393dfc035f;hpb=0baa372b6fa4b21e0214e8f208fe08b2ab2b0ecc;p=mesa.git diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c index 31e4be0624c..2c1b7048673 100644 --- a/src/gallium/drivers/svga/svga_state_constants.c +++ b/src/gallium/drivers/svga/svga_state_constants.c @@ -63,7 +63,7 @@ * \return number of float[4] constants put into the 'dest' buffer */ static unsigned -svga_get_extra_constants_common(struct svga_context *svga, +svga_get_extra_constants_common(const struct svga_context *svga, const struct svga_shader_variant *variant, enum pipe_shader_type shader, float *dest) { @@ -72,9 +72,9 @@ svga_get_extra_constants_common(struct svga_context *svga, unsigned count = 0; for (i = 0; i < variant->key.num_textures; i++) { - struct pipe_sampler_view *sv = svga->curr.sampler_views[shader][i]; + const struct pipe_sampler_view *sv = svga->curr.sampler_views[shader][i]; if (sv) { - struct pipe_resource *tex = sv->texture; + const struct pipe_resource *tex = sv->texture; /* Scaling factors needed for handling unnormalized texture coordinates * for texture rectangles. */ @@ -82,10 +82,10 @@ svga_get_extra_constants_common(struct svga_context *svga, /* debug/sanity check */ assert(variant->key.tex[i].width_height_idx == count); - *dest++ = 1.0 / (float)tex->width0; - *dest++ = 1.0 / (float)tex->height0; - *dest++ = 1.0; - *dest++ = 1.0; + *dest++ = 1.0f / (float) tex->width0; + *dest++ = 1.0f / (float) tex->height0; + *dest++ = 1.0f; + *dest++ = 1.0f; count++; } @@ -114,7 +114,7 @@ svga_get_extra_constants_common(struct svga_context *svga, * \return number of float[4] constants put into the dest buffer */ static unsigned -svga_get_extra_fs_constants(struct svga_context *svga, float *dest) +svga_get_extra_fs_constants(const struct svga_context *svga, float *dest) { const struct svga_shader_variant *variant = svga->state.hw_draw.fs; unsigned count = 0; @@ -133,7 +133,7 @@ svga_get_extra_fs_constants(struct svga_context *svga, float *dest) * will be returned in 'dest'. */ static unsigned -svga_get_prescale_constants(struct svga_context *svga, float **dest) +svga_get_prescale_constants(const struct svga_context *svga, float **dest) { memcpy(*dest, svga->state.hw_clear.prescale.scale, 4 * sizeof(float)); *dest += 4; @@ -148,9 +148,9 @@ svga_get_prescale_constants(struct svga_context *svga, float **dest) * Emit extra constants needed for point sprite emulation. */ static unsigned -svga_get_pt_sprite_constants(struct svga_context *svga, float **dest) +svga_get_pt_sprite_constants(const struct svga_context *svga, float **dest) { - struct svga_screen *screen = svga_screen(svga->pipe.screen); + const struct svga_screen *screen = svga_screen(svga->pipe.screen); float *dst = *dest; dst[0] = 1.0 / (svga->curr.viewport.scale[0] * 2); @@ -166,7 +166,7 @@ svga_get_pt_sprite_constants(struct svga_context *svga, float **dest) * by '*dest'. The updated buffer pointer will be returned in 'dest'. */ static unsigned -svga_get_clip_plane_constants(struct svga_context *svga, +svga_get_clip_plane_constants(const struct svga_context *svga, const struct svga_shader_variant *variant, float **dest) { @@ -195,7 +195,7 @@ svga_get_clip_plane_constants(struct svga_context *svga, * \return number of float[4] constants put into the dest buffer */ static unsigned -svga_get_extra_vs_constants(struct svga_context *svga, float *dest) +svga_get_extra_vs_constants(const struct svga_context *svga, float *dest) { const struct svga_shader_variant *variant = svga->state.hw_draw.vs; unsigned count = 0; @@ -233,7 +233,7 @@ svga_get_extra_vs_constants(struct svga_context *svga, float *dest) * to by 'dest'. */ static unsigned -svga_get_extra_gs_constants(struct svga_context *svga, float *dest) +svga_get_extra_gs_constants(const struct svga_context *svga, float *dest) { const struct svga_shader_variant *variant = svga->state.hw_draw.gs; unsigned count = 0; @@ -490,12 +490,6 @@ emit_constbuf_vgpu10(struct svga_context *svga, enum pipe_shader_type shader) const struct svga_shader_variant *variant; unsigned alloc_buf_size; - assert(shader == PIPE_SHADER_VERTEX || - shader == PIPE_SHADER_GEOMETRY || - shader == PIPE_SHADER_FRAGMENT); - - cbuf = &svga->curr.constbufs[shader][0]; - switch (shader) { case PIPE_SHADER_VERTEX: variant = svga->state.hw_draw.vs; @@ -519,6 +513,8 @@ emit_constbuf_vgpu10(struct svga_context *svga, enum pipe_shader_type shader) assert(variant); + cbuf = &svga->curr.constbufs[shader][0]; + /* Compute extra constants size and offset in bytes */ extra_size = extra_count * 4 * sizeof(float); extra_offset = 4 * sizeof(float) * variant->extra_const_start; @@ -591,7 +587,8 @@ emit_constbuf_vgpu10(struct svga_context *svga, enum pipe_shader_type shader) /* we must unmap the buffer before getting the winsys handle */ u_upload_unmap(svga->const0_upload); - dst_handle = svga_buffer_handle(svga, dst_buffer); + dst_handle = svga_buffer_handle(svga, dst_buffer, + PIPE_BIND_CONSTANT_BUFFER); if (!dst_handle) { pipe_resource_reference(&dst_buffer, NULL); return PIPE_ERROR_OUT_OF_MEMORY; @@ -660,7 +657,8 @@ emit_consts_vgpu10(struct svga_context *svga, enum pipe_shader_type shader) struct svga_winsys_surface *handle; if (buffer) { - handle = svga_buffer_handle(svga, &buffer->b.b); + handle = svga_buffer_handle(svga, &buffer->b.b, + PIPE_BIND_CONSTANT_BUFFER); enabled_constbufs |= 1 << index; } else { @@ -771,7 +769,8 @@ struct svga_tracked_state svga_hw_vs_constants = "hw vs params", (SVGA_NEW_PRESCALE | SVGA_NEW_VS_CONST_BUFFER | - SVGA_NEW_VS_VARIANT), + SVGA_NEW_VS_VARIANT | + SVGA_NEW_TEXTURE_CONSTS), emit_vs_consts }; @@ -808,8 +807,10 @@ emit_gs_consts(struct svga_context *svga, unsigned dirty) struct svga_tracked_state svga_hw_gs_constants = { "hw gs params", - (SVGA_NEW_GS_CONST_BUFFER | + (SVGA_NEW_PRESCALE | + SVGA_NEW_GS_CONST_BUFFER | SVGA_NEW_RAST | - SVGA_NEW_GS_VARIANT), + SVGA_NEW_GS_VARIANT | + SVGA_NEW_TEXTURE_CONSTS), emit_gs_consts };