|
|
|
|
|
|
|
|
#include "nir_builder.h" |
|
|
#include "nir_builder.h" |
|
|
|
|
|
|
|
|
static nir_shader * |
|
|
static nir_shader * |
|
|
create_passthrough_tcs(const struct brw_compiler *compiler, |
|
|
|
|
|
|
|
|
create_passthrough_tcs(void *mem_ctx, const struct brw_compiler *compiler, |
|
|
const nir_shader_compiler_options *options, |
|
|
const nir_shader_compiler_options *options, |
|
|
const struct brw_tcs_prog_key *key) |
|
|
const struct brw_tcs_prog_key *key) |
|
|
{ |
|
|
{ |
|
|
nir_builder b; |
|
|
nir_builder b; |
|
|
nir_builder_init_simple_shader(&b, NULL, MESA_SHADER_TESS_CTRL, options); |
|
|
|
|
|
|
|
|
nir_builder_init_simple_shader(&b, mem_ctx, MESA_SHADER_TESS_CTRL, |
|
|
|
|
|
options); |
|
|
nir_shader *nir = b.shader; |
|
|
nir_shader *nir = b.shader; |
|
|
nir_variable *var; |
|
|
nir_variable *var; |
|
|
nir_intrinsic_instr *load; |
|
|
nir_intrinsic_instr *load; |
|
|
|
|
|
|
|
|
bool start_busy = false; |
|
|
bool start_busy = false; |
|
|
double start_time = 0; |
|
|
double start_time = 0; |
|
|
|
|
|
|
|
|
|
|
|
void *mem_ctx = ralloc_context(NULL); |
|
|
if (tcp) { |
|
|
if (tcp) { |
|
|
nir = tcp->program.nir; |
|
|
nir = tcp->program.nir; |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
const nir_shader_compiler_options *options = |
|
|
const nir_shader_compiler_options *options = |
|
|
ctx->Const.ShaderCompilerOptions[MESA_SHADER_TESS_CTRL].NirOptions; |
|
|
ctx->Const.ShaderCompilerOptions[MESA_SHADER_TESS_CTRL].NirOptions; |
|
|
nir = create_passthrough_tcs(compiler, options, key); |
|
|
|
|
|
|
|
|
nir = create_passthrough_tcs(mem_ctx, compiler, options, key); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
memset(&prog_data, 0, sizeof(prog_data)); |
|
|
memset(&prog_data, 0, sizeof(prog_data)); |
|
|
|
|
|
|
|
|
start_time = get_time(); |
|
|
start_time = get_time(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void *mem_ctx = ralloc_context(NULL); |
|
|
|
|
|
unsigned program_size; |
|
|
unsigned program_size; |
|
|
char *error_str; |
|
|
char *error_str; |
|
|
const unsigned *program = |
|
|
const unsigned *program = |
|
|
|
|
|
|
|
|
if (shader_prog) { |
|
|
if (shader_prog) { |
|
|
shader_prog->LinkStatus = false; |
|
|
shader_prog->LinkStatus = false; |
|
|
ralloc_strcat(&shader_prog->InfoLog, error_str); |
|
|
ralloc_strcat(&shader_prog->InfoLog, error_str); |
|
|
} else { |
|
|
|
|
|
ralloc_free(nir); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
_mesa_problem(NULL, "Failed to compile tessellation control shader: " |
|
|
_mesa_problem(NULL, "Failed to compile tessellation control shader: " |
|
|
|
|
|
|
|
|
&prog_data, sizeof(prog_data), |
|
|
&prog_data, sizeof(prog_data), |
|
|
&stage_state->prog_offset, &brw->tcs.base.prog_data); |
|
|
&stage_state->prog_offset, &brw->tcs.base.prog_data); |
|
|
ralloc_free(mem_ctx); |
|
|
ralloc_free(mem_ctx); |
|
|
if (!tcs) |
|
|
|
|
|
ralloc_free(nir); |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |