enum VS_OUTPUT
{
- VS_O_VPOS,
- VS_O_L_ADDR0,
+ VS_O_VPOS = 0,
+ VS_O_L_ADDR0 = 0,
VS_O_L_ADDR1,
VS_O_R_ADDR0,
VS_O_R_ADDR1
o_addr[1] = ureg_DECL_output(shader, TGSI_SEMANTIC_GENERIC, VS_O_L_ADDR1);
/*
- * scale = (BLOCK_WIDTH, BLOCK_HEIGHT) / (dst.width, dst.height)
+ * scale = (VL_BLOCK_WIDTH, VL_BLOCK_HEIGHT) / (dst.width, dst.height)
*
- * t_vpos = vpos + 7 / BLOCK_WIDTH
+ * t_vpos = vpos + 7 / VL_BLOCK_WIDTH
* o_vpos.xy = t_vpos * scale
*
* o_addr = calc_addr(...)
*/
scale = ureg_imm2f(shader,
- (float)BLOCK_WIDTH / idct->buffer_width,
- (float)BLOCK_HEIGHT / idct->buffer_height);
+ (float)VL_BLOCK_WIDTH / idct->buffer_width,
+ (float)VL_BLOCK_HEIGHT / idct->buffer_height);
ureg_MAD(shader, ureg_writemask(o_vpos, TGSI_WRITEMASK_XY), vpos, scale, scale);
ureg_MOV(shader, ureg_writemask(o_vpos, TGSI_WRITEMASK_ZW), ureg_imm1f(shader, 1.0f));
o_r_addr[1] = ureg_DECL_output(shader, TGSI_SEMANTIC_GENERIC, VS_O_R_ADDR1);
/*
- * scale = (BLOCK_WIDTH, BLOCK_HEIGHT) / (dst.width, dst.height)
+ * scale = (VL_BLOCK_WIDTH, VL_BLOCK_HEIGHT) / (dst.width, dst.height)
*
* t_vpos = vpos + vrect
* o_vpos.xy = t_vpos * scale
*/
scale = ureg_imm2f(shader,
- (float)BLOCK_WIDTH / idct->buffer_width,
- (float)BLOCK_HEIGHT / idct->buffer_height);
+ (float)VL_BLOCK_WIDTH / idct->buffer_width,
+ (float)VL_BLOCK_HEIGHT / idct->buffer_height);
ureg_ADD(shader, ureg_writemask(t_tex, TGSI_WRITEMASK_XY), vpos, vrect);
ureg_MUL(shader, ureg_writemask(t_tex, TGSI_WRITEMASK_XY), ureg_src(t_tex), scale);
ureg_MUL(shader, ureg_writemask(t_start, TGSI_WRITEMASK_XY), vpos, scale);
calc_addr(shader, o_l_addr, ureg_src(t_tex), ureg_src(t_start), false, false, idct->buffer_width / 4);
- calc_addr(shader, o_r_addr, vrect, ureg_imm1f(shader, 0.0f), true, true, BLOCK_WIDTH / 4);
+ calc_addr(shader, o_r_addr, vrect, ureg_imm1f(shader, 0.0f), true, true, VL_BLOCK_WIDTH / 4);
ureg_release_temporary(shader, t_tex);
ureg_release_temporary(shader, t_start);
for (i = 0; i < idct->nr_of_render_targets; ++i) {
struct ureg_src s_addr[2];
- increment_addr(shader, r, r_addr, true, true, i - (signed)idct->nr_of_render_targets / 2, BLOCK_HEIGHT);
+ increment_addr(shader, r, r_addr, true, true, i - (signed)idct->nr_of_render_targets / 2, VL_BLOCK_HEIGHT);
s_addr[0] = ureg_src(r[0]);
s_addr[1] = ureg_src(r[1]);
o_r_addr[1] = ureg_DECL_output(shader, TGSI_SEMANTIC_GENERIC, first_output + VS_O_R_ADDR1);
scale = ureg_imm2f(shader,
- (float)BLOCK_WIDTH / idct->buffer_width,
- (float)BLOCK_HEIGHT / idct->buffer_height);
+ (float)VL_BLOCK_WIDTH / idct->buffer_width,
+ (float)VL_BLOCK_HEIGHT / idct->buffer_height);
ureg_MUL(shader, ureg_writemask(tex, TGSI_WRITEMASK_Z),
ureg_scalar(vrect, TGSI_SWIZZLE_X),
- ureg_imm1f(shader, BLOCK_WIDTH / idct->nr_of_render_targets));
+ ureg_imm1f(shader, VL_BLOCK_WIDTH / idct->nr_of_render_targets));
ureg_MUL(shader, ureg_writemask(t_start, TGSI_WRITEMASK_XY), vpos, scale);
- calc_addr(shader, o_l_addr, vrect, ureg_imm1f(shader, 0.0f), false, false, BLOCK_WIDTH / 4);
+ calc_addr(shader, o_l_addr, vrect, ureg_imm1f(shader, 0.0f), false, false, VL_BLOCK_WIDTH / 4);
calc_addr(shader, o_r_addr, ureg_src(tex), ureg_src(t_start), true, false, idct->buffer_height / 4);
ureg_MOV(shader, ureg_writemask(o_r_addr[0], TGSI_WRITEMASK_Z), ureg_src(tex));
memset(&rs_state, 0, sizeof(rs_state));
rs_state.point_size = 1;
- rs_state.gl_rasterization_rules = true;
+ rs_state.half_pixel_center = true;
+ rs_state.bottom_edge_rule = true;
+ rs_state.depth_clip = 1;
idct->rs_state = idct->pipe->create_rasterizer_state(idct->pipe, &rs_state);
if (!idct->rs_state)
goto error_rs_state;
surf_templ.format = tex->format;
surf_templ.u.tex.first_layer = 0;
surf_templ.u.tex.last_layer = 0;
- surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
buffer->fb_state_mismatch.cbufs[0] = idct->pipe->create_surface(idct->pipe, tex, &surf_templ);
buffer->viewport_mismatch.scale[0] = tex->width0;
surf_templ.format = tex->format;
surf_templ.u.tex.first_layer = i;
surf_templ.u.tex.last_layer = i;
- surf_templ.usage = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
buffer->fb_state.cbufs[i] = idct->pipe->create_surface(
idct->pipe, tex, &surf_templ);
struct pipe_box rect =
{
0, 0, 0,
- BLOCK_WIDTH / 4,
- BLOCK_HEIGHT,
+ VL_BLOCK_WIDTH / 4,
+ VL_BLOCK_HEIGHT,
1
};
if (!matrix)
goto error_matrix;
- buf_transfer = pipe->get_transfer
- (
- pipe, matrix,
- 0, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD,
- &rect
- );
- if (!buf_transfer)
- goto error_transfer;
-
- pitch = buf_transfer->stride / sizeof(float);
-
- f = pipe->transfer_map(pipe, buf_transfer);
+ f = pipe->transfer_map(pipe, matrix, 0,
+ PIPE_TRANSFER_WRITE |
+ PIPE_TRANSFER_DISCARD_RANGE,
+ &rect, &buf_transfer);
if (!f)
goto error_map;
- for(i = 0; i < BLOCK_HEIGHT; ++i)
- for(j = 0; j < BLOCK_WIDTH; ++j)
+ pitch = buf_transfer->stride / sizeof(float);
+
+ for(i = 0; i < VL_BLOCK_HEIGHT; ++i)
+ for(j = 0; j < VL_BLOCK_WIDTH; ++j)
// transpose and scale
f[i * pitch + j] = ((const float (*)[8])const_matrix)[j][i] * scale;
pipe->transfer_unmap(pipe, buf_transfer);
- pipe->transfer_destroy(pipe, buf_transfer);
memset(&sv_templ, 0, sizeof(sv_templ));
u_sampler_view_default_template(&sv_templ, matrix, matrix->format);
return sv;
error_map:
- pipe->transfer_destroy(pipe, buf_transfer);
-
-error_transfer:
pipe_resource_reference(&matrix, NULL);
error_matrix: