22 glUniform1i(p.getUniformLocation(
"edgeTex"), 2);
23 glUniform1i(p.getUniformLocation(
"offsetTex"), 3);
29 glTexImage2D(GL_TEXTURE_2D,
38#if OPENGL_VERSION >= OPENGL_3_3
39 GLint swizzleMask1[] = {GL_RED, GL_RED, GL_RED, GL_GREEN};
40 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask1);
45 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
46 std::string offsetName =
"shaders/HQ_xLiteOffsets.dat";
49 offsetName[10] = narrow<char>(
'0' + n);
51 offsetTexture[i].bind();
52 glTexImage2D(GL_TEXTURE_2D,
60 offsetFile.
mmap().data());
61#if OPENGL_VERSION >= OPENGL_3_3
62 GLint swizzleMask2[] = {GL_RED, GL_RED, GL_RED, GL_GREEN};
63 glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask2);
66 glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
71 unsigned srcStartY,
unsigned srcEndY,
unsigned srcWidth,
72 unsigned dstStartY,
unsigned dstEndY,
unsigned dstWidth,
73 unsigned logSrcHeight)
75 unsigned factorX = dstWidth / srcWidth;
76 unsigned factorY = (dstEndY - dstStartY) / (srcEndY - srcStartY);
78 if ((srcWidth == 320) && (factorX > 1) && (factorX == factorY)) {
79 setup(superImpose !=
nullptr);
81 glActiveTexture(GL_TEXTURE3);
82 offsetTexture[factorX - 2].bind();
83 glActiveTexture(GL_TEXTURE2);
85 glActiveTexture(GL_TEXTURE0);
87 srcStartY, srcEndY, srcWidth,
88 dstStartY, dstEndY, dstWidth,
93 srcStartY, srcEndY, srcWidth,
94 dstStartY, dstEndY, dstWidth,
99using Pixel = uint32_t;
101 unsigned srcStartY,
unsigned srcEndY,
unsigned lineWidth,
104 if ((lineWidth != 320) || (srcEndY > 240))
return;
114 auto curr = paintFrame.
getLine(narrow<int>(srcStartY) - 1, buf1);
115 auto next = paintFrame.
getLine(narrow<int>(srcStartY) + 0, buf2);
119 if (
auto* mapped = edgeBuffer.
mapWrite()) {
120 for (
auto y :
xrange(srcStartY, srcEndY)) {
123 next = paintFrame.
getLine(narrow<int>(y + 1), buf2);
125 memcpy(mapped + 320 *
size_t(y), tmpBuf2.data(), 320 *
sizeof(uint16_t));
131 glTexSubImage2D(GL_TEXTURE_2D,
134 narrow<GLint>(srcStartY),
135 narrow<GLint>(lineWidth),
136 narrow<GLint>(srcEndY - srcStartY),
void unmap() const
Unmaps the contents of this buffer.
void unbind() const
Unbind this buffer.
void setImage(GLuint width, GLuint height)
Sets the image for this buffer.
T * getOffset(GLuint x, GLuint y)
Gets a pointer relative to the start of this buffer.
void bind() const
Bind this PixelBuffer.
T * mapWrite()
Maps the contents of this buffer into memory.
void setInterpolation(bool interpolation)
Enable/disable bilinear interpolation for this texture.
void bind()
Makes this texture the active GL texture.
std::span< const uint8_t > mmap()
Map file in memory.
Interface for getting lines from a video frame.
std::span< const Pixel > getLine(int line, std::span< Pixel > buf) const
Gets a pointer to the pixels of the given line number.
void uploadBlock(unsigned srcStartY, unsigned srcEndY, unsigned lineWidth, FrameSource &paintFrame) override
GLHQLiteScaler(GLScaler &fallback)
void scaleImage(gl::ColorTexture &src, gl::ColorTexture *superImpose, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, unsigned dstStartY, unsigned dstEndY, unsigned dstWidth, unsigned logSrcHeight) override
Scales the image in the given area, which must consist of lines which are all equally wide.
Abstract base class for OpenGL scalers.
void setup(bool superImpose)
Setup scaler.
std::array< gl::ShaderProgram, 2 > program
void execute(gl::ColorTexture &src, gl::ColorTexture *superImpose, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, unsigned dstStartY, unsigned dstEndY, unsigned dstWidth, unsigned logSrcHeight, bool textureFromZero=false)
Helper method to draw a rectangle with multiple texture coordinates.
virtual void scaleImage(gl::ColorTexture &src, gl::ColorTexture *superImpose, unsigned srcStartY, unsigned srcEndY, unsigned srcWidth, unsigned dstStartY, unsigned dstEndY, unsigned dstWidth, unsigned logSrcHeight)=0
Scales the image in the given area, which must consist of lines which are all equally wide.
EndianT< uint32_t, ConvLittle< BIG > > L32
std::optional< Context > context
void format(SectorAccessibleDisk &disk, MSXBootSectorType bootType)
Format the given disk (= a single partition).
This file implemented 3 utility functions:
const FileContext & systemFileContext()
CharacterConverter::Pixel Pixel
void calcEdgesGL(std::span< const uint32_t > curr, std::span< const uint32_t > next, std::span< Endian::L32 > edges2, EdgeOp edgeOp)
constexpr void fill(ForwardRange &&range, const T &value)
void swap(openmsx::MemBuffer< T > &l, openmsx::MemBuffer< T > &r) noexcept
#define VLA_SSE_ALIGNED(TYPE, NAME, LENGTH)
constexpr auto xrange(T e)