[PICA] Alpha test and some new registers

This commit is contained in:
wheremyfoodat 2022-10-01 02:40:08 +03:00
parent 6adc56df4e
commit 8b85255f4c
6 changed files with 104 additions and 29 deletions

View file

@ -78,6 +78,7 @@ class GPU {
u32 fixedAttribCount = 0; // How many attribute components have we written? When we get to 4 the attr will actually get submitted
std::array<u32, 3> fixedAttrBuff; // Buffer to hold fixed attributes in until they get submitted
// OpenGL renderer state
OpenGL::Framebuffer fbo;
OpenGL::Texture fboTexture;
OpenGL::Program triangleProgram;
@ -85,6 +86,8 @@ class GPU {
OpenGL::VertexArray vao;
OpenGL::VertexBuffer vbo;
GLint alphaControlLoc = -1;
u32 oldAlphaControl = 0;
// Dummy VAO/VBO for blitting the final output
OpenGL::VertexArray dummyVAO;

View file

@ -2,7 +2,17 @@
namespace PICAInternalRegs {
enum : u32 {
// Rasterizer registers
ViewportWidth = 0x41,
ViewportInvw = 0x42,
ViewportHeight = 0x43,
ViewportInvh = 0x44,
DepthScale = 0x4D,
DepthOffset = 0x4E,
// Framebuffer registers
AlphaTestConfig = 0x104,
DepthAndColorMask = 0x107,
// Geometry pipeline registers

View file

@ -74,7 +74,7 @@ class PICAShader {
std::array<Loop, 4> loopInfo;
std::array<ConditionalInfo, 8> conditionalInfo;
std::array<CallInfo, 8> callInfo;
std::array<CallInfo, 4> callInfo;
ShaderType type;
@ -157,7 +157,7 @@ public:
std::array<vec4f, 96> floatUniforms;
std::array<vec4f, 16> fixedAttributes; // Fixed vertex attributes
std::array<vec4f, 16> attributes; // Attributes past to the shader
std::array<vec4f, 16> attributes; // Attributes passed to the shader
std::array<vec4f, 16> outputs;
PICAShader(ShaderType type) : type(type) {}
@ -177,6 +177,7 @@ public:
}
void uploadWord(u32 word) {
if (bufferIndex >= 511) Helpers::panic("o no");
bufferedShader[bufferIndex++] = word;
bufferIndex &= 0x1ff;
}