gl_rasterizer: Implement AnalyzeVertexArray.
This commit is contained in:
parent
8041d72a1f
commit
ed2134784e
|
@ -229,6 +229,41 @@ public:
|
|||
BitField<21, 6, VertexSize> size;
|
||||
BitField<27, 3, VertexType> type;
|
||||
BitField<31, 1, u32> bgra;
|
||||
|
||||
u32 SizeInBytes() const {
|
||||
switch (size) {
|
||||
case VertexSize::Size_32_32_32_32:
|
||||
return 16;
|
||||
case VertexSize::Size_32_32_32:
|
||||
return 12;
|
||||
case VertexSize::Size_16_16_16_16:
|
||||
return 8;
|
||||
case VertexSize::Size_32_32:
|
||||
return 8;
|
||||
case VertexSize::Size_16_16_16:
|
||||
return 6;
|
||||
case VertexSize::Size_8_8_8_8:
|
||||
return 4;
|
||||
case VertexSize::Size_16_16:
|
||||
return 4;
|
||||
case VertexSize::Size_32:
|
||||
return 4;
|
||||
case VertexSize::Size_8_8_8:
|
||||
return 3;
|
||||
case VertexSize::Size_8_8:
|
||||
return 2;
|
||||
case VertexSize::Size_16:
|
||||
return 2;
|
||||
case VertexSize::Size_8:
|
||||
return 1;
|
||||
case VertexSize::Size_10_10_10_2:
|
||||
return 4;
|
||||
case VertexSize::Size_11_11_10:
|
||||
return 4;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
} vertex_attrib_format[NumVertexAttributes];
|
||||
|
||||
INSERT_PADDING_WORDS(0xF);
|
||||
|
|
|
@ -14,7 +14,10 @@
|
|||
#include "common/microprofile.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "common/vector_math.h"
|
||||
#include "core/core.h"
|
||||
#include "core/hle/kernel/process.h"
|
||||
#include "core/settings.h"
|
||||
#include "video_core/engines/maxwell_3d.h"
|
||||
#include "video_core/renderer_opengl/gl_rasterizer.h"
|
||||
#include "video_core/renderer_opengl/gl_shader_gen.h"
|
||||
#include "video_core/renderer_opengl/renderer_opengl.h"
|
||||
|
@ -146,7 +149,24 @@ static constexpr std::array<GLenum, 4> vs_attrib_types{
|
|||
};
|
||||
|
||||
void RasterizerOpenGL::AnalyzeVertexArray(bool is_indexed) {
|
||||
UNIMPLEMENTED();
|
||||
const auto& regs = Core::System().GetInstance().GPU().Maxwell3D().regs;
|
||||
const auto& vertex_attributes = regs.vertex_attrib_format;
|
||||
|
||||
if (is_indexed) {
|
||||
UNREACHABLE();
|
||||
}
|
||||
const u32 vertex_num = regs.vertex_buffer.count;
|
||||
|
||||
vs_input_size = 0;
|
||||
u32 max_offset{};
|
||||
for (const auto& attrib : vertex_attributes) {
|
||||
if (max_offset >= attrib.offset) {
|
||||
continue;
|
||||
}
|
||||
max_offset = attrib.offset;
|
||||
vs_input_size = max_offset + attrib.SizeInBytes();
|
||||
}
|
||||
vs_input_size *= vertex_num;
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::SetupVertexArray(u8* array_ptr, GLintptr buffer_offset) {
|
||||
|
|
Reference in New Issue