int draw offsets.
This commit is contained in:
parent
92f1a7cb40
commit
d695f637a8
|
@ -207,8 +207,8 @@ struct SavedState {
|
|||
}
|
||||
};
|
||||
|
||||
void Blitter::Draw(GLuint src_texture, uint32_t src_x, uint32_t src_y,
|
||||
uint32_t src_width, uint32_t src_height, GLenum filter) {
|
||||
void Blitter::Draw(GLuint src_texture, int32_t src_x, int32_t src_y,
|
||||
int32_t src_width, int32_t src_height, GLenum filter) {
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glDisablei(GL_BLEND, 0);
|
||||
|
@ -246,11 +246,10 @@ void Blitter::Draw(GLuint src_texture, uint32_t src_x, uint32_t src_y,
|
|||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
void Blitter::BlitTexture2D(GLuint src_texture, uint32_t src_x, uint32_t src_y,
|
||||
uint32_t src_width, uint32_t src_height,
|
||||
uint32_t dest_x, uint32_t dest_y,
|
||||
uint32_t dest_width, uint32_t dest_height,
|
||||
GLenum filter) {
|
||||
void Blitter::BlitTexture2D(GLuint src_texture, int32_t src_x, int32_t src_y,
|
||||
int32_t src_width, int32_t src_height,
|
||||
int32_t dest_x, int32_t dest_y, int32_t dest_width,
|
||||
int32_t dest_height, GLenum filter) {
|
||||
SavedState state;
|
||||
state.Save();
|
||||
|
||||
|
@ -265,11 +264,11 @@ void Blitter::BlitTexture2D(GLuint src_texture, uint32_t src_x, uint32_t src_y,
|
|||
state.Restore();
|
||||
}
|
||||
|
||||
void Blitter::CopyColorTexture2D(GLuint src_texture, uint32_t src_x,
|
||||
uint32_t src_y, uint32_t src_width,
|
||||
uint32_t src_height, uint32_t dest_texture,
|
||||
uint32_t dest_x, uint32_t dest_y,
|
||||
uint32_t dest_width, uint32_t dest_height,
|
||||
void Blitter::CopyColorTexture2D(GLuint src_texture, int32_t src_x,
|
||||
int32_t src_y, int32_t src_width,
|
||||
int32_t src_height, GLuint dest_texture,
|
||||
int32_t dest_x, int32_t dest_y,
|
||||
int32_t dest_width, int32_t dest_height,
|
||||
GLenum filter) {
|
||||
SavedState state;
|
||||
state.Save();
|
||||
|
@ -292,11 +291,11 @@ void Blitter::CopyColorTexture2D(GLuint src_texture, uint32_t src_x,
|
|||
state.Restore();
|
||||
}
|
||||
|
||||
void Blitter::CopyDepthTexture(GLuint src_texture, uint32_t src_x,
|
||||
uint32_t src_y, uint32_t src_width,
|
||||
uint32_t src_height, uint32_t dest_texture,
|
||||
uint32_t dest_x, uint32_t dest_y,
|
||||
uint32_t dest_width, uint32_t dest_height) {
|
||||
void Blitter::CopyDepthTexture(GLuint src_texture, int32_t src_x, int32_t src_y,
|
||||
int32_t src_width, int32_t src_height,
|
||||
GLuint dest_texture, int32_t dest_x,
|
||||
int32_t dest_y, int32_t dest_width,
|
||||
int32_t dest_height) {
|
||||
SavedState state;
|
||||
state.Save();
|
||||
|
||||
|
|
|
@ -27,24 +27,24 @@ class Blitter {
|
|||
bool Initialize();
|
||||
void Shutdown();
|
||||
|
||||
void BlitTexture2D(GLuint src_texture, uint32_t src_x, uint32_t src_y,
|
||||
uint32_t src_width, uint32_t src_height, uint32_t dest_x,
|
||||
uint32_t dest_y, uint32_t dest_width, uint32_t dest_height,
|
||||
void BlitTexture2D(GLuint src_texture, int32_t src_x, int32_t src_y,
|
||||
int32_t src_width, int32_t src_height, int32_t dest_x,
|
||||
int32_t dest_y, int32_t dest_width, int32_t dest_height,
|
||||
GLenum filter);
|
||||
|
||||
void CopyColorTexture2D(GLuint src_texture, uint32_t src_x, uint32_t src_y,
|
||||
uint32_t src_width, uint32_t src_height,
|
||||
uint32_t dest_texture, uint32_t dest_x,
|
||||
uint32_t dest_y, uint32_t dest_width,
|
||||
uint32_t dest_height, GLenum filter);
|
||||
void CopyDepthTexture(GLuint src_texture, uint32_t src_x, uint32_t src_y,
|
||||
uint32_t src_width, uint32_t src_height,
|
||||
uint32_t dest_texture, uint32_t dest_x, uint32_t dest_y,
|
||||
uint32_t dest_width, uint32_t dest_height);
|
||||
void CopyColorTexture2D(GLuint src_texture, int32_t src_x, int32_t src_y,
|
||||
int32_t src_width, int32_t src_height,
|
||||
GLuint dest_texture, int32_t dest_x, int32_t dest_y,
|
||||
int32_t dest_width, int32_t dest_height,
|
||||
GLenum filter);
|
||||
void CopyDepthTexture(GLuint src_texture, int32_t src_x, int32_t src_y,
|
||||
int32_t src_width, int32_t src_height,
|
||||
GLuint dest_texture, int32_t dest_x, int32_t dest_y,
|
||||
int32_t dest_width, int32_t dest_height);
|
||||
|
||||
private:
|
||||
void Draw(GLuint src_texture, uint32_t src_x, uint32_t src_y,
|
||||
uint32_t src_width, uint32_t src_height, GLenum filter);
|
||||
void Draw(GLuint src_texture, int32_t src_x, int32_t src_y, int32_t src_width,
|
||||
int32_t src_height, GLenum filter);
|
||||
|
||||
GLuint vertex_program_;
|
||||
GLuint color_fragment_program_;
|
||||
|
|
|
@ -1865,9 +1865,6 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateViewportState() {
|
|||
uint32_t window_offset = regs[XE_GPU_REG_PA_SC_WINDOW_OFFSET].u32;
|
||||
window_offset_x = window_offset & 0x7FFF;
|
||||
window_offset_y = (window_offset >> 16) & 0x7FFF;
|
||||
draw_batcher_.set_window_offset(window_offset_x, window_offset_y);
|
||||
} else {
|
||||
draw_batcher_.set_window_offset(0, 0);
|
||||
}
|
||||
|
||||
// http://www.x.org/docs/AMD/old/evergreen_3D_registers_v2.pdf
|
||||
|
|
|
@ -77,13 +77,9 @@ class DrawBatcher {
|
|||
|
||||
PrimitiveType prim_type() const { return batch_state_.prim_type; }
|
||||
|
||||
void set_window_offset(uint32_t x, uint32_t y) {
|
||||
active_draw_.header->window_offset.x = float(x);
|
||||
active_draw_.header->window_offset.y = float(y);
|
||||
}
|
||||
void set_window_scalar(float width_scalar, float height_scalar) {
|
||||
active_draw_.header->window_offset.z = width_scalar;
|
||||
active_draw_.header->window_offset.w = height_scalar;
|
||||
active_draw_.header->window_scale.x = width_scalar;
|
||||
active_draw_.header->window_scale.y = height_scalar;
|
||||
}
|
||||
void set_vtx_fmt(float xy, float z, float w) {
|
||||
active_draw_.header->vtx_fmt.x = xy;
|
||||
|
@ -175,7 +171,7 @@ class DrawBatcher {
|
|||
|
||||
// This must match GL4Shader's header.
|
||||
struct CommonHeader {
|
||||
float4 window_offset; // tx,ty,sx,sy
|
||||
float4 window_scale; // sx,sy, ?, ?
|
||||
float4 vtx_fmt; //
|
||||
float4 alpha_test; // alpha test enable, func, ref, ?
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ std::string GL4Shader::GetHeader() {
|
|||
"\n"
|
||||
// This must match DrawBatcher::CommonHeader.
|
||||
"struct StateData {\n"
|
||||
" vec4 window_offset;\n"
|
||||
" vec4 window_scale;\n"
|
||||
" vec4 vtx_fmt;\n"
|
||||
" vec4 alpha_test;\n"
|
||||
// TODO(benvanik): variable length.
|
||||
|
@ -196,7 +196,7 @@ bool GL4Shader::PrepareVertexShader(
|
|||
" // Already multiplied by 1/W0, so pull it out.\n"
|
||||
" pos.z /= pos.w;\n"
|
||||
" }\n"
|
||||
" pos.xy *= state.window_offset.zw;\n"
|
||||
" pos.xy *= state.window_scale.xy;\n"
|
||||
" return pos;\n"
|
||||
"}\n";
|
||||
std::string source =
|
||||
|
|
|
@ -524,16 +524,16 @@ TextureCache::TextureEntry* TextureCache::LookupAddress(uint32_t guest_address,
|
|||
}
|
||||
|
||||
GLuint TextureCache::CopyTexture(Blitter* blitter, uint32_t guest_address,
|
||||
uint32_t x, uint32_t y, uint32_t width,
|
||||
uint32_t height, TextureFormat format,
|
||||
int32_t x, int32_t y, int32_t width,
|
||||
int32_t height, TextureFormat format,
|
||||
bool swap_channels, GLuint src_texture) {
|
||||
return ConvertTexture(blitter, guest_address, x, y, width, height, format,
|
||||
swap_channels, src_texture);
|
||||
}
|
||||
|
||||
GLuint TextureCache::ConvertTexture(Blitter* blitter, uint32_t guest_address,
|
||||
uint32_t x, uint32_t y, uint32_t width,
|
||||
uint32_t height, TextureFormat format,
|
||||
int32_t x, int32_t y, int32_t width,
|
||||
int32_t height, TextureFormat format,
|
||||
bool swap_channels, GLuint src_texture) {
|
||||
const auto& config = texture_configs[uint32_t(format)];
|
||||
if (config.format == GL_INVALID_ENUM) {
|
||||
|
|
|
@ -59,12 +59,12 @@ class TextureCache {
|
|||
TextureEntryView* Demand(const TextureInfo& texture_info,
|
||||
const SamplerInfo& sampler_info);
|
||||
|
||||
GLuint CopyTexture(Blitter* blitter, uint32_t guest_address, uint32_t x,
|
||||
uint32_t y, uint32_t width, uint32_t height,
|
||||
GLuint CopyTexture(Blitter* blitter, uint32_t guest_address, int32_t x,
|
||||
int32_t y, int32_t width, int32_t height,
|
||||
TextureFormat format, bool swap_channels,
|
||||
GLuint src_texture);
|
||||
GLuint ConvertTexture(Blitter* blitter, uint32_t guest_address, uint32_t x,
|
||||
uint32_t y, uint32_t width, uint32_t height,
|
||||
GLuint ConvertTexture(Blitter* blitter, uint32_t guest_address, int32_t x,
|
||||
int32_t y, int32_t width, int32_t height,
|
||||
TextureFormat format, bool swap_channels,
|
||||
GLuint src_texture);
|
||||
|
||||
|
|
Loading…
Reference in New Issue