#include "util/u_pack_color.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
+#include "util/u_simple_shaders.h"
#include "util/u_upload_mgr.h"
#include "vl/vl_decoder.h"
#include "vl/vl_video_buffer.h"
{
struct r600_context *rctx = (struct r600_context *)context;
+ if (rctx->dummy_pixel_shader) {
+ rctx->context.delete_fs_state(&rctx->context, rctx->dummy_pixel_shader);
+ }
rctx->context.delete_depth_stencil_alpha_state(&rctx->context, rctx->custom_dsa_flush);
util_unreference_framebuffer_state(&rctx->framebuffer);
r600_get_backend_mask(rctx); /* this emits commands and must be last */
+ rctx->dummy_pixel_shader =
+ util_make_fragment_cloneinput_shader(&rctx->context, 0,
+ TGSI_SEMANTIC_GENERIC,
+ TGSI_INTERPOLATE_CONSTANT);
+ rctx->context.bind_fs_state(&rctx->context, rctx->dummy_pixel_shader);
+
return &rctx->context;
}
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
unsigned nr_vertex_buffers;
+ /* With rasterizer discard, there doesn't have to be a pixel shader.
+ * In that case, we bind this one: */
+ struct si_pipe_shader *dummy_pixel_shader;
+
/* SI state handling */
union si_state queued;
union si_state emitted;
tgsi_dump(shader->tokens, 0);
}
- lp_build_tgsi_llvm(bld_base, shader->tokens);
+ if (!lp_build_tgsi_llvm(bld_base, shader->tokens)) {
+ fprintf(stderr, "Failed to translate shader from TGSI to LLVM\n");
+ return -EINVAL;
+ }
radeon_llvm_finalize_module(&si_shader_ctx.radeon_bld);
if (!rctx->ps_shader->bo) {
si_pipe_shader_ps(ctx, rctx->ps_shader);
}
+ if (!rctx->ps_shader->bo) {
+ if (!rctx->dummy_pixel_shader->bo)
+ si_pipe_shader_ps(ctx, rctx->dummy_pixel_shader);
+
+ if (rctx->dummy_pixel_shader->pm4)
+ si_pm4_bind_state(rctx, vs, rctx->dummy_pixel_shader->pm4);
+ }
if (rctx->shader_dirty) {
si_update_spi_map(rctx);