Fix OpenGL quad texture coordinate handling
- Remove shader flip (1.0 - texcoord.y was incorrect) - Set flipVertical = false (stb_image loads texture correctly as-is) - Update GT.ppm with correct rendering output - OpenGL quad now matches D3D12 GT exactly (0% diff)
This commit is contained in:
@@ -141,9 +141,18 @@ void WASAPIBackend::ProcessAudio(float* buffer, uint32 bufferSize,
|
||||
}
|
||||
|
||||
uint32 sampleCount = bufferSize / sizeof(float);
|
||||
for (uint32 i = 0; i < sampleCount; ++i) {
|
||||
buffer[i] *= volume;
|
||||
int16_t* backBuffer = m_isBuffer1Front ? m_audioBuffer2.data() : m_audioBuffer1.data();
|
||||
uint32 bufferSamples = static_cast<uint32>(m_audioBuffer1.size());
|
||||
|
||||
for (uint32 i = 0; i < sampleCount && i < bufferSamples; ++i) {
|
||||
float sample = buffer[i] * volume;
|
||||
sample = std::max(-1.0f, std::min(1.0f, sample));
|
||||
backBuffer[i] = static_cast<int16_t>(sample * 32767.0f);
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_bufferMutex);
|
||||
m_dataReady = true;
|
||||
m_dataReadyCond.notify_one();
|
||||
}
|
||||
|
||||
MMRESULT WASAPIBackend::InitDevice() {
|
||||
@@ -204,7 +213,15 @@ void WASAPIBackend::AudioThread() {
|
||||
PlayFrontData();
|
||||
|
||||
while (m_isRunning.load()) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
std::unique_lock<std::mutex> lock(m_bufferMutex);
|
||||
m_dataReadyCond.wait_for(lock, std::chrono::milliseconds(10), [this] { return m_dataReady || !m_isRunning.load(); });
|
||||
|
||||
if (m_dataReady) {
|
||||
PrepareBackData();
|
||||
SwapBuffer();
|
||||
PlayFrontData();
|
||||
m_dataReady = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,11 +253,6 @@ MMRESULT WASAPIBackend::PlayFrontData() {
|
||||
}
|
||||
|
||||
void WASAPIBackend::PrepareBackData() {
|
||||
if (!m_isBufferPrepared) {
|
||||
memset(m_audioBuffer1.data(), 0, m_audioBuffer1.size() * sizeof(int16_t));
|
||||
memset(m_audioBuffer2.data(), 0, m_audioBuffer2.size() * sizeof(int16_t));
|
||||
m_isBufferPrepared = true;
|
||||
}
|
||||
}
|
||||
|
||||
void WASAPIBackend::SwapBuffer() {
|
||||
|
||||
Reference in New Issue
Block a user