#include "util/format_srgb.h"
#include "tgsi/tgsi_parse.h"
+#include "compiler/nir/nir.h"
#include "nv50/nv50_stateobj.h"
#include "nv50/nv50_context.h"
return NULL;
prog->type = type;
- prog->pipe.tokens = tgsi_dup_tokens(cso->tokens);
+ prog->pipe.type = cso->type;
+
+ switch (cso->type) {
+ case PIPE_SHADER_IR_TGSI:
+ prog->pipe.tokens = tgsi_dup_tokens(cso->tokens);
+ break;
+ case PIPE_SHADER_IR_NIR:
+ prog->pipe.ir.nir = cso->ir.nir;
+ break;
+ default:
+ assert(!"unsupported IR!");
+ free(prog);
+ return NULL;
+ }
if (cso->stream_output.num_outputs)
prog->pipe.stream_output = cso->stream_output;
nv50_program_destroy(nv50_context(pipe), prog);
- FREE((void *)prog->pipe.tokens);
+ if (prog->pipe.type == PIPE_SHADER_IR_TGSI)
+ FREE((void *)prog->pipe.tokens);
+ else if (prog->pipe.type == PIPE_SHADER_IR_NIR)
+ ralloc_free(prog->pipe.ir.nir);
FREE(prog);
}
if (!prog)
return NULL;
prog->type = PIPE_SHADER_COMPUTE;
+ prog->pipe.type = cso->ir_type;
+
+ switch(cso->ir_type) {
+ case PIPE_SHADER_IR_TGSI:
+ prog->pipe.tokens = tgsi_dup_tokens((const struct tgsi_token *)cso->prog);
+ break;
+ case PIPE_SHADER_IR_NIR:
+ prog->pipe.ir.nir = (nir_shader *)cso->prog;
+ break;
+ default:
+ assert(!"unsupported IR!");
+ free(prog);
+ return NULL;
+ }
prog->cp.smem_size = cso->req_local_mem;
prog->cp.lmem_size = cso->req_private_mem;
prog->parm_size = cso->req_input_mem;
- prog->pipe.tokens = tgsi_dup_tokens((const struct tgsi_token *)cso->prog);
-
return (void *)prog;
}
util_copy_framebuffer_state(&nv50->framebuffer, fb);
- nv50->dirty_3d |= NV50_NEW_3D_FRAMEBUFFER;
+ nv50->dirty_3d |= NV50_NEW_3D_FRAMEBUFFER | NV50_NEW_3D_TEXTURES;
}
static void
static void
nv50_set_window_rectangles(struct pipe_context *pipe,
- boolean include,
+ bool include,
unsigned num_rectangles,
const struct pipe_scissor_state *rectangles)
{
if (nv50->global_residents.size <= (end * sizeof(struct pipe_resource *))) {
const unsigned old_size = nv50->global_residents.size;
- const unsigned req_size = end * sizeof(struct pipe_resource *);
- util_dynarray_resize(&nv50->global_residents, req_size);
+ util_dynarray_resize(&nv50->global_residents, struct pipe_resource *, end);
memset((uint8_t *)nv50->global_residents.data + old_size, 0,
- req_size - old_size);
+ nv50->global_residents.size - old_size);
}
if (resources) {