mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
i965: Make a few tessellation related functions non-static.
Also, move them to brw_shader.cpp so they're in a location for code used by both the vec4 and fs worlds. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
This commit is contained in:
parent
464d6080c6
commit
501bedffa6
3 changed files with 51 additions and 47 deletions
|
|
@ -582,6 +582,53 @@ brw_abs_immediate(enum brw_reg_type type, struct brw_reg *reg)
|
|||
return false;
|
||||
}
|
||||
|
||||
unsigned
|
||||
tesslevel_outer_components(GLenum tes_primitive_mode)
|
||||
{
|
||||
switch (tes_primitive_mode) {
|
||||
case GL_QUADS:
|
||||
return 4;
|
||||
case GL_TRIANGLES:
|
||||
return 3;
|
||||
case GL_ISOLINES:
|
||||
return 2;
|
||||
default:
|
||||
unreachable("Bogus tessellation domain");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned
|
||||
tesslevel_inner_components(GLenum tes_primitive_mode)
|
||||
{
|
||||
switch (tes_primitive_mode) {
|
||||
case GL_QUADS:
|
||||
return 2;
|
||||
case GL_TRIANGLES:
|
||||
return 1;
|
||||
case GL_ISOLINES:
|
||||
return 0;
|
||||
default:
|
||||
unreachable("Bogus tessellation domain");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a normal .xyzw writemask, convert it to a writemask for a vector
|
||||
* that's stored backwards, i.e. .wzyx.
|
||||
*/
|
||||
unsigned
|
||||
writemask_for_backwards_vector(unsigned mask)
|
||||
{
|
||||
unsigned new_mask = 0;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
new_mask |= ((mask >> i) & 1) << (3 - i);
|
||||
|
||||
return new_mask;
|
||||
}
|
||||
|
||||
backend_shader::backend_shader(const struct brw_compiler *compiler,
|
||||
void *log_data,
|
||||
void *mem_ctx,
|
||||
|
|
|
|||
|
|
@ -292,6 +292,10 @@ int type_size_scalar(const struct glsl_type *type);
|
|||
int type_size_vec4(const struct glsl_type *type);
|
||||
int type_size_vec4_times_4(const struct glsl_type *type);
|
||||
|
||||
unsigned tesslevel_outer_components(GLenum tes_primitive_mode);
|
||||
unsigned tesslevel_inner_components(GLenum tes_primitive_mode);
|
||||
unsigned writemask_for_backwards_vector(unsigned mask);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -286,53 +286,6 @@ vec4_tcs_visitor::emit_urb_write(const src_reg &value,
|
|||
inst->base_mrf = -1;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
tesslevel_outer_components(GLenum tes_primitive_mode)
|
||||
{
|
||||
switch (tes_primitive_mode) {
|
||||
case GL_QUADS:
|
||||
return 4;
|
||||
case GL_TRIANGLES:
|
||||
return 3;
|
||||
case GL_ISOLINES:
|
||||
return 2;
|
||||
default:
|
||||
unreachable("Bogus tessellation domain");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
tesslevel_inner_components(GLenum tes_primitive_mode)
|
||||
{
|
||||
switch (tes_primitive_mode) {
|
||||
case GL_QUADS:
|
||||
return 2;
|
||||
case GL_TRIANGLES:
|
||||
return 1;
|
||||
case GL_ISOLINES:
|
||||
return 0;
|
||||
default:
|
||||
unreachable("Bogus tessellation domain");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a normal .xyzw writemask, convert it to a writemask for a vector
|
||||
* that's stored backwards, i.e. .wzyx.
|
||||
*/
|
||||
static unsigned
|
||||
writemask_for_backwards_vector(unsigned mask)
|
||||
{
|
||||
unsigned new_mask = 0;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
new_mask |= ((mask >> i) & 1) << (3 - i);
|
||||
|
||||
return new_mask;
|
||||
}
|
||||
|
||||
void
|
||||
vec4_tcs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue