2018-09-24 15:03:25 +02:00
|
|
|
|
#pragma once
|
2016-04-20 01:32:27 +02:00
|
|
|
|
|
2015-09-28 22:51:32 +02:00
|
|
|
|
#include <vector>
|
2016-04-20 01:32:27 +02:00
|
|
|
|
|
2019-11-09 20:00:31 +01:00
|
|
|
|
#include "Utilities/span.h"
|
2018-09-29 00:12:00 +02:00
|
|
|
|
#include "../gcm_enums.h"
|
2015-09-28 22:51:32 +02:00
|
|
|
|
|
2015-10-27 01:19:04 +01:00
|
|
|
|
/**
|
2016-08-21 19:17:09 +02:00
|
|
|
|
* Write count vertex attributes from src_ptr.
|
2016-02-20 00:50:20 +01:00
|
|
|
|
* src_ptr array layout is deduced from the type, vector element count and src_stride arguments.
|
2015-09-28 22:51:32 +02:00
|
|
|
|
*/
|
2019-11-09 15:17:41 +01:00
|
|
|
|
void write_vertex_array_data_to_buffer(gsl::span<std::byte> raw_dst_span, gsl::span<const std::byte> src_ptr, u32 count, rsx::vertex_base_type type, u32 vector_element_count, u32 attribute_src_stride, u8 dst_stride, bool swap_endianness);
|
2015-09-28 22:51:32 +02:00
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* If primitive mode is not supported and need to be emulated (using an index buffer) returns false.
|
|
|
|
|
|
*/
|
2016-01-20 18:12:48 +01:00
|
|
|
|
bool is_primitive_native(rsx::primitive_type m_draw_mode);
|
2015-09-28 22:51:32 +02:00
|
|
|
|
|
2019-01-14 13:33:05 +01:00
|
|
|
|
/*
|
|
|
|
|
|
* Returns true if adjacency information does not matter for this type. Allows optimizations e.g removal of primitive restart index
|
|
|
|
|
|
*/
|
|
|
|
|
|
bool is_primitive_disjointed(rsx::primitive_type draw_mode);
|
|
|
|
|
|
|
2015-10-27 01:19:04 +01:00
|
|
|
|
/**
|
2015-09-28 22:51:32 +02:00
|
|
|
|
* Returns a fixed index count for emulated primitive, otherwise returns initial_index_count
|
|
|
|
|
|
*/
|
2016-08-05 23:58:35 +02:00
|
|
|
|
u32 get_index_count(rsx::primitive_type m_draw_mode, u32 initial_index_count);
|
2015-09-28 22:51:32 +02:00
|
|
|
|
|
2015-10-27 01:19:04 +01:00
|
|
|
|
/**
|
|
|
|
|
|
* Returns index type size in byte
|
|
|
|
|
|
*/
|
2016-08-05 23:58:35 +02:00
|
|
|
|
u32 get_index_type_size(rsx::index_array_type type);
|
2015-10-27 01:19:04 +01:00
|
|
|
|
|
|
|
|
|
|
/**
|
2016-01-12 00:54:07 +01:00
|
|
|
|
* Write count indexes using (first, first + count) ranges.
|
2017-10-17 12:09:02 +02:00
|
|
|
|
* Returns min/max index found during the process and the number of valid indices written to the buffer.
|
2016-07-31 23:01:31 +02:00
|
|
|
|
* The function expands index buffer for non native primitive type if expands(draw_mode) return true.
|
2015-09-28 22:51:32 +02:00
|
|
|
|
*/
|
2019-11-09 15:17:41 +01:00
|
|
|
|
std::tuple<u32, u32, u32> write_index_array_data_to_buffer(gsl::span<std::byte> dst, gsl::span<const std::byte> src,
|
2018-10-01 22:05:51 +02:00
|
|
|
|
rsx::index_array_type, rsx::primitive_type draw_mode, bool restart_index_enabled, u32 restart_index,
|
2019-06-08 07:58:04 +02:00
|
|
|
|
const std::function<bool(rsx::primitive_type)>& expands);
|
2015-10-15 23:06:14 +02:00
|
|
|
|
|
2015-10-27 01:19:04 +01:00
|
|
|
|
/**
|
|
|
|
|
|
* Write index data needed to emulate non indexed non native primitive mode.
|
|
|
|
|
|
*/
|
2017-06-26 23:34:22 +02:00
|
|
|
|
void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst, rsx::primitive_type draw_mode, unsigned count);
|
2015-10-31 18:08:49 +01:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Stream a 128 bits vector to dst.
|
|
|
|
|
|
*/
|
2016-06-20 23:38:38 +02:00
|
|
|
|
void stream_vector(void *dst, f32 x, f32 y, f32 z, f32 w);
|
2015-12-17 18:31:27 +01:00
|
|
|
|
void stream_vector(void *dst, u32 x, u32 y, u32 z, u32 w);
|
2015-10-31 18:19:45 +01:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Stream a 128 bits vector from src to dst.
|
|
|
|
|
|
*/
|
2015-12-17 18:31:27 +01:00
|
|
|
|
void stream_vector_from_memory(void *dst, void *src);
|
2020-03-28 10:53:30 +01:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Stream and swap data in u32 units.
|
|
|
|
|
|
*/
|
|
|
|
|
|
template <bool unaligned = false>
|
|
|
|
|
|
void stream_data_to_memory_swapped_u32(void *dst, const void *src, u32 vertex_count, u8 stride);
|
2020-04-09 14:53:43 +02:00
|
|
|
|
template <bool unaligned = false>
|
|
|
|
|
|
bool stream_data_to_memory_swapped_and_compare_u32(void *dst, const void *src, u32 size);
|
2020-03-28 10:53:30 +01:00
|
|
|
|
|
|
|
|
|
|
|