Xenos: Fill in some of the unknown primitive types.

This commit is contained in:
Dr. Chat 2017-06-10 20:09:03 -05:00
parent 8e1c0201ad
commit 6ab4bac542
3 changed files with 40 additions and 21 deletions

View File

@ -448,8 +448,8 @@ bool DrawBatcher::Flush(FlushMode mode) {
prim_type = GL_LINES_ADJACENCY; prim_type = GL_LINES_ADJACENCY;
break; break;
default: default:
case PrimitiveType::kUnknown0x07: case PrimitiveType::kTriangleWithWFlags:
prim_type = GL_POINTS; prim_type = GL_TRIANGLES;
valid_prim = false; valid_prim = false;
XELOGE("unsupported primitive type %d", batch_state_.prim_type); XELOGE("unsupported primitive type %d", batch_state_.prim_type);
assert_unhandled_case(batch_state_.prim_type); assert_unhandled_case(batch_state_.prim_type);

View File

@ -275,6 +275,7 @@ VkPipeline PipelineCache::GetPipeline(const RenderState* render_state,
&pipeline_info, nullptr, &pipeline); &pipeline_info, nullptr, &pipeline);
if (result != VK_SUCCESS) { if (result != VK_SUCCESS) {
XELOGE("vkCreateGraphicsPipelines failed with code %d", result); XELOGE("vkCreateGraphicsPipelines failed with code %d", result);
assert_always();
return nullptr; return nullptr;
} }
@ -422,7 +423,7 @@ VkShaderModule PipelineCache::GetGeometryShader(PrimitiveType primitive_type,
return nullptr; return nullptr;
case PrimitiveType::kPointList: case PrimitiveType::kPointList:
return geometry_shaders_.point_list; return geometry_shaders_.point_list;
case PrimitiveType::kUnknown0x07: case PrimitiveType::kTriangleWithWFlags:
assert_always("Unknown geometry type"); assert_always("Unknown geometry type");
return nullptr; return nullptr;
case PrimitiveType::kRectangleList: case PrimitiveType::kRectangleList:
@ -633,11 +634,19 @@ bool PipelineCache::SetDynamicState(VkCommandBuffer command_buffer,
// Normal vertex shaders only, for now. // Normal vertex shaders only, for now.
// TODO(benvanik): transform feedback/memexport. // TODO(benvanik): transform feedback/memexport.
// https://github.com/freedreno/freedreno/blob/master/includes/a2xx.xml.h // https://github.com/freedreno/freedreno/blob/master/includes/a2xx.xml.h
// 0 = normal // Draw calls skipped if they have unsupported export modes.
// 2 = point size // 0 = positionOnly
// 7 = memexport // 1 = unused
// 2 = sprite
// 3 = edge
// 4 = kill
// 5 = spriteKill
// 6 = edgeKill
// 7 = multipass
assert_true(program_cntl.vs_export_mode == 0 || assert_true(program_cntl.vs_export_mode == 0 ||
program_cntl.vs_export_mode == 2); program_cntl.vs_export_mode == 2 ||
program_cntl.vs_export_mode == 7);
assert_false(program_cntl.gen_index_vtx);
SpirvPushConstants push_constants; SpirvPushConstants push_constants;
@ -897,6 +906,8 @@ PipelineCache::UpdateStatus PipelineCache::UpdateVertexInputState(
vertex_attrib_descr.format = VK_FORMAT_UNDEFINED; vertex_attrib_descr.format = VK_FORMAT_UNDEFINED;
vertex_attrib_descr.offset = attrib.fetch_instr.attributes.offset * 4; vertex_attrib_descr.offset = attrib.fetch_instr.attributes.offset * 4;
// TODO(DrChat): Some floating point formats have is_integer set. Input
// data is still floating point, does this mean we need to truncate?
bool is_signed = attrib.fetch_instr.attributes.is_signed; bool is_signed = attrib.fetch_instr.attributes.is_signed;
bool is_integer = attrib.fetch_instr.attributes.is_integer; bool is_integer = attrib.fetch_instr.attributes.is_integer;
switch (attrib.fetch_instr.attributes.data_format) { switch (attrib.fetch_instr.attributes.data_format) {
@ -1052,7 +1063,7 @@ PipelineCache::UpdateStatus PipelineCache::UpdateInputAssemblyState(
state_info.topology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY; state_info.topology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY;
break; break;
default: default:
case PrimitiveType::kUnknown0x07: case PrimitiveType::kTriangleWithWFlags:
XELOGE("unsupported primitive type %d", primitive_type); XELOGE("unsupported primitive type %d", primitive_type);
assert_unhandled_case(primitive_type); assert_unhandled_case(primitive_type);
return UpdateStatus::kError; return UpdateStatus::kError;

View File

@ -30,12 +30,19 @@ enum class PrimitiveType : uint32_t {
kTriangleList = 0x04, kTriangleList = 0x04,
kTriangleFan = 0x05, kTriangleFan = 0x05,
kTriangleStrip = 0x06, kTriangleStrip = 0x06,
kUnknown0x07 = 0x07, kTriangleWithWFlags = 0x07,
kRectangleList = 0x08, kRectangleList = 0x08,
kLineLoop = 0x0C, kLineLoop = 0x0C,
kQuadList = 0x0D, kQuadList = 0x0D,
kQuadStrip = 0x0E, kQuadStrip = 0x0E,
kUnknown0x11 = 0x11, kPolygon = 0x0F,
k2DCopyRectListV0 = 0x10,
k2DCopyRectListV1 = 0x11,
k2DCopyRectListV2 = 0x12,
k2DCopyRectListV3 = 0x13,
k2DFillRectList = 0x14,
k2DLineStrip = 0x15,
k2DTriStrip = 0x16,
}; };
enum class Dimension : uint32_t { enum class Dimension : uint32_t {
@ -373,11 +380,12 @@ typedef union {
// XE_GPU_REG_SHADER_CONSTANT_FETCH_* // XE_GPU_REG_SHADER_CONSTANT_FETCH_*
XEPACKEDUNION(xe_gpu_vertex_fetch_t, { XEPACKEDUNION(xe_gpu_vertex_fetch_t, {
XEPACKEDSTRUCTANONYMOUS({ XEPACKEDSTRUCTANONYMOUS({
uint32_t type : 2; uint32_t type : 2; // +0
uint32_t address : 30; uint32_t address : 30; // +2
uint32_t endian : 2;
uint32_t size : 24; // size in words uint32_t endian : 2; // +0
uint32_t unk1 : 6; uint32_t size : 24; // +2 size in words
uint32_t unk1 : 6; // +26
}); });
XEPACKEDSTRUCTANONYMOUS({ XEPACKEDSTRUCTANONYMOUS({
uint32_t dword_0; uint32_t dword_0;
@ -400,12 +408,12 @@ XEPACKEDUNION(xe_gpu_texture_fetch_t, {
uint32_t pitch : 9; // +22 byte_pitch >> 5 uint32_t pitch : 9; // +22 byte_pitch >> 5
uint32_t tiled : 1; // +31 uint32_t tiled : 1; // +31
uint32_t format : 6; // dword_1 uint32_t format : 6; // +0 dword_1
uint32_t endianness : 2; uint32_t endianness : 2; // +6
uint32_t request_size : 2; uint32_t request_size : 2; // +8
uint32_t stacked : 1; uint32_t stacked : 1; // +10
uint32_t clamp_policy : 1; // d3d/opengl uint32_t clamp_policy : 1; // +11 d3d/opengl
uint32_t address : 20; uint32_t address : 20; // +12
union { // dword_2 union { // dword_2
struct { struct {