rsx::thread moved from rsx2 branch

TODO: cellResc module & RsxDebugger disabled, DX12 renderer not compilable
This commit is contained in:
DH 2015-10-04 01:45:26 +03:00
parent a7262d34f0
commit 1e7ded2163
33 changed files with 8324 additions and 6803 deletions

1087
Utilities/types.h Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,202 +1,110 @@
#pragma once
#include "Emu/RSX/GSRender.h"
#include "GLBuffers.h"
#include "gl_helpers.h"
#define RSX_DEBUG 1
#include "GLProgramBuffer.h"
#pragma comment(lib, "opengl32.lib")
#if RSX_DEBUG
#define checkForGlError(sit) if((g_last_gl_error = glGetError()) != GL_NO_ERROR) printGlError(g_last_gl_error, sit)
#else
#define checkForGlError(sit)
#endif
extern GLenum g_last_gl_error;
void printGlError(GLenum err, const char* situation);
void printGlError(GLenum err, const std::string& situation);
class GLTexture
{
u32 m_id;
u32 m_id = 0;
public:
GLTexture() : m_id(0)
{
}
void create();
void Create();
int gl_wrap(int wrap);
int GetGlWrap(int wrap);
float max_aniso(int aniso);
float GetMaxAniso(int aniso);
inline static u8 Convert4To8(u8 v)
inline static u8 convert_4_to_8(u8 v)
{
// Swizzle bits: 00001234 -> 12341234
return (v << 4) | (v);
}
inline static u8 Convert5To8(u8 v)
inline static u8 convert_5_to_8(u8 v)
{
// Swizzle bits: 00012345 -> 12345123
return (v << 3) | (v >> 2);
}
inline static u8 Convert6To8(u8 v)
inline static u8 convert_6_to_8(u8 v)
{
// Swizzle bits: 00123456 -> 12345612
return (v << 2) | (v >> 4);
}
void Init(RSXTexture& tex);
void init(rsx::texture& tex);
void save(rsx::texture& tex, const std::string& name);
void save(rsx::texture& tex);
void bind();
void unbind();
void remove();
void Save(RSXTexture& tex, const std::string& name);
void Save(RSXTexture& tex);
void Bind();
void Unbind();
void Delete();
u32 id() const;
};
class PostDrawObj
{
protected:
GLFragmentProgram m_fp;
GLVertexProgram m_vp;
GLProgram m_program;
GLfbo m_fbo;
GLrbo m_rbo;
public:
virtual void Draw();
virtual void InitializeShaders() = 0;
virtual void InitializeLocations() = 0;
void Initialize();
};
class DrawCursorObj : public PostDrawObj
{
u32 m_tex_id;
void* m_pixels;
u32 m_width, m_height;
double m_pos_x, m_pos_y, m_pos_z;
bool m_update_texture, m_update_pos;
public:
DrawCursorObj() : PostDrawObj()
, m_tex_id(0)
, m_update_texture(false)
, m_update_pos(false)
{
}
virtual void Draw();
virtual void InitializeShaders();
void SetTexture(void* pixels, int width, int height);
void SetPosition(float x, float y, float z = 0.0f);
void InitializeLocations();
};
class GSFrameBase
{
public:
GSFrameBase() {}
GSFrameBase(const GSFrameBase&) = delete;
virtual void Close() = 0;
virtual bool IsShown() = 0;
virtual void Hide() = 0;
virtual void Show() = 0;
virtual void* GetNewContext() = 0;
virtual void SetCurrent(void* ctx) = 0;
virtual void DeleteContext(void* ctx) = 0;
virtual void Flip(void* ctx) = 0;
};
class GLGSRender final : public GSRender
class GLGSRender : public GSRender
{
private:
std::vector<u8> m_vdata;
std::vector<PostDrawObj> m_post_draw_objs;
GLProgram m_program;
int m_fp_buf_num;
int m_vp_buf_num;
GLProgramBuffer m_prog_buffer;
GLFragmentProgram m_fragment_prog;
GLVertexProgram m_vertex_prog;
GLTexture m_gl_textures[m_textures_count];
GLTexture m_gl_vertex_textures[m_textures_count];
GLTexture m_gl_textures[rsx::limits::textures_count];
GLTexture m_gl_vertex_textures[rsx::limits::vertex_textures_count];
GLvao m_vao;
GLvbo m_vbo;
GLrbo m_rbo;
GLfbo m_fbo;
draw_context_t m_context = nullptr;
void* m_context;
//TODO: program cache
gl::glsl::program m_program;
rsx::surface_info m_surface;
public:
GSFrameBase* m_frame;
gl::fbo draw_fbo;
private:
GLProgramBuffer m_prog_buffer;
gl::texture m_draw_tex_color[rsx::limits::color_buffers_count];
gl::texture m_draw_tex_depth_stencil;
//buffer
gl::fbo m_flip_fbo;
gl::texture m_flip_tex_color;
public:
GSFrameBase* m_frame = nullptr;
u32 m_draw_frames;
u32 m_skip_frames;
bool is_intel_vendor;
GLGSRender();
virtual ~GLGSRender() override;
virtual ~GLGSRender();
private:
void EnableVertexData(bool indexed_draw = false);
void DisableVertexData();
void InitVertexData();
void InitFragmentData();
static u32 enable(u32 enable, u32 cap);
static u32 enable(u32 enable, u32 cap, u32 index);
void close() override;
void Enable(bool enable, const u32 cap);
virtual void Close() override;
bool LoadProgram();
void WriteBuffers();
void WriteDepthBuffer();
void WriteColorBuffers();
void WriteColorBufferA();
void WriteColorBufferB();
void WriteColorBufferC();
void WriteColorBufferD();
void DrawObjects();
void InitDrawBuffers();
public:
bool load_program();
void init_buffers();
void read_buffers();
void write_buffers();
protected:
virtual void OnInit() override;
virtual void OnInitThread() override;
virtual void OnExitThread() override;
virtual void OnReset() override;
virtual void Clear(u32 cmd) override;
virtual void Draw() override;
virtual void Flip() override;
void begin() override;
void end() override;
virtual void semaphorePGRAPHTextureReadRelease(u32 offset, u32 value) override;
virtual void semaphorePGRAPHBackendRelease(u32 offset, u32 value) override;
virtual void semaphorePFIFOAcquire(u32 offset, u32 value) override;
virtual void notifyProgramChange() override {}
virtual void notifyBlendStateChange() override {}
virtual void notifyDepthStencilStateChange() override {}
virtual void notifyRasterizerStateChange() override {}
void oninit() override;
void oninit_thread() override;
void onexit_thread() override;
bool domethod(u32 id, u32 arg) override;
void flip(int buffer) override;
u64 timestamp() const override;
};

View file

@ -23,25 +23,12 @@ OPENGL_PROC(PFNGLATTACHSHADERPROC, AttachShader);
OPENGL_PROC(PFNGLDETACHSHADERPROC, DetachShader);
OPENGL_PROC(PFNGLGETATTRIBLOCATIONPROC, GetAttribLocation);
OPENGL_PROC(PFNGLLINKPROGRAMPROC, LinkProgram);
//OPENGL_PROC(PFNGLBINDFRAGDATALOCATIONPROC, BindFragDataLocation);
OPENGL_PROC(PFNGLVALIDATEPROGRAMPROC, ValidateProgram);
OPENGL_PROC(PFNGLBINDFRAGDATALOCATIONPROC, BindFragDataLocation);
OPENGL_PROC(PFNGLBINDATTRIBLOCATIONPROC, BindAttribLocation);
OPENGL_PROC(PFNGLGETUNIFORMLOCATIONPROC, GetUniformLocation);
OPENGL_PROC(PFNGLGETPROGRAMIVPROC, GetProgramiv);
OPENGL_PROC(PFNGLGETPROGRAMINFOLOGPROC, GetProgramInfoLog);
OPENGL_PROC(PFNGLVERTEXATTRIB4BVPROC, VertexAttrib4bv);
OPENGL_PROC(PFNGLVERTEXATTRIB4UBVPROC, VertexAttrib4ubv);
OPENGL_PROC(PFNGLVERTEXATTRIB1SPROC, VertexAttrib1s);
OPENGL_PROC(PFNGLVERTEXATTRIB2SVPROC, VertexAttrib2sv);
OPENGL_PROC(PFNGLVERTEXATTRIB3SVPROC, VertexAttrib3sv);
OPENGL_PROC(PFNGLVERTEXATTRIB4SVPROC, VertexAttrib4sv);
OPENGL_PROC(PFNGLVERTEXATTRIB4IVPROC, VertexAttrib4iv);
OPENGL_PROC(PFNGLVERTEXATTRIB1FPROC, VertexAttrib1f);
OPENGL_PROC(PFNGLVERTEXATTRIB2FPROC, VertexAttrib2f);
OPENGL_PROC(PFNGLVERTEXATTRIB3FPROC, VertexAttrib3f);
OPENGL_PROC(PFNGLVERTEXATTRIB4FPROC, VertexAttrib4f);
OPENGL_PROC(PFNGLVERTEXATTRIB2FVPROC, VertexAttrib2fv);
OPENGL_PROC(PFNGLVERTEXATTRIB3FVPROC, VertexAttrib3fv);
OPENGL_PROC(PFNGLVERTEXATTRIB4FVPROC, VertexAttrib4fv);
OPENGL_PROC(PFNGLVERTEXATTRIBPOINTERPROC, VertexAttribPointer);
OPENGL_PROC(PFNGLENABLEVERTEXATTRIBARRAYPROC, EnableVertexAttribArray);
OPENGL_PROC(PFNGLDISABLEVERTEXATTRIBARRAYPROC, DisableVertexAttribArray);
@ -49,36 +36,106 @@ OPENGL_PROC(PFNGLGENVERTEXARRAYSPROC, GenVertexArrays);
OPENGL_PROC(PFNGLBINDVERTEXARRAYPROC, BindVertexArray);
OPENGL_PROC(PFNGLDELETEVERTEXARRAYSPROC, DeleteVertexArrays);
OPENGL_PROC(PFNGLDEPTHRANGEFPROC, DepthRangef);
OPENGL_PROC(PFNGLVERTEXATTRIB1FPROC, VertexAttrib1f);
OPENGL_PROC(PFNGLVERTEXATTRIB1DPROC, VertexAttrib1d);
OPENGL_PROC(PFNGLVERTEXATTRIB1FVPROC, VertexAttrib1fv);
OPENGL_PROC(PFNGLVERTEXATTRIB1DVPROC, VertexAttrib1dv);
OPENGL_PROC(PFNGLVERTEXATTRIB2FPROC, VertexAttrib2f);
OPENGL_PROC(PFNGLVERTEXATTRIB2DPROC, VertexAttrib2d);
OPENGL_PROC(PFNGLVERTEXATTRIB2FVPROC, VertexAttrib2fv);
OPENGL_PROC(PFNGLVERTEXATTRIB2DVPROC, VertexAttrib2dv);
OPENGL_PROC(PFNGLVERTEXATTRIB3FPROC, VertexAttrib3f);
OPENGL_PROC(PFNGLVERTEXATTRIB3DPROC, VertexAttrib3d);
OPENGL_PROC(PFNGLVERTEXATTRIB3FVPROC, VertexAttrib3fv);
OPENGL_PROC(PFNGLVERTEXATTRIB3DVPROC, VertexAttrib3dv);
OPENGL_PROC(PFNGLVERTEXATTRIB4FPROC, VertexAttrib4f);
OPENGL_PROC(PFNGLVERTEXATTRIB4DPROC, VertexAttrib4d);
OPENGL_PROC(PFNGLVERTEXATTRIB4IVPROC, VertexAttrib4iv);
OPENGL_PROC(PFNGLVERTEXATTRIB4FVPROC, VertexAttrib4fv);
OPENGL_PROC(PFNGLVERTEXATTRIB4DVPROC, VertexAttrib4dv);
OPENGL_PROC(PFNGLVERTEXATTRIB4UIVPROC, VertexAttrib4uiv);
OPENGL_PROC(PFNGLUNIFORM1IPROC, Uniform1i);
OPENGL_PROC(PFNGLUNIFORM1FPROC, Uniform1f);
OPENGL_PROC(PFNGLUNIFORM1DPROC, Uniform1d);
OPENGL_PROC(PFNGLUNIFORM1UIPROC, Uniform1ui);
OPENGL_PROC(PFNGLUNIFORM1IVPROC, Uniform1iv);
OPENGL_PROC(PFNGLUNIFORM1FVPROC, Uniform1fv);
OPENGL_PROC(PFNGLUNIFORM1DVPROC, Uniform1dv);
OPENGL_PROC(PFNGLUNIFORM1UIVPROC, Uniform1uiv);
OPENGL_PROC(PFNGLUNIFORM2IPROC, Uniform2i);
OPENGL_PROC(PFNGLUNIFORM2FPROC, Uniform2f);
OPENGL_PROC(PFNGLUNIFORM2DPROC, Uniform2d);
OPENGL_PROC(PFNGLUNIFORM2UIPROC, Uniform2ui);
OPENGL_PROC(PFNGLUNIFORM2IVPROC, Uniform2iv);
OPENGL_PROC(PFNGLUNIFORM2FVPROC, Uniform2fv);
OPENGL_PROC(PFNGLUNIFORM2DVPROC, Uniform2dv);
OPENGL_PROC(PFNGLUNIFORM2UIVPROC, Uniform2uiv);
OPENGL_PROC(PFNGLUNIFORM3IPROC, Uniform3i);
OPENGL_PROC(PFNGLUNIFORM3FPROC, Uniform3f);
OPENGL_PROC(PFNGLUNIFORM3DPROC, Uniform3d);
OPENGL_PROC(PFNGLUNIFORM3UIPROC, Uniform3ui);
OPENGL_PROC(PFNGLUNIFORM3IVPROC, Uniform3iv);
OPENGL_PROC(PFNGLUNIFORM3FVPROC, Uniform3fv);
OPENGL_PROC(PFNGLUNIFORM3DVPROC, Uniform3dv);
OPENGL_PROC(PFNGLUNIFORM3UIVPROC, Uniform3uiv);
OPENGL_PROC(PFNGLUNIFORM4FPROC, Uniform4i);
OPENGL_PROC(PFNGLUNIFORM4IPROC, Uniform4i);
OPENGL_PROC(PFNGLUNIFORM4FPROC, Uniform4f);
OPENGL_PROC(PFNGLUNIFORM4DPROC, Uniform4d);
OPENGL_PROC(PFNGLUNIFORM4UIPROC, Uniform4ui);
OPENGL_PROC(PFNGLUNIFORM4IVPROC, Uniform4iv);
OPENGL_PROC(PFNGLUNIFORM4FVPROC, Uniform4fv);
OPENGL_PROC(PFNGLUNIFORM4DVPROC, Uniform4dv);
OPENGL_PROC(PFNGLUNIFORM4UIVPROC, Uniform4uiv);
OPENGL_PROC(PFNGLUNIFORMMATRIX2FVPROC, UniformMatrix2fv);
OPENGL_PROC(PFNGLUNIFORMMATRIX2DVPROC, UniformMatrix2dv);
OPENGL_PROC(PFNGLUNIFORMMATRIX3FVPROC, UniformMatrix3fv);
OPENGL_PROC(PFNGLUNIFORMMATRIX3DVPROC, UniformMatrix3dv);
OPENGL_PROC(PFNGLUNIFORMMATRIX4FVPROC, UniformMatrix4fv);
OPENGL_PROC(PFNGLUNIFORMMATRIX4DVPROC, UniformMatrix4dv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM1IPROC, ProgramUniform1i);
OPENGL_PROC(PFNGLPROGRAMUNIFORM1FPROC, ProgramUniform1f);
OPENGL_PROC(PFNGLPROGRAMUNIFORM1DPROC, ProgramUniform1d);
OPENGL_PROC(PFNGLPROGRAMUNIFORM1UIPROC, ProgramUniform1ui);
OPENGL_PROC(PFNGLPROGRAMUNIFORM1IVPROC, ProgramUniform1iv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM1FVPROC, ProgramUniform1fv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM1DVPROC, ProgramUniform1dv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM1UIVPROC, ProgramUniform1uiv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM2IPROC, ProgramUniform2i);
OPENGL_PROC(PFNGLPROGRAMUNIFORM2FPROC, ProgramUniform2f);
OPENGL_PROC(PFNGLPROGRAMUNIFORM2DPROC, ProgramUniform2d);
OPENGL_PROC(PFNGLPROGRAMUNIFORM2UIPROC, ProgramUniform2ui);
OPENGL_PROC(PFNGLPROGRAMUNIFORM2IVPROC, ProgramUniform2iv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM2FVPROC, ProgramUniform2fv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM2DVPROC, ProgramUniform2dv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM2UIVPROC, ProgramUniform2uiv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM3IPROC, ProgramUniform3i);
OPENGL_PROC(PFNGLPROGRAMUNIFORM3FPROC, ProgramUniform3f);
OPENGL_PROC(PFNGLPROGRAMUNIFORM3DPROC, ProgramUniform3d);
OPENGL_PROC(PFNGLPROGRAMUNIFORM3UIPROC, ProgramUniform3ui);
OPENGL_PROC(PFNGLPROGRAMUNIFORM3IVPROC, ProgramUniform3iv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM3FVPROC, ProgramUniform3fv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM3DVPROC, ProgramUniform3dv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM3UIVPROC, ProgramUniform3uiv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM4IPROC, ProgramUniform4i);
OPENGL_PROC(PFNGLPROGRAMUNIFORM4FPROC, ProgramUniform4f);
OPENGL_PROC(PFNGLUNIFORMMATRIX4FVPROC, UniformMatrix4fv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM4DPROC, ProgramUniform4d);
OPENGL_PROC(PFNGLPROGRAMUNIFORM4UIPROC, ProgramUniform4ui);
OPENGL_PROC(PFNGLPROGRAMUNIFORM4IVPROC, ProgramUniform4iv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM4FVPROC, ProgramUniform4fv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM4DVPROC, ProgramUniform4dv);
OPENGL_PROC(PFNGLPROGRAMUNIFORM4UIVPROC, ProgramUniform4uiv);
OPENGL_PROC(PFNGLPROGRAMUNIFORMMATRIX2FVPROC, ProgramUniformMatrix2fv);
OPENGL_PROC(PFNGLPROGRAMUNIFORMMATRIX2DVPROC, ProgramUniformMatrix2dv);
OPENGL_PROC(PFNGLPROGRAMUNIFORMMATRIX3FVPROC, ProgramUniformMatrix3fv);
OPENGL_PROC(PFNGLPROGRAMUNIFORMMATRIX3DVPROC, ProgramUniformMatrix3dv);
OPENGL_PROC(PFNGLPROGRAMUNIFORMMATRIX4FVPROC, ProgramUniformMatrix4fv);
OPENGL_PROC(PFNGLPROGRAMUNIFORMMATRIX4DVPROC, ProgramUniformMatrix4dv);
OPENGL_PROC(PFNGLUSEPROGRAMPROC, UseProgram);
OPENGL_PROC2(PFNGLDEPTHBOUNDSEXTPROC, DepthBoundsEXT, glDepthBoundsEXT);
OPENGL_PROC(PFNGLDEPTHBOUNDSEXTPROC, DepthBoundsEXT);
OPENGL_PROC(PFNGLSTENCILOPSEPARATEPROC, StencilOpSeparate);
OPENGL_PROC(PFNGLSTENCILFUNCSEPARATEPROC, StencilFuncSeparate);
OPENGL_PROC(PFNGLSTENCILMASKSEPARATEPROC, StencilMaskSeparate);
@ -96,13 +153,25 @@ OPENGL_PROC(PFNGLFRAMEBUFFERTEXTURE3DPROC, FramebufferTexture3D);
OPENGL_PROC(PFNGLFRAMEBUFFERRENDERBUFFERPROC, FramebufferRenderbuffer);
OPENGL_PROC(PFNGLBLITFRAMEBUFFERPROC, BlitFramebuffer);
OPENGL_PROC(PFNGLDRAWBUFFERSPROC, DrawBuffers);
OPENGL_PROC(PFNGLENABLEIPROC, Enablei);
OPENGL_PROC(PFNGLDISABLEIPROC, Disablei);
OPENGL_PROC(PFNGLPRIMITIVERESTARTINDEXPROC, PrimitiveRestartIndex);
OPENGL_PROC(PFNGLGETINTEGER64VPROC, GetInteger64v);
OPENGL_PROC(PFNGLCHECKFRAMEBUFFERSTATUSPROC, CheckFramebufferStatus);
//KHR_debug
OPENGL_PROC(PFNGLDEBUGMESSAGECONTROLARBPROC, DebugMessageControlARB);
OPENGL_PROC(PFNGLDEBUGMESSAGEINSERTARBPROC, DebugMessageInsertARB);
OPENGL_PROC(PFNGLDEBUGMESSAGECALLBACKARBPROC, DebugMessageCallbackARB);
//...
#ifndef __GNUG__
OPENGL_PROC(PFNGLBLENDCOLORPROC, BlendColor);
OPENGL_PROC(PFNGLBLENDEQUATIONPROC, BlendEquation);
OPENGL_PROC(PFNGLCOMPRESSEDTEXIMAGE2DPROC, CompressedTexImage2D);
OPENGL_PROC(PFNGLACTIVETEXTUREPROC, ActiveTexture);
OPENGL_PROC2(PFNWGLSWAPINTERVALEXTPROC, SwapInterval, wglSwapIntervalEXT);
#endif

View file

@ -3,7 +3,7 @@
#include "Emu/Memory/Memory.h"
#include "GLProgram.h"
#include "GLGSRender.h"
/*
GLProgram::GLProgram() : id(0)
{
}
@ -116,3 +116,4 @@ void GLProgram::Delete()
id = 0;
m_locations.clear();
}
*/

View file

@ -1,7 +1,8 @@
#pragma once
#include "GLVertexProgram.h"
#include "GLFragmentProgram.h"
/*
struct GLProgram
{
private:
@ -27,3 +28,4 @@ public:
void SetVTex(u32 index);
void Delete();
};
*/

View file

@ -7,7 +7,7 @@ struct GLTraits
{
typedef GLVertexProgram VertexProgramData;
typedef GLFragmentProgram FragmentProgramData;
typedef GLProgram PipelineData;
typedef gl::glsl::program PipelineData;
typedef void* PipelineProperties;
typedef void* ExtraData;
@ -36,12 +36,14 @@ struct GLTraits
static
PipelineData *BuildProgram(VertexProgramData &vertexProgramData, FragmentProgramData &fragmentProgramData, const PipelineProperties &pipelineProperties, const ExtraData& extraData)
{
GLProgram *result = new GLProgram();
result->Create(vertexProgramData.id, fragmentProgramData.id);
//checkForGlError("m_program.Create");
result->Use();
PipelineData *result = new PipelineData();
__glcheck result->create()
.attach(gl::glsl::shader_view(vertexProgramData.id))
.attach(gl::glsl::shader_view(fragmentProgramData.id))
.make();
__glcheck result->use();
LOG_NOTICE(RSX, "*** prog id = %d", result->id);
LOG_NOTICE(RSX, "*** prog id = %d", result->id());
LOG_NOTICE(RSX, "*** vp id = %d", vertexProgramData.id);
LOG_NOTICE(RSX, "*** fp id = %d", fragmentProgramData.id);
@ -54,7 +56,7 @@ struct GLTraits
static
void DeleteProgram(PipelineData *ptr)
{
ptr->Delete();
ptr->remove();
}
};

View file

@ -2,7 +2,7 @@
#include "Utilities/Log.h"
#include "OpenGL.h"
void InitProcTable()
void gl::init()
{
#ifdef _WIN32
#define OPENGL_PROC(p, n) OPENGL_PROC2(p, n, gl##n)

View file

@ -25,7 +25,10 @@ typedef BOOL (WINAPI* PFNWGLSWAPINTERVALEXTPROC) (int interval);
#include <GL/glxext.h>
#endif
void InitProcTable();
namespace gl
{
void init();
}
struct OpenGL
{

View file

@ -0,0 +1,469 @@
#include "stdafx.h"
#include "gl_helpers.h"
namespace gl
{
const fbo screen{};
void fbo::create()
{
glGenFramebuffers(1, &m_id);
}
void fbo::bind() const
{
glBindFramebuffer(GL_FRAMEBUFFER, m_id);
}
void fbo::blit(const fbo& dst, areai src_area, areai dst_area, buffers buffers_, filter filter_) const
{
bind_as(target::read_frame_buffer);
dst.bind_as(target::draw_frame_buffer);
glBlitFramebuffer(
src_area.x1, src_area.y1, src_area.x2, src_area.y2,
dst_area.x1, dst_area.y1, dst_area.x2, dst_area.y2,
(GLbitfield)buffers_, (GLenum)filter_);
}
void fbo::bind_as(target target_) const
{
glBindFramebuffer((int)target_, id());
}
void fbo::remove()
{
glDeleteFramebuffers(1, &m_id);
m_id = 0;
}
bool fbo::created() const
{
return m_id != 0;
}
void fbo::check() const
{
save_binding_state save(*this);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE)
{
throw std::logic_error(fmt::format("0x%04x", status));
}
}
void fbo::recreate()
{
if (created())
remove();
create();
}
void fbo::draw_buffer(const attachment& buffer) const
{
save_binding_state save(*this);
GLenum buf = buffer.id();
glDrawBuffers(1, &buf);
}
void fbo::draw_buffers(const std::initializer_list<attachment>& indexes) const
{
save_binding_state save(*this);
std::vector<GLenum> ids;
for (auto &index : indexes)
ids.push_back(index.id());
glDrawBuffers((GLsizei)ids.size(), ids.data());
}
void fbo::draw_arrays(draw_mode mode, GLsizei count, GLint first) const
{
save_binding_state save(*this);
__glcheck glDrawArrays((GLenum)mode, first, count);
}
void fbo::draw_arrays(const buffer& buffer, draw_mode mode, GLsizei count, GLint first) const
{
buffer.bind(buffer::target::array);
draw_arrays(mode, count, first);
}
void fbo::draw_arrays(const vao& buffer, draw_mode mode, GLsizei count, GLint first) const
{
buffer.bind();
draw_arrays(mode, count, first);
}
void fbo::draw_elements(draw_mode mode, GLsizei count, indices_type type, const GLvoid *indices) const
{
save_binding_state save(*this);
glDrawElements((GLenum)mode, count, (GLenum)type, indices);
}
void fbo::draw_elements(const buffer& buffer, draw_mode mode, GLsizei count, indices_type type, const GLvoid *indices) const
{
buffer.bind(buffer::target::array);
glDrawElements((GLenum)mode, count, (GLenum)type, indices);
}
void fbo::draw_elements(draw_mode mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
{
indices.bind(buffer::target::element_array);
glDrawElements((GLenum)mode, count, (GLenum)type, (GLvoid*)indices_buffer_offset);
}
void fbo::draw_elements(const buffer& buffer_, draw_mode mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
{
buffer_.bind(buffer::target::array);
draw_elements(mode, count, type, indices, indices_buffer_offset);
}
void fbo::draw_elements(draw_mode mode, GLsizei count, const GLubyte *indices) const
{
draw_elements(mode, count, indices_type::ubyte, indices);
}
void fbo::draw_elements(const buffer& buffer, draw_mode mode, GLsizei count, const GLubyte *indices) const
{
draw_elements(buffer, mode, count, indices_type::ubyte, indices);
}
void fbo::draw_elements(draw_mode mode, GLsizei count, const GLushort *indices) const
{
draw_elements(mode, count, indices_type::ushort, indices);
}
void fbo::draw_elements(const buffer& buffer, draw_mode mode, GLsizei count, const GLushort *indices) const
{
draw_elements(buffer, mode, count, indices_type::ushort, indices);
}
void fbo::draw_elements(draw_mode mode, GLsizei count, const GLuint *indices) const
{
draw_elements(mode, count, indices_type::uint, indices);
}
void fbo::draw_elements(const buffer& buffer, draw_mode mode, GLsizei count, const GLuint *indices) const
{
draw_elements(buffer, mode, count, indices_type::uint, indices);
}
void fbo::clear(buffers buffers_) const
{
save_binding_state save(*this);
glClear((GLbitfield)buffers_);
}
void fbo::clear(buffers buffers_, color4f color_value, double depth_value, u8 stencil_value) const
{
save_binding_state save(*this);
glClearColor(color_value.r, color_value.g, color_value.b, color_value.a);
glClearDepth(depth_value);
glClearStencil(stencil_value);
clear(buffers_);
}
void fbo::copy_from(const void* pixels, sizei size, gl::texture::format format_, gl::texture::type type_, class pixel_unpack_settings pixel_settings) const
{
save_binding_state save(*this);
pixel_settings.apply();
glDrawPixels(size.width, size.height, (GLenum)format_, (GLenum)type_, pixels);
}
void fbo::copy_from(const buffer& buf, sizei size, gl::texture::format format_, gl::texture::type type_, class pixel_unpack_settings pixel_settings) const
{
save_binding_state save(*this);
buffer::save_binding_state save_buffer(buffer::target::pixel_unpack, buf);
pixel_settings.apply();
glDrawPixels(size.width, size.height, (GLenum)format_, (GLenum)type_, nullptr);
}
void fbo::copy_to(void* pixels, coordi coord, gl::texture::format format_, gl::texture::type type_, class pixel_pack_settings pixel_settings) const
{
save_binding_state save(*this);
pixel_settings.apply();
glReadPixels(coord.x, coord.y, coord.width, coord.height, (GLenum)format_, (GLenum)type_, pixels);
}
void fbo::copy_to(const buffer& buf, coordi coord, gl::texture::format format_, gl::texture::type type_, class pixel_pack_settings pixel_settings) const
{
save_binding_state save(*this);
buffer::save_binding_state save_buffer(buffer::target::pixel_pack, buf);
pixel_settings.apply();
glReadPixels(coord.x, coord.y, coord.width, coord.height, (GLenum)format_, (GLenum)type_, nullptr);
}
fbo fbo::get_binded_draw_buffer()
{
GLint value;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &value);
return{ (GLuint)value };
}
fbo fbo::get_binded_read_buffer()
{
GLint value;
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &value);
return{ (GLuint)value };
}
fbo fbo::get_binded_buffer()
{
GLint value;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &value);
return{ (GLuint)value };
}
GLuint fbo::id() const
{
return m_id;
}
void fbo::set_id(GLuint id)
{
m_id = id;
}
void texture::settings::apply(const texture &texture) const
{
save_binding_state save(texture);
texture.pixel_unpack_settings().apply();
if (compressed_format(m_internal_format))
{
int compressed_image_size = m_compressed_image_size;
if (!compressed_image_size)
{
switch (m_internal_format)
{
case texture::internal_format::compressed_rgb_s3tc_dxt1:
compressed_image_size = ((m_width + 2) / 3) * ((m_height + 2) / 3) * 6;
break;
case texture::internal_format::compressed_rgba_s3tc_dxt1:
compressed_image_size = ((m_width + 3) / 4) * ((m_height + 3) / 4) * 8;
break;
case texture::internal_format::compressed_rgba_s3tc_dxt3:
case texture::internal_format::compressed_rgba_s3tc_dxt5:
compressed_image_size = ((m_width + 3) / 4) * ((m_height + 3) / 4) * 16;
break;
}
}
__glcheck glCompressedTexImage2D((GLenum)m_parent->get_target(), m_level, (GLint)m_internal_format, m_width, m_height, 0, compressed_image_size, m_pixels);
}
else
{
__glcheck glTexImage2D((GLenum)m_parent->get_target(), m_level, (GLint)m_internal_format, m_width, m_height, 0, (GLint)m_format, (GLint)m_type, m_pixels);
}
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_TEXTURE_MAX_LEVEL, m_max_level);
if (m_pixels)
{
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_GENERATE_MIPMAP, m_generate_mipmap ? GL_TRUE : GL_FALSE);
}
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_TEXTURE_WRAP_S, (GLint)m_wrap_s);
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_TEXTURE_WRAP_T, (GLint)m_wrap_t);
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_TEXTURE_WRAP_R, (GLint)m_wrap_r);
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_TEXTURE_COMPARE_MODE, (GLint)m_compare_mode);
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_TEXTURE_COMPARE_FUNC, (GLint)m_compare_func);
__glcheck glTexParameterf((GLenum)m_parent->get_target(), GL_TEXTURE_MIN_LOD, m_max_lod);
__glcheck glTexParameterf((GLenum)m_parent->get_target(), GL_TEXTURE_MAX_LOD, m_min_lod);
__glcheck glTexParameterf((GLenum)m_parent->get_target(), GL_TEXTURE_LOD_BIAS, m_lod);
__glcheck glTexParameterfv((GLenum)m_parent->get_target(), GL_TEXTURE_BORDER_COLOR, m_border_color.rgba);
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_TEXTURE_MIN_FILTER, (GLint)m_min_filter);
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_TEXTURE_MAG_FILTER, (GLint)m_mag_filter);
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_TEXTURE_SWIZZLE_R, (GLint)m_swizzle_r);
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_TEXTURE_SWIZZLE_G, (GLint)m_swizzle_g);
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_TEXTURE_SWIZZLE_B, (GLint)m_swizzle_b);
__glcheck glTexParameteri((GLenum)m_parent->get_target(), GL_TEXTURE_SWIZZLE_A, (GLint)m_swizzle_a);
__glcheck glTexParameterf((GLenum)m_parent->get_target(), GL_TEXTURE_MAX_ANISOTROPY_EXT, m_aniso);
}
void texture::settings::apply()
{
if (m_parent)
{
apply(*m_parent);
m_parent = nullptr;
}
}
texture::settings& texture::settings::swizzle(texture::channel r, texture::channel g, texture::channel b, texture::channel a)
{
m_swizzle_r = r;
m_swizzle_g = g;
m_swizzle_b = b;
m_swizzle_a = a;
return *this;
}
texture::settings& texture::settings::format(texture::format format)
{
m_format = format;
return *this;
}
texture::settings& texture::settings::type(texture::type type)
{
m_type = type;
return *this;
}
texture::settings& texture::settings::internal_format(texture::internal_format format)
{
m_internal_format = format;
return *this;
}
texture::settings& texture::settings::filter(min_filter min_filter, gl::filter mag_filter)
{
m_min_filter = min_filter;
m_mag_filter = mag_filter;
return *this;
}
texture::settings& texture::settings::width(uint width)
{
m_width = width;
return *this;
}
texture::settings& texture::settings::height(uint height)
{
m_height = height;
return *this;
}
texture::settings& texture::settings::size(sizei size)
{
return width(size.width).height(size.height);
}
texture::settings& texture::settings::level(int value)
{
m_level = value;
return *this;
}
texture::settings& texture::settings::compressed_image_size(int size)
{
m_compressed_image_size = size;
return *this;
}
texture::settings& texture::settings::pixels(const void* pixels)
{
m_pixels = pixels;
return *this;
}
texture::settings& texture::settings::aniso(float value)
{
m_aniso = value;
return *this;
}
texture::settings& texture::settings::compare_mode(texture::compare_mode value)
{
m_compare_mode = value;
return *this;
}
texture::settings& texture::settings::compare_func(texture::compare_func value)
{
m_compare_func = value;
return *this;
}
texture::settings& texture::settings::compare(texture::compare_func func, texture::compare_mode mode)
{
return compare_func(func).compare_mode(mode);
}
texture::settings& texture::settings::wrap_s(texture::wrap value)
{
m_wrap_s = value;
return *this;
}
texture::settings& texture::settings::wrap_t(texture::wrap value)
{
m_wrap_t = value;
return *this;
}
texture::settings& texture::settings::wrap_r(texture::wrap value)
{
m_wrap_r = value;
return *this;
}
texture::settings& texture::settings::wrap(texture::wrap s, texture::wrap t, texture::wrap r)
{
return wrap_s(s).wrap_t(t).wrap_r(r);
}
texture::settings& texture::settings::max_lod(float value)
{
m_max_lod = value;
return *this;
}
texture::settings& texture::settings::min_lod(float value)
{
m_min_lod = value;
return *this;
}
texture::settings& texture::settings::lod(float value)
{
m_lod = value;
return *this;
}
texture::settings& texture::settings::max_level(int value)
{
m_max_level = value;
return *this;
}
texture::settings& texture::settings::generate_mipmap(bool value)
{
m_generate_mipmap = value;
return *this;
}
texture::settings& texture::settings::mipmap(int level, int max_level, float lod, float min_lod, float max_lod, bool generate)
{
return this->level(level).max_level(max_level).lod(lod).min_lod(min_lod).max_lod(max_lod).generate_mipmap(generate);
}
texture::settings& texture::settings::border_color(color4f value)
{
m_border_color = value;
return *this;
}
texture_view texture::with_level(int level)
{
return{ get_target(), id() };
}
texture::settings texture::config()
{
return{ this };
}
void texture::config(const settings& settings_)
{
settings_.apply(*this);
}
}

File diff suppressed because it is too large Load diff

View file

@ -48,7 +48,7 @@ void GSManager::Close()
{
if(m_render)
{
m_render->Close();
m_render->close();
delete m_render;
m_render = nullptr;
}

View file

@ -5,26 +5,8 @@
#include "GSManager.h"
#include "GSRender.h"
GSLock::GSLock(GSRender& renderer, GSLockType type)
: m_renderer(renderer)
, m_type(type)
{
switch (m_type)
{
case GS_LOCK_NOT_WAIT: m_renderer.m_cs_main.lock(); break;
case GS_LOCK_WAIT_FLIP: m_renderer.m_sem_flip.wait(); break;
}
}
GSLock::~GSLock()
{
switch (m_type)
{
case GS_LOCK_NOT_WAIT: m_renderer.m_cs_main.unlock(); break;
case GS_LOCK_WAIT_FLIP: m_renderer.m_sem_flip.try_post(); break;
}
}
GSLockCurrent::GSLockCurrent(GSLockType type) : GSLock(Emu.GetGSManager().GetRender(), type)
draw_context_t GSFrameBase::new_context()
{
return std::shared_ptr<void>(make_context(), [this](void* ctxt) { delete_context(ctxt); });
}

View file

@ -1,34 +1,33 @@
#pragma once
#include "Emu/RSX/RSXThread.h"
#include <memory>
struct GSRender : public RSXThread
using draw_context_t = std::shared_ptr<void>;
class GSFrameBase
{
virtual ~GSRender() override
{
}
virtual void Close()=0;
};
enum GSLockType
{
GS_LOCK_NOT_WAIT,
GS_LOCK_WAIT_FLIP,
};
struct GSLock
{
private:
GSRender& m_renderer;
GSLockType m_type;
public:
GSLock(GSRender& renderer, GSLockType type);
GSFrameBase() = default;
GSFrameBase(const GSFrameBase&) = delete;
~GSLock();
virtual void close() = 0;
virtual bool shown() = 0;
virtual void hide() = 0;
virtual void show() = 0;
draw_context_t new_context();
virtual void set_current(draw_context_t ctx) = 0;
virtual void flip(draw_context_t ctx) = 0;
virtual size2i client_size() = 0;
protected:
virtual void delete_context(void* ctx) = 0;
virtual void* make_context() = 0;
};
struct GSLockCurrent : GSLock
struct GSRender : public rsx::thread
{
GSLockCurrent(GSLockType type);
};
virtual ~GSRender() = default;
virtual void close()=0;
};

View file

@ -3,67 +3,29 @@
class NullGSRender final : public GSRender
{
public:
NullGSRender()
{
}
virtual ~NullGSRender() override
{
}
private:
virtual void OnInit() override
void oninit() override
{
}
virtual void OnInitThread() override
void oninit_thread() override
{
}
virtual void OnExitThread() override
void onexit_thread() override
{
}
virtual void OnReset() override
bool domethod(u32 cmd, u32 value) override
{
return false;
}
void flip(int buffer) override
{
}
virtual void Clear(u32 cmd) override
void close() override
{
}
virtual void Draw() override
{
}
virtual void Flip() override
{
}
virtual void Close() override
{
if (joinable())
{
join();
}
}
virtual void semaphorePGRAPHTextureReadRelease(u32 offset, u32 value) override
{
}
virtual void semaphorePGRAPHBackendRelease(u32 offset, u32 value) override
{
}
virtual void semaphorePFIFOAcquire(u32 offset, u32 value) override
{
}
virtual void notifyProgramChange() override {}
virtual void notifyBlendStateChange() override {}
virtual void notifyDepthStencilStateChange() override {}
virtual void notifyRasterizerStateChange() override {}
};

View file

@ -3,413 +3,416 @@
#include "RSXThread.h"
#include "RSXTexture.h"
RSXTexture::RSXTexture()
{
m_index = 0;
}
RSXTexture::RSXTexture(u8 index)
{
m_index = index;
}
void RSXTexture::Init()
{
// Offset
methodRegisters[NV4097_SET_TEXTURE_OFFSET + (m_index*32)] = 0;
// Format
methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] = 0;
// Address
methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] =
((/*wraps*/1) | ((/*anisoBias*/0) << 4) | ((/*wrapt*/1) << 8) | ((/*unsignedRemap*/0) << 12) |
((/*wrapr*/3) << 16) | ((/*gamma*/0) << 20) |((/*signedRemap*/0) << 24) | ((/*zfunc*/0) << 28));
// Control0
methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] =
(((/*alphakill*/0) << 2) | (/*maxaniso*/0) << 4) | ((/*maxlod*/0xc00) << 7) | ((/*minlod*/0) << 19) | ((/*enable*/0) << 31);
// Control1
methodRegisters[NV4097_SET_TEXTURE_CONTROL1 + (m_index*32)] = 0xE4;
// Filter
methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] =
((/*bias*/0) | ((/*conv*/1) << 13) | ((/*min*/5) << 16) | ((/*mag*/2) << 24)
| ((/*as*/0) << 28) | ((/*rs*/0) << 29) | ((/*gs*/0) << 30) | ((/*bs*/0) << 31) );
// Image Rect
methodRegisters[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index*32)] = (/*height*/1) | ((/*width*/1) << 16);
// Border Color
methodRegisters[NV4097_SET_TEXTURE_BORDER_COLOR + (m_index*32)] = 0;
}
u32 RSXTexture::GetOffset() const
{
return methodRegisters[NV4097_SET_TEXTURE_OFFSET + (m_index*32)];
}
u8 RSXTexture::GetLocation() const
{
return (methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] & 0x3) - 1;
}
bool RSXTexture::isCubemap() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] >> 2) & 0x1);
}
u8 RSXTexture::GetBorderType() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] >> 3) & 0x1);
}
u8 RSXTexture::GetDimension() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] >> 4) & 0xf);
}
u8 RSXTexture::GetFormat() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] >> 8) & 0xff);
}
u16 RSXTexture::GetMipmap() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FORMAT + (m_index*32)] >> 16) & 0xffff);
}
u8 RSXTexture::GetWrapS() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)]) & 0xf);
}
u8 RSXTexture::GetWrapT() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 8) & 0xf);
}
u8 RSXTexture::GetWrapR() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 16) & 0xf);
}
u8 RSXTexture::GetUnsignedRemap() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 12) & 0xf);
}
u8 RSXTexture::GetZfunc() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 28) & 0xf);
}
u8 RSXTexture::GetGamma() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 20) & 0xf);
}
u8 RSXTexture::GetAnisoBias() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 4) & 0xf);
}
u8 RSXTexture::GetSignedRemap() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_ADDRESS + (m_index*32)] >> 24) & 0xf);
}
bool RSXTexture::IsEnabled() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] >> 31) & 0x1);
}
u16 RSXTexture::GetMinLOD() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] >> 19) & 0xfff);
}
u16 RSXTexture::GetMaxLOD() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] >> 7) & 0xfff);
}
u8 RSXTexture::GetMaxAniso() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] >> 4) & 0x7);
}
bool RSXTexture::IsAlphaKillEnabled() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_CONTROL0 + (m_index*32)] >> 2) & 0x1);
}
u32 RSXTexture::GetRemap() const
{
return (methodRegisters[NV4097_SET_TEXTURE_CONTROL1 + (m_index*32)]);
}
u16 RSXTexture::GetBias() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)]) & 0x1fff);
}
u8 RSXTexture::GetMinFilter() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 16) & 0x7);
}
u8 RSXTexture::GetMagFilter() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 24) & 0x7);
}
u8 RSXTexture::GetConvolutionFilter() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 13) & 0xf);
}
bool RSXTexture::isASigned() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 28) & 0x1);
}
bool RSXTexture::isRSigned() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 29) & 0x1);
}
bool RSXTexture::isGSigned() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 30) & 0x1);
}
bool RSXTexture::isBSigned() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_FILTER + (m_index*32)] >> 31) & 0x1);
}
u16 RSXTexture::GetWidth() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index*32)] >> 16) & 0xffff);
}
u16 RSXTexture::GetHeight() const
{
return ((methodRegisters[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index*32)]) & 0xffff);
}
u32 RSXTexture::GetBorderColor() const
{
return methodRegisters[NV4097_SET_TEXTURE_BORDER_COLOR + (m_index*32)];
}
void RSXTexture::SetControl3(u16 depth, u32 pitch)
{
m_depth = depth;
m_pitch = pitch;
}
RSXVertexTexture::RSXVertexTexture() : RSXTexture()
{
}
RSXVertexTexture::RSXVertexTexture(u8 index) : RSXTexture(index)
{
}
void RSXVertexTexture::Init()
{
// Offset
methodRegisters[NV4097_SET_VERTEX_TEXTURE_OFFSET + (m_index * 32)] = 0;
// Format
methodRegisters[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 32)] = 0;
// Address
methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)] =
((/*wraps*/1) | ((/*anisoBias*/0) << 4) | ((/*wrapt*/1) << 8) | ((/*unsignedRemap*/0) << 12) |
((/*wrapr*/3) << 16) | ((/*gamma*/0) << 20) | ((/*signedRemap*/0) << 24) | ((/*zfunc*/0) << 28));
// Control0
methodRegisters[NV4097_SET_VERTEX_TEXTURE_CONTROL0 + (m_index * 32)] =
(((/*alphakill*/0) << 2) | (/*maxaniso*/0) << 4) | ((/*maxlod*/0xc00) << 7) | ((/*minlod*/0) << 19) | ((/*enable*/0) << 31);
// Control1
//methodRegisters[NV4097_SET_VERTEX_TEXTURE_CONTROL1 + (m_index * 32)] = 0xE4;
// Filter
methodRegisters[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 32)] =
((/*bias*/0) | ((/*conv*/1) << 13) | ((/*min*/5) << 16) | ((/*mag*/2) << 24)
| ((/*as*/0) << 28) | ((/*rs*/0) << 29) | ((/*gs*/0) << 30) | ((/*bs*/0) << 31));
// Image Rect
methodRegisters[NV4097_SET_VERTEX_TEXTURE_IMAGE_RECT + (m_index * 32)] = (/*height*/1) | ((/*width*/1) << 16);
// Border Color
methodRegisters[NV4097_SET_VERTEX_TEXTURE_BORDER_COLOR + (m_index * 32)] = 0;
}
u32 RSXVertexTexture::GetOffset() const
{
return methodRegisters[NV4097_SET_VERTEX_TEXTURE_OFFSET + (m_index * 32)];
}
u8 RSXVertexTexture::GetLocation() const
{
return (methodRegisters[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 32)] & 0x3) - 1;
}
bool RSXVertexTexture::isCubemap() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 32)] >> 2) & 0x1);
}
u8 RSXVertexTexture::GetBorderType() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 32)] >> 3) & 0x1);
}
u8 RSXVertexTexture::GetDimension() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 32)] >> 4) & 0xf);
}
u8 RSXVertexTexture::GetFormat() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 32)] >> 8) & 0xff);
}
u16 RSXVertexTexture::GetMipmap() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 32)] >> 16) & 0xffff);
}
u8 RSXVertexTexture::GetWrapS() const
{
return 1;
//return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)]) & 0xf);
}
u8 RSXVertexTexture::GetWrapT() const
{
return 1;
//return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)] >> 8) & 0xf);
}
u8 RSXVertexTexture::GetWrapR() const
{
return 1;
//return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)] >> 16) & 0xf);
}
u8 RSXVertexTexture::GetUnsignedRemap() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)] >> 12) & 0xf);
}
u8 RSXVertexTexture::GetZfunc() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)] >> 28) & 0xf);
}
u8 RSXVertexTexture::GetGamma() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)] >> 20) & 0xf);
}
u8 RSXVertexTexture::GetAnisoBias() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)] >> 4) & 0xf);
}
u8 RSXVertexTexture::GetSignedRemap() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 32)] >> 24) & 0xf);
}
bool RSXVertexTexture::IsEnabled() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_CONTROL0 + (m_index * 32)] >> 31) & 0x1);
}
u16 RSXVertexTexture::GetMinLOD() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_CONTROL0 + (m_index * 32)] >> 19) & 0xfff);
}
u16 RSXVertexTexture::GetMaxLOD() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_CONTROL0 + (m_index * 32)] >> 7) & 0xfff);
}
u8 RSXVertexTexture::GetMaxAniso() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_CONTROL0 + (m_index * 32)] >> 4) & 0x7);
}
bool RSXVertexTexture::IsAlphaKillEnabled() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_CONTROL0 + (m_index * 32)] >> 2) & 0x1);
}
u32 RSXVertexTexture::GetRemap() const
{
return 0 | (1 << 2) | (2 << 4) | (3 << 6);//(methodRegisters[NV4097_SET_VERTEX_TEXTURE_CONTROL1 + (m_index * 32)]);
}
u16 RSXVertexTexture::GetBias() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 32)]) & 0x1fff);
}
u8 RSXVertexTexture::GetMinFilter() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 32)] >> 16) & 0x7);
}
u8 RSXVertexTexture::GetMagFilter() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 32)] >> 24) & 0x7);
}
u8 RSXVertexTexture::GetConvolutionFilter() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 32)] >> 13) & 0xf);
}
bool RSXVertexTexture::isASigned() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 32)] >> 28) & 0x1);
}
bool RSXVertexTexture::isRSigned() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 32)] >> 29) & 0x1);
}
bool RSXVertexTexture::isGSigned() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 32)] >> 30) & 0x1);
}
bool RSXVertexTexture::isBSigned() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 32)] >> 31) & 0x1);
}
u16 RSXVertexTexture::GetWidth() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_IMAGE_RECT + (m_index * 32)] >> 16) & 0xffff);
}
u16 RSXVertexTexture::GetHeight() const
{
return ((methodRegisters[NV4097_SET_VERTEX_TEXTURE_IMAGE_RECT + (m_index * 32)]) & 0xffff);
}
u32 RSXVertexTexture::GetBorderColor() const
{
return methodRegisters[NV4097_SET_VERTEX_TEXTURE_BORDER_COLOR + (m_index * 32)];
namespace rsx
{
void texture::init(u8 index)
{
m_index = index;
// Offset
method_registers[NV4097_SET_TEXTURE_OFFSET + (m_index * 8)] = 0;
// Format
method_registers[NV4097_SET_TEXTURE_FORMAT + (m_index * 8)] = 0;
// Address
method_registers[NV4097_SET_TEXTURE_ADDRESS + (m_index * 8)] =
((/*wraps*/1) | ((/*anisoBias*/0) << 4) | ((/*wrapt*/1) << 8) | ((/*unsignedRemap*/0) << 12) |
((/*wrapr*/3) << 16) | ((/*gamma*/0) << 20) | ((/*signedRemap*/0) << 24) | ((/*zfunc*/0) << 28));
// Control0
method_registers[NV4097_SET_TEXTURE_CONTROL0 + (m_index * 8)] =
(((/*alphakill*/0) << 2) | (/*maxaniso*/0) << 4) | ((/*maxlod*/0xc00) << 7) | ((/*minlod*/0) << 19) | ((/*enable*/0) << 31);
// Control1
method_registers[NV4097_SET_TEXTURE_CONTROL1 + (m_index * 8)] = 0xE4;
// Filter
method_registers[NV4097_SET_TEXTURE_FILTER + (m_index * 8)] =
((/*bias*/0) | ((/*conv*/1) << 13) | ((/*min*/5) << 16) | ((/*mag*/2) << 24)
| ((/*as*/0) << 28) | ((/*rs*/0) << 29) | ((/*gs*/0) << 30) | ((/*bs*/0) << 31));
// Image Rect
method_registers[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index * 8)] = (/*height*/1) | ((/*width*/1) << 16);
// Border Color
method_registers[NV4097_SET_TEXTURE_BORDER_COLOR + (m_index * 8)] = 0;
}
u32 texture::offset() const
{
return method_registers[NV4097_SET_TEXTURE_OFFSET + (m_index * 8)];
}
u8 texture::location() const
{
return (method_registers[NV4097_SET_TEXTURE_FORMAT + (m_index * 8)] & 0x3) - 1;
}
bool texture::cubemap() const
{
return ((method_registers[NV4097_SET_TEXTURE_FORMAT + (m_index * 8)] >> 2) & 0x1);
}
u8 texture::border_type() const
{
return ((method_registers[NV4097_SET_TEXTURE_FORMAT + (m_index * 8)] >> 3) & 0x1);
}
u8 texture::dimension() const
{
return ((method_registers[NV4097_SET_TEXTURE_FORMAT + (m_index * 8)] >> 4) & 0xf);
}
u8 texture::format() const
{
return ((method_registers[NV4097_SET_TEXTURE_FORMAT + (m_index * 8)] >> 8) & 0xff);
}
u16 texture::mipmap() const
{
return ((method_registers[NV4097_SET_TEXTURE_FORMAT + (m_index * 8)] >> 16) & 0xffff);
}
u8 texture::wrap_s() const
{
return ((method_registers[NV4097_SET_TEXTURE_ADDRESS + (m_index * 8)]) & 0xf);
}
u8 texture::wrap_t() const
{
return ((method_registers[NV4097_SET_TEXTURE_ADDRESS + (m_index * 8)] >> 8) & 0xf);
}
u8 texture::wrap_r() const
{
return ((method_registers[NV4097_SET_TEXTURE_ADDRESS + (m_index * 8)] >> 16) & 0xf);
}
u8 texture::unsigned_remap() const
{
return ((method_registers[NV4097_SET_TEXTURE_ADDRESS + (m_index * 8)] >> 12) & 0xf);
}
u8 texture::zfunc() const
{
return ((method_registers[NV4097_SET_TEXTURE_ADDRESS + (m_index * 8)] >> 28) & 0xf);
}
u8 texture::gamma() const
{
return ((method_registers[NV4097_SET_TEXTURE_ADDRESS + (m_index * 8)] >> 20) & 0xf);
}
u8 texture::aniso_bias() const
{
return ((method_registers[NV4097_SET_TEXTURE_ADDRESS + (m_index * 8)] >> 4) & 0xf);
}
u8 texture::signed_remap() const
{
return ((method_registers[NV4097_SET_TEXTURE_ADDRESS + (m_index * 8)] >> 24) & 0xf);
}
bool texture::enabled() const
{
return location() <= 1 && ((method_registers[NV4097_SET_TEXTURE_CONTROL0 + (m_index * 8)] >> 31) & 0x1);
}
u16 texture::min_lod() const
{
return ((method_registers[NV4097_SET_TEXTURE_CONTROL0 + (m_index * 8)] >> 19) & 0xfff);
}
u16 texture::max_lod() const
{
return ((method_registers[NV4097_SET_TEXTURE_CONTROL0 + (m_index * 8)] >> 7) & 0xfff);
}
u8 texture::max_aniso() const
{
return ((method_registers[NV4097_SET_TEXTURE_CONTROL0 + (m_index * 8)] >> 4) & 0x7);
}
bool texture::alpha_kill_enabled() const
{
return ((method_registers[NV4097_SET_TEXTURE_CONTROL0 + (m_index * 8)] >> 2) & 0x1);
}
u32 texture::remap() const
{
return (method_registers[NV4097_SET_TEXTURE_CONTROL1 + (m_index * 8)]);
}
u16 texture::bias() const
{
return ((method_registers[NV4097_SET_TEXTURE_FILTER + (m_index * 8)]) & 0x1fff);
}
u8 texture::min_filter() const
{
return ((method_registers[NV4097_SET_TEXTURE_FILTER + (m_index * 8)] >> 16) & 0x7);
}
u8 texture::mag_filter() const
{
return ((method_registers[NV4097_SET_TEXTURE_FILTER + (m_index * 8)] >> 24) & 0x7);
}
u8 texture::convolution_filter() const
{
return ((method_registers[NV4097_SET_TEXTURE_FILTER + (m_index * 8)] >> 13) & 0xf);
}
bool texture::a_signed() const
{
return ((method_registers[NV4097_SET_TEXTURE_FILTER + (m_index * 8)] >> 28) & 0x1);
}
bool texture::r_signed() const
{
return ((method_registers[NV4097_SET_TEXTURE_FILTER + (m_index * 8)] >> 29) & 0x1);
}
bool texture::g_signed() const
{
return ((method_registers[NV4097_SET_TEXTURE_FILTER + (m_index * 8)] >> 30) & 0x1);
}
bool texture::b_signed() const
{
return ((method_registers[NV4097_SET_TEXTURE_FILTER + (m_index * 8)] >> 31) & 0x1);
}
u16 texture::width() const
{
return ((method_registers[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index * 8)] >> 16) & 0xffff);
}
u16 texture::height() const
{
return ((method_registers[NV4097_SET_TEXTURE_IMAGE_RECT + (m_index * 8)]) & 0xffff);
}
u32 texture::border_color() const
{
return method_registers[NV4097_SET_TEXTURE_BORDER_COLOR + (m_index * 8)];
}
u16 texture::depth() const
{
return method_registers[NV4097_SET_TEXTURE_CONTROL3] >> 20;
}
u32 texture::pitch() const
{
return method_registers[NV4097_SET_TEXTURE_CONTROL3] & 0xfffff;
}
void vertex_texture::init(u8 index)
{
m_index = index;
// Offset
method_registers[NV4097_SET_VERTEX_TEXTURE_OFFSET + (m_index * 8)] = 0;
// Format
method_registers[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 8)] = 0;
// Address
method_registers[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 8)] =
((/*wraps*/1) | ((/*anisoBias*/0) << 4) | ((/*wrapt*/1) << 8) | ((/*unsignedRemap*/0) << 12) |
((/*wrapr*/3) << 16) | ((/*gamma*/0) << 20) | ((/*signedRemap*/0) << 24) | ((/*zfunc*/0) << 28));
// Control0
method_registers[NV4097_SET_VERTEX_TEXTURE_CONTROL0 + (m_index * 8)] =
(((/*alphakill*/0) << 2) | (/*maxaniso*/0) << 4) | ((/*maxlod*/0xc00) << 7) | ((/*minlod*/0) << 19) | ((/*enable*/0) << 31);
// Control1
//method_registers[NV4097_SET_VERTEX_TEXTURE_CONTROL1 + (m_index * 8)] = 0xE4;
// Filter
method_registers[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 8)] =
((/*bias*/0) | ((/*conv*/1) << 13) | ((/*min*/5) << 16) | ((/*mag*/2) << 24)
| ((/*as*/0) << 28) | ((/*rs*/0) << 29) | ((/*gs*/0) << 30) | ((/*bs*/0) << 31));
// Image Rect
method_registers[NV4097_SET_VERTEX_TEXTURE_IMAGE_RECT + (m_index * 8)] = (/*height*/1) | ((/*width*/1) << 16);
// Border Color
method_registers[NV4097_SET_VERTEX_TEXTURE_BORDER_COLOR + (m_index * 8)] = 0;
}
u32 vertex_texture::offset() const
{
return method_registers[NV4097_SET_VERTEX_TEXTURE_OFFSET + (m_index * 8)];
}
u8 vertex_texture::location() const
{
return (method_registers[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 8)] & 0x3) - 1;
}
bool vertex_texture::cubemap() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 8)] >> 2) & 0x1);
}
u8 vertex_texture::border_type() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 8)] >> 3) & 0x1);
}
u8 vertex_texture::dimension() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 8)] >> 4) & 0xf);
}
u8 vertex_texture::format() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 8)] >> 8) & 0xff);
}
u16 vertex_texture::mipmap() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FORMAT + (m_index * 8)] >> 16) & 0xffff);
}
u8 vertex_texture::wrap_s() const
{
return 1;
//return ((method_registers[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 8)]) & 0xf);
}
u8 vertex_texture::wrap_t() const
{
return 1;
//return ((method_registers[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 8)] >> 8) & 0xf);
}
u8 vertex_texture::wrap_r() const
{
return 1;
//return ((method_registers[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 8)] >> 16) & 0xf);
}
u8 vertex_texture::unsigned_remap() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 8)] >> 12) & 0xf);
}
u8 vertex_texture::zfunc() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 8)] >> 28) & 0xf);
}
u8 vertex_texture::gamma() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 8)] >> 20) & 0xf);
}
u8 vertex_texture::aniso_bias() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 8)] >> 4) & 0xf);
}
u8 vertex_texture::signed_remap() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_ADDRESS + (m_index * 8)] >> 24) & 0xf);
}
bool vertex_texture::enabled() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_CONTROL0 + (m_index * 8)] >> 31) & 0x1);
}
u16 vertex_texture::min_lod() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_CONTROL0 + (m_index * 8)] >> 19) & 0xfff);
}
u16 vertex_texture::max_lod() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_CONTROL0 + (m_index * 8)] >> 7) & 0xfff);
}
u8 vertex_texture::max_aniso() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_CONTROL0 + (m_index * 8)] >> 4) & 0x7);
}
bool vertex_texture::alpha_kill_enabled() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_CONTROL0 + (m_index * 8)] >> 2) & 0x1);
}
u32 vertex_texture::remap() const
{
return 0 | (1 << 2) | (2 << 4) | (3 << 6);//(method_registers[NV4097_SET_VERTEX_TEXTURE_CONTROL1 + (m_index * 8)]);
}
u16 vertex_texture::bias() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 8)]) & 0x1fff);
}
u8 vertex_texture::min_filter() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 8)] >> 16) & 0x7);
}
u8 vertex_texture::mag_filter() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 8)] >> 24) & 0x7);
}
u8 vertex_texture::convolution_filter() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 8)] >> 13) & 0xf);
}
bool vertex_texture::a_signed() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 8)] >> 28) & 0x1);
}
bool vertex_texture::r_signed() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 8)] >> 29) & 0x1);
}
bool vertex_texture::g_signed() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 8)] >> 30) & 0x1);
}
bool vertex_texture::b_signed() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_FILTER + (m_index * 8)] >> 31) & 0x1);
}
u16 vertex_texture::width() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_IMAGE_RECT + (m_index * 8)] >> 16) & 0xffff);
}
u16 vertex_texture::height() const
{
return ((method_registers[NV4097_SET_VERTEX_TEXTURE_IMAGE_RECT + (m_index * 8)]) & 0xffff);
}
u32 vertex_texture::border_color() const
{
return method_registers[NV4097_SET_VERTEX_TEXTURE_BORDER_COLOR + (m_index * 8)];
}
u16 vertex_texture::depth() const
{
return method_registers[NV4097_SET_VERTEX_TEXTURE_CONTROL3] >> 20;
}
u32 vertex_texture::pitch() const
{
return method_registers[NV4097_SET_VERTEX_TEXTURE_CONTROL3] & 0xfffff;
}
}

View file

@ -1,122 +1,131 @@
#pragma once
#include "Utilities/types.h"
class RSXTexture
namespace rsx
{
protected:
u8 m_index;
class texture
{
protected:
u8 m_index;
public:
u32 m_pitch;
u16 m_depth;
public:
//initialize texture registers with default values
void init(u8 index);
public:
RSXTexture();
RSXTexture(u8 index);
virtual void Init();
// Offset
u32 offset() const;
// Offset
virtual u32 GetOffset() const;
// Format
u8 location() const;
bool cubemap() const;
u8 border_type() const;
u8 dimension() const;
u8 format() const;
u16 mipmap() const;
// Format
virtual u8 GetLocation() const;
virtual bool isCubemap() const;
virtual u8 GetBorderType() const;
virtual u8 GetDimension() const;
virtual u8 GetFormat() const;
virtual u16 GetMipmap() const;
// Address
u8 wrap_s() const;
u8 wrap_t() const;
u8 wrap_r() const;
u8 unsigned_remap() const;
u8 zfunc() const;
u8 gamma() const;
u8 aniso_bias() const;
u8 signed_remap() const;
// Address
virtual u8 GetWrapS() const;
virtual u8 GetWrapT() const;
virtual u8 GetWrapR() const;
virtual u8 GetUnsignedRemap() const;
virtual u8 GetZfunc() const;
virtual u8 GetGamma() const;
virtual u8 GetAnisoBias() const;
virtual u8 GetSignedRemap() const;
// Control0
bool enabled() const;
u16 min_lod() const;
u16 max_lod() const;
u8 max_aniso() const;
bool alpha_kill_enabled() const;
// Control0
virtual bool IsEnabled() const;
virtual u16 GetMinLOD() const;
virtual u16 GetMaxLOD() const;
virtual u8 GetMaxAniso() const;
virtual bool IsAlphaKillEnabled() const;
// Control1
u32 remap() const;
// Control1
virtual u32 GetRemap() const;
// Filter
u16 bias() const;
u8 min_filter() const;
u8 mag_filter() const;
u8 convolution_filter() const;
bool a_signed() const;
bool r_signed() const;
bool g_signed() const;
bool b_signed() const;
// Filter
virtual u16 GetBias() const;
virtual u8 GetMinFilter() const;
virtual u8 GetMagFilter() const;
virtual u8 GetConvolutionFilter() const;
virtual bool isASigned() const;
virtual bool isRSigned() const;
virtual bool isGSigned() const;
virtual bool isBSigned() const;
// Image Rect
u16 width() const;
u16 height() const;
// Image Rect
virtual u16 GetWidth() const;
virtual u16 GetHeight() const;
// Border Color
u32 border_color() const;
u16 depth() const;
u32 pitch() const;
// Border Color
virtual u32 GetBorderColor() const;
//custom info
u8 index() const;
};
void SetControl3(u16 depth, u32 pitch);
};
class vertex_texture
{
protected:
u8 m_index;
class RSXVertexTexture : public RSXTexture
{
public:
RSXVertexTexture();
RSXVertexTexture(u8 index);
void Init();
public:
//initialize texture registers with default values
void init(u8 index);
// Offset
u32 GetOffset() const;
// Offset
u32 offset() const;
// Format
u8 GetLocation() const;
bool isCubemap() const;
u8 GetBorderType() const;
u8 GetDimension() const;
u8 GetFormat() const;
u16 GetMipmap() const;
// Format
u8 location() const;
bool cubemap() const;
u8 border_type() const;
u8 dimension() const;
u8 format() const;
u16 mipmap() const;
// Address
u8 GetWrapS() const;
u8 GetWrapT() const;
u8 GetWrapR() const;
u8 GetUnsignedRemap() const;
u8 GetZfunc() const;
u8 GetGamma() const;
u8 GetAnisoBias() const;
u8 GetSignedRemap() const;
// Address
u8 wrap_s() const;
u8 wrap_t() const;
u8 wrap_r() const;
u8 unsigned_remap() const;
u8 zfunc() const;
u8 gamma() const;
u8 aniso_bias() const;
u8 signed_remap() const;
// Control0
bool IsEnabled() const;
u16 GetMinLOD() const;
u16 GetMaxLOD() const;
u8 GetMaxAniso() const;
bool IsAlphaKillEnabled() const;
// Control0
bool enabled() const;
u16 min_lod() const;
u16 max_lod() const;
u8 max_aniso() const;
bool alpha_kill_enabled() const;
// Control1
u32 GetRemap() const;
// Control1
u32 remap() const;
// Filter
u16 GetBias() const;
u8 GetMinFilter() const;
u8 GetMagFilter() const;
u8 GetConvolutionFilter() const;
bool isASigned() const;
bool isRSigned() const;
bool isGSigned() const;
bool isBSigned() const;
// Filter
u16 bias() const;
u8 min_filter() const;
u8 mag_filter() const;
u8 convolution_filter() const;
bool a_signed() const;
bool r_signed() const;
bool g_signed() const;
bool b_signed() const;
// Image Rect
u16 GetWidth() const;
u16 GetHeight() const;
// Image Rect
u16 width() const;
u16 height() const;
// Border Color
u32 GetBorderColor() const;
};
// Border Color
u32 border_color() const;
u16 depth() const;
u32 pitch() const;
//custom info
u8 index() const;
};
}

File diff suppressed because it is too large Load diff

View file

@ -8,721 +8,223 @@
#include "Utilities/Semaphore.h"
#include "Utilities/Thread.h"
#include "Utilities/Timer.h"
#include "Utilities/types.h"
enum Method
namespace rsx
{
CELL_GCM_METHOD_FLAG_NON_INCREMENT = 0x40000000,
CELL_GCM_METHOD_FLAG_JUMP = 0x20000000,
CELL_GCM_METHOD_FLAG_CALL = 0x00000002,
CELL_GCM_METHOD_FLAG_RETURN = 0x00020000,
};
extern u32 methodRegisters[0xffff];
u32 GetAddress(u32 offset, u32 location);
struct RSXVertexData
{
u32 frequency;
u32 stride;
u32 size;
u32 type;
u32 addr;
u32 constant_count;
std::vector<u8> data;
RSXVertexData();
void Reset();
bool IsEnabled() const { return size > 0; }
void Load(u32 start, u32 count, u32 baseOffset, u32 baseIndex);
u32 GetTypeSize() const;
};
struct RSXIndexArrayData
{
std::vector<u8> m_data;
int m_type;
u32 m_first;
u32 m_count;
u32 m_addr;
u32 index_max;
u32 index_min;
RSXIndexArrayData()
namespace limits
{
Reset();
}
void Reset()
{
m_type = 0;
m_first = ~0;
m_count = 0;
m_addr = 0;
index_min = ~0;
index_max = 0;
m_data.clear();
}
};
struct RSXTransformConstant
{
u32 id;
float x, y, z, w;
RSXTransformConstant()
: x(0.0f)
, y(0.0f)
, z(0.0f)
, w(0.0f)
{
}
RSXTransformConstant(u32 id, float x, float y, float z, float w)
: id(id)
, x(x)
, y(y)
, z(z)
, w(w)
{
}
};
class RSXThread : protected named_thread_t
{
public:
static const uint m_textures_count = 16;
static const uint m_vertex_count = 32;
static const uint m_fragment_count = 32;
static const uint m_tiles_count = 15;
static const uint m_zculls_count = 8;
protected:
std::stack<u32> m_call_stack;
CellGcmControl* m_ctrl;
Timer m_timer_sync;
public:
GcmTileInfo m_tiles[m_tiles_count];
GcmZcullInfo m_zculls[m_zculls_count];
RSXTexture m_textures[m_textures_count];
RSXVertexTexture m_vertex_textures[m_textures_count];
RSXVertexData m_vertex_data[m_vertex_count];
RSXIndexArrayData m_indexed_array;
std::vector<RSXTransformConstant> m_fragment_constants;
std::vector<RSXTransformConstant> m_transform_constants;
u32 m_shader_ctrl, m_cur_fragment_prog_num;
RSXFragmentProgram m_fragment_progs[m_fragment_count];
RSXFragmentProgram* m_cur_fragment_prog;
RSXVertexProgram m_vertex_progs[m_vertex_count];
RSXVertexProgram* m_cur_vertex_prog;
public:
u32 m_ioAddress, m_ioSize, m_ctrlAddress;
int m_flip_status;
int m_flip_mode;
int m_debug_level;
int m_frequency_mode;
u32 m_tiles_addr;
u32 m_zculls_addr;
u32 m_gcm_buffers_addr;
u32 m_gcm_buffers_count;
u32 m_gcm_current_buffer;
u32 m_ctxt_addr;
u32 m_report_main_addr;
u32 m_label_addr;
// DMA
u32 dma_report;
u32 m_local_mem_addr, m_main_mem_addr;
bool m_strict_ordering[0x1000];
public:
uint m_draw_mode;
u32 m_width;
u32 m_height;
float m_width_scale;
float m_height_scale;
u32 m_draw_array_count;
u32 m_draw_array_first;
double m_fps_limit = 59.94;
public:
std::mutex m_cs_main;
semaphore_t m_sem_flip;
u64 m_last_flip_time;
vm::ptr<void(u32)> m_flip_handler;
vm::ptr<void(u32)> m_user_handler;
u64 m_vblank_count;
vm::ptr<void(u32)> m_vblank_handler;
public:
// Dither
bool m_set_dither;
// Color mask
bool m_set_color_mask;
bool m_color_mask_r;
bool m_color_mask_g;
bool m_color_mask_b;
bool m_color_mask_a;
// Clip
bool m_set_clip;
float m_clip_min;
float m_clip_max;
// Depth test
bool m_set_depth_test;
bool m_set_depth_func;
int m_depth_func;
bool m_set_depth_mask;
u32 m_depth_mask;
// Depth bound test
bool m_set_depth_bounds_test;
bool m_set_depth_bounds;
float m_depth_bounds_min;
float m_depth_bounds_max;
// Primitive restart
bool m_set_restart_index;
u32 m_restart_index;
// Point
bool m_set_point_size;
bool m_set_point_sprite_control;
float m_point_size;
u16 m_point_x;
u16 m_point_y;
// Line smooth
bool m_set_line_smooth;
// Viewport & scissor
bool m_set_viewport_horizontal;
bool m_set_viewport_vertical;
u16 m_viewport_x;
u16 m_viewport_y;
u16 m_viewport_w;
u16 m_viewport_h;
bool m_set_scissor_horizontal;
bool m_set_scissor_vertical;
u16 m_scissor_x;
u16 m_scissor_y;
u16 m_scissor_w;
u16 m_scissor_h;
// Polygon mode/offset
bool m_set_poly_smooth;
bool m_set_poly_offset_fill;
bool m_set_poly_offset_line;
bool m_set_poly_offset_point;
bool m_set_front_polygon_mode;
u32 m_front_polygon_mode;
bool m_set_back_polygon_mode;
u32 m_back_polygon_mode;
bool m_set_poly_offset_mode;
float m_poly_offset_scale_factor;
float m_poly_offset_bias;
// Line/Polygon stipple
bool m_set_line_stipple;
u16 m_line_stipple_pattern;
u16 m_line_stipple_factor;
bool m_set_polygon_stipple;
u32 m_polygon_stipple_pattern[32];
// Logic Ops
bool m_set_logic_op;
u32 m_logic_op;
// Clearing
u32 m_clear_surface_mask;
u32 m_clear_surface_z;
u8 m_clear_surface_s;
u8 m_clear_surface_color_r;
u8 m_clear_surface_color_g;
u8 m_clear_surface_color_b;
u8 m_clear_surface_color_a;
u8 m_clear_color_r;
u8 m_clear_color_g;
u8 m_clear_color_b;
u8 m_clear_color_a;
u8 m_clear_s;
u32 m_clear_z;
// Blending
bool m_set_blend;
bool m_set_blend_dfactor;
u16 m_blend_dfactor_rgb;
u16 m_blend_dfactor_alpha;
bool m_set_blend_sfactor;
u16 m_blend_sfactor_rgb;
u16 m_blend_sfactor_alpha;
bool m_set_blend_equation;
u16 m_blend_equation_rgb;
u16 m_blend_equation_alpha;
bool m_set_blend_color;
u8 m_blend_color_r;
u8 m_blend_color_g;
u8 m_blend_color_b;
u8 m_blend_color_a;
bool m_set_blend_mrt1;
bool m_set_blend_mrt2;
bool m_set_blend_mrt3;
// Stencil Test
bool m_set_stencil_test;
bool m_set_stencil_mask;
u32 m_stencil_mask;
bool m_set_stencil_func;
u32 m_stencil_func;
bool m_set_stencil_func_ref;
u32 m_stencil_func_ref;
bool m_set_stencil_func_mask;
u32 m_stencil_func_mask;
bool m_set_stencil_fail;
u32 m_stencil_fail;
bool m_set_stencil_zfail;
u32 m_stencil_zfail;
bool m_set_stencil_zpass;
u32 m_stencil_zpass;
bool m_set_two_sided_stencil_test_enable;
bool m_set_two_side_light_enable;
bool m_set_back_stencil_mask;
u32 m_back_stencil_mask;
bool m_set_back_stencil_func;
u32 m_back_stencil_func;
bool m_set_back_stencil_func_ref;
u32 m_back_stencil_func_ref;
bool m_set_back_stencil_func_mask;
u32 m_back_stencil_func_mask;
bool m_set_back_stencil_fail;
u32 m_back_stencil_fail;
bool m_set_back_stencil_zfail;
u32 m_back_stencil_zfail;
bool m_set_back_stencil_zpass;
u32 m_back_stencil_zpass;
bool m_set_stencil_op_fail;
// Line width
bool m_set_line_width;
float m_line_width;
// Shader mode
bool m_set_shade_mode;
u32 m_shade_mode;
// Lighting
bool m_set_specular;
// Color
u32 m_color_format;
u16 m_color_format_src_pitch;
u16 m_color_format_dst_pitch;
u32 m_color_conv;
u32 m_color_conv_fmt;
u32 m_color_conv_op;
s16 m_color_conv_clip_x;
s16 m_color_conv_clip_y;
u16 m_color_conv_clip_w;
u16 m_color_conv_clip_h;
s16 m_color_conv_out_x;
s16 m_color_conv_out_y;
u16 m_color_conv_out_w;
u16 m_color_conv_out_h;
s32 m_color_conv_dsdx;
s32 m_color_conv_dtdy;
// Semaphore
// PGRAPH
u32 m_PGRAPH_semaphore_offset;
//PFIFO
u32 m_PFIFO_semaphore_offset;
u32 m_PFIFO_semaphore_release_value;
// Fog
bool m_set_fog_mode;
u32 m_fog_mode;
bool m_set_fog_params;
float m_fog_param0;
float m_fog_param1;
// Clip plane
bool m_set_clip_plane;
bool m_clip_plane_0;
bool m_clip_plane_1;
bool m_clip_plane_2;
bool m_clip_plane_3;
bool m_clip_plane_4;
bool m_clip_plane_5;
// Surface
bool m_set_surface_format;
u8 m_surface_color_format;
u8 m_surface_depth_format;
u8 m_surface_type;
u8 m_surface_antialias;
u8 m_surface_width;
u8 m_surface_height;
bool m_set_surface_clip_horizontal;
u16 m_surface_clip_x;
u16 m_surface_clip_w;
bool m_set_surface_clip_vertical;
u16 m_surface_clip_y;
u16 m_surface_clip_h;
u32 m_surface_pitch_a;
u32 m_surface_pitch_b;
u32 m_surface_pitch_c;
u32 m_surface_pitch_d;
u32 m_surface_pitch_z;
u32 m_surface_offset_a;
u32 m_surface_offset_b;
u32 m_surface_offset_c;
u32 m_surface_offset_d;
u32 m_surface_offset_z;
u32 m_surface_color_target;
// DMA context
bool m_set_context_dma_color_a;
u32 m_context_dma_color_a;
bool m_set_context_dma_color_b;
u32 m_context_dma_color_b;
bool m_set_context_dma_color_c;
u32 m_context_dma_color_c;
bool m_set_context_dma_color_d;
u32 m_context_dma_color_d;
bool m_set_context_dma_z;
u32 m_context_dma_z;
u32 m_context_surface;
u32 m_context_dma_img_src;
u32 m_context_dma_img_dst;
u32 m_context_dma_buffer_in_src;
u32 m_context_dma_buffer_in_dst;
u32 m_dst_offset;
// Swizzle2D?
u16 m_swizzle_format;
u8 m_swizzle_width;
u8 m_swizzle_height;
u32 m_swizzle_offset;
// Cull face
bool m_set_cull_face;
u32 m_cull_face;
// Alpha test
bool m_set_alpha_test;
bool m_set_alpha_func;
u32 m_alpha_func;
bool m_set_alpha_ref;
float m_alpha_ref;
// Shader
u16 m_shader_window_height;
u8 m_shader_window_origin;
u16 m_shader_window_pixel_centers;
// Vertex Data
u32 m_vertex_data_base_offset;
u32 m_vertex_data_base_index;
// Front face
bool m_set_front_face;
u32 m_front_face;
// Frequency divider
u32 m_set_frequency_divider_operation;
u8 m_begin_end;
bool m_read_buffer;
std::set<u32> m_used_gcm_commands;
protected:
RSXThread()
: m_ctrl(nullptr)
, m_shader_ctrl(0x40)
, m_flip_status(0)
, m_flip_mode(CELL_GCM_DISPLAY_VSYNC)
, m_debug_level(CELL_GCM_DEBUG_LEVEL0)
, m_frequency_mode(CELL_GCM_DISPLAY_FREQUENCY_DISABLE)
, m_report_main_addr(0)
, m_main_mem_addr(0)
, m_local_mem_addr(0)
, m_draw_mode(0)
, m_draw_array_count(0)
, m_draw_array_first(~0)
, m_gcm_current_buffer(0)
, m_read_buffer(true)
{
m_flip_handler.set(0);
m_vblank_handler.set(0);
m_user_handler.set(0);
m_set_depth_test = false;
m_set_alpha_test = false;
m_set_depth_bounds_test = false;
m_set_blend = false;
m_set_blend_mrt1 = false;
m_set_blend_mrt2 = false;
m_set_blend_mrt3 = false;
m_set_logic_op = false;
m_set_cull_face = false;
m_set_dither = false;
m_set_stencil_test = false;
m_set_scissor_horizontal = false;
m_set_scissor_vertical = false;
m_set_line_smooth = false;
m_set_poly_smooth = false;
m_set_point_sprite_control = false;
m_set_specular = false;
m_set_two_sided_stencil_test_enable = false;
m_set_two_side_light_enable = false;
m_set_surface_clip_horizontal = false;
m_set_surface_clip_vertical = false;
m_set_poly_offset_fill = false;
m_set_poly_offset_line = false;
m_set_poly_offset_point = false;
m_set_restart_index = false;
m_set_line_stipple = false;
m_set_polygon_stipple = false;
// Default value
// TODO: Check against the default value on PS3
m_clear_color_r = 0;
m_clear_color_g = 0;
m_clear_color_b = 0;
m_clear_color_a = 0;
m_clear_z = 0xffffff;
m_clear_s = 0;
m_poly_offset_scale_factor = 0.0;
m_poly_offset_bias = 0.0;
m_restart_index = 0xffffffff;
m_front_polygon_mode = 0x1b02; // GL_FILL
m_back_polygon_mode = 0x1b02; // GL_FILL
m_front_face = 0x0901; // GL_CCW
m_cull_face = 0x0405; // GL_BACK
m_alpha_func = 0x0207; // GL_ALWAYS
m_alpha_ref = 0.0f;
m_logic_op = 0x1503; // GL_COPY
m_shade_mode = 0x1D01; // GL_SMOOTH
m_depth_mask = 1;
m_depth_func = 0x0201; // GL_LESS
m_depth_bounds_min = 0.0;
m_depth_bounds_max = 1.0;
m_clip_min = 0.0;
m_clip_max = 1.0;
m_blend_equation_rgb = 0x8006; // GL_FUNC_ADD
m_blend_equation_alpha = 0x8006; // GL_FUNC_ADD
m_blend_sfactor_rgb = 1; // GL_ONE
m_blend_dfactor_rgb = 0; // GL_ZERO
m_blend_sfactor_alpha = 1; // GL_ONE
m_blend_dfactor_alpha = 0; // GL_ZERO
m_point_x = 0;
m_point_y = 0;
m_point_size = 1.0;
m_line_width = 1.0;
m_line_stipple_pattern = 0xffff;
m_line_stipple_factor = 1;
m_vertex_data_base_offset = 0;
m_vertex_data_base_index = 0;
// Construct Stipple Pattern
for (size_t i = 0; i < 32; i++)
enum
{
m_polygon_stipple_pattern[i] = 0xFFFFFFFF;
}
// Construct Textures
for (int i = 0; i < 16; i++)
{
m_textures[i] = RSXTexture(i);
}
Reset();
textures_count = 16,
vertex_textures_count = 4,
vertex_count = 16,
fragment_count = 32,
tiles_count = 15,
zculls_count = 8,
color_buffers_count = 4
};
}
virtual ~RSXThread() override
//TODO
union alignas(4) method_registers_t
{
}
void Reset()
{
m_set_dither = false;
m_set_color_mask = false;
m_set_clip = false;
m_set_depth_test = false;
m_set_depth_func = false;
m_set_depth_mask = false;
m_set_depth_bounds_test = false;
m_set_depth_bounds = false;
m_set_viewport_horizontal = false;
m_set_viewport_vertical = false;
m_set_scissor_horizontal = false;
m_set_scissor_vertical = false;
m_set_front_polygon_mode = false;
m_set_back_polygon_mode = false;
m_set_blend = false;
m_set_blend_mrt1 = false;
m_set_blend_mrt2 = false;
m_set_blend_mrt3 = false;
m_set_blend_sfactor = false;
m_set_blend_dfactor = false;
m_set_blend_equation = false;
m_set_blend_color = false;
m_set_stencil_test = false;
m_set_two_sided_stencil_test_enable = false;
m_set_two_side_light_enable = false;
m_set_stencil_mask = false;
m_set_stencil_func = false;
m_set_stencil_func_ref = false;
m_set_stencil_func_mask = false;
m_set_stencil_fail = false;
m_set_stencil_zfail = false;
m_set_stencil_zpass = false;
m_set_back_stencil_mask = false;
m_set_back_stencil_func = false;
m_set_back_stencil_func_ref = false;
m_set_back_stencil_func_mask = false;
m_set_back_stencil_fail = false;
m_set_back_stencil_zfail = false;
m_set_back_stencil_zpass = false;
m_set_stencil_op_fail = false;
m_set_point_sprite_control = false;
m_set_point_size = false;
m_set_line_width = false;
m_set_line_smooth = false;
m_set_shade_mode = false;
m_set_fog_mode = false;
m_set_fog_params = false;
m_set_clip_plane = false;
m_set_context_dma_color_a = false;
m_set_context_dma_color_b = false;
m_set_context_dma_color_c = false;
m_set_context_dma_color_d = false;
m_set_context_dma_z = false;
m_set_cull_face = false;
m_set_front_face = false;
m_set_alpha_test = false;
m_set_alpha_func = false;
m_set_alpha_ref = false;
m_set_poly_smooth = false;
m_set_poly_offset_fill = false;
m_set_poly_offset_line = false;
m_set_poly_offset_point = false;
m_set_poly_offset_mode = false;
m_set_restart_index = false;
m_set_specular = false;
m_set_line_stipple = false;
m_set_polygon_stipple = false;
m_set_logic_op = false;
m_set_surface_format = false;
m_set_surface_clip_horizontal = false;
m_set_surface_clip_vertical = false;
m_clear_surface_mask = 0;
m_begin_end = 0;
for (uint i = 0; i < m_textures_count; ++i)
u8 _u8[0x10000];
u32 _u32[0x10000 >> 2];
/*
struct
{
m_textures[i].Init();
}
}
u8 pad[NV4097_SET_TEXTURE_OFFSET - 4];
void Begin(u32 draw_mode);
void End();
struct texture_t
{
u32 offset;
u32 OutOfArgsCount(const uint x, const u32 cmd, const u32 count, const u32 args_addr);
void DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const u32 count);
union format_t
{
u32 _u32;
virtual void OnInit() = 0;
virtual void OnInitThread() = 0;
virtual void OnExitThread() = 0;
virtual void OnReset() = 0;
struct
{
u32: 1;
u32 location : 1;
u32 cubemap : 1;
u32 border_type : 1;
u32 dimension : 4;
u32 format : 8;
u32 mipmap : 16;
};
} format;
/**
* This member is called when the backend is expected to render a draw call, either
* indexed or not.
*/
virtual void Draw() = 0;
union address_t
{
u32 _u32;
/**
* This member is called when the backend is expected to clear a target surface.
*/
virtual void Clear(u32 cmd) = 0;
struct
{
u32 wrap_s : 4;
u32 aniso_bias : 4;
u32 wrap_t : 4;
u32 unsigned_remap : 4;
u32 wrap_r : 4;
u32 gamma : 4;
u32 signed_remap : 4;
u32 zfunc : 4;
};
} address;
/**
* This member is called when the backend is expected to present a target surface in
* either local or main memory.
*/
virtual void Flip() = 0;
/**
* This member is called when RSXThread parse a TEXTURE_READ_SEMAPHORE_RELEASE
* command.
* Backend is expected to write value at offset when current draw textures aren't
* needed anymore by the GPU and can be modified.
*/
virtual void semaphorePGRAPHTextureReadRelease(u32 offset, u32 value) = 0;
/**
* This member is called when RSXThread parse a BACK_END_WRITE_SEMAPHORE_RELEASE
* command.
* Backend is expected to write value at offset when current draw call has completed
* and render surface can be used.
*/
virtual void semaphorePGRAPHBackendRelease(u32 offset, u32 value) = 0;
/**
* This member is called when RSXThread parse a SEMAPHORE_ACQUIRE command.
* Backend and associated GPU is expected to wait that memory at offset is the same
* as value. In particular buffer/texture buffers value can change while backend is
* waiting.
*/
virtual void semaphorePFIFOAcquire(u32 offset, u32 value) = 0;
/**
* Called when vertex or fragment shader changes.
* Backend can reuse same program if no change has been notified.
*/
virtual void notifyProgramChange() = 0;
/**
* Called when blend state changes.
* Backend can reuse same program if no change has been notified.
*/
virtual void notifyBlendStateChange() = 0;
/**
* Called when depth stencil state changes.
* Backend can reuse same program if no change has been notified.
*/
virtual void notifyDepthStencilStateChange() = 0;
/**
* Called when rasterizer state changes.
* Rasterizer state includes culling, color masking
* Backend can reuse same program if no change has been notified.
*/
virtual void notifyRasterizerStateChange() = 0;
void LoadVertexData(u32 first, u32 count)
{
for (u32 i = 0; i < m_vertex_count; ++i)
u32 control0;
u32 control1;
u32 filter;
u32 image_rect;
u32 border_color;
} textures[limits::textures_count];
};
*/
u32& operator[](int index)
{
if (!m_vertex_data[i].IsEnabled()) continue;
m_vertex_data[i].Load(first, count, m_vertex_data_base_offset, m_vertex_data_base_index);
return _u32[index >> 2];
}
}
};
virtual void Task();
extern u32 method_registers[0x10000 >> 2];
public:
void Init(const u32 ioAddress, const u32 ioSize, const u32 ctrlAddress, const u32 localAddress);
u32 get_address(u32 offset, u32 location);
u32 linear_to_swizzle(u32 x, u32 y, u32 z, u32 log2_width, u32 log2_height, u32 log2_depth);
u32 ReadIO32(u32 addr);
u32 get_vertex_type_size(u32 type);
void WriteIO32(u32 addr, u32 value);
};
struct surface_info
{
u8 log2height;
u8 log2width;
u8 antialias;
u8 depth_format;
u8 color_format;
u32 width;
u32 height;
u32 format;
void unpack(u32 surface_format)
{
format = surface_format;
log2height = surface_format >> 24;
log2width = (surface_format >> 16) & 0xff;
antialias = (surface_format >> 12) & 0xf;
depth_format = (surface_format >> 5) & 0x7;
color_format = surface_format & 0x1f;
width = 1 << (u32(log2width) + 1);
height = 1 << (u32(log2width) + 1);
}
};
struct data_array_format_info
{
u16 frequency = 0;
u8 stride = 0;
u8 size = 0;
u8 type = CELL_GCM_VERTEX_F;
bool array = false;
void unpack(u32 data_array_format)
{
frequency = data_array_format >> 16;
stride = (data_array_format >> 8) & 0xff;
size = (data_array_format >> 4) & 0xf;
type = data_array_format & 0xf;
}
};
class thread : protected named_thread_t
{
protected:
std::stack<u32> m_call_stack;
public:
CellGcmControl* ctrl = nullptr;
Timer timer_sync;
GcmTileInfo tiles[limits::tiles_count];
GcmZcullInfo zculls[limits::zculls_count];
rsx::texture textures[limits::textures_count];
rsx::vertex_texture vertex_textures[limits::vertex_textures_count];
data_array_format_info vertex_arrays_info[limits::vertex_count];
std::vector<u8> vertex_arrays[limits::vertex_count];
std::vector<u8> vertex_index_array;
u32 vertex_draw_count = 0;
std::unordered_map<u32, color4_base<f32>> fragment_constants;
std::unordered_map<u32, color4_base<f32>> transform_constants;
u32 transform_program[512 * 4] = {};
void load_vertex_data(u32 first, u32 count);
void load_vertex_index_data(u32 first, u32 count);
public:
u32 ioAddress, ioSize;
int flip_status;
int flip_mode;
int debug_level;
int frequency_mode;
u32 tiles_addr;
u32 zculls_addr;
vm::ps3::ptr<CellGcmDisplayInfo> gcm_buffers;
u32 gcm_buffers_count;
u32 gcm_current_buffer;
u32 ctxt_addr;
u32 report_main_addr;
u32 label_addr;
u32 draw_mode;
u32 local_mem_addr, main_mem_addr;
bool strict_ordering[0x1000];
public:
u32 draw_array_count;
u32 draw_array_first;
double fps_limit = 59.94;
public:
std::mutex cs_main;
semaphore_t sem_flip;
u64 last_flip_time;
vm::ps3::ptr<void(u32)> flip_handler = { 0 };
vm::ps3::ptr<void(u32)> user_handler = { 0 };
vm::ps3::ptr<void(u32)> vblank_handler = { 0 };
u64 vblank_count;
public:
std::set<u32> m_used_gcm_commands;
protected:
virtual ~thread() {}
public:
virtual void begin();
virtual void end();
virtual void oninit() = 0;
virtual void oninit_thread() = 0;
virtual void onexit_thread() = 0;
virtual bool domethod(u32 cmd, u32 value) { return false; }
virtual void flip(int buffer) = 0;
virtual u64 timestamp() const;
void task();
public:
void reset();
void init(const u32 ioAddress, const u32 ioSize, const u32 ctrlAddress, const u32 localAddress);
u32 ReadIO32(u32 addr);
void WriteIO32(u32 addr, u32 value);
};
}

View file

@ -102,7 +102,7 @@ vm::ptr<CellGcmReportData> cellGcmGetReportDataAddressLocation(u32 index, u32 lo
return vm::null;
}
// TODO: It seems m_report_main_addr is not initialized
return vm::ptr<CellGcmReportData>::make(Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10);
return vm::ptr<CellGcmReportData>::make(Emu.GetGSManager().GetRender().report_main_addr + index * 0x10);
}
cellGcmSys.Error("cellGcmGetReportDataAddressLocation: Wrong location (%d)", location);
@ -201,7 +201,7 @@ u64 cellGcmGetTimeStampLocation(u32 index, u32 location)
return 0;
}
// TODO: It seems m_report_main_addr is not initialized
return vm::read64(Emu.GetGSManager().GetRender().m_report_main_addr + index * 0x10);
return vm::read64(Emu.GetGSManager().GetRender().report_main_addr + index * 0x10);
}
cellGcmSys.Error("cellGcmGetTimeStampLocation: Wrong location (%d)", location);
@ -251,14 +251,14 @@ s32 cellGcmBindTile(u8 index)
{
cellGcmSys.Warning("cellGcmBindTile(index=%d)", index);
if (index >= RSXThread::m_tiles_count)
if (index >= rsx::limits::tiles_count)
{
cellGcmSys.Error("cellGcmBindTile: CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE;
}
auto& tile = Emu.GetGSManager().GetRender().m_tiles[index];
tile.m_binded = true;
auto& tile = Emu.GetGSManager().GetRender().tiles[index];
tile.binded = true;
return CELL_OK;
}
@ -267,14 +267,14 @@ s32 cellGcmBindZcull(u8 index)
{
cellGcmSys.Warning("cellGcmBindZcull(index=%d)", index);
if (index >= RSXThread::m_zculls_count)
if (index >= rsx::limits::zculls_count)
{
cellGcmSys.Error("cellGcmBindZcull: CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE;
}
auto& zcull = Emu.GetGSManager().GetRender().m_zculls[index];
zcull.m_binded = true;
auto& zcull = Emu.GetGSManager().GetRender().zculls[index];
zcull.binded = true;
return CELL_OK;
}
@ -290,7 +290,7 @@ s32 cellGcmGetConfiguration(vm::ptr<CellGcmConfig> config)
s32 cellGcmGetFlipStatus()
{
s32 status = Emu.GetGSManager().GetRender().m_flip_status;
s32 status = Emu.GetGSManager().GetRender().flip_status;
cellGcmSys.Log("cellGcmGetFlipStatus() -> %d", status);
@ -388,15 +388,15 @@ s32 _cellGcmInitBody(vm::pptr<CellGcmContextData> context, u32 cmdSize, u32 ioSi
ctrl.ref = -1;
auto& render = Emu.GetGSManager().GetRender();
render.m_ctxt_addr = context.addr();
render.m_gcm_buffers_addr = vm::alloc(sizeof(CellGcmDisplayInfo) * 8, vm::main);
render.m_zculls_addr = vm::alloc(sizeof(CellGcmZcullInfo) * 8, vm::main);
render.m_tiles_addr = vm::alloc(sizeof(CellGcmTileInfo) * 15, vm::main);
render.m_gcm_buffers_count = 0;
render.m_gcm_current_buffer = 0;
render.m_main_mem_addr = 0;
render.m_label_addr = gcm_info.label_addr;
render.Init(g_defaultCommandBufferBegin, cmdSize, gcm_info.control_addr, local_addr);
render.ctxt_addr = context.addr();
render.gcm_buffers = { vm::alloc(sizeof(CellGcmDisplayInfo) * 8, vm::main) };
render.zculls_addr = vm::alloc(sizeof(CellGcmZcullInfo) * 8, vm::main);
render.tiles_addr = vm::alloc(sizeof(CellGcmTileInfo) * 15, vm::main);
render.gcm_buffers_count = 0;
render.gcm_current_buffer = 0;
render.main_mem_addr = 0;
render.label_addr = gcm_info.label_addr;
render.init(g_defaultCommandBufferBegin, cmdSize, gcm_info.control_addr, local_addr);
return CELL_OK;
}
@ -405,7 +405,7 @@ s32 cellGcmResetFlipStatus()
{
cellGcmSys.Log("cellGcmResetFlipStatus()");
Emu.GetGSManager().GetRender().m_flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_WAITING;
Emu.GetGSManager().GetRender().flip_status = CELL_GCM_DISPLAY_FLIP_STATUS_WAITING;
return CELL_OK;
}
@ -419,7 +419,7 @@ s32 cellGcmSetDebugOutputLevel(s32 level)
case CELL_GCM_DEBUG_LEVEL0:
case CELL_GCM_DEBUG_LEVEL1:
case CELL_GCM_DEBUG_LEVEL2:
Emu.GetGSManager().GetRender().m_debug_level = level;
Emu.GetGSManager().GetRender().debug_level = level;
break;
default: return CELL_EINVAL;
@ -438,16 +438,16 @@ s32 cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height
return CELL_EINVAL;
}
auto buffers = vm::get_ptr<CellGcmDisplayInfo>(Emu.GetGSManager().GetRender().m_gcm_buffers_addr);
auto buffers = Emu.GetGSManager().GetRender().gcm_buffers;
buffers[id].offset = offset;
buffers[id].pitch = pitch;
buffers[id].width = width;
buffers[id].height = height;
if (id + 1 > Emu.GetGSManager().GetRender().m_gcm_buffers_count)
if (id + 1 > Emu.GetGSManager().GetRender().gcm_buffers_count)
{
Emu.GetGSManager().GetRender().m_gcm_buffers_count = id + 1;
Emu.GetGSManager().GetRender().gcm_buffers_count = id + 1;
}
return CELL_OK;
@ -457,7 +457,7 @@ void cellGcmSetFlipHandler(vm::ptr<void(u32)> handler)
{
cellGcmSys.Warning("cellGcmSetFlipHandler(handler=*0x%x)", handler);
Emu.GetGSManager().GetRender().m_flip_handler = handler;
Emu.GetGSManager().GetRender().flip_handler = handler;
}
s32 cellGcmSetFlipMode(u32 mode)
@ -469,7 +469,7 @@ s32 cellGcmSetFlipMode(u32 mode)
case CELL_GCM_DISPLAY_HSYNC:
case CELL_GCM_DISPLAY_VSYNC:
case CELL_GCM_DISPLAY_HSYNC_WITH_NOISE:
Emu.GetGSManager().GetRender().m_flip_mode = mode;
Emu.GetGSManager().GetRender().flip_mode = mode;
break;
default:
@ -483,7 +483,7 @@ void cellGcmSetFlipStatus()
{
cellGcmSys.Warning("cellGcmSetFlipStatus()");
Emu.GetGSManager().GetRender().m_flip_status = 0;
Emu.GetGSManager().GetRender().flip_status = 0;
}
s32 cellGcmSetPrepareFlip(PPUThread& ppu, vm::ptr<CellGcmContextData> ctxt, u32 id)
@ -535,11 +535,11 @@ s32 cellGcmSetSecondVFrequency(u32 freq)
switch (freq)
{
case CELL_GCM_DISPLAY_FREQUENCY_59_94HZ:
Emu.GetGSManager().GetRender().m_frequency_mode = freq; Emu.GetGSManager().GetRender().m_fps_limit = 59.94; break;
Emu.GetGSManager().GetRender().frequency_mode = freq; Emu.GetGSManager().GetRender().fps_limit = 59.94; break;
case CELL_GCM_DISPLAY_FREQUENCY_SCANOUT:
Emu.GetGSManager().GetRender().m_frequency_mode = freq; cellGcmSys.Todo("Unimplemented display frequency: Scanout"); break;
Emu.GetGSManager().GetRender().frequency_mode = freq; cellGcmSys.Todo("Unimplemented display frequency: Scanout"); break;
case CELL_GCM_DISPLAY_FREQUENCY_DISABLE:
Emu.GetGSManager().GetRender().m_frequency_mode = freq; cellGcmSys.Todo("Unimplemented display frequency: Disabled"); break;
Emu.GetGSManager().GetRender().frequency_mode = freq; cellGcmSys.Todo("Unimplemented display frequency: Disabled"); break;
default: cellGcmSys.Error("Improper display frequency specified!"); return CELL_OK;
}
@ -551,7 +551,7 @@ s32 cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u
cellGcmSys.Warning("cellGcmSetTileInfo(index=%d, location=%d, offset=%d, size=%d, pitch=%d, comp=%d, base=%d, bank=%d)",
index, location, offset, size, pitch, comp, base, bank);
if (index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4)
if (index >= rsx::limits::tiles_count || base >= 800 || bank >= 4)
{
cellGcmSys.Error("cellGcmSetTileInfo: CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE;
@ -574,16 +574,16 @@ s32 cellGcmSetTileInfo(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u
cellGcmSys.Error("cellGcmSetTileInfo: bad compression mode! (%d)", comp);
}
auto& tile = Emu.GetGSManager().GetRender().m_tiles[index];
tile.m_location = location;
tile.m_offset = offset;
tile.m_size = size;
tile.m_pitch = pitch;
tile.m_comp = comp;
tile.m_base = base;
tile.m_bank = bank;
auto& tile = Emu.GetGSManager().GetRender().tiles[index];
tile.location = location;
tile.offset = offset;
tile.size = size;
tile.pitch = pitch;
tile.comp = comp;
tile.base = base;
tile.bank = bank;
vm::get_ptr<CellGcmTileInfo>(Emu.GetGSManager().GetRender().m_tiles_addr)[index] = tile.Pack();
vm::get_ptr<CellGcmTileInfo>(Emu.GetGSManager().GetRender().tiles_addr)[index] = tile.pack();
return CELL_OK;
}
@ -591,7 +591,7 @@ void cellGcmSetUserHandler(vm::ptr<void(u32)> handler)
{
cellGcmSys.Warning("cellGcmSetUserHandler(handler=*0x%x)", handler);
Emu.GetGSManager().GetRender().m_user_handler = handler;
Emu.GetGSManager().GetRender().user_handler = handler;
}
s32 cellGcmSetUserCommand()
@ -603,7 +603,7 @@ void cellGcmSetVBlankHandler(vm::ptr<void(u32)> handler)
{
cellGcmSys.Warning("cellGcmSetVBlankHandler(handler=*0x%x)", handler);
Emu.GetGSManager().GetRender().m_vblank_handler = handler;
Emu.GetGSManager().GetRender().vblank_handler = handler;
}
s32 cellGcmSetWaitFlip(vm::ptr<CellGcmContextData> ctxt)
@ -625,26 +625,26 @@ s32 cellGcmSetZcull(u8 index, u32 offset, u32 width, u32 height, u32 cullStart,
cellGcmSys.Todo("cellGcmSetZcull(index=%d, offset=0x%x, width=%d, height=%d, cullStart=0x%x, zFormat=0x%x, aaFormat=0x%x, zCullDir=0x%x, zCullFormat=0x%x, sFunc=0x%x, sRef=0x%x, sMask=0x%x)",
index, offset, width, height, cullStart, zFormat, aaFormat, zCullDir, zCullFormat, sFunc, sRef, sMask);
if (index >= RSXThread::m_zculls_count)
if (index >= rsx::limits::zculls_count)
{
cellGcmSys.Error("cellGcmSetZcull: CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE;
}
auto& zcull = Emu.GetGSManager().GetRender().m_zculls[index];
zcull.m_offset = offset;
zcull.m_width = width;
zcull.m_height = height;
zcull.m_cullStart = cullStart;
zcull.m_zFormat = zFormat;
zcull.m_aaFormat = aaFormat;
zcull.m_zcullDir = zCullDir;
zcull.m_zcullFormat = zCullFormat;
zcull.m_sFunc = sFunc;
zcull.m_sRef = sRef;
zcull.m_sMask = sMask;
auto& zcull = Emu.GetGSManager().GetRender().zculls[index];
zcull.offset = offset;
zcull.width = width;
zcull.height = height;
zcull.cullStart = cullStart;
zcull.zFormat = zFormat;
zcull.aaFormat = aaFormat;
zcull.zcullDir = zCullDir;
zcull.zcullFormat = zCullFormat;
zcull.sFunc = sFunc;
zcull.sRef = sRef;
zcull.sMask = sMask;
vm::get_ptr<CellGcmZcullInfo>(Emu.GetGSManager().GetRender().m_zculls_addr)[index] = zcull.Pack();
vm::get_ptr<CellGcmZcullInfo>(Emu.GetGSManager().GetRender().zculls_addr)[index] = zcull.pack();
return CELL_OK;
}
@ -652,14 +652,14 @@ s32 cellGcmUnbindTile(u8 index)
{
cellGcmSys.Warning("cellGcmUnbindTile(index=%d)", index);
if (index >= RSXThread::m_tiles_count)
if (index >= rsx::limits::tiles_count)
{
cellGcmSys.Error("cellGcmUnbindTile: CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE;
}
auto& tile = Emu.GetGSManager().GetRender().m_tiles[index];
tile.m_binded = false;
auto& tile = Emu.GetGSManager().GetRender().tiles[index];
tile.binded = false;
return CELL_OK;
}
@ -674,8 +674,8 @@ s32 cellGcmUnbindZcull(u8 index)
return CELL_EINVAL;
}
auto& zcull = Emu.GetGSManager().GetRender().m_zculls[index];
zcull.m_binded = false;
auto& zcull = Emu.GetGSManager().GetRender().zculls[index];
zcull.binded = false;
return CELL_OK;
}
@ -683,31 +683,31 @@ s32 cellGcmUnbindZcull(u8 index)
u32 cellGcmGetTileInfo()
{
cellGcmSys.Warning("cellGcmGetTileInfo()");
return Emu.GetGSManager().GetRender().m_tiles_addr;
return Emu.GetGSManager().GetRender().tiles_addr;
}
u32 cellGcmGetZcullInfo()
{
cellGcmSys.Warning("cellGcmGetZcullInfo()");
return Emu.GetGSManager().GetRender().m_zculls_addr;
return Emu.GetGSManager().GetRender().zculls_addr;
}
u32 cellGcmGetDisplayInfo()
{
cellGcmSys.Warning("cellGcmGetDisplayInfo() = 0x%x", Emu.GetGSManager().GetRender().m_gcm_buffers_addr);
return Emu.GetGSManager().GetRender().m_gcm_buffers_addr;
cellGcmSys.Warning("cellGcmGetDisplayInfo() = 0x%x", Emu.GetGSManager().GetRender().gcm_buffers.addr());
return Emu.GetGSManager().GetRender().gcm_buffers.addr();
}
s32 cellGcmGetCurrentDisplayBufferId(vm::ptr<u8> id)
{
cellGcmSys.Warning("cellGcmGetCurrentDisplayBufferId(id=*0x%x)", id);
if (Emu.GetGSManager().GetRender().m_gcm_current_buffer > UINT8_MAX)
if (Emu.GetGSManager().GetRender().gcm_current_buffer > UINT8_MAX)
{
throw EXCEPTION("Unexpected");
}
*id = Emu.GetGSManager().GetRender().m_gcm_current_buffer;
*id = Emu.GetGSManager().GetRender().gcm_current_buffer;
return CELL_OK;
}
@ -739,7 +739,7 @@ u64 cellGcmGetLastFlipTime()
{
cellGcmSys.Log("cellGcmGetLastFlipTime()");
return Emu.GetGSManager().GetRender().m_last_flip_time;
return Emu.GetGSManager().GetRender().last_flip_time;
}
u64 cellGcmGetLastSecondVTime()
@ -752,7 +752,7 @@ u64 cellGcmGetVBlankCount()
{
cellGcmSys.Log("cellGcmGetVBlankCount()");
return Emu.GetGSManager().GetRender().m_vblank_count;
return Emu.GetGSManager().GetRender().vblank_count;
}
s32 cellGcmSysGetLastVBlankTime()
@ -895,7 +895,7 @@ s32 gcmMapEaIoAddress(u32 ea, u32 io, u32 size, bool is_strict)
{
offsetTable.ioAddress[(ea >> 20) + i] = (io >> 20) + i;
offsetTable.eaAddress[(io >> 20) + i] = (ea >> 20) + i;
Emu.GetGSManager().GetRender().m_strict_ordering[(io >> 20) + i] = is_strict;
Emu.GetGSManager().GetRender().strict_ordering[(io >> 20) + i] = is_strict;
}
}
else
@ -957,7 +957,7 @@ s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr<u32> offset)
{
offsetTable.ioAddress[(ea >> 20) + i] = (u16)((io >> 20) + i);
offsetTable.eaAddress[(io >> 20) + i] = (u16)((ea >> 20) + i);
Emu.GetGSManager().GetRender().m_strict_ordering[(io >> 20) + i] = false;
Emu.GetGSManager().GetRender().strict_ordering[(io >> 20) + i] = false;
}
*offset = io;
@ -968,7 +968,7 @@ s32 cellGcmMapMainMemory(u32 ea, u32 size, vm::ptr<u32> offset)
return CELL_GCM_ERROR_NO_IO_PAGE_TABLE;
}
Emu.GetGSManager().GetRender().m_main_mem_addr = Emu.GetGSManager().GetRender().m_ioAddress;
Emu.GetGSManager().GetRender().main_mem_addr = Emu.GetGSManager().GetRender().ioAddress;
return CELL_OK;
}
@ -1108,7 +1108,7 @@ s32 cellGcmSetCursorImageOffset(u32 offset)
void cellGcmSetDefaultCommandBuffer()
{
cellGcmSys.Warning("cellGcmSetDefaultCommandBuffer()");
vm::write32(Emu.GetGSManager().GetRender().m_ctxt_addr, gcm_info.context_addr);
vm::write32(Emu.GetGSManager().GetRender().ctxt_addr, gcm_info.context_addr);
}
s32 cellGcmSetDefaultCommandBufferAndSegmentWordSize()
@ -1142,7 +1142,7 @@ s32 cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
index, location, offset, size, pitch, comp, base, bank);
// Copied form cellGcmSetTileInfo
if (index >= RSXThread::m_tiles_count || base >= 800 || bank >= 4)
if (index >= rsx::limits::tiles_count || base >= 800 || bank >= 4)
{
cellGcmSys.Error("cellGcmSetTile: CELL_GCM_ERROR_INVALID_VALUE");
return CELL_GCM_ERROR_INVALID_VALUE;
@ -1165,16 +1165,16 @@ s32 cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
cellGcmSys.Error("cellGcmSetTile: bad compression mode! (%d)", comp);
}
auto& tile = Emu.GetGSManager().GetRender().m_tiles[index];
tile.m_location = location;
tile.m_offset = offset;
tile.m_size = size;
tile.m_pitch = pitch;
tile.m_comp = comp;
tile.m_base = base;
tile.m_bank = bank;
auto& tile = Emu.GetGSManager().GetRender().tiles[index];
tile.location = location;
tile.offset = offset;
tile.size = size;
tile.pitch = pitch;
tile.comp = comp;
tile.base = base;
tile.bank = bank;
vm::get_ptr<CellGcmTileInfo>(Emu.GetGSManager().GetRender().m_tiles_addr)[index] = tile.Pack();
vm::get_ptr<CellGcmTileInfo>(Emu.GetGSManager().GetRender().tiles_addr)[index] = tile.pack();
return CELL_OK;
}

View file

@ -467,7 +467,7 @@ void InitMembers()
void SetupRsxRenderingStates(vm::ptr<CellGcmContextData>& cntxt)
{
//TODO: use cntxt
GSRender& r = Emu.GetGSManager().GetRender();
/*GSRender& r = Emu.GetGSManager().GetRender();
r.m_set_color_mask = true; r.m_color_mask_a = r.m_color_mask_r = r.m_color_mask_g = r.m_color_mask_b = true;
r.m_set_depth_mask = true; r.m_depth_mask = 0;
r.m_set_alpha_test = false;
@ -502,7 +502,7 @@ void SetupRsxRenderingStates(vm::ptr<CellGcmContextData>& cntxt)
r.m_height = s_rescInternalInstance->m_dstHeight;
r.m_surface_depth_format = 2;
r.m_surface_color_target = 1;
r.m_surface_color_target = 1;*/
if (IsPalInterpolate())
{
@ -536,32 +536,32 @@ void SetupSurfaces(vm::ptr<CellGcmContextData>& cntxt)
dstOffset1 = s_rescInternalInstance->m_dstOffsets[s_rescInternalInstance->m_bufIdPalMidNow];
}
GSRender& r = Emu.GetGSManager().GetRender();
//GSRender& r = Emu.GetGSManager().GetRender();
r.m_surface_type = CELL_GCM_SURFACE_PITCH;
r.m_surface_antialias = CELL_GCM_SURFACE_CENTER_1;
r.m_surface_color_format = (u8)s_rescInternalInstance->m_pRescDsts->format;
r.m_surface_color_target = (!isMrt) ? CELL_GCM_SURFACE_TARGET_0 : CELL_GCM_SURFACE_TARGET_MRT1;
//surface.colorLocation[0] = CELL_GCM_LOCATION_LOCAL;
r.m_surface_offset_a = dstOffset0;
r.m_surface_pitch_a = s_rescInternalInstance->m_dstPitch;
//surface.colorLocation[1] = CELL_GCM_LOCATION_LOCAL;
r.m_surface_offset_b = (!isMrt) ? 0 : dstOffset1;
r.m_surface_pitch_b = (!isMrt) ? 64 : s_rescInternalInstance->m_dstPitch;
//surface.colorLocation[2] = CELL_GCM_LOCATION_LOCAL;
r.m_surface_offset_c = 0;
r.m_surface_pitch_c = 64;
//surface.colorLocation[3] = CELL_GCM_LOCATION_LOCAL;
r.m_surface_offset_d = 0;
r.m_surface_pitch_d = 64;
r.m_surface_depth_format = CELL_GCM_SURFACE_Z24S8;
//surface.depthLocation = CELL_GCM_LOCATION_LOCAL;
r.m_surface_offset_z = 0;
r.m_surface_pitch_z = 64;
r.m_surface_width = s_rescInternalInstance->m_dstWidth;
r.m_surface_height = s_rescInternalInstance->m_dstHeight;
r.m_surface_clip_x = 0;
r.m_surface_clip_y = 0;
//r.m_surface_type = CELL_GCM_SURFACE_PITCH;
//r.m_surface_antialias = CELL_GCM_SURFACE_CENTER_1;
//r.m_surface_color_format = (u8)s_rescInternalInstance->m_pRescDsts->format;
//r.m_surface_color_target = (!isMrt) ? CELL_GCM_SURFACE_TARGET_0 : CELL_GCM_SURFACE_TARGET_MRT1;
////surface.colorLocation[0] = CELL_GCM_LOCATION_LOCAL;
//r.m_surface_offset_a = dstOffset0;
//r.m_surface_pitch_a = s_rescInternalInstance->m_dstPitch;
////surface.colorLocation[1] = CELL_GCM_LOCATION_LOCAL;
//r.m_surface_offset_b = (!isMrt) ? 0 : dstOffset1;
//r.m_surface_pitch_b = (!isMrt) ? 64 : s_rescInternalInstance->m_dstPitch;
////surface.colorLocation[2] = CELL_GCM_LOCATION_LOCAL;
//r.m_surface_offset_c = 0;
//r.m_surface_pitch_c = 64;
////surface.colorLocation[3] = CELL_GCM_LOCATION_LOCAL;
//r.m_surface_offset_d = 0;
//r.m_surface_pitch_d = 64;
//r.m_surface_depth_format = CELL_GCM_SURFACE_Z24S8;
////surface.depthLocation = CELL_GCM_LOCATION_LOCAL;
//r.m_surface_offset_z = 0;
//r.m_surface_pitch_z = 64;
//r.m_surface_width = s_rescInternalInstance->m_dstWidth;
//r.m_surface_height = s_rescInternalInstance->m_dstHeight;
//r.m_surface_clip_x = 0;
//r.m_surface_clip_y = 0;
}
// Module<> Functions
@ -1075,21 +1075,21 @@ void cellRescSetFlipHandler(vm::ptr<void(u32)> handler)
{
cellResc.Warning("cellRescSetFlipHandler(handler=*0x%x)", handler);
Emu.GetGSManager().GetRender().m_flip_handler = handler;
Emu.GetGSManager().GetRender().flip_handler = handler;
}
void cellRescResetFlipStatus()
{
cellResc.Log("cellRescResetFlipStatus()");
Emu.GetGSManager().GetRender().m_flip_status = 1;
Emu.GetGSManager().GetRender().flip_status = 1;
}
s32 cellRescGetFlipStatus()
{
cellResc.Log("cellRescGetFlipStatus()");
return Emu.GetGSManager().GetRender().m_flip_status;
return Emu.GetGSManager().GetRender().flip_status;
}
s32 cellRescGetRegisterCount()
@ -1102,7 +1102,7 @@ u64 cellRescGetLastFlipTime()
{
cellResc.Log("cellRescGetLastFlipTime()");
return Emu.GetGSManager().GetRender().m_last_flip_time;
return Emu.GetGSManager().GetRender().last_flip_time;
}
s32 cellRescSetRegisterCount()
@ -1115,7 +1115,7 @@ void cellRescSetVBlankHandler(vm::ptr<void(u32)> handler)
{
cellResc.Warning("cellRescSetVBlankHandler(handler=*0x%x)", handler);
Emu.GetGSManager().GetRender().m_vblank_handler = handler;
Emu.GetGSManager().GetRender().vblank_handler = handler;
}
u16 FloatToHalf(float val)
@ -1142,7 +1142,7 @@ u16 FloatToHalf(float val)
return ((s >> 16) & 0x8000) | ((e << 10) & 0x7c00) | ((m >> 13) & 0x03ff);
}
static void blackman(float window[])
static void blackman(float (&window)[4])
{
const float x0 = ((1.f * 2.f*PI) / 5.f) - PI;
const float x1 = ((2.f * 2.f*PI) / 5.f) - PI;

View file

@ -215,7 +215,8 @@ void Emulator::Load()
LOG_NOTICE(LOADER, "Resolution: %s", Ini.ResolutionIdToString(Ini.GSResolution.GetValue()));
LOG_NOTICE(LOADER, "Write Depth Buffer: %s", Ini.GSDumpDepthBuffer.GetValue() ? "Yes" : "No");
LOG_NOTICE(LOADER, "Write Color Buffers: %s", Ini.GSDumpColorBuffers.GetValue() ? "Yes" : "No");
LOG_NOTICE(LOADER, "Read Color Buffer: %s", Ini.GSReadColorBuffer.GetValue() ? "Yes" : "No");
LOG_NOTICE(LOADER, "Read Color Buffers: %s", Ini.GSReadColorBuffers.GetValue() ? "Yes" : "No");
LOG_NOTICE(LOADER, "Read Depth Buffer: %s", Ini.GSReadDepthBuffer.GetValue() ? "Yes" : "No");
LOG_NOTICE(LOADER, "Audio Out: %s", Ini.AudioOutIdToString(Ini.AudioOutMode.GetValue()));
LOG_NOTICE(LOADER, "Log Everything: %s", Ini.HLELogging.GetValue() ? "Yes" : "No");
LOG_NOTICE(LOADER, "RSX Logging: %s", Ini.RSXLogging.GetValue() ? "Yes" : "No");

View file

@ -21,49 +21,45 @@ GLGSFrame::GLGSFrame()
canvas->Bind(wxEVT_LEFT_DCLICK, &GSFrame::OnLeftDclick, this);
}
GLGSFrame::~GLGSFrame()
{
}
void GLGSFrame::Close()
void GLGSFrame::close()
{
GSFrame::Close();
}
bool GLGSFrame::IsShown()
bool GLGSFrame::shown()
{
return GSFrame::IsShown();
}
void GLGSFrame::Hide()
void GLGSFrame::hide()
{
GSFrame::Hide();
}
void GLGSFrame::Show()
void GLGSFrame::show()
{
GSFrame::Show();
}
void* GLGSFrame::GetNewContext()
void* GLGSFrame::make_context()
{
return new wxGLContext(GetCanvas());
}
void GLGSFrame::SetCurrent(void* ctx)
void GLGSFrame::set_current(draw_context_t ctx)
{
GetCanvas()->SetCurrent(*(wxGLContext*)ctx);
GetCanvas()->SetCurrent(*(wxGLContext*)ctx.get());
}
void GLGSFrame::DeleteContext(void* ctx)
void GLGSFrame::delete_context(void* ctx)
{
delete (wxGLContext*)ctx;
}
void GLGSFrame::Flip(void* context)
void GLGSFrame::flip(draw_context_t context)
{
if (!canvas) return;
canvas->SetCurrent(*(wxGLContext*)context);
canvas->SetCurrent(*(wxGLContext*)context.get());
static Timer fps_t;
canvas->SwapBuffers();
@ -80,6 +76,12 @@ void GLGSFrame::Flip(void* context)
}
}
size2i GLGSFrame::client_size()
{
wxSize size = GetClientSize();
return{ size.GetWidth(), size.GetHeight() };
}
void GLGSFrame::OnSize(wxSizeEvent& event)
{
if (canvas) canvas->SetSize(GetClientSize());

View file

@ -9,18 +9,18 @@ struct GLGSFrame : public GSFrame, public GSFrameBase
u32 m_frames;
GLGSFrame();
~GLGSFrame();
virtual void Close() override;
void close() override;
virtual bool IsShown() override;
virtual void Hide() override;
virtual void Show() override;
bool shown() override;
void hide() override;
void show() override;
virtual void* GetNewContext() override;
virtual void SetCurrent(void* ctx) override;
virtual void DeleteContext(void* ctx) override;
virtual void Flip(void* context) override;
void* make_context() override;
void set_current(draw_context_t context) override;
void delete_context(void* context) override;
void flip(draw_context_t context) override;
size2i client_size() override;
wxGLCanvas* GetCanvas() const { return canvas; }

View file

@ -423,27 +423,29 @@ void MainFrame::ConfigLLEModules(wxCommandEvent& event)
void MainFrame::OpenELFCompiler(wxCommandEvent& WXUNUSED(event))
{
(new CompilerELF(this)) -> Show();
(new CompilerELF(this))->Show();
}
void MainFrame::OpenKernelExplorer(wxCommandEvent& WXUNUSED(event))
{
(new KernelExplorer(this)) -> Show();
(new KernelExplorer(this))->Show();
}
void MainFrame::OpenMemoryViewer(wxCommandEvent& WXUNUSED(event))
{
(new MemoryViewerPanel(this)) -> Show();
(new MemoryViewerPanel(this))->Show();
}
void MainFrame::OpenRSXDebugger(wxCommandEvent& WXUNUSED(event))
{
(new RSXDebugger(this)) -> Show();
#if _USE_RSX_DEBUGGER
(new RSXDebugger(this))->Show();
#endif
}
void MainFrame::OpenStringSearch(wxCommandEvent& WXUNUSED(event))
{
(new MemoryStringSearcher(this)) -> Show();
(new MemoryStringSearcher(this))->Show();
}
void MainFrame::OpenCgDisasm(wxCommandEvent& WXUNUSED(event))

View file

@ -1,11 +1,14 @@
#include "stdafx_gui.h"
#include "RSXDebugger.h"
#if _USE_RSX_DEBUGGER
#include "rpcs3/Ini.h"
#include "Utilities/rPlatform.h"
#include "Utilities/Log.h"
#include "Emu/Memory/Memory.h"
#include "Emu/System.h"
#include "RSXDebugger.h"
#include "Emu/SysCalls/Modules/cellVideoOut.h"
#include "Emu/RSX/GSManager.h"
#include "Emu/RSX/GSRender.h"
@ -1207,3 +1210,4 @@ bool RSXDebugger::RSXReady()
{
return Emu.GetGSManager().IsInited();
}
#endif

View file

@ -1,9 +1,10 @@
#pragma once
#define _USE_RSX_DEBUGGER 0
#if _USE_RSX_DEBUGGER
#include <wx/listctrl.h>
class RSXDebugger : public wxFrame
{
u32 m_addr;
@ -69,3 +70,5 @@ public:
bool RSXReady();
void SetPC(const uint pc) { m_addr = pc; }
};
#endif

View file

@ -118,7 +118,8 @@ SettingsDialog::SettingsDialog(wxWindow *parent)
wxCheckBox* chbox_gs_log_prog = new wxCheckBox(p_graphics, wxID_ANY, "Log shader programs");
wxCheckBox* chbox_gs_dump_depth = new wxCheckBox(p_graphics, wxID_ANY, "Write Depth Buffer");
wxCheckBox* chbox_gs_dump_color = new wxCheckBox(p_graphics, wxID_ANY, "Write Color Buffers");
wxCheckBox* chbox_gs_read_color = new wxCheckBox(p_graphics, wxID_ANY, "Read Color Buffer");
wxCheckBox* chbox_gs_read_color = new wxCheckBox(p_graphics, wxID_ANY, "Read Color Buffers");
wxCheckBox* chbox_gs_read_depth = new wxCheckBox(p_graphics, wxID_ANY, "Read Depth Buffer");
wxCheckBox* chbox_gs_vsync = new wxCheckBox(p_graphics, wxID_ANY, "VSync");
wxCheckBox* chbox_gs_debug_output = new wxCheckBox(p_graphics, wxID_ANY, "Debug Output");
wxCheckBox* chbox_gs_3dmonitor = new wxCheckBox(p_graphics, wxID_ANY, "3D Monitor");
@ -256,7 +257,8 @@ SettingsDialog::SettingsDialog(wxWindow *parent)
chbox_gs_log_prog->SetValue(Ini.GSLogPrograms.GetValue());
chbox_gs_dump_depth->SetValue(Ini.GSDumpDepthBuffer.GetValue());
chbox_gs_dump_color->SetValue(Ini.GSDumpColorBuffers.GetValue());
chbox_gs_read_color->SetValue(Ini.GSReadColorBuffer.GetValue());
chbox_gs_read_color->SetValue(Ini.GSReadColorBuffers.GetValue());
chbox_gs_read_depth->SetValue(Ini.GSReadDepthBuffer.GetValue());
chbox_gs_vsync->SetValue(Ini.GSVSyncEnable.GetValue());
chbox_gs_debug_output->SetValue(Ini.GSDebugOutputEnable.GetValue());
chbox_gs_3dmonitor->SetValue(Ini.GS3DTV.GetValue());
@ -346,9 +348,10 @@ SettingsDialog::SettingsDialog(wxWindow *parent)
s_subpanel_graphics1->Add(s_round_gs_render, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics1->Add(s_round_gs_res, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics1->Add(s_round_gs_d3d_adaptater, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics1->Add(chbox_gs_dump_depth, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics1->Add(chbox_gs_dump_color, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics1->Add(chbox_gs_read_color, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics1->Add(chbox_gs_dump_depth, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics1->Add(chbox_gs_read_depth, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics1->Add(chbox_gs_vsync, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics2->Add(s_round_gs_aspect, wxSizerFlags().Border(wxALL, 5).Expand());
s_subpanel_graphics2->Add(s_round_gs_frame_limit, wxSizerFlags().Border(wxALL, 5).Expand());
@ -437,7 +440,8 @@ SettingsDialog::SettingsDialog(wxWindow *parent)
Ini.GSLogPrograms.SetValue(chbox_gs_log_prog->GetValue());
Ini.GSDumpDepthBuffer.SetValue(chbox_gs_dump_depth->GetValue());
Ini.GSDumpColorBuffers.SetValue(chbox_gs_dump_color->GetValue());
Ini.GSReadColorBuffer.SetValue(chbox_gs_read_color->GetValue());
Ini.GSReadColorBuffers.SetValue(chbox_gs_read_color->GetValue());
Ini.GSReadDepthBuffer.SetValue(chbox_gs_read_depth->GetValue());
Ini.GSVSyncEnable.SetValue(chbox_gs_vsync->GetValue());
Ini.GSDebugOutputEnable.SetValue(chbox_gs_debug_output->GetValue());
Ini.GS3DTV.SetValue(chbox_gs_3dmonitor->GetValue());

View file

@ -111,7 +111,8 @@ public:
IniEntry<bool> GSLogPrograms;
IniEntry<bool> GSDumpColorBuffers;
IniEntry<bool> GSDumpDepthBuffer;
IniEntry<bool> GSReadColorBuffer;
IniEntry<bool> GSReadColorBuffers;
IniEntry<bool> GSReadDepthBuffer;
IniEntry<bool> GSVSyncEnable;
IniEntry<bool> GS3DTV;
IniEntry<bool> GSDebugOutputEnable;
@ -202,16 +203,17 @@ public:
GSLogPrograms.Init("GS_LogPrograms", path);
GSDumpColorBuffers.Init("GS_DumpColorBuffers", path);
GSDumpDepthBuffer.Init("GS_DumpDepthBuffer", path);
GSReadColorBuffer.Init("GS_GSReadColorBuffer", path);
GSReadColorBuffers.Init("GS_ReadColorBuffer", path);
GSReadDepthBuffer.Init("GS_ReadDepthBuffer", path);
GSVSyncEnable.Init("GS_VSyncEnable", path);
GSDebugOutputEnable.Init("GS_DebugOutputEnable", path);
GS3DTV.Init("GS_3DTV", path);
GSOverlay.Init("GS_Overlay", path);
// Audio
AudioOutMode.Init("Audio_AudioOutMode", path);
AudioDumpToFile.Init("Audio_AudioDumpToFile", path);
AudioConvertToU16.Init("Audio_AudioConvertToU16", path);
AudioOutMode.Init("Audio_OutMode", path);
AudioDumpToFile.Init("Audio_DumpToFile", path);
AudioConvertToU16.Init("Audio_ConvertToU16", path);
// Camera
Camera.Init("Camera", path);
@ -289,7 +291,8 @@ public:
GSLogPrograms.Load(false);
GSDumpColorBuffers.Load(false);
GSDumpDepthBuffer.Load(false);
GSReadColorBuffer.Load(false);
GSReadColorBuffers.Load(false);
GSReadDepthBuffer.Load(false);
GSVSyncEnable.Load(false);
GSDebugOutputEnable.Load(false);
GS3DTV.Load(false);
@ -376,7 +379,8 @@ public:
GSLogPrograms.Save();
GSDumpColorBuffers.Save();
GSDumpDepthBuffer.Save();
GSReadColorBuffer.Save();
GSReadColorBuffers.Save();
GSReadDepthBuffer.Save();
GSVSyncEnable.Save();
GSDebugOutputEnable.Save();
GS3DTV.Save();

View file

@ -60,10 +60,8 @@
<ClCompile Include="Emu\IdManager.cpp" />
<ClCompile Include="Emu\RSX\CgBinaryFragmentProgram.cpp" />
<ClCompile Include="Emu\RSX\CgBinaryVertexProgram.cpp" />
<ClCompile Include="Emu\RSX\Common\BufferUtils.cpp" />
<ClCompile Include="Emu\RSX\Common\FragmentProgramDecompiler.cpp" />
<ClCompile Include="Emu\RSX\Common\ShaderParam.cpp" />
<ClCompile Include="Emu\RSX\Common\TextureUtils.cpp" />
<ClCompile Include="Emu\RSX\Common\VertexProgramDecompiler.cpp" />
<ClCompile Include="Emu\RSX\D3D12\D3D12Buffer.cpp" />
<ClCompile Include="Emu\RSX\D3D12\D3D12FragmentProgramDecompiler.cpp" />
@ -76,6 +74,7 @@
<ClCompile Include="Emu\RSX\D3D12\D3D12VertexProgramDecompiler.cpp" />
<ClCompile Include="Emu\RSX\D3D12\D3D12CommonDecompiler.cpp" />
<ClCompile Include="Emu\RSX\GL\GLCommonDecompiler.cpp" />
<ClCompile Include="Emu\RSX\GL\gl_helpers.cpp" />
<ClCompile Include="Emu\SysCalls\lv2\sys_dbg.cpp" />
<ClCompile Include="Emu\SysCalls\lv2\sys_fs.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellAtracMulti.cpp" />
@ -393,6 +392,7 @@
<ClInclude Include="..\Utilities\StrFmt.h" />
<ClInclude Include="..\Utilities\Thread.h" />
<ClInclude Include="..\Utilities\Timer.h" />
<ClInclude Include="..\Utilities\types.h" />
<ClInclude Include="..\Utilities\VirtualMemory.h" />
<ClInclude Include="Crypto\aes.h" />
<ClInclude Include="Crypto\ec.h" />
@ -531,11 +531,9 @@
<ClInclude Include="Emu\Memory\Memory.h" />
<ClInclude Include="Emu\Memory\MemoryBlock.h" />
<ClInclude Include="Emu\RSX\CgBinaryProgram.h" />
<ClInclude Include="Emu\RSX\Common\BufferUtils.h" />
<ClInclude Include="Emu\RSX\Common\FragmentProgramDecompiler.h" />
<ClInclude Include="Emu\RSX\Common\ProgramStateCache.h" />
<ClInclude Include="Emu\RSX\Common\ShaderParam.h" />
<ClInclude Include="Emu\RSX\Common\TextureUtils.h" />
<ClInclude Include="Emu\RSX\Common\VertexProgramDecompiler.h" />
<ClInclude Include="Emu\RSX\D3D12\D3D12.h" />
<ClInclude Include="Emu\RSX\D3D12\D3D12Buffer.h" />
@ -556,6 +554,7 @@
<ClInclude Include="Emu\RSX\GL\GLProgram.h" />
<ClInclude Include="Emu\RSX\GL\GLProgramBuffer.h" />
<ClInclude Include="Emu\RSX\GL\GLVertexProgram.h" />
<ClInclude Include="Emu\RSX\GL\gl_helpers.h" />
<ClInclude Include="Emu\RSX\GL\OpenGL.h" />
<ClInclude Include="Emu\RSX\GSManager.h" />
<ClInclude Include="Emu\RSX\GSRender.h" />
@ -770,55 +769,55 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include</IncludePath>
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include;..\glm</IncludePath>
<IntDir>$(Platform)\$(Configuration)\emucore\</IntDir>
<LibraryPath>$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - DX12|x64'">
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include</IncludePath>
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include;..\glm</IncludePath>
<IntDir>$(Platform)\$(Configuration)\emucore\</IntDir>
<LibraryPath>$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include</IncludePath>
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include;..\glm</IncludePath>
<IntDir>$(Platform)\$(Configuration)\emucore\</IntDir>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM DX12|x64'">
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include</IncludePath>
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include;..\glm</IncludePath>
<IntDir>$(Platform)\$(Configuration)\emucore\</IntDir>
<LibraryPath>$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - MemLeak|x64'">
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include</IncludePath>
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include;..\glm</IncludePath>
<IntDir>$(Platform)\$(Configuration)\emucore\</IntDir>
<LibraryPath>$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include</IncludePath>
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include;..\glm</IncludePath>
<IntDir>$(Platform)\$(Configuration)\emucore\</IntDir>
<LibraryPath>$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release - DX12|x64'">
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include</IncludePath>
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include;..\glm</IncludePath>
<IntDir>$(Platform)\$(Configuration)\emucore\</IntDir>
<LibraryPath>$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include</IncludePath>
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include;..\glm</IncludePath>
<IntDir>$(Platform)\$(Configuration)\emucore\</IntDir>
<LibraryPath>$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release - LLVM DX12|x64'">
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include</IncludePath>
<IncludePath>.\;..\;..\asmjit\src\asmjit;..\wxWidgets\include\msvc;..\wxWidgets\include;.\OpenAL\include;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);..\llvm\include;..\llvm_build\include;$(UniversalCRT_IncludePath);..\minidx9\Include;..\glm</IncludePath>
<IntDir>$(Platform)\$(Configuration)\emucore\</IntDir>
<LibraryPath>$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<ExcludePath>$(ExcludePath)</ExcludePath>

View file

@ -989,11 +989,8 @@
<ClCompile Include="..\Utilities\SharedMutex.cpp">
<Filter>Utilities</Filter>
</ClCompile>
<ClCompile Include="Emu\RSX\Common\TextureUtils.cpp">
<Filter>Emu\GPU\RSX\Common</Filter>
</ClCompile>
<ClCompile Include="Emu\RSX\Common\BufferUtils.cpp">
<Filter>Emu\GPU\RSX\Common</Filter>
<ClCompile Include="Emu\RSX\GL\gl_helpers.cpp">
<Filter>Emu\GPU\RSX\GL</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
@ -1888,11 +1885,11 @@
<ClInclude Include="Emu\RSX\D3D12\d3dx12.h">
<Filter>Emu\GPU\RSX\D3D12</Filter>
</ClInclude>
<ClInclude Include="Emu\RSX\Common\TextureUtils.h">
<Filter>Emu\GPU\RSX\Common</Filter>
<ClInclude Include="Emu\RSX\GL\gl_helpers.h">
<Filter>Emu\GPU\RSX\GL</Filter>
</ClInclude>
<ClInclude Include="Emu\RSX\Common\BufferUtils.h">
<Filter>Emu\GPU\RSX\Common</Filter>
<ClInclude Include="..\Utilities\types.h">
<Filter>Utilities</Filter>
</ClInclude>
</ItemGroup>
</Project>

View file

@ -139,38 +139,38 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath)</IncludePath>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath);..\glm</IncludePath>
<OutDir>$(SolutionDir)bin\</OutDir>
<LibraryPath>..\libs\$(Configuration)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<TargetName>$(ProjectName)-dbg</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM|x64'">
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath)</IncludePath>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath);..\glm</IncludePath>
<OutDir>$(SolutionDir)bin\</OutDir>
<LibraryPath>..\libs\$(Configuration)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<TargetName>$(ProjectName)-dbg</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - DX12|x64'">
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath)</IncludePath>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath);..\glm</IncludePath>
<OutDir>$(SolutionDir)bin\</OutDir>
<LibraryPath>..\libs\Debug\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<TargetName>$(ProjectName)-dbg</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - LLVM DX12|x64'">
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath)</IncludePath>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath);..\glm</IncludePath>
<OutDir>$(SolutionDir)bin\</OutDir>
<LibraryPath>..\libs\Debug\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<TargetName>$(ProjectName)-dbg</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug - MemLeak|x64'">
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(UniversalCRT_IncludePath);$(IncludePath)</IncludePath>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(UniversalCRT_IncludePath);$(IncludePath);..\glm</IncludePath>
<OutDir>$(SolutionDir)bin\</OutDir>
<LibraryPath>..\libs\Debug\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<TargetName>$(ProjectName)-dbg</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath)</IncludePath>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath);..\glm</IncludePath>
<OutDir>$(SolutionDir)bin\</OutDir>
<LibraryPath>..\libs\$(Configuration)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<LinkIncremental>false</LinkIncremental>
@ -178,7 +178,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release - LLVM|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath)</IncludePath>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath);..\glm</IncludePath>
<OutDir>$(SolutionDir)bin\</OutDir>
<LibraryPath>..\libs\$(Configuration)\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<LinkIncremental>false</LinkIncremental>
@ -186,7 +186,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release - DX12|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath)</IncludePath>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath);..\glm</IncludePath>
<OutDir>$(SolutionDir)bin\</OutDir>
<LibraryPath>..\libs\Release\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<LinkIncremental>false</LinkIncremental>
@ -194,7 +194,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release - LLVM DX12|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath)</IncludePath>
<IncludePath>.\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath);..\asmjit\src\asmjit;$(UniversalCRT_IncludePath);..\glm</IncludePath>
<OutDir>$(SolutionDir)bin\</OutDir>
<LibraryPath>..\libs\Release\;$(UniversalCRT_LibraryPath_x64);$(LibraryPath)</LibraryPath>
<LinkIncremental>false</LinkIncremental>