summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-09-17 15:14:32 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2013-09-17 15:16:20 +0200
commit1738e8019de52e1651753174ee2695a3bd3f0ff2 (patch)
tree69bba1e52678f91bfb41acd5024e76a05c22af7e
parent768ed6952981ef083795e6aca7e3f077815eae59 (diff)
minigallium: rebase to a1b6e69
-rw-r--r--native/minigallium/README.md2
-rw-r--r--native/minigallium/auxiliary/tgsi/tgsi_build.c34
-rw-r--r--native/minigallium/auxiliary/tgsi/tgsi_exec.c61
-rw-r--r--native/minigallium/auxiliary/tgsi/tgsi_info.c16
-rw-r--r--native/minigallium/auxiliary/tgsi/tgsi_opcode_tmp.h4
-rw-r--r--native/minigallium/auxiliary/tgsi/tgsi_scan.c97
-rw-r--r--native/minigallium/auxiliary/tgsi/tgsi_scan.h1
-rw-r--r--native/minigallium/auxiliary/tgsi/tgsi_util.c30
-rw-r--r--native/minigallium/auxiliary/util/u_cpu_detect.c80
-rw-r--r--native/minigallium/auxiliary/util/u_cpu_detect.h3
-rw-r--r--native/minigallium/auxiliary/util/u_format_srgb.c30
-rw-r--r--native/minigallium/auxiliary/util/u_format_srgb.h56
-rw-r--r--native/minigallium/auxiliary/util/u_format_table.c176
-rw-r--r--native/minigallium/auxiliary/util/u_math.c2
-rw-r--r--native/minigallium/auxiliary/util/u_vbuf.c24
-rw-r--r--native/minigallium/auxiliary/util/u_video.h12
-rw-r--r--native/minigallium/include/pipe/p_config.h4
-rw-r--r--native/minigallium/include/pipe/p_context.h12
-rw-r--r--native/minigallium/include/pipe/p_defines.h4
-rw-r--r--native/minigallium/include/pipe/p_format.h1
-rw-r--r--native/minigallium/include/pipe/p_screen.h4
-rw-r--r--native/minigallium/include/pipe/p_shader_tokens.h9
-rw-r--r--native/minigallium/include/pipe/p_video_decoder.h155
-rw-r--r--native/minigallium/include/pipe/p_video_enums.h21
-rw-r--r--native/minigallium/include/pipe/p_video_state.h4
25 files changed, 587 insertions, 255 deletions
diff --git a/native/minigallium/README.md b/native/minigallium/README.md
index 9ad21ae..bff705c 100644
--- a/native/minigallium/README.md
+++ b/native/minigallium/README.md
@@ -2,5 +2,5 @@ Subset of gallium, for tgsi support, tests and utilities.
Keeping this within `etna_viv` tree for now for easy experimentation.
-Based on mesa/gallium commit 0794f63
+Based on mesa/gallium commit a1b6e69
diff --git a/native/minigallium/auxiliary/tgsi/tgsi_build.c b/native/minigallium/auxiliary/tgsi/tgsi_build.c
index 523430b..f4add02 100644
--- a/native/minigallium/auxiliary/tgsi/tgsi_build.c
+++ b/native/minigallium/auxiliary/tgsi/tgsi_build.c
@@ -124,6 +124,7 @@ tgsi_build_declaration(
unsigned semantic,
unsigned invariant,
unsigned local,
+ unsigned array,
struct tgsi_header *header )
{
struct tgsi_declaration declaration;
@@ -139,7 +140,7 @@ tgsi_build_declaration(
declaration.Semantic = semantic;
declaration.Invariant = invariant;
declaration.Local = local;
-
+ declaration.Array = array;
header_bodysize_grow( header );
return declaration;
@@ -339,6 +340,21 @@ tgsi_default_declaration_array( void )
return a;
}
+static struct tgsi_declaration_array
+tgsi_build_declaration_array(unsigned arrayid,
+ struct tgsi_declaration *declaration,
+ struct tgsi_header *header)
+{
+ struct tgsi_declaration_array da;
+
+ da = tgsi_default_declaration_array();
+ da.ArrayID = arrayid;
+
+ declaration_grow(declaration, header);
+
+ return da;
+}
+
struct tgsi_full_declaration
tgsi_default_full_declaration( void )
{
@@ -379,6 +395,7 @@ tgsi_build_full_declaration(
full_decl->Declaration.Semantic,
full_decl->Declaration.Invariant,
full_decl->Declaration.Local,
+ full_decl->Declaration.Array,
header );
if (maxsize <= size)
@@ -472,6 +489,19 @@ tgsi_build_full_declaration(
header);
}
+ if (full_decl->Declaration.Array) {
+ struct tgsi_declaration_array *da;
+
+ if (maxsize <= size) {
+ return 0;
+ }
+ da = (struct tgsi_declaration_array *)&tokens[size];
+ size++;
+ *da = tgsi_build_declaration_array(
+ full_decl->Array.ArrayID,
+ declaration,
+ header);
+ }
return size;
}
@@ -846,8 +876,8 @@ static struct tgsi_ind_register
tgsi_build_ind_register(
unsigned file,
unsigned swizzle,
- unsigned arrayid,
int index,
+ unsigned arrayid,
struct tgsi_instruction *instruction,
struct tgsi_header *header )
{
diff --git a/native/minigallium/auxiliary/tgsi/tgsi_exec.c b/native/minigallium/auxiliary/tgsi/tgsi_exec.c
index d991d4b..0750a50 100644
--- a/native/minigallium/auxiliary/tgsi/tgsi_exec.c
+++ b/native/minigallium/auxiliary/tgsi/tgsi_exec.c
@@ -2076,6 +2076,7 @@ exec_txq(struct tgsi_exec_machine *mach,
fetch_source(mach, &src, &inst->Src[0], TGSI_CHAN_X, TGSI_EXEC_DATA_INT);
+ /* XXX: This interface can't return per-pixel values */
mach->Sampler->get_dims(mach->Sampler, unit, src.i[0], result);
for (i = 0; i < TGSI_QUAD_SIZE; i++) {
@@ -3264,6 +3265,50 @@ micro_f2i(union tgsi_exec_channel *dst,
}
static void
+micro_fseq(union tgsi_exec_channel *dst,
+ const union tgsi_exec_channel *src0,
+ const union tgsi_exec_channel *src1)
+{
+ dst->u[0] = src0->f[0] == src1->f[0] ? ~0 : 0;
+ dst->u[1] = src0->f[1] == src1->f[1] ? ~0 : 0;
+ dst->u[2] = src0->f[2] == src1->f[2] ? ~0 : 0;
+ dst->u[3] = src0->f[3] == src1->f[3] ? ~0 : 0;
+}
+
+static void
+micro_fsge(union tgsi_exec_channel *dst,
+ const union tgsi_exec_channel *src0,
+ const union tgsi_exec_channel *src1)
+{
+ dst->u[0] = src0->f[0] >= src1->f[0] ? ~0 : 0;
+ dst->u[1] = src0->f[1] >= src1->f[1] ? ~0 : 0;
+ dst->u[2] = src0->f[2] >= src1->f[2] ? ~0 : 0;
+ dst->u[3] = src0->f[3] >= src1->f[3] ? ~0 : 0;
+}
+
+static void
+micro_fslt(union tgsi_exec_channel *dst,
+ const union tgsi_exec_channel *src0,
+ const union tgsi_exec_channel *src1)
+{
+ dst->u[0] = src0->f[0] < src1->f[0] ? ~0 : 0;
+ dst->u[1] = src0->f[1] < src1->f[1] ? ~0 : 0;
+ dst->u[2] = src0->f[2] < src1->f[2] ? ~0 : 0;
+ dst->u[3] = src0->f[3] < src1->f[3] ? ~0 : 0;
+}
+
+static void
+micro_fsne(union tgsi_exec_channel *dst,
+ const union tgsi_exec_channel *src0,
+ const union tgsi_exec_channel *src1)
+{
+ dst->u[0] = src0->f[0] != src1->f[0] ? ~0 : 0;
+ dst->u[1] = src0->f[1] != src1->f[1] ? ~0 : 0;
+ dst->u[2] = src0->f[2] != src1->f[2] ? ~0 : 0;
+ dst->u[3] = src0->f[3] != src1->f[3] ? ~0 : 0;
+}
+
+static void
micro_idiv(union tgsi_exec_channel *dst,
const union tgsi_exec_channel *src0,
const union tgsi_exec_channel *src1)
@@ -4152,6 +4197,22 @@ exec_instruction(
exec_vector_unary(mach, inst, micro_f2i, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_FLOAT);
break;
+ case TGSI_OPCODE_FSEQ:
+ exec_vector_binary(mach, inst, micro_fseq, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_FLOAT);
+ break;
+
+ case TGSI_OPCODE_FSGE:
+ exec_vector_binary(mach, inst, micro_fsge, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_FLOAT);
+ break;
+
+ case TGSI_OPCODE_FSLT:
+ exec_vector_binary(mach, inst, micro_fslt, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_FLOAT);
+ break;
+
+ case TGSI_OPCODE_FSNE:
+ exec_vector_binary(mach, inst, micro_fsne, TGSI_EXEC_DATA_UINT, TGSI_EXEC_DATA_FLOAT);
+ break;
+
case TGSI_OPCODE_IDIV:
exec_vector_binary(mach, inst, micro_idiv, TGSI_EXEC_DATA_INT, TGSI_EXEC_DATA_INT);
break;
diff --git a/native/minigallium/auxiliary/tgsi/tgsi_info.c b/native/minigallium/auxiliary/tgsi/tgsi_info.c
index 7e93028..7a5d18f 100644
--- a/native/minigallium/auxiliary/tgsi/tgsi_info.c
+++ b/native/minigallium/auxiliary/tgsi/tgsi_info.c
@@ -145,10 +145,10 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 0, 0, 0, 0, 0, 0, NONE, "", 105 }, /* removed */
{ 0, 0, 0, 0, 0, 0, NONE, "", 106 }, /* removed */
{ 0, 0, 0, 0, 0, 0, NONE, "NOP", TGSI_OPCODE_NOP },
- { 0, 0, 0, 0, 0, 0, NONE, "", 108 }, /* removed */
- { 0, 0, 0, 0, 0, 0, NONE, "", 109 }, /* removed */
- { 0, 0, 0, 0, 0, 0, NONE, "", 110 }, /* removed */
- { 0, 0, 0, 0, 0, 0, NONE, "", 111 }, /* removed */
+ { 1, 2, 0, 0, 0, 0, COMP, "FSEQ", TGSI_OPCODE_FSEQ },
+ { 1, 2, 0, 0, 0, 0, COMP, "FSGE", TGSI_OPCODE_FSGE },
+ { 1, 2, 0, 0, 0, 0, COMP, "FSLT", TGSI_OPCODE_FSLT },
+ { 1, 2, 0, 0, 0, 0, COMP, "FSNE", TGSI_OPCODE_FSNE },
{ 1, 1, 0, 0, 0, 0, REPL, "NRM4", TGSI_OPCODE_NRM4 },
{ 0, 1, 0, 0, 0, 0, NONE, "CALLNZ", TGSI_OPCODE_CALLNZ },
{ 0, 1, 0, 0, 0, 0, NONE, "", 114 }, /* removed */
@@ -302,6 +302,10 @@ tgsi_opcode_infer_type( uint opcode )
case TGSI_OPCODE_ARR:
case TGSI_OPCODE_MOD:
case TGSI_OPCODE_F2I:
+ case TGSI_OPCODE_FSEQ:
+ case TGSI_OPCODE_FSGE:
+ case TGSI_OPCODE_FSLT:
+ case TGSI_OPCODE_FSNE:
case TGSI_OPCODE_IDIV:
case TGSI_OPCODE_IMAX:
case TGSI_OPCODE_IMIN:
@@ -343,6 +347,10 @@ tgsi_opcode_infer_src_type( uint opcode )
case TGSI_OPCODE_TXQ_LZ:
case TGSI_OPCODE_F2I:
case TGSI_OPCODE_F2U:
+ case TGSI_OPCODE_FSEQ:
+ case TGSI_OPCODE_FSGE:
+ case TGSI_OPCODE_FSLT:
+ case TGSI_OPCODE_FSNE:
case TGSI_OPCODE_UCMP:
return TGSI_TYPE_FLOAT;
default:
diff --git a/native/minigallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/native/minigallium/auxiliary/tgsi/tgsi_opcode_tmp.h
index e9d0a05..b8144a8 100644
--- a/native/minigallium/auxiliary/tgsi/tgsi_opcode_tmp.h
+++ b/native/minigallium/auxiliary/tgsi/tgsi_opcode_tmp.h
@@ -159,6 +159,10 @@ OP01(BREAKC)
OP01(KILL_IF)
OP00(END)
OP11(F2I)
+OP12(FSEQ)
+OP12(FSGE)
+OP12(FSLT)
+OP12(FSNE)
OP12(IDIV)
OP12(IMAX)
OP12(IMIN)
diff --git a/native/minigallium/auxiliary/tgsi/tgsi_scan.c b/native/minigallium/auxiliary/tgsi/tgsi_scan.c
index e7bf6e6..05b7111 100644
--- a/native/minigallium/auxiliary/tgsi/tgsi_scan.c
+++ b/native/minigallium/auxiliary/tgsi/tgsi_scan.c
@@ -36,6 +36,7 @@
#include "util/u_debug.h"
#include "util/u_math.h"
+#include "util/u_memory.h"
#include "util/u_prim.h"
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_util.h"
@@ -114,7 +115,6 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
}
if (procType == TGSI_PROCESSOR_FRAGMENT &&
- src->Register.File == TGSI_FILE_INPUT &&
info->reads_position &&
src->Register.Index == 0 &&
(src->Register.SwizzleX == TGSI_SWIZZLE_Z ||
@@ -129,6 +129,18 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
if (src->Register.Indirect) {
info->indirect_files |= (1 << src->Register.File);
}
+
+ /* MSAA samplers */
+ if (src->Register.File == TGSI_FILE_SAMPLER) {
+ assert(fullinst->Instruction.Texture);
+ assert(src->Register.Index < Elements(info->is_msaa_sampler));
+
+ if (fullinst->Instruction.Texture &&
+ (fullinst->Texture.Texture == TGSI_TEXTURE_2D_MSAA ||
+ fullinst->Texture.Texture == TGSI_TEXTURE_2D_ARRAY_MSAA)) {
+ info->is_msaa_sampler[src->Register.Index] = TRUE;
+ }
+ }
}
/* check for indirect register writes */
@@ -152,6 +164,8 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
for (reg = fulldecl->Range.First;
reg <= fulldecl->Range.Last;
reg++) {
+ unsigned semName = fulldecl->Semantic.Name;
+ unsigned semIndex = fulldecl->Semantic.Index;
/* only first 32 regs will appear in this bitfield */
info->file_mask[file] |= (1 << reg);
@@ -159,82 +173,81 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
info->file_max[file] = MAX2(info->file_max[file], (int)reg);
if (file == TGSI_FILE_INPUT) {
- info->input_semantic_name[reg] = (ubyte)fulldecl->Semantic.Name;
- info->input_semantic_index[reg] = (ubyte)fulldecl->Semantic.Index;
+ info->input_semantic_name[reg] = (ubyte) semName;
+ info->input_semantic_index[reg] = (ubyte) semIndex;
info->input_interpolate[reg] = (ubyte)fulldecl->Interp.Interpolate;
info->input_centroid[reg] = (ubyte)fulldecl->Interp.Centroid;
info->input_cylindrical_wrap[reg] = (ubyte)fulldecl->Interp.CylindricalWrap;
info->num_inputs++;
if (procType == TGSI_PROCESSOR_FRAGMENT) {
- if (fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION)
+ if (semName == TGSI_SEMANTIC_POSITION)
info->reads_position = TRUE;
- else if (fulldecl->Semantic.Name == TGSI_SEMANTIC_PRIMID)
+ else if (semName == TGSI_SEMANTIC_PRIMID)
info->uses_primid = TRUE;
- else if (fulldecl->Semantic.Name == TGSI_SEMANTIC_FACE)
+ else if (semName == TGSI_SEMANTIC_FACE)
info->uses_frontface = TRUE;
}
}
else if (file == TGSI_FILE_SYSTEM_VALUE) {
unsigned index = fulldecl->Range.First;
- unsigned semName = fulldecl->Semantic.Name;
info->system_value_semantic_name[index] = semName;
info->num_system_values = MAX2(info->num_system_values,
index + 1);
- /*
- info->system_value_semantic_name[info->num_system_values++] =
- fulldecl->Semantic.Name;
- */
-
- if (fulldecl->Semantic.Name == TGSI_SEMANTIC_INSTANCEID) {
+ if (semName == TGSI_SEMANTIC_INSTANCEID) {
info->uses_instanceid = TRUE;
}
- else if (fulldecl->Semantic.Name == TGSI_SEMANTIC_VERTEXID) {
+ else if (semName == TGSI_SEMANTIC_VERTEXID) {
info->uses_vertexid = TRUE;
- } else if (fulldecl->Semantic.Name == TGSI_SEMANTIC_PRIMID) {
+ }
+ else if (semName == TGSI_SEMANTIC_PRIMID) {
info->uses_primid = TRUE;
}
}
else if (file == TGSI_FILE_OUTPUT) {
- info->output_semantic_name[reg] = (ubyte)fulldecl->Semantic.Name;
- info->output_semantic_index[reg] = (ubyte)fulldecl->Semantic.Index;
+ info->output_semantic_name[reg] = (ubyte) semName;
+ info->output_semantic_index[reg] = (ubyte) semIndex;
info->num_outputs++;
- if ((procType == TGSI_PROCESSOR_VERTEX || procType == TGSI_PROCESSOR_GEOMETRY) &&
- fulldecl->Semantic.Name == TGSI_SEMANTIC_CLIPDIST) {
- info->num_written_clipdistance += util_bitcount(fulldecl->Declaration.UsageMask);
- }
- if ((procType == TGSI_PROCESSOR_VERTEX || procType == TGSI_PROCESSOR_GEOMETRY) &&
- fulldecl->Semantic.Name == TGSI_SEMANTIC_CULLDIST) {
- info->num_written_culldistance += util_bitcount(fulldecl->Declaration.UsageMask);
+ if (procType == TGSI_PROCESSOR_VERTEX ||
+ procType == TGSI_PROCESSOR_GEOMETRY) {
+ if (semName == TGSI_SEMANTIC_CLIPDIST) {
+ info->num_written_clipdistance +=
+ util_bitcount(fulldecl->Declaration.UsageMask);
+ }
+ else if (semName == TGSI_SEMANTIC_CULLDIST) {
+ info->num_written_culldistance +=
+ util_bitcount(fulldecl->Declaration.UsageMask);
+ }
}
- /* extra info for special outputs */
- if (procType == TGSI_PROCESSOR_FRAGMENT &&
- fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION)
+
+ if (procType == TGSI_PROCESSOR_FRAGMENT) {
+ if (semName == TGSI_SEMANTIC_POSITION) {
info->writes_z = TRUE;
- if (procType == TGSI_PROCESSOR_FRAGMENT &&
- fulldecl->Semantic.Name == TGSI_SEMANTIC_STENCIL)
+ }
+ else if (semName == TGSI_SEMANTIC_STENCIL) {
info->writes_stencil = TRUE;
- if (procType == TGSI_PROCESSOR_VERTEX &&
- fulldecl->Semantic.Name == TGSI_SEMANTIC_EDGEFLAG) {
- info->writes_edgeflag = TRUE;
+ }
}
- if (procType == TGSI_PROCESSOR_GEOMETRY &&
- fulldecl->Semantic.Name ==
- TGSI_SEMANTIC_VIEWPORT_INDEX) {
- info->writes_viewport_index = TRUE;
+ if (procType == TGSI_PROCESSOR_VERTEX) {
+ if (semName == TGSI_SEMANTIC_EDGEFLAG) {
+ info->writes_edgeflag = TRUE;
+ }
}
- if (procType == TGSI_PROCESSOR_GEOMETRY &&
- fulldecl->Semantic.Name ==
- TGSI_SEMANTIC_LAYER) {
- info->writes_layer = TRUE;
+
+ if (procType == TGSI_PROCESSOR_GEOMETRY) {
+ if (semName == TGSI_SEMANTIC_VIEWPORT_INDEX) {
+ info->writes_viewport_index = TRUE;
+ }
+ else if (semName == TGSI_SEMANTIC_LAYER) {
+ info->writes_layer = TRUE;
+ }
}
}
-
- }
+ }
}
break;
diff --git a/native/minigallium/auxiliary/tgsi/tgsi_scan.h b/native/minigallium/auxiliary/tgsi/tgsi_scan.h
index e2fa73a..d9147bd 100644
--- a/native/minigallium/auxiliary/tgsi/tgsi_scan.h
+++ b/native/minigallium/auxiliary/tgsi/tgsi_scan.h
@@ -80,6 +80,7 @@ struct tgsi_shader_info
boolean color0_writes_all_cbufs;
boolean writes_viewport_index;
boolean writes_layer;
+ boolean is_msaa_sampler[PIPE_MAX_SAMPLERS];
unsigned num_written_culldistance;
unsigned num_written_clipdistance;
diff --git a/native/minigallium/auxiliary/tgsi/tgsi_util.c b/native/minigallium/auxiliary/tgsi/tgsi_util.c
index 98c1e6e..b3bc8f2 100644
--- a/native/minigallium/auxiliary/tgsi/tgsi_util.c
+++ b/native/minigallium/auxiliary/tgsi/tgsi_util.c
@@ -217,6 +217,32 @@ tgsi_util_get_inst_usage_mask(const struct tgsi_full_instruction *inst,
case TGSI_OPCODE_OR:
case TGSI_OPCODE_XOR:
case TGSI_OPCODE_SAD:
+ case TGSI_OPCODE_FSEQ:
+ case TGSI_OPCODE_FSGE:
+ case TGSI_OPCODE_FSLT:
+ case TGSI_OPCODE_FSNE:
+ case TGSI_OPCODE_F2I:
+ case TGSI_OPCODE_IDIV:
+ case TGSI_OPCODE_IMAX:
+ case TGSI_OPCODE_IMIN:
+ case TGSI_OPCODE_INEG:
+ case TGSI_OPCODE_ISGE:
+ case TGSI_OPCODE_ISHR:
+ case TGSI_OPCODE_ISLT:
+ case TGSI_OPCODE_F2U:
+ case TGSI_OPCODE_U2F:
+ case TGSI_OPCODE_UADD:
+ case TGSI_OPCODE_UDIV:
+ case TGSI_OPCODE_UMAD:
+ case TGSI_OPCODE_UMAX:
+ case TGSI_OPCODE_UMIN:
+ case TGSI_OPCODE_UMOD:
+ case TGSI_OPCODE_UMUL:
+ case TGSI_OPCODE_USEQ:
+ case TGSI_OPCODE_USGE:
+ case TGSI_OPCODE_USHR:
+ case TGSI_OPCODE_USLT:
+ case TGSI_OPCODE_USNE:
/* Channel-wise operations */
read_mask = write_mask;
break;
@@ -418,9 +444,11 @@ tgsi_util_get_texture_coord_dim(int tgsi_tex, int *shadow_or_sample)
case TGSI_TEXTURE_SHADOW1D_ARRAY:
case TGSI_TEXTURE_SHADOW2D_ARRAY:
case TGSI_TEXTURE_SHADOWCUBE_ARRAY:
+ *shadow_or_sample = dim;
+ break;
case TGSI_TEXTURE_2D_MSAA:
case TGSI_TEXTURE_2D_ARRAY_MSAA:
- *shadow_or_sample = dim;
+ *shadow_or_sample = 3;
break;
default:
/* no shadow nor sample */
diff --git a/native/minigallium/auxiliary/util/u_cpu_detect.c b/native/minigallium/auxiliary/util/u_cpu_detect.c
index 588fc7c..d2d1313 100644
--- a/native/minigallium/auxiliary/util/u_cpu_detect.c
+++ b/native/minigallium/auxiliary/util/u_cpu_detect.c
@@ -212,6 +212,44 @@ cpuid(uint32_t ax, uint32_t *p)
#endif
}
+/**
+ * @sa cpuid.h included in gcc-4.4 onwards.
+ * @sa http://msdn.microsoft.com/en-us/library/hskdteyh%28v=vs.90%29.aspx
+ */
+static INLINE void
+cpuid_count(uint32_t ax, uint32_t cx, uint32_t *p)
+{
+#if (defined(PIPE_CC_GCC) || defined(PIPE_CC_SUNPRO)) && defined(PIPE_ARCH_X86)
+ __asm __volatile (
+ "xchgl %%ebx, %1\n\t"
+ "cpuid\n\t"
+ "xchgl %%ebx, %1"
+ : "=a" (p[0]),
+ "=S" (p[1]),
+ "=c" (p[2]),
+ "=d" (p[3])
+ : "0" (ax), "2" (cx)
+ );
+#elif (defined(PIPE_CC_GCC) || defined(PIPE_CC_SUNPRO)) && defined(PIPE_ARCH_X86_64)
+ __asm __volatile (
+ "cpuid\n\t"
+ : "=a" (p[0]),
+ "=b" (p[1]),
+ "=c" (p[2]),
+ "=d" (p[3])
+ : "0" (ax), "2" (cx)
+ );
+#elif defined(PIPE_CC_MSVC)
+ __cpuidex(p, ax, cx);
+#else
+ p[0] = 0;
+ p[1] = 0;
+ p[2] = 0;
+ p[3] = 0;
+#endif
+}
+
+
static INLINE uint64_t xgetbv(void)
{
#if defined(PIPE_CC_GCC)
@@ -230,8 +268,31 @@ static INLINE uint64_t xgetbv(void)
#else
return 0;
#endif
+}
+
+#if defined(PIPE_ARCH_X86)
+static INLINE boolean sse2_has_daz(void)
+{
+ struct {
+ uint32_t pad1[7];
+ uint32_t mxcsr_mask;
+ uint32_t pad2[128-8];
+ } PIPE_ALIGN_VAR(16) fxarea;
+
+ fxarea.mxcsr_mask = 0;
+#if (defined(PIPE_CC_GCC) || defined(PIPE_CC_SUNPRO))
+ __asm __volatile ("fxsave %0" : "+m" (fxarea));
+#elif (defined(PIPE_CC_MSVC) && _MSC_VER >= 1700) || defined(PIPE_CC_ICL)
+ /* 1700 = Visual Studio 2012 */
+ _fxsave(&fxarea);
+#else
+ fxarea.mxcsr_mask = 0;
+#endif
+ return !!(fxarea.mxcsr_mask & (1 << 6));
}
+#endif
+
#endif /* X86 or X86_64 */
void
@@ -310,11 +371,22 @@ util_cpu_detect(void)
((xgetbv() & 6) == 6); // XMM & YMM
util_cpu_caps.has_f16c = (regs2[2] >> 29) & 1;
util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */
+#if defined(PIPE_ARCH_X86_64)
+ util_cpu_caps.has_daz = 1;
+#else
+ util_cpu_caps.has_daz = util_cpu_caps.has_sse3 ||
+ (util_cpu_caps.has_sse2 && sse2_has_daz());
+#endif
cacheline = ((regs2[1] >> 8) & 0xFF) * 8;
if (cacheline > 0)
util_cpu_caps.cacheline = cacheline;
}
+ if (util_cpu_caps.has_avx && regs[0] >= 0x00000007) {
+ uint32_t regs7[4];
+ cpuid_count(0x00000007, 0x00000000, regs7);
+ util_cpu_caps.has_avx2 = (regs7[1] >> 5) & 1;
+ }
if (regs[1] == 0x756e6547 && regs[2] == 0x6c65746e && regs[3] == 0x49656e69) {
/* GenuineIntel */
@@ -331,6 +403,9 @@ util_cpu_detect(void)
util_cpu_caps.has_mmx2 |= (regs2[3] >> 22) & 1;
util_cpu_caps.has_3dnow = (regs2[3] >> 31) & 1;
util_cpu_caps.has_3dnow_ext = (regs2[3] >> 30) & 1;
+
+ util_cpu_caps.has_xop = util_cpu_caps.has_avx &&
+ ((regs2[2] >> 11) & 1);
}
if (regs[0] >= 0x80000006) {
@@ -368,9 +443,14 @@ util_cpu_detect(void)
debug_printf("util_cpu_caps.has_sse4_1 = %u\n", util_cpu_caps.has_sse4_1);
debug_printf("util_cpu_caps.has_sse4_2 = %u\n", util_cpu_caps.has_sse4_2);
debug_printf("util_cpu_caps.has_avx = %u\n", util_cpu_caps.has_avx);
+ debug_printf("util_cpu_caps.has_avx2 = %u\n", util_cpu_caps.has_avx2);
+ debug_printf("util_cpu_caps.has_f16c = %u\n", util_cpu_caps.has_f16c);
+ debug_printf("util_cpu_caps.has_popcnt = %u\n", util_cpu_caps.has_popcnt);
debug_printf("util_cpu_caps.has_3dnow = %u\n", util_cpu_caps.has_3dnow);
debug_printf("util_cpu_caps.has_3dnow_ext = %u\n", util_cpu_caps.has_3dnow_ext);
+ debug_printf("util_cpu_caps.has_xop = %u\n", util_cpu_caps.has_xop);
debug_printf("util_cpu_caps.has_altivec = %u\n", util_cpu_caps.has_altivec);
+ debug_printf("util_cpu_caps.has_daz = %u\n", util_cpu_caps.has_daz);
}
#endif
diff --git a/native/minigallium/auxiliary/util/u_cpu_detect.h b/native/minigallium/auxiliary/util/u_cpu_detect.h
index f9cd647..5ccfc93 100644
--- a/native/minigallium/auxiliary/util/u_cpu_detect.h
+++ b/native/minigallium/auxiliary/util/u_cpu_detect.h
@@ -64,10 +64,13 @@ struct util_cpu_caps {
unsigned has_sse4_2:1;
unsigned has_popcnt:1;
unsigned has_avx:1;
+ unsigned has_avx2:1;
unsigned has_f16c:1;
unsigned has_3dnow:1;
unsigned has_3dnow_ext:1;
+ unsigned has_xop:1;
unsigned has_altivec:1;
+ unsigned has_daz:1;
};
extern struct util_cpu_caps
diff --git a/native/minigallium/auxiliary/util/u_format_srgb.c b/native/minigallium/auxiliary/util/u_format_srgb.c
index 4ac8c7b..2649089 100644
--- a/native/minigallium/auxiliary/util/u_format_srgb.c
+++ b/native/minigallium/auxiliary/util/u_format_srgb.c
@@ -146,3 +146,33 @@ util_format_linear_to_srgb_8unorm_table[256] = {
248, 249, 249, 250, 250, 251, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255,
};
+const unsigned
+util_format_linear_to_srgb_helper_table[104] = {
+ 0x0073000d, 0x007a000d, 0x0080000d, 0x0087000d,
+ 0x008d000d, 0x0094000d, 0x009a000d, 0x00a1000d,
+ 0x00a7001a, 0x00b4001a, 0x00c1001a, 0x00ce001a,
+ 0x00da001a, 0x00e7001a, 0x00f4001a, 0x0101001a,
+ 0x010e0033, 0x01280033, 0x01410033, 0x015b0033,
+ 0x01750033, 0x018f0033, 0x01a80033, 0x01c20033,
+ 0x01dc0067, 0x020f0067, 0x02430067, 0x02760067,
+ 0x02aa0067, 0x02dd0067, 0x03110067, 0x03440067,
+ 0x037800ce, 0x03df00ce, 0x044600ce, 0x04ad00ce,
+ 0x051400ce, 0x057b00c5, 0x05dd00bc, 0x063b00b5,
+ 0x06970158, 0x07420142, 0x07e30130, 0x087b0120,
+ 0x090b0112, 0x09940106, 0x0a1700fc, 0x0a9500f2,
+ 0x0b0f01cb, 0x0bf401ae, 0x0ccb0195, 0x0d950180,
+ 0x0e56016e, 0x0f0d015e, 0x0fbc0150, 0x10630143,
+ 0x11070264, 0x1238023e, 0x1357021d, 0x14660201,
+ 0x156601e9, 0x165a01d3, 0x174401c0, 0x182401af,
+ 0x18fe0331, 0x1a9602fe, 0x1c1502d2, 0x1d7e02ad,
+ 0x1ed4028d, 0x201a0270, 0x21520256, 0x227d0240,
+ 0x239f0443, 0x25c003fe, 0x27bf03c4, 0x29a10392,
+ 0x2b6a0367, 0x2d1d0341, 0x2ebe031f, 0x304d0300,
+ 0x31d105b0, 0x34a80555, 0x37520507, 0x39d504c5,
+ 0x3c37048b, 0x3e7c0458, 0x40a8042a, 0x42bd0401,
+ 0x44c20798, 0x488e071e, 0x4c1c06b6, 0x4f76065d,
+ 0x52a50610, 0x55ac05cc, 0x5892058f, 0x5b590559,
+ 0x5e0c0a23, 0x631c0980, 0x67db08f6, 0x6c55087f,
+ 0x70940818, 0x74a007bd, 0x787d076c, 0x7c330723,
+};
+
diff --git a/native/minigallium/auxiliary/util/u_format_srgb.h b/native/minigallium/auxiliary/util/u_format_srgb.h
index 82ed957..740a919 100644
--- a/native/minigallium/auxiliary/util/u_format_srgb.h
+++ b/native/minigallium/auxiliary/util/u_format_srgb.h
@@ -39,6 +39,7 @@
#include "pipe/p_compiler.h"
+#include "u_pack_color.h"
#include "u_math.h"
@@ -51,23 +52,58 @@ util_format_srgb_to_linear_8unorm_table[256];
extern const uint8_t
util_format_linear_to_srgb_8unorm_table[256];
+extern const unsigned
+util_format_linear_to_srgb_helper_table[104];
+
/**
* Convert a unclamped linear float to srgb value in the [0,255].
- * XXX this hasn't been tested (render to srgb surface).
- * XXX this needs optimization.
*/
static INLINE uint8_t
util_format_linear_float_to_srgb_8unorm(float x)
{
- if (x >= 1.0f)
- return 255;
- else if (x >= 0.0031308f)
- return float_to_ubyte(1.055f * powf(x, 0.41666f) - 0.055f);
- else if (x > 0.0f)
- return float_to_ubyte(12.92f * x);
- else
- return 0;
+ /* this would be exact but (probably much) slower */
+ if (0) {
+ if (x >= 1.0f)
+ return 255;
+ else if (x >= 0.0031308f)
+ return float_to_ubyte(1.055f * powf(x, 0.41666666f) - 0.055f);
+ else if (x > 0.0f)
+ return float_to_ubyte(12.92f * x);
+ else
+ return 0;
+ }
+ else {
+ /*
+ * This is taken from https://gist.github.com/rygorous/2203834
+ * Use LUT and do linear interpolation.
+ */
+ union fi almostone, minval, f;
+ unsigned tab, bias, scale, t;
+
+ almostone.ui = 0x3f7fffff;
+ minval.ui = (127-13) << 23;
+
+ /*
+ * Clamp to [2^(-13), 1-eps]; these two values map to 0 and 1, respectively.
+ * The tests are carefully written so that NaNs map to 0, same as in the
+ * reference implementation.
+ */
+ if (!(x > minval.f))
+ x = minval.f;
+ if (x > almostone.f)
+ x = almostone.f;
+
+ /* Do the table lookup and unpack bias, scale */
+ f.f = x;
+ tab = util_format_linear_to_srgb_helper_table[(f.ui - minval.ui) >> 20];
+ bias = (tab >> 16) << 9;
+ scale = tab & 0xffff;
+
+ /* Grab next-highest mantissa bits and perform linear interpolation */
+ t = (f.ui >> 12) & 0xff;
+ return (uint8_t) ((bias + scale*t) >> 16);
+ }
}
diff --git a/native/minigallium/auxiliary/util/u_format_table.c b/native/minigallium/auxiliary/util/u_format_table.c
index 4f38e4e..1cb0484 100644
--- a/native/minigallium/auxiliary/util/u_format_table.c
+++ b/native/minigallium/auxiliary/util/u_format_table.c
@@ -22432,6 +22432,136 @@ util_format_r32a32_sint_pack_unsigned(uint8_t *dst_row, unsigned dst_stride, con
}
}
+union util_format_r10g10b10a2_uint {
+ uint32_t value;
+ struct {
+ unsigned r:10;
+ unsigned g:10;
+ unsigned b:10;
+ unsigned a:2;
+ } chan;
+};
+
+static INLINE void
+util_format_r10g10b10a2_uint_unpack_unsigned(unsigned *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ unsigned x, y;
+ for(y = 0; y < height; y += 1) {
+ unsigned *dst = dst_row;
+ const uint8_t *src = src_row;
+ for(x = 0; x < width; x += 1) {
+ uint32_t value = *(const uint32_t *)src;
+ uint32_t r;
+ uint32_t g;
+ uint32_t b;
+ uint32_t a;
+ r = (value) & 0x3ff;
+ g = (value >> 10) & 0x3ff;
+ b = (value >> 20) & 0x3ff;
+ a = value >> 30;
+ dst[0] = (unsigned)r; /* r */
+ dst[1] = (unsigned)g; /* g */
+ dst[2] = (unsigned)b; /* b */
+ dst[3] = (unsigned)a; /* a */
+ src += 4;
+ dst += 4;
+ }
+ src_row += src_stride;
+ dst_row += dst_stride/sizeof(*dst_row);
+ }
+}
+
+static INLINE void
+util_format_r10g10b10a2_uint_pack_unsigned(uint8_t *dst_row, unsigned dst_stride, const unsigned *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ unsigned x, y;
+ for(y = 0; y < height; y += 1) {
+ const unsigned *src = src_row;
+ uint8_t *dst = dst_row;
+ for(x = 0; x < width; x += 1) {
+ uint32_t value = 0;
+ value |= ((uint32_t)MIN2(src[0], 1023)) & 0x3ff;
+ value |= (((uint32_t)MIN2(src[1], 1023)) & 0x3ff) << 10;
+ value |= (((uint32_t)MIN2(src[2], 1023)) & 0x3ff) << 20;
+ value |= ((uint32_t)MIN2(src[3], 3)) << 30;
+ *(uint32_t *)dst = value;
+ src += 4;
+ dst += 4;
+ }
+ dst_row += dst_stride;
+ src_row += src_stride/sizeof(*src_row);
+ }
+}
+
+static INLINE void
+util_format_r10g10b10a2_uint_fetch_unsigned(unsigned *dst, const uint8_t *src, unsigned i, unsigned j)
+{
+ uint32_t value = *(const uint32_t *)src;
+ uint32_t r;
+ uint32_t g;
+ uint32_t b;
+ uint32_t a;
+ r = (value) & 0x3ff;
+ g = (value >> 10) & 0x3ff;
+ b = (value >> 20) & 0x3ff;
+ a = value >> 30;
+ dst[0] = (unsigned)r; /* r */
+ dst[1] = (unsigned)g; /* g */
+ dst[2] = (unsigned)b; /* b */
+ dst[3] = (unsigned)a; /* a */
+}
+
+static INLINE void
+util_format_r10g10b10a2_uint_unpack_signed(int *dst_row, unsigned dst_stride, const uint8_t *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ unsigned x, y;
+ for(y = 0; y < height; y += 1) {
+ int *dst = dst_row;
+ const uint8_t *src = src_row;
+ for(x = 0; x < width; x += 1) {
+ uint32_t value = *(const uint32_t *)src;
+ uint32_t r;
+ uint32_t g;
+ uint32_t b;
+ uint32_t a;
+ r = (value) & 0x3ff;
+ g = (value >> 10) & 0x3ff;
+ b = (value >> 20) & 0x3ff;
+ a = value >> 30;
+ dst[0] = (int)r; /* r */
+ dst[1] = (int)g; /* g */
+ dst[2] = (int)b; /* b */
+ dst[3] = (int)a; /* a */
+ src += 4;
+ dst += 4;
+ }
+ src_row += src_stride;
+ dst_row += dst_stride/sizeof(*dst_row);
+ }
+}
+
+static INLINE void
+util_format_r10g10b10a2_uint_pack_signed(uint8_t *dst_row, unsigned dst_stride, const int *src_row, unsigned src_stride, unsigned width, unsigned height)
+{
+ unsigned x, y;
+ for(y = 0; y < height; y += 1) {
+ const int *src = src_row;
+ uint8_t *dst = dst_row;
+ for(x = 0; x < width; x += 1) {
+ uint32_t value = 0;
+ value |= ((uint32_t)CLAMP(src[0], 0, 1023)) & 0x3ff;
+ value |= (((uint32_t)CLAMP(src[1], 0, 1023)) & 0x3ff) << 10;
+ value |= (((uint32_t)CLAMP(src[2], 0, 1023)) & 0x3ff) << 20;
+ value |= ((uint32_t)CLAMP(src[3], 0, 3)) << 30;
+ *(uint32_t *)dst = value;
+ src += 4;
+ dst += 4;
+ }
+ dst_row += dst_stride;
+ src_row += src_stride/sizeof(*src_row);
+ }
+}
+
const struct util_format_description
util_format_none_description = {
PIPE_FORMAT_NONE,
@@ -33300,6 +33430,50 @@ util_format_r32a32_sint_description = {
&util_format_r32a32_sint_fetch_signed /* fetch_rgba_sint */
};
+const struct util_format_description
+util_format_r10g10b10a2_uint_description = {
+ PIPE_FORMAT_R10G10B10A2_UINT,
+ "PIPE_FORMAT_R10G10B10A2_UINT",
+ "r10g10b10a2_uint",
+ {1, 1, 32}, /* block */
+ UTIL_FORMAT_LAYOUT_PLAIN,
+ 4, /* nr_channels */
+ FALSE, /* is_array */
+ TRUE, /* is_bitmask */
+ FALSE, /* is_mixed */
+ {
+ {UTIL_FORMAT_TYPE_UNSIGNED, FALSE, TRUE, 10, 0}, /* x = r */
+ {UTIL_FORMAT_TYPE_UNSIGNED, FALSE, TRUE, 10, 10}, /* y = g */
+ {UTIL_FORMAT_TYPE_UNSIGNED, FALSE, TRUE, 10, 20}, /* z = b */
+ {UTIL_FORMAT_TYPE_UNSIGNED, FALSE, TRUE, 2, 30} /* w = a */
+ },
+ {
+ UTIL_FORMAT_SWIZZLE_X, /* r */
+ UTIL_FORMAT_SWIZZLE_Y, /* g */
+ UTIL_FORMAT_SWIZZLE_Z, /* b */
+ UTIL_FORMAT_SWIZZLE_W /* a */
+ },
+ UTIL_FORMAT_COLORSPACE_RGB,
+ NULL, /* unpack_rgba_8unorm */
+ NULL, /* pack_rgba_8unorm */
+ NULL, /* fetch_rgba_8unorm */
+ NULL, /* unpack_rgba_float */
+ NULL, /* pack_rgba_float */
+ NULL, /* fetch_rgba_float */
+ NULL, /* unpack_z_32unorm */
+ NULL, /* pack_z_32unorm */
+ NULL, /* unpack_z_float */
+ NULL, /* pack_z_float */
+ NULL, /* unpack_s_8uint */
+ NULL, /* pack_s_8uint */
+ &util_format_r10g10b10a2_uint_unpack_unsigned, /* unpack_rgba_uint */
+ &util_format_r10g10b10a2_uint_pack_unsigned, /* pack_rgba_uint */
+ &util_format_r10g10b10a2_uint_unpack_signed, /* unpack_rgba_sint */
+ &util_format_r10g10b10a2_uint_pack_signed, /* pack_rgba_sint */
+ &util_format_r10g10b10a2_uint_fetch_unsigned, /* fetch_rgba_uint */
+ NULL /* fetch_rgba_sint */
+};
+
const struct util_format_description *
util_format_description(enum pipe_format format)
{
@@ -33802,6 +33976,8 @@ util_format_description(enum pipe_format format)
return &util_format_r32a32_uint_description;
case PIPE_FORMAT_R32A32_SINT:
return &util_format_r32a32_sint_description;
+ case PIPE_FORMAT_R10G10B10A2_UINT:
+ return &util_format_r10g10b10a2_uint_description;
default:
return NULL;
}
diff --git a/native/minigallium/auxiliary/util/u_math.c b/native/minigallium/auxiliary/util/u_math.c
index f3fe392..6981ee9 100644
--- a/native/minigallium/auxiliary/util/u_math.c
+++ b/native/minigallium/auxiliary/util/u_math.c
@@ -111,7 +111,7 @@ util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
if (util_cpu_caps.has_sse) {
/* Enable flush to zero mode */
current_mxcsr |= _MM_FLUSH_ZERO_MASK;
- if (util_cpu_caps.has_sse3) {
+ if (util_cpu_caps.has_daz) {
/* Enable denormals are zero mode */
current_mxcsr |= _MM_DENORMALS_ZERO_MASK;
}
diff --git a/native/minigallium/auxiliary/util/u_vbuf.c b/native/minigallium/auxiliary/util/u_vbuf.c
index cb66b4c..b5efa88 100644
--- a/native/minigallium/auxiliary/util/u_vbuf.c
+++ b/native/minigallium/auxiliary/util/u_vbuf.c
@@ -186,7 +186,7 @@ struct u_vbuf {
uint32_t nonzero_stride_vb_mask; /* each bit describes a corresp. buffer */
/* Which buffers are allowed (supported by hardware). */
uint32_t allowed_vb_mask;
- /* Incompatible index buffer */
+ /* Incompatible index buffer */
uint32_t incompatible_ib_mask;
};
@@ -241,7 +241,7 @@ void u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps)
caps->user_vertex_buffers =
screen->get_param(screen, PIPE_CAP_USER_VERTEX_BUFFERS);
- caps->max_vertex_buffers =
+ caps->max_vertex_buffers =
screen->get_param(screen, PIPE_CAP_MAX_VERTEX_BUFFERS);
}
@@ -560,7 +560,7 @@ u_vbuf_translate_begin(struct u_vbuf *mgr,
}
}
assert(mask[VB_VERTEX] || mask[VB_INSTANCE] || mask[VB_CONST]);
-
+
/* In the case of unroll_indices, we can regard all non-constant
* vertex buffers with only non-instance vertex elements as incompatible
* and thus free.
@@ -788,9 +788,9 @@ u_vbuf_create_vertex_elements(struct u_vbuf *mgr, unsigned count,
if(used_buffers & ~mgr->allowed_vb_mask)
{
- /* More vertex buffers are used than the hardware supports.
- * In principle, we only need to make sure that less vertex are used,
- * and mark some of the latter vertex buffers as incompatible.
+ /* More vertex buffers are used than the hardware supports. In
+ * principle, we only need to make sure that less vertex buffers are
+ * used, and mark some of the latter vertex buffers as incompatible.
* For now, mark all vertex buffers as incompatible.
*/
ve->incompatible_vb_mask_any = used_buffers;
@@ -809,8 +809,12 @@ u_vbuf_create_vertex_elements(struct u_vbuf *mgr, unsigned count,
}
}
- ve->driver_cso =
- pipe->create_vertex_elements_state(pipe, count, driver_attribs);
+ /* Only create driver CSO if no incompatible elements */
+ if(!ve->incompatible_elem_mask)
+ {
+ ve->driver_cso =
+ pipe->create_vertex_elements_state(pipe, count, driver_attribs);
+ }
return ve;
}
@@ -1202,12 +1206,12 @@ void u_vbuf_draw_vbo(struct u_vbuf *mgr, const struct pipe_draw_info *info)
/* Primitive restart doesn't work when unrolling indices.
* We would have to break this drawing operation into several ones. */
/* Use some heuristic to see if unrolling indices improves
- * performance. Force unroll indices always if the index format is
+ * performance. Force unroll indices always if the index format is
* incompatible (don't support primitive restart in this case...). */
if ((!info->primitive_restart &&
num_vertices > info->count*2 &&
num_vertices-info->count > 32 &&
- !u_vbuf_mapping_vertex_buffer_blocks(mgr))
+ !u_vbuf_mapping_vertex_buffer_blocks(mgr))
|| mgr->incompatible_ib_mask) {
/*printf("num_vertices=%i count=%i\n", num_vertices, info->count);*/
unroll_indices = TRUE;
diff --git a/native/minigallium/auxiliary/util/u_video.h b/native/minigallium/auxiliary/util/u_video.h
index e575947..276e460 100644
--- a/native/minigallium/auxiliary/util/u_video.h
+++ b/native/minigallium/auxiliary/util/u_video.h
@@ -39,7 +39,7 @@ extern "C" {
#include "pipe/p_compiler.h"
#include "util/u_debug.h"
-static INLINE enum pipe_video_codec
+static INLINE enum pipe_video_format
u_reduce_video_profile(enum pipe_video_profile profile)
{
switch (profile)
@@ -47,24 +47,24 @@ u_reduce_video_profile(enum pipe_video_profile profile)
case PIPE_VIDEO_PROFILE_MPEG1:
case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE:
case PIPE_VIDEO_PROFILE_MPEG2_MAIN:
- return PIPE_VIDEO_CODEC_MPEG12;
+ return PIPE_VIDEO_FORMAT_MPEG12;
case PIPE_VIDEO_PROFILE_MPEG4_SIMPLE:
case PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE:
- return PIPE_VIDEO_CODEC_MPEG4;
+ return PIPE_VIDEO_FORMAT_MPEG4;
case PIPE_VIDEO_PROFILE_VC1_SIMPLE:
case PIPE_VIDEO_PROFILE_VC1_MAIN:
case PIPE_VIDEO_PROFILE_VC1_ADVANCED:
- return PIPE_VIDEO_CODEC_VC1;
+ return PIPE_VIDEO_FORMAT_VC1;
case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE:
case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN:
case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH:
- return PIPE_VIDEO_CODEC_MPEG4_AVC;
+ return PIPE_VIDEO_FORMAT_MPEG4_AVC;
default:
- return PIPE_VIDEO_CODEC_UNKNOWN;
+ return PIPE_VIDEO_FORMAT_UNKNOWN;
}
}
diff --git a/native/minigallium/include/pipe/p_config.h b/native/minigallium/include/pipe/p_config.h
index 1588a92..9bccf32 100644
--- a/native/minigallium/include/pipe/p_config.h
+++ b/native/minigallium/include/pipe/p_config.h
@@ -58,6 +58,10 @@
/*
* Meaning of _MSC_VER value:
+ * - 1800: Visual Studio 2013
+ * - 1700: Visual Studio 2012
+ * - 1600: Visual Studio 2010
+ * - 1500: Visual Studio 2008
* - 1400: Visual C++ 2005
* - 1310: Visual C++ .NET 2003
* - 1300: Visual C++ .NET 2002
diff --git a/native/minigallium/include/pipe/p_context.h b/native/minigallium/include/pipe/p_context.h
index aa18cbf..69352f7 100644
--- a/native/minigallium/include/pipe/p_context.h
+++ b/native/minigallium/include/pipe/p_context.h
@@ -65,7 +65,7 @@ struct pipe_transfer;
struct pipe_vertex_buffer;
struct pipe_vertex_element;
struct pipe_video_buffer;
-struct pipe_video_decoder;
+struct pipe_video_codec;
struct pipe_viewport_state;
struct pipe_compute_state;
union pipe_color_union;
@@ -430,14 +430,10 @@ struct pipe_context {
void (*texture_barrier)(struct pipe_context *);
/**
- * Creates a video decoder for a specific video codec/profile
+ * Creates a video codec for a specific video format/profile
*/
- struct pipe_video_decoder *(*create_video_decoder)( struct pipe_context *context,
- enum pipe_video_profile profile,
- enum pipe_video_entrypoint entrypoint,
- enum pipe_video_chroma_format chroma_format,
- unsigned width, unsigned height, unsigned max_references,
- bool expect_chunked_decode);
+ struct pipe_video_codec *(*create_video_codec)( struct pipe_context *context,
+ const struct pipe_video_codec *templat );
/**
* Creates a video buffer as decoding target
diff --git a/native/minigallium/include/pipe/p_defines.h b/native/minigallium/include/pipe/p_defines.h
index e04fdcd..85294f4 100644
--- a/native/minigallium/include/pipe/p_defines.h
+++ b/native/minigallium/include/pipe/p_defines.h
@@ -330,9 +330,13 @@ enum pipe_flush_flags {
* The shared flag is quite underspecified, but certainly isn't a
* binding flag - it seems more like a message to the winsys to create
* a shareable allocation.
+ *
+ * The third flag has been added to be able to force textures to be created
+ * in linear mode (no tiling).
*/
#define PIPE_BIND_SCANOUT (1 << 14) /* */
#define PIPE_BIND_SHARED (1 << 15) /* get_texture_handle ??? */
+#define PIPE_BIND_LINEAR (1 << 21)
/* Flags for the driver about resource behaviour:
diff --git a/native/minigallium/include/pipe/p_format.h b/native/minigallium/include/pipe/p_format.h
index f181621..b82f08f 100644
--- a/native/minigallium/include/pipe/p_format.h
+++ b/native/minigallium/include/pipe/p_format.h
@@ -340,6 +340,7 @@ enum pipe_format {
PIPE_FORMAT_R16A16_SINT = 250,
PIPE_FORMAT_R32A32_UINT = 251,
PIPE_FORMAT_R32A32_SINT = 252,
+ PIPE_FORMAT_R10G10B10A2_UINT = 253,
PIPE_FORMAT_COUNT
};
diff --git a/native/minigallium/include/pipe/p_screen.h b/native/minigallium/include/pipe/p_screen.h
index c487e8e..3ed7f26 100644
--- a/native/minigallium/include/pipe/p_screen.h
+++ b/native/minigallium/include/pipe/p_screen.h
@@ -94,6 +94,7 @@ struct pipe_screen {
*/
int (*get_video_param)( struct pipe_screen *,
enum pipe_video_profile profile,
+ enum pipe_video_entrypoint entrypoint,
enum pipe_video_cap param );
/**
@@ -135,7 +136,8 @@ struct pipe_screen {
*/
boolean (*is_video_format_supported)( struct pipe_screen *,
enum pipe_format format,
- enum pipe_video_profile profile );
+ enum pipe_video_profile profile,
+ enum pipe_video_entrypoint entrypoint );
/**
* Check if we can actually create the given resource (test the dimension,
diff --git a/native/minigallium/include/pipe/p_shader_tokens.h b/native/minigallium/include/pipe/p_shader_tokens.h
index 9aaf687..1beec05 100644
--- a/native/minigallium/include/pipe/p_shader_tokens.h
+++ b/native/minigallium/include/pipe/p_shader_tokens.h
@@ -153,7 +153,7 @@ struct tgsi_declaration_interp
#define TGSI_SEMANTIC_FACE 7
#define TGSI_SEMANTIC_EDGEFLAG 8
#define TGSI_SEMANTIC_PRIMID 9
-#define TGSI_SEMANTIC_INSTANCEID 10
+#define TGSI_SEMANTIC_INSTANCEID 10 /**< doesn't include start_instance */
#define TGSI_SEMANTIC_VERTEXID 11
#define TGSI_SEMANTIC_STENCIL 12
#define TGSI_SEMANTIC_CLIPDIST 13
@@ -367,7 +367,12 @@ struct tgsi_property_data {
#define TGSI_OPCODE_TXQ_LZ 103 /* TXQ for mipmap level 0 */
/* gap */
#define TGSI_OPCODE_NOP 107
- /* gap */
+
+#define TGSI_OPCODE_FSEQ 108
+#define TGSI_OPCODE_FSGE 109
+#define TGSI_OPCODE_FSLT 110
+#define TGSI_OPCODE_FSNE 111
+
#define TGSI_OPCODE_NRM4 112
#define TGSI_OPCODE_CALLNZ 113
/* gap */
diff --git a/native/minigallium/include/pipe/p_video_decoder.h b/native/minigallium/include/pipe/p_video_decoder.h
deleted file mode 100644
index 5499ffa..0000000
--- a/native/minigallium/include/pipe/p_video_decoder.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2009 Younes Manton.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef PIPE_VIDEO_CONTEXT_H
-#define PIPE_VIDEO_CONTEXT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "pipe/p_video_state.h"
-
-struct pipe_screen;
-struct pipe_surface;
-struct pipe_macroblock;
-struct pipe_picture_desc;
-struct pipe_fence_handle;
-
-/**
- * Gallium video decoder for a specific codec/profile
- */
-struct pipe_video_decoder
-{
- struct pipe_context *context;
-
- enum pipe_video_profile profile;
- enum pipe_video_entrypoint entrypoint;
- enum pipe_video_chroma_format chroma_format;
- unsigned width;
- unsigned height;
- unsigned max_references;
-
- /**
- * destroy this video decoder
- */
- void (*destroy)(struct pipe_video_decoder *decoder);
-
- /**
- * start decoding of a new frame
- */
- void (*begin_frame)(struct pipe_video_decoder *decoder,
- struct pipe_video_buffer *target,
- struct pipe_picture_desc *picture);
-
- /**
- * decode a macroblock
- */
- void (*decode_macroblock)(struct pipe_video_decoder *decoder,
- struct pipe_video_buffer *target,
- struct pipe_picture_desc *picture,
- const struct pipe_macroblock *macroblocks,
- unsigned num_macroblocks);
-
- /**
- * decode a bitstream
- */
- void (*decode_bitstream)(struct pipe_video_decoder *decoder,
- struct pipe_video_buffer *target,
- struct pipe_picture_desc *picture,
- unsigned num_buffers,
- const void * const *buffers,
- const unsigned *sizes);
-
- /**
- * end decoding of the current frame
- */
- void (*end_frame)(struct pipe_video_decoder *decoder,
- struct pipe_video_buffer *target,
- struct pipe_picture_desc *picture);
-
- /**
- * flush any outstanding command buffers to the hardware
- * should be called before a video_buffer is acessed by the state tracker again
- */
- void (*flush)(struct pipe_video_decoder *decoder);
-};
-
-/**
- * output for decoding / input for displaying
- */
-struct pipe_video_buffer
-{
- struct pipe_context *context;
-
- enum pipe_format buffer_format;
- enum pipe_video_chroma_format chroma_format;
- unsigned width;
- unsigned height;
- bool interlaced;
-
- /**
- * destroy this video buffer
- */
- void (*destroy)(struct pipe_video_buffer *buffer);
-
- /**
- * get a individual sampler view for each plane
- */
- struct pipe_sampler_view **(*get_sampler_view_planes)(struct pipe_video_buffer *buffer);
-
- /**
- * get a individual sampler view for each component
- */
- struct pipe_sampler_view **(*get_sampler_view_components)(struct pipe_video_buffer *buffer);
-
- /**
- * get a individual surfaces for each plane
- */
- struct pipe_surface **(*get_surfaces)(struct pipe_video_buffer *buffer);
-
- /*
- * auxiliary associated data
- */
- void *associated_data;
-
- /*
- * decoder where the associated data came from
- */
- struct pipe_video_decoder *decoder;
-
- /*
- * destroy the associated data
- */
- void (*destroy_associated_data)(void *associated_data);
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* PIPE_VIDEO_CONTEXT_H */
diff --git a/native/minigallium/include/pipe/p_video_enums.h b/native/minigallium/include/pipe/p_video_enums.h
index deacf8d..46dad94 100644
--- a/native/minigallium/include/pipe/p_video_enums.h
+++ b/native/minigallium/include/pipe/p_video_enums.h
@@ -28,6 +28,15 @@
#ifndef PIPE_VIDEO_ENUMS_H
#define PIPE_VIDEO_ENUMS_H
+enum pipe_video_format
+{
+ PIPE_VIDEO_FORMAT_UNKNOWN = 0,
+ PIPE_VIDEO_FORMAT_MPEG12, /**< MPEG1, MPEG2 */
+ PIPE_VIDEO_FORMAT_MPEG4, /**< DIVX, XVID */
+ PIPE_VIDEO_FORMAT_VC1, /**< WMV */
+ PIPE_VIDEO_FORMAT_MPEG4_AVC /**< H.264 */
+};
+
enum pipe_video_profile
{
PIPE_VIDEO_PROFILE_UNKNOWN,
@@ -54,16 +63,8 @@ enum pipe_video_cap
PIPE_VIDEO_CAP_PREFERED_FORMAT = 4,
PIPE_VIDEO_CAP_PREFERS_INTERLACED = 5,
PIPE_VIDEO_CAP_SUPPORTS_PROGRESSIVE = 6,
- PIPE_VIDEO_CAP_SUPPORTS_INTERLACED = 7
-};
-
-enum pipe_video_codec
-{
- PIPE_VIDEO_CODEC_UNKNOWN = 0,
- PIPE_VIDEO_CODEC_MPEG12, /**< MPEG1, MPEG2 */
- PIPE_VIDEO_CODEC_MPEG4, /**< DIVX, XVID */
- PIPE_VIDEO_CODEC_VC1, /**< WMV */
- PIPE_VIDEO_CODEC_MPEG4_AVC /**< H.264 */
+ PIPE_VIDEO_CAP_SUPPORTS_INTERLACED = 7,
+ PIPE_VIDEO_CAP_MAX_LEVEL = 8
};
enum pipe_video_entrypoint
diff --git a/native/minigallium/include/pipe/p_video_state.h b/native/minigallium/include/pipe/p_video_state.h
index 00390d3..1fb6ff2 100644
--- a/native/minigallium/include/pipe/p_video_state.h
+++ b/native/minigallium/include/pipe/p_video_state.h
@@ -108,12 +108,12 @@ struct pipe_picture_desc
struct pipe_quant_matrix
{
- enum pipe_video_codec codec;
+ enum pipe_video_format codec;
};
struct pipe_macroblock
{
- enum pipe_video_codec codec;
+ enum pipe_video_format codec;
};
struct pipe_mpeg12_picture_desc