am a22a71f1: am 27f6f9f6: Remove GLES3 attribute location aliasing tests from must pass set
* commit 'a22a71f136a1417d29c59df0e0ef246670ef0037':
Remove GLES3 attribute location aliasing tests from must pass set
diff --git a/android/scripts/common.py b/android/scripts/common.py
index 241cecf..ec9afb9 100644
--- a/android/scripts/common.py
+++ b/android/scripts/common.py
@@ -121,7 +121,7 @@
process = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdoutJob = threading.Thread(target=readApplyPrefixAndPrint, args=(process.stdout, linePrefix, sys.stdout))
- stderrJob = threading.Thread(target=readApplyPrefixAndPrint, args=(process.stdout, linePrefix, sys.stderr))
+ stderrJob = threading.Thread(target=readApplyPrefixAndPrint, args=(process.stderr, linePrefix, sys.stderr))
stdoutJob.start()
stderrJob.start()
retcode = process.wait()
diff --git a/execserver/tools/xsClient.cpp b/execserver/tools/xsClient.cpp
index eb71fe6..e680fc9 100644
--- a/execserver/tools/xsClient.cpp
+++ b/execserver/tools/xsClient.cpp
@@ -67,11 +67,11 @@
message.write(buf);
// Write to socket.
- int pos = 0;
- while (pos < (int)buf.size())
+ size_t pos = 0;
+ while (pos < buf.size())
{
- int numLeft = (int)buf.size() - pos;
- int numSent = 0;
+ size_t numLeft = buf.size() - pos;
+ size_t numSent = 0;
deSocketResult result = socket.send(&buf[pos], numLeft, &numSent);
if (result != DE_SOCKETRESULT_SUCCESS)
@@ -81,14 +81,14 @@
}
}
-void readBytes (de::Socket& socket, vector<deUint8>& dst, int numBytes)
+void readBytes (de::Socket& socket, vector<deUint8>& dst, size_t numBytes)
{
- int numRead = 0;
+ size_t numRead = 0;
dst.resize(numBytes);
while (numRead < numBytes)
{
- int numLeft = numBytes - numRead;
- int curNumRead = 0;
+ size_t numLeft = numBytes - numRead;
+ size_t curNumRead = 0;
deSocketResult result = socket.receive(&dst[numRead], numLeft, &curNumRead);
if (result != DE_SOCKETRESULT_SUCCESS)
@@ -105,7 +105,7 @@
readBytes(socket, header, MESSAGE_HEADER_SIZE);
MessageType type;
- int messageSize;
+ size_t messageSize;
Message::parseHeader(&header[0], (int)header.size(), type, messageSize);
// Simple messages without any data.
diff --git a/execserver/tools/xsTest.cpp b/execserver/tools/xsTest.cpp
index 38b6120..5e47377 100644
--- a/execserver/tools/xsTest.cpp
+++ b/execserver/tools/xsTest.cpp
@@ -73,11 +73,11 @@
message.write(buf);
// Write to socket.
- int pos = 0;
- while (pos < (int)buf.size())
+ size_t pos = 0;
+ while (pos < buf.size())
{
- int numLeft = (int)buf.size() - pos;
- int numSent = 0;
+ size_t numLeft = buf.size() - pos;
+ size_t numSent = 0;
deSocketResult result = socket.send(&buf[pos], numLeft, &numSent);
if (result != DE_SOCKETRESULT_SUCCESS)
@@ -87,14 +87,14 @@
}
}
-void readBytes (de::Socket& socket, vector<deUint8>& dst, int numBytes)
+void readBytes (de::Socket& socket, vector<deUint8>& dst, size_t numBytes)
{
- int numRead = 0;
+ size_t numRead = 0;
dst.resize(numBytes);
while (numRead < numBytes)
{
- int numLeft = numBytes - numRead;
- int curNumRead = 0;
+ size_t numLeft = numBytes - numRead;
+ size_t curNumRead = 0;
deSocketResult result = socket.receive(&dst[numRead], numLeft, &curNumRead);
if (result != DE_SOCKETRESULT_SUCCESS)
@@ -111,7 +111,7 @@
readBytes(socket, header, MESSAGE_HEADER_SIZE);
MessageType type;
- int messageSize;
+ size_t messageSize;
Message::parseHeader(&header[0], (int)header.size(), type, messageSize);
// Simple messages without any data.
diff --git a/execserver/xsExecutionServer.cpp b/execserver/xsExecutionServer.cpp
index 5a8a592..d99c805 100644
--- a/execserver/xsExecutionServer.cpp
+++ b/execserver/xsExecutionServer.cpp
@@ -43,7 +43,7 @@
if (m_buffer.size() < MESSAGE_HEADER_SIZE)
return false;
else
- return (int)m_buffer.size() == getMessageSize();
+ return m_buffer.size() == getMessageSize();
}
const deUint8* MessageBuilder::getMessageData (void) const
@@ -51,10 +51,10 @@
return m_buffer.size() > MESSAGE_HEADER_SIZE ? &m_buffer[MESSAGE_HEADER_SIZE] : DE_NULL;
}
-int MessageBuilder::getMessageDataSize (void) const
+size_t MessageBuilder::getMessageDataSize (void) const
{
DE_ASSERT(isComplete());
- return (int)m_buffer.size() - MESSAGE_HEADER_SIZE;
+ return m_buffer.size() - MESSAGE_HEADER_SIZE;
}
void MessageBuilder::read (ByteBuffer& src)
@@ -78,15 +78,15 @@
if (m_buffer.size() >= MESSAGE_HEADER_SIZE)
{
// We have header.
- int msgSize = getMessageSize();
- int numBytesLeft = msgSize - (int)m_buffer.size();
- int numToRead = de::min(src.getNumElements(), numBytesLeft);
+ size_t msgSize = getMessageSize();
+ size_t numBytesLeft = msgSize - m_buffer.size();
+ size_t numToRead = (size_t)de::min(src.getNumElements(), (int)numBytesLeft);
if (numToRead > 0)
{
int curBufPos = (int)m_buffer.size();
m_buffer.resize(curBufPos+numToRead);
- src.popBack(&m_buffer[curBufPos], numToRead);
+ src.popBack(&m_buffer[curBufPos], (int)numToRead);
}
}
}
@@ -257,7 +257,7 @@
}
}
-void ExecutionRequestHandler::processMessage (MessageType type, const deUint8* data, int dataSize)
+void ExecutionRequestHandler::processMessage (MessageType type, const deUint8* data, size_t dataSize)
{
switch (type)
{
@@ -341,17 +341,17 @@
bool ExecutionRequestHandler::receive (void)
{
- int maxLen = de::min<int>((int)m_sendRecvTmpBuf.size(), m_bufferIn.getNumFree());
+ size_t maxLen = de::min(m_sendRecvTmpBuf.size(), (size_t)m_bufferIn.getNumFree());
if (maxLen > 0)
{
- int numRecv;
+ size_t numRecv;
deSocketResult result = m_socket->receive(&m_sendRecvTmpBuf[0], maxLen, &numRecv);
if (result == DE_SOCKETRESULT_SUCCESS)
{
DE_ASSERT(numRecv > 0);
- m_bufferIn.pushFront(&m_sendRecvTmpBuf[0], numRecv);
+ m_bufferIn.pushFront(&m_sendRecvTmpBuf[0], (int)numRecv);
return true;
}
else if (result == DE_SOCKETRESULT_CONNECTION_CLOSED)
@@ -372,19 +372,19 @@
bool ExecutionRequestHandler::send (void)
{
- int maxLen = de::min<int>((int)m_sendRecvTmpBuf.size(), m_bufferOut.getNumElements());
+ size_t maxLen = de::min(m_sendRecvTmpBuf.size(), (size_t)m_bufferOut.getNumElements());
if (maxLen > 0)
{
- m_bufferOut.peekBack(&m_sendRecvTmpBuf[0], maxLen);
+ m_bufferOut.peekBack(&m_sendRecvTmpBuf[0], (int)maxLen);
- int numSent;
+ size_t numSent;
deSocketResult result = m_socket->send(&m_sendRecvTmpBuf[0], maxLen, &numSent);
if (result == DE_SOCKETRESULT_SUCCESS)
{
DE_ASSERT(numSent > 0);
- m_bufferOut.popBack(numSent);
+ m_bufferOut.popBack((int)numSent);
return true;
}
else if (result == DE_SOCKETRESULT_CONNECTION_CLOSED)
diff --git a/execserver/xsExecutionServer.hpp b/execserver/xsExecutionServer.hpp
index c9ad1ae..8e5cd8e 100644
--- a/execserver/xsExecutionServer.hpp
+++ b/execserver/xsExecutionServer.hpp
@@ -72,14 +72,14 @@
bool isComplete (void) const;
MessageType getMessageType (void) const { return m_messageType; }
- int getMessageSize (void) const { return m_messageSize; }
+ size_t getMessageSize (void) const { return m_messageSize; }
const deUint8* getMessageData (void) const;
- int getMessageDataSize (void) const;
+ size_t getMessageDataSize (void) const;
private:
std::vector<deUint8> m_buffer;
MessageType m_messageType;
- int m_messageSize;
+ size_t m_messageSize;
};
class ExecutionRequestHandler : public ConnectionHandler
@@ -96,7 +96,7 @@
ExecutionRequestHandler& operator= (const ExecutionRequestHandler& handler);
void processSession (void);
- void processMessage (MessageType type, const deUint8* data, int dataSize);
+ void processMessage (MessageType type, const deUint8* data, size_t dataSize);
inline TestDriver* getTestDriver (void) { if (!m_testDriver) acquireTestDriver(); return m_testDriver; }
void acquireTestDriver (void);
diff --git a/execserver/xsProtocol.cpp b/execserver/xsProtocol.cpp
index e2471fa..53a1a35 100644
--- a/execserver/xsProtocol.cpp
+++ b/execserver/xsProtocol.cpp
@@ -47,7 +47,7 @@
class MessageParser
{
public:
- MessageParser (const deUint8* data, int dataSize)
+ MessageParser (const deUint8* data, size_t dataSize)
: m_data (data)
, m_size (dataSize)
, m_pos (0)
@@ -57,7 +57,7 @@
template <typename T>
T get (void)
{
- XS_CHECK_MSG(m_pos + (int)sizeof(T) <= m_size, "Invalid payload size");
+ XS_CHECK_MSG(m_pos + sizeof(T) <= m_size, "Invalid payload size");
T netValue;
deMemcpy(&netValue, &m_data[m_pos], sizeof(T));
m_pos += sizeof(T);
@@ -84,8 +84,8 @@
private:
const deUint8* m_data;
- int m_size;
- int m_pos;
+ size_t m_size;
+ size_t m_pos;
};
class MessageWriter
@@ -138,18 +138,18 @@
deMemcpy(&m_buf[curPos], &value[0], strLen+1);
}
-void Message::parseHeader (const deUint8* data, int dataSize, MessageType& type, int& size)
+void Message::parseHeader (const deUint8* data, size_t dataSize, MessageType& type, size_t& size)
{
XS_CHECK_MSG(dataSize >= MESSAGE_HEADER_SIZE, "Incomplete header");
MessageParser parser(data, dataSize);
- size = (MessageType)parser.get<int>();
+ size = (size_t)(MessageType)parser.get<int>();
type = (MessageType)parser.get<int>();
}
-void Message::writeHeader (MessageType type, int messageSize, deUint8* dst, int bufSize)
+void Message::writeHeader (MessageType type, size_t messageSize, deUint8* dst, size_t bufSize)
{
XS_CHECK_MSG(bufSize >= MESSAGE_HEADER_SIZE, "Incomplete header");
- int netSize = hostToNetwork(messageSize);
+ int netSize = hostToNetwork((int)messageSize);
int netType = hostToNetwork((int)type);
deMemcpy(dst+0, &netSize, sizeof(netSize));
deMemcpy(dst+4, &netType, sizeof(netType));
@@ -160,7 +160,7 @@
MessageWriter writer(type, buf);
}
-HelloMessage::HelloMessage (const deUint8* data, int dataSize)
+HelloMessage::HelloMessage (const deUint8* data, size_t dataSize)
: Message(MESSAGETYPE_HELLO)
{
MessageParser parser(data, dataSize);
@@ -174,7 +174,7 @@
writer.put(version);
}
-TestMessage::TestMessage (const deUint8* data, int dataSize)
+TestMessage::TestMessage (const deUint8* data, size_t dataSize)
: Message(MESSAGETYPE_TEST)
{
MessageParser parser(data, dataSize);
@@ -188,7 +188,7 @@
writer.put(test.c_str());
}
-ExecuteBinaryMessage::ExecuteBinaryMessage (const deUint8* data, int dataSize)
+ExecuteBinaryMessage::ExecuteBinaryMessage (const deUint8* data, size_t dataSize)
: Message(MESSAGETYPE_EXECUTE_BINARY)
{
MessageParser parser(data, dataSize);
@@ -208,7 +208,7 @@
writer.put(caseList.c_str());
}
-ProcessLogDataMessage::ProcessLogDataMessage (const deUint8* data, int dataSize)
+ProcessLogDataMessage::ProcessLogDataMessage (const deUint8* data, size_t dataSize)
: Message(MESSAGETYPE_PROCESS_LOG_DATA)
{
MessageParser parser(data, dataSize);
@@ -222,7 +222,7 @@
writer.put(logData.c_str());
}
-ProcessLaunchFailedMessage::ProcessLaunchFailedMessage (const deUint8* data, int dataSize)
+ProcessLaunchFailedMessage::ProcessLaunchFailedMessage (const deUint8* data, size_t dataSize)
: Message(MESSAGETYPE_PROCESS_LAUNCH_FAILED)
{
MessageParser parser(data, dataSize);
@@ -236,7 +236,7 @@
writer.put(reason.c_str());
}
-ProcessFinishedMessage::ProcessFinishedMessage (const deUint8* data, int dataSize)
+ProcessFinishedMessage::ProcessFinishedMessage (const deUint8* data, size_t dataSize)
: Message(MESSAGETYPE_PROCESS_FINISHED)
{
MessageParser parser(data, dataSize);
@@ -250,7 +250,7 @@
writer.put(exitCode);
}
-InfoMessage::InfoMessage (const deUint8* data, int dataSize)
+InfoMessage::InfoMessage (const deUint8* data, size_t dataSize)
: Message(MESSAGETYPE_INFO)
{
MessageParser parser(data, dataSize);
diff --git a/execserver/xsProtocol.hpp b/execserver/xsProtocol.hpp
index 369ee92..e8ce3d2 100644
--- a/execserver/xsProtocol.hpp
+++ b/execserver/xsProtocol.hpp
@@ -74,8 +74,8 @@
virtual void write (std::vector<deUint8>& buf) const = DE_NULL;
- static void parseHeader (const deUint8* data, int dataSize, MessageType& type, int& messageSize);
- static void writeHeader (MessageType type, int messageSize, deUint8* dst, int bufSize);
+ static void parseHeader (const deUint8* data, size_t dataSize, MessageType& type, size_t& messageSize);
+ static void writeHeader (MessageType type, size_t messageSize, deUint8* dst, size_t bufSize);
protected:
void writeNoData (std::vector<deUint8>& buf) const;
@@ -89,7 +89,7 @@
class SimpleMessage : public Message
{
public:
- SimpleMessage (const deUint8* data, int dataSize) : Message((MessageType)MsgType) { DE_UNREF(data); XS_CHECK_MSG(dataSize == 0, "No payload expected"); }
+ SimpleMessage (const deUint8* data, size_t dataSize) : Message((MessageType)MsgType) { DE_UNREF(data); XS_CHECK_MSG(dataSize == 0, "No payload expected"); }
SimpleMessage (void) : Message((MessageType)MsgType) {}
~SimpleMessage (void) {}
@@ -105,7 +105,7 @@
public:
int version;
- HelloMessage (const deUint8* data, int dataSize);
+ HelloMessage (const deUint8* data, size_t dataSize);
HelloMessage (void) : Message(MESSAGETYPE_HELLO), version(PROTOCOL_VERSION) {}
~HelloMessage (void) {}
@@ -120,7 +120,7 @@
std::string workDir;
std::string caseList;
- ExecuteBinaryMessage (const deUint8* data, int dataSize);
+ ExecuteBinaryMessage (const deUint8* data, size_t dataSize);
ExecuteBinaryMessage (void) : Message(MESSAGETYPE_EXECUTE_BINARY) {}
~ExecuteBinaryMessage (void) {};
@@ -132,7 +132,7 @@
public:
std::string logData;
- ProcessLogDataMessage (const deUint8* data, int dataSize);
+ ProcessLogDataMessage (const deUint8* data, size_t dataSize);
~ProcessLogDataMessage (void) {}
void write (std::vector<deUint8>& buf) const;
@@ -143,7 +143,7 @@
public:
std::string reason;
- ProcessLaunchFailedMessage (const deUint8* data, int dataSize);
+ ProcessLaunchFailedMessage (const deUint8* data, size_t dataSize);
ProcessLaunchFailedMessage (const char* reason_) : Message(MESSAGETYPE_PROCESS_LAUNCH_FAILED), reason(reason_) {}
~ProcessLaunchFailedMessage (void) {}
@@ -155,7 +155,7 @@
public:
int exitCode;
- ProcessFinishedMessage (const deUint8* data, int dataSize);
+ ProcessFinishedMessage (const deUint8* data, size_t dataSize);
ProcessFinishedMessage (int exitCode_) : Message(MESSAGETYPE_PROCESS_FINISHED), exitCode(exitCode_) {}
~ProcessFinishedMessage (void) {}
@@ -167,7 +167,7 @@
public:
std::string info;
- InfoMessage (const deUint8* data, int dataSize);
+ InfoMessage (const deUint8* data, size_t dataSize);
~InfoMessage (void) {}
void write (std::vector<deUint8>& buf) const;
@@ -179,7 +179,7 @@
public:
std::string test;
- TestMessage (const deUint8* data, int dataSize);
+ TestMessage (const deUint8* data, size_t dataSize);
~TestMessage (void) {}
void write (std::vector<deUint8>& buf) const;
diff --git a/executor/tools/xeCommandLineExecutor.cpp b/executor/tools/xeCommandLineExecutor.cpp
index 730dfc3..cbe3e7b 100644
--- a/executor/tools/xeCommandLineExecutor.cpp
+++ b/executor/tools/xeCommandLineExecutor.cpp
@@ -22,49 +22,58 @@
*//*--------------------------------------------------------------------*/
#include "xeBatchExecutor.hpp"
-#include "xeTestCaseListParser.hpp"
-#include "xeTcpIpLink.hpp"
#include "xeLocalTcpIpLink.hpp"
-#include "xeTestResultParser.hpp"
+#include "xeTcpIpLink.hpp"
+#include "xeTestCaseListParser.hpp"
#include "xeTestLogWriter.hpp"
-#include "deDirectoryIterator.hpp"
+#include "xeTestResultParser.hpp"
+
#include "deCommandLine.hpp"
+#include "deDirectoryIterator.hpp"
+#include "deStringUtil.hpp"
+
#include "deString.h"
-#include <vector>
-#include <string>
+#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <fstream>
-#include <memory>
-#include <algorithm>
#include <iostream>
+#include <memory>
#include <sstream>
+#include <string>
+#include <vector>
+
+using std::vector;
+using std::string;
+
+namespace
+{
// Command line arguments.
namespace opt
{
-DE_DECLARE_COMMAND_LINE_OPT(StartServer, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(Host, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(StartServer, string);
+DE_DECLARE_COMMAND_LINE_OPT(Host, string);
DE_DECLARE_COMMAND_LINE_OPT(Port, int);
-DE_DECLARE_COMMAND_LINE_OPT(CaseListDir, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(TestSet, std::vector<std::string>);
-DE_DECLARE_COMMAND_LINE_OPT(ExcludeSet, std::vector<std::string>);
-DE_DECLARE_COMMAND_LINE_OPT(ContinueFile, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(TestLogFile, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(InfoLogFile, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(CaseListDir, string);
+DE_DECLARE_COMMAND_LINE_OPT(TestSet, vector<string>);
+DE_DECLARE_COMMAND_LINE_OPT(ExcludeSet, vector<string>);
+DE_DECLARE_COMMAND_LINE_OPT(ContinueFile, string);
+DE_DECLARE_COMMAND_LINE_OPT(TestLogFile, string);
+DE_DECLARE_COMMAND_LINE_OPT(InfoLogFile, string);
DE_DECLARE_COMMAND_LINE_OPT(Summary, bool);
// TargetConfiguration
-DE_DECLARE_COMMAND_LINE_OPT(BinaryName, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(WorkingDir, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(CmdLineArgs, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(BinaryName, string);
+DE_DECLARE_COMMAND_LINE_OPT(WorkingDir, string);
+DE_DECLARE_COMMAND_LINE_OPT(CmdLineArgs, string);
-static void parseCommaSeparatedList (const char* src, std::vector<std::string>* dst)
+void parseCommaSeparatedList (const char* src, vector<string>* dst)
{
std::istringstream inStr (src);
- std::string comp;
+ string comp;
while (std::getline(inStr, comp, ','))
dst->push_back(comp);
@@ -81,25 +90,28 @@
{ "no", false }
};
- parser << Option<StartServer> ("s", "start-server", "Start local execserver", "")
- << Option<Host> ("c", "connect", "Connect to host", "127.0.0.1")
- << Option<Port> ("p", "port", "Select TCP port to use", "50016")
- << Option<CaseListDir> ("cd", "caselistdir", "Path to test case XML files", ".")
- << Option<TestSet> ("t", "testset", "Test set", parseCommaSeparatedList, "")
- << Option<ExcludeSet> ("e", "exclude", "Comma-separated list of exclude filters", parseCommaSeparatedList, "")
- << Option<ContinueFile> (DE_NULL, "continue", "Continue execution by initializing results from existing test log", "")
- << Option<TestLogFile> ("o", "out", "Output test log filename", "")
- << Option<InfoLogFile> ("i", "info", "Output info log filename", "")
- << Option<Summary> (DE_NULL, "summary", "Print summary at the end", s_yesNo, "yes")
- << Option<BinaryName> ("b", "binaryname", "Test binary path, relative to working directory", "")
- << Option<WorkingDir> ("wd", "workdir", "Working directory for test execution", "")
- << Option<CmdLineArgs> (DE_NULL, "cmdline", "Additional command line arguments for test binary", "");
+ parser << Option<StartServer> ("s", "start-server", "Start local execserver. Path to the execserver binary.")
+ << Option<Host> ("c", "connect", "Connect to host. Address of the execserver.")
+ << Option<Port> ("p", "port", "TCP port of the execserver.", "50016")
+ << Option<CaseListDir> ("cd", "caselistdir", "Path to the directory containing test case XML files.", ".")
+ << Option<TestSet> ("t", "testset", "Comma-separated list of include filters.", parseCommaSeparatedList)
+ << Option<ExcludeSet> ("e", "exclude", "Comma-separated list of exclude filters.", parseCommaSeparatedList, "")
+ << Option<ContinueFile> (DE_NULL, "continue", "Continue execution by initializing results from existing test log.")
+ << Option<TestLogFile> ("o", "out", "Output test log filename.", "TestLog.qpa")
+ << Option<InfoLogFile> ("i", "info", "Output info log filename.", "InfoLog.txt")
+ << Option<Summary> (DE_NULL, "summary", "Print summary after running tests.", s_yesNo, "yes")
+ << Option<BinaryName> ("b", "binaryname", "Test binary path. Relative to working directory.", "<Unused>")
+ << Option<WorkingDir> ("wd", "workdir", "Working directory for the test execution.", ".")
+ << Option<CmdLineArgs> (DE_NULL, "cmdline", "Additional command line arguments for the test binary.", "");
}
} // opt
-using std::vector;
-using std::string;
+enum RunMode
+{
+ RUNMODE_CONNECT,
+ RUNMODE_START_SERVER
+};
struct CommandLine
{
@@ -109,20 +121,20 @@
{
}
- xe::TargetConfiguration targetCfg;
- std::string serverBin;
- std::string host;
- int port;
- std::string caseListDir;
- std::vector<std::string> testset;
- std::vector<std::string> exclude;
- std::string inFile;
- std::string outFile;
- std::string infoFile;
- bool summary;
+ xe::TargetConfiguration targetCfg;
+ RunMode runMode;
+ string serverBinOrAddress;
+ int port;
+ string caseListDir;
+ vector<string> testset;
+ vector<string> exclude;
+ string inFile;
+ string outFile;
+ string infoFile;
+ bool summary;
};
-static bool parseCommandLine (CommandLine& cmdLine, int argc, const char* const* argv)
+bool parseCommandLine (CommandLine& cmdLine, int argc, const char* const* argv)
{
de::cmdline::Parser parser;
de::cmdline::CommandLine opts;
@@ -138,13 +150,49 @@
return false;
}
- cmdLine.serverBin = opts.getOption<opt::StartServer>();
- cmdLine.host = opts.getOption<opt::Host>();
+ if (opts.hasOption<opt::StartServer>() && opts.hasOption<opt::Host>())
+ {
+ std::cout << "Invalid command line arguments. Both --start-server and --connect defined." << std::endl;
+ return false;
+ }
+ else if (!opts.hasOption<opt::StartServer>() && !opts.hasOption<opt::Host>())
+ {
+ std::cout << "Invalid command line arguments. Must define either --start-server or --connect." << std::endl;
+ return false;
+ }
+
+ if (!opts.hasOption<opt::TestSet>())
+ {
+ std::cout << "Invalid command line arguments. --testset not defined." << std::endl;
+ return false;
+ }
+
+ if (opts.hasOption<opt::StartServer>())
+ {
+ cmdLine.runMode = RUNMODE_START_SERVER;
+ cmdLine.serverBinOrAddress = opts.getOption<opt::StartServer>();
+ }
+ else
+ {
+ cmdLine.runMode = RUNMODE_CONNECT;
+ cmdLine.serverBinOrAddress = opts.getOption<opt::Host>();
+ }
+
+ if (opts.hasOption<opt::ContinueFile>())
+ {
+ cmdLine.inFile = opts.getOption<opt::ContinueFile>();
+
+ if (cmdLine.inFile.empty())
+ {
+ std::cout << "Invalid command line arguments. --continue argument is empty." << std::endl;
+ return false;
+ }
+ }
+
cmdLine.port = opts.getOption<opt::Port>();
cmdLine.caseListDir = opts.getOption<opt::CaseListDir>();
cmdLine.testset = opts.getOption<opt::TestSet>();
cmdLine.exclude = opts.getOption<opt::ExcludeSet>();
- cmdLine.inFile = opts.getOption<opt::ContinueFile>();
cmdLine.outFile = opts.getOption<opt::TestLogFile>();
cmdLine.infoFile = opts.getOption<opt::InfoLogFile>();
cmdLine.summary = opts.getOption<opt::Summary>();
@@ -155,7 +203,7 @@
return true;
}
-static bool checkCasePathPatternMatch (const char* pattern, const char* casePath, bool isTestGroup)
+bool checkCasePathPatternMatch (const char* pattern, const char* casePath, bool isTestGroup)
{
int ptrnPos = 0;
int casePos = 0;
@@ -199,7 +247,7 @@
return false;
}
-static void readCaseList (xe::TestGroup* root, const char* filename)
+void readCaseList (xe::TestGroup* root, const char* filename)
{
xe::TestCaseListParser caseListParser;
std::ifstream in (filename, std::ios_base::binary);
@@ -222,9 +270,10 @@
}
}
-static void readCaseLists (xe::TestRoot& root, const char* caseListDir)
+void readCaseLists (xe::TestRoot& root, const char* caseListDir)
{
- de::DirectoryIterator iter(caseListDir);
+ int testCaseListCount = 0;
+ de::DirectoryIterator iter (caseListDir);
for (; iter.hasItem(); iter.next())
{
@@ -232,25 +281,29 @@
if (item.getType() == de::FilePath::TYPE_FILE)
{
- std::string baseName = item.getBaseName();
+ string baseName = item.getBaseName();
if (baseName.find("-cases.xml") == baseName.length()-10)
{
- std::string packageName = baseName.substr(0, baseName.length()-10);
+ string packageName = baseName.substr(0, baseName.length()-10);
xe::TestGroup* package = root.createGroup(packageName.c_str(), "");
readCaseList(package, item.getPath());
+ testCaseListCount++;
}
}
}
+
+ if (testCaseListCount == 0)
+ throw xe::Error("Couldn't find test case lists from test case list directory: '" + string(caseListDir) + "'");
}
-static void addMatchingCases (const xe::TestGroup& group, xe::TestSet& testSet, const char* filter)
+void addMatchingCases (const xe::TestGroup& group, xe::TestSet& testSet, const char* filter)
{
for (int childNdx = 0; childNdx < group.getNumChildren(); childNdx++)
{
const xe::TestNode* child = group.getChild(childNdx);
const bool isGroup = child->getNodeType() == xe::TESTNODETYPE_GROUP;
- const std::string fullPath = child->getFullPath();
+ const string fullPath = child->getFullPath();
if (checkCasePathPatternMatch(filter, fullPath.c_str(), isGroup))
{
@@ -268,13 +321,13 @@
}
}
-static void removeMatchingCases (const xe::TestGroup& group, xe::TestSet& testSet, const char* filter)
+void removeMatchingCases (const xe::TestGroup& group, xe::TestSet& testSet, const char* filter)
{
for (int childNdx = 0; childNdx < group.getNumChildren(); childNdx++)
{
const xe::TestNode* child = group.getChild(childNdx);
const bool isGroup = child->getNodeType() == xe::TESTNODETYPE_GROUP;
- const std::string fullPath = child->getFullPath();
+ const string fullPath = child->getFullPath();
if (checkCasePathPatternMatch(filter, fullPath.c_str(), isGroup))
{
@@ -326,7 +379,7 @@
xe::BatchResult* m_batchResult;
};
-static void readLogFile (xe::BatchResult* batchResult, const char* filename)
+void readLogFile (xe::BatchResult* batchResult, const char* filename)
{
std::ifstream in (filename, std::ifstream::binary|std::ifstream::in);
BatchResultHandler handler (batchResult);
@@ -348,7 +401,7 @@
in.close();
}
-static void printBatchResultSummary (const xe::TestNode* root, const xe::TestSet& testSet, const xe::BatchResult& batchResult)
+void printBatchResultSummary (const xe::TestNode* root, const xe::TestSet& testSet, const xe::BatchResult& batchResult)
{
int countByStatusCode[xe::TESTSTATUSCODE_LAST];
std::fill(&countByStatusCode[0], &countByStatusCode[0]+DE_LENGTH_OF_ARRAY(countByStatusCode), 0);
@@ -359,7 +412,7 @@
if (node->getNodeType() == xe::TESTNODETYPE_TEST_CASE && testSet.hasNode(node))
{
const xe::TestCase* testCase = static_cast<const xe::TestCase*>(node);
- std::string fullPath;
+ string fullPath;
xe::TestStatusCode statusCode = xe::TESTSTATUSCODE_PENDING;
testCase->getFullPath(fullPath);
@@ -390,7 +443,7 @@
printf(" %20s: %5d\n", "Total", totalCases);
}
-static void writeInfoLog (const xe::InfoLog& log, const char* filename)
+void writeInfoLog (const xe::InfoLog& log, const char* filename)
{
std::ofstream out(filename, std::ios_base::binary);
XE_CHECK(out.good());
@@ -398,14 +451,14 @@
out.close();
}
-static xe::CommLink* createCommLink (const CommandLine& cmdLine)
+xe::CommLink* createCommLink (const CommandLine& cmdLine)
{
- if (!cmdLine.serverBin.empty())
+ if (cmdLine.runMode == RUNMODE_START_SERVER)
{
xe::LocalTcpIpLink* link = new xe::LocalTcpIpLink();
try
{
- link->start(cmdLine.serverBin.c_str(), DE_NULL, cmdLine.port);
+ link->start(cmdLine.serverBinOrAddress.c_str(), DE_NULL, cmdLine.port);
return link;
}
catch (...)
@@ -414,29 +467,42 @@
throw;
}
}
+ else if (cmdLine.runMode == RUNMODE_CONNECT)
+ {
+ de::SocketAddress address;
+
+ address.setFamily(DE_SOCKETFAMILY_INET4);
+ address.setProtocol(DE_SOCKETPROTOCOL_TCP);
+ address.setHost(cmdLine.serverBinOrAddress.c_str());
+ address.setPort(cmdLine.port);
+
+ xe::TcpIpLink* link = new xe::TcpIpLink();
+ try
+ {
+ std::string error;
+
+ link->connect(address);
+ return link;
+ }
+ catch (const std::exception& error)
+ {
+ delete link;
+ throw xe::Error("Failed to connect to ExecServer at: " + cmdLine.serverBinOrAddress + ":" + de::toString(cmdLine.port) + ", " + error.what());
+ }
+ catch (...)
+ {
+ delete link;
+ throw;
+ }
+ }
else
{
- de::SocketAddress address;
- address.setFamily(DE_SOCKETFAMILY_INET4);
- address.setProtocol(DE_SOCKETPROTOCOL_TCP);
- address.setHost(cmdLine.host.c_str());
- address.setPort(cmdLine.port);
-
- xe::TcpIpLink* link = new xe::TcpIpLink();
- try
- {
- link->connect(address);
- return link;
- }
- catch (...)
- {
- delete link;
- throw;
- }
+ DE_ASSERT(false);
+ return DE_NULL;
}
}
-static void runExecutor (const CommandLine& cmdLine)
+void runExecutor (const CommandLine& cmdLine)
{
xe::TestRoot root;
@@ -450,6 +516,9 @@
for (vector<string>::const_iterator filterIter = cmdLine.testset.begin(); filterIter != cmdLine.testset.end(); ++filterIter)
addMatchingCases(root, testSet, filterIter->c_str());
+ if (testSet.empty())
+ throw xe::Error("None of the test case lists contains tests matching any of the test sets.");
+
// Remove excluded cases.
for (vector<string>::const_iterator filterIter = cmdLine.exclude.begin(); filterIter != cmdLine.exclude.end(); ++filterIter)
removeMatchingCases(root, testSet, filterIter->c_str());
@@ -486,6 +555,8 @@
printBatchResultSummary(&root, testSet, batchResult);
}
+} // anonymous
+
int main (int argc, const char* const* argv)
{
CommandLine cmdLine;
diff --git a/executor/xeBatchExecutor.cpp b/executor/xeBatchExecutor.cpp
index 46fe449..9e8b7b7 100644
--- a/executor/xeBatchExecutor.cpp
+++ b/executor/xeBatchExecutor.cpp
@@ -278,7 +278,7 @@
}
}
-void BatchExecutor::onTestLogData (const deUint8* bytes, int numBytes)
+void BatchExecutor::onTestLogData (const deUint8* bytes, size_t numBytes)
{
try
{
@@ -291,7 +291,7 @@
}
}
-void BatchExecutor::onInfoLogData (const deUint8* bytes, int numBytes)
+void BatchExecutor::onInfoLogData (const deUint8* bytes, size_t numBytes)
{
if (numBytes > 0 && m_infoLog)
m_infoLog->append(bytes, numBytes);
@@ -353,7 +353,7 @@
writer.enqueue();
}
-void BatchExecutor::enqueueTestLogData (void* userPtr, const deUint8* bytes, int numBytes)
+void BatchExecutor::enqueueTestLogData (void* userPtr, const deUint8* bytes, size_t numBytes)
{
BatchExecutor* executor = static_cast<BatchExecutor*>(userPtr);
CallWriter writer (&executor->m_dispatcher, BatchExecutor::dispatchTestLogData);
@@ -365,7 +365,7 @@
writer.enqueue();
}
-void BatchExecutor::enqueueInfoLogData (void* userPtr, const deUint8* bytes, int numBytes)
+void BatchExecutor::enqueueInfoLogData (void* userPtr, const deUint8* bytes, size_t numBytes)
{
BatchExecutor* executor = static_cast<BatchExecutor*>(userPtr);
CallWriter writer (&executor->m_dispatcher, BatchExecutor::dispatchInfoLogData);
@@ -377,7 +377,7 @@
writer.enqueue();
}
-void BatchExecutor::dispatchStateChanged (CallReader data)
+void BatchExecutor::dispatchStateChanged (CallReader& data)
{
BatchExecutor* executor = DE_NULL;
CommLinkState state = COMMLINKSTATE_LAST;
@@ -390,10 +390,10 @@
executor->onStateChanged(state, message.c_str());
}
-void BatchExecutor::dispatchTestLogData (CallReader data)
+void BatchExecutor::dispatchTestLogData (CallReader& data)
{
BatchExecutor* executor = DE_NULL;
- int numBytes;
+ size_t numBytes;
data >> executor
>> numBytes;
@@ -401,10 +401,10 @@
executor->onTestLogData(data.getDataBlock(numBytes), numBytes);
}
-void BatchExecutor::dispatchInfoLogData (CallReader data)
+void BatchExecutor::dispatchInfoLogData (CallReader& data)
{
BatchExecutor* executor = DE_NULL;
- int numBytes;
+ size_t numBytes;
data >> executor
>> numBytes;
diff --git a/executor/xeBatchExecutor.hpp b/executor/xeBatchExecutor.hpp
index 509bbb0..b84d054 100644
--- a/executor/xeBatchExecutor.hpp
+++ b/executor/xeBatchExecutor.hpp
@@ -80,20 +80,20 @@
bool iterate (void);
void onStateChanged (CommLinkState state, const char* message);
- void onTestLogData (const deUint8* bytes, int numBytes);
- void onInfoLogData (const deUint8* bytes, int numBytes);
+ void onTestLogData (const deUint8* bytes, size_t numBytes);
+ void onInfoLogData (const deUint8* bytes, size_t numBytes);
void launchTestSet (const TestSet& testSet);
// Callbacks for CommLink.
static void enqueueStateChanged (void* userPtr, CommLinkState state, const char* message);
- static void enqueueTestLogData (void* userPtr, const deUint8* bytes, int numBytes);
- static void enqueueInfoLogData (void* userPtr, const deUint8* bytes, int numBytes);
+ static void enqueueTestLogData (void* userPtr, const deUint8* bytes, size_t numBytes);
+ static void enqueueInfoLogData (void* userPtr, const deUint8* bytes, size_t numBytes);
// Called in CallQueue dispatch.
- static void dispatchStateChanged (CallReader data);
- static void dispatchTestLogData (CallReader data);
- static void dispatchInfoLogData (CallReader data);
+ static void dispatchStateChanged (CallReader& data);
+ static void dispatchTestLogData (CallReader& data);
+ static void dispatchInfoLogData (CallReader& data);
enum State
{
diff --git a/executor/xeCallQueue.cpp b/executor/xeCallQueue.cpp
index 7f87b54..5c30318 100644
--- a/executor/xeCallQueue.cpp
+++ b/executor/xeCallQueue.cpp
@@ -66,7 +66,12 @@
try
{
// \note Enqueue lock is not held during call so it is possible to enqueue more work from dispatched call.
- call->getFunction()(CallReader(call));
+ CallReader reader(call);
+
+ call->getFunction()(reader);
+
+ // check callee consumed all
+ DE_ASSERT(reader.isDataConsumed());
call->clear();
}
catch (const std::exception&)
@@ -160,14 +165,14 @@
{
}
-void CallReader::read (deUint8* bytes, int numBytes)
+void CallReader::read (deUint8* bytes, size_t numBytes)
{
DE_ASSERT(m_curPos + numBytes <= m_call->getDataSize());
deMemcpy(bytes, m_call->getData()+m_curPos, numBytes);
m_curPos += numBytes;
}
-const deUint8* CallReader::getDataBlock (int numBytes)
+const deUint8* CallReader::getDataBlock (size_t numBytes)
{
DE_ASSERT(m_curPos + numBytes <= m_call->getDataSize());
@@ -177,6 +182,11 @@
return ptr;
}
+bool CallReader::isDataConsumed (void) const
+{
+ return m_curPos == m_call->getDataSize();
+}
+
CallReader& operator>> (CallReader& reader, std::string& value)
{
value.clear();
@@ -209,10 +219,10 @@
m_queue->freeCall(m_call);
}
-void CallWriter::write (const deUint8* bytes, int numBytes)
+void CallWriter::write (const deUint8* bytes, size_t numBytes)
{
DE_ASSERT(!m_enqueued);
- int curPos = m_call->getDataSize();
+ size_t curPos = m_call->getDataSize();
m_call->setDataSize(curPos+numBytes);
deMemcpy(m_call->getData()+curPos, bytes, numBytes);
}
diff --git a/executor/xeCallQueue.hpp b/executor/xeCallQueue.hpp
index 3d72655..94217e4 100644
--- a/executor/xeCallQueue.hpp
+++ b/executor/xeCallQueue.hpp
@@ -45,7 +45,7 @@
class Call
{
public:
- typedef void (*Function) (CallReader data);
+ typedef void (*Function) (CallReader& data);
Call (void);
~Call (void);
@@ -55,8 +55,8 @@
Function getFunction (void) const { return m_func; }
void setFunction (Function func) { m_func = func; }
- int getDataSize (void) const { return (int)m_data.size(); }
- void setDataSize (int size) { m_data.resize(size); }
+ size_t getDataSize (void) const { return m_data.size(); }
+ void setDataSize (size_t size) { m_data.resize(size); }
const deUint8* getData (void) const { return m_data.empty() ? DE_NULL : &m_data[0]; }
deUint8* getData (void) { return m_data.empty() ? DE_NULL : &m_data[0]; }
@@ -72,12 +72,16 @@
CallReader (Call* call);
CallReader (void) : m_call(DE_NULL), m_curPos(0) {}
- void read (deUint8* bytes, int numBytes);
- const deUint8* getDataBlock (int numBytes); //!< \note Valid only during call.
+ void read (deUint8* bytes, size_t numBytes);
+ const deUint8* getDataBlock (size_t numBytes); //!< \note Valid only during call.
+ bool isDataConsumed (void) const; //!< all data has been consumed
private:
+ CallReader (const CallReader& other); //!< disallowed
+ CallReader& operator= (const CallReader& other); //!< disallowed
+
Call* m_call;
- int m_curPos;
+ size_t m_curPos;
};
class CallWriter
@@ -86,7 +90,7 @@
CallWriter (CallQueue* queue, Call::Function function);
~CallWriter (void);
- void write (const deUint8* bytes, int numBytes);
+ void write (const deUint8* bytes, size_t numBytes);
void enqueue (void);
private:
diff --git a/executor/xeCommLink.hpp b/executor/xeCommLink.hpp
index 66c314d..c4fedef 100644
--- a/executor/xeCommLink.hpp
+++ b/executor/xeCommLink.hpp
@@ -48,7 +48,7 @@
{
public:
typedef void (*StateChangedFunc) (void* userPtr, CommLinkState state, const char* message);
- typedef void (*LogDataFunc) (void* userPtr, const deUint8* bytes, int numBytes);
+ typedef void (*LogDataFunc) (void* userPtr, const deUint8* bytes, size_t numBytes);
CommLink (void);
virtual ~CommLink (void);
diff --git a/executor/xeContainerFormatParser.cpp b/executor/xeContainerFormatParser.cpp
index a15449c..a02d8b8 100644
--- a/executor/xeContainerFormatParser.cpp
+++ b/executor/xeContainerFormatParser.cpp
@@ -62,14 +62,14 @@
throw ContainerParseError(what);
}
-void ContainerFormatParser::feed (const deUint8* bytes, int numBytes)
+void ContainerFormatParser::feed (const deUint8* bytes, size_t numBytes)
{
// Grow buffer if necessary.
- if (m_buf.getNumFree() < numBytes)
- m_buf.resize(getNextBufferSize(m_buf.getSize(), m_buf.getNumElements()+numBytes));
+ if (m_buf.getNumFree() < (int)numBytes)
+ m_buf.resize(getNextBufferSize(m_buf.getSize(), m_buf.getNumElements()+(int)numBytes));
// Append to front.
- m_buf.pushFront(bytes, numBytes);
+ m_buf.pushFront(bytes, (int)numBytes);
// If we haven't parsed complete element, re-try after data feed.
if (m_element == CONTAINERELEMENT_INCOMPLETE)
diff --git a/executor/xeContainerFormatParser.hpp b/executor/xeContainerFormatParser.hpp
index 40c0f44..5167ce8 100644
--- a/executor/xeContainerFormatParser.hpp
+++ b/executor/xeContainerFormatParser.hpp
@@ -58,7 +58,7 @@
void clear (void);
- void feed (const deUint8* bytes, int numBytes);
+ void feed (const deUint8* bytes, size_t numBytes);
void advance (void);
ContainerElement getElement (void) const { return m_element; }
diff --git a/executor/xeLocalTcpIpLink.cpp b/executor/xeLocalTcpIpLink.cpp
index 0550582..8bc9491 100644
--- a/executor/xeLocalTcpIpLink.cpp
+++ b/executor/xeLocalTcpIpLink.cpp
@@ -62,7 +62,7 @@
deProcess_destroy(m_process);
m_process = DE_NULL;
- XE_FAIL((std::string("Failed to start server: ") + err).c_str());
+ XE_FAIL((std::string("Failed to start ExecServer '") + execServerPath + "' : " + err).c_str());
}
try
diff --git a/executor/xeTcpIpLink.cpp b/executor/xeTcpIpLink.cpp
index 1778a4f..68065c6 100644
--- a/executor/xeTcpIpLink.cpp
+++ b/executor/xeTcpIpLink.cpp
@@ -133,7 +133,7 @@
callback(userPtr, state, error);
}
-void TcpIpLinkState::onTestLogData (const deUint8* bytes, int numBytes) const
+void TcpIpLinkState::onTestLogData (const deUint8* bytes, size_t numBytes) const
{
CommLink::LogDataFunc callback = DE_NULL;
void* userPtr = DE_NULL;
@@ -147,7 +147,7 @@
callback(userPtr, bytes, numBytes);
}
-void TcpIpLinkState::onInfoLogData (const deUint8* bytes, int numBytes) const
+void TcpIpLinkState::onInfoLogData (const deUint8* bytes, size_t numBytes) const
{
CommLink::LogDataFunc callback = DE_NULL;
void* userPtr = DE_NULL;
@@ -206,8 +206,8 @@
while (!m_buffer.isCanceled())
{
- int numToSend = 0;
- int numSent = 0;
+ size_t numToSend = 0;
+ size_t numSent = 0;
deSocketResult result = DE_SOCKETRESULT_LAST;
try
@@ -234,7 +234,7 @@
else if (result == DE_SOCKETRESULT_WOULD_BLOCK)
{
// \note Socket should not be in non-blocking mode.
- DE_ASSERT(numSent <= 0);
+ DE_ASSERT(numSent == 0);
deYield();
}
else
@@ -291,7 +291,7 @@
{
bool hasHeader = m_curMsgPos >= xs::MESSAGE_HEADER_SIZE;
bool hasPayload = false;
- int messageSize = 0;
+ size_t messageSize = 0;
xs::MessageType messageType = (xs::MessageType)0;
if (hasHeader)
@@ -309,12 +309,12 @@
else
{
// Try to receive missing bytes.
- int curSize = hasHeader ? messageSize : xs::MESSAGE_HEADER_SIZE;
- int bytesToRecv = curSize-m_curMsgPos;
- int numRecv = 0;
+ size_t curSize = hasHeader ? messageSize : (size_t)xs::MESSAGE_HEADER_SIZE;
+ size_t bytesToRecv = curSize-m_curMsgPos;
+ size_t numRecv = 0;
deSocketResult result = DE_SOCKETRESULT_LAST;
- if ((int)m_curMsgBuf.size() < curSize)
+ if (m_curMsgBuf.size() < curSize)
m_curMsgBuf.resize(curSize);
result = m_socket.receive(&m_curMsgBuf[m_curMsgPos], bytesToRecv, &numRecv);
@@ -328,7 +328,7 @@
else if (result == DE_SOCKETRESULT_WOULD_BLOCK)
{
// \note Socket should not be in non-blocking mode.
- DE_ASSERT(numRecv <= 0);
+ DE_ASSERT(numRecv == 0);
deYield();
}
else
@@ -359,7 +359,7 @@
}
}
-void TcpIpRecvThread::handleMessage (xs::MessageType messageType, const deUint8* data, int dataSize)
+void TcpIpRecvThread::handleMessage (xs::MessageType messageType, const deUint8* data, size_t dataSize)
{
switch (messageType)
{
@@ -480,6 +480,7 @@
{
closeConnection();
m_state.setState(COMMLINKSTATE_ERROR, e.what());
+ throw;
}
}
diff --git a/executor/xeTcpIpLink.hpp b/executor/xeTcpIpLink.hpp
index d401355..51ca7c3 100644
--- a/executor/xeTcpIpLink.hpp
+++ b/executor/xeTcpIpLink.hpp
@@ -49,8 +49,8 @@
void setCallbacks (CommLink::StateChangedFunc stateChangedCallback, CommLink::LogDataFunc testLogDataCallback, CommLink::LogDataFunc infoLogDataCallback, void* userPtr);
void setState (CommLinkState state, const char* error = "");
- void onTestLogData (const deUint8* bytes, int numBytes) const;
- void onInfoLogData (const deUint8* bytes, int numBytes) const;
+ void onTestLogData (const deUint8* bytes, size_t numBytes) const;
+ void onInfoLogData (const deUint8* bytes, size_t numBytes) const;
void onKeepaliveReceived (void);
deUint64 getLastKeepaliveRecevied (void) const;
@@ -104,13 +104,13 @@
bool isRunning (void) const { return m_isRunning; }
private:
- void handleMessage (xs::MessageType messageType, const deUint8* data, int dataSize);
+ void handleMessage (xs::MessageType messageType, const deUint8* data, size_t dataSize);
de::Socket& m_socket;
TcpIpLinkState& m_state;
std::vector<deUint8> m_curMsgBuf;
- int m_curMsgPos;
+ size_t m_curMsgPos;
bool m_isRunning;
};
diff --git a/executor/xeTestLogParser.cpp b/executor/xeTestLogParser.cpp
index e871663..01627c1 100644
--- a/executor/xeTestLogParser.cpp
+++ b/executor/xeTestLogParser.cpp
@@ -49,7 +49,7 @@
m_inSession = false;
}
-void TestLogParser::parse (const deUint8* bytes, int numBytes)
+void TestLogParser::parse (const deUint8* bytes, size_t numBytes)
{
m_containerParser.feed(bytes, numBytes);
diff --git a/executor/xeTestLogParser.hpp b/executor/xeTestLogParser.hpp
index f009e05..bc323f3 100644
--- a/executor/xeTestLogParser.hpp
+++ b/executor/xeTestLogParser.hpp
@@ -56,7 +56,7 @@
void reset (void);
- void parse (const deUint8* bytes, int numBytes);
+ void parse (const deUint8* bytes, size_t numBytes);
private:
TestLogParser (const TestLogParser& other);
diff --git a/executor/xeTestResultParser.cpp b/executor/xeTestResultParser.cpp
index 1c7072a..0b95b8e 100644
--- a/executor/xeTestResultParser.cpp
+++ b/executor/xeTestResultParser.cpp
@@ -802,11 +802,11 @@
deUint8 decodedBits = 0;
if (de::inRange<deInt8>(byte, 'A', 'Z'))
- decodedBits = byte - 'A';
+ decodedBits = (deUint8)(byte - 'A');
else if (de::inRange<deInt8>(byte, 'a', 'z'))
- decodedBits = ('Z'-'A'+1) + (byte-'a');
+ decodedBits = (deUint8)(('Z'-'A'+1) + (byte-'a'));
else if (de::inRange<deInt8>(byte, '0', '9'))
- decodedBits = ('Z'-'A'+1) + ('z'-'a'+1) + (byte-'0');
+ decodedBits = (deUint8)(('Z'-'A'+1) + ('z'-'a'+1) + (byte-'0'));
else if (byte == '+')
decodedBits = ('Z'-'A'+1) + ('z'-'a'+1) + ('9'-'0'+1);
else if (byte == '/')
@@ -833,10 +833,10 @@
switch (phase)
{
- case 0: outPtr[0] |= decodedBits<<2; break;
- case 1: outPtr[0] |= (decodedBits>>4); outPtr[1] |= ((decodedBits&0xF)<<4); break;
- case 2: outPtr[1] |= (decodedBits>>2); outPtr[2] |= ((decodedBits&0x3)<<6); break;
- case 3: outPtr[2] |= decodedBits; break;
+ case 0: outPtr[0] |= (deUint8)(decodedBits<<2); break;
+ case 1: outPtr[0] |= (deUint8)(decodedBits>>4); outPtr[1] |= (deUint8)((decodedBits&0xF)<<4); break;
+ case 2: outPtr[1] |= (deUint8)(decodedBits>>2); outPtr[2] |= (deUint8)((decodedBits&0x3)<<6); break;
+ case 3: outPtr[2] |= decodedBits; break;
default:
DE_ASSERT(false);
}
diff --git a/framework/common/tcuApp.cpp b/framework/common/tcuApp.cpp
index a16e45e..409a677 100644
--- a/framework/common/tcuApp.cpp
+++ b/framework/common/tcuApp.cpp
@@ -28,13 +28,47 @@
#include "tcuTestHierarchyUtil.hpp"
#include "tcuCommandLine.hpp"
#include "tcuTestLog.hpp"
+
#include "qpInfo.h"
#include "qpDebugOut.h"
+
#include "deMath.h"
+#include <iostream>
+
namespace tcu
{
+using std::string;
+
+/*--------------------------------------------------------------------*//*!
+ * Writes all packages found stdout without any
+ * separations. Recommended to be used with a single package
+ * only. It's possible to use test selectors for limiting the export
+ * to one package in a multipackage binary.
+ *//*--------------------------------------------------------------------*/
+static void writeCaselistsToStdout (TestPackageRoot& root, TestContext& testCtx, const CommandLine& cmdLine)
+{
+ DefaultHierarchyInflater inflater (testCtx);
+ TestHierarchyIterator iter (root, inflater, cmdLine);
+
+ while (iter.getState() != TestHierarchyIterator::STATE_FINISHED)
+ {
+ iter.next();
+
+ while (iter.getNode()->getNodeType() != NODETYPE_PACKAGE)
+ {
+ if (iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE)
+ std::cout << (isTestNodeTypeExecutable(iter.getNode()->getNodeType()) ? "TEST" : "GROUP") << ": " << iter.getNodePath() << "\n";
+ iter.next();
+ }
+
+ DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_LEAVE_NODE &&
+ iter.getNode()->getNodeType() == NODETYPE_PACKAGE);
+ iter.next();
+ }
+}
+
/*--------------------------------------------------------------------*//*!
* \brief Construct test application
*
@@ -79,10 +113,12 @@
// \note No executor is created if runmode is not EXECUTE
if (runMode == RUNMODE_EXECUTE)
m_testExecutor = new TestSessionExecutor(*m_testRoot, *m_testCtx);
+ else if (runMode == RUNMODE_DUMP_STDOUT_CASELIST)
+ writeCaselistsToStdout(*m_testRoot, *m_testCtx, cmdLine);
else if (runMode == RUNMODE_DUMP_XML_CASELIST)
- writeXmlCaselists(*m_testRoot, *m_testCtx, m_testCtx->getCommandLine());
+ writeXmlCaselistsToFiles(*m_testRoot, *m_testCtx, cmdLine);
else if (runMode == RUNMODE_DUMP_TEXT_CASELIST)
- writeTxtCaselists(*m_testRoot, *m_testCtx, m_testCtx->getCommandLine());
+ writeTxtCaselistsToFiles(*m_testRoot, *m_testCtx, cmdLine);
else
DE_ASSERT(false);
}
@@ -155,10 +191,10 @@
// Report statistics.
print("\nTest run totals:\n");
- print(" Passed: %d/%d (%.1f%%)\n", result.numPassed, result.numExecuted, (result.numExecuted > 0 ? (100.0f * result.numPassed / result.numExecuted) : 0.0f));
- print(" Failed: %d/%d (%.1f%%)\n", result.numFailed, result.numExecuted, (result.numExecuted > 0 ? (100.0f * result.numFailed / result.numExecuted) : 0.0f));
- print(" Not supported: %d/%d (%.1f%%)\n", result.numNotSupported, result.numExecuted, (result.numExecuted > 0 ? (100.0f * result.numNotSupported / result.numExecuted) : 0.0f));
- print(" Warnings: %d/%d (%.1f%%)\n", result.numWarnings, result.numExecuted, (result.numExecuted > 0 ? (100.0f * result.numWarnings / result.numExecuted) : 0.0f));
+ print(" Passed: %d/%d (%.1f%%)\n", result.numPassed, result.numExecuted, (result.numExecuted > 0 ? (100.0f * (float)result.numPassed / (float)result.numExecuted) : 0.0f));
+ print(" Failed: %d/%d (%.1f%%)\n", result.numFailed, result.numExecuted, (result.numExecuted > 0 ? (100.0f * (float)result.numFailed / (float)result.numExecuted) : 0.0f));
+ print(" Not supported: %d/%d (%.1f%%)\n", result.numNotSupported, result.numExecuted, (result.numExecuted > 0 ? (100.0f * (float)result.numNotSupported / (float)result.numExecuted) : 0.0f));
+ print(" Warnings: %d/%d (%.1f%%)\n", result.numWarnings, result.numExecuted, (result.numExecuted > 0 ? (100.0f * (float)result.numWarnings / (float)result.numExecuted) : 0.0f));
if (!result.isComplete)
print("Test run was ABORTED!\n");
}
diff --git a/framework/common/tcuBilinearImageCompare.cpp b/framework/common/tcuBilinearImageCompare.cpp
index 9b53ff9..df6f7c2 100644
--- a/framework/common/tcuBilinearImageCompare.cpp
+++ b/framework/common/tcuBilinearImageCompare.cpp
@@ -173,8 +173,8 @@
for (int sampleNdx = 0; sampleNdx < DE_LENGTH_OF_ARRAY(s_offsets); sampleNdx++)
{
- const int u = ((x-1)<<NUM_SUBPIXEL_BITS) + (int)s_offsets[sampleNdx][0];
- const int v = ((y-1)<<NUM_SUBPIXEL_BITS) + (int)s_offsets[sampleNdx][1];
+ const int u = (x<<NUM_SUBPIXEL_BITS) + (int)s_offsets[sampleNdx][0] - (1<<NUM_SUBPIXEL_BITS);
+ const int v = (y<<NUM_SUBPIXEL_BITS) + (int)s_offsets[sampleNdx][1] - (1<<NUM_SUBPIXEL_BITS);
if (!de::inBounds(u, 0, (reference.getWidth()-1)<<NUM_SUBPIXEL_BITS) ||
!de::inBounds(v, 0, (reference.getHeight()-1)<<NUM_SUBPIXEL_BITS))
diff --git a/framework/common/tcuCommandLine.cpp b/framework/common/tcuCommandLine.cpp
index 405d9bd..c660e63 100644
--- a/framework/common/tcuCommandLine.cpp
+++ b/framework/common/tcuCommandLine.cpp
@@ -54,33 +54,34 @@
namespace opt
{
-DE_DECLARE_COMMAND_LINE_OPT(CasePath, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(CaseList, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(CaseListFile, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(StdinCaseList, bool);
-DE_DECLARE_COMMAND_LINE_OPT(LogFilename, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(RunMode, tcu::RunMode);
-DE_DECLARE_COMMAND_LINE_OPT(WatchDog, bool);
-DE_DECLARE_COMMAND_LINE_OPT(CrashHandler, bool);
-DE_DECLARE_COMMAND_LINE_OPT(BaseSeed, int);
-DE_DECLARE_COMMAND_LINE_OPT(TestIterationCount, int);
-DE_DECLARE_COMMAND_LINE_OPT(Visibility, WindowVisibility);
-DE_DECLARE_COMMAND_LINE_OPT(SurfaceWidth, int);
-DE_DECLARE_COMMAND_LINE_OPT(SurfaceHeight, int);
-DE_DECLARE_COMMAND_LINE_OPT(SurfaceType, tcu::SurfaceType);
-DE_DECLARE_COMMAND_LINE_OPT(ScreenRotation, tcu::ScreenRotation);
-DE_DECLARE_COMMAND_LINE_OPT(GLContextType, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(GLConfigID, int);
-DE_DECLARE_COMMAND_LINE_OPT(GLConfigName, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(GLContextFlags, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(CLPlatformID, int);
-DE_DECLARE_COMMAND_LINE_OPT(CLDeviceIDs, std::vector<int>);
-DE_DECLARE_COMMAND_LINE_OPT(CLBuildOptions, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(EGLDisplayType, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(EGLWindowType, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(EGLPixmapType, std::string);
-DE_DECLARE_COMMAND_LINE_OPT(LogImages, bool);
-DE_DECLARE_COMMAND_LINE_OPT(TestOOM, bool);
+DE_DECLARE_COMMAND_LINE_OPT(CasePath, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(CaseList, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(CaseListFile, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(StdinCaseList, bool);
+DE_DECLARE_COMMAND_LINE_OPT(LogFilename, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(RunMode, tcu::RunMode);
+DE_DECLARE_COMMAND_LINE_OPT(ExportFilenamePattern, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(WatchDog, bool);
+DE_DECLARE_COMMAND_LINE_OPT(CrashHandler, bool);
+DE_DECLARE_COMMAND_LINE_OPT(BaseSeed, int);
+DE_DECLARE_COMMAND_LINE_OPT(TestIterationCount, int);
+DE_DECLARE_COMMAND_LINE_OPT(Visibility, WindowVisibility);
+DE_DECLARE_COMMAND_LINE_OPT(SurfaceWidth, int);
+DE_DECLARE_COMMAND_LINE_OPT(SurfaceHeight, int);
+DE_DECLARE_COMMAND_LINE_OPT(SurfaceType, tcu::SurfaceType);
+DE_DECLARE_COMMAND_LINE_OPT(ScreenRotation, tcu::ScreenRotation);
+DE_DECLARE_COMMAND_LINE_OPT(GLContextType, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(GLConfigID, int);
+DE_DECLARE_COMMAND_LINE_OPT(GLConfigName, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(GLContextFlags, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(CLPlatformID, int);
+DE_DECLARE_COMMAND_LINE_OPT(CLDeviceIDs, std::vector<int>);
+DE_DECLARE_COMMAND_LINE_OPT(CLBuildOptions, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(EGLDisplayType, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(EGLWindowType, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(EGLPixmapType, std::string);
+DE_DECLARE_COMMAND_LINE_OPT(LogImages, bool);
+DE_DECLARE_COMMAND_LINE_OPT(TestOOM, bool);
static void parseIntList (const char* src, std::vector<int>* dst)
{
@@ -109,7 +110,8 @@
{
{ "execute", RUNMODE_EXECUTE },
{ "xml-caselist", RUNMODE_DUMP_XML_CASELIST },
- { "txt-caselist", RUNMODE_DUMP_TEXT_CASELIST }
+ { "txt-caselist", RUNMODE_DUMP_TEXT_CASELIST },
+ { "stdout-caselist",RUNMODE_DUMP_STDOUT_CASELIST}
};
static const NamedValue<WindowVisibility> s_visibilites[] =
{
@@ -141,6 +143,7 @@
<< Option<LogFilename> (DE_NULL, "deqp-log-filename", "Write test results to given file", "TestResults.qpa")
<< Option<RunMode> (DE_NULL, "deqp-runmode", "Execute tests, or write list of test cases into a file",
s_runModes, "execute")
+ << Option<ExportFilenamePattern>(DE_NULL, "deqp-caselist-export-file", "Set the target file name pattern for caselist export", "${packageName}-cases.${typeExtension}")
<< Option<WatchDog> (DE_NULL, "deqp-watchdog", "Enable test watchdog", s_enableNames, "disable")
<< Option<CrashHandler> (DE_NULL, "deqp-crashhandler", "Enable crash handling", s_enableNames, "disable")
<< Option<BaseSeed> (DE_NULL, "deqp-base-seed", "Base seed for test cases that use randomization", "0")
@@ -785,22 +788,23 @@
return isOk;
}
-const char* CommandLine::getLogFileName (void) const { return m_cmdLine.getOption<opt::LogFilename>().c_str(); }
-deUint32 CommandLine::getLogFlags (void) const { return m_logFlags; }
-RunMode CommandLine::getRunMode (void) const { return m_cmdLine.getOption<opt::RunMode>(); }
-WindowVisibility CommandLine::getVisibility (void) const { return m_cmdLine.getOption<opt::Visibility>(); }
-bool CommandLine::isWatchDogEnabled (void) const { return m_cmdLine.getOption<opt::WatchDog>(); }
-bool CommandLine::isCrashHandlingEnabled (void) const { return m_cmdLine.getOption<opt::CrashHandler>(); }
-int CommandLine::getBaseSeed (void) const { return m_cmdLine.getOption<opt::BaseSeed>(); }
-int CommandLine::getTestIterationCount (void) const { return m_cmdLine.getOption<opt::TestIterationCount>(); }
-int CommandLine::getSurfaceWidth (void) const { return m_cmdLine.getOption<opt::SurfaceWidth>(); }
-int CommandLine::getSurfaceHeight (void) const { return m_cmdLine.getOption<opt::SurfaceHeight>(); }
-SurfaceType CommandLine::getSurfaceType (void) const { return m_cmdLine.getOption<opt::SurfaceType>(); }
-ScreenRotation CommandLine::getScreenRotation (void) const { return m_cmdLine.getOption<opt::ScreenRotation>(); }
-int CommandLine::getGLConfigId (void) const { return m_cmdLine.getOption<opt::GLConfigID>(); }
-int CommandLine::getCLPlatformId (void) const { return m_cmdLine.getOption<opt::CLPlatformID>(); }
-const std::vector<int>& CommandLine::getCLDeviceIds (void) const { return m_cmdLine.getOption<opt::CLDeviceIDs>(); }
-bool CommandLine::isOutOfMemoryTestEnabled (void) const { return m_cmdLine.getOption<opt::TestOOM>(); }
+const char* CommandLine::getLogFileName (void) const { return m_cmdLine.getOption<opt::LogFilename>().c_str(); }
+deUint32 CommandLine::getLogFlags (void) const { return m_logFlags; }
+RunMode CommandLine::getRunMode (void) const { return m_cmdLine.getOption<opt::RunMode>(); }
+const char* CommandLine::getCaseListExportFile (void) const { return m_cmdLine.getOption<opt::ExportFilenamePattern>().c_str();}
+WindowVisibility CommandLine::getVisibility (void) const { return m_cmdLine.getOption<opt::Visibility>(); }
+bool CommandLine::isWatchDogEnabled (void) const { return m_cmdLine.getOption<opt::WatchDog>(); }
+bool CommandLine::isCrashHandlingEnabled (void) const { return m_cmdLine.getOption<opt::CrashHandler>(); }
+int CommandLine::getBaseSeed (void) const { return m_cmdLine.getOption<opt::BaseSeed>(); }
+int CommandLine::getTestIterationCount (void) const { return m_cmdLine.getOption<opt::TestIterationCount>(); }
+int CommandLine::getSurfaceWidth (void) const { return m_cmdLine.getOption<opt::SurfaceWidth>(); }
+int CommandLine::getSurfaceHeight (void) const { return m_cmdLine.getOption<opt::SurfaceHeight>(); }
+SurfaceType CommandLine::getSurfaceType (void) const { return m_cmdLine.getOption<opt::SurfaceType>(); }
+ScreenRotation CommandLine::getScreenRotation (void) const { return m_cmdLine.getOption<opt::ScreenRotation>(); }
+int CommandLine::getGLConfigId (void) const { return m_cmdLine.getOption<opt::GLConfigID>(); }
+int CommandLine::getCLPlatformId (void) const { return m_cmdLine.getOption<opt::CLPlatformID>(); }
+const std::vector<int>& CommandLine::getCLDeviceIds (void) const { return m_cmdLine.getOption<opt::CLDeviceIDs>(); }
+bool CommandLine::isOutOfMemoryTestEnabled (void) const { return m_cmdLine.getOption<opt::TestOOM>(); }
const char* CommandLine::getGLContextType (void) const
{
diff --git a/framework/common/tcuCommandLine.hpp b/framework/common/tcuCommandLine.hpp
index 1685e90..37a79a7 100644
--- a/framework/common/tcuCommandLine.hpp
+++ b/framework/common/tcuCommandLine.hpp
@@ -42,6 +42,7 @@
RUNMODE_EXECUTE = 0, //! Test program executes the tests.
RUNMODE_DUMP_XML_CASELIST, //! Test program dumps the list of contained test cases in XML format.
RUNMODE_DUMP_TEXT_CASELIST, //! Test program dumps the list of contained test cases in plain-text format.
+ RUNMODE_DUMP_STDOUT_CASELIST, //! Test program dumps the list of contained test cases in plain-text format into stdout.
RUNMODE_LAST
};
@@ -114,6 +115,9 @@
//! Get run mode (--deqp-runmode)
RunMode getRunMode (void) const;
+ //! Get caselist dump target file pattern (--deqp-caselist-export-file)
+ const char* getCaseListExportFile (void) const;
+
//! Get default window visibility (--deqp-visibility)
WindowVisibility getVisibility (void) const;
diff --git a/framework/common/tcuCompressedTexture.cpp b/framework/common/tcuCompressedTexture.cpp
index c911576..2be372e 100644
--- a/framework/common/tcuCompressedTexture.cpp
+++ b/framework/common/tcuCompressedTexture.cpp
@@ -330,33 +330,33 @@
const int numBits = (high-low) + 1;
DE_ASSERT(de::inRange(numBits, 1, 32));
if (numBits < 32)
- return (src >> low) & ((1u<<numBits)-1);
+ return (deUint32)((src >> low) & ((1u<<numBits)-1));
else
- return (src >> low) & 0xFFFFFFFFu;
+ return (deUint32)((src >> low) & 0xFFFFFFFFu);
}
inline deUint8 extend4To8 (deUint8 src)
{
DE_ASSERT((src & ~((1<<4)-1)) == 0);
- return (src << 4) | src;
+ return (deUint8)((src << 4) | src);
}
inline deUint8 extend5To8 (deUint8 src)
{
DE_ASSERT((src & ~((1<<5)-1)) == 0);
- return (src << 3) | (src >> 2);
+ return (deUint8)((src << 3) | (src >> 2));
}
inline deUint8 extend6To8 (deUint8 src)
{
DE_ASSERT((src & ~((1<<6)-1)) == 0);
- return (src << 2) | (src >> 4);
+ return (deUint8)((src << 2) | (src >> 4));
}
inline deUint8 extend7To8 (deUint8 src)
{
DE_ASSERT((src & ~((1<<7)-1)) == 0);
- return (src << 1) | (src >> 6);
+ return (deUint8)((src << 1) | (src >> 6));
}
inline deInt8 extendSigned3To8 (deUint8 src)
@@ -374,13 +374,13 @@
inline deUint16 extend11To16 (deUint16 src)
{
DE_ASSERT((src & ~((1<<11)-1)) == 0);
- return (src << 5) | (src >> 6);
+ return (deUint16)((src << 5) | (src >> 6));
}
inline deInt16 extend11To16WithSign (deInt16 src)
{
if (src < 0)
- return -(deInt16)extend11To16(-src);
+ return (deInt16)(-(deInt16)extend11To16((deUint16)(-src)));
else
return (deInt16)extend11To16(src);
}
@@ -591,7 +591,7 @@
const deUint32 distNdx = (getBits(src, 34, 35) << 1) | getBit(src, 32);
const int dist = distTable[distNdx];
- paintR[0] = extend4To8((R1a << 2) | R1b);
+ paintR[0] = extend4To8((deUint8)((R1a << 2) | R1b));
paintG[0] = extend4To8(G1);
paintB[0] = extend4To8(B1);
paintR[2] = extend4To8(R2);
@@ -623,8 +623,8 @@
int dist;
baseR[0] = extend4To8(R1);
- baseG[0] = extend4To8((G1a << 1) | G1b);
- baseB[0] = extend4To8((B1a << 3) | B1b);
+ baseG[0] = extend4To8((deUint8)((G1a << 1) | G1b));
+ baseB[0] = extend4To8((deUint8)((B1a << 3) | B1b));
baseR[1] = extend4To8(R2);
baseG[1] = extend4To8(G2);
baseB[1] = extend4To8(B2);
@@ -685,9 +685,9 @@
const deUint8 RH1 = (deUint8)getBits(src, 34, 38);
const deUint8 RH2 = (deUint8)getBit(src, 32);
const deUint8 RO = extend6To8((deUint8)getBits(src, 57, 62));
- const deUint8 GO = extend7To8((GO1 << 6) | GO2);
- const deUint8 BO = extend6To8((BO1 << 5) | (BO2 << 3) | BO3);
- const deUint8 RH = extend6To8((RH1 << 1) | RH2);
+ const deUint8 GO = extend7To8((deUint8)((GO1 << 6) | GO2));
+ const deUint8 BO = extend6To8((deUint8)((BO1 << 5) | (BO2 << 3) | BO3));
+ const deUint8 RH = extend6To8((deUint8)((RH1 << 1) | RH2));
const deUint8 GH = extend7To8((deUint8)getBits(src, 25, 31));
const deUint8 BH = extend6To8((deUint8)getBits(src, 19, 24));
const deUint8 RV = extend6To8((deUint8)getBits(src, 13, 18));
@@ -1103,7 +1103,7 @@
// \note "foo << bar << 1" done instead of "foo << (bar+1)" to avoid overflow, i.e. shift amount being too big.
if (word0Ndx == word1Ndx)
- return (m_words[word0Ndx] & ((((Word)1 << high%WORD_BITS << 1) - 1))) >> ((Word)low % WORD_BITS);
+ return (deUint32)((m_words[word0Ndx] & ((((Word)1 << high%WORD_BITS << 1) - 1))) >> ((Word)low % WORD_BITS));
else
{
DE_ASSERT(word1Ndx == word0Ndx + 1);
@@ -1409,7 +1409,7 @@
deUint8* const dstU = (deUint8*)dst;
for (int i = 0; i < blockWidth*blockHeight; i++)
for (int c = 0; c < 4; c++)
- dstU[i*4 + c] = (rgba[c] & 0xff00) >> 8;
+ dstU[i*4 + c] = (deUint8)((rgba[c] & 0xff00) >> 8);
}
else
{
@@ -1419,7 +1419,7 @@
{
for (int c = 0; c < 4; c++)
{
- if (isFloat16InfOrNan(rgba[c]))
+ if (isFloat16InfOrNan((deFloat16)rgba[c]))
throw InternalError("Infinity or NaN color component in HDR void extent block in ASTC texture (behavior undefined by ASTC specification)");
}
@@ -2264,23 +2264,31 @@
const deUint32 z = smallBlock ? zIn << 1 : zIn;
const deUint32 seed = seedIn + 1024*(numPartitions-1);
const deUint32 rnum = hash52(seed);
- deUint8 seed1 = rnum & 0xf;
- deUint8 seed2 = (rnum >> 4) & 0xf;
- deUint8 seed3 = (rnum >> 8) & 0xf;
- deUint8 seed4 = (rnum >> 12) & 0xf;
- deUint8 seed5 = (rnum >> 16) & 0xf;
- deUint8 seed6 = (rnum >> 20) & 0xf;
- deUint8 seed7 = (rnum >> 24) & 0xf;
- deUint8 seed8 = (rnum >> 28) & 0xf;
- deUint8 seed9 = (rnum >> 18) & 0xf;
- deUint8 seed10 = (rnum >> 22) & 0xf;
- deUint8 seed11 = (rnum >> 26) & 0xf;
- deUint8 seed12 = ((rnum >> 30) | (rnum << 2)) & 0xf;
+ deUint8 seed1 = (deUint8)( rnum & 0xf);
+ deUint8 seed2 = (deUint8)((rnum >> 4) & 0xf);
+ deUint8 seed3 = (deUint8)((rnum >> 8) & 0xf);
+ deUint8 seed4 = (deUint8)((rnum >> 12) & 0xf);
+ deUint8 seed5 = (deUint8)((rnum >> 16) & 0xf);
+ deUint8 seed6 = (deUint8)((rnum >> 20) & 0xf);
+ deUint8 seed7 = (deUint8)((rnum >> 24) & 0xf);
+ deUint8 seed8 = (deUint8)((rnum >> 28) & 0xf);
+ deUint8 seed9 = (deUint8)((rnum >> 18) & 0xf);
+ deUint8 seed10 = (deUint8)((rnum >> 22) & 0xf);
+ deUint8 seed11 = (deUint8)((rnum >> 26) & 0xf);
+ deUint8 seed12 = (deUint8)(((rnum >> 30) | (rnum << 2)) & 0xf);
- seed1 *= seed1; seed5 *= seed5; seed9 *= seed9;
- seed2 *= seed2; seed6 *= seed6; seed10 *= seed10;
- seed3 *= seed3; seed7 *= seed7; seed11 *= seed11;
- seed4 *= seed4; seed8 *= seed8; seed12 *= seed12;
+ seed1 = (deUint8)(seed1 * seed1 );
+ seed2 = (deUint8)(seed2 * seed2 );
+ seed3 = (deUint8)(seed3 * seed3 );
+ seed4 = (deUint8)(seed4 * seed4 );
+ seed5 = (deUint8)(seed5 * seed5 );
+ seed6 = (deUint8)(seed6 * seed6 );
+ seed7 = (deUint8)(seed7 * seed7 );
+ seed8 = (deUint8)(seed8 * seed8 );
+ seed9 = (deUint8)(seed9 * seed9 );
+ seed10 = (deUint8)(seed10 * seed10);
+ seed11 = (deUint8)(seed11 * seed11);
+ seed12 = (deUint8)(seed12 * seed12);
const int shA = (seed & 2) != 0 ? 4 : 5;
const int shB = numPartitions == 3 ? 6 : 5;
@@ -2288,9 +2296,18 @@
const int sh2 = (seed & 1) != 0 ? shB : shA;
const int sh3 = (seed & 0x10) != 0 ? sh1 : sh2;
- seed1 >>= sh1; seed2 >>= sh2; seed3 >>= sh1; seed4 >>= sh2;
- seed5 >>= sh1; seed6 >>= sh2; seed7 >>= sh1; seed8 >>= sh2;
- seed9 >>= sh3; seed10 >>= sh3; seed11 >>= sh3; seed12 >>= sh3;
+ seed1 = (deUint8)(seed1 >> sh1);
+ seed2 = (deUint8)(seed2 >> sh2);
+ seed3 = (deUint8)(seed3 >> sh1);
+ seed4 = (deUint8)(seed4 >> sh2);
+ seed5 = (deUint8)(seed5 >> sh1);
+ seed6 = (deUint8)(seed6 >> sh2);
+ seed7 = (deUint8)(seed7 >> sh1);
+ seed8 = (deUint8)(seed8 >> sh2);
+ seed9 = (deUint8)(seed9 >> sh3);
+ seed10 = (deUint8)(seed10 >> sh3);
+ seed11 = (deUint8)(seed11 >> sh3);
+ seed12 = (deUint8)(seed12 >> sh3);
const int a = 0x3f & (seed1*x + seed2*y + seed11*z + (rnum >> 14));
const int b = 0x3f & (seed3*x + seed4*y + seed12*z + (rnum >> 10));
@@ -2351,7 +2368,7 @@
const deUint32 c = (c0*(64-w) + c1*w + 32) / 64;
if (isSRGB)
- ((deUint8*)dst)[texelNdx*4 + channelNdx] = (c & 0xff00) >> 8;
+ ((deUint8*)dst)[texelNdx*4 + channelNdx] = (deUint8)((c & 0xff00) >> 8);
else
((float*)dst)[texelNdx*4 + channelNdx] = c == 65535 ? 1.0f : (float)c / 65536.0f;
}
@@ -2367,7 +2384,7 @@
const deUint32 mt = m < 512 ? 3*m
: m >= 1536 ? 5*m - 2048
: 4*m - 512;
- const deFloat16 cf = (e << 10) + (mt >> 3);
+ const deFloat16 cf = (deFloat16)((e << 10) + (mt >> 3));
((float*)dst)[texelNdx*4 + channelNdx] = deFloat16To32(isFloat16InfOrNan(cf) ? 0x7bff : cf);
}
diff --git a/framework/common/tcuFloat.hpp b/framework/common/tcuFloat.hpp
index c25692d..fcadc12 100644
--- a/framework/common/tcuFloat.hpp
+++ b/framework/common/tcuFloat.hpp
@@ -106,7 +106,7 @@
float asFloat (void) const;
double asDouble (void) const;
- inline int signBit (void) const { return (m_value >> (ExponentBits+MantissaBits)) & 1; }
+ inline int signBit (void) const { return (int)(m_value >> (ExponentBits+MantissaBits)) & 1; }
inline StorageType exponentBits (void) const { return (m_value >> MantissaBits) & ((StorageType(1)<<ExponentBits)-1); }
inline StorageType mantissaBits (void) const { return m_value & ((StorageType(1)<<MantissaBits)-1); }
@@ -211,7 +211,7 @@
// Handles the typical notation for zero (min exponent, mantissa 0). Note that the exponent usually used exponent (-ExponentBias) for zero/subnormals is not used.
// Instead zero/subnormals have the (normally implicit) leading mantissa bit set to zero.
const bool isDenormOrZero = (exponent == 1 - ExponentBias) && (mantissa >> MantissaBits == 0);
- const StorageType s = StorageType(sign < 0 ? 1 : 0) << (ExponentBits+MantissaBits);
+ const StorageType s = StorageType((StorageType(sign < 0 ? 1 : 0)) << (StorageType(ExponentBits+MantissaBits)));
const StorageType exp = (isShorthandZero || isDenormOrZero) ? StorageType(0) : StorageType(exponent + ExponentBias);
DE_ASSERT(sign == +1 || sign == -1);
@@ -264,7 +264,7 @@
const int eMin = 1 - ExponentBias;
const int eMax = ((1<<ExponentBits)-2) - ExponentBias;
- const StorageType s = StorageType(other.signBit()) << (ExponentBits+MantissaBits); // \note Not sign, but sign bit.
+ const StorageType s = StorageType((StorageType(other.signBit())) << (StorageType(ExponentBits+MantissaBits))); // \note Not sign, but sign bit.
int e = other.exponent();
deUint64 m = other.mantissa();
diff --git a/framework/common/tcuFormatUtil.hpp b/framework/common/tcuFormatUtil.hpp
index 77f65bd..bc0c09e 100644
--- a/framework/common/tcuFormatUtil.hpp
+++ b/framework/common/tcuFormatUtil.hpp
@@ -149,7 +149,7 @@
if (name)
return stream << name;
else
- return stream << Hex<NumBytes*2>(m_value);
+ return stream << Hex<NumBytes*2>((deUint64)m_value);
}
std::string toString (void) const
@@ -158,7 +158,7 @@
if (name)
return std::string(name);
else
- return Hex<NumBytes*2>(m_value).toString();
+ return Hex<NumBytes*2>((deUint64)m_value).toString();
}
private:
diff --git a/framework/common/tcuFuzzyImageCompare.cpp b/framework/common/tcuFuzzyImageCompare.cpp
index cfcd576..071087f 100644
--- a/framework/common/tcuFuzzyImageCompare.cpp
+++ b/framework/common/tcuFuzzyImageCompare.cpp
@@ -32,6 +32,11 @@
namespace tcu
{
+enum
+{
+ MIN_ERR_THRESHOLD = 4 // Magic to make small differences go away
+};
+
using std::vector;
template<int Channel>
@@ -105,17 +110,14 @@
}
#endif
-static inline float compareColors (deUint32 pa, deUint32 pb, int minErrThreshold)
+static inline deUint32 colorDistSquared (deUint32 pa, deUint32 pb)
{
- int r = de::max<int>(de::abs((int)getChannel<0>(pa) - (int)getChannel<0>(pb)) - minErrThreshold, 0);
- int g = de::max<int>(de::abs((int)getChannel<1>(pa) - (int)getChannel<1>(pb)) - minErrThreshold, 0);
- int b = de::max<int>(de::abs((int)getChannel<2>(pa) - (int)getChannel<2>(pb)) - minErrThreshold, 0);
- int a = de::max<int>(de::abs((int)getChannel<3>(pa) - (int)getChannel<3>(pb)) - minErrThreshold, 0);
+ const int r = de::max<int>(de::abs((int)getChannel<0>(pa) - (int)getChannel<0>(pb)) - MIN_ERR_THRESHOLD, 0);
+ const int g = de::max<int>(de::abs((int)getChannel<1>(pa) - (int)getChannel<1>(pb)) - MIN_ERR_THRESHOLD, 0);
+ const int b = de::max<int>(de::abs((int)getChannel<2>(pa) - (int)getChannel<2>(pb)) - MIN_ERR_THRESHOLD, 0);
+ const int a = de::max<int>(de::abs((int)getChannel<3>(pa) - (int)getChannel<3>(pb)) - MIN_ERR_THRESHOLD, 0);
- float scale = 1.0f/(255-minErrThreshold);
- float sqSum = (float)(r*r + g*g + b*b + a*a) * (scale*scale);
-
- return deFloatSqrt(sqSum);
+ return deUint32(r*r + g*g + b*b + a*a);
}
template<int NumChannels>
@@ -208,14 +210,13 @@
}
template<int NumChannels>
-static float compareToNeighbor (const FuzzyCompareParams& params, de::Random& rnd, deUint32 pixel, const ConstPixelBufferAccess& surface, int x, int y)
+static deUint32 distSquaredToNeighbor (de::Random& rnd, deUint32 pixel, const ConstPixelBufferAccess& surface, int x, int y)
{
- float minErr = +100.f;
-
// (x, y) + (0, 0)
- minErr = deFloatMin(minErr, compareColors(pixel, readUnorm8<NumChannels>(surface, x, y), params.minErrThreshold));
- if (minErr == 0.0f)
- return minErr;
+ deUint32 minDist = colorDistSquared(pixel, readUnorm8<NumChannels>(surface, x, y));
+
+ if (minDist == 0)
+ return minDist;
// Area around (x, y)
static const int s_coords[][2] =
@@ -238,9 +239,9 @@
if (!deInBounds32(dx, 0, surface.getWidth()) || !deInBounds32(dy, 0, surface.getHeight()))
continue;
- minErr = deFloatMin(minErr, compareColors(pixel, readUnorm8<NumChannels>(surface, dx, dy), params.minErrThreshold));
- if (minErr == 0.0f)
- return minErr;
+ minDist = de::min(minDist, colorDistSquared(pixel, readUnorm8<NumChannels>(surface, dx, dy)));
+ if (minDist == 0)
+ return minDist;
}
// Random bilinear-interpolated samples around (x, y)
@@ -251,12 +252,12 @@
deUint32 sample = bilinearSample<NumChannels>(surface, dx, dy);
- minErr = deFloatMin(minErr, compareColors(pixel, sample, params.minErrThreshold));
- if (minErr == 0.0f)
- return minErr;
+ minDist = de::min(minDist, colorDistSquared(pixel, sample));
+ if (minDist == 0)
+ return minDist;
}
- return minErr;
+ return minDist;
}
static inline float toGrayscale (const Vec4& c)
@@ -285,7 +286,7 @@
TextureLevel refFiltered(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), width, height);
TextureLevel cmpFiltered(TextureFormat(TextureFormat::RGBA, TextureFormat::UNORM_INT8), width, height);
- // Kernel = {0.15, 0.7, 0.15}
+ // Kernel = {0.1, 0.8, 0.1}
vector<float> kernel(3);
kernel[0] = kernel[2] = 0.1f; kernel[1]= 0.8f;
int shift = (int)(kernel.size() - 1) / 2;
@@ -306,8 +307,8 @@
DE_ASSERT(DE_FALSE);
}
- int numSamples = 0;
- float errSum = 0.0f;
+ int numSamples = 0;
+ deUint64 distSum4 = 0ull;
// Clear error mask to green.
clear(errorMask, Vec4(0.0f, 1.0f, 0.0f, 1.0f));
@@ -319,26 +320,35 @@
{
for (int x = 1; x < width-1; x += params.maxSampleSkip > 0 ? (int)rnd.getInt(0, params.maxSampleSkip) : 1)
{
- float err = deFloatMin(compareToNeighbor<4>(params, rnd, readUnorm8<4>(refAccess, x, y), cmpAccess, x, y),
- compareToNeighbor<4>(params, rnd, readUnorm8<4>(cmpAccess, x, y), refAccess, x, y));
+ const deUint32 minDist2 = de::min(distSquaredToNeighbor<4>(rnd, readUnorm8<4>(refAccess, x, y), cmpAccess, x, y),
+ distSquaredToNeighbor<4>(rnd, readUnorm8<4>(cmpAccess, x, y), refAccess, x, y));
+ const deUint64 newSum4 = distSum4 + minDist2*minDist2;
- err = deFloatPow(err, params.errExp);
-
- errSum += err;
+ distSum4 = (newSum4 >= distSum4) ? newSum4 : ~0ull; // In case of overflow
numSamples += 1;
// Build error image.
- float red = err * 500.0f;
- float luma = toGrayscale(cmp.getPixel(x, y));
- float rF = 0.7f + 0.3f*luma;
- errorMask.setPixel(Vec4(red*rF, (1.0f-red)*rF, 0.0f, 1.0f), x, y);
+ {
+ const int scale = 255-MIN_ERR_THRESHOLD;
+ const float err2 = float(minDist2) / float(scale*scale);
+ const float err4 = err2*err2;
+ const float red = err4 * 500.0f;
+ const float luma = toGrayscale(cmp.getPixel(x, y));
+ const float rF = 0.7f + 0.3f*luma;
+
+ errorMask.setPixel(Vec4(red*rF, (1.0f-red)*rF, 0.0f, 1.0f), x, y);
+ }
}
}
- // Scale error sum based on number of samples taken
- errSum *= (float)((width-2) * (height-2)) / (float)numSamples;
+ {
+ // Scale error sum based on number of samples taken
+ const double pSamples = double((width-2) * (height-2)) / double(numSamples);
+ const deUint64 colScale = deUint64(255-MIN_ERR_THRESHOLD);
+ const deUint64 colScale4 = colScale*colScale*colScale*colScale;
- return errSum;
+ return float(double(distSum4) / double(colScale4) * pSamples);
+ }
}
} // tcu
diff --git a/framework/common/tcuFuzzyImageCompare.hpp b/framework/common/tcuFuzzyImageCompare.hpp
index ba28ab4..0c81fbc 100644
--- a/framework/common/tcuFuzzyImageCompare.hpp
+++ b/framework/common/tcuFuzzyImageCompare.hpp
@@ -33,18 +33,12 @@
struct FuzzyCompareParams
{
- FuzzyCompareParams (int maxSampleSkip_ = 8,
- int minErrThreshold_ = 4,
- float errExp_ = 4.0f)
- : maxSampleSkip (maxSampleSkip_)
- , minErrThreshold (minErrThreshold_)
- , errExp (errExp_)
+ FuzzyCompareParams (int maxSampleSkip_ = 8)
+ : maxSampleSkip(maxSampleSkip_)
{
}
int maxSampleSkip;
- int minErrThreshold;
- float errExp;
};
float fuzzyCompare (const FuzzyCompareParams& params, const ConstPixelBufferAccess& ref, const ConstPixelBufferAccess& cmp, const PixelBufferAccess& errorMask);
diff --git a/framework/common/tcuImageIO.cpp b/framework/common/tcuImageIO.cpp
index e17443b..a87360f 100644
--- a/framework/common/tcuImageIO.cpp
+++ b/framework/common/tcuImageIO.cpp
@@ -214,7 +214,7 @@
{
deUint16 val;
resource->read((deUint8*)&val, sizeof(val));
- return ((val >> 8) & 0xFF) | ((val << 8) & 0xFF00);
+ return (deUint16)(((val >> 8) & 0xFF) | ((val << 8) & 0xFF00));
}
/*--------------------------------------------------------------------*//*!
diff --git a/framework/common/tcuRGBA.cpp b/framework/common/tcuRGBA.cpp
index 3d8d399..fedd91c 100644
--- a/framework/common/tcuRGBA.cpp
+++ b/framework/common/tcuRGBA.cpp
@@ -23,6 +23,7 @@
#include "tcuRGBA.hpp"
#include "tcuVector.hpp"
+#include "tcuTextureUtil.hpp"
namespace tcu
{
@@ -36,10 +37,10 @@
RGBA::RGBA (const Vec4& v)
{
- int r = deClamp32(int(v.x() * 255.0f + 0.5f), 0, 255);
- int g = deClamp32(int(v.y() * 255.0f + 0.5f), 0, 255);
- int b = deClamp32(int(v.z() * 255.0f + 0.5f), 0, 255);
- int a = deClamp32(int(v.w() * 255.0f + 0.5f), 0, 255);
+ const deUint32 r = (deUint32)floatToU8(v.x());
+ const deUint32 g = (deUint32)floatToU8(v.y());
+ const deUint32 b = (deUint32)floatToU8(v.z());
+ const deUint32 a = (deUint32)floatToU8(v.w());
m_value = (a << ALPHA_SHIFT) | (r << RED_SHIFT) | (g << GREEN_SHIFT) | (b << BLUE_SHIFT);
}
diff --git a/framework/common/tcuRGBA.hpp b/framework/common/tcuRGBA.hpp
index c5d3243..76e7dbc 100644
--- a/framework/common/tcuRGBA.hpp
+++ b/framework/common/tcuRGBA.hpp
@@ -62,7 +62,7 @@
DE_ASSERT(deInRange32(g, 0, 255));
DE_ASSERT(deInRange32(b, 0, 255));
DE_ASSERT(deInRange32(a, 0, 255));
- m_value = (a << ALPHA_SHIFT) | (r << RED_SHIFT) | (g << GREEN_SHIFT) | (b << BLUE_SHIFT);
+ m_value = ((deUint32)a << ALPHA_SHIFT) | ((deUint32)r << RED_SHIFT) | ((deUint32)g << GREEN_SHIFT) | ((deUint32)b << BLUE_SHIFT);
}
explicit RGBA (deUint32 val)
@@ -72,20 +72,20 @@
explicit RGBA (const Vec4& v);
- void setRed (int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~(0xFF << RED_SHIFT)) | (v << RED_SHIFT); }
- void setGreen (int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~(0xFF << GREEN_SHIFT)) | (v << GREEN_SHIFT); }
- void setBlue (int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~(0xFF << BLUE_SHIFT)) | (v << BLUE_SHIFT); }
- void setAlpha (int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~(0xFF << ALPHA_SHIFT)) | (v << ALPHA_SHIFT); }
- int getRed (void) const { return (m_value >> RED_SHIFT) & 0xFF; }
- int getGreen (void) const { return (m_value >> GREEN_SHIFT) & 0xFF; }
- int getBlue (void) const { return (m_value >> BLUE_SHIFT) & 0xFF; }
- int getAlpha (void) const { return (m_value >> ALPHA_SHIFT) & 0xFF; }
+ void setRed (int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~((deUint32)0xFFu << RED_SHIFT)) | ((deUint32)v << RED_SHIFT); }
+ void setGreen (int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~((deUint32)0xFFu << GREEN_SHIFT)) | ((deUint32)v << GREEN_SHIFT); }
+ void setBlue (int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~((deUint32)0xFFu << BLUE_SHIFT)) | ((deUint32)v << BLUE_SHIFT); }
+ void setAlpha (int v) { DE_ASSERT(deInRange32(v, 0, 255)); m_value = (m_value & ~((deUint32)0xFFu << ALPHA_SHIFT)) | ((deUint32)v << ALPHA_SHIFT); }
+ int getRed (void) const { return (int)((m_value >> (deUint32)RED_SHIFT) & 0xFFu); }
+ int getGreen (void) const { return (int)((m_value >> (deUint32)GREEN_SHIFT) & 0xFFu); }
+ int getBlue (void) const { return (int)((m_value >> (deUint32)BLUE_SHIFT) & 0xFFu); }
+ int getAlpha (void) const { return (int)((m_value >> (deUint32)ALPHA_SHIFT) & 0xFFu); }
deUint32 getPacked (void) const { return m_value; }
bool isBelowThreshold (RGBA thr) const { return (getRed() <= thr.getRed()) && (getGreen() <= thr.getGreen()) && (getBlue() <= thr.getBlue()) && (getAlpha() <= thr.getAlpha()); }
static RGBA fromBytes (const deUint8* bytes) { return RGBA(bytes[0], bytes[1], bytes[2], bytes[3]); }
- void toBytes (deUint8* bytes) const { bytes[0] = getRed(); bytes[1] = getGreen(); bytes[2] = getBlue(); bytes[3] = getAlpha(); }
+ void toBytes (deUint8* bytes) const { bytes[0] = (deUint8)getRed(); bytes[1] = (deUint8)getGreen(); bytes[2] = (deUint8)getBlue(); bytes[3] = (deUint8)getAlpha(); }
Vec4 toVec (void) const;
IVec4 toIVec (void) const;
diff --git a/framework/common/tcuResultCollector.hpp b/framework/common/tcuResultCollector.hpp
index d4af499..7fb8ed2 100644
--- a/framework/common/tcuResultCollector.hpp
+++ b/framework/common/tcuResultCollector.hpp
@@ -43,24 +43,25 @@
class ResultCollector
{
public:
- ResultCollector (void);
- ResultCollector (TestLog& log, const std::string& prefix = "");
+ ResultCollector (void);
+ ResultCollector (TestLog& log, const std::string& prefix = "");
- qpTestResult getResult (void) const { return m_result; }
+ qpTestResult getResult (void) const { return m_result; }
+ const std::string getMessage (void) const { return m_message; }
- void fail (const std::string& msg);
- bool check (bool condition, const std::string& msg);
+ void fail (const std::string& msg);
+ bool check (bool condition, const std::string& msg);
- void addResult (qpTestResult result, const std::string& msg);
- bool checkResult (bool condition, qpTestResult result, const std::string& msg);
+ void addResult (qpTestResult result, const std::string& msg);
+ bool checkResult (bool condition, qpTestResult result, const std::string& msg);
- void setTestContextResult (TestContext& testCtx);
+ void setTestContextResult (TestContext& testCtx);
private:
- TestLog* m_log;
- std::string m_prefix;
- qpTestResult m_result;
- std::string m_message;
+ TestLog* const m_log;
+ const std::string m_prefix;
+ qpTestResult m_result;
+ std::string m_message;
} DE_WARN_UNUSED_TYPE;
} // tcu
diff --git a/framework/common/tcuSeedBuilder.cpp b/framework/common/tcuSeedBuilder.cpp
index b08d22d..688b9c7 100644
--- a/framework/common/tcuSeedBuilder.cpp
+++ b/framework/common/tcuSeedBuilder.cpp
@@ -87,7 +87,7 @@
SeedBuilder& operator<< (SeedBuilder& builder, deUint8 value)
{
- const deInt8 val = value ^ 140u;
+ const deUint8 val = value ^ 140u;
builder.feed(sizeof(val), &val);
return builder;
diff --git a/framework/common/tcuTestHierarchyUtil.cpp b/framework/common/tcuTestHierarchyUtil.cpp
index e8cd6c9..dc21619 100644
--- a/framework/common/tcuTestHierarchyUtil.cpp
+++ b/framework/common/tcuTestHierarchyUtil.cpp
@@ -23,6 +23,8 @@
#include "tcuTestHierarchyUtil.hpp"
#include "tcuStringTemplate.hpp"
+#include "tcuCommandLine.hpp"
+
#include "qpXmlWriter.h"
#include <fstream>
@@ -57,122 +59,141 @@
return StringTemplate(pattern).specialize(args);
}
-void writeXmlCaselists (TestPackageRoot& root, TestContext& testCtx, const tcu::CommandLine& cmdLine)
+static void writeXmlCaselist (TestHierarchyIterator& iter, qpXmlWriter* writer)
{
- const char* const filenamePattern = "${packageName}-cases.${typeExtension}"; // \todo [2015-02-27 pyry] Make this command line argument
- DefaultHierarchyInflater inflater (testCtx);
- TestHierarchyIterator iter (root, inflater, cmdLine);
- FILE* curFile = DE_NULL;
- qpXmlWriter* writer = DE_NULL;
+ DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE &&
+ iter.getNode()->getNodeType() == NODETYPE_PACKAGE);
- try
{
- while (iter.getState() != TestHierarchyIterator::STATE_FINISHED)
+ const TestNode* node = iter.getNode();
+ qpXmlAttribute attribs[2];
+ int numAttribs = 0;
+ attribs[numAttribs++] = qpSetStringAttrib("PackageName", node->getName());
+ attribs[numAttribs++] = qpSetStringAttrib("Description", node->getDescription());
+ DE_ASSERT(numAttribs <= DE_LENGTH_OF_ARRAY(attribs));
+
+ if (!qpXmlWriter_startDocument(writer) ||
+ !qpXmlWriter_startElement(writer, "TestCaseList", numAttribs, attribs))
+ throw Exception("Failed to start XML document");
+ }
+
+ iter.next();
+
+ while (iter.getNode()->getNodeType() != NODETYPE_PACKAGE)
+ {
+ const TestNode* const node = iter.getNode();
+ const TestNodeType nodeType = node->getNodeType();
+ const bool isEnter = iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE;
+
+ DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE ||
+ iter.getState() == TestHierarchyIterator::STATE_LEAVE_NODE);
{
- const TestNode* const node = iter.getNode();
- const TestNodeType nodeType = node->getNodeType();
- const bool isEnter = iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE;
-
- DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE ||
- iter.getState() == TestHierarchyIterator::STATE_LEAVE_NODE);
-
- if (nodeType == NODETYPE_PACKAGE)
+ if (isEnter)
{
- if (isEnter)
- {
- const string filename = makePackageFilename(filenamePattern, node->getName(), "xml");
- qpXmlAttribute attribs[2];
- int numAttribs = 0;
+ const string caseName = node->getName();
+ const string description = node->getDescription();
+ qpXmlAttribute attribs[3];
+ int numAttribs = 0;
- DE_ASSERT(!curFile && !writer);
+ attribs[numAttribs++] = qpSetStringAttrib("Name", caseName.c_str());
+ attribs[numAttribs++] = qpSetStringAttrib("CaseType", getNodeTypeName(nodeType));
+ attribs[numAttribs++] = qpSetStringAttrib("Description", description.c_str());
+ DE_ASSERT(numAttribs <= DE_LENGTH_OF_ARRAY(attribs));
- print("Writing test cases from '%s' to file '%s'..\n", node->getName(), filename.c_str());
-
- curFile = fopen(filename.c_str(), "wb");
- if (!curFile)
- throw Exception("Failed to open " + filename);
-
- writer = qpXmlWriter_createFileWriter(curFile, DE_FALSE);
- if (!writer)
- throw Exception("Failed to create qpXmlWriter");
-
- attribs[numAttribs++] = qpSetStringAttrib("PackageName", node->getName());
- attribs[numAttribs++] = qpSetStringAttrib("Description", node->getDescription());
- DE_ASSERT(numAttribs <= DE_LENGTH_OF_ARRAY(attribs));
-
- if (!qpXmlWriter_startDocument(writer) ||
- !qpXmlWriter_startElement(writer, "TestCaseList", numAttribs, attribs))
- throw Exception("Failed to start XML document");
- }
- else
- {
- if (!qpXmlWriter_endElement(writer, "TestCaseList") ||
- !qpXmlWriter_endDocument(writer))
- throw Exception("Failed to terminate XML document");
-
- qpXmlWriter_destroy(writer);
- fclose(curFile);
-
- writer = DE_NULL;
- curFile = DE_NULL;
- }
+ if (!qpXmlWriter_startElement(writer, "TestCase", numAttribs, attribs))
+ throw Exception("Writing to case list file failed");
}
else
{
- if (isEnter)
- {
- const string caseName = node->getName();
- const string description = node->getDescription();
- qpXmlAttribute attribs[3];
- int numAttribs = 0;
-
- attribs[numAttribs++] = qpSetStringAttrib("Name", caseName.c_str());
- attribs[numAttribs++] = qpSetStringAttrib("CaseType", getNodeTypeName(nodeType));
- attribs[numAttribs++] = qpSetStringAttrib("Description", description.c_str());
- DE_ASSERT(numAttribs <= DE_LENGTH_OF_ARRAY(attribs));
-
- if (!qpXmlWriter_startElement(writer, "TestCase", numAttribs, attribs))
- throw Exception("Writing to case list file failed");
- }
- else
- {
- if (!qpXmlWriter_endElement(writer, "TestCase"))
- throw tcu::Exception("Writing to case list file failed");
- }
+ if (!qpXmlWriter_endElement(writer, "TestCase"))
+ throw tcu::Exception("Writing to case list file failed");
}
-
- iter.next();
}
- }
- catch (...)
- {
- if (writer)
- qpXmlWriter_destroy(writer);
- if (curFile)
- fclose(curFile);
-
- throw;
+ iter.next();
}
- DE_ASSERT(!curFile && !writer);
+ // This could be done in catch, but the file is corrupt at that point anyways.
+ if (!qpXmlWriter_endElement(writer, "TestCaseList") ||
+ !qpXmlWriter_endDocument(writer))
+ throw Exception("Failed to terminate XML document");
}
-void writeTxtCaselists (TestPackageRoot& root, TestContext& testCtx, const tcu::CommandLine& cmdLine)
+/*--------------------------------------------------------------------*//*!
+ * \brief Export the test list of each package into a separate XML file.
+ *//*--------------------------------------------------------------------*/
+void writeXmlCaselistsToFiles (TestPackageRoot& root, TestContext& testCtx, const CommandLine& cmdLine)
{
- const char* const filenamePattern = "${packageName}-cases.${typeExtension}"; // \todo [2015-02-27 pyry] Make this command line argument
DefaultHierarchyInflater inflater (testCtx);
TestHierarchyIterator iter (root, inflater, cmdLine);
+ const char* const filenamePattern = cmdLine.getCaseListExportFile();
while (iter.getState() != TestHierarchyIterator::STATE_FINISHED)
{
+ const TestNode* node = iter.getNode();
+ const char* pkgName = node->getName();
+ const string filename = makePackageFilename(filenamePattern, pkgName, "xml");
+
DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE &&
+ node->getNodeType() == NODETYPE_PACKAGE);
+
+ FILE* file = DE_NULL;
+ qpXmlWriter* writer = DE_NULL;
+
+ try
+ {
+ file = fopen(filename.c_str(), "wb");
+ if (!file)
+ throw Exception("Failed to open " + filename);
+
+ writer = qpXmlWriter_createFileWriter(file, DE_FALSE);
+ if (!writer)
+ throw Exception("XML writer creation failed");
+
+ print("Writing test cases from '%s' to file '%s'..\n", pkgName, filename.c_str());
+
+ writeXmlCaselist(iter, writer);
+
+ qpXmlWriter_destroy(writer);
+ writer = DE_NULL;
+
+ fclose(file);
+ file = DE_NULL;
+ }
+ catch (...)
+ {
+ if (writer)
+ qpXmlWriter_destroy(writer);
+ if (file)
+ fclose(file);
+ throw;
+ }
+
+ DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_LEAVE_NODE &&
iter.getNode()->getNodeType() == NODETYPE_PACKAGE);
+ iter.next();
+ }
+}
- const char* pkgName = iter.getNode()->getName();
+/*--------------------------------------------------------------------*//*!
+ * \brief Export the test list of each package into a separate ascii file.
+ *//*--------------------------------------------------------------------*/
+void writeTxtCaselistsToFiles (TestPackageRoot& root, TestContext& testCtx, const CommandLine& cmdLine)
+{
+ DefaultHierarchyInflater inflater (testCtx);
+ TestHierarchyIterator iter (root, inflater, cmdLine);
+ const char* const filenamePattern = cmdLine.getCaseListExportFile();
+
+ while (iter.getState() != TestHierarchyIterator::STATE_FINISHED)
+ {
+ const TestNode* node = iter.getNode();
+ const char* pkgName = node->getName();
const string filename = makePackageFilename(filenamePattern, pkgName, "txt");
- std::ofstream out (filename.c_str(), std::ios_base::binary);
+ DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE &&
+ node->getNodeType() == NODETYPE_PACKAGE);
+
+ std::ofstream out(filename.c_str(), std::ios_base::binary);
if (!out.is_open() || !out.good())
throw Exception("Failed to open " + filename);
diff --git a/framework/common/tcuTestHierarchyUtil.hpp b/framework/common/tcuTestHierarchyUtil.hpp
index 683f7f1..a535533 100644
--- a/framework/common/tcuTestHierarchyUtil.hpp
+++ b/framework/common/tcuTestHierarchyUtil.hpp
@@ -30,8 +30,8 @@
{
// \todo [2015-02-26 pyry] Remove TestContext requirement
-void writeXmlCaselists (TestPackageRoot& root, TestContext& testCtx, const tcu::CommandLine& cmdLine);
-void writeTxtCaselists (TestPackageRoot& root, TestContext& testCtx, const tcu::CommandLine& cmdLine);
+void writeXmlCaselistsToFiles (TestPackageRoot& root, TestContext& testCtx, const CommandLine& cmdLine);
+void writeTxtCaselistsToFiles (TestPackageRoot& root, TestContext& testCtx, const CommandLine& cmdLine);
} // tcu
diff --git a/framework/common/tcuTestLog.cpp b/framework/common/tcuTestLog.cpp
index 5870f10..bbb41ee 100644
--- a/framework/common/tcuTestLog.cpp
+++ b/framework/common/tcuTestLog.cpp
@@ -63,7 +63,77 @@
, m_bias (0.0f, 0.0f, 0.0f, 0.0f)
, m_compression (compression)
{
- computePixelScaleBias(access, m_scale, m_bias);
+ // Simplify combined formats that only use a single channel
+ if (tcu::isCombinedDepthStencilType(m_access.getFormat().type))
+ {
+ if (m_access.getFormat().order == tcu::TextureFormat::D)
+ m_access = tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_DEPTH);
+ else if (m_access.getFormat().order == tcu::TextureFormat::S)
+ m_access = tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_STENCIL);
+ }
+
+ // Implicit scale and bias
+ if (m_access.getFormat().order != tcu::TextureFormat::DS)
+ computePixelScaleBias(m_access, m_scale, m_bias);
+ else
+ {
+ // Pack D and S bias and scale to R and G
+ const ConstPixelBufferAccess depthAccess = tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_DEPTH);
+ const ConstPixelBufferAccess stencilAccess = tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_STENCIL);
+ tcu::Vec4 depthScale;
+ tcu::Vec4 depthBias;
+ tcu::Vec4 stencilScale;
+ tcu::Vec4 stencilBias;
+
+ computePixelScaleBias(depthAccess, depthScale, depthBias);
+ computePixelScaleBias(stencilAccess, stencilScale, stencilBias);
+
+ m_scale = tcu::Vec4(depthScale.x(), stencilScale.x(), 0.0f, 0.0f);
+ m_bias = tcu::Vec4(depthBias.x(), stencilBias.x(), 0.0f, 0.0f);
+ }
+}
+
+LogImage::LogImage (const std::string& name, const std::string& description, const ConstPixelBufferAccess& access, const Vec4& scale, const Vec4& bias, qpImageCompressionMode compression)
+ : m_name (name)
+ , m_description (description)
+ , m_access (access)
+ , m_scale (scale)
+ , m_bias (bias)
+ , m_compression (compression)
+{
+ // Cannot set scale and bias of combined formats
+ DE_ASSERT(access.getFormat().order != tcu::TextureFormat::DS);
+
+ // Simplify access
+ if (tcu::isCombinedDepthStencilType(access.getFormat().type))
+ {
+ if (access.getFormat().order == tcu::TextureFormat::D)
+ m_access = tcu::getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_DEPTH);
+ if (access.getFormat().order == tcu::TextureFormat::S)
+ m_access = tcu::getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_STENCIL);
+ else
+ {
+ // Cannot log a DS format
+ DE_ASSERT(false);
+ return;
+ }
+ }
+}
+
+void LogImage::write (TestLog& log) const
+{
+ if (m_access.getFormat().order != tcu::TextureFormat::DS)
+ log.writeImage(m_name.c_str(), m_description.c_str(), m_access, m_scale, m_bias, m_compression);
+ else
+ {
+ const ConstPixelBufferAccess depthAccess = tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_DEPTH);
+ const ConstPixelBufferAccess stencilAccess = tcu::getEffectiveDepthStencilAccess(m_access, tcu::Sampler::MODE_STENCIL);
+
+ log.startImageSet(m_name.c_str(), m_description.c_str());
+ log.writeImage("Depth", "Depth channel", depthAccess, m_scale.swizzle(0, 0, 0, 0), m_bias.swizzle(0, 0, 0, 0), m_compression);
+ log.writeImage("Stencil", "Stencil channel", stencilAccess, m_scale.swizzle(1, 1, 1, 1), m_bias.swizzle(1, 1, 1, 1), m_compression);
+ log.endImageSet();
+ }
}
// MessageBuilder
@@ -170,6 +240,9 @@
int height = access.getHeight();
int depth = access.getDepth();
+ // Writing a combined image does not make sense
+ DE_ASSERT(!tcu::isCombinedDepthStencilType(access.getFormat().type));
+
// Do not bother with preprocessing if images are not stored
if ((qpTestLog_getLogFlags(m_log) & QP_TEST_LOG_EXCLUDE_IMAGES) != 0)
return;
diff --git a/framework/common/tcuTestLog.hpp b/framework/common/tcuTestLog.hpp
index dc7e045..7d76921 100644
--- a/framework/common/tcuTestLog.hpp
+++ b/framework/common/tcuTestLog.hpp
@@ -253,15 +253,7 @@
LogImage (const std::string& name, const std::string& description, const ConstPixelBufferAccess& access, qpImageCompressionMode compression = QP_IMAGE_COMPRESSION_MODE_BEST);
- LogImage (const std::string& name, const std::string& description, const ConstPixelBufferAccess& access, const Vec4& scale, const Vec4& bias, qpImageCompressionMode compression = QP_IMAGE_COMPRESSION_MODE_BEST)
- : m_name (name)
- , m_description (description)
- , m_access (access)
- , m_scale (scale)
- , m_bias (bias)
- , m_compression (compression)
- {
- }
+ LogImage (const std::string& name, const std::string& description, const ConstPixelBufferAccess& access, const Vec4& scale, const Vec4& bias, qpImageCompressionMode compression = QP_IMAGE_COMPRESSION_MODE_BEST);
void write (TestLog& log) const;
@@ -478,11 +470,6 @@
log.startImageSet(m_name.c_str(), m_description.c_str());
}
-inline void LogImage::write (TestLog& log) const
-{
- log.writeImage(m_name.c_str(), m_description.c_str(), m_access, m_scale, m_bias, m_compression);
-}
-
inline void LogSection::write (TestLog& log) const
{
log.startSection(m_name.c_str(), m_description.c_str());
diff --git a/framework/common/tcuTexLookupVerifier.cpp b/framework/common/tcuTexLookupVerifier.cpp
index 4a70168..7f3e277 100644
--- a/framework/common/tcuTexLookupVerifier.cpp
+++ b/framework/common/tcuTexLookupVerifier.cpp
@@ -293,6 +293,8 @@
{
DE_ASSERT(xBounds.x() <= xBounds.y());
DE_ASSERT(yBounds.x() <= yBounds.y());
+ DE_ASSERT(xBounds.x() + searchStep > xBounds.x()); // step is not effectively 0
+ DE_ASSERT(xBounds.y() + searchStep > xBounds.y());
if (!isInColorBounds(prec, quad, result))
return false;
@@ -322,6 +324,10 @@
DE_ASSERT(xBounds.x() <= xBounds.y());
DE_ASSERT(yBounds.x() <= yBounds.y());
DE_ASSERT(zBounds.x() <= zBounds.y());
+ DE_ASSERT(xBounds.x() + searchStep > xBounds.x()); // step is not effectively 0
+ DE_ASSERT(xBounds.y() + searchStep > xBounds.y());
+ DE_ASSERT(yBounds.x() + searchStep > yBounds.x());
+ DE_ASSERT(yBounds.y() + searchStep > yBounds.y());
if (!isInColorBounds(prec, quad0, quad1, result))
return false;
@@ -354,6 +360,10 @@
{
DE_ASSERT(xBounds0.x() <= xBounds0.y());
DE_ASSERT(xBounds1.x() <= xBounds1.y());
+ DE_ASSERT(xBounds0.x() + searchStep > xBounds0.x()); // step is not effectively 0
+ DE_ASSERT(xBounds0.y() + searchStep > xBounds0.y());
+ DE_ASSERT(xBounds1.x() + searchStep > xBounds1.x());
+ DE_ASSERT(xBounds1.y() + searchStep > xBounds1.y());
if (!isInColorBounds(prec, line0, line1, result))
return false;
@@ -391,6 +401,14 @@
DE_ASSERT(yBounds0.x() <= yBounds0.y());
DE_ASSERT(xBounds1.x() <= xBounds1.y());
DE_ASSERT(yBounds1.x() <= yBounds1.y());
+ DE_ASSERT(xBounds0.x() + searchStep > xBounds0.x()); // step is not effectively 0
+ DE_ASSERT(xBounds0.y() + searchStep > xBounds0.y());
+ DE_ASSERT(yBounds0.x() + searchStep > yBounds0.x());
+ DE_ASSERT(yBounds0.y() + searchStep > yBounds0.y());
+ DE_ASSERT(xBounds1.x() + searchStep > xBounds1.x());
+ DE_ASSERT(xBounds1.y() + searchStep > xBounds1.y());
+ DE_ASSERT(yBounds1.x() + searchStep > yBounds1.x());
+ DE_ASSERT(yBounds1.y() + searchStep > yBounds1.y());
if (!isInColorBounds(prec, quad0, quad1, result))
return false;
@@ -442,6 +460,18 @@
DE_ASSERT(xBounds1.x() <= xBounds1.y());
DE_ASSERT(yBounds1.x() <= yBounds1.y());
DE_ASSERT(zBounds1.x() <= zBounds1.y());
+ DE_ASSERT(xBounds0.x() + searchStep > xBounds0.x()); // step is not effectively 0
+ DE_ASSERT(xBounds0.y() + searchStep > xBounds0.y());
+ DE_ASSERT(yBounds0.x() + searchStep > yBounds0.x());
+ DE_ASSERT(yBounds0.y() + searchStep > yBounds0.y());
+ DE_ASSERT(zBounds0.x() + searchStep > zBounds0.x());
+ DE_ASSERT(zBounds0.y() + searchStep > zBounds0.y());
+ DE_ASSERT(xBounds1.x() + searchStep > xBounds1.x());
+ DE_ASSERT(xBounds1.y() + searchStep > xBounds1.y());
+ DE_ASSERT(yBounds1.x() + searchStep > yBounds1.x());
+ DE_ASSERT(yBounds1.y() + searchStep > yBounds1.y());
+ DE_ASSERT(zBounds1.x() + searchStep > zBounds1.x());
+ DE_ASSERT(zBounds1.y() + searchStep > zBounds1.y());
if (!isInColorBounds(prec, quad00, quad01, quad10, quad11, result))
return false;
@@ -603,6 +633,15 @@
const int w = level.getWidth();
+ const TextureFormat format = level.getFormat();
+ const TextureChannelClass texClass = getTextureChannelClass(format.type);
+
+ DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+ DE_UNREF(texClass);
+ DE_UNREF(format);
+
for (int i = minI; i <= maxI; i++)
{
// Wrapped coordinates
@@ -647,6 +686,10 @@
texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ? computeBilinearSearchStepForSnorm(prec) :
0.0f; // Step is computed for floating-point quads based on texel values.
+ DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
// \todo [2013-07-03 pyry] This could be optimized by first computing ranges based on wrap mode.
for (int j = minJ; j <= maxJ; j++)
@@ -706,6 +749,10 @@
texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ? computeBilinearSearchStepForSnorm(prec) :
0.0f; // Step is computed for floating-point quads based on texel values.
+ DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
// \todo [2013-07-03 pyry] This could be optimized by first computing ranges based on wrap mode.
for (int k = minK; k <= maxK; k++)
@@ -910,8 +957,8 @@
const int w0 = level0.getWidth();
const int w1 = level1.getWidth();
- const Vec2 uBounds0 = computeNonNormalizedCoordBounds(sampler.normalizedCoords, w0, coordX, prec.coordBits.x(), prec.uvwBits.x());
- const Vec2 uBounds1 = computeNonNormalizedCoordBounds(sampler.normalizedCoords, w1, coordX, prec.coordBits.x(), prec.uvwBits.x());
+ const Vec2 uBounds0 = computeNonNormalizedCoordBounds(sampler.normalizedCoords, w0, coordX, prec.coordBits.x(), prec.uvwBits.x());
+ const Vec2 uBounds1 = computeNonNormalizedCoordBounds(sampler.normalizedCoords, w1, coordX, prec.coordBits.x(), prec.uvwBits.x());
// Integer coordinates - without wrap mode
const int minI0 = deFloorFloatToInt32(uBounds0.x()-0.5f);
@@ -924,6 +971,10 @@
texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ? computeBilinearSearchStepForSnorm(prec) :
0.0f; // Step is computed for floating-point quads based on texel values.
+ DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
for (int i0 = minI0; i0 <= maxI0; i0++)
{
ColorLine line0;
@@ -1007,6 +1058,10 @@
texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ? computeBilinearSearchStepForSnorm(prec) :
0.0f; // Step is computed for floating-point quads based on texel values.
+ DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
for (int j0 = minJ0; j0 <= maxJ0; j0++)
{
for (int i0 = minI0; i0 <= maxI0; i0++)
@@ -1112,6 +1167,10 @@
texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ? computeBilinearSearchStepForSnorm(prec) :
0.0f; // Step is computed for floating-point quads based on texel values.
+ DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
for (int k0 = minK0; k0 <= maxK0; k0++)
{
for (int j0 = minJ0; j0 <= maxJ0; j0++)
@@ -1403,6 +1462,10 @@
texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ? computeBilinearSearchStepForSnorm(prec) :
0.0f; // Step is computed for floating-point quads based on texel values.
+ DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
for (int j = minJ; j <= maxJ; j++)
{
for (int i = minI; i <= maxI; i++)
@@ -1474,6 +1537,10 @@
texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ? computeBilinearSearchStepForSnorm(prec) :
0.0f; // Step is computed for floating-point quads based on texel values.
+ DE_ASSERT(texClass == TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_SIGNED_FIXED_POINT ||
+ texClass == TEXTURECHANNELCLASS_FLOATING_POINT);
+
for (int j0 = minJ0; j0 <= maxJ0; j0++)
{
for (int i0 = minI0; i0 <= maxI0; i0++)
@@ -1570,7 +1637,7 @@
}
static bool isCubeMipmapLinearSampleResultValid (const ConstPixelBufferAccess (&faces0)[CUBEFACE_LAST],
- const ConstPixelBufferAccess (&faces1)[CUBEFACE_LAST],
+ const ConstPixelBufferAccess (&faces1)[CUBEFACE_LAST],
const Sampler& sampler,
const Sampler::FilterMode levelFilter,
const LookupPrecision& prec,
@@ -2264,8 +2331,8 @@
const IVec2 (&offsets)[4],
const Vector<ScalarType, 4>& result)
{
- const Vec2 uBounds = computeNonNormalizedCoordBounds(sampler.normalizedCoords, level.getWidth(), coord.x(), prec.coordBits.x(), prec.uvwBits.x());
- const Vec2 vBounds = computeNonNormalizedCoordBounds(sampler.normalizedCoords, level.getHeight(), coord.y(), prec.coordBits.y(), prec.uvwBits.y());
+ const Vec2 uBounds = computeNonNormalizedCoordBounds(sampler.normalizedCoords, level.getWidth(), coord.x(), prec.coordBits.x(), prec.uvwBits.x());
+ const Vec2 vBounds = computeNonNormalizedCoordBounds(sampler.normalizedCoords, level.getHeight(), coord.y(), prec.coordBits.y(), prec.uvwBits.y());
// Integer coordinate bounds for (x0, y0) - without wrap mode
const int minI = deFloorFloatToInt32(uBounds.x()-0.5f);
diff --git a/framework/common/tcuTexture.cpp b/framework/common/tcuTexture.cpp
index 6fb69f0..d6aa25d 100644
--- a/framework/common/tcuTexture.cpp
+++ b/framework/common/tcuTexture.cpp
@@ -57,17 +57,17 @@
inline void writeRGBA8888Int (deUint8* ptr, const IVec4& val)
{
- ptr[0] = de::clamp(val[0], 0, 255);
- ptr[1] = de::clamp(val[1], 0, 255);
- ptr[2] = de::clamp(val[2], 0, 255);
- ptr[3] = de::clamp(val[3], 0, 255);
+ ptr[0] = (deUint8)de::clamp(val[0], 0, 255);
+ ptr[1] = (deUint8)de::clamp(val[1], 0, 255);
+ ptr[2] = (deUint8)de::clamp(val[2], 0, 255);
+ ptr[3] = (deUint8)de::clamp(val[3], 0, 255);
}
inline void writeRGB888Int (deUint8* ptr, const IVec4& val)
{
- ptr[0] = de::clamp(val[0], 0, 255);
- ptr[1] = de::clamp(val[1], 0, 255);
- ptr[2] = de::clamp(val[2], 0, 255);
+ ptr[0] = (deUint8)de::clamp(val[0], 0, 255);
+ ptr[1] = (deUint8)de::clamp(val[1], 0, 255);
+ ptr[2] = (deUint8)de::clamp(val[2], 0, 255);
}
inline void writeRGBA8888Float (deUint8* ptr, const Vec4& val)
@@ -405,7 +405,6 @@
static const TextureSwizzle ARGB = {{ TextureSwizzle::CHANNEL_1, TextureSwizzle::CHANNEL_2, TextureSwizzle::CHANNEL_3, TextureSwizzle::CHANNEL_0 }};
static const TextureSwizzle D = {{ TextureSwizzle::CHANNEL_0, TextureSwizzle::CHANNEL_ZERO, TextureSwizzle::CHANNEL_ZERO, TextureSwizzle::CHANNEL_ONE }};
static const TextureSwizzle S = {{ TextureSwizzle::CHANNEL_0, TextureSwizzle::CHANNEL_ZERO, TextureSwizzle::CHANNEL_ZERO, TextureSwizzle::CHANNEL_ONE }};
- static const TextureSwizzle DS = {{ TextureSwizzle::CHANNEL_0, TextureSwizzle::CHANNEL_ZERO, TextureSwizzle::CHANNEL_ZERO, TextureSwizzle::CHANNEL_1 }};
switch (order)
{
@@ -426,7 +425,11 @@
case TextureFormat::sRGBA: return RGBA;
case TextureFormat::D: return D;
case TextureFormat::S: return S;
- case TextureFormat::DS: return DS;
+
+ case TextureFormat::DS:
+ DE_ASSERT(false); // combined formats cannot be read from
+ return INV;
+
default:
DE_ASSERT(DE_FALSE);
return INV;
@@ -452,7 +455,6 @@
static const TextureSwizzle ARGB = {{ TextureSwizzle::CHANNEL_3, TextureSwizzle::CHANNEL_0, TextureSwizzle::CHANNEL_1, TextureSwizzle::CHANNEL_2 }};
static const TextureSwizzle D = {{ TextureSwizzle::CHANNEL_0, TextureSwizzle::CHANNEL_LAST, TextureSwizzle::CHANNEL_LAST, TextureSwizzle::CHANNEL_LAST }};
static const TextureSwizzle S = {{ TextureSwizzle::CHANNEL_0, TextureSwizzle::CHANNEL_LAST, TextureSwizzle::CHANNEL_LAST, TextureSwizzle::CHANNEL_LAST }};
- static const TextureSwizzle DS = {{ TextureSwizzle::CHANNEL_0, TextureSwizzle::CHANNEL_3, TextureSwizzle::CHANNEL_LAST, TextureSwizzle::CHANNEL_LAST }};
switch (order)
{
@@ -473,7 +475,11 @@
case TextureFormat::sRGBA: return RGBA;
case TextureFormat::D: return D;
case TextureFormat::S: return S;
- case TextureFormat::DS: return DS;
+
+ case TextureFormat::DS:
+ DE_ASSERT(false); // combined formats cannot be written to
+ return INV;
+
default:
DE_ASSERT(DE_FALSE);
return INV;
@@ -610,8 +616,10 @@
DE_ASSERT(de::inBounds(x, 0, m_size.x()));
DE_ASSERT(de::inBounds(y, 0, m_size.y()));
DE_ASSERT(de::inBounds(z, 0, m_size.z()));
+ DE_ASSERT(!isCombinedDepthStencilType(m_format.type)); // combined types cannot be accessed directly
+ DE_ASSERT(m_format.order != TextureFormat::DS); // combined formats cannot be accessed directly
- const deUint8* pixelPtr = (const deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+ const deUint8* pixelPtr = (const deUint8*)getPixelPtr(x, y, z);
// Optimized fomats.
if (m_format.type == TextureFormat::UNORM_INT8)
@@ -639,25 +647,6 @@
case TextureFormat::UNSIGNED_INT_1010102_REV: return UVec4(UB32(0, 10), UB32(10, 10), UB32(20, 10), UB32(30, 2)).cast<float>();
case TextureFormat::UNSIGNED_INT_999_E5_REV: return unpackRGB999E5(*((const deUint32*)pixelPtr));
- case TextureFormat::UNSIGNED_INT_24_8:
- switch (m_format.order)
- {
- // \note Stencil is always ignored.
- case TextureFormat::D: return Vec4(NB32(8, 24), 0.0f, 0.0f, 1.0f);
- case TextureFormat::DS: return Vec4(NB32(8, 24), 0.0f, 0.0f, 1.0f /* (float)UB32(0, 8) */);
- default:
- DE_ASSERT(false);
- }
-
- case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
- {
- DE_ASSERT(m_format.order == TextureFormat::DS);
- float d = *((const float*)pixelPtr);
- // \note Stencil is ignored.
-// deUint8 s = *((const deUint32*)(pixelPtr+4)) & 0xff;
- return Vec4(d, 0.0f, 0.0f, 1.0f);
- }
-
case TextureFormat::UNSIGNED_INT_11F_11F_10F_REV:
return Vec4(Float11(UB32(0, 11)).asFloat(), Float11(UB32(11, 11)).asFloat(), Float10(UB32(22, 10)).asFloat(), 1.0f);
@@ -707,8 +696,10 @@
DE_ASSERT(de::inBounds(x, 0, m_size.x()));
DE_ASSERT(de::inBounds(y, 0, m_size.y()));
DE_ASSERT(de::inBounds(z, 0, m_size.z()));
+ DE_ASSERT(!isCombinedDepthStencilType(m_format.type)); // combined types cannot be accessed directly
+ DE_ASSERT(m_format.order != TextureFormat::DS); // combined formats cannot be accessed directly
- const deUint8* const pixelPtr = (const deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+ const deUint8* const pixelPtr = (const deUint8*)getPixelPtr(x, y, z);
IVec4 result;
// Optimized fomats.
@@ -731,25 +722,6 @@
case TextureFormat::UNORM_INT_1010102_REV: return UVec4(U32( 0, 10), U32(10, 10), U32(20, 10), U32(30, 2)).cast<int>();
case TextureFormat::UNSIGNED_INT_1010102_REV: return UVec4(U32( 0, 10), U32(10, 10), U32(20, 10), U32(30, 2)).cast<int>();
- case TextureFormat::UNSIGNED_INT_24_8:
- switch (m_format.order)
- {
- case TextureFormat::D: return UVec4(U32(8, 24), 0, 0, 1).cast<int>();
- case TextureFormat::S: return UVec4(0, 0, 0, U32(8, 24)).cast<int>();
- case TextureFormat::DS: return UVec4(U32(8, 24), 0, 0, U32(0, 8)).cast<int>();
- default:
- DE_ASSERT(false);
- }
-
- case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
- {
- DE_ASSERT(m_format.order == TextureFormat::DS);
- float d = *((const float*)pixelPtr);
- deUint8 s = *((const deUint32*)(pixelPtr+4)) & 0xffu;
- // \note Returns bit-representation of depth floating-point value.
- return UVec4(tcu::Float32(d).bits(), 0, 0, s).cast<int>();
- }
-
default:
break; // To generic path.
}
@@ -812,7 +784,7 @@
DE_ASSERT(de::inBounds(y, 0, getHeight()));
DE_ASSERT(de::inBounds(z, 0, getDepth()));
- const deUint8* const pixelPtr = (const deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+ const deUint8* const pixelPtr = (const deUint8*)getPixelPtr(x, y, z);
#define UB32(OFFS, COUNT) ((*((const deUint32*)pixelPtr) >> (OFFS)) & ((1<<(COUNT))-1))
#define NB32(OFFS, COUNT) channelToNormFloat(UB32(OFFS, COUNT), (COUNT))
@@ -837,7 +809,7 @@
return *((const float*)pixelPtr);
default:
- DE_ASSERT(m_format.order == TextureFormat::D || m_format.order == TextureFormat::DS);
+ DE_ASSERT(m_format.order == TextureFormat::D); // no other combined depth stencil types
return channelToFloat(pixelPtr, m_format.type);
}
@@ -851,7 +823,7 @@
DE_ASSERT(de::inBounds(y, 0, getHeight()));
DE_ASSERT(de::inBounds(z, 0, getDepth()));
- const deUint8* const pixelPtr = (const deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+ const deUint8* const pixelPtr = (const deUint8*)getPixelPtr(x, y, z);
switch (m_format.type)
{
@@ -872,14 +844,8 @@
default:
{
- if (m_format.order == TextureFormat::S)
- return channelToInt(pixelPtr, m_format.type);
- else
- {
- DE_ASSERT(m_format.order == TextureFormat::DS);
- const int stencilChannelIndex = 3;
- return channelToInt(pixelPtr + getChannelSize(m_format.type)*stencilChannelIndex, m_format.type);
- }
+ DE_ASSERT(m_format.order == TextureFormat::S); // no other combined depth stencil types
+ return channelToInt(pixelPtr, m_format.type);
}
}
}
@@ -889,8 +855,10 @@
DE_ASSERT(de::inBounds(x, 0, getWidth()));
DE_ASSERT(de::inBounds(y, 0, getHeight()));
DE_ASSERT(de::inBounds(z, 0, getDepth()));
+ DE_ASSERT(!isCombinedDepthStencilType(m_format.type)); // combined types cannot be accessed directly
+ DE_ASSERT(m_format.order != TextureFormat::DS); // combined formats cannot be accessed directly
- deUint8* const pixelPtr = (deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+ deUint8* const pixelPtr = (deUint8*)getPixelPtr(x, y, z);
// Optimized fomats.
if (m_format.type == TextureFormat::UNORM_INT8)
@@ -934,31 +902,6 @@
*((deUint32*)pixelPtr) = packRGB999E5(color);
break;
- case TextureFormat::UNSIGNED_INT_24_8:
- switch (m_format.order)
- {
- case TextureFormat::D: *((deUint32*)pixelPtr) = PN(color[0], 8, 24); break;
- case TextureFormat::S: *((deUint32*)pixelPtr) = PN(color[3], 8, 24); break;
- case TextureFormat::DS: *((deUint32*)pixelPtr) = PN(color[0], 8, 24) | PU((deUint32)color[3], 0, 8); break;
- default:
- DE_ASSERT(false);
- }
- break;
-
- case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
- DE_ASSERT(m_format.order == TextureFormat::DS);
- *((float*)pixelPtr) = color[0];
- *((deUint32*)(pixelPtr+4)) = PU((deUint32)color[3], 0, 8);
- break;
-
- case TextureFormat::FLOAT:
- if (m_format.order == TextureFormat::D)
- {
- *((float*)pixelPtr) = color[0];
- break;
- }
- // else fall-through to default case!
-
default:
{
// Generic path.
@@ -984,8 +927,10 @@
DE_ASSERT(de::inBounds(x, 0, getWidth()));
DE_ASSERT(de::inBounds(y, 0, getHeight()));
DE_ASSERT(de::inBounds(z, 0, getDepth()));
+ DE_ASSERT(!isCombinedDepthStencilType(m_format.type)); // combined types cannot be accessed directly
+ DE_ASSERT(m_format.order != TextureFormat::DS); // combined formats cannot be accessed directly
- deUint8* const pixelPtr = (deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+ deUint8* const pixelPtr = (deUint8*)getPixelPtr(x, y, z);
// Optimized fomats.
if (m_format.type == TextureFormat::UNORM_INT8)
@@ -1006,23 +951,6 @@
case TextureFormat::UNORM_INT_1010102_REV: *((deUint32*)pixelPtr) = PU(color[0], 0, 10) | PU(color[1], 10, 10) | PU(color[2], 20, 10) | PU(color[3], 30, 2); break;
case TextureFormat::UNSIGNED_INT_1010102_REV: *((deUint32*)pixelPtr) = PU(color[0], 0, 10) | PU(color[1], 10, 10) | PU(color[2], 20, 10) | PU(color[3], 30, 2); break;
- case TextureFormat::UNSIGNED_INT_24_8:
- switch (m_format.order)
- {
- case TextureFormat::D: *((deUint32*)pixelPtr) = PU(color[0], 8, 24); break;
- case TextureFormat::S: *((deUint32*)pixelPtr) = PU(color[3], 8, 24); break;
- case TextureFormat::DS: *((deUint32*)pixelPtr) = PU(color[0], 8, 24) | PU((deUint32)color[3], 0, 8); break;
- default:
- DE_ASSERT(false);
- }
- break;
-
- case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
- DE_ASSERT(m_format.order == TextureFormat::DS);
- *((deUint32*)pixelPtr) = color[0];
- *((deUint32*)(pixelPtr+4)) = PU((deUint32)color[3], 0, 8);
- break;
-
default:
{
// Generic path.
@@ -1048,7 +976,7 @@
DE_ASSERT(de::inBounds(y, 0, getHeight()));
DE_ASSERT(de::inBounds(z, 0, getDepth()));
- deUint8* const pixelPtr = (deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+ deUint8* const pixelPtr = (deUint8*)getPixelPtr(x, y, z);
#define PN(VAL, OFFS, BITS) (normFloatToChannel((VAL), (BITS)) << (OFFS))
@@ -1070,7 +998,7 @@
break;
default:
- DE_ASSERT(m_format.order == TextureFormat::D || m_format.order == TextureFormat::DS);
+ DE_ASSERT(m_format.order == TextureFormat::D); // no other combined depth stencil types
floatToChannel(pixelPtr, depth, m_format.type);
break;
}
@@ -1084,7 +1012,7 @@
DE_ASSERT(de::inBounds(y, 0, getHeight()));
DE_ASSERT(de::inBounds(z, 0, getDepth()));
- deUint8* const pixelPtr = (deUint8*)getDataPtr() + z*m_pitch.z() + y*m_pitch.y() + x*m_pitch.x();
+ deUint8* const pixelPtr = (deUint8*)getPixelPtr(x, y, z);
#define PU(VAL, OFFS, BITS) (uintToChannel((deUint32)(VAL), (BITS)) << (OFFS))
@@ -1106,15 +1034,8 @@
break;
default:
- if (m_format.order == TextureFormat::S)
- intToChannel(pixelPtr, stencil, m_format.type);
- else
- {
- DE_ASSERT(m_format.order == TextureFormat::DS);
- const int stencilChannelIndex = 3;
- intToChannel(pixelPtr + getChannelSize(m_format.type)*stencilChannelIndex, stencil, m_format.type);
- }
-
+ DE_ASSERT(m_format.order == TextureFormat::S); // no other combined depth stencil types
+ intToChannel(pixelPtr, stencil, m_format.type);
break;
}
@@ -1201,31 +1122,18 @@
static bool isFixedPointDepthTextureFormat (const tcu::TextureFormat& format)
{
+ DE_ASSERT(format.order == TextureFormat::D);
+
const tcu::TextureChannelClass channelClass = tcu::getTextureChannelClass(format.type);
-
- if (format.order == TextureFormat::D)
+ if (channelClass == tcu::TEXTURECHANNELCLASS_FLOATING_POINT)
+ return false;
+ else if (channelClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT)
+ return true;
+ else
{
- // depth internal formats cannot be non-normalized integers
- return channelClass != tcu::TEXTURECHANNELCLASS_FLOATING_POINT;
+ DE_ASSERT(false);
+ return false;
}
- else if (format.order == TextureFormat::DS)
- {
- // combined formats have no single channel class, detect format manually
- switch (format.type)
- {
- case tcu::TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV: return false;
- case tcu::TextureFormat::UNSIGNED_INT_24_8: return true;
-
- default:
- {
- // unknown format
- DE_ASSERT(false);
- return true;
- }
- }
- }
-
- return false;
}
// Texel lookup with color conversion.
diff --git a/framework/common/tcuTexture.hpp b/framework/common/tcuTexture.hpp
index fde4919..6ddc1ef 100644
--- a/framework/common/tcuTexture.hpp
+++ b/framework/common/tcuTexture.hpp
@@ -587,11 +587,11 @@
~TextureLevelPyramid(void);
const TextureFormat& getFormat (void) const { return m_format; }
- bool isLevelEmpty (int levelNdx) const { return m_data[levelNdx].empty(); }
-
int getNumLevels (void) const { return (int)m_access.size(); }
- const ConstPixelBufferAccess& getLevel (int ndx) const { return m_access[ndx]; }
- const PixelBufferAccess& getLevel (int ndx) { return m_access[ndx]; }
+
+ bool isLevelEmpty (int levelNdx) const { DE_ASSERT(de::inBounds(levelNdx, 0, getNumLevels())); return m_data[(size_t)levelNdx].empty(); }
+ const ConstPixelBufferAccess& getLevel (int levelNdx) const { DE_ASSERT(de::inBounds(levelNdx, 0, getNumLevels())); return m_access[(size_t)levelNdx]; }
+ const PixelBufferAccess& getLevel (int levelNdx) { DE_ASSERT(de::inBounds(levelNdx, 0, getNumLevels())); return m_access[(size_t)levelNdx]; }
const ConstPixelBufferAccess* getLevels (void) const { return &m_access[0]; }
const PixelBufferAccess* getLevels (void) { return &m_access[0]; }
@@ -763,12 +763,12 @@
int getSize (void) const { return m_size; }
int getNumLevels (void) const { return (int)m_access[0].size(); }
- const ConstPixelBufferAccess& getLevelFace (int ndx, CubeFace face) const { return m_access[face][ndx]; }
- const PixelBufferAccess& getLevelFace (int ndx, CubeFace face) { return m_access[face][ndx]; }
+ const ConstPixelBufferAccess& getLevelFace (int ndx, CubeFace face) const { DE_ASSERT(de::inBounds(ndx, 0, getNumLevels())); return m_access[face][(size_t)ndx]; }
+ const PixelBufferAccess& getLevelFace (int ndx, CubeFace face) { DE_ASSERT(de::inBounds(ndx, 0, getNumLevels())); return m_access[face][(size_t)ndx]; }
void allocLevel (CubeFace face, int levelNdx);
void clearLevel (CubeFace face, int levelNdx);
- bool isLevelEmpty (CubeFace face, int levelNdx) const { return m_data[face][levelNdx].empty(); }
+ bool isLevelEmpty (CubeFace face, int levelNdx) const { DE_ASSERT(de::inBounds(levelNdx, 0, getNumLevels())); return m_data[face][(size_t)levelNdx].empty(); }
Vec4 sample (const Sampler& sampler, float s, float t, float p, float lod) const;
float sampleCompare (const Sampler& sampler, float ref, float s, float t, float r, float lod) const;
diff --git a/framework/common/tcuTextureUtil.cpp b/framework/common/tcuTextureUtil.cpp
index 99f8dbd..d8018af 100644
--- a/framework/common/tcuTextureUtil.cpp
+++ b/framework/common/tcuTextureUtil.cpp
@@ -901,14 +901,14 @@
{
for (int y = 0; y < dst.getHeight(); y++)
for (int x = 0; x < dst.getWidth(); x++)
- dst.setPixel(src.sample2D(sampler, filter, (x+0.5f)*sX, (y+0.5f)*sY, 0), x, y);
+ dst.setPixel(src.sample2D(sampler, filter, ((float)x+0.5f)*sX, ((float)y+0.5f)*sY, 0), x, y);
}
else
{
for (int z = 0; z < dst.getDepth(); z++)
for (int y = 0; y < dst.getHeight(); y++)
for (int x = 0; x < dst.getWidth(); x++)
- dst.setPixel(src.sample3D(sampler, filter, (x+0.5f)*sX, (y+0.5f)*sY, (z+0.5f)*sZ), x, y, z);
+ dst.setPixel(src.sample3D(sampler, filter, ((float)x+0.5f)*sX, ((float)y+0.5f)*sY, ((float)z+0.5f)*sZ), x, y, z);
}
}
diff --git a/framework/common/tcuThreadUtil.cpp b/framework/common/tcuThreadUtil.cpp
index d3a1c9a..84ac428 100644
--- a/framework/common/tcuThreadUtil.cpp
+++ b/framework/common/tcuThreadUtil.cpp
@@ -163,7 +163,7 @@
m_thread.pushMessage(m_stream.str());
}
-Thread::Thread (int seed)
+Thread::Thread (deUint32 seed)
: m_random (seed)
, m_status (THREADSTATUS_NOT_STARTED)
{
@@ -267,7 +267,7 @@
void DataBlock::setData (size_t size, const void* data)
{
m_data = std::vector<deUint8>(size);
- deMemcpy(&(m_data[0]), data, (int)size);
+ deMemcpy(&(m_data[0]), data, size);
}
CompareData::CompareData (SharedPtr<DataBlock> a, SharedPtr<DataBlock> b)
diff --git a/framework/common/tcuThreadUtil.hpp b/framework/common/tcuThreadUtil.hpp
index a8c88ae..7157d2c 100644
--- a/framework/common/tcuThreadUtil.hpp
+++ b/framework/common/tcuThreadUtil.hpp
@@ -162,7 +162,7 @@
THREADSTATUS_FAILED,
THREADSTATUS_NOT_SUPPORTED
};
- Thread (int seed);
+ Thread (deUint32 seed);
~Thread (void);
virtual void init (void) {} //!< Called first before any Operation
diff --git a/framework/common/tcuVector.hpp b/framework/common/tcuVector.hpp
index cc5aeca..2b40a18 100644
--- a/framework/common/tcuVector.hpp
+++ b/framework/common/tcuVector.hpp
@@ -141,7 +141,7 @@
VecAccess<T, Size, 4> xyzw (void) { DE_ASSERT(Size >= 4); return VecAccess<T, Size, 4>(*this, 0, 1, 2, 3); }
// Swizzles.
- const T& swizzle (int a) const { DE_ASSERT(a >= 0 && a < Size); return m_data[a]; }
+ Vector<T, 1> swizzle (int a) const { DE_ASSERT(a >= 0 && a < Size); return Vector<T, 1>(m_data[a]); }
Vector<T, 2> swizzle (int a, int b) const { DE_ASSERT(a >= 0 && a < Size); DE_ASSERT(b >= 0 && b < Size); return Vector<T, 2>(m_data[a], m_data[b]); }
Vector<T, 3> swizzle (int a, int b, int c) const { DE_ASSERT(a >= 0 && a < Size); DE_ASSERT(b >= 0 && b < Size); DE_ASSERT(c >= 0 && c < Size); return Vector<T, 3>(m_data[a], m_data[b], m_data[c]); }
Vector<T, 4> swizzle (int a, int b, int c, int d) const { DE_ASSERT(a >= 0 && a < Size); DE_ASSERT(b >= 0 && b < Size); DE_ASSERT(c >= 0 && c < Size); DE_ASSERT(d >= 0 && d < Size); return Vector<T, 4>(m_data[a], m_data[b], m_data[c], m_data[d]); }
diff --git a/framework/common/tcuVectorType.hpp b/framework/common/tcuVectorType.hpp
index 832c31b..1865a61 100644
--- a/framework/common/tcuVectorType.hpp
+++ b/framework/common/tcuVectorType.hpp
@@ -35,18 +35,22 @@
template <typename T, int Size>
class Vector;
+typedef Vector<float, 1> Vec1;
typedef Vector<float, 2> Vec2;
typedef Vector<float, 3> Vec3;
typedef Vector<float, 4> Vec4;
+typedef Vector<int, 1> IVec1;
typedef Vector<int, 2> IVec2;
typedef Vector<int, 3> IVec3;
typedef Vector<int, 4> IVec4;
+typedef Vector<deUint32, 1> UVec1;
typedef Vector<deUint32, 2> UVec2;
typedef Vector<deUint32, 3> UVec3;
typedef Vector<deUint32, 4> UVec4;
+typedef Vector<bool, 1> BVec1;
typedef Vector<bool, 2> BVec2;
typedef Vector<bool, 3> BVec3;
typedef Vector<bool, 4> BVec4;
diff --git a/framework/common/tcuVectorUtil.hpp b/framework/common/tcuVectorUtil.hpp
index de17642..e21fb2e 100644
--- a/framework/common/tcuVectorUtil.hpp
+++ b/framework/common/tcuVectorUtil.hpp
@@ -25,6 +25,7 @@
#include "tcuDefs.hpp"
#include "tcuVector.hpp"
+#include "deMeta.hpp"
#include "deMath.h"
#include "deInt32.h"
@@ -55,15 +56,13 @@
template<typename T> inline T logicalOr (T a, T b) { return a || b; }
template<typename T> inline T mod (T a, T b) { return a % b; }
-template<> inline float mod (float x, float y) { return x - y * floor(x / y); }
+template<> inline float mod (float x, float y) { return x - y * deFloatFloor(x / y); }
template<typename T> inline T negate (T f) { return -f; }
template<> inline deUint32 negate<deUint32> (deUint32 f) { return (deUint32)-(int)f; }
inline float radians (float f) { return deFloatRadians(f); }
inline float degrees (float f) { return deFloatDegrees(f); }
-inline float exp2 (float f) { return deFloatExp2(f); }
-inline float log2 (float f) { return deFloatLog2(f); }
inline float inverseSqrt (float f) { return deFloatRsq(f); }
inline float sign (float f) { return (f < 0.0f) ? -1.0f : ((f > 0.0f) ? +1.0f : 0.0f); }
inline float fract (float f) { return f - deFloatFloor(f); }
@@ -94,13 +93,9 @@
if (k < 0.0f)
return 0.0f;
else
- return eta * i - (eta * cosAngle + ::sqrt(k)) * n;
+ return eta * i - (eta * cosAngle + deFloatSqrt(k)) * n;
}
-inline float asinh (float a) { return deFloatAsinh(a); }
-inline float acosh (float a) { return deFloatAcosh(a); }
-inline float atanh (float a) { return deFloatAtanh(a); }
-
template<typename T> inline bool lessThan (T a, T b) { return (a < b); }
template<typename T> inline bool lessThanEqual (T a, T b) { return (a <= b); }
template<typename T> inline bool greaterThan (T a, T b) { return (a > b); }
@@ -114,8 +109,6 @@
inline int chopToInt (float a) { return deChopFloatToInt32(a); }
-inline float trunc (float a) { return (float)chopToInt(a); }
-
inline float roundToEven (float a)
{
float q = deFloatFrac(a);
@@ -148,12 +141,18 @@
}
template <typename T, int Size>
-inline T length (const Vector<T, Size>& a)
+inline typename de::meta::EnableIf<T, de::meta::TypesSame<T, double>::Value>::Type length (const Vector<T, Size>& a)
{
return ::sqrt(lengthSquared(a));
}
template <typename T, int Size>
+inline typename de::meta::EnableIf<T, de::meta::TypesSame<T, float>::Value>::Type length (const Vector<T, Size>& a)
+{
+ return deFloatSqrt(lengthSquared(a));
+}
+
+template <typename T, int Size>
inline T distance (const Vector<T, Size>& a, const Vector<T, Size>& b)
{
return length(a - b);
@@ -450,7 +449,7 @@
TCU_DECLARE_VECTOR_UNARY_FUNC(abs, de::abs)
TCU_DECLARE_VECTOR_UNARY_FUNC(sign, deFloatSign)
TCU_DECLARE_VECTOR_UNARY_FUNC(floor, deFloatFloor)
-TCU_DECLARE_VECTOR_UNARY_FUNC(trunc, trunc)
+TCU_DECLARE_VECTOR_UNARY_FUNC(trunc, deFloatTrunc)
TCU_DECLARE_VECTOR_UNARY_FUNC(roundToEven, roundToEven)
TCU_DECLARE_VECTOR_UNARY_FUNC(ceil, deFloatCeil)
TCU_DECLARE_VECTOR_UNARY_FUNC(fract, deFloatFrac)
diff --git a/framework/delibs/debase/deDefs.c b/framework/delibs/debase/deDefs.c
index b664724..68e578b 100644
--- a/framework/delibs/debase/deDefs.c
+++ b/framework/delibs/debase/deDefs.c
@@ -123,7 +123,7 @@
#elif ((DE_OS == DE_OS_WIN32) && (DE_COMPILER == DE_COMPILER_CLANG))
_assert(reason, file, line);
#elif (DE_OS == DE_OS_UNIX)
- __assert_fail(reason, file, line, "Unknown function");
+ __assert_fail(reason, file, (unsigned int)line, "Unknown function");
#elif (DE_OS == DE_OS_SYMBIAN)
__assert("Unknown function", file, line, reason);
#elif (DE_OS == DE_OS_OSX) || (DE_OS == DE_OS_IOS)
diff --git a/framework/delibs/debase/deFloat16.c b/framework/delibs/debase/deFloat16.c
index 375fdc3..e424395 100644
--- a/framework/delibs/debase/deFloat16.c
+++ b/framework/delibs/debase/deFloat16.c
@@ -27,19 +27,19 @@
deFloat16 deFloat32To16 (float val32)
{
- int sign;
- int expotent;
- int mantissa;
+ deUint32 sign;
+ int expotent;
+ deUint32 mantissa;
union
{
- float f;
- int i;
+ float f;
+ deUint32 u;
} x;
x.f = val32;
- sign = (x.i >> 16) & 0x00008000;
- expotent = ((x.i >> 23) & 0x000000ff) - (127 - 15);
- mantissa = x.i & 0x007fffff;
+ sign = (x.u >> 16u) & 0x00008000u;
+ expotent = (int)((x.u >> 23u) & 0x000000ffu) - (127 - 15);
+ mantissa = x.u & 0x007fffffu;
if (expotent <= 0)
{
@@ -50,13 +50,13 @@
}
/* Converted to denormalized half, add leading 1 to significand. */
- mantissa = mantissa | 0x00800000;
+ mantissa = mantissa | 0x00800000u;
/* Round mantissa to nearest (10+e) */
{
- int t = 14 - expotent;
- int a = (1 << (t - 1)) - 1;
- int b = (mantissa >> t) & 1;
+ deUint32 t = 14u - expotent;
+ deUint32 a = (1u << (t - 1u)) - 1u;
+ deUint32 b = (mantissa >> t) & 1u;
mantissa = (mantissa + a + b) >> t;
}
@@ -65,99 +65,99 @@
}
else if (expotent == 0xff - (127 - 15))
{
- if (mantissa == 0)
+ if (mantissa == 0u)
{
/* InF */
- return (deFloat16) (sign | 0x7c00);
+ return (deFloat16) (sign | 0x7c00u);
}
else
{
/* NaN */
- mantissa >>= 13;
- return (deFloat16) (sign | 0x7c00 | mantissa | (mantissa == 0));
+ mantissa >>= 13u;
+ return (deFloat16) (sign | 0x7c00u | mantissa | (mantissa == 0u));
}
}
else
{
/* Normalized float. */
- mantissa = mantissa + 0x00000fff + ((mantissa >> 13) & 1);
+ mantissa = mantissa + 0x00000fffu + ((mantissa >> 13u) & 1u);
- if (mantissa & 0x00800000)
+ if (mantissa & 0x00800000u)
{
/* Overflow in mantissa. */
- mantissa = 0;
+ mantissa = 0u;
expotent += 1;
}
if (expotent > 30)
{
/* \todo [pyry] Cause hw fp overflow */
- return (deFloat16) (sign | 0x7c00);
+ return (deFloat16) (sign | 0x7c00u);
}
- return (deFloat16) (sign | (expotent << 10) | (mantissa >> 13));
+ return (deFloat16) (sign | ((deUint32)expotent << 10u) | (mantissa >> 13u));
}
}
float deFloat16To32 (deFloat16 val16)
{
- int sign;
- int expotent;
- int mantissa;
+ deUint32 sign;
+ deUint32 expotent;
+ deUint32 mantissa;
union
{
- float f;
- int i;
+ float f;
+ deUint32 u;
} x;
- x.i = 0;
+ x.u = 0u;
- sign = ((int) val16 >> 15) & 0x00000001;
- expotent = ((int) val16 >> 10) & 0x0000001f;
- mantissa = (int) val16 & 0x000003ff;
+ sign = ((deUint32)val16 >> 15u) & 0x00000001u;
+ expotent = ((deUint32)val16 >> 10u) & 0x0000001fu;
+ mantissa = (deUint32)val16 & 0x000003ffu;
- if (expotent == 0)
+ if (expotent == 0u)
{
- if (mantissa == 0)
+ if (mantissa == 0u)
{
/* +/- 0 */
- x.i = sign << 31;
+ x.u = sign << 31u;
return x.f;
}
else
{
/* Denormalized, normalize it. */
- while (!(mantissa & 0x00000400))
+ while (!(mantissa & 0x00000400u))
{
- mantissa <<= 1;
- expotent -= 1;
+ mantissa <<= 1u;
+ expotent -= 1u;
}
- expotent += 1;
- mantissa &= ~0x00000400;
+ expotent += 1u;
+ mantissa &= ~0x00000400u;
}
}
- else if (expotent == 31)
+ else if (expotent == 31u)
{
- if (mantissa == 0)
+ if (mantissa == 0u)
{
/* +/- InF */
- x.i = (sign << 31) | 0x7f800000;
+ x.u = (sign << 31u) | 0x7f800000u;
return x.f;
}
else
{
/* +/- NaN */
- x.i = (sign << 31) | 0x7f800000 | (mantissa << 13);
+ x.u = (sign << 31u) | 0x7f800000u | (mantissa << 13u);
return x.f;
}
}
- expotent = expotent + (127 - 15);
- mantissa = mantissa << 13;
+ expotent = expotent + (127u - 15u);
+ mantissa = mantissa << 13u;
- x.i = (sign << 31) | (expotent << 23) | mantissa;
+ x.u = (sign << 31u) | (expotent << 23u) | mantissa;
return x.f;
}
diff --git a/framework/delibs/debase/deInt32.h b/framework/delibs/debase/deInt32.h
index 1ec9a37..0423183 100644
--- a/framework/delibs/debase/deInt32.h
+++ b/framework/delibs/debase/deInt32.h
@@ -158,9 +158,9 @@
* \param a Input value.
* \return 0x80000000 if a<0, 0 otherwise.
*//*--------------------------------------------------------------------*/
-DE_INLINE int deSignBit32 (int a)
+DE_INLINE deInt32 deSignBit32 (deInt32 a)
{
- return (a & 0x80000000);
+ return (deInt32)((deUint32)a & 0x80000000u);
}
/*--------------------------------------------------------------------*//*!
@@ -293,7 +293,7 @@
DE_INLINE int deLog2Floor32 (deInt32 a)
{
DE_ASSERT(a > 0);
- return 31 - deClz32(a);
+ return 31 - deClz32((deUint32)a);
}
/*--------------------------------------------------------------------*//*!
@@ -401,11 +401,11 @@
return (a >= 0) ? a : -a;
}
-DE_INLINE int deClz64 (deInt64 a)
+DE_INLINE int deClz64 (deUint64 a)
{
- if (((deUint64)a >> 32) != 0)
- return deClz32((deInt32)(a >> 32));
- return deClz32((deInt32)a) + 32;
+ if ((a >> 32) != 0)
+ return deClz32((deUint32)(a >> 32));
+ return deClz32((deUint32)a) + 32;
}
/* Common hash & compare functions. */
@@ -413,7 +413,7 @@
DE_INLINE deUint32 deInt32Hash (deInt32 a)
{
/* From: http://www.concentric.net/~Ttwang/tech/inthash.htm */
- deUint32 key = a;
+ deUint32 key = (deUint32)a;
key = (key ^ 61) ^ (key >> 16);
key = key + (key << 3);
key = key ^ (key >> 4);
@@ -425,7 +425,7 @@
DE_INLINE deUint32 deInt64Hash (deInt64 a)
{
/* From: http://www.concentric.net/~Ttwang/tech/inthash.htm */
- deUint64 key = a;
+ deUint64 key = (deUint64)a;
key = (~key) + (key << 21); /* key = (key << 21) - key - 1; */
key = key ^ (key >> 24);
key = (key + (key << 3)) + (key << 8); /* key * 265 */
@@ -436,10 +436,10 @@
return (deUint32)key;
}
-DE_INLINE int deInt16Hash (deInt16 v) { return deInt32Hash(v); }
-DE_INLINE int deUint16Hash (deUint16 v) { return deInt32Hash((deInt32)v); }
-DE_INLINE int deUint32Hash (deUint32 v) { return deInt32Hash((deInt32)v); }
-DE_INLINE int deUint64Hash (deUint64 v) { return deInt64Hash((deInt64)v); }
+DE_INLINE deUint32 deInt16Hash (deInt16 v) { return deInt32Hash(v); }
+DE_INLINE deUint32 deUint16Hash (deUint16 v) { return deInt32Hash((deInt32)v); }
+DE_INLINE deUint32 deUint32Hash (deUint32 v) { return deInt32Hash((deInt32)v); }
+DE_INLINE deUint32 deUint64Hash (deUint64 v) { return deInt64Hash((deInt64)v); }
DE_INLINE deBool deInt16Equal (deInt16 a, deInt16 b) { return (a == b); }
DE_INLINE deBool deUint16Equal (deUint16 a, deUint16 b) { return (a == b); }
@@ -448,7 +448,7 @@
DE_INLINE deBool deInt64Equal (deInt64 a, deInt64 b) { return (a == b); }
DE_INLINE deBool deUint64Equal (deUint64 a, deUint64 b) { return (a == b); }
-DE_INLINE int dePointerHash (const void* ptr)
+DE_INLINE deUint32 dePointerHash (const void* ptr)
{
deUintptr val = (deUintptr)ptr;
#if (DE_PTR_SIZE == 4)
@@ -532,6 +532,23 @@
}
}
+DE_INLINE deInt32 deSignExtendTo32 (deInt32 value, int numBits)
+{
+ DE_ASSERT(deInRange32(numBits, 1, 32));
+
+ if (numBits < 32)
+ {
+ deBool signSet = ((deUint32)value & (1u<<(numBits-1))) != 0;
+ deUint32 signMask = deBitMask32(numBits, 32-numBits);
+
+ DE_ASSERT(((deUint32)value & signMask) == 0u);
+
+ return (deInt32)((deUint32)value | (signSet ? signMask : 0u));
+ }
+ else
+ return value;
+}
+
DE_END_EXTERN_C
#endif /* _DEINT32_H */
diff --git a/framework/delibs/debase/deInt32Test.c b/framework/delibs/debase/deInt32Test.c
index eaf20dc..9291a1f 100644
--- a/framework/delibs/debase/deInt32Test.c
+++ b/framework/delibs/debase/deInt32Test.c
@@ -43,8 +43,8 @@
for (ndx = 0; ndx < (1<<RCP_LUT_BITS); ndx++)
{
- deUint32 val = (1u << RCP_LUT_BITS) | ndx;
- deUint32 rcp = (int)((1u << DE_RCP_FRAC_BITS) / ((double)val / (1<<RCP_LUT_BITS)));
+ deUint32 val = (1u << RCP_LUT_BITS) | (deUint32)ndx;
+ deUint32 rcp = (deUint32)((1u << DE_RCP_FRAC_BITS) / ((double)val / (1<<RCP_LUT_BITS)));
if ((ndx & 3) == 0)
printf("\t");
@@ -87,8 +87,8 @@
DE_TEST_ASSERT(deClz32(0x80000000) == 0);
/* Test simple inputs for dePop32(). */
- DE_TEST_ASSERT(dePop32(0) == 0);
- DE_TEST_ASSERT(dePop32(~0) == 32);
+ DE_TEST_ASSERT(dePop32(0u) == 0);
+ DE_TEST_ASSERT(dePop32(~0u) == 32);
DE_TEST_ASSERT(dePop32(0xFF) == 8);
DE_TEST_ASSERT(dePop32(0xFF00FF) == 16);
DE_TEST_ASSERT(dePop32(0x3333333) == 14);
@@ -97,8 +97,8 @@
/* dePop32(): Check exp2(N) values and inverses. */
for (numBits = 0; numBits < 32; numBits++)
{
- DE_TEST_ASSERT(dePop32(1<<numBits) == 1);
- DE_TEST_ASSERT(dePop32(~(1<<numBits)) == 31);
+ DE_TEST_ASSERT(dePop32(1u<<numBits) == 1);
+ DE_TEST_ASSERT(dePop32(~(1u<<numBits)) == 31);
}
/* Check exp2(N) values. */
@@ -119,10 +119,10 @@
for (iter = 0; iter < NUM_ITERS; iter++)
{
- const int EPS = 1 << (DE_RCP_FRAC_BITS - NUM_ACCURATE_BITS);
+ const deUint32 EPS = 1u << (DE_RCP_FRAC_BITS - NUM_ACCURATE_BITS);
- deUint32 val = (deRandom_getUint32(&rnd) & ((1u<<numBits)-1)) | (1u<<numBits);
- deUint32 ref = (deUint32)(((1.0f / (double)val) * (double)(1<<DE_RCP_FRAC_BITS)) * (double)(1u<<numBits));
+ deUint32 val = (deRandom_getUint32(&rnd) & ((1u<<numBits)-1)) | (1u<<numBits);
+ deUint32 ref = (deUint32)(((1.0f / (double)val) * (double)(1<<DE_RCP_FRAC_BITS)) * (double)(1u<<numBits));
deRcp32(val, &rcp, &exp);
@@ -155,6 +155,19 @@
DE_TEST_ASSERT(deIntMinValue32(1) == -1);
DE_TEST_ASSERT(deIntMinValue32(2) == -2);
DE_TEST_ASSERT(deIntMinValue32(32) == -0x7FFFFFFF - 1);
+
+ DE_TEST_ASSERT(deSignExtendTo32((int)0x0, 1) == 0);
+ DE_TEST_ASSERT(deSignExtendTo32((int)0x1, 1) == (int)0xFFFFFFFF);
+ DE_TEST_ASSERT(deSignExtendTo32((int)0x3, 3) == 3);
+ DE_TEST_ASSERT(deSignExtendTo32((int)0x6, 3) == (int)0xFFFFFFFE);
+ DE_TEST_ASSERT(deSignExtendTo32((int)0x3, 4) == 3);
+ DE_TEST_ASSERT(deSignExtendTo32((int)0xC, 4) == (int)0xFFFFFFFC);
+ DE_TEST_ASSERT(deSignExtendTo32((int)0x7FC3, 16) == (int)0x7FC3);
+ DE_TEST_ASSERT(deSignExtendTo32((int)0x84A0, 16) == (int)0xFFFF84A0);
+ DE_TEST_ASSERT(deSignExtendTo32((int)0xFFC3, 17) == (int)0xFFC3);
+ DE_TEST_ASSERT(deSignExtendTo32((int)0x184A0, 17) == (int)0xFFFF84A0);
+ DE_TEST_ASSERT(deSignExtendTo32((int)0x7A016601, 32) == (int)0x7A016601);
+ DE_TEST_ASSERT(deSignExtendTo32((int)0x8A016601, 32) == (int)0x8A016601);
}
DE_END_EXTERN_C
diff --git a/framework/delibs/debase/deMemory.c b/framework/delibs/debase/deMemory.c
index 93ae325..35d2cf7 100644
--- a/framework/delibs/debase/deMemory.c
+++ b/framework/delibs/debase/deMemory.c
@@ -43,7 +43,7 @@
* \param numBytes Number of bytes to allocate.
* \return Pointer to the allocated memory (or null on failure).
*//*--------------------------------------------------------------------*/
-void* deMalloc (int numBytes)
+void* deMalloc (size_t numBytes)
{
void* ptr;
@@ -73,7 +73,7 @@
* \param numBytes Number of bytes to allocate.
* \return Pointer to the allocated memory (or null on failure).
*//*--------------------------------------------------------------------*/
-void* deCalloc (int numBytes)
+void* deCalloc (size_t numBytes)
{
void* ptr = deMalloc(numBytes);
if (ptr)
@@ -81,15 +81,17 @@
return ptr;
}
-void* deAlignedMalloc (int numBytes, int alignBytes)
+void* deAlignedMalloc (size_t numBytes, deUint32 alignBytes)
{
- int ptrSize = sizeof(void*);
- deUintptr origPtr = (deUintptr)deMalloc(numBytes + ptrSize + alignBytes);
+ size_t ptrSize = sizeof(void*);
+ deUintptr origPtr = (deUintptr)deMalloc(numBytes + ptrSize + (size_t)alignBytes);
+
+ DE_ASSERT(deInRange32(alignBytes, 0, 256) && deIsPowerOfTwo32(alignBytes));
+
if (origPtr)
{
- deUintptr alignedPtr = (deUintptr)deAlignPtr((void*)(origPtr + ptrSize), alignBytes);
+ deUintptr alignedPtr = (deUintptr)deAlignPtr((void*)(origPtr + ptrSize), (deUintptr)alignBytes);
deUintptr ptrPtr = (alignedPtr - ptrSize);
- DE_ASSERT(deInRange32(alignBytes, 0, 256) && deIsPowerOfTwo32(alignBytes));
*(deUintptr*)ptrPtr = origPtr;
return (void*)alignedPtr;
}
@@ -103,9 +105,9 @@
* \param numBytes New size in bytes
* \return Pointer to the reallocated (and possibly moved) memory block
*//*--------------------------------------------------------------------*/
-void* deRealloc (void* ptr, int numBytes)
+void* deRealloc (void* ptr, size_t numBytes)
{
- return realloc(ptr, (size_t)numBytes);
+ return realloc(ptr, numBytes);
}
/*--------------------------------------------------------------------*//*!
@@ -121,7 +123,7 @@
{
if (ptr)
{
- int ptrSize = sizeof(void*);
+ size_t ptrSize = sizeof(void*);
deUintptr ptrPtr = (deUintptr)ptr - ptrSize;
deUintptr origPtr = *(deUintptr*)ptrPtr;
DE_ASSERT(ptrPtr - origPtr < 256);
diff --git a/framework/delibs/debase/deMemory.h b/framework/delibs/debase/deMemory.h
index 1736be8..105d4d9 100644
--- a/framework/delibs/debase/deMemory.h
+++ b/framework/delibs/debase/deMemory.h
@@ -32,12 +32,12 @@
#define DE_NEW(TYPE) ((TYPE*)deMalloc(sizeof(TYPE)))
#define DE_DELETE(TYPE, PTR) deFree(PTR)
-void* deMalloc (int numBytes);
-void* deCalloc (int numBytes);
-void* deRealloc (void* ptr, int numBytes);
+void* deMalloc (size_t numBytes);
+void* deCalloc (size_t numBytes);
+void* deRealloc (void* ptr, size_t numBytes);
void deFree (void* ptr);
-void* deAlignedMalloc (int numBytes, int alignBytes);
+void* deAlignedMalloc (size_t numBytes, deUint32 alignBytes);
void deAlignedFree (void* ptr);
char* deStrdup (const char* str);
@@ -48,13 +48,13 @@
* \param value Value to fill with.
* \param numBytes Number of bytes to write.
*//*--------------------------------------------------------------------*/
-DE_INLINE void deMemset (void* ptr, int value, int numBytes)
+DE_INLINE void deMemset (void* ptr, int value, size_t numBytes)
{
DE_ASSERT((value & 0xFF) == value);
memset(ptr, value, numBytes);
}
-DE_INLINE int deMemCmp (const void* a, const void* b, int numBytes)
+DE_INLINE int deMemCmp (const void* a, const void* b, size_t numBytes)
{
return memcmp(a, b, numBytes);
}
@@ -66,12 +66,12 @@
* \param numBytes Number of bytes to copy
* \return Destination buffer.
*//*--------------------------------------------------------------------*/
-DE_INLINE void* deMemcpy (void* dst, const void* src, int numBytes)
+DE_INLINE void* deMemcpy (void* dst, const void* src, size_t numBytes)
{
return memcpy(dst, src, numBytes);
}
-DE_INLINE void* deMemmove (void* dst, const void* src, int numBytes)
+DE_INLINE void* deMemmove (void* dst, const void* src, size_t numBytes)
{
return memmove(dst, src, numBytes);
}
diff --git a/framework/delibs/debase/deString.c b/framework/delibs/debase/deString.c
index fe60c0f..f53657d 100644
--- a/framework/delibs/debase/deString.c
+++ b/framework/delibs/debase/deString.c
@@ -67,7 +67,7 @@
return hash;
}
-deUint32 deMemoryHash (const void* ptr, int numBytes)
+deUint32 deMemoryHash (const void* ptr, size_t numBytes)
{
/* \todo [2010-05-10 pyry] Better generic hash function? */
const deUint8* input = (const deUint8*)ptr;
@@ -80,7 +80,7 @@
return hash;
}
-deBool deMemoryEqual (const void* ptr, const void* cmp, int numBytes)
+deBool deMemoryEqual (const void* ptr, const void* cmp, size_t numBytes)
{
return memcmp(ptr, cmp, numBytes) == 0;
}
diff --git a/framework/delibs/debase/deString.h b/framework/delibs/debase/deString.h
index 832523c..52e232a 100644
--- a/framework/delibs/debase/deString.h
+++ b/framework/delibs/debase/deString.h
@@ -36,8 +36,8 @@
deBool deStringEqual (const char* a, const char* b);
deBool deStringBeginsWith (const char* str, const char* leading);
-deUint32 deMemoryHash (const void* ptr, int numBytes);
-deBool deMemoryEqual (const void* ptr, const void* cmp, int numBytes);
+deUint32 deMemoryHash (const void* ptr, size_t numBytes);
+deBool deMemoryEqual (const void* ptr, const void* cmp, size_t numBytes);
deInt32 deVsprintf (char* string, size_t size, const char* format, va_list args);
deInt32 deSprintf (char* string, size_t size, const char* format, ...) DE_PRINTF_FUNC_ATTR(3, 4);
diff --git a/framework/delibs/decpp/deBlockBuffer.cpp b/framework/delibs/decpp/deBlockBuffer.cpp
index 69cf477..7e00594 100644
--- a/framework/delibs/decpp/deBlockBuffer.cpp
+++ b/framework/delibs/decpp/deBlockBuffer.cpp
@@ -50,8 +50,8 @@
{
}
- deUint16 getThreadId (void) const { return data >> 16; }
- deUint16 getPayload (void) const { return data & 0xffff; }
+ deUint16 getThreadId (void) const { return (deUint16)(data >> 16); }
+ deUint16 getPayload (void) const { return (deUint16)(data & 0xffff); }
};
typedef BlockBuffer<Message> MessageBuffer;
@@ -208,7 +208,7 @@
{
deUint32 cmpSum = 0;
for (int j = 0; j < numConsumers; j++)
- cmpSum += consumers[j]->getPayloadSum(i);
+ cmpSum += consumers[j]->getPayloadSum((deUint16)i);
DE_TEST_ASSERT(refSum == cmpSum);
}
diff --git a/framework/delibs/decpp/deMeta.hpp b/framework/delibs/decpp/deMeta.hpp
index 231aac0..f7b5ac1 100644
--- a/framework/delibs/decpp/deMeta.hpp
+++ b/framework/delibs/decpp/deMeta.hpp
@@ -48,6 +48,24 @@
};
};
+template <typename A, typename B>
+struct TypesSame
+{
+ enum
+ {
+ Value = false
+ };
+};
+
+template <typename A>
+struct TypesSame<A, A>
+{
+ enum
+ {
+ Value = true
+ };
+};
+
} // meta
} // de
diff --git a/framework/delibs/decpp/dePoolArray.hpp b/framework/delibs/decpp/dePoolArray.hpp
index 9a1db24..cec9acd 100644
--- a/framework/delibs/decpp/dePoolArray.hpp
+++ b/framework/delibs/decpp/dePoolArray.hpp
@@ -48,7 +48,7 @@
* to access next element(s) doesn't work.
* \todo [2013-02-11 pyry] Make elements per page template argument.
*//*--------------------------------------------------------------------*/
-template<typename T, deUint32 Alignment = (sizeof(T) > 4 ? 4 : sizeof(T))>
+template<typename T, deUint32 Alignment = (sizeof(T) > 4 ? 4 : (deUint32)sizeof(T))>
class PoolArray
{
public:
diff --git a/framework/delibs/decpp/deSocket.hpp b/framework/delibs/decpp/deSocket.hpp
index f8198ff..e401605 100644
--- a/framework/delibs/decpp/deSocket.hpp
+++ b/framework/delibs/decpp/deSocket.hpp
@@ -95,8 +95,8 @@
void close (void);
- deSocketResult send (const void* buf, int bufSize, int* numSent) { return deSocket_send(m_socket, buf, bufSize, numSent); }
- deSocketResult receive (void* buf, int bufSize, int* numRecv) { return deSocket_receive(m_socket, buf, bufSize, numRecv); }
+ deSocketResult send (const void* buf, size_t bufSize, size_t* numSent) { return deSocket_send(m_socket, buf, bufSize, numSent); }
+ deSocketResult receive (void* buf, size_t bufSize, size_t* numRecv) { return deSocket_receive(m_socket, buf, bufSize, numRecv); }
private:
Socket (deSocket* socket) : m_socket(socket) {}
diff --git a/framework/delibs/decpp/deSpinBarrier.cpp b/framework/delibs/decpp/deSpinBarrier.cpp
index 150bbc2..e328abc 100644
--- a/framework/delibs/decpp/deSpinBarrier.cpp
+++ b/framework/delibs/decpp/deSpinBarrier.cpp
@@ -32,9 +32,11 @@
{
SpinBarrier::SpinBarrier (deInt32 numThreads)
- : m_numThreads (numThreads)
+ : m_numCores (deGetNumAvailableLogicalCores())
+ , m_numThreads (numThreads)
, m_numEntered (0)
, m_numLeaving (0)
+ , m_numRemoved (0)
{
DE_ASSERT(numThreads > 0);
}
@@ -44,12 +46,42 @@
DE_ASSERT(m_numEntered == 0 && m_numLeaving == 0);
}
-void SpinBarrier::sync (WaitMode mode)
+void SpinBarrier::reset (deUint32 numThreads)
{
- DE_ASSERT(mode == WAIT_MODE_YIELD || mode == WAIT_MODE_BUSY);
+ // If last threads were removed, m_numEntered > 0 && m_numRemoved > 0
+ DE_ASSERT(m_numLeaving == 0);
+ DE_ASSERT(numThreads > 0);
+ m_numThreads = numThreads;
+ m_numEntered = 0;
+ m_numLeaving = 0;
+ m_numRemoved = 0;
+}
+
+inline SpinBarrier::WaitMode getWaitMode (SpinBarrier::WaitMode requested, deUint32 numCores, deInt32 numThreads)
+{
+ if (requested == SpinBarrier::WAIT_MODE_AUTO)
+ return ((deUint32)numThreads <= numCores) ? SpinBarrier::WAIT_MODE_BUSY : SpinBarrier::WAIT_MODE_YIELD;
+ else
+ return requested;
+}
+
+inline void wait (SpinBarrier::WaitMode mode)
+{
+ DE_ASSERT(mode == SpinBarrier::WAIT_MODE_YIELD || mode == SpinBarrier::WAIT_MODE_BUSY);
+
+ if (mode == SpinBarrier::WAIT_MODE_YIELD)
+ deYield();
+}
+
+void SpinBarrier::sync (WaitMode requestedMode)
+{
+ const deInt32 cachedNumThreads = m_numThreads;
+ const WaitMode waitMode = getWaitMode(requestedMode, m_numCores, cachedNumThreads);
deMemoryReadWriteFence();
+ // m_numEntered must not be touched until all threads have had
+ // a chance to observe it being 0.
if (m_numLeaving > 0)
{
for (;;)
@@ -57,16 +89,25 @@
if (m_numLeaving == 0)
break;
- if (mode == WAIT_MODE_YIELD)
- deYield();
+ wait(waitMode);
}
}
- if (deAtomicIncrement32(&m_numEntered) == m_numThreads)
+ // If m_numRemoved > 0, m_numThreads will decrease. If m_numThreads is decreased
+ // just after atomicOp and before comparison, the branch could be taken by multiple
+ // threads. Since m_numThreads only changes if all threads are inside the spinbarrier,
+ // cached value at snapshotted at the beginning of the function will be equal for
+ // all threads.
+ if (deAtomicIncrement32(&m_numEntered) == cachedNumThreads)
{
- m_numLeaving = m_numThreads;
+ // Release all waiting threads. Since this thread has not been removed, m_numLeaving will
+ // be >= 1 until m_numLeaving is decremented at the end of this function.
+ m_numThreads -= m_numRemoved;
+ m_numLeaving = m_numThreads;
+ m_numRemoved = 0;
+
deMemoryReadWriteFence();
- m_numEntered = 0;
+ m_numEntered = 0;
}
else
{
@@ -75,8 +116,7 @@
if (m_numEntered == 0)
break;
- if (mode == WAIT_MODE_YIELD)
- deYield();
+ wait(waitMode);
}
}
@@ -84,6 +124,39 @@
deMemoryReadWriteFence();
}
+void SpinBarrier::removeThread (WaitMode requestedMode)
+{
+ const deInt32 cachedNumThreads = m_numThreads;
+ const WaitMode waitMode = getWaitMode(requestedMode, m_numCores, cachedNumThreads);
+
+ // Wait for other threads exiting previous barrier
+ if (m_numLeaving > 0)
+ {
+ for (;;)
+ {
+ if (m_numLeaving == 0)
+ break;
+
+ wait(waitMode);
+ }
+ }
+
+ // Ask for last thread entering barrier to adjust thread count
+ deAtomicIncrement32(&m_numRemoved);
+
+ // See sync() - use cached value
+ if (deAtomicIncrement32(&m_numEntered) == cachedNumThreads)
+ {
+ // Release all waiting threads.
+ m_numThreads -= m_numRemoved;
+ m_numLeaving = m_numThreads;
+ m_numRemoved = 0;
+
+ deMemoryReadWriteFence();
+ m_numEntered = 0;
+ }
+}
+
namespace
{
@@ -99,12 +172,12 @@
class TestThread : public de::Thread
{
public:
- TestThread (SpinBarrier& barrier, volatile deInt32* sharedVar, int numThreads, int threadNdx, bool busyOk)
+ TestThread (SpinBarrier& barrier, volatile deInt32* sharedVar, int numThreads, int threadNdx)
: m_barrier (barrier)
, m_sharedVar (sharedVar)
, m_numThreads (numThreads)
, m_threadNdx (threadNdx)
- , m_busyOk (busyOk)
+ , m_busyOk ((deUint32)m_numThreads <= deGetNumAvailableLogicalCores())
{
}
@@ -138,18 +211,23 @@
}
private:
- SpinBarrier& m_barrier;
- volatile deInt32* m_sharedVar;
- int m_numThreads;
- int m_threadNdx;
- bool m_busyOk;
+ SpinBarrier& m_barrier;
+ volatile deInt32* const m_sharedVar;
+ const int m_numThreads;
+ const int m_threadNdx;
+ const bool m_busyOk;
SpinBarrier::WaitMode getWaitMode (de::Random& rnd)
{
- if (m_busyOk && rnd.getBool())
- return SpinBarrier::WAIT_MODE_BUSY;
- else
- return SpinBarrier::WAIT_MODE_YIELD;
+ static const SpinBarrier::WaitMode s_allModes[] =
+ {
+ SpinBarrier::WAIT_MODE_YIELD,
+ SpinBarrier::WAIT_MODE_AUTO,
+ SpinBarrier::WAIT_MODE_BUSY,
+ };
+ const int numModes = DE_LENGTH_OF_ARRAY(s_allModes) - (m_busyOk ? 0 : 1);
+
+ return rnd.choose<SpinBarrier::WaitMode>(DE_ARRAY_BEGIN(s_allModes), DE_ARRAY_BEGIN(s_allModes) + numModes);
}
};
@@ -159,14 +237,9 @@
volatile deInt32 sharedVar = 0;
std::vector<TestThread*> threads (numThreads, static_cast<TestThread*>(DE_NULL));
- // Going over logical cores with busy-waiting will cause priority inversion and make tests take
- // excessive amount of time. Use busy waiting only when number of threads is at most one per
- // core.
- const bool busyOk = (deUint32)numThreads <= deGetNumAvailableLogicalCores();
-
for (int ndx = 0; ndx < numThreads; ndx++)
{
- threads[ndx] = new TestThread(barrier, &sharedVar, numThreads, ndx, busyOk);
+ threads[ndx] = new TestThread(barrier, &sharedVar, numThreads, ndx);
DE_TEST_ASSERT(threads[ndx]);
threads[ndx]->start();
}
@@ -180,17 +253,104 @@
DE_TEST_ASSERT(sharedVar == 0);
}
-} // namespace
+void singleThreadRemoveTest (SpinBarrier::WaitMode mode)
+{
+ SpinBarrier barrier(3);
+
+ barrier.removeThread(mode);
+ barrier.removeThread(mode);
+ barrier.sync(mode);
+ barrier.removeThread(mode);
+
+ barrier.reset(1);
+ barrier.sync(mode);
+
+ barrier.reset(2);
+ barrier.removeThread(mode);
+ barrier.sync(mode);
+}
+
+class TestExitThread : public de::Thread
+{
+public:
+ TestExitThread (SpinBarrier& barrier, int numThreads, int threadNdx, SpinBarrier::WaitMode waitMode)
+ : m_barrier (barrier)
+ , m_numThreads (numThreads)
+ , m_threadNdx (threadNdx)
+ , m_waitMode (waitMode)
+ {
+ }
+
+ void run (void)
+ {
+ const int numIters = 10000;
+ de::Random rnd (deInt32Hash(m_numThreads) ^ deInt32Hash(m_threadNdx) ^ deInt32Hash((deInt32)m_waitMode));
+ const int invExitProb = 1000;
+
+ for (int iterNdx = 0; iterNdx < numIters; iterNdx++)
+ {
+ if (rnd.getInt(0, invExitProb) == 0)
+ {
+ m_barrier.removeThread(m_waitMode);
+ break;
+ }
+ else
+ m_barrier.sync(m_waitMode);
+ }
+ }
+
+private:
+ SpinBarrier& m_barrier;
+ const int m_numThreads;
+ const int m_threadNdx;
+ const SpinBarrier::WaitMode m_waitMode;
+};
+
+void multiThreadRemoveTest (int numThreads, SpinBarrier::WaitMode waitMode)
+{
+ SpinBarrier barrier (numThreads);
+ std::vector<TestExitThread*> threads (numThreads, static_cast<TestExitThread*>(DE_NULL));
+
+ for (int ndx = 0; ndx < numThreads; ndx++)
+ {
+ threads[ndx] = new TestExitThread(barrier, numThreads, ndx, waitMode);
+ DE_TEST_ASSERT(threads[ndx]);
+ threads[ndx]->start();
+ }
+
+ for (int ndx = 0; ndx < numThreads; ndx++)
+ {
+ threads[ndx]->join();
+ delete threads[ndx];
+ }
+}
+
+} // anonymous
void SpinBarrier_selfTest (void)
{
singleThreadTest(SpinBarrier::WAIT_MODE_YIELD);
singleThreadTest(SpinBarrier::WAIT_MODE_BUSY);
+ singleThreadTest(SpinBarrier::WAIT_MODE_AUTO);
multiThreadTest(1);
multiThreadTest(2);
multiThreadTest(4);
multiThreadTest(8);
multiThreadTest(16);
+
+ singleThreadRemoveTest(SpinBarrier::WAIT_MODE_YIELD);
+ singleThreadRemoveTest(SpinBarrier::WAIT_MODE_BUSY);
+ singleThreadRemoveTest(SpinBarrier::WAIT_MODE_AUTO);
+ multiThreadRemoveTest(1, SpinBarrier::WAIT_MODE_BUSY);
+ multiThreadRemoveTest(2, SpinBarrier::WAIT_MODE_AUTO);
+ multiThreadRemoveTest(4, SpinBarrier::WAIT_MODE_AUTO);
+ multiThreadRemoveTest(8, SpinBarrier::WAIT_MODE_AUTO);
+ multiThreadRemoveTest(16, SpinBarrier::WAIT_MODE_AUTO);
+ multiThreadRemoveTest(1, SpinBarrier::WAIT_MODE_YIELD);
+ multiThreadRemoveTest(2, SpinBarrier::WAIT_MODE_YIELD);
+ multiThreadRemoveTest(4, SpinBarrier::WAIT_MODE_YIELD);
+ multiThreadRemoveTest(8, SpinBarrier::WAIT_MODE_YIELD);
+ multiThreadRemoveTest(16, SpinBarrier::WAIT_MODE_YIELD);
}
} // de
diff --git a/framework/delibs/decpp/deSpinBarrier.hpp b/framework/delibs/decpp/deSpinBarrier.hpp
index 6679f8d..484d57a 100644
--- a/framework/delibs/decpp/deSpinBarrier.hpp
+++ b/framework/delibs/decpp/deSpinBarrier.hpp
@@ -35,14 +35,21 @@
* SpinBarrier provides barrier implementation that uses spin loop for
* waiting for other threads. Threads may choose to wait in tight loop
* (WAIT_MODE_BUSY) or yield between iterations (WAIT_MODE_YIELD).
+ *
+ * It is not recommended to use WAIT_MODE_BUSY when there are more threads
+ * than number of cores participating in the barrier as it will lead to
+ * priority inversion and dramatic slowdown. For that reason WAIT_MODE_AUTO
+ * is provided, which selects between busy and yielding waiting based on
+ * number of threads.
*//*--------------------------------------------------------------------*/
class SpinBarrier
{
public:
enum WaitMode
{
- WAIT_MODE_BUSY = 0,
- WAIT_MODE_YIELD,
+ WAIT_MODE_BUSY = 0, //! Wait in tight spin loop.
+ WAIT_MODE_YIELD, //! Call deYield() between spin loop iterations.
+ WAIT_MODE_AUTO, //! Use WAIT_MODE_BUSY loop if #threads <= #cores, otherwise WAIT_MODE_YIELD.
WAIT_MODE_LAST
};
@@ -50,15 +57,28 @@
SpinBarrier (deInt32 numThreads);
~SpinBarrier (void);
+ //! Reset barrier. Not thread-safe, e.g. no other thread can
+ //! be calling sync() or removeThread() at the same time.
+ void reset (deUint32 numThreads);
+
+ //! Wait until all threads (determined by active thread count)
+ //! have entered sync().
void sync (WaitMode mode);
+ //! Remove thread from barrier (decrements active thread count).
+ //! Can be called concurrently with sync() or removeThread().
+ void removeThread (WaitMode mode);
+
private:
SpinBarrier (const SpinBarrier&);
SpinBarrier operator= (const SpinBarrier&);
- const deInt32 m_numThreads;
+ const deUint32 m_numCores;
+
+ volatile deInt32 m_numThreads;
volatile deInt32 m_numEntered;
volatile deInt32 m_numLeaving;
+ volatile deInt32 m_numRemoved;
};
void SpinBarrier_selfTest (void);
diff --git a/framework/delibs/decpp/deThreadSafeRingBuffer.cpp b/framework/delibs/decpp/deThreadSafeRingBuffer.cpp
index 065688b..3a8030d 100644
--- a/framework/delibs/decpp/deThreadSafeRingBuffer.cpp
+++ b/framework/delibs/decpp/deThreadSafeRingBuffer.cpp
@@ -49,8 +49,8 @@
{
}
- deUint16 getThreadId (void) const { return data >> 16; }
- deUint16 getPayload (void) const { return data & 0xffff; }
+ deUint16 getThreadId (void) const { return (deUint16)(data >> 16); }
+ deUint16 getPayload (void) const { return (deUint16)(data & 0xffff); }
};
class Consumer : public Thread
@@ -169,7 +169,7 @@
{
deUint32 cmpSum = 0;
for (int j = 0; j < numConsumers; j++)
- cmpSum += consumers[j]->getPayloadSum(i);
+ cmpSum += consumers[j]->getPayloadSum((deUint16)i);
DE_TEST_ASSERT(refSum == cmpSum);
}
diff --git a/framework/delibs/depool/deMemPool.c b/framework/delibs/depool/deMemPool.c
index 7c32f3d..5ae8920 100644
--- a/framework/delibs/depool/deMemPool.c
+++ b/framework/delibs/depool/deMemPool.c
@@ -118,13 +118,13 @@
* \param page Memory page to initialize.
* \param capacity Capacity allocated for the memory page.
*//*--------------------------------------------------------------------*/
-static void MemPage_init (MemPage* page, int capacity)
+static void MemPage_init (MemPage* page, size_t capacity)
{
memset(page, 0, sizeof(MemPage));
#if defined(DE_DEBUG)
memset(page + 1, 0xCD, capacity);
#endif
- page->capacity = capacity;
+ page->capacity = (int)capacity;
}
/*--------------------------------------------------------------------*//*!
@@ -133,7 +133,7 @@
* \param capacity Capacity for the memory page.
* \return The created memory page (or null on failure).
*//*--------------------------------------------------------------------*/
-static MemPage* MemPage_create (int capacity)
+static MemPage* MemPage_create (size_t capacity)
{
MemPage* page = (MemPage*)deMalloc(sizeof(MemPage) + capacity);
if (!page)
@@ -155,7 +155,7 @@
#if defined(DE_DEBUG)
/* Fill with garbage to hopefully catch dangling pointer bugs easier. */
deUint8* dataPtr = (deUint8*)(page + 1);
- memset(dataPtr, 0xCD, page->capacity);
+ memset(dataPtr, 0xCD, (size_t)page->capacity);
#endif
deFree(page);
}
@@ -423,7 +423,7 @@
return numCapacityBytes;
}
-DE_INLINE void* deMemPool_allocInternal (deMemPool* pool, int numBytes, deUint32 alignBytes)
+DE_INLINE void* deMemPool_allocInternal (deMemPool* pool, size_t numBytes, deUint32 alignBytes)
{
MemPage* curPage = pool->currentPage;
@@ -457,19 +457,19 @@
#endif
DE_ASSERT(curPage);
- DE_ASSERT(deIsPowerOfTwo32(alignBytes));
+ DE_ASSERT(deIsPowerOfTwo32((int)alignBytes));
{
void* curPagePtr = (void*)((deUint8*)(curPage + 1) + curPage->bytesAllocated);
void* alignedPtr = deAlignPtr(curPagePtr, alignBytes);
- int alignPadding = (int)((deUintptr)alignedPtr - (deUintptr)curPagePtr);
+ size_t alignPadding = (size_t)((deUintptr)alignedPtr - (deUintptr)curPagePtr);
- if (numBytes + alignPadding > curPage->capacity - curPage->bytesAllocated)
+ if (numBytes + alignPadding > (size_t)(curPage->capacity - curPage->bytesAllocated))
{
/* Does not fit to current page. */
- int maxAlignPadding = deMax32(0, alignBytes-MEM_PAGE_BASE_ALIGN);
- int newPageCapacity = deMax32(deMin32(2*curPage->capacity, MAX_PAGE_SIZE), numBytes+maxAlignPadding);
+ int maxAlignPadding = deMax32(0, ((int)alignBytes)-MEM_PAGE_BASE_ALIGN);
+ int newPageCapacity = deMax32(deMin32(2*curPage->capacity, MAX_PAGE_SIZE), ((int)numBytes)+maxAlignPadding);
- curPage = MemPage_create(newPageCapacity);
+ curPage = MemPage_create((size_t)newPageCapacity);
if (!curPage)
return DE_NULL;
@@ -480,12 +480,12 @@
curPagePtr = (void*)(curPage + 1);
alignedPtr = deAlignPtr(curPagePtr, alignBytes);
- alignPadding = (int)((deUintptr)alignedPtr - (deUintptr)curPagePtr);
+ alignPadding = (size_t)((deUintptr)alignedPtr - (deUintptr)curPagePtr);
- DE_ASSERT(numBytes + alignPadding <= curPage->capacity);
+ DE_ASSERT(numBytes + alignPadding <= (size_t)curPage->capacity);
}
- curPage->bytesAllocated += numBytes+alignPadding;
+ curPage->bytesAllocated += (int)(numBytes + alignPadding);
return alignedPtr;
}
}
@@ -496,7 +496,7 @@
* \param numBytes Number of bytes to allocate.
* \return Pointer to the allocate memory (or null on failure).
*//*--------------------------------------------------------------------*/
-void* deMemPool_alloc (deMemPool* pool, int numBytes)
+void* deMemPool_alloc (deMemPool* pool, size_t numBytes)
{
void* ptr;
DE_ASSERT(pool);
@@ -514,7 +514,7 @@
* \param alignBytes Required alignment in bytes, must be power of two.
* \return Pointer to the allocate memory (or null on failure).
*//*--------------------------------------------------------------------*/
-void* deMemPool_alignedAlloc (deMemPool* pool, int numBytes, deUint32 alignBytes)
+void* deMemPool_alignedAlloc (deMemPool* pool, size_t numBytes, deUint32 alignBytes)
{
void* ptr;
DE_ASSERT(pool);
@@ -533,7 +533,7 @@
* \param ptr Piece of memory to duplicate.
* \return Pointer to the copied memory block (or null on failure).
*//*--------------------------------------------------------------------*/
-void* deMemPool_memDup (deMemPool* pool, const void* ptr, int numBytes)
+void* deMemPool_memDup (deMemPool* pool, const void* ptr, size_t numBytes)
{
void* newPtr = deMemPool_alloc(pool, numBytes);
if (newPtr)
@@ -549,7 +549,7 @@
*//*--------------------------------------------------------------------*/
char* deMemPool_strDup (deMemPool* pool, const char* str)
{
- int len = (int)strlen(str);
+ size_t len = strlen(str);
char* newStr = (char*)deMemPool_alloc(pool, len+1);
if (newStr)
memcpy(newStr, str, len+1);
@@ -565,8 +565,11 @@
*//*--------------------------------------------------------------------*/
char* deMemPool_strnDup (deMemPool* pool, const char* str, int maxLength)
{
- int len = deMin32((int)strlen(str), maxLength);
+ size_t len = (size_t)deMin32((int)strlen(str), deMax32(0, maxLength));
char* newStr = (char*)deMemPool_alloc(pool, len + 1);
+
+ DE_ASSERT(maxLength >= 0);
+
if (newStr)
{
memcpy(newStr, str, len);
diff --git a/framework/delibs/depool/deMemPool.h b/framework/delibs/depool/deMemPool.h
index fde8738..44e074d 100644
--- a/framework/delibs/depool/deMemPool.h
+++ b/framework/delibs/depool/deMemPool.h
@@ -69,9 +69,9 @@
int deMemPool_getNumAllocatedBytes (const deMemPool* pool, deBool recurse);
int deMemPool_getCapacity (const deMemPool* pool, deBool recurse);
-void* deMemPool_alloc (deMemPool* pool, int numBytes);
-void* deMemPool_alignedAlloc (deMemPool* pool, int numBytes, deUint32 alignBytes);
-void* deMemPool_memDup (deMemPool* pool, const void* ptr, int numBytes);
+void* deMemPool_alloc (deMemPool* pool, size_t numBytes);
+void* deMemPool_alignedAlloc (deMemPool* pool, size_t numBytes, deUint32 alignBytes);
+void* deMemPool_memDup (deMemPool* pool, const void* ptr, size_t numBytes);
char* deMemPool_strDup (deMemPool* pool, const char* str);
char* deMemPool_strnDup (deMemPool* pool, const char* str, int maxLength);
diff --git a/framework/delibs/depool/dePoolArray.c b/framework/delibs/depool/dePoolArray.c
index 6f6752f..aff04de 100644
--- a/framework/delibs/depool/dePoolArray.c
+++ b/framework/delibs/depool/dePoolArray.c
@@ -75,7 +75,7 @@
if (arr->pageTableCapacity < reqPageTableCapacity)
{
int newPageTableCapacity = deMax32(2*arr->pageTableCapacity, reqPageTableCapacity);
- void** newPageTable = (void**)deMemPool_alloc(arr->pool, newPageTableCapacity * sizeof(void*));
+ void** newPageTable = (void**)deMemPool_alloc(arr->pool, (size_t)newPageTableCapacity * sizeof(void*));
int i;
if (!newPageTable)
@@ -89,7 +89,7 @@
/* Grab information about old page table for recycling purposes. */
oldPageTable = arr->pageTable;
- oldPageTableSize = arr->pageTableCapacity * sizeof(void*);
+ oldPageTableSize = arr->pageTableCapacity * (int)sizeof(void*);
arr->pageTable = newPageTable;
arr->pageTableCapacity = newPageTableCapacity;
@@ -115,7 +115,7 @@
/* Allocate the rest of the needed pages from the pool. */
for (; pageTableNdx < reqPageTableCapacity; pageTableNdx++)
{
- void* newPage = deMemPool_alloc(arr->pool, pageAllocSize);
+ void* newPage = deMemPool_alloc(arr->pool, (size_t)pageAllocSize);
if (!newPage)
return DE_FALSE;
diff --git a/framework/delibs/depool/dePoolHash.h b/framework/delibs/depool/dePoolHash.h
index 1507c16..8aedba9 100644
--- a/framework/delibs/depool/dePoolHash.h
+++ b/framework/delibs/depool/dePoolHash.h
@@ -257,7 +257,7 @@
if (newSlotTableSize > hash->slotTableSize) \
{ \
TYPENAME##Slot** oldSlotTable = hash->slotTable; \
- TYPENAME##Slot** newSlotTable = (TYPENAME##Slot**)deMemPool_alloc(hash->pool, sizeof(TYPENAME##Slot*) * newSlotTableSize); \
+ TYPENAME##Slot** newSlotTable = (TYPENAME##Slot**)deMemPool_alloc(hash->pool, sizeof(TYPENAME##Slot*) * (size_t)newSlotTableSize); \
int oldSlotTableSize = hash->slotTableSize; \
int slotNdx; \
\
@@ -298,7 +298,7 @@
{ \
if (hash->numElements > 0) \
{ \
- int slotNdx = HASHFUNC(key) & (hash->slotTableSize - 1); \
+ int slotNdx = (int)(HASHFUNC(key) & (deUint32)(hash->slotTableSize - 1)); \
TYPENAME##Slot* slot = hash->slotTable[slotNdx]; \
DE_ASSERT(deInBounds32(slotNdx, 0, hash->slotTableSize)); \
\
@@ -328,7 +328,7 @@
if (!TYPENAME##_rehash(hash, deMax32(4, 2*hash->slotTableSize))) \
return DE_FALSE; \
\
- slotNdx = HASHFUNC(key) & (hash->slotTableSize - 1); \
+ slotNdx = (int)(HASHFUNC(key) & (deUint32)(hash->slotTableSize - 1)); \
DE_ASSERT(slotNdx >= 0 && slotNdx < hash->slotTableSize); \
slot = hash->slotTable[slotNdx]; \
\
@@ -371,7 +371,7 @@
TYPENAME##Slot* prevSlot = DE_NULL; \
\
DE_ASSERT(hash->numElements > 0); \
- slotNdx = HASHFUNC(key) & (hash->slotTableSize - 1); \
+ slotNdx = (int)(HASHFUNC(key) & (deUint32)(hash->slotTableSize - 1)); \
DE_ASSERT(slotNdx >= 0 && slotNdx < hash->slotTableSize); \
slot = hash->slotTable[slotNdx]; \
DE_ASSERT(slot); \
diff --git a/framework/delibs/depool/dePoolSet.h b/framework/delibs/depool/dePoolSet.h
index f0fb3af..e827a1e 100644
--- a/framework/delibs/depool/dePoolSet.h
+++ b/framework/delibs/depool/dePoolSet.h
@@ -265,7 +265,7 @@
if (newSlotTableSize > set->slotTableSize) \
{ \
TYPENAME##Slot** oldSlotTable = set->slotTable; \
- TYPENAME##Slot** newSlotTable = (TYPENAME##Slot**)deMemPool_alloc(set->pool, sizeof(TYPENAME##Slot*) * newSlotTableSize); \
+ TYPENAME##Slot** newSlotTable = (TYPENAME##Slot**)deMemPool_alloc(set->pool, sizeof(TYPENAME##Slot*) * (size_t)newSlotTableSize); \
int oldSlotTableSize = set->slotTableSize; \
int slotNdx; \
\
@@ -306,7 +306,7 @@
{ \
if (set->numElements > 0) \
{ \
- int slotNdx = HASHFUNC(key) & (set->slotTableSize - 1); \
+ int slotNdx = (int)(HASHFUNC(key) & (deUint32)(set->slotTableSize - 1)); \
TYPENAME##Slot* slot = set->slotTable[slotNdx]; \
DE_ASSERT(deInBounds32(slotNdx, 0, set->slotTableSize)); \
\
@@ -337,7 +337,7 @@
if (!TYPENAME##_rehash(set, deMax32(4, 2*set->slotTableSize))) \
return DE_FALSE; \
\
- slotNdx = HASHFUNC(key) & (set->slotTableSize - 1); \
+ slotNdx = (int)(HASHFUNC(key) & (deUint32)(set->slotTableSize - 1)); \
DE_ASSERT(slotNdx >= 0 && slotNdx < set->slotTableSize); \
slot = set->slotTable[slotNdx]; \
\
@@ -379,7 +379,7 @@
TYPENAME##Slot* prevSlot = DE_NULL; \
\
DE_ASSERT(set->numElements > 0); \
- slotNdx = HASHFUNC(key) & (set->slotTableSize - 1); \
+ slotNdx = (int)(HASHFUNC(key) & (deUint32)(set->slotTableSize - 1)); \
DE_ASSERT(slotNdx >= 0 && slotNdx < set->slotTableSize); \
slot = set->slotTable[slotNdx]; \
DE_ASSERT(slot); \
diff --git a/framework/delibs/depool/dePoolStringBuilder.c b/framework/delibs/depool/dePoolStringBuilder.c
index 4e4dd46..53a0f14 100644
--- a/framework/delibs/depool/dePoolStringBuilder.c
+++ b/framework/delibs/depool/dePoolStringBuilder.c
@@ -58,7 +58,7 @@
deBool dePoolStringBuilder_appendString (dePoolStringBuilder* builder, const char* str)
{
StringBlock* block = DE_POOL_NEW(builder->pool, StringBlock);
- int len = (int)strlen(str);
+ size_t len = strlen(str);
char* blockStr = (char*)deMemPool_alloc(builder->pool, len + 1);
if (!block || !blockStr)
@@ -84,7 +84,7 @@
builder->blockListTail = block;
- builder->length += len;
+ builder->length += (int)len;
return DE_TRUE;
}
@@ -117,7 +117,7 @@
char* dePoolStringBuilder_dupToPool (dePoolStringBuilder* builder, deMemPool* pool)
{
- char* resultStr = (char*)deMemPool_alloc(pool, builder->length + 1);
+ char* resultStr = (char*)deMemPool_alloc(pool, (size_t)builder->length + 1);
if (resultStr)
{
diff --git a/framework/delibs/destream/deRingbuffer.c b/framework/delibs/destream/deRingbuffer.c
index 4e55139..7468484 100644
--- a/framework/delibs/destream/deRingbuffer.c
+++ b/framework/delibs/destream/deRingbuffer.c
@@ -59,8 +59,8 @@
ringbuffer->blockSize = blockSize;
ringbuffer->blockCount = blockCount;
- ringbuffer->buffer = (deUint8*)deMalloc(sizeof(deUint8) * blockSize * blockCount);
- ringbuffer->blockUsage = (deInt32*)deMalloc(sizeof(deUint32) * blockCount);
+ ringbuffer->buffer = (deUint8*)deMalloc(sizeof(deUint8) * (size_t)blockSize * (size_t)blockCount);
+ ringbuffer->blockUsage = (deInt32*)deMalloc(sizeof(deUint32) * (size_t)blockCount);
ringbuffer->emptyCount = deSemaphore_create(ringbuffer->blockCount, DE_NULL);
ringbuffer->fullCount = deSemaphore_create(0, DE_NULL);
@@ -79,7 +79,7 @@
return DE_NULL;
}
- memset(ringbuffer->blockUsage, 0, sizeof(deInt32) * blockCount);
+ memset(ringbuffer->blockUsage, 0, sizeof(deInt32) * (size_t)blockCount);
ringbuffer->outBlock = 0;
ringbuffer->outPos = 0;
@@ -141,7 +141,7 @@
dst = ringbuffer->buffer + ringbuffer->blockSize * ringbuffer->inBlock + ringbuffer->inPos;
src = (deUint8*)buf + *written;
- deMemcpy(dst, src, writeSize);
+ deMemcpy(dst, src, (size_t)writeSize);
ringbuffer->inPos += writeSize;
*written += writeSize;
@@ -238,7 +238,7 @@
src = ringbuffer->buffer + ringbuffer->blockSize * ringbuffer->outBlock + ringbuffer->outPos;
dst = (deUint8*)buf + *read;
- deMemcpy(dst, src, writeSize);
+ deMemcpy(dst, src, (size_t)writeSize);
ringbuffer->outPos += writeSize;
*read += writeSize;
diff --git a/framework/delibs/destream/deStreamCpyThread.c b/framework/delibs/destream/deStreamCpyThread.c
index 97a0d9a..c07266a 100644
--- a/framework/delibs/destream/deStreamCpyThread.c
+++ b/framework/delibs/destream/deStreamCpyThread.c
@@ -28,7 +28,7 @@
void cpyStream (void* arg)
{
deStreamCpyThread* thread = (deStreamCpyThread*)arg;
- deUint8* buffer = malloc(sizeof(deUint8) * thread->bufferSize);
+ deUint8* buffer = malloc(sizeof(deUint8) * (size_t)thread->bufferSize);
for(;;)
{
diff --git a/framework/delibs/destream/deThreadStream.c b/framework/delibs/destream/deThreadStream.c
index 2cc0bf3..3c5ad98 100644
--- a/framework/delibs/destream/deThreadStream.c
+++ b/framework/delibs/destream/deThreadStream.c
@@ -48,7 +48,7 @@
{
deThreadInStream* threadStream = (deThreadInStream*)arg;
- deUint8* buffer = malloc(sizeof(deUint8) * threadStream->bufferSize);
+ deUint8* buffer = malloc(sizeof(deUint8) * (size_t)threadStream->bufferSize);
for(;;)
{
diff --git a/framework/delibs/dethread/deThreadTest.c b/framework/delibs/dethread/deThreadTest.c
index 2af44de..dfd3b27 100644
--- a/framework/delibs/dethread/deThreadTest.c
+++ b/framework/delibs/dethread/deThreadTest.c
@@ -355,12 +355,12 @@
typedef struct TestBuffer_s
{
- deInt32 buffer[32];
+ deUint32 buffer[32];
deSemaphore empty;
deSemaphore fill;
- deInt32 producerSum;
- deInt32 consumerSum;
+ deUint32 producerHash;
+ deUint32 consumerHash;
} TestBuffer;
void producerThread (void* arg)
@@ -375,16 +375,16 @@
for (ndx = 0; ndx <= numToProduce; ndx++)
{
- deInt32 val;
+ deUint32 val;
if (ndx == numToProduce)
{
- val = 0; /* End. */
+ val = 0u; /* End. */
}
else
{
- val = (deInt32)deRandom_getUint32(&random);
- val = val ? val : 1;
+ val = deRandom_getUint32(&random);
+ val = val ? val : 1u;
}
deSemaphore_decrement(buffer->empty);
@@ -394,7 +394,7 @@
deSemaphore_increment(buffer->fill);
- buffer->producerSum += val;
+ buffer->producerHash ^= val;
}
}
@@ -414,7 +414,7 @@
deSemaphore_increment(buffer->empty);
- buffer->consumerSum += val;
+ buffer->consumerHash ^= val;
if (val == 0)
break;
@@ -463,7 +463,7 @@
deSemaphore_destroy(testBuffer.empty);
deSemaphore_destroy(testBuffer.fill);
- DE_TEST_ASSERT(testBuffer.producerSum == testBuffer.consumerSum);
+ DE_TEST_ASSERT(testBuffer.producerHash == testBuffer.consumerHash);
}
}
diff --git a/framework/delibs/dethread/unix/deSemaphoreUnix.c b/framework/delibs/dethread/unix/deSemaphoreUnix.c
index 110e35e..a9c6f14 100644
--- a/framework/delibs/dethread/unix/deSemaphoreUnix.c
+++ b/framework/delibs/dethread/unix/deSemaphoreUnix.c
@@ -36,11 +36,12 @@
sem_t* sem = (sem_t*)deMalloc(sizeof(sem_t));
DE_UNREF(attributes);
+ DE_ASSERT(initialValue >= 0);
if (!sem)
return 0;
- if (sem_init(sem, 0, initialValue) != 0)
+ if (sem_init(sem, 0, (unsigned int)initialValue) != 0)
{
deFree(sem);
return 0;
diff --git a/framework/delibs/dethread/unix/deThreadUnix.c b/framework/delibs/dethread/unix/deThreadUnix.c
index 04035ef..6eeafbd 100644
--- a/framework/delibs/dethread/unix/deThreadUnix.c
+++ b/framework/delibs/dethread/unix/deThreadUnix.c
@@ -172,12 +172,12 @@
if (ret > 0)
{
- return dePop64(mask);
+ return (deUint32)dePop64(mask);
}
else
{
#if defined(_SC_NPROCESSORS_ONLN)
- const int count = sysconf(_SC_NPROCESSORS_ONLN);
+ const long count = sysconf(_SC_NPROCESSORS_ONLN);
if (count <= 0)
return 1;
@@ -194,7 +194,7 @@
deUint32 deGetNumAvailableLogicalCores (void)
{
#if defined(_SC_NPROCESSORS_ONLN)
- const int count = sysconf(_SC_NPROCESSORS_ONLN);
+ const long count = sysconf(_SC_NPROCESSORS_ONLN);
if (count <= 0)
return 1;
@@ -210,7 +210,7 @@
deUint32 deGetNumTotalLogicalCores (void)
{
#if defined(_SC_NPROCESSORS_CONF)
- const int count = sysconf(_SC_NPROCESSORS_CONF);
+ const long count = sysconf(_SC_NPROCESSORS_CONF);
if (count <= 0)
return 1;
diff --git a/framework/delibs/deutil/deCommandLine.c b/framework/delibs/deutil/deCommandLine.c
index 44f61f4..d0ebb1c 100644
--- a/framework/delibs/deutil/deCommandLine.c
+++ b/framework/delibs/deutil/deCommandLine.c
@@ -56,7 +56,7 @@
DE_ASSERT(commandLine);
/* Create buffer for args (no expansion can happen). */
- buf = (char*)deCalloc((int)strlen(commandLine)+1);
+ buf = (char*)deCalloc(strlen(commandLine)+1);
pos = 0;
argNdx = 0;
outPtr = buf;
@@ -118,7 +118,7 @@
{
deCommandLine* cmdLine = (deCommandLine*)deCalloc(sizeof(deCommandLine));
- if (!cmdLine || !(cmdLine->args = (char**)deCalloc(sizeof(char*)*CharPtrArray_getNumElements(args))))
+ if (!cmdLine || !(cmdLine->args = (char**)deCalloc(sizeof(char*)*(size_t)CharPtrArray_getNumElements(args))))
{
deFree(cmdLine);
deFree(buf);
diff --git a/framework/delibs/deutil/deFile.c b/framework/delibs/deutil/deFile.c
index 9cc2bf8..1ca81d6 100644
--- a/framework/delibs/deutil/deFile.c
+++ b/framework/delibs/deutil/deFile.c
@@ -185,7 +185,7 @@
deFileResult deFile_read (deFile* file, void* buf, deInt64 bufSize, deInt64* numReadPtr)
{
- deInt64 numRead = read(file->fd, buf, bufSize);
+ deInt64 numRead = read(file->fd, buf, (size_t)bufSize);
if (numReadPtr)
*numReadPtr = numRead;
@@ -195,7 +195,7 @@
deFileResult deFile_write (deFile* file, const void* buf, deInt64 bufSize, deInt64* numWrittenPtr)
{
- deInt64 numWritten = write(file->fd, buf, bufSize);
+ deInt64 numWritten = write(file->fd, buf, (size_t)bufSize);
if (numWrittenPtr)
*numWrittenPtr = numWritten;
diff --git a/framework/delibs/deutil/deProcess.c b/framework/delibs/deutil/deProcess.c
index 1b7ed5d..2962a1a 100644
--- a/framework/delibs/deutil/deProcess.c
+++ b/framework/delibs/deutil/deProcess.c
@@ -60,8 +60,9 @@
static void die (int statusPipe, const char* message)
{
- int msgLen = strlen(message);
- int res = 0;
+ size_t msgLen = strlen(message);
+ int res = 0;
+
printf("Process launch failed: %s\n", message);
res = (int)write(statusPipe, message, msgLen+1);
DE_UNREF(res); /* No need to check result. */
@@ -78,7 +79,7 @@
DE_INLINE deBool beginsWithPath (const char* fileName, const char* pathPrefix)
{
- int pathLen = strlen(pathPrefix);
+ size_t pathLen = strlen(pathPrefix);
/* Strip trailing / */
while (pathLen > 0 && pathPrefix[pathLen-1] == '/')
@@ -89,8 +90,8 @@
static void stripLeadingPath (char* fileName, const char* pathPrefix)
{
- int pathLen = strlen(pathPrefix);
- int fileNameLen = strlen(fileName);
+ size_t pathLen = strlen(pathPrefix);
+ size_t fileNameLen = strlen(fileName);
DE_ASSERT(beginsWithPath(fileName, pathPrefix));
@@ -108,7 +109,7 @@
static void execProcess (const char* commandLine, const char* workingDirectory, int statusPipe)
{
deCommandLine* cmdLine = deCommandLine_parse(commandLine);
- char** argList = cmdLine ? (char**)deCalloc(sizeof(char*)*(cmdLine->numArgs+1)) : DE_NULL;
+ char** argList = cmdLine ? (char**)deCalloc(sizeof(char*)*((size_t)cmdLine->numArgs+1)) : DE_NULL;
if (!cmdLine || !argList)
die(statusPipe, "Command line parsing failed (out of memory)");
@@ -299,7 +300,7 @@
/* Check status. */
{
char errBuf[256];
- int result = 0;
+ ssize_t result = 0;
close(statusPipe[1]);
while ((result = read(statusPipe[0], errBuf, 1)) == -1)
@@ -307,6 +308,8 @@
if (result > 0)
{
+ int procStatus = 0;
+
/* Read full error msg. */
int errPos = 1;
while (errPos < DE_LENGTH_OF_ARRAY(errBuf))
@@ -328,7 +331,7 @@
closePipe(pipeErr);
/* Run waitpid to clean up zombie. */
- waitpid(pid, &result, 0);
+ waitpid(pid, &procStatus, 0);
deProcess_setError(process, errBuf);
@@ -348,9 +351,9 @@
close(pipeOut[1]);
close(pipeErr[1]);
- process->standardIn = deFile_createFromHandle(pipeIn[1]);
- process->standardOut = deFile_createFromHandle(pipeOut[0]);
- process->standardErr = deFile_createFromHandle(pipeErr[0]);
+ process->standardIn = deFile_createFromHandle((deUintptr)pipeIn[1]);
+ process->standardOut = deFile_createFromHandle((deUintptr)pipeOut[0]);
+ process->standardErr = deFile_createFromHandle((deUintptr)pipeErr[0]);
if (!process->standardIn)
close(pipeIn[1]);
diff --git a/framework/delibs/deutil/deSocket.c b/framework/delibs/deutil/deSocket.c
index fa8eced..751e34f 100644
--- a/framework/delibs/deutil/deSocket.c
+++ b/framework/delibs/deutil/deSocket.c
@@ -189,9 +189,13 @@
#if defined(DE_USE_WINSOCK)
/* \note SOCKET is unsigned type! */
typedef SOCKET deSocketHandle;
+ typedef int NativeSocklen;
+ typedef int NativeSize;
# define DE_INVALID_SOCKET_HANDLE INVALID_SOCKET
#else
typedef int deSocketHandle;
+ typedef socklen_t NativeSocklen;
+ typedef size_t NativeSize;
# define DE_INVALID_SOCKET_HANDLE -1
#endif
@@ -251,7 +255,7 @@
}
}
-static deBool deSocketAddressToBsdAddress (const deSocketAddress* address, int bsdAddrBufSize, struct sockaddr* bsdAddr, int* bsdAddrLen)
+static deBool deSocketAddressToBsdAddress (const deSocketAddress* address, size_t bsdAddrBufSize, struct sockaddr* bsdAddr, NativeSocklen* bsdAddrLen)
{
deMemset(bsdAddr, 0, bsdAddrBufSize);
@@ -275,28 +279,28 @@
/* \note Always uses first address. */
- if (bsdAddrBufSize < (int)result->ai_addrlen)
+ if (bsdAddrBufSize < (size_t)result->ai_addrlen)
{
DE_ASSERT(!"Too small bsdAddr buffer");
freeaddrinfo(result);
return DE_FALSE;
}
- *bsdAddrLen = (int)result->ai_addrlen;
+ *bsdAddrLen = (NativeSocklen)result->ai_addrlen;
- deMemcpy(bsdAddr, result->ai_addr, (int)result->ai_addrlen);
+ deMemcpy(bsdAddr, result->ai_addr, (size_t)result->ai_addrlen);
freeaddrinfo(result);
/* Add port. */
if (bsdAddr->sa_family == AF_INET)
{
- if (*bsdAddrLen < (int)sizeof(struct sockaddr_in))
+ if (*bsdAddrLen < (NativeSocklen)sizeof(struct sockaddr_in))
return DE_FALSE;
((struct sockaddr_in*)bsdAddr)->sin_port = htons((deUint16)address->port);
}
else if (bsdAddr->sa_family == AF_INET6)
{
- if (*bsdAddrLen < (int)sizeof(struct sockaddr_in6))
+ if (*bsdAddrLen < (NativeSocklen)sizeof(struct sockaddr_in6))
return DE_FALSE;
((struct sockaddr_in6*)bsdAddr)->sin6_port = htons((deUint16)address->port);
}
@@ -309,7 +313,7 @@
{
struct sockaddr_in* addr4 = (struct sockaddr_in*)bsdAddr;
- if (bsdAddrBufSize < (int)sizeof(struct sockaddr_in))
+ if (bsdAddrBufSize < sizeof(struct sockaddr_in))
{
DE_ASSERT(!"Too small bsdAddr buffer");
return DE_FALSE;
@@ -319,7 +323,7 @@
addr4->sin_family = AF_INET;
addr4->sin_addr.s_addr = INADDR_ANY;
- *bsdAddrLen = sizeof(struct sockaddr_in);
+ *bsdAddrLen = (NativeSocklen)sizeof(struct sockaddr_in);
return DE_TRUE;
}
@@ -327,7 +331,7 @@
{
struct sockaddr_in6* addr6 = (struct sockaddr_in6*)bsdAddr;
- if (bsdAddrBufSize < (int)sizeof(struct sockaddr_in6))
+ if (bsdAddrBufSize < sizeof(struct sockaddr_in6))
{
DE_ASSERT(!"Too small bsdAddr buffer");
return DE_FALSE;
@@ -336,7 +340,7 @@
addr6->sin6_port = htons((deUint16)address->port);
addr6->sin6_family = AF_INET6;
- *bsdAddrLen = sizeof(struct sockaddr_in6);
+ *bsdAddrLen = (NativeSocklen)sizeof(struct sockaddr_in6);
return DE_TRUE;
}
@@ -472,13 +476,13 @@
const int backlogSize = 4;
deUint8 bsdAddrBuf[sizeof(struct sockaddr_in6)];
struct sockaddr* bsdAddr = (struct sockaddr*)&bsdAddrBuf[0];
- int bsdAddrLen;
+ NativeSocklen bsdAddrLen;
if (sock->state != DE_SOCKETSTATE_CLOSED)
return DE_FALSE;
/* Resolve address. */
- if (!deSocketAddressToBsdAddress(address, (int)sizeof(bsdAddrBuf), bsdAddr, &bsdAddrLen))
+ if (!deSocketAddressToBsdAddress(address, sizeof(bsdAddrBuf), bsdAddr, &bsdAddrLen))
return DE_FALSE;
/* Create socket. */
@@ -495,7 +499,7 @@
}
/* Bind to address. */
- if (bind(sock->handle, bsdAddr, bsdAddrLen) != 0)
+ if (bind(sock->handle, bsdAddr, (NativeSocklen)bsdAddrLen) != 0)
{
deSocket_close(sock);
return DE_FALSE;
@@ -519,19 +523,11 @@
deSocket* newSock = DE_NULL;
deUint8 bsdAddrBuf[sizeof(struct sockaddr_in6)];
struct sockaddr* bsdAddr = (struct sockaddr*)&bsdAddrBuf[0];
-#if defined(DE_USE_WINSOCK)
- int bsdAddrLen = (int)sizeof(bsdAddrBuf);
-#else
- socklen_t bsdAddrLen = (socklen_t)sizeof(bsdAddrBuf);
-#endif
+ NativeSocklen bsdAddrLen = (NativeSocklen)sizeof(bsdAddrBuf);
- deMemset(bsdAddr, 0, (int)bsdAddrLen);
+ deMemset(bsdAddr, 0, (size_t)bsdAddrLen);
-#if defined(DE_USE_WINSOCK)
newFd = accept(sock->handle, bsdAddr, &bsdAddrLen);
-#else
- newFd = accept(sock->handle, bsdAddr, (socklen_t*)&bsdAddrLen);
-#endif
if (!deSocketHandleIsValid(newFd))
return DE_NULL;
@@ -561,10 +557,10 @@
{
deUint8 bsdAddrBuf[sizeof(struct sockaddr_in6)];
struct sockaddr* bsdAddr = (struct sockaddr*)&bsdAddrBuf[0];
- int bsdAddrLen;
+ NativeSocklen bsdAddrLen;
/* Resolve address. */
- if (!deSocketAddressToBsdAddress(address, (int)sizeof(bsdAddrBuf), bsdAddr, &bsdAddrLen))
+ if (!deSocketAddressToBsdAddress(address, sizeof(bsdAddrBuf), bsdAddr, &bsdAddrLen))
return DE_FALSE;
/* Create socket. */
@@ -603,7 +599,7 @@
return DE_FALSE;
}
- DE_ASSERT(channels != 0 && (channels & ~DE_SOCKETCHANNEL_BOTH) == 0);
+ DE_ASSERT(channels != 0 && (channels & ~(deUint32)DE_SOCKETCHANNEL_BOTH) == 0);
/* Don't attempt to close already closed channels on partially open socket. */
channels &= sock->openChannels;
@@ -751,13 +747,13 @@
deMutex_unlock(sock->stateLock);
}
-deSocketResult deSocket_send (deSocket* sock, const void* buf, int bufSize, int* numSentPtr)
+deSocketResult deSocket_send (deSocket* sock, const void* buf, size_t bufSize, size_t* numSentPtr)
{
- int numSent = (int)send(sock->handle, (const char*)buf, bufSize, 0);
+ int numSent = (int)send(sock->handle, (const char*)buf, (NativeSize)bufSize, 0);
deSocketResult result = mapSendRecvResult(numSent);
if (numSentPtr)
- *numSentPtr = numSent;
+ *numSentPtr = (numSent > 0) ? ((size_t)numSent) : (0);
/* Update state. */
if (result == DE_SOCKETRESULT_CONNECTION_CLOSED)
@@ -768,13 +764,13 @@
return result;
}
-deSocketResult deSocket_receive (deSocket* sock, void* buf, int bufSize, int* numReceivedPtr)
+deSocketResult deSocket_receive (deSocket* sock, void* buf, size_t bufSize, size_t* numReceivedPtr)
{
- int numRecv = (int)recv(sock->handle, (char*)buf, bufSize, 0);
+ int numRecv = (int)recv(sock->handle, (char*)buf, (NativeSize)bufSize, 0);
deSocketResult result = mapSendRecvResult(numRecv);
if (numReceivedPtr)
- *numReceivedPtr = numRecv;
+ *numReceivedPtr = (numRecv > 0) ? ((size_t)numRecv) : (0);
/* Update state. */
if (result == DE_SOCKETRESULT_CONNECTION_CLOSED)
diff --git a/framework/delibs/deutil/deSocket.h b/framework/delibs/deutil/deSocket.h
index 6270630..78d9b23 100644
--- a/framework/delibs/deutil/deSocket.h
+++ b/framework/delibs/deutil/deSocket.h
@@ -131,8 +131,8 @@
deBool deSocket_shutdown (deSocket* socket, deUint32 channels);
deBool deSocket_close (deSocket* socket);
-deSocketResult deSocket_send (deSocket* socket, const void* buf, int bufSize, int* numSent);
-deSocketResult deSocket_receive (deSocket* socket, void* buf, int bufSize, int* numReceived);
+deSocketResult deSocket_send (deSocket* socket, const void* buf, size_t bufSize, size_t* numSent);
+deSocketResult deSocket_receive (deSocket* socket, void* buf, size_t bufSize, size_t* numReceived);
/* Utilities. */
diff --git a/framework/delibs/deutil/deTimerTest.c b/framework/delibs/deutil/deTimerTest.c
index 0d39d82..15ec454 100644
--- a/framework/delibs/deutil/deTimerTest.c
+++ b/framework/delibs/deutil/deTimerTest.c
@@ -68,9 +68,9 @@
DE_TEST_ASSERT(scheduleOk);
- deSleep(interval*intervalSleepMultiplier);
+ deSleep((deUint32)(interval*intervalSleepMultiplier));
deTimer_disable(timer);
- deSleep(interval);
+ deSleep((deUint32)interval);
printf(" timer fired %d times, expected %d\n", numCalls, expectedCalls);
DE_TEST_ASSERT(!isSingle || numCalls == 1);
diff --git a/framework/egl/egluGLContextFactory.cpp b/framework/egl/egluGLContextFactory.cpp
index 29cc642..349e6c4 100644
--- a/framework/egl/egluGLContextFactory.cpp
+++ b/framework/egl/egluGLContextFactory.cpp
@@ -212,7 +212,7 @@
case RenderConfig::VISIBILITY_VISIBLE: return WindowParams::VISIBILITY_VISIBLE;
case RenderConfig::VISIBILITY_FULLSCREEN: return WindowParams::VISIBILITY_FULLSCREEN;
default:
- DE_ASSERT(visibility == (RenderConfig::Visibility)RenderConfig::DONT_CARE);
+ DE_ASSERT((int)visibility == RenderConfig::DONT_CARE);
return WindowParams::VISIBILITY_DONT_CARE;
}
}
diff --git a/framework/egl/egluGLUtil.cpp b/framework/egl/egluGLUtil.cpp
index 0f65b6d..8e31e39 100644
--- a/framework/egl/egluGLUtil.cpp
+++ b/framework/egl/egluGLUtil.cpp
@@ -169,7 +169,7 @@
return false;
}
- if (renderConfig.surfaceType != (glu::RenderConfig::SurfaceType)glu::RenderConfig::DONT_CARE)
+ if (renderConfig.surfaceType != glu::RenderConfig::SURFACETYPE_DONT_CARE)
{
EGLint surfaceType = 0;
EGLint requiredSurface = 0;
diff --git a/framework/opengl/simplereference/sglrContext.hpp b/framework/opengl/simplereference/sglrContext.hpp
index 72c0bd4..9799f28 100644
--- a/framework/opengl/simplereference/sglrContext.hpp
+++ b/framework/opengl/simplereference/sglrContext.hpp
@@ -168,8 +168,8 @@
virtual void uniform2iv (deInt32 index, deInt32 count, const deInt32*) = DE_NULL;
virtual void uniform3iv (deInt32 index, deInt32 count, const deInt32*) = DE_NULL;
virtual void uniform4iv (deInt32 index, deInt32 count, const deInt32*) = DE_NULL;
- virtual void uniformMatrix3fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value) = DE_NULL;
- virtual void uniformMatrix4fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value) = DE_NULL;
+ virtual void uniformMatrix3fv (deInt32 location, deInt32 count, deBool transpose, const float *value) = DE_NULL;
+ virtual void uniformMatrix4fv (deInt32 location, deInt32 count, deBool transpose, const float *value) = DE_NULL;
virtual deInt32 getUniformLocation (deUint32 program, const char *name) = DE_NULL;
virtual void lineWidth (float) = DE_NULL;
diff --git a/framework/opengl/simplereference/sglrGLContext.cpp b/framework/opengl/simplereference/sglrGLContext.cpp
index 6e65113..6db1647 100644
--- a/framework/opengl/simplereference/sglrGLContext.cpp
+++ b/framework/opengl/simplereference/sglrGLContext.cpp
@@ -579,12 +579,12 @@
void GLContext::colorMask (deBool r, deBool g, deBool b, deBool a)
{
- m_wrapper->glColorMask(r, g, b, a);
+ m_wrapper->glColorMask((glw::GLboolean)r, (glw::GLboolean)g, (glw::GLboolean)b, (glw::GLboolean)a);
}
void GLContext::depthMask (deBool mask)
{
- m_wrapper->glDepthMask(mask);
+ m_wrapper->glDepthMask((glw::GLboolean)mask);
}
void GLContext::stencilMask (deUint32 mask)
@@ -655,7 +655,7 @@
void GLContext::vertexAttribPointer (deUint32 index, int size, deUint32 type, deBool normalized, int stride, const void *pointer)
{
- m_wrapper->glVertexAttribPointer(index, size, type, normalized, stride, pointer);
+ m_wrapper->glVertexAttribPointer(index, size, type, (glw::GLboolean)normalized, stride, pointer);
}
void GLContext::vertexAttribIPointer (deUint32 index, int size, deUint32 type, int stride, const void *pointer)
@@ -763,14 +763,14 @@
m_wrapper->glUniform4iv(location, count, value);
}
-void GLContext::uniformMatrix3fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value)
+void GLContext::uniformMatrix3fv (deInt32 location, deInt32 count, deBool transpose, const float *value)
{
- m_wrapper->glUniformMatrix3fv(location, count, transpose, value);
+ m_wrapper->glUniformMatrix3fv(location, count, (glw::GLboolean)transpose, value);
}
-void GLContext::uniformMatrix4fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value)
+void GLContext::uniformMatrix4fv (deInt32 location, deInt32 count, deBool transpose, const float *value)
{
- m_wrapper->glUniformMatrix4fv(location, count, transpose, value);
+ m_wrapper->glUniformMatrix4fv(location, count, (glw::GLboolean)transpose, value);
}
deInt32 GLContext::getUniformLocation (deUint32 program, const char *name)
{
diff --git a/framework/opengl/simplereference/sglrGLContext.hpp b/framework/opengl/simplereference/sglrGLContext.hpp
index d68931d..fb4c8c4 100644
--- a/framework/opengl/simplereference/sglrGLContext.hpp
+++ b/framework/opengl/simplereference/sglrGLContext.hpp
@@ -180,8 +180,8 @@
virtual void uniform2iv (deInt32 index, deInt32 count, const deInt32*);
virtual void uniform3iv (deInt32 index, deInt32 count, const deInt32*);
virtual void uniform4iv (deInt32 index, deInt32 count, const deInt32*);
- virtual void uniformMatrix3fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value);
- virtual void uniformMatrix4fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value);
+ virtual void uniformMatrix3fv (deInt32 location, deInt32 count, deBool transpose, const float *value);
+ virtual void uniformMatrix4fv (deInt32 location, deInt32 count, deBool transpose, const float *value);
virtual deInt32 getUniformLocation (deUint32 program, const char *name);
virtual void lineWidth (float);
diff --git a/framework/opengl/simplereference/sglrReferenceContext.cpp b/framework/opengl/simplereference/sglrReferenceContext.cpp
index 9abd42c..e5f443b 100644
--- a/framework/opengl/simplereference/sglrReferenceContext.cpp
+++ b/framework/opengl/simplereference/sglrReferenceContext.cpp
@@ -2068,12 +2068,12 @@
if (texObj->getType() == Texture::TYPE_2D_ARRAY || texObj->getType() == Texture::TYPE_CUBE_MAP_ARRAY)
{
RC_IF_ERROR((layer < 0) || (layer >= GL_MAX_ARRAY_TEXTURE_LAYERS), GL_INVALID_VALUE, RC_RET_VOID);
- RC_IF_ERROR((level < 0) || (level > tcu::log2(GL_MAX_TEXTURE_SIZE)), GL_INVALID_VALUE, RC_RET_VOID);
+ RC_IF_ERROR((level < 0) || (level > deFloatLog2(GL_MAX_TEXTURE_SIZE)), GL_INVALID_VALUE, RC_RET_VOID);
}
else if (texObj->getType() == Texture::TYPE_3D)
{
- RC_IF_ERROR((layer < 0) || (layer >= GL_MAX_3D_TEXTURE_SIZE), GL_INVALID_VALUE, RC_RET_VOID);
- RC_IF_ERROR((level < 0) || (level > tcu::log2(GL_MAX_3D_TEXTURE_SIZE)), GL_INVALID_VALUE, RC_RET_VOID);
+ RC_IF_ERROR((layer < 0) || (layer >= GL_MAX_3D_TEXTURE_SIZE), GL_INVALID_VALUE, RC_RET_VOID);
+ RC_IF_ERROR((level < 0) || (level > deFloatLog2(GL_MAX_3D_TEXTURE_SIZE)), GL_INVALID_VALUE, RC_RET_VOID);
}
}
@@ -3859,7 +3859,7 @@
uniformv(location, glu::TYPE_INT_VEC4, count, v);
}
-void ReferenceContext::uniformMatrix3fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value)
+void ReferenceContext::uniformMatrix3fv (deInt32 location, deInt32 count, deBool transpose, const float *value)
{
RC_IF_ERROR(m_currentProgram == DE_NULL, GL_INVALID_OPERATION, RC_RET_VOID);
@@ -3897,7 +3897,7 @@
}
}
-void ReferenceContext::uniformMatrix4fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value)
+void ReferenceContext::uniformMatrix4fv (deInt32 location, deInt32 count, deBool transpose, const float *value)
{
RC_IF_ERROR(m_currentProgram == DE_NULL, GL_INVALID_OPERATION, RC_RET_VOID);
@@ -4286,7 +4286,7 @@
const bool hasStencil = !isEmpty(stencilBuf);
const int stencilBits = (hasStencil) ? (getNumStencilBits(stencilBuf.raw().getFormat())) : (0);
- const rr::RenderTarget renderTarget(colorBuf0, depthBuf,stencilBuf);
+ const rr::RenderTarget renderTarget(colorBuf0, depthBuf, stencilBuf);
const rr::Program program (m_currentProgram->m_program->getVertexShader(),
m_currentProgram->m_program->getFragmentShader(),
(m_currentProgram->m_program->m_hasGeometryShader) ? (m_currentProgram->m_program->getGeometryShader()) : (DE_NULL));
@@ -4785,7 +4785,7 @@
void Texture1D::sample4 (tcu::Vec4 output[4], const float packetTexcoords[4], float lodBias) const
{
- const int texWidth = m_view.getWidth();
+ const float texWidth = (float)m_view.getWidth();
const float dFdx0 = packetTexcoords[1] - packetTexcoords[0];
const float dFdx1 = packetTexcoords[3] - packetTexcoords[2];
@@ -4904,8 +4904,8 @@
void Texture2D::sample4 (tcu::Vec4 output[4], const tcu::Vec2 packetTexcoords[4], float lodBias) const
{
- const int texWidth = m_view.getWidth();
- const int texHeight = m_view.getHeight();
+ const float texWidth = (float)m_view.getWidth();
+ const float texHeight = (float)m_view.getHeight();
const tcu::Vec2 dFdx0 = packetTexcoords[1] - packetTexcoords[0];
const tcu::Vec2 dFdx1 = packetTexcoords[3] - packetTexcoords[2];
@@ -5022,7 +5022,7 @@
void TextureCube::sample4 (tcu::Vec4 output[4], const tcu::Vec3 packetTexcoords[4], float lodBias) const
{
- const int cubeSide = m_view.getSize();
+ const float cubeSide = (float)m_view.getSize();
// Each tex coord might be in a different face.
@@ -5137,8 +5137,8 @@
void Texture2DArray::sample4 (tcu::Vec4 output[4], const tcu::Vec3 packetTexcoords[4], float lodBias) const
{
- const int texWidth = m_view.getWidth();
- const int texHeight = m_view.getHeight();
+ const float texWidth = (float)m_view.getWidth();
+ const float texHeight = (float)m_view.getHeight();
const tcu::Vec3 dFdx0 = packetTexcoords[1] - packetTexcoords[0];
const tcu::Vec3 dFdx1 = packetTexcoords[3] - packetTexcoords[2];
@@ -5243,7 +5243,7 @@
void TextureCubeArray::sample4 (tcu::Vec4 output[4], const tcu::Vec4 packetTexcoords[4], float lodBias) const
{
- const int cubeSide = m_view.getSize();
+ const float cubeSide = (float)m_view.getSize();
const tcu::Vec3 cubeCoords[4] =
{
packetTexcoords[0].toWidth<3>(),
@@ -5346,9 +5346,9 @@
void Texture3D::sample4 (tcu::Vec4 output[4], const tcu::Vec3 packetTexcoords[4], float lodBias) const
{
- const int texWidth = m_view.getWidth();
- const int texHeight = m_view.getHeight();
- const int texDepth = m_view.getDepth();
+ const float texWidth = (float)m_view.getWidth();
+ const float texHeight = (float)m_view.getHeight();
+ const float texDepth = (float)m_view.getDepth();
const tcu::Vec3 dFdx0 = packetTexcoords[1] - packetTexcoords[0];
const tcu::Vec3 dFdx1 = packetTexcoords[3] - packetTexcoords[2];
diff --git a/framework/opengl/simplereference/sglrReferenceContext.hpp b/framework/opengl/simplereference/sglrReferenceContext.hpp
index dfdb294..37ebcdc 100644
--- a/framework/opengl/simplereference/sglrReferenceContext.hpp
+++ b/framework/opengl/simplereference/sglrReferenceContext.hpp
@@ -731,8 +731,8 @@
virtual void uniform2iv (deInt32 index, deInt32 count, const deInt32*);
virtual void uniform3iv (deInt32 index, deInt32 count, const deInt32*);
virtual void uniform4iv (deInt32 index, deInt32 count, const deInt32*);
- virtual void uniformMatrix3fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value);
- virtual void uniformMatrix4fv (deInt32 location, deInt32 count, deInt32 transpose, const float *value);
+ virtual void uniformMatrix3fv (deInt32 location, deInt32 count, deBool transpose, const float *value);
+ virtual void uniformMatrix4fv (deInt32 location, deInt32 count, deBool transpose, const float *value);
virtual deInt32 getUniformLocation (deUint32 program, const char *name);
virtual void lineWidth (float);
diff --git a/framework/platform/null/tcuNullContextFactory.cpp b/framework/platform/null/tcuNullContextFactory.cpp
new file mode 100644
index 0000000..d466185
--- /dev/null
+++ b/framework/platform/null/tcuNullContextFactory.cpp
@@ -0,0 +1,43 @@
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Tester Core
+ * ----------------------------------------
+ *
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Null GL Context Factory.
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuNullContextFactory.hpp"
+#include "tcuNullRenderContext.hpp"
+
+namespace tcu
+{
+namespace null
+{
+
+NullGLContextFactory::NullGLContextFactory (void)
+ : glu::ContextFactory("null", "Null Render Context")
+{
+}
+
+glu::RenderContext* NullGLContextFactory::createContext (const glu::RenderConfig& config, const tcu::CommandLine&) const
+{
+ return new RenderContext(config);
+}
+
+} // null
+} // tcu
diff --git a/framework/platform/null/tcuNullContextFactory.hpp b/framework/platform/null/tcuNullContextFactory.hpp
new file mode 100644
index 0000000..3f0e975
--- /dev/null
+++ b/framework/platform/null/tcuNullContextFactory.hpp
@@ -0,0 +1,44 @@
+#ifndef _TCUNULLCONTEXTFACTORY_HPP
+#define _TCUNULLCONTEXTFACTORY_HPP
+/*-------------------------------------------------------------------------
+ * drawElements Quality Program Tester Core
+ * ----------------------------------------
+ *
+ * Copyright 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief Null GL Context Factory.
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "gluContextFactory.hpp"
+
+namespace tcu
+{
+namespace null
+{
+
+class NullGLContextFactory : public glu::ContextFactory
+{
+public:
+ NullGLContextFactory (void);
+ glu::RenderContext* createContext (const glu::RenderConfig& config, const tcu::CommandLine&) const;
+};
+
+} // null
+} // tcu
+
+#endif // _TCUNULLCONTEXTFACTORY_HPP
diff --git a/framework/platform/null/tcuNullPlatform.cpp b/framework/platform/null/tcuNullPlatform.cpp
index 8bb9568..ea790e5 100644
--- a/framework/platform/null/tcuNullPlatform.cpp
+++ b/framework/platform/null/tcuNullPlatform.cpp
@@ -22,6 +22,7 @@
*//*--------------------------------------------------------------------*/
#include "tcuNullPlatform.hpp"
+#include "tcuNullContextFactory.hpp"
#include "tcuNullRenderContext.hpp"
#include "egluNativeDisplay.hpp"
#include "eglwLibrary.hpp"
@@ -31,20 +32,6 @@
namespace null
{
-class NullGLContextFactory : public glu::ContextFactory
-{
-public:
- NullGLContextFactory (void)
- : glu::ContextFactory("null", "Null Render Context")
- {
- }
-
- glu::RenderContext* createContext (const glu::RenderConfig& config, const tcu::CommandLine&) const
- {
- return new RenderContext(config);
- }
-};
-
class NullEGLDisplay : public eglu::NativeDisplay
{
public:
diff --git a/framework/platform/null/tcuNullRenderContext.cpp b/framework/platform/null/tcuNullRenderContext.cpp
index f82267a..b91d2ee 100644
--- a/framework/platform/null/tcuNullRenderContext.cpp
+++ b/framework/platform/null/tcuNullRenderContext.cpp
@@ -92,6 +92,7 @@
string shadingLanguageVersion;
string extensions;
vector<string> extensionList;
+ vector<deUint32> compressedTextureList;
GLenum lastError;
@@ -146,7 +147,7 @@
addExtension("GL_OES_sample_shading");
addExtension("GL_OES_sample_variables");
addExtension("GL_OES_shader_multisample_interpolation");
- addExtension("GL_OES_shader_image_atomics");
+ addExtension("GL_OES_shader_image_atomic");
addExtension("GL_OES_texture_storage_multisample_2d_array");
addExtension("GL_KHR_blend_equation_advanced");
addExtension("GL_KHR_blend_equation_advanced_coherent");
@@ -156,6 +157,16 @@
addExtension("GL_EXT_tessellation_shader");
addExtension("GL_EXT_tessellation_point_size");
addExtension("GL_EXT_gpu_shader5");
+ addExtension("GL_EXT_shader_implicit_conversions");
+ addExtension("GL_EXT_texture_buffer");
+ addExtension("GL_EXT_texture_cube_map_array");
+ addExtension("GL_EXT_draw_buffers_indexed");
+ addExtension("GL_EXT_texture_sRGB_decode");
+ addExtension("GL_EXT_texture_border_clamp");
+ addExtension("GL_KHR_debug");
+ addExtension("GL_EXT_primitive_bounding_box");
+ addExtension("GL_ANDROID_extension_pack_es31a");
+ addExtension("GL_EXT_copy_image");
}
else if (glu::isContextTypeGLCore(ctxType) && ctxType.getMajorVersion() == 3)
{
@@ -171,7 +182,61 @@
throw tcu::NotSupportedError("Unsupported GL version", "", __FILE__, __LINE__);
if (isContextTypeES(ctxType))
+ {
addExtension("GL_EXT_color_buffer_float");
+ addExtension("GL_EXT_color_buffer_half_float");
+ }
+
+ // support compressed formats
+ {
+ static deUint32 compressedFormats[] =
+ {
+ GL_ETC1_RGB8_OES,
+ GL_COMPRESSED_R11_EAC,
+ GL_COMPRESSED_SIGNED_R11_EAC,
+ GL_COMPRESSED_RG11_EAC,
+ GL_COMPRESSED_SIGNED_RG11_EAC,
+ GL_COMPRESSED_RGB8_ETC2,
+ GL_COMPRESSED_SRGB8_ETC2,
+ GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ GL_COMPRESSED_RGBA8_ETC2_EAC,
+ GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
+ GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
+ GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
+ GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
+ GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
+ GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
+ GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
+ GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
+ GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
+ GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
+ GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
+ GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
+ GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
+ GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
+ GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
+ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
+ };
+
+ addExtension("GL_KHR_texture_compression_astc_hdr");
+ addExtension("GL_KHR_texture_compression_astc_ldr");
+ for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(compressedFormats); ++ndx)
+ compressedTextureList.push_back(compressedFormats[ndx]);
+ }
}
Context::~Context (void)
@@ -234,13 +299,52 @@
case GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS:
case GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS:
case GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS:
- *params = 16;
+ *params = 32;
+ break;
+
+ case GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS:
+ case GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS:
+ case GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS:
+ case GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS:
+ case GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS:
+ case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS:
+ *params = 8;
+ break;
+
+ case GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS:
+ case GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS:
+ case GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS:
+ case GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS:
+ case GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS:
+ case GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS:
+ *params = 8;
+ break;
+
+ case GL_MAX_SHADER_STORAGE_BLOCK_SIZE:
+ *params = 1u << 25;
+ break;
+
+ case GL_MAX_GEOMETRY_OUTPUT_VERTICES:
+ *params = 256;
+ break;
+
+ case GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
+ *params = 2048;
+ break;
+
+ case GL_MAX_GEOMETRY_SHADER_INVOCATIONS:
+ *params = 4;
+ break;
+
+ case GL_MAX_COLOR_TEXTURE_SAMPLES:
+ *params = 8;
break;
case GL_MAX_TEXTURE_SIZE:
case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
case GL_MAX_3D_TEXTURE_SIZE:
case GL_MAX_RENDERBUFFER_SIZE:
+ case GL_MAX_TEXTURE_BUFFER_SIZE:
*params = 2048;
break;
@@ -253,7 +357,11 @@
break;
case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
- *params = 0;
+ *params = (int)ctx->compressedTextureList.size();
+ break;
+
+ case GL_COMPRESSED_TEXTURE_FORMATS:
+ deMemcpy(params, &ctx->compressedTextureList[0], (int)ctx->compressedTextureList.size());
break;
case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
@@ -313,6 +421,29 @@
}
}
+GLW_APICALL void GLW_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
+{
+ static const int s_sampleCounts[] = { 16, 8, 4, 2, 1 };
+
+ DE_UNREF(internalformat);
+ DE_UNREF(target);
+
+ switch (pname)
+ {
+ case GL_NUM_SAMPLE_COUNTS:
+ if (bufSize >= 1)
+ *params = DE_LENGTH_OF_ARRAY(s_sampleCounts);
+ break;
+
+ case GL_SAMPLES:
+ deMemcpy(params, s_sampleCounts, de::min(bufSize, DE_LENGTH_OF_ARRAY(s_sampleCounts)));
+ break;
+
+ default:
+ break;
+ }
+}
+
GLW_APICALL const glw::GLubyte* GLW_APIENTRY glGetString (GLenum name)
{
Context* const ctx = getCurrentContext();
@@ -579,6 +710,12 @@
ctx->pixelPackBufferBufferBinding = 0;
}
+GLW_APICALL GLint GLW_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name)
+{
+ DE_UNREF(program);
+ return (GLint)(deStringHash(name) & 0x7FFFFFFF);
+}
+
void initFunctions (glw::Functions* gl)
{
# include "tcuNullRenderContextInitFuncs.inl"
diff --git a/framework/platform/null/tcuNullRenderContextFuncs.inl b/framework/platform/null/tcuNullRenderContextFuncs.inl
index 09144e8..f3467e8 100644
--- a/framework/platform/null/tcuNullRenderContextFuncs.inl
+++ b/framework/platform/null/tcuNullRenderContextFuncs.inl
@@ -1591,14 +1591,6 @@
}
-GLW_APICALL GLint GLW_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name)
-{
- DE_UNREF(program);
- DE_UNREF(name);
-
- return (GLint)0;
-}
-
GLW_APICALL void GLW_APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data)
{
DE_UNREF(target);
@@ -1781,16 +1773,6 @@
}
-GLW_APICALL void GLW_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
-{
- DE_UNREF(target);
- DE_UNREF(internalformat);
- DE_UNREF(pname);
- DE_UNREF(bufSize);
- DE_UNREF(params);
-
-}
-
GLW_APICALL void GLW_APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val)
{
DE_UNREF(pname);
diff --git a/framework/qphelper/qpTestLog.c b/framework/qphelper/qpTestLog.c
index 2a80e48..5bd6301 100644
--- a/framework/qphelper/qpTestLog.c
+++ b/framework/qphelper/qpTestLog.c
@@ -279,12 +279,12 @@
deSprintf(&buf[0], 32, "%lld", (long long int)val);
}
-DE_INLINE void floatToString (float value, char* buf, int bufSize)
+DE_INLINE void floatToString (float value, char* buf, size_t bufSize)
{
deSprintf(buf, bufSize, "%f", value);
}
-DE_INLINE void doubleToString (double value, char* buf, int bufSize)
+DE_INLINE void doubleToString (double value, char* buf, size_t bufSize)
{
deSprintf(buf, bufSize, "%f", value);
}
@@ -627,8 +627,8 @@
typedef struct Buffer_s
{
- int capacity;
- int size;
+ size_t capacity;
+ size_t size;
deUint8* data;
} Buffer;
@@ -645,12 +645,12 @@
Buffer_init(buffer);
}
-deBool Buffer_resize (Buffer* buffer, int newSize)
+deBool Buffer_resize (Buffer* buffer, size_t newSize)
{
/* Grow buffer if necessary. */
if (newSize > buffer->capacity)
{
- int newCapacity = deAlign32(deMax32(2*buffer->capacity, newSize), 512);
+ size_t newCapacity = (size_t)deAlign32(deMax32(2*(int)buffer->capacity, (int)newSize), 512);
deUint8* newData = (deUint8*)deMalloc(newCapacity);
if (!newData)
return DE_FALSE;
@@ -665,9 +665,9 @@
return DE_TRUE;
}
-deBool Buffer_append (Buffer* buffer, const deUint8* data, int numBytes)
+deBool Buffer_append (Buffer* buffer, const deUint8* data, size_t numBytes)
{
- int offset = buffer->size;
+ size_t offset = buffer->size;
if (!Buffer_resize(buffer, buffer->size + numBytes))
return DE_FALSE;
@@ -681,7 +681,7 @@
void pngWriteData (png_structp png, png_bytep dataPtr, png_size_t numBytes)
{
Buffer* buffer = (Buffer*)png_get_io_ptr(png);
- if (!Buffer_append(buffer, (const deUint8*)dataPtr, (int)numBytes))
+ if (!Buffer_append(buffer, (const deUint8*)dataPtr, numBytes))
png_error(png, "unable to resize PNG write buffer!");
}
@@ -696,7 +696,7 @@
if (setjmp(png_jmpbuf(png)) == 0)
{
/* Write data. */
- png_set_IHDR(png, info, width, height,
+ png_set_IHDR(png, info, (png_uint_32)width, (png_uint_32)height,
8,
colorFormat,
PNG_INTERLACE_NONE,
@@ -725,7 +725,7 @@
DE_ASSERT(imageFormat == QP_IMAGE_FORMAT_RGB888 || imageFormat == QP_IMAGE_FORMAT_RGBA8888);
/* Allocate & set row pointers. */
- rowPointers = (png_byte**)deMalloc(height * sizeof(png_byte*));
+ rowPointers = (png_byte**)deMalloc((size_t)height * sizeof(png_byte*));
if (!rowPointers)
return DE_FALSE;
@@ -845,7 +845,7 @@
int numAttribs = 0;
Buffer compressedBuffer;
const void* writeDataPtr = DE_NULL;
- int writeDataBytes = -1;
+ size_t writeDataBytes = ~(size_t)0;
DE_ASSERT(log && name);
DE_ASSERT(deInRange32(width, 1, 16384));
@@ -899,11 +899,11 @@
else
{
/* Need to re-pack pixels. */
- if (Buffer_resize(&compressedBuffer, packedStride*height))
+ if (Buffer_resize(&compressedBuffer, (size_t)(packedStride*height)))
{
int row;
for (row = 0; row < height; row++)
- memcpy(&compressedBuffer.data[packedStride*row], &((const deUint8*)data)[row*stride], pixelSize*width);
+ memcpy(&compressedBuffer.data[packedStride*row], &((const deUint8*)data)[row*stride], (size_t)(pixelSize*width));
}
else
{
@@ -913,7 +913,7 @@
}
}
- writeDataBytes = packedStride*height;
+ writeDataBytes = (size_t)(packedStride*height);
break;
}
diff --git a/framework/qphelper/qpXmlWriter.c b/framework/qphelper/qpXmlWriter.c
index 5850b41..6921dab 100644
--- a/framework/qphelper/qpXmlWriter.c
+++ b/framework/qphelper/qpXmlWriter.c
@@ -250,7 +250,7 @@
return DE_TRUE;
}
-deBool qpXmlWriter_writeBase64 (qpXmlWriter* writer, const deUint8* data, int numBytes)
+deBool qpXmlWriter_writeBase64 (qpXmlWriter* writer, const deUint8* data, size_t numBytes)
{
static const char s_base64Table[64] =
{
@@ -262,7 +262,7 @@
};
int numWritten = 0;
- int srcNdx = 0;
+ size_t srcNdx = 0;
deBool writeIndent = DE_TRUE;
const char* indentStr = getIndentStr(writer->xmlElementDepth);
@@ -274,7 +274,7 @@
/* Loop all input chars. */
while (srcNdx < numBytes)
{
- int numRead = deMin32(3, numBytes - srcNdx);
+ size_t numRead = (size_t)deMin32(3, (int)(numBytes - srcNdx));
deUint8 s0 = data[srcNdx];
deUint8 s1 = (numRead >= 2) ? data[srcNdx+1] : 0;
deUint8 s2 = (numRead >= 3) ? data[srcNdx+2] : 0;
diff --git a/framework/qphelper/qpXmlWriter.h b/framework/qphelper/qpXmlWriter.h
index 304161e..ebba428 100644
--- a/framework/qphelper/qpXmlWriter.h
+++ b/framework/qphelper/qpXmlWriter.h
@@ -146,7 +146,7 @@
* \param numBytes Length of data in bytes
* \return true on success, false on error
*//*--------------------------------------------------------------------*/
-deBool qpXmlWriter_writeBase64 (qpXmlWriter* writer, const deUint8* data, int numBytes);
+deBool qpXmlWriter_writeBase64 (qpXmlWriter* writer, const deUint8* data, size_t numBytes);
/*--------------------------------------------------------------------*//*!
* \brief Convenience function for writing XML element
diff --git a/framework/randomshaders/rsgBinaryOps.cpp b/framework/randomshaders/rsgBinaryOps.cpp
index 77cacea..465ec16 100644
--- a/framework/randomshaders/rsgBinaryOps.cpp
+++ b/framework/randomshaders/rsgBinaryOps.cpp
@@ -57,14 +57,14 @@
if (m_rightValueExpr == DE_NULL)
{
state.pushPrecedence(rightPrec);
- m_rightValueExpr = Expression::createRandom(state, m_rightValueRange);
+ m_rightValueExpr = Expression::createRandom(state, m_rightValueRange.asAccess());
state.popPrecedence();
return m_rightValueExpr;
}
else if (m_leftValueExpr == DE_NULL)
{
state.pushPrecedence(leftPrec);
- m_leftValueExpr = Expression::createRandom(state, m_leftValueRange);
+ m_leftValueExpr = Expression::createRandom(state, m_leftValueRange.asAccess());
state.popPrecedence();
return m_leftValueExpr;
}
@@ -239,13 +239,13 @@
bMax = scale;
for (int i = 0; i < 5; i++)
{
- if (de::inBounds(aMin*(scale-i*scaleStep), dstMin, dstMax) &&
- de::inBounds(aMax*(scale-i*scaleStep), dstMin, dstMax))
- bMin = scale-i*scaleStep;
+ if (de::inBounds(aMin*(scale-(float)i*scaleStep), dstMin, dstMax) &&
+ de::inBounds(aMax*(scale-(float)i*scaleStep), dstMin, dstMax))
+ bMin = scale-(float)i*scaleStep;
- if (de::inBounds(aMin*(scale+i*scaleStep), dstMin, dstMax) &&
- de::inBounds(aMax*(scale+i*scaleStep), dstMin, dstMax))
- bMax = scale+i*scaleStep;
+ if (de::inBounds(aMin*(scale+(float)i*scaleStep), dstMin, dstMax) &&
+ de::inBounds(aMax*(scale+(float)i*scaleStep), dstMin, dstMax))
+ bMax = scale+(float)i*scaleStep;
}
// Negative scale?
diff --git a/framework/randomshaders/rsgBuiltinFunctions.hpp b/framework/randomshaders/rsgBuiltinFunctions.hpp
index 1a6be3c..6563e8f 100644
--- a/framework/randomshaders/rsgBuiltinFunctions.hpp
+++ b/framework/randomshaders/rsgBuiltinFunctions.hpp
@@ -87,7 +87,7 @@
if (m_child)
return DE_NULL;
- m_child = Expression::createRandom(state, m_inValueRange);
+ m_child = Expression::createRandom(state, m_inValueRange.asAccess());
return m_child;
}
diff --git a/framework/randomshaders/rsgExpression.cpp b/framework/randomshaders/rsgExpression.cpp
index b0184d9..35291e3 100644
--- a/framework/randomshaders/rsgExpression.cpp
+++ b/framework/randomshaders/rsgExpression.cpp
@@ -206,8 +206,8 @@
int rangeLen = rnd.getInt(0, maxSteps);
int minStep = rnd.getInt(0, maxSteps-rangeLen);
- float minVal = minFloatVal + step*minStep;
- float maxVal = minVal + step*rangeLen;
+ float minVal = minFloatVal + step*(float)minStep;
+ float maxVal = minVal + step*(float)rangeLen;
valueRange.getMin().component(ndx).asFloat() = minVal;
valueRange.getMax().component(ndx).asFloat() = maxVal;
@@ -377,7 +377,7 @@
int numSteps = (int)((maxVal-minVal)/step) + 1;
- float value = deFloatClamp(minVal + step*state.getRandom().getInt(0, numSteps), minVal, maxVal);
+ const float value = deFloatClamp(minVal + step*(float)state.getRandom().getInt(0, numSteps), minVal, maxVal);
ExecValueAccess access = m_value.getValue(VariableType::getScalarType(VariableType::TYPE_FLOAT));
for (int ndx = 0; ndx < EXEC_VEC_WIDTH; ndx++)
@@ -454,7 +454,7 @@
int rangeLength = maxVal - minVal;
DE_ASSERT(rangeLength >= 0);
- return deFloatMax(0.1f, 1.0f - rangeLength/4.0f);
+ return deFloatMax(0.1f, 1.0f - (float)rangeLength/4.0f);
}
else if (type.isVoid())
return unusedValueWeight;
@@ -838,12 +838,12 @@
computeRandomValueRangeForInfElements(state, m_valueRange.asAccess());
- DE_ASSERT(state.getVariableManager().hasEntry(IsWritableIntersectingEntry(m_valueRange)));
+ DE_ASSERT(state.getVariableManager().hasEntry(IsWritableIntersectingEntry(m_valueRange.asAccess())));
}
}
- IsWritableIntersectingEntry::Iterator first = state.getVariableManager().getBegin(IsWritableIntersectingEntry(m_valueRange));
- IsWritableIntersectingEntry::Iterator end = state.getVariableManager().getEnd(IsWritableIntersectingEntry(m_valueRange));
+ IsWritableIntersectingEntry::Iterator first = state.getVariableManager().getBegin(IsWritableIntersectingEntry(m_valueRange.asAccess()));
+ IsWritableIntersectingEntry::Iterator end = state.getVariableManager().getEnd(IsWritableIntersectingEntry(m_valueRange.asAccess()));
bool possiblyCreateVar = canAllocateVariable(state, m_valueRange.getType()) &&
(first == end || getWeightedBool(state.getRandom(), 0.5f));
@@ -858,7 +858,7 @@
bool supersetExists = false;
for (IsWritableIntersectingEntry::Iterator i = first; i != end; i++)
{
- if ((*i)->getValueRange().isSupersetOf(m_valueRange))
+ if ((*i)->getValueRange().isSupersetOf(m_valueRange.asAccess()))
{
supersetExists = true;
break;
@@ -871,7 +871,7 @@
// \todo [2011-02-03 pyry] Use some heuristics to select the range?
ConstValueRangeAccess selectedRange = state.getRandom().choose<const ValueEntry*>(first, end)->getValueRange();
- ValueRange::computeIntersection(m_valueRange, m_valueRange, selectedRange);
+ ValueRange::computeIntersection(m_valueRange.asAccess(), m_valueRange.asAccess(), selectedRange);
}
}
}
@@ -913,13 +913,13 @@
// - variable valuerange is made unbound
// - R-value is generated
// - R-values in L-value are generated
- m_lvalueExpr = Expression::createRandomLValue(state, m_valueRange);
+ m_lvalueExpr = Expression::createRandomLValue(state, m_valueRange.asAccess());
return m_lvalueExpr;
}
else if (m_rvalueExpr == DE_NULL)
{
// Construct value expr
- m_rvalueExpr = Expression::createRandom(state, m_valueRange);
+ m_rvalueExpr = Expression::createRandom(state, m_valueRange.asAccess());
return m_rvalueExpr;
}
else
@@ -1046,14 +1046,14 @@
continue;
// Intersection to entry value range length ratio.
- int intersectionMin = deMax32(entryMin, readMin);
- int intersectionMax = deMin32(entryMax, readMax);
- int entryRangeLen = entryMax - entryMin;
- int readRangeLen = readMax - readMin;
- int intersectionLen = intersectionMax - intersectionMin;
- float entryRatio = (entryRangeLen > 0) ? ((float)intersectionLen / (float)entryRangeLen) : 1.0f;
- float readRatio = (readRangeLen > 0) ? ((float)intersectionLen / (float)readRangeLen) : 1.0f;
- float elementWeight = 0.5f*readRatio + 0.5f*entryRatio;
+ int intersectionMin = deMax32(entryMin, readMin);
+ int intersectionMax = deMin32(entryMax, readMax);
+ deInt64 entryRangeLen = (deInt64)entryMax - (deInt64)entryMin;
+ deInt64 readRangeLen = (deInt64)readMax - (deInt64)readMin;
+ deInt64 intersectionLen = (deInt64)intersectionMax - (deInt64)intersectionMin;
+ float entryRatio = (entryRangeLen > 0) ? ((float)intersectionLen / (float)entryRangeLen) : 1.0f;
+ float readRatio = (readRangeLen > 0) ? ((float)intersectionLen / (float)readRangeLen) : 1.0f;
+ float elementWeight = 0.5f*readRatio + 0.5f*entryRatio;
weight = combineWeight(weight, elementWeight);
}
@@ -1094,7 +1094,7 @@
ValueRange newVarRange(computeRandomType(state, maxScalars));
computeRandomValueRange(state, newVarRange.asAccess());
- m_variable = allocateNewVariable(state, newVarRange);
+ m_variable = allocateNewVariable(state, newVarRange.asAccess());
}
else
{
@@ -1135,7 +1135,7 @@
// Compute intersection
ValueRange intersection(m_variable->getType());
ValueRange::computeIntersection(intersection, entry->getValueRange(), valueRange);
- state.getVariableManager().setValue(m_variable, intersection);
+ state.getVariableManager().setValue(m_variable, intersection.asAccess());
}
}
}
@@ -1202,7 +1202,7 @@
ValueRange infRange(m_variable->getType());
setInfiniteRange(infRange);
- state.getVariableManager().setValue(m_variable, infRange);
+ state.getVariableManager().setValue(m_variable, infRange.asAccess());
}
}
@@ -1236,7 +1236,7 @@
{
if (m_child == DE_NULL)
{
- m_child = Expression::createRandom(state, m_valueRange);
+ m_child = Expression::createRandom(state, m_valueRange.asAccess());
return m_child;
}
else
@@ -1326,7 +1326,7 @@
// Create child.
state.pushPrecedence(swizzlePrecedence);
- m_child = Expression::createRandom(state, inValueRange);
+ m_child = Expression::createRandom(state, inValueRange.asAccess());
state.popPrecedence();
return m_child;
@@ -1486,7 +1486,7 @@
ValueRange lodRange(VariableType(VariableType::TYPE_FLOAT, 1));
setInfiniteRange(lodRange); // Any value is valid.
- m_lodBiasExpr = Expression::createRandom(state, lodRange);
+ m_lodBiasExpr = Expression::createRandom(state, lodRange.asAccess());
return m_lodBiasExpr;
}
@@ -1514,7 +1514,7 @@
}
}
- m_coordExpr = Expression::createRandom(state, coordRange);
+ m_coordExpr = Expression::createRandom(state, coordRange.asAccess());
}
else
{
@@ -1532,7 +1532,7 @@
coordRange.getMax().component(2) = neg ? -0.25f : 4.0f;
}
- m_coordExpr = Expression::createRandom(state, coordRange);
+ m_coordExpr = Expression::createRandom(state, coordRange.asAccess());
}
DE_ASSERT(m_coordExpr);
@@ -1613,7 +1613,7 @@
texOutputRange.getMax().component(ndx) = 1.0f;
}
- if (!valueRange.isSupersetOf(texOutputRange))
+ if (!valueRange.isSupersetOf(texOutputRange.asAccess()))
return 0.0f;
return state.getShaderParameters().texLookupBaseWeight;
diff --git a/framework/randomshaders/rsgFunctionGenerator.cpp b/framework/randomshaders/rsgFunctionGenerator.cpp
index bdd09c0..6d359da 100644
--- a/framework/randomshaders/rsgFunctionGenerator.cpp
+++ b/framework/randomshaders/rsgFunctionGenerator.cpp
@@ -75,8 +75,8 @@
// Remove value entry from this scope. After this entry ptr is invalid.
m_state.getVariableManager().removeValueFromCurrentScope(variable);
- if (!isUndefinedValueRange(valueRange))
- m_function.getBody().addChild(new AssignStatement(m_state, variable, valueRange));
+ if (!isUndefinedValueRange(valueRange.asAccess()))
+ m_function.getBody().addChild(new AssignStatement(m_state, variable, valueRange.asAccess()));
}
}
diff --git a/framework/randomshaders/rsgProgramExecutor.cpp b/framework/randomshaders/rsgProgramExecutor.cpp
index a3a3225..cfc3d81 100644
--- a/framework/randomshaders/rsgProgramExecutor.cpp
+++ b/framework/randomshaders/rsgProgramExecutor.cpp
@@ -195,8 +195,8 @@
inline tcu::Vec2 computeGridCellWeights (float cellWidth, float cellHeight, int x, int y)
{
- float gx = (x + 0.5f) / cellWidth;
- float gy = (y + 0.5f) / cellHeight;
+ float gx = ((float)x + 0.5f) / cellWidth;
+ float gy = ((float)y + 0.5f) / cellHeight;
return tcu::Vec2(deFloatFrac(gx), deFloatFrac(gy));
}
diff --git a/framework/randomshaders/rsgShaderGenerator.cpp b/framework/randomshaders/rsgShaderGenerator.cpp
index 737e6fa..7af9623 100644
--- a/framework/randomshaders/rsgShaderGenerator.cpp
+++ b/framework/randomshaders/rsgShaderGenerator.cpp
@@ -211,7 +211,7 @@
fragColorVar->setLayoutLocation(0); // Bind color output to location 0 (applies to GLSL ES 3.0 onwards).
- m_state.getVariableManager().setValue(fragColorVar, valueRange);
+ m_state.getVariableManager().setValue(fragColorVar, valueRange.asAccess());
}
}
@@ -259,7 +259,7 @@
valueRange.getMin() = tcu::Vec4(-1.0f, -1.0f, 0.0f, 1.0f);
valueRange.getMax() = tcu::Vec4( 1.0f, 1.0f, 0.0f, 1.0f);
- m_state.getVariableManager().setValue(qpPosVariable, valueRange); // \todo [2011-05-24 pyry] No expression should be able to use gl_Position or dEQP_Position..
+ m_state.getVariableManager().setValue(qpPosVariable, valueRange.asAccess()); // \todo [2011-05-24 pyry] No expression should be able to use gl_Position or dEQP_Position..
createAssignment(main.getBody(), glPosVariable, qpPosVariable);
}
diff --git a/framework/randomshaders/rsgUtils.cpp b/framework/randomshaders/rsgUtils.cpp
index 2820fb7..e7e37f8 100644
--- a/framework/randomshaders/rsgUtils.cpp
+++ b/framework/randomshaders/rsgUtils.cpp
@@ -225,8 +225,8 @@
int rangeLen = rnd.getInt(0, maxSteps);
int minStep = rnd.getInt(0, maxSteps-rangeLen);
- float minVal = minFloatVal + step*minStep;
- float maxVal = minVal + step*rangeLen;
+ float minVal = minFloatVal + step*(float)minStep;
+ float maxVal = minVal + step*(float)rangeLen;
valueRange.getMin().component(ndx).asFloat() = minVal;
valueRange.getMax().component(ndx).asFloat() = maxVal;
diff --git a/framework/randomshaders/rsgUtils.hpp b/framework/randomshaders/rsgUtils.hpp
index 1ca0757..d659586 100644
--- a/framework/randomshaders/rsgUtils.hpp
+++ b/framework/randomshaders/rsgUtils.hpp
@@ -53,7 +53,7 @@
inline float getQuantizedFloat (de::Random& rnd, float min, float max, float step)
{
int numSteps = (int)((max-min)/step);
- return min + step*rnd.getInt(0, numSteps);
+ return min + step * (float)rnd.getInt(0, numSteps);
}
inline bool quantizeFloatRange (float& min, float& max)
diff --git a/framework/randomshaders/rsgVariableManager.cpp b/framework/randomshaders/rsgVariableManager.cpp
index f8f7041..d2a2fee 100644
--- a/framework/randomshaders/rsgVariableManager.cpp
+++ b/framework/randomshaders/rsgVariableManager.cpp
@@ -477,7 +477,7 @@
if (!newTopScope.findEntry(var))
newTopScope.allocate(var);
- newTopScope.setValue(var, intersectedValue);
+ newTopScope.setValue(var, intersectedValue.asAccess());
// Add entry from top scope to cache.
m_entryCache.push_back(newTopScope.findEntry(var));
diff --git a/framework/referencerenderer/rrFragmentOperations.cpp b/framework/referencerenderer/rrFragmentOperations.cpp
index 2994b82..6d0f1f9 100644
--- a/framework/referencerenderer/rrFragmentOperations.cpp
+++ b/framework/referencerenderer/rrFragmentOperations.cpp
@@ -763,6 +763,10 @@
DE_ASSERT((!hasDepth || colorBuffer.getHeight() == depthBuffer.getHeight()) && (!hasStencil || colorBuffer.getHeight() == stencilBuffer.getHeight()));
DE_ASSERT((!hasDepth || colorBuffer.getDepth() == depthBuffer.getDepth()) && (!hasStencil || colorBuffer.getDepth() == stencilBuffer.getDepth()));
+ // Combined formats must be separated beforehand
+ DE_ASSERT(!hasDepth || (!tcu::isCombinedDepthStencilType(depthBuffer.getFormat().type) && depthBuffer.getFormat().order == tcu::TextureFormat::D));
+ DE_ASSERT(!hasStencil || (!tcu::isCombinedDepthStencilType(stencilBuffer.getFormat().type) && stencilBuffer.getFormat().order == tcu::TextureFormat::S));
+
int numSamplesPerFragment = colorBuffer.getWidth();
int totalNumSamples = numFragments*numSamplesPerFragment;
int numSampleGroups = (totalNumSamples - 1) / SAMPLE_REGISTER_SIZE + 1; // \note totalNumSamples/SAMPLE_REGISTER_SIZE rounded up.
diff --git a/framework/referencerenderer/rrMultisamplePixelBufferAccess.cpp b/framework/referencerenderer/rrMultisamplePixelBufferAccess.cpp
index e7ab014..6777048 100644
--- a/framework/referencerenderer/rrMultisamplePixelBufferAccess.cpp
+++ b/framework/referencerenderer/rrMultisamplePixelBufferAccess.cpp
@@ -138,6 +138,80 @@
}
}
+void resolveMultisampleDepthBuffer (const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src)
+{
+ DE_ASSERT(dst.getWidth() == src.raw().getHeight());
+ DE_ASSERT(dst.getHeight() == src.raw().getDepth());
+
+ const tcu::ConstPixelBufferAccess effectiveSrc = tcu::getEffectiveDepthStencilAccess(src.raw(), tcu::Sampler::MODE_DEPTH);
+ const tcu::PixelBufferAccess effectiveDst = tcu::getEffectiveDepthStencilAccess(dst, tcu::Sampler::MODE_DEPTH);
+
+ if (src.getNumSamples() == 1)
+ {
+ // fast-path for non-multisampled cases
+ tcu::copy(effectiveDst, MultisampleConstPixelBufferAccess::fromMultisampleAccess(effectiveSrc).toSinglesampleAccess());
+ }
+ else
+ {
+ const float numSamplesInv = 1.0f / (float)src.getNumSamples();
+
+ for (int y = 0; y < dst.getHeight(); y++)
+ for (int x = 0; x < dst.getWidth(); x++)
+ {
+ float sum = 0.0f;
+ for (int s = 0; s < src.getNumSamples(); s++)
+ sum += effectiveSrc.getPixDepth(s, x, y);
+
+ effectiveDst.setPixDepth(sum*numSamplesInv, x, y);
+ }
+ }
+}
+
+void resolveMultisampleStencilBuffer (const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src)
+{
+ DE_ASSERT(dst.getWidth() == src.raw().getHeight());
+ DE_ASSERT(dst.getHeight() == src.raw().getDepth());
+
+ const tcu::ConstPixelBufferAccess effectiveSrc = tcu::getEffectiveDepthStencilAccess(src.raw(), tcu::Sampler::MODE_STENCIL);
+ const tcu::PixelBufferAccess effectiveDst = tcu::getEffectiveDepthStencilAccess(dst, tcu::Sampler::MODE_STENCIL);
+
+ if (src.getNumSamples() == 1)
+ {
+ // fast-path for non-multisampled cases
+ tcu::copy(effectiveDst, MultisampleConstPixelBufferAccess::fromMultisampleAccess(effectiveSrc).toSinglesampleAccess());
+ }
+ else
+ {
+ // Resolve by selecting one
+ for (int y = 0; y < dst.getHeight(); y++)
+ for (int x = 0; x < dst.getWidth(); x++)
+ effectiveDst.setPixStencil(effectiveSrc.getPixStencil(0, x, y), x, y);
+ }
+}
+
+void resolveMultisampleBuffer (const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src)
+{
+ switch (src.raw().getFormat().order)
+ {
+ case tcu::TextureFormat::D:
+ resolveMultisampleDepthBuffer(dst, src);
+ return;
+
+ case tcu::TextureFormat::S:
+ resolveMultisampleStencilBuffer(dst, src);
+ return;
+
+ case tcu::TextureFormat::DS:
+ resolveMultisampleDepthBuffer(dst, src);
+ resolveMultisampleStencilBuffer(dst, src);
+ return;
+
+ default:
+ resolveMultisampleColorBuffer(dst, src);
+ return;
+ }
+}
+
tcu::Vec4 resolveMultisamplePixel (const MultisampleConstPixelBufferAccess& access, int x, int y)
{
tcu::Vec4 sum;
diff --git a/framework/referencerenderer/rrMultisamplePixelBufferAccess.hpp b/framework/referencerenderer/rrMultisamplePixelBufferAccess.hpp
index 975ef80..517c1f7 100644
--- a/framework/referencerenderer/rrMultisamplePixelBufferAccess.hpp
+++ b/framework/referencerenderer/rrMultisamplePixelBufferAccess.hpp
@@ -90,6 +90,9 @@
MultisampleConstPixelBufferAccess getSubregion (const MultisampleConstPixelBufferAccess& access, int x, int y, int width, int height);
void resolveMultisampleColorBuffer (const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
+void resolveMultisampleDepthBuffer (const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
+void resolveMultisampleStencilBuffer (const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
+void resolveMultisampleBuffer (const tcu::PixelBufferAccess& dst, const MultisampleConstPixelBufferAccess& src);
tcu::Vec4 resolveMultisamplePixel (const MultisampleConstPixelBufferAccess& access, int x, int y);
void clear (const MultisamplePixelBufferAccess& access, const tcu::Vec4& color);
diff --git a/framework/referencerenderer/rrRasterizer.hpp b/framework/referencerenderer/rrRasterizer.hpp
index b384a8d..dee7c15 100644
--- a/framework/referencerenderer/rrRasterizer.hpp
+++ b/framework/referencerenderer/rrRasterizer.hpp
@@ -42,7 +42,7 @@
//! Get coverage bit value.
inline deUint64 getCoverageBit (int numSamples, int x, int y, int sampleNdx)
{
- const int numBits = sizeof(deUint64)*8;
+ const int numBits = (int)sizeof(deUint64)*8;
const int maxSamples = numBits/4;
DE_STATIC_ASSERT(maxSamples >= RASTERIZER_MAX_SAMPLES_PER_FRAGMENT);
DE_ASSERT(de::inRange(numSamples, 1, maxSamples) && de::inBounds(x, 0, 2) && de::inBounds(y, 0, 2));
diff --git a/framework/referencerenderer/rrRenderer.cpp b/framework/referencerenderer/rrRenderer.cpp
index dc6ec31..943d8c5 100644
--- a/framework/referencerenderer/rrRenderer.cpp
+++ b/framework/referencerenderer/rrRenderer.cpp
@@ -1032,7 +1032,7 @@
const float* depthValues,
std::vector<Fragment>& fragmentBuffer)
{
- const int numSamples = renderTarget.colorBuffers[0].getNumSamples();
+ const int numSamples = renderTarget.getNumSamples();
const size_t numOutputs = program.fragmentShader->getOutputs().size();
FragmentProcessor fragProcessor;
@@ -1090,7 +1090,7 @@
}
// Execute per-fragment ops and write
- fragProcessor.render(renderTarget.colorBuffers[outputNdx], renderTarget.depthBuffer, renderTarget.stencilBuffer, &fragmentBuffer[0], fragCount, facetype, fragOpsState);
+ fragProcessor.render(renderTarget.getColorBuffer((int)outputNdx), renderTarget.getDepthBuffer(), renderTarget.getStencilBuffer(), &fragmentBuffer[0], fragCount, facetype, fragOpsState);
}
}
}
@@ -1102,7 +1102,7 @@
const tcu::IVec4& renderTargetRect,
RasterizationInternalBuffers& buffers)
{
- const int numSamples = renderTarget.colorBuffers[0].getNumSamples();
+ const int numSamples = renderTarget.getNumSamples();
const float depthClampMin = de::min(state.viewport.zn, state.viewport.zf);
const float depthClampMax = de::max(state.viewport.zn, state.viewport.zf);
TriangleRasterizer rasterizer (renderTargetRect, numSamples, state.rasterization);
@@ -1123,7 +1123,7 @@
if (buffers.fragmentDepthBuffer && state.fragOps.polygonOffsetEnabled)
{
const float maximumDepthSlope = findPrimitiveMaximumDepthSlope(triangle);
- const float minimumResolvableDifference = findPrimitiveMinimumResolvableDifference(triangle, renderTarget.depthBuffer);
+ const float minimumResolvableDifference = findPrimitiveMinimumResolvableDifference(triangle, renderTarget.getDepthBuffer());
depthOffset = maximumDepthSlope * state.fragOps.polygonOffsetFactor + minimumResolvableDifference * state.fragOps.polygonOffsetUnits;
}
@@ -1170,7 +1170,7 @@
const tcu::IVec4& renderTargetRect,
RasterizationInternalBuffers& buffers)
{
- const int numSamples = renderTarget.colorBuffers[0].getNumSamples();
+ const int numSamples = renderTarget.getNumSamples();
const float depthClampMin = de::min(state.viewport.zn, state.viewport.zf);
const float depthClampMax = de::max(state.viewport.zn, state.viewport.zf);
const bool msaa = numSamples > 1;
@@ -1223,7 +1223,7 @@
const tcu::IVec4& renderTargetRect,
RasterizationInternalBuffers& buffers)
{
- const int numSamples = renderTarget.colorBuffers[0].getNumSamples();
+ const int numSamples = renderTarget.getNumSamples();
const float depthClampMin = de::min(state.viewport.zn, state.viewport.zf);
const float depthClampMax = de::max(state.viewport.zn, state.viewport.zf);
TriangleRasterizer rasterizer1 (renderTargetRect, numSamples, state.rasterization);
@@ -1287,12 +1287,12 @@
const Program& program,
const ContainerType& list)
{
- const int numSamples = renderTarget.colorBuffers[0].getNumSamples();
+ const int numSamples = renderTarget.getNumSamples();
const int numFragmentOutputs = (int)program.fragmentShader->getOutputs().size();
const size_t maxFragmentPackets = 128;
const tcu::IVec4 viewportRect = tcu::IVec4(state.viewport.rect.left, state.viewport.rect.bottom, state.viewport.rect.width, state.viewport.rect.height);
- const tcu::IVec4 bufferRect = getBufferSize(renderTarget.colorBuffers[0]);
+ const tcu::IVec4 bufferRect = getBufferSize(renderTarget.getColorBuffer(0));
const tcu::IVec4 renderTargetRect = rectIntersection(viewportRect, bufferRect);
// shared buffers for all primitives
@@ -1305,7 +1305,7 @@
RasterizationInternalBuffers buffers;
// calculate depth only if we have a depth buffer
- if (!isEmpty(renderTarget.depthBuffer))
+ if (!isEmpty(renderTarget.getDepthBuffer()))
{
depthValues.resize(maxFragmentPackets*4*numSamples);
depthBufferPointer = &depthValues[0];
@@ -1569,23 +1569,23 @@
return false;
// There is a fragment output sink for each output?
- if ((size_t)command.renderTarget.numColorBuffers < command.program.fragmentShader->getOutputs().size())
+ if ((size_t)command.renderTarget.getNumColorBuffers() < command.program.fragmentShader->getOutputs().size())
return false;
// All destination buffers should have same number of samples and same size
- for (int outputNdx = 0; outputNdx < command.renderTarget.numColorBuffers; ++outputNdx)
+ for (int outputNdx = 0; outputNdx < command.renderTarget.getNumColorBuffers(); ++outputNdx)
{
- if (getBufferSize(command.renderTarget.colorBuffers[0]) != getBufferSize(command.renderTarget.colorBuffers[outputNdx]))
+ if (getBufferSize(command.renderTarget.getColorBuffer(0)) != getBufferSize(command.renderTarget.getColorBuffer(outputNdx)))
return false;
- if (command.renderTarget.colorBuffers[0].getNumSamples() != command.renderTarget.colorBuffers[outputNdx].getNumSamples())
+ if (command.renderTarget.getNumSamples() != command.renderTarget.getColorBuffer(outputNdx).getNumSamples())
return false;
}
// All destination buffers should have same basic type as matching fragment output
for (size_t varyingNdx = 0; varyingNdx < command.program.fragmentShader->getOutputs().size(); ++varyingNdx)
{
- const tcu::TextureChannelClass colorbufferClass = tcu::getTextureChannelClass(command.renderTarget.colorBuffers[varyingNdx].raw().getFormat().type);
+ const tcu::TextureChannelClass colorbufferClass = tcu::getTextureChannelClass(command.renderTarget.getColorBuffer((int)varyingNdx).raw().getFormat().type);
const GenericVecType colorType = (colorbufferClass == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER) ? (rr::GENERICVECTYPE_INT32) : ((colorbufferClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER) ? (rr::GENERICVECTYPE_UINT32) : (rr::GENERICVECTYPE_FLOAT));
if (command.program.fragmentShader->getOutputs()[varyingNdx].type != colorType)
@@ -1643,6 +1643,22 @@
} // anonymous
+RenderTarget::RenderTarget (const MultisamplePixelBufferAccess& colorMultisampleBuffer,
+ const MultisamplePixelBufferAccess& depthMultisampleBuffer,
+ const MultisamplePixelBufferAccess& stencilMultisampleBuffer)
+ : m_numColorBuffers (1)
+ , m_depthBuffer (MultisamplePixelBufferAccess::fromMultisampleAccess(tcu::getEffectiveDepthStencilAccess(depthMultisampleBuffer.raw(), tcu::Sampler::MODE_DEPTH)))
+ , m_stencilBuffer (MultisamplePixelBufferAccess::fromMultisampleAccess(tcu::getEffectiveDepthStencilAccess(stencilMultisampleBuffer.raw(), tcu::Sampler::MODE_STENCIL)))
+{
+ m_colorBuffers[0] = colorMultisampleBuffer;
+}
+
+int RenderTarget::getNumSamples (void) const
+{
+ DE_ASSERT(m_numColorBuffers > 0);
+ return m_colorBuffers[0].getNumSamples();
+}
+
DrawIndices::DrawIndices (const deUint32* ptr, int baseVertex_)
: indices (ptr)
, indexType (INDEXTYPE_UINT32)
diff --git a/framework/referencerenderer/rrRenderer.hpp b/framework/referencerenderer/rrRenderer.hpp
index f47e4fe..6655b5d 100644
--- a/framework/referencerenderer/rrRenderer.hpp
+++ b/framework/referencerenderer/rrRenderer.hpp
@@ -41,20 +41,22 @@
MAX_COLOR_BUFFERS = 4
};
- RenderTarget (const MultisamplePixelBufferAccess& colorMultisampleBuffer,
- const MultisamplePixelBufferAccess& depthMultisampleBuffer = MultisamplePixelBufferAccess(),
- const MultisamplePixelBufferAccess& stencilMultisampleBuffer = MultisamplePixelBufferAccess())
- : numColorBuffers (1)
- , depthBuffer (depthMultisampleBuffer)
- , stencilBuffer (stencilMultisampleBuffer)
- {
- colorBuffers[0] = colorMultisampleBuffer;
- }
+ RenderTarget (const MultisamplePixelBufferAccess& colorMultisampleBuffer,
+ const MultisamplePixelBufferAccess& depthMultisampleBuffer = MultisamplePixelBufferAccess(),
+ const MultisamplePixelBufferAccess& stencilMultisampleBuffer = MultisamplePixelBufferAccess());
- MultisamplePixelBufferAccess colorBuffers[MAX_COLOR_BUFFERS];
- const int numColorBuffers;
- const MultisamplePixelBufferAccess depthBuffer;
- const MultisamplePixelBufferAccess stencilBuffer;
+ int getNumSamples (void) const;
+
+ const MultisamplePixelBufferAccess& getColorBuffer (int ndx) const { DE_ASSERT(de::inRange(ndx, 0, m_numColorBuffers)); return m_colorBuffers[ndx]; }
+ int getNumColorBuffers (void) const { return m_numColorBuffers; }
+ const MultisamplePixelBufferAccess& getStencilBuffer (void) const { return m_stencilBuffer; }
+ const MultisamplePixelBufferAccess& getDepthBuffer (void) const { return m_depthBuffer; }
+
+private:
+ MultisamplePixelBufferAccess m_colorBuffers[MAX_COLOR_BUFFERS];
+ const int m_numColorBuffers;
+ const MultisamplePixelBufferAccess m_depthBuffer;
+ const MultisamplePixelBufferAccess m_stencilBuffer;
} DE_WARN_UNUSED_TYPE;
struct Program
diff --git a/framework/referencerenderer/rrVertexAttrib.cpp b/framework/referencerenderer/rrVertexAttrib.cpp
index eaea7b3..7d2f2e1 100644
--- a/framework/referencerenderer/rrVertexAttrib.cpp
+++ b/framework/referencerenderer/rrVertexAttrib.cpp
@@ -128,10 +128,10 @@
deInt32 aligned[4];
deMemcpy(aligned, ptr, size * sizeof(deInt32));
- dst[0] = aligned[0] / float(1 << 16);
- if (size >= 2) dst[1] = aligned[1] / float(1 << 16);
- if (size >= 3) dst[2] = aligned[2] / float(1 << 16);
- if (size >= 4) dst[3] = aligned[3] / float(1 << 16);
+ dst[0] = float(aligned[0]) / float(1 << 16);
+ if (size >= 2) dst[1] = float(aligned[1]) / float(1 << 16);
+ if (size >= 3) dst[2] = float(aligned[2]) / float(1 << 16);
+ if (size >= 4) dst[3] = float(aligned[3]) / float(1 << 16);
}
inline void readDouble (tcu::Vec4& dst, const int size, const void* ptr)
@@ -419,27 +419,27 @@
case VERTEXATTRIBTYPE_FLOAT: return 4;
case VERTEXATTRIBTYPE_HALF: return 2;
case VERTEXATTRIBTYPE_FIXED: return 4;
- case VERTEXATTRIBTYPE_DOUBLE: return sizeof(double);
+ case VERTEXATTRIBTYPE_DOUBLE: return (int)sizeof(double);
case VERTEXATTRIBTYPE_NONPURE_UNORM8: return 1;
case VERTEXATTRIBTYPE_NONPURE_UNORM16: return 2;
case VERTEXATTRIBTYPE_NONPURE_UNORM32: return 4;
- case VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV: return sizeof(deUint32)/4;
+ case VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV: return (int)sizeof(deUint32)/4;
case VERTEXATTRIBTYPE_NONPURE_SNORM8_CLAMP: return 1;
case VERTEXATTRIBTYPE_NONPURE_SNORM16_CLAMP: return 2;
case VERTEXATTRIBTYPE_NONPURE_SNORM32_CLAMP: return 4;
- case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP: return sizeof(deUint32)/4;
+ case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP: return (int)sizeof(deUint32)/4;
case VERTEXATTRIBTYPE_NONPURE_SNORM8_SCALE: return 1;
case VERTEXATTRIBTYPE_NONPURE_SNORM16_SCALE: return 2;
case VERTEXATTRIBTYPE_NONPURE_SNORM32_SCALE: return 4;
- case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE: return sizeof(deUint32)/4;
+ case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE: return (int)sizeof(deUint32)/4;
case VERTEXATTRIBTYPE_NONPURE_UINT8: return 1;
case VERTEXATTRIBTYPE_NONPURE_UINT16: return 2;
case VERTEXATTRIBTYPE_NONPURE_UINT32: return 4;
case VERTEXATTRIBTYPE_NONPURE_INT8: return 1;
case VERTEXATTRIBTYPE_NONPURE_INT16: return 2;
case VERTEXATTRIBTYPE_NONPURE_INT32: return 4;
- case VERTEXATTRIBTYPE_NONPURE_UINT_2_10_10_10_REV: return sizeof(deUint32)/4;
- case VERTEXATTRIBTYPE_NONPURE_INT_2_10_10_10_REV: return sizeof(deUint32)/4;
+ case VERTEXATTRIBTYPE_NONPURE_UINT_2_10_10_10_REV: return (int)sizeof(deUint32)/4;
+ case VERTEXATTRIBTYPE_NONPURE_INT_2_10_10_10_REV: return (int)sizeof(deUint32)/4;
case VERTEXATTRIBTYPE_PURE_UINT8: return 1;
case VERTEXATTRIBTYPE_PURE_UINT16: return 2;
case VERTEXATTRIBTYPE_PURE_UINT32: return 4;
@@ -447,9 +447,9 @@
case VERTEXATTRIBTYPE_PURE_INT16: return 2;
case VERTEXATTRIBTYPE_PURE_INT32: return 4;
case VERTEXATTRIBTYPE_NONPURE_UNORM8_BGRA: return 1;
- case VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV_BGRA: return sizeof(deUint32)/4;
- case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP_BGRA: return sizeof(deUint32)/4;
- case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE_BGRA: return sizeof(deUint32)/4;
+ case VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV_BGRA: return (int)sizeof(deUint32)/4;
+ case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP_BGRA: return (int)sizeof(deUint32)/4;
+ case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE_BGRA: return (int)sizeof(deUint32)/4;
default:
DE_ASSERT(false);
return 0;
diff --git a/modules/egl/teglGLES2SharedRenderingPerfTests.cpp b/modules/egl/teglGLES2SharedRenderingPerfTests.cpp
index 65c92af..5e2dcc9 100644
--- a/modules/egl/teglGLES2SharedRenderingPerfTests.cpp
+++ b/modules/egl/teglGLES2SharedRenderingPerfTests.cpp
@@ -262,9 +262,9 @@
{
for (int y = 0; y < config.textureHeight; y++)
{
- data.push_back((255*x)/255);
- data.push_back((255*y)/255);
- data.push_back((255*x*y)/(255*255));
+ data.push_back((deUint8)((255*x)/255));
+ data.push_back((deUint8)((255*y)/255));
+ data.push_back((deUint8)((255*x*y)/(255*255)));
data.push_back(255);
}
}
@@ -966,22 +966,22 @@
deviation = 0.0;
for (int resultNdx = 0; resultNdx < (int)resultsUs.size(); resultNdx++)
- deviation += (resultsUs[resultNdx] - average) * (resultsUs[resultNdx] - average);
+ deviation += (double)((resultsUs[resultNdx] - average) * (resultsUs[resultNdx] - average));
- deviation = std::sqrt((double)(deviation/resultsUs.size()));
+ deviation = std::sqrt(deviation/(double)resultsUs.size());
{
tcu::ScopedLogSection section(log, "Statistics from results", "Statistics from results");
log << TestLog::Message
- << "Average: " << (average/1000.0) << "ms\n"
- << "Standart deviation: " << (deviation/1000.0) << "ms\n"
- << "Standart error of mean: " << ((deviation/std::sqrt((double)resultsUs.size()))/1000.0) << "ms\n"
- << "Median: " << (median/1000.0) << "ms\n"
+ << "Average: " << ((double)average/1000.0) << "ms\n"
+ << "Standard deviation: " << ((double)deviation/1000.0) << "ms\n"
+ << "Standard error of mean: " << (((double)deviation/std::sqrt((double)resultsUs.size()))/1000.0) << "ms\n"
+ << "Median: " << ((double)median/1000.0) << "ms\n"
<< TestLog::EndMessage;
}
- testCtx.setTestResult(QP_TEST_RESULT_PASS, de::floatToString((float)(average/1000.0), 2).c_str());
+ testCtx.setTestResult(QP_TEST_RESULT_PASS, de::floatToString((float)((double)average/1000.0), 2).c_str());
}
void logTestConfig (TestLog& log, const TestConfig& config)
diff --git a/modules/egl/teglGLES2SharingTests.cpp b/modules/egl/teglGLES2SharingTests.cpp
index 0219e38..33b02b4 100644
--- a/modules/egl/teglGLES2SharingTests.cpp
+++ b/modules/egl/teglGLES2SharingTests.cpp
@@ -366,24 +366,24 @@
for (int i = 0; i < (int)m_buffer.size() / 4; i++)
{
- indices.push_back(i*4);
- indices.push_back(i*4 + 1);
- indices.push_back(i*4 + 2);
- indices.push_back(i*4 + 2);
- indices.push_back(i*4 + 3);
- indices.push_back(i*4);
+ indices.push_back((deUint16)(i*4));
+ indices.push_back((deUint16)(i*4 + 1));
+ indices.push_back((deUint16)(i*4 + 2));
+ indices.push_back((deUint16)(i*4 + 2));
+ indices.push_back((deUint16)(i*4 + 3));
+ indices.push_back((deUint16)(i*4));
- coords.push_back(0.125f * (i % 16) - 1.0f);
- coords.push_back(0.125f * ((int)(i / 16.0f)) - 1.0f);
+ coords.push_back(0.125f * (float)(i % 16) - 1.0f);
+ coords.push_back(0.125f * (float)((int)((float)i / 16.0f)) - 1.0f);
- coords.push_back(0.125f * (i % 16) - 1.0f);
- coords.push_back(0.125f * ((int)(i / 16.0f) + 1) - 1.0f);
+ coords.push_back(0.125f * (float)(i % 16) - 1.0f);
+ coords.push_back(0.125f * (float)((int)((float)i / 16.0f) + 1) - 1.0f);
- coords.push_back(0.125f * ((i % 16) + 1) - 1.0f);
- coords.push_back(0.125f * ((int)(i / 16.0f) + 1) - 1.0f);
+ coords.push_back(0.125f * (float)((i % 16) + 1) - 1.0f);
+ coords.push_back(0.125f * (float)((int)((float)i / 16.0f) + 1) - 1.0f);
- coords.push_back(0.125f * ((i % 16) + 1) - 1.0f);
- coords.push_back(0.125f * ((int)(i / 16.0f)) - 1.0f);
+ coords.push_back(0.125f * (float)((i % 16) + 1) - 1.0f);
+ coords.push_back(0.125f * (float)((int)((float)i / 16.0f)) - 1.0f);
}
int width = 240;
@@ -431,17 +431,17 @@
m_gl.readPixels(0, 0, screen->getWidth(), screen->getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, screen->getAccess().getDataPtr());
for (int i = 0; i < (int)m_buffer.size() / 4; i++)
{
- float fx1 = 0.125f * (i % 16) - 1.0f;
- float fy1 = 0.125f * ((int)(i / 16.0f)) - 1.0f;
- float fx2 = 0.125f * ((i % 16) + 1) - 1.0f;
- float fy2 = 0.125f * ((int)((i / 16.0f) + 1)) - 1.0f;
+ float fx1 = 0.125f * (float)(i % 16) - 1.0f;
+ float fy1 = 0.125f * (float)((int)((float)i / 16.0f)) - 1.0f;
+ float fx2 = 0.125f * (float)((i % 16) + 1) - 1.0f;
+ float fy2 = 0.125f * (float)((int)((float)i / 16.0f) + 1) - 1.0f;
- int ox = deRoundFloatToInt32(width / 2.0f);
- int oy = deRoundFloatToInt32(height / 2.0f);
- int x1 = deRoundFloatToInt32((width * fx1 / 2.0f) + ox);
- int y1 = deRoundFloatToInt32((height * fy1 / 2.0f) + oy);
- int x2 = deRoundFloatToInt32((width * fx2 / 2.0f) + ox);
- int y2 = deRoundFloatToInt32((height * fy2 / 2.0f) + oy);
+ int ox = deRoundFloatToInt32((float)width / 2.0f);
+ int oy = deRoundFloatToInt32((float)height / 2.0f);
+ int x1 = deRoundFloatToInt32(((float)width * fx1 / 2.0f) + (float)ox);
+ int y1 = deRoundFloatToInt32(((float)height * fy1 / 2.0f) + (float)oy);
+ int x2 = deRoundFloatToInt32(((float)width * fx2 / 2.0f) + (float)ox);
+ int y2 = deRoundFloatToInt32(((float)height * fy2 / 2.0f) + (float)oy);
for (int x = x1; x < x2; x++)
{
@@ -610,8 +610,8 @@
{
for (int y = 0; y < height; y++)
{
- float t = ((float)x / (width - 1.0f));
- float s = ((float)y / (height - 1.0f));
+ float t = ((float)x / ((float)width - 1.0f));
+ float s = ((float)y / ((float)height - 1.0f));
float lod = 0.0f;
tcu::Vec4 color = m_texture.sample(tcu::Sampler(tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::REPEAT_GL, tcu::Sampler::LINEAR, tcu::Sampler::LINEAR), t, s, lod);
@@ -741,17 +741,17 @@
tcu::clear(reference->getAccess(), tcu::IVec4(0xff, 0, 0, 0xff));
- int x1 = (int)((width/2.0f) * (-0.9f) + (width/2.0f));
- int x2 = (int)((width/2.0f) * 0.9f + (width/2.0f));
- int y1 = (int)((height/2.0f) * (-0.9f) + (height/2.0f));
- int y2 = (int)((height/2.0f) * 0.9f + (height/2.0f));
+ int x1 = (int)(((float)width/2.0f) * (-0.9f) + ((float)width/2.0f));
+ int x2 = (int)(((float)width/2.0f) * 0.9f + ((float)width/2.0f));
+ int y1 = (int)(((float)height/2.0f) * (-0.9f) + ((float)height/2.0f));
+ int y2 = (int)(((float)height/2.0f) * 0.9f + ((float)height/2.0f));
for (int x = x1; x <= x2; x++)
{
for (int y = y1; y <= y2; y++)
{
- float t = ((float)(x-x1) / (x2 - x1));
- float s = ((float)(y-y1) / (y2-y1));
+ float t = ((float)(x-x1) / (float)(x2-x1));
+ float s = ((float)(y-y1) / (float)(y2-y1));
bool isUpper = t > s;
tcu::Vec4 a(colors[0], colors[1], colors[2], colors[3]);
@@ -1030,17 +1030,17 @@
tcu::clear(reference->getAccess(), tcu::IVec4(0xff, 0, 0, 0xff));
- int x1 = (int)((width/2.0f) * (-0.9f) + (width/2.0f));
- int x2 = (int)((width/2.0f) * 0.9f + (width/2.0f));
- int y1 = (int)((height/2.0f) * (-0.9f) + (height/2.0f));
- int y2 = (int)((height/2.0f) * 0.9f + (height/2.0f));
+ int x1 = (int)(((float)width/2.0f) * (-0.9f) + ((float)width/2.0f));
+ int x2 = (int)(((float)width/2.0f) * 0.9f + ((float)width/2.0f));
+ int y1 = (int)(((float)height/2.0f) * (-0.9f) + ((float)height/2.0f));
+ int y2 = (int)(((float)height/2.0f) * 0.9f + ((float)height/2.0f));
for (int x = x1; x <= x2; x++)
{
for (int y = y1; y <= y2; y++)
{
- float t = ((float)(x-x1) / (x2 - x1));
- float s = ((float)(y-y1) / (y2-y1));
+ float t = ((float)(x-x1) / (float)(x2-x1));
+ float s = ((float)(y-y1) / (float)(y2-y1));
bool isUpper = t > s;
tcu::Vec4 a(colors[0], colors[1], colors[2], colors[3]);
diff --git a/modules/egl/teglGLES2SharingThreadedTests.cpp b/modules/egl/teglGLES2SharingThreadedTests.cpp
index 78da36b..2a44613 100644
--- a/modules/egl/teglGLES2SharingThreadedTests.cpp
+++ b/modules/egl/teglGLES2SharingThreadedTests.cpp
@@ -2258,7 +2258,7 @@
void GLES2SharingRandomTest::addRandomOperation (GLES2ThreadTest::EGLResourceManager& resourceManager)
{
- int threadNdx = m_random.getUint32() % m_threads.size();
+ int threadNdx = m_random.getUint32() % (deUint32)m_threads.size();
std::vector<OperationId> operations;
std::vector<float> weights;
diff --git a/modules/egl/teglImageFormatTests.cpp b/modules/egl/teglImageFormatTests.cpp
index 1974e85..53832a9 100644
--- a/modules/egl/teglImageFormatTests.cpp
+++ b/modules/egl/teglImageFormatTests.cpp
@@ -533,7 +533,7 @@
for (int level = 0; level < DE_LENGTH_OF_ARRAY(depthLevelColors); level++)
{
const tcu::Vec4 color = depthLevelColors[level];
- const float clipDepth = ((level + 1) * 0.1f) * 2.0f - 1.0f; // depth in clip coords
+ const float clipDepth = ((float)(level + 1) * 0.1f) * 2.0f - 1.0f; // depth in clip coords
GLU_CHECK_GLW_CALL(gl, uniform4f(colorLoc, color.x(), color.y(), color.z(), color.w()));
GLU_CHECK_GLW_CALL(gl, uniform1f(depthLoc, clipDepth));
@@ -558,7 +558,7 @@
for (int level = 0; level < DE_LENGTH_OF_ARRAY(depthLevelColors); level++)
{
- if ((level + 1) * 0.1f < refAccess.getPixDepth(x, y))
+ if ((float)(level + 1) * 0.1f < refAccess.getPixDepth(x, y))
result = depthLevelColors[level];
}
@@ -653,7 +653,7 @@
for (int level = 0; level < DE_LENGTH_OF_ARRAY(stencilLevelColors); level++)
{
const tcu::Vec4 color = stencilLevelColors[level];
- const int stencil = (int)(((level + 1) * 0.1f) * maxStencil);
+ const int stencil = (int)(((float)(level + 1) * 0.1f) * (float)maxStencil);
GLU_CHECK_GLW_CALL(gl, stencilFunc(GL_LESS, stencil, 0xFFFFFFFFu));
GLU_CHECK_GLW_CALL(gl, uniform4f(colorLoc, color.x(), color.y(), color.z(), color.w()));
@@ -676,7 +676,7 @@
for (int level = 0; level < DE_LENGTH_OF_ARRAY(stencilLevelColors); level++)
{
- const int levelStencil = (int)(((level + 1) * 0.1f) * maxStencil);
+ const int levelStencil = (int)(((float)(level + 1) * 0.1f) * (float)maxStencil);
if (levelStencil < refAccess.getPixStencil(x, y))
result = stencilLevelColors[level];
}
diff --git a/modules/egl/teglImageUtil.cpp b/modules/egl/teglImageUtil.cpp
index 825361e..07221db 100644
--- a/modules/egl/teglImageUtil.cpp
+++ b/modules/egl/teglImageUtil.cpp
@@ -344,8 +344,8 @@
for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(stencilValues); ++ndx)
{
const deUint32 stencil = stencilValues[ndx] & stencilMask;
- const tcu::IVec2 size = tcu::IVec2((int)((DE_LENGTH_OF_ARRAY(stencilValues) - ndx) * (ref.getWidth() / float(DE_LENGTH_OF_ARRAY(stencilValues)))),
- (int)((DE_LENGTH_OF_ARRAY(stencilValues) - ndx) * (ref.getHeight() / float(DE_LENGTH_OF_ARRAY(stencilValues) + 4)))); // not symmetric
+ const tcu::IVec2 size = tcu::IVec2((int)((float)(DE_LENGTH_OF_ARRAY(stencilValues) - ndx) * ((float)ref.getWidth() / float(DE_LENGTH_OF_ARRAY(stencilValues)))),
+ (int)((float)(DE_LENGTH_OF_ARRAY(stencilValues) - ndx) * ((float)ref.getHeight() / float(DE_LENGTH_OF_ARRAY(stencilValues) + 4)))); // not symmetric
if (size.x() == 0 || size.y() == 0)
break;
@@ -377,9 +377,9 @@
GLU_CHECK_GLW_CALL(gl, enable(GL_SCISSOR_TEST));
for (int ndx = 0; ndx < NUM_STEPS; ++ndx)
{
- const float depth = ndx / float(NUM_STEPS);
- const tcu::IVec2 size = tcu::IVec2((int)((NUM_STEPS - ndx) * (ref.getWidth() / float(NUM_STEPS))),
- (int)((NUM_STEPS - ndx) * (ref.getHeight() / float(NUM_STEPS + 4)))); // not symmetric
+ const float depth = (float)ndx / float(NUM_STEPS);
+ const tcu::IVec2 size = tcu::IVec2((int)((float)(NUM_STEPS - ndx) * ((float)ref.getWidth() / float(NUM_STEPS))),
+ (int)((float)(NUM_STEPS - ndx) * ((float)ref.getHeight() / float(NUM_STEPS + 4)))); // not symmetric
if (size.x() == 0 || size.y() == 0)
break;
@@ -419,8 +419,8 @@
GLU_CHECK_GLW_CALL(gl, enable(GL_SCISSOR_TEST));
for (int ndx = 0; ndx < DE_LENGTH_OF_ARRAY(colorValues); ++ndx)
{
- const tcu::IVec2 size = tcu::IVec2((int)((DE_LENGTH_OF_ARRAY(colorValues) - ndx) * (ref.getWidth() / float(DE_LENGTH_OF_ARRAY(colorValues)))),
- (int)((DE_LENGTH_OF_ARRAY(colorValues) - ndx) * (ref.getHeight() / float(DE_LENGTH_OF_ARRAY(colorValues) + 4)))); // not symmetric
+ const tcu::IVec2 size = tcu::IVec2((int)((float)(DE_LENGTH_OF_ARRAY(colorValues) - ndx) * ((float)ref.getWidth() / float(DE_LENGTH_OF_ARRAY(colorValues)))),
+ (int)((float)(DE_LENGTH_OF_ARRAY(colorValues) - ndx) * ((float)ref.getHeight() / float(DE_LENGTH_OF_ARRAY(colorValues) + 4)))); // not symmetric
if (size.x() == 0 || size.y() == 0)
break;
diff --git a/modules/egl/teglMakeCurrentPerfTests.cpp b/modules/egl/teglMakeCurrentPerfTests.cpp
index 9bf82ed..af552f6 100644
--- a/modules/egl/teglMakeCurrentPerfTests.cpp
+++ b/modules/egl/teglMakeCurrentPerfTests.cpp
@@ -460,8 +460,8 @@
}
// Calculate mean and median
- iterationTimeMeanUs = ((float)(((double)totalTimeUs) / totalIterationCount));
- iterationTimeMedianUs = ((float)(((double)m_samples[m_samples.size() / 2]) / m_spec.iterationCount));
+ iterationTimeMeanUs = ((float)(((double)totalTimeUs) / (double)totalIterationCount));
+ iterationTimeMedianUs = ((float)(((double)m_samples[m_samples.size() / 2]) / (double)m_spec.iterationCount));
// Calculate variance
for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++)
@@ -478,7 +478,7 @@
iterationTimeMaxUs = std::max<float>(iterationTimeMaxUs, iterationTimeUs);
}
- iterationTimeVarianceUs /= m_samples.size();
+ iterationTimeVarianceUs /= (float)m_samples.size();
// Calculate skewness
for (int sampleNdx = 0; sampleNdx < (int)m_samples.size(); sampleNdx++)
@@ -501,7 +501,7 @@
log << TestLog::Message << "Max: " << iterationTimeMaxUs << "us" << TestLog::EndMessage;
}
- m_testCtx.setTestResult(QP_TEST_RESULT_PASS, de::floatToString((float)(((double)totalTimeUs)/totalIterationCount), 2).c_str());
+ m_testCtx.setTestResult(QP_TEST_RESULT_PASS, de::floatToString((float)(((double)totalTimeUs)/(double)totalIterationCount), 2).c_str());
}
}
diff --git a/modules/egl/teglMemoryStressTests.cpp b/modules/egl/teglMemoryStressTests.cpp
index 269dcfe..2ad9cfb 100644
--- a/modules/egl/teglMemoryStressTests.cpp
+++ b/modules/egl/teglMemoryStressTests.cpp
@@ -449,7 +449,7 @@
}
else
{
- float change = (min - max) / ((float)(max));
+ float change = (float)(min - max) / ((float)(max));
if (change > threshold)
{
diff --git a/modules/egl/teglNativeColorMappingTests.cpp b/modules/egl/teglNativeColorMappingTests.cpp
index 415a732..c116dab 100644
--- a/modules/egl/teglNativeColorMappingTests.cpp
+++ b/modules/egl/teglNativeColorMappingTests.cpp
@@ -258,10 +258,10 @@
deMinu32(nativeBitDepth.z(), eglBitDepth.z()),
deMinu32(nativeBitDepth.w(), eglBitDepth.w()));
- const tcu::UVec4 uColor = tcu::UVec4((deUint32)(((1u << bitDepth.x()) - 1u) * color.x()),
- (deUint32)(((1u << bitDepth.y()) - 1u) * color.y()),
- (deUint32)(((1u << bitDepth.z()) - 1u) * color.z()),
- (deUint32)(((1u << bitDepth.w()) - 1u) * color.w()));
+ const tcu::UVec4 uColor = tcu::UVec4((deUint32)((float)((1u << bitDepth.x()) - 1u) * color.x()),
+ (deUint32)((float)((1u << bitDepth.y()) - 1u) * color.y()),
+ (deUint32)((float)((1u << bitDepth.z()) - 1u) * color.z()),
+ (deUint32)((float)((1u << bitDepth.w()) - 1u) * color.w()));
tcu::TextureLevel reference(result.getFormat(), result.getWidth(), result.getHeight());
diff --git a/modules/egl/teglNativeCoordMappingTests.cpp b/modules/egl/teglNativeCoordMappingTests.cpp
index c704665..37c2c5d 100644
--- a/modules/egl/teglNativeCoordMappingTests.cpp
+++ b/modules/egl/teglNativeCoordMappingTests.cpp
@@ -220,8 +220,8 @@
tcu::Vec2 toGLCoord (int width, int height, int x, int y)
{
- const float xf = (float(2.0f * x) / width) - 1.0f;
- const float yf = (float(2.0f * y) / height) - 1.0f;
+ const float xf = ((2.0f * float(x)) / (float)width) - 1.0f;
+ const float yf = ((2.0f * float(y)) / (float)height) - 1.0f;
return tcu::Vec2(xf, yf);
}
diff --git a/modules/egl/teglPreservingSwapTests.cpp b/modules/egl/teglPreservingSwapTests.cpp
index 4e3e384..d78077b 100644
--- a/modules/egl/teglPreservingSwapTests.cpp
+++ b/modules/egl/teglPreservingSwapTests.cpp
@@ -212,11 +212,11 @@
const int px = width;
const int py = height;
- const int x1i = (int)((px/2.0f) * x1 + ox);
- const int y1i = (int)((py/2.0f) * y1 + oy);
+ const int x1i = (int)(((float)px/2.0f) * x1 + (float)ox);
+ const int y1i = (int)(((float)py/2.0f) * y1 + (float)oy);
- const int x2i = (int)((px/2.0f) * x2 + ox);
- const int y2i = (int)((py/2.0f) * y2 + oy);
+ const int x2i = (int)(((float)px/2.0f) * x2 + (float)ox);
+ const int y2i = (int)(((float)py/2.0f) * y2 + (float)oy);
m_gl.enable(GL_SCISSOR_TEST);
m_gl.scissor(x1i, y1i, x2i-x1i, y2i-y1i);
@@ -501,11 +501,11 @@
const int px = width;
const int py = height;
- const int x1i = (int)((px/2.0f) * postSwapX1 + ox);
- const int y1i = (int)((py/2.0f) * postSwapY1 + oy);
+ const int x1i = (int)(((float)px/2.0f) * postSwapX1 + (float)ox);
+ const int y1i = (int)(((float)py/2.0f) * postSwapY1 + (float)oy);
- const int x2i = (int)((px/2.0f) * postSwapX2 + ox);
- const int y2i = (int)((py/2.0f) * postSwapY2 + oy);
+ const int x2i = (int)(((float)px/2.0f) * postSwapX2 + (float)ox);
+ const int y2i = (int)(((float)py/2.0f) * postSwapY2 + (float)oy);
if (m_readPixelsBeforeSwap)
isOk = isOk && compareToReference(log, "Compare pre-swap framebuffer to reference", "Compare pre-swap framebuffer to reference", preSwapFramebufferReference, preSwapFramebuffer, 0, 0, width, height);
diff --git a/modules/gles2/functional/es2fApiCase.cpp b/modules/gles2/functional/es2fApiCase.cpp
index ee5ba3c..a07d247 100644
--- a/modules/gles2/functional/es2fApiCase.cpp
+++ b/modules/gles2/functional/es2fApiCase.cpp
@@ -86,7 +86,12 @@
void ApiCase::checkBooleans (deUint8 value, deUint8 expected)
{
- if (value != expected)
+ checkBooleans((deInt32)value, expected);
+}
+
+void ApiCase::checkBooleans (deInt32 value, deUint8 expected)
+{
+ if (value != (deInt32)expected)
{
m_log << tcu::TestLog::Message << "// ERROR: expected " << (expected ? "GL_TRUE" : "GL_FALSE") << tcu::TestLog::EndMessage;
if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
diff --git a/modules/gles2/functional/es2fApiCase.hpp b/modules/gles2/functional/es2fApiCase.hpp
index 9bbfd90..fee6e8e 100644
--- a/modules/gles2/functional/es2fApiCase.hpp
+++ b/modules/gles2/functional/es2fApiCase.hpp
@@ -50,6 +50,7 @@
void expectError (deUint32 error0, deUint32 error1);
void getSupportedExtensions (const deUint32 numSupportedValues, const deUint32 extension, std::vector<int>& values);
void checkBooleans (deUint8 value, deUint8 expected);
+ void checkBooleans (deInt32 value, deUint8 expected);
tcu::TestLog& m_log;
};
diff --git a/modules/gles2/functional/es2fBufferTestUtil.cpp b/modules/gles2/functional/es2fBufferTestUtil.cpp
index a94025b..59360d3 100644
--- a/modules/gles2/functional/es2fBufferTestUtil.cpp
+++ b/modules/gles2/functional/es2fBufferTestUtil.cpp
@@ -319,10 +319,10 @@
for (int y = 0; y < gridSizeY; y++)
for (int x = 0; x < gridSizeX; x++)
{
- float sx0 = (x+0) / (float)gridSizeX;
- float sy0 = (y+0) / (float)gridSizeY;
- float sx1 = (x+1) / (float)gridSizeX;
- float sy1 = (y+1) / (float)gridSizeY;
+ float sx0 = (float)(x+0) / (float)gridSizeX;
+ float sy0 = (float)(y+0) / (float)gridSizeY;
+ float sx1 = (float)(x+1) / (float)gridSizeX;
+ float sy1 = (float)(y+1) / (float)gridSizeY;
float fx0 = 2.0f * sx0 - 1.0f;
float fy0 = 2.0f * sy0 - 1.0f;
float fx1 = 2.0f * sx1 - 1.0f;
@@ -388,8 +388,8 @@
for (int y = 0; y < VERIFY_QUAD_SIZE; y++)
for (int x = 0; x < VERIFY_QUAD_SIZE; x++)
{
- float fx = (float)(x+0.5f) / (float)VERIFY_QUAD_SIZE;
- float fy = (float)(y+0.5f) / (float)VERIFY_QUAD_SIZE;
+ float fx = ((float)x+0.5f) / (float)VERIFY_QUAD_SIZE;
+ float fy = ((float)y+0.5f) / (float)VERIFY_QUAD_SIZE;
bool tri = fx + fy <= 1.0f;
float tx = tri ? fx : (1.0f-fx);
diff --git a/modules/gles2/functional/es2fClippingTests.cpp b/modules/gles2/functional/es2fClippingTests.cpp
index 71e74b0..796cdef 100644
--- a/modules/gles2/functional/es2fClippingTests.cpp
+++ b/modules/gles2/functional/es2fClippingTests.cpp
@@ -1991,8 +1991,8 @@
const tcu::IVec3 r1 = outside[ndx1];
const tcu::IVec3 r2 = outside[ndx2];
const tcu::Vec4 p0 = tcu::Vec4(r0.x() * w0, r0.y() * w0, r0.z() * w0, w0);
- const tcu::Vec4 p1 = tcu::Vec4(r1.x() * far * w1, r1.y() * far * w1, r1.z() * far * w1, w1);
- const tcu::Vec4 p2 = tcu::Vec4(r2.x() * far * w2, r2.y() * far * w2, r2.z() * far * w2, w2);
+ const tcu::Vec4 p1 = tcu::Vec4(float(r1.x()) * far * w1, float(r1.y()) * far * w1, float(r1.z()) * far * w1, w1);
+ const tcu::Vec4 p2 = tcu::Vec4(float(r2.x()) * far * w2, float(r2.y()) * far * w2, float(r2.z()) * far * w2, w2);
const std::string name = std::string("clip") +
(outside[ndx1].x() > 0 ? "_pos_x" : (outside[ndx1].x() < 0 ? "_neg_x" : "")) +
@@ -2023,9 +2023,9 @@
const tcu::IVec3 r0 = outside[ndx1];
const tcu::IVec3 r1 = outside[ndx2];
const tcu::IVec3 r2 = outside[ndx3];
- const tcu::Vec4 p0 = tcu::Vec4(r0.x() * far * w0, r0.y() * far * w0, r0.z() * far * w0, w0);
- const tcu::Vec4 p1 = tcu::Vec4(r1.x() * far * w1, r1.y() * far * w1, r1.z() * far * w1, w1);
- const tcu::Vec4 p2 = tcu::Vec4(r2.x() * far * w2, r2.y() * far * w2, r2.z() * far * w2, w2);
+ const tcu::Vec4 p0 = tcu::Vec4(float(r0.x()) * far * w0, float(r0.y()) * far * w0, float(r0.z()) * far * w0, w0);
+ const tcu::Vec4 p1 = tcu::Vec4(float(r1.x()) * far * w1, float(r1.y()) * far * w1, float(r1.z()) * far * w1, w1);
+ const tcu::Vec4 p2 = tcu::Vec4(float(r2.x()) * far * w2, float(r2.y()) * far * w2, float(r2.z()) * far * w2, w2);
// ignore cases where polygon is along xz or yz planes
if (pointsOnLine(r0.swizzle(0, 1), r1.swizzle(0, 1), r2.swizzle(0, 1)))
diff --git a/modules/gles2/functional/es2fColorClearTest.cpp b/modules/gles2/functional/es2fColorClearTest.cpp
index 3a86e61..2c275c2 100644
--- a/modules/gles2/functional/es2fColorClearTest.cpp
+++ b/modules/gles2/functional/es2fColorClearTest.cpp
@@ -147,7 +147,7 @@
int b = (int)(rnd.getUint32() & 0xFF);
int a = m_testAlpha ? (int)(rnd.getUint32() & 0xFF) : 0xFF;
RGBA clearCol(r, g, b, a);
- gl.clearColor(r/255.0f, g/255.0f, b/255.0f, a/255.0f);
+ gl.clearColor(float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, float(a)/255.0f);
// Mask.
deUint8 clearMask;
diff --git a/modules/gles2/functional/es2fDepthRangeTests.cpp b/modules/gles2/functional/es2fDepthRangeTests.cpp
index 4668d17..a59b1a0 100644
--- a/modules/gles2/functional/es2fDepthRangeTests.cpp
+++ b/modules/gles2/functional/es2fDepthRangeTests.cpp
@@ -228,7 +228,7 @@
// Render reference.
for (int y = 0; y < referenceFrame.getHeight(); y++)
{
- float yf = ((float)y + 0.5f) / referenceFrame.getHeight();
+ float yf = ((float)y + 0.5f) / (float)referenceFrame.getHeight();
int half = de::clamp((int)((float)referenceFrame.getWidth()*0.5f + 0.5f), 0, referenceFrame.getWidth());
// Fill left half - comparison to constant 0.5
@@ -245,7 +245,7 @@
for (int x = half; x < referenceFrame.getWidth(); x++)
{
float xf = ((float)x + 0.5f) / (float)referenceFrame.getWidth();
- float xh = ((float)x - half + 0.5f) / (float)(referenceFrame.getWidth()-half);
+ float xh = ((float)(x - half) + 0.5f) / (float)(referenceFrame.getWidth()-half);
float rd = 1.0f - (xh + yf) * 0.5f;
float d = depthRangeTransform(triQuadInterpolate(xf, yf, m_depthCoord), m_zNear, m_zFar);
bool dpass = compare(m_compareFunc, d, rd);
diff --git a/modules/gles2/functional/es2fDepthStencilClearTests.cpp b/modules/gles2/functional/es2fDepthStencilClearTests.cpp
index f1671dd..cbbcf99 100644
--- a/modules/gles2/functional/es2fDepthStencilClearTests.cpp
+++ b/modules/gles2/functional/es2fDepthStencilClearTests.cpp
@@ -324,7 +324,7 @@
if (m_testDepth)
{
int numSteps = DEPTH_STEPS;
- float step = 2.0f / numSteps;
+ float step = 2.0f / (float)numSteps;
gl.enable (GL_DEPTH_TEST);
gl.depthFunc(GL_LESS);
@@ -333,7 +333,7 @@
for (int ndx = 0; ndx < numSteps; ndx++)
{
- float d = -1.0f + step*ndx;
+ float d = -1.0f + step*(float)ndx;
float c = (float)ndx / (float)(numSteps-1);
float pos[] =
{
diff --git a/modules/gles2/functional/es2fDepthStencilTests.cpp b/modules/gles2/functional/es2fDepthStencilTests.cpp
index c7cb9ca..793c7a3 100644
--- a/modules/gles2/functional/es2fDepthStencilTests.cpp
+++ b/modules/gles2/functional/es2fDepthStencilTests.cpp
@@ -271,10 +271,10 @@
// Compute depth values
{
int numValues = DE_LENGTH_OF_ARRAY(depthValues);
- float depthStep = 2.0f/(numValues-1);
+ float depthStep = 2.0f/(float)(numValues-1);
for (int ndx = 0; ndx < numValues; ndx++)
- depthValues[ndx] = -1.0f + depthStep*ndx;
+ depthValues[ndx] = -1.0f + depthStep*(float)ndx;
}
for (int y0 = 0; y0 < numL0CellsY; y0++)
@@ -322,7 +322,7 @@
cmd.params.visibleFace = rr::FACETYPE_FRONT;
cmd.rect = rr::WindowRectangle(0, 0, target.width, target.height);
- cmd.color = Vec4(0.0f, 0.0f, colorStep*ndx, 0.0f);
+ cmd.color = Vec4(0.0f, 0.0f, colorStep*(float)ndx, 0.0f);
cmd.colorMask = tcu::BVec4(false, false, true, false);
cmd.params.depth = depthSteps[ndx]+epsilon;
cmd.params.depthTestEnabled = true;
@@ -347,7 +347,7 @@
cmd.params.visibleFace = rr::FACETYPE_FRONT;
cmd.rect = rr::WindowRectangle(0, 0, target.width, target.height);
- cmd.color = Vec4(0.0f, colorStep*(ndx+1), 0.0f, 0.0f);
+ cmd.color = Vec4(0.0f, colorStep*float(ndx+1), 0.0f, 0.0f);
cmd.colorMask = tcu::BVec4(false, true, false, false);
cmd.params.stencilTestEnabled = true;
diff --git a/modules/gles2/functional/es2fFloatStateQueryTests.cpp b/modules/gles2/functional/es2fFloatStateQueryTests.cpp
index 8d8c1b3..6903adb 100644
--- a/modules/gles2/functional/es2fFloatStateQueryTests.cpp
+++ b/modules/gles2/functional/es2fFloatStateQueryTests.cpp
@@ -131,7 +131,7 @@
if (!state.verifyValidity(testCtx))
return;
- const GLboolean expectedGLState = reference ? GL_TRUE : GL_FALSE;
+ const GLboolean expectedGLState = reference != 0.0f ? GL_TRUE : GL_FALSE;
if (state != expectedGLState)
{
@@ -156,8 +156,8 @@
const GLboolean referenceAsGLBoolean[] =
{
- reference0 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
- reference1 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+ reference0 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+ reference1 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
};
StateQueryMemoryWriteGuard<GLboolean[2]> boolVector2;
@@ -185,10 +185,10 @@
const GLboolean referenceAsGLBoolean[] =
{
- reference0 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
- reference1 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
- reference2 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
- reference3 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+ reference0 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+ reference1 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+ reference2 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+ reference3 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
};
StateQueryMemoryWriteGuard<GLboolean[4]> boolVector4;
diff --git a/modules/gles2/functional/es2fMultisampleTests.cpp b/modules/gles2/functional/es2fMultisampleTests.cpp
index 2089165..9e7cc6a 100644
--- a/modules/gles2/functional/es2fMultisampleTests.cpp
+++ b/modules/gles2/functional/es2fMultisampleTests.cpp
@@ -512,7 +512,7 @@
for (int i = 0; i < numTriangles; i++)
{
float angle0 = 2.0f*DE_PI * (float)i / (float)numTriangles + 0.001f*(float)m_currentIteration;
- float angle1 = 2.0f*DE_PI * (float)(i + 0.5f) / (float)numTriangles + 0.001f*(float)m_currentIteration;
+ float angle1 = 2.0f*DE_PI * ((float)i + 0.5f) / (float)numTriangles + 0.001f*(float)m_currentIteration;
renderTriangle(Vec2(0.0f, 0.0f),
Vec2(deFloatCos(angle0)*0.95f, deFloatSin(angle0)*0.95f),
@@ -991,7 +991,7 @@
for (int i = 0; i < numTriangles; i++)
{
float angle0 = 2.0f*DE_PI * (float)i / (float)numTriangles;
- float angle1 = 2.0f*DE_PI * (float)(i + 0.5f) / (float)numTriangles;
+ float angle1 = 2.0f*DE_PI * ((float)i + 0.5f) / (float)numTriangles;
renderTriangle(Vec2(0.0f, 0.0f),
Vec2(deFloatCos(angle0)*0.95f, deFloatSin(angle0)*0.95f),
@@ -1406,7 +1406,7 @@
GLU_CHECK_CALL(glSampleCoverage((float)i / (float)(numTriangles-1), invertSampleCoverage ? GL_TRUE : GL_FALSE));
float angle0 = 2.0f*DE_PI * (float)i / (float)numTriangles;
- float angle1 = 2.0f*DE_PI * (float)(i + 0.5f) / (float)numTriangles;
+ float angle1 = 2.0f*DE_PI * ((float)i + 0.5f) / (float)numTriangles;
renderTriangle(Vec2(0.0f, 0.0f),
Vec2(deFloatCos(angle0)*0.95f, deFloatSin(angle0)*0.95f),
diff --git a/modules/gles2/functional/es2fPrerequisiteTests.cpp b/modules/gles2/functional/es2fPrerequisiteTests.cpp
index b2bf495..042eac0 100644
--- a/modules/gles2/functional/es2fPrerequisiteTests.cpp
+++ b/modules/gles2/functional/es2fPrerequisiteTests.cpp
@@ -138,7 +138,7 @@
};
- glClearColor(r/255.0f, g/255.0f, b/255.0f, a/255.0f);
+ glClearColor(float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, float(a)/255.0f);
glClear(GL_COLOR_BUFFER_BIT);
GLU_CHECK_MSG("CLES2 ClearColor failed.");
@@ -225,7 +225,7 @@
int b = (int)(deRandom_getUint32(&rnd) & 0xFF);
tcu::clear(refImage.getAccess(), tcu::IVec4(r, g, b, 255));
- glClearColor(r/255.0f, g/255.0f, b/255.0f, 1.0f);
+ glClearColor(float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glu::readPixels(m_context.getRenderContext(), x, y, resImage.getAccess());
diff --git a/modules/gles2/functional/es2fRasterizationTests.cpp b/modules/gles2/functional/es2fRasterizationTests.cpp
index d4125da..e9529a9 100644
--- a/modules/gles2/functional/es2fRasterizationTests.cpp
+++ b/modules/gles2/functional/es2fRasterizationTests.cpp
@@ -1135,8 +1135,8 @@
for (int col = 0; col < numColumns; ++col)
for (int row = 0; row < numRows; ++row)
{
- const tcu::Vec2 center = tcu::Vec2((row + 0.5f) / numRows * 2.0f - 1.0f, (col + 0.5f) / numColumns * 2.0f - 1.0f);
- const float rotation = (iteration * numColumns * numRows + col * numRows + row) / (float)(m_iterationCount * numColumns * numRows) * DE_PI / 2.0f;
+ const tcu::Vec2 center = tcu::Vec2(((float)row + 0.5f) / (float)numRows * 2.0f - 1.0f, ((float)col + 0.5f) / (float)numColumns * 2.0f - 1.0f);
+ const float rotation = float(iteration * numColumns * numRows + col * numRows + row) / (float)(m_iterationCount * numColumns * numRows) * DE_PI / 2.0f;
const tcu::Vec2 sideH = quadSide * tcu::Vec2(deFloatCos(rotation), deFloatSin(rotation));
const tcu::Vec2 sideV = tcu::Vec2(sideH.y(), -sideH.x());
const tcu::Vec2 quad[4] =
@@ -1191,7 +1191,7 @@
{
const float quadSide = (m_caseType == FILLRULECASE_CLIPPED_PARTIAL) ? (1.0f) : (2.0f);
const tcu::Vec2 center = (m_caseType == FILLRULECASE_CLIPPED_PARTIAL) ? (tcu::Vec2(0.5f, 0.5f)) : (tcu::Vec2(0.0f, 0.0f));
- const float rotation = (iteration) / (float)(m_iterationCount - 1) * DE_PI / 2.0f;
+ const float rotation = (float)(iteration) / (float)(m_iterationCount - 1) * DE_PI / 2.0f;
const tcu::Vec2 sideH = quadSide * tcu::Vec2(deFloatCos(rotation), deFloatSin(rotation));
const tcu::Vec2 sideV = tcu::Vec2(sideH.y(), -sideH.x());
const tcu::Vec2 quad[4] =
diff --git a/modules/gles2/functional/es2fReadPixelsTests.cpp b/modules/gles2/functional/es2fReadPixelsTests.cpp
index aadbd6f..d8c0732 100644
--- a/modules/gles2/functional/es2fReadPixelsTests.cpp
+++ b/modules/gles2/functional/es2fReadPixelsTests.cpp
@@ -123,10 +123,10 @@
// Render reference
- const int coordX1 = (int)((-0.5f * reference.getWidth() / 2.0f) + reference.getWidth() / 2.0f);
- const int coordY1 = (int)((-0.5f * reference.getHeight() / 2.0f) + reference.getHeight() / 2.0f);
- const int coordX2 = (int)(( 0.5f * reference.getWidth() / 2.0f) + reference.getWidth() / 2.0f);
- const int coordY2 = (int)(( 0.5f * reference.getHeight() / 2.0f) + reference.getHeight() / 2.0f);
+ const int coordX1 = (int)((-0.5f * (float)reference.getWidth() / 2.0f) + (float)reference.getWidth() / 2.0f);
+ const int coordY1 = (int)((-0.5f * (float)reference.getHeight() / 2.0f) + (float)reference.getHeight() / 2.0f);
+ const int coordX2 = (int)(( 0.5f * (float)reference.getWidth() / 2.0f) + (float)reference.getWidth() / 2.0f);
+ const int coordY2 = (int)(( 0.5f * (float)reference.getHeight() / 2.0f) + (float)reference.getHeight() / 2.0f);
for (int x = 0; x < reference.getWidth(); x++)
{
@@ -205,7 +205,7 @@
render(reference);
std::vector<deUint8> pixelData;
- const int rowPitch = m_alignment * deCeilFloatToInt32(pixelSize * width / (float)m_alignment);
+ const int rowPitch = m_alignment * deCeilFloatToInt32(float(pixelSize * width) / (float)m_alignment);
pixelData.resize(rowPitch * height, 0);
@@ -215,10 +215,10 @@
if (m_context.getRenderTarget().getNumSamples() > 1)
{
const tcu::IVec4 formatBitDepths = tcu::getTextureFormatBitDepth(format);
- const deUint8 redThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits, formatBitDepths.x()))));
- const deUint8 greenThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits, formatBitDepths.y()))));
- const deUint8 blueThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits, formatBitDepths.z()))));
- const deUint8 alphaThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits, formatBitDepths.w()))));
+ const deUint8 redThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits, formatBitDepths.x()))));
+ const deUint8 greenThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits, formatBitDepths.y()))));
+ const deUint8 blueThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits, formatBitDepths.z()))));
+ const deUint8 alphaThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits, formatBitDepths.w()))));
// bilinearCompare only accepts RGBA, UINT8
tcu::Texture2D referenceRGBA8 (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), width, height);
@@ -238,10 +238,10 @@
else
{
const tcu::IVec4 formatBitDepths = tcu::getTextureFormatBitDepth(format);
- const float redThreshold = 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits, formatBitDepths.x()));
- const float greenThreshold = 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits, formatBitDepths.y()));
- const float blueThreshold = 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits, formatBitDepths.z()));
- const float alphaThreshold = 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits, formatBitDepths.w()));
+ const float redThreshold = 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits, formatBitDepths.x()));
+ const float greenThreshold = 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits, formatBitDepths.y()));
+ const float blueThreshold = 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits, formatBitDepths.z()));
+ const float alphaThreshold = 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits, formatBitDepths.w()));
// Compare
if (tcu::floatThresholdCompare(m_testCtx.getLog(), "Result", "Result", reference.getLevel(0), tcu::PixelBufferAccess(format, width, height, 1, rowPitch, 0, &(pixelData[0])), tcu::Vec4(redThreshold, greenThreshold, blueThreshold, alphaThreshold), tcu::COMPARE_LOG_RESULT))
diff --git a/modules/gles2/functional/es2fShaderBuiltinVarTests.cpp b/modules/gles2/functional/es2fShaderBuiltinVarTests.cpp
index 9129c51..a987cc1 100644
--- a/modules/gles2/functional/es2fShaderBuiltinVarTests.cpp
+++ b/modules/gles2/functional/es2fShaderBuiltinVarTests.cpp
@@ -540,8 +540,8 @@
{
for (int xo = 0; xo < w; xo++)
{
- const float xf = float(xo+0.5f) / float(w);
- const float yf = float((h-yo-1)+0.5f) / float(h);
+ const float xf = (float(xo)+0.5f) / float(w);
+ const float yf = (float(h-yo-1)+0.5f) / float(h);
const tcu::Vec4 color (xf, yf, 0.0f, 1.0f);
const int dx = x0+xo;
const int dy = y0+yo;
diff --git a/modules/gles2/functional/es2fShaderLoopTests.cpp b/modules/gles2/functional/es2fShaderLoopTests.cpp
index 8da0b44..64df20b 100644
--- a/modules/gles2/functional/es2fShaderLoopTests.cpp
+++ b/modules/gles2/functional/es2fShaderLoopTests.cpp
@@ -390,7 +390,7 @@
else
{
if (loopCountType == LOOPCOUNT_CONSTANT)
- incrementStr = string("ndx += ") + de::toString(1.0f / numLoopIters);
+ incrementStr = string("ndx += ") + de::toString(1.0f / (float)numLoopIters);
else if (loopCountType == LOOPCOUNT_UNIFORM)
incrementStr = string("ndx += ") + getFloatFractionUniformName(numLoopIters);
else if (loopCountType == LOOPCOUNT_DYNAMIC)
diff --git a/modules/gles2/functional/es2fShaderOperatorTests.cpp b/modules/gles2/functional/es2fShaderOperatorTests.cpp
index 64f5854..e967d92 100644
--- a/modules/gles2/functional/es2fShaderOperatorTests.cpp
+++ b/modules/gles2/functional/es2fShaderOperatorTests.cpp
@@ -165,7 +165,7 @@
// Reference for expression "in0++, in1 = in0 + in2, in2 = in1"
inline Vec4 sequenceSideEffCase0 (const Vec4& in0, const Vec4& in1, const Vec4& in2) { DE_UNREF(in1); return in0 + 1.0f + in2; }
// Reference for expression "in1++, in0 = float(in1), in1 = int(in0 + in2)"
-inline int sequenceSideEffCase1 (float in0, int in1, float in2) { DE_UNREF(in0); return (int)(in1 + 1.0f + in2); }
+inline int sequenceSideEffCase1 (float in0, int in1, float in2) { DE_UNREF(in0); return (int)(float(in1) + 1.0f + in2); }
// Reference for expression "in1 = in0, in2++, in2 = in2 + vec2(in1), ivec2(in2)"
inline IVec2 sequenceSideEffCase2 (bool in0, bool in1, const Vec2& in2) { DE_UNREF(in1); return (in2 + Vec2(1.0f) + Vec2((float)in0)).asInt(); }
// Reference for expression "in0 = in0 + vec4(in2), in1 = in1 + ivec4(in0), in1++"
@@ -617,31 +617,31 @@
Vector<T, Size> nop (const Vector<T, Size>& v) { return v; }
#define DECLARE_UNARY_GENTYPE_FUNCS(FUNC_NAME) \
- void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].z()); } \
+ void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2)).x(); } \
void eval_##FUNC_NAME##_vec2 (ShaderEvalContext& c) { c.color.yz() = FUNC_NAME(c.in[0].swizzle(3, 1)); } \
void eval_##FUNC_NAME##_vec3 (ShaderEvalContext& c) { c.color.xyz() = FUNC_NAME(c.in[0].swizzle(2, 0, 1)); } \
void eval_##FUNC_NAME##_vec4 (ShaderEvalContext& c) { c.color = FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0)); }
#define DECLARE_BINARY_GENTYPE_FUNCS(FUNC_NAME) \
- void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].z(), c.in[1].x()); } \
+ void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2), c.in[1].swizzle(0)).x(); } \
void eval_##FUNC_NAME##_vec2 (ShaderEvalContext& c) { c.color.yz() = FUNC_NAME(c.in[0].swizzle(3, 1), c.in[1].swizzle(1, 0)); } \
void eval_##FUNC_NAME##_vec3 (ShaderEvalContext& c) { c.color.xyz() = FUNC_NAME(c.in[0].swizzle(2, 0, 1), c.in[1].swizzle(1, 2, 0)); } \
void eval_##FUNC_NAME##_vec4 (ShaderEvalContext& c) { c.color = FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0), c.in[1].swizzle(3, 2, 1, 0)); }
#define DECLARE_TERNARY_GENTYPE_FUNCS(FUNC_NAME) \
- void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].z(), c.in[1].x(), c.in[2].y()); } \
+ void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2), c.in[1].swizzle(0), c.in[2].swizzle(1)).x(); } \
void eval_##FUNC_NAME##_vec2 (ShaderEvalContext& c) { c.color.yz() = FUNC_NAME(c.in[0].swizzle(3, 1), c.in[1].swizzle(1, 0), c.in[2].swizzle(2, 1)); } \
void eval_##FUNC_NAME##_vec3 (ShaderEvalContext& c) { c.color.xyz() = FUNC_NAME(c.in[0].swizzle(2, 0, 1), c.in[1].swizzle(1, 2, 0), c.in[2].swizzle(3, 1, 2)); } \
void eval_##FUNC_NAME##_vec4 (ShaderEvalContext& c) { c.color = FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0), c.in[1].swizzle(3, 2, 1, 0), c.in[2].swizzle(0, 3, 2, 1)); }
#define DECLARE_UNARY_SCALAR_GENTYPE_FUNCS(FUNC_NAME) \
- void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].z()); } \
+ void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2)); } \
void eval_##FUNC_NAME##_vec2 (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(3, 1)); } \
void eval_##FUNC_NAME##_vec3 (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2, 0, 1)); } \
void eval_##FUNC_NAME##_vec4 (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0)); }
#define DECLARE_BINARY_SCALAR_GENTYPE_FUNCS(FUNC_NAME) \
- void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].z(), c.in[1].x()); } \
+ void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2), c.in[1].swizzle(0)); } \
void eval_##FUNC_NAME##_vec2 (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(3, 1), c.in[1].swizzle(1, 0)); } \
void eval_##FUNC_NAME##_vec3 (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2, 0, 1), c.in[1].swizzle(1, 2, 0)); } \
void eval_##FUNC_NAME##_vec4 (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0), c.in[1].swizzle(3, 2, 1, 0)); }
diff --git a/modules/gles2/functional/es2fShaderTextureFunctionTests.cpp b/modules/gles2/functional/es2fShaderTextureFunctionTests.cpp
index 13a4428..4f2366e 100644
--- a/modules/gles2/functional/es2fShaderTextureFunctionTests.cpp
+++ b/modules/gles2/functional/es2fShaderTextureFunctionTests.cpp
@@ -343,7 +343,7 @@
m_texture2D = new glu::Texture2D(m_renderCtx, m_textureSpec.format, m_textureSpec.dataType, m_textureSpec.width, m_textureSpec.height);
for (int level = 0; level < m_textureSpec.numLevels; level++)
{
- float fA = level*cStep;
+ float fA = float(level)*cStep;
float fB = 1.0f-fA;
Vec4 colorA = cBias + cScale*Vec4(fA, fB, fA, fB);
Vec4 colorB = cBias + cScale*Vec4(fB, fA, fB, fA);
@@ -354,8 +354,8 @@
m_texture2D->upload();
// Compute LOD.
- float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*m_textureSpec.width / (float)viewportSize[0];
- float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*m_textureSpec.height / (float)viewportSize[1];
+ float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width / (float)viewportSize[0];
+ float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height / (float)viewportSize[1];
m_lookupParams.lod = computeLodFromDerivates(dudx, 0.0f, 0.0f, dvdy);
// Append to texture list.
@@ -374,7 +374,7 @@
m_textureCube = new glu::TextureCube(m_renderCtx, m_textureSpec.format, m_textureSpec.dataType, m_textureSpec.width);
for (int level = 0; level < m_textureSpec.numLevels; level++)
{
- float fA = level*cStep;
+ float fA = float(level)*cStep;
float fB = 1.0f-fA;
Vec2 f (fA, fB);
@@ -399,8 +399,8 @@
tcu::CubeFaceFloatCoords c00 = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
tcu::CubeFaceFloatCoords c10 = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.maxCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
tcu::CubeFaceFloatCoords c01 = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.maxCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
- float dudx = (c10.s - c00.s)*m_textureSpec.width / (float)viewportSize[0];
- float dvdy = (c01.t - c00.t)*m_textureSpec.height / (float)viewportSize[1];
+ float dudx = (c10.s - c00.s)*(float)m_textureSpec.width / (float)viewportSize[0];
+ float dvdy = (c01.t - c00.t)*(float)m_textureSpec.height / (float)viewportSize[1];
m_lookupParams.lod = computeLodFromDerivates(dudx, 0.0f, 0.0f, dvdy);
diff --git a/modules/gles2/functional/es2fVertexTextureTests.cpp b/modules/gles2/functional/es2fVertexTextureTests.cpp
index f86afad..432b2a4 100644
--- a/modules/gles2/functional/es2fVertexTextureTests.cpp
+++ b/modules/gles2/functional/es2fVertexTextureTests.cpp
@@ -248,13 +248,13 @@
for (int i = 0; i < DE_LENGTH_OF_ARRAY(quadVertices); i++)
m_positions.push_back(safeCoords(quadVertices[i], renderSize, Vec2(0.0f)) * 2.0f - 1.0f);
- m_indices.push_back(firstNdx + 0);
- m_indices.push_back(firstNdx + 1);
- m_indices.push_back(firstNdx + 2);
+ m_indices.push_back(deUint16(firstNdx + 0));
+ m_indices.push_back(deUint16(firstNdx + 1));
+ m_indices.push_back(deUint16(firstNdx + 2));
- m_indices.push_back(firstNdx + 1);
- m_indices.push_back(firstNdx + 3);
- m_indices.push_back(firstNdx + 2);
+ m_indices.push_back(deUint16(firstNdx + 1));
+ m_indices.push_back(deUint16(firstNdx + 3));
+ m_indices.push_back(deUint16(firstNdx + 2));
}
m_texCoords.reserve(m_gridSize*m_gridSize*4);
@@ -348,7 +348,7 @@
DE_ASSERT(deInBounds32(ix + region.x, 0, dst.getWidth()));
DE_ASSERT(deInBounds32(iy + region.y, 0, dst.getHeight()));
- dst.setPixel(ix + region.x, iy + region.y, toRGBA(color));
+ dst.setPixel(ix + region.x, iy + region.y, tcu::RGBA(color));
}
}
}
diff --git a/modules/gles2/performance/es2pDrawCallBatchingTests.cpp b/modules/gles2/performance/es2pDrawCallBatchingTests.cpp
index b2426aa..135e53c 100644
--- a/modules/gles2/performance/es2pDrawCallBatchingTests.cpp
+++ b/modules/gles2/performance/es2pDrawCallBatchingTests.cpp
@@ -175,9 +175,9 @@
{
for (int triangleNdx = 0; triangleNdx < m_spec.triangleCount; triangleNdx++)
{
- m_dynamicIndexData.push_back(triangleNdx * 3);
- m_dynamicIndexData.push_back(triangleNdx * 3 + 1);
- m_dynamicIndexData.push_back(triangleNdx * 3 + 2);
+ m_dynamicIndexData.push_back(deUint8(triangleNdx * 3));
+ m_dynamicIndexData.push_back(deUint8(triangleNdx * 3 + 1));
+ m_dynamicIndexData.push_back(deUint8(triangleNdx * 3 + 2));
}
}
}
@@ -187,9 +187,9 @@
{
for (int triangleNdx = 0; triangleNdx < m_spec.triangleCount; triangleNdx++)
{
- m_staticIndexData.push_back(triangleNdx * 3);
- m_staticIndexData.push_back(triangleNdx * 3 + 1);
- m_staticIndexData.push_back(triangleNdx * 3 + 2);
+ m_staticIndexData.push_back(deUint8(triangleNdx * 3));
+ m_staticIndexData.push_back(deUint8(triangleNdx * 3 + 1));
+ m_staticIndexData.push_back(deUint8(triangleNdx * 3 + 2));
}
}
}
@@ -277,18 +277,18 @@
{
int sign = (m_spec.triangleCount % 2 == 1 || i % 2 == 0 ? 1 : -1);
- data.push_back(-127 * sign);
- data.push_back(-127 * sign);
+ data.push_back(deInt8(-127 * sign));
+ data.push_back(deInt8(-127 * sign));
data.push_back(0);
data.push_back(127);
- data.push_back(127 * sign);
- data.push_back(-127 * sign);
+ data.push_back(deInt8(127 * sign));
+ data.push_back(deInt8(-127 * sign));
data.push_back(0);
data.push_back(127);
- data.push_back(127 * sign);
- data.push_back(127 * sign);
+ data.push_back(deInt8(127 * sign));
+ data.push_back(deInt8(127 * sign));
data.push_back(0);
data.push_back(127);
}
@@ -298,7 +298,7 @@
data.reserve(4 * 3 * m_spec.triangleCount * m_spec.drawCallCount);
for (int i = 0; i < 4 * 3 * m_spec.triangleCount * m_spec.drawCallCount; i++)
- data.push_back(m_rnd.getUint32());
+ data.push_back((deInt8)m_rnd.getUint32());
}
m_staticAttributeDatas.push_back(data);
@@ -317,18 +317,18 @@
{
int sign = (i % 2 == 0 ? 1 : -1);
- data.push_back(-127 * sign);
- data.push_back(-127 * sign);
+ data.push_back(deInt8(-127 * sign));
+ data.push_back(deInt8(-127 * sign));
data.push_back(0);
data.push_back(127);
- data.push_back(127 * sign);
- data.push_back(-127 * sign);
+ data.push_back(deInt8(127 * sign));
+ data.push_back(deInt8(-127 * sign));
data.push_back(0);
data.push_back(127);
- data.push_back(127 * sign);
- data.push_back(127 * sign);
+ data.push_back(deInt8(127 * sign));
+ data.push_back(deInt8(127 * sign));
data.push_back(0);
data.push_back(127);
}
@@ -338,7 +338,7 @@
data.reserve(4 * 3 * m_spec.triangleCount * m_spec.drawCallCount);
for (int i = 0; i < 4 * 3 * m_spec.triangleCount * m_spec.drawCallCount; i++)
- data.push_back(m_rnd.getUint32());
+ data.push_back((deInt8)m_rnd.getUint32());
}
m_dynamicAttributeDatas.push_back(data);
@@ -859,7 +859,7 @@
}
else if (m_state == STATE_SAMPLE)
{
- if ((int)m_unbatchedSamplesUs.size() < m_unbatchedSampleCount && (m_unbatchedSamplesUs.size() / ((double)m_unbatchedSampleCount) < m_batchedSamplesUs.size() / ((double)m_batchedSampleCount) || (int)m_batchedSamplesUs.size() >= m_batchedSampleCount))
+ if ((int)m_unbatchedSamplesUs.size() < m_unbatchedSampleCount && ((double)m_unbatchedSamplesUs.size() / ((double)m_unbatchedSampleCount) < (double)m_batchedSamplesUs.size() / ((double)m_batchedSampleCount) || (int)m_batchedSamplesUs.size() >= m_batchedSampleCount))
m_unbatchedSamplesUs.push_back(renderUnbatched());
else if ((int)m_batchedSamplesUs.size() < m_batchedSampleCount)
m_batchedSamplesUs.push_back(renderBatched());
diff --git a/modules/gles2/performance/es2pShaderCompilationCases.cpp b/modules/gles2/performance/es2pShaderCompilationCases.cpp
index 7b3d436..21ec8ef 100644
--- a/modules/gles2/performance/es2pShaderCompilationCases.cpp
+++ b/modules/gles2/performance/es2pShaderCompilationCases.cpp
@@ -2028,10 +2028,10 @@
// Log this measurement.
log << TestLog::Float("Measurement" + de::toString(ndx) + "CompilationTime",
"Measurement " + de::toString(ndx) + " compilation time",
- "ms", QP_KEY_TAG_TIME, timeWithoutDraw / 1000.0f)
+ "ms", QP_KEY_TAG_TIME, (float)timeWithoutDraw / 1000.0f)
<< TestLog::Float("Measurement" + de::toString(ndx) + "SpecializationTime",
"Measurement " + de::toString(ndx) + " specialization time",
- "ms", QP_KEY_TAG_TIME, specializationTime / 1000.0f);
+ "ms", QP_KEY_TAG_TIME, (float)specializationTime / 1000.0f);
}
// Log some statistics.
@@ -2565,7 +2565,7 @@
// Log this measurement.
log << TestLog::Float("Measurement" + de::toString(ndx) + "Time",
"Measurement " + de::toString(ndx) + " time",
- "ms", QP_KEY_TAG_TIME, measurements[ndx].totalTime()/1000.0f);
+ "ms", QP_KEY_TAG_TIME, (float)measurements[ndx].totalTime()/1000.0f);
}
// Log some statistics.
diff --git a/modules/gles2/performance/es2pTextureUploadTests.cpp b/modules/gles2/performance/es2pTextureUploadTests.cpp
index a2600f1..add6c02 100644
--- a/modules/gles2/performance/es2pTextureUploadTests.cpp
+++ b/modules/gles2/performance/es2pTextureUploadTests.cpp
@@ -261,7 +261,7 @@
vector<deUint64>::const_iterator middle = first + (last - first) / 2;
deUint64 medianFrameTime = *middle;
- double medianMTexelsPerSeconds = (double)(m_texSize*m_texSize*measureState.numDrawCalls) / medianFrameTime;
+ double medianMTexelsPerSeconds = (double)(m_texSize*m_texSize*measureState.numDrawCalls) / (double)medianFrameTime;
double medianTexelDrawDurationNs = (double)medianFrameTime * 1000.0 / (double)(m_texSize*m_texSize*measureState.numDrawCalls);
deUint64 totalTime = measureState.getTotalTime();
diff --git a/modules/gles2/stress/es2sSpecialFloatTests.cpp b/modules/gles2/stress/es2sSpecialFloatTests.cpp
index 9396c40..5730abb 100644
--- a/modules/gles2/stress/es2sSpecialFloatTests.cpp
+++ b/modules/gles2/stress/es2sSpecialFloatTests.cpp
@@ -624,13 +624,13 @@
{
const int baseNdx = (x * (DE_LENGTH_OF_ARRAY(s_specialFloats) - 1) + y) * 6;
- indices[baseNdx + 0] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
- indices[baseNdx + 1] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
- indices[baseNdx + 2] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
+ indices[baseNdx + 0] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+ indices[baseNdx + 1] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+ indices[baseNdx + 2] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
- indices[baseNdx + 3] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
- indices[baseNdx + 4] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
- indices[baseNdx + 5] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
+ indices[baseNdx + 3] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+ indices[baseNdx + 4] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+ indices[baseNdx + 5] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
}
m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a grid with the shader. Setting a_attr for each vertex to (special, special, 1, 1)." << tcu::TestLog::EndMessage;
@@ -843,13 +843,13 @@
{
const int baseNdx = (x * (DE_LENGTH_OF_ARRAY(s_specialFloats)) + y) * 6;
- indices[baseNdx + 0] = (x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0);
- indices[baseNdx + 1] = (x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1);
- indices[baseNdx + 2] = (x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0);
+ indices[baseNdx + 0] = (deUint16)((x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0));
+ indices[baseNdx + 1] = (deUint16)((x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1));
+ indices[baseNdx + 2] = (deUint16)((x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0));
- indices[baseNdx + 3] = (x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0);
- indices[baseNdx + 4] = (x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1);
- indices[baseNdx + 5] = (x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1);
+ indices[baseNdx + 3] = (deUint16)((x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0));
+ indices[baseNdx + 4] = (deUint16)((x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1));
+ indices[baseNdx + 5] = (deUint16)((x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1));
}
m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a grid with the shader. Setting u_special for vertex each tile to (special, special, 1, 1)." << tcu::TestLog::EndMessage;
@@ -1148,13 +1148,13 @@
{
const int baseNdx = (x * (DE_LENGTH_OF_ARRAY(s_specialFloats) - 1) + y) * 6;
- indices[baseNdx + 0] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
- indices[baseNdx + 1] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
- indices[baseNdx + 2] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
+ indices[baseNdx + 0] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+ indices[baseNdx + 1] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+ indices[baseNdx + 2] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
- indices[baseNdx + 3] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
- indices[baseNdx + 4] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
- indices[baseNdx + 5] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
+ indices[baseNdx + 3] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+ indices[baseNdx + 4] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+ indices[baseNdx + 5] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
}
m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a textured grid with the shader. Sampling from the texture using special floating point values." << tcu::TestLog::EndMessage;
@@ -1335,13 +1335,13 @@
{
const int baseNdx = y * 6;
- indices[baseNdx + 0] = (y + 0) * 2;
- indices[baseNdx + 1] = (y + 1) * 2;
- indices[baseNdx + 2] = (y + 1) * 2 + 1;
+ indices[baseNdx + 0] = (deUint16)((y + 0) * 2);
+ indices[baseNdx + 1] = (deUint16)((y + 1) * 2);
+ indices[baseNdx + 2] = (deUint16)((y + 1) * 2 + 1);
- indices[baseNdx + 3] = (y + 0) * 2;
- indices[baseNdx + 4] = (y + 1) * 2 + 1;
- indices[baseNdx + 5] = (y + 0) * 2 + 1;
+ indices[baseNdx + 3] = (deUint16)((y + 0) * 2);
+ indices[baseNdx + 4] = (deUint16)((y + 1) * 2 + 1);
+ indices[baseNdx + 5] = (deUint16)((y + 0) * 2 + 1);
}
// Draw grids
@@ -1531,13 +1531,13 @@
{
const int baseNdx = (x * numBlendFuncs + y) * 6;
- indices[baseNdx + 0] = (x+0) * (numBlendFuncs + 1) + (y+0);
- indices[baseNdx + 1] = (x+1) * (numBlendFuncs + 1) + (y+1);
- indices[baseNdx + 2] = (x+1) * (numBlendFuncs + 1) + (y+0);
+ indices[baseNdx + 0] = (deUint16)((x+0) * (numBlendFuncs + 1) + (y+0));
+ indices[baseNdx + 1] = (deUint16)((x+1) * (numBlendFuncs + 1) + (y+1));
+ indices[baseNdx + 2] = (deUint16)((x+1) * (numBlendFuncs + 1) + (y+0));
- indices[baseNdx + 3] = (x+0) * (numBlendFuncs + 1) + (y+0);
- indices[baseNdx + 4] = (x+1) * (numBlendFuncs + 1) + (y+1);
- indices[baseNdx + 5] = (x+0) * (numBlendFuncs + 1) + (y+1);
+ indices[baseNdx + 3] = (deUint16)((x+0) * (numBlendFuncs + 1) + (y+0));
+ indices[baseNdx + 4] = (deUint16)((x+1) * (numBlendFuncs + 1) + (y+1));
+ indices[baseNdx + 5] = (deUint16)((x+0) * (numBlendFuncs + 1) + (y+1));
}
// Draw tiles
@@ -1670,9 +1670,9 @@
gl.uniform4fv(uColorLoc, 1, color.getPtr());
deUint16 indices[3];
- indices[0] = rnd.getInt(0, maxVertexIndex);
- indices[1] = rnd.getInt(0, maxVertexIndex);
- indices[2] = rnd.getInt(0, maxVertexIndex);
+ indices[0] = (deUint16)rnd.getInt(0, maxVertexIndex);
+ indices[1] = (deUint16)rnd.getInt(0, maxVertexIndex);
+ indices[2] = (deUint16)rnd.getInt(0, maxVertexIndex);
gl.drawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, indices);
}
diff --git a/modules/gles3/functional/es3fASTCDecompressionCases.cpp b/modules/gles3/functional/es3fASTCDecompressionCases.cpp
index 9611fab..c668dfd 100644
--- a/modules/gles3/functional/es3fASTCDecompressionCases.cpp
+++ b/modules/gles3/functional/es3fASTCDecompressionCases.cpp
@@ -1387,10 +1387,10 @@
{
// Void extent block.
const bool isVoidExtentHDR = rnd.getBool();
- const deUint16 r = isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : rnd.getInt(0, 0xffff);
- const deUint16 g = isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : rnd.getInt(0, 0xffff);
- const deUint16 b = isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : rnd.getInt(0, 0xffff);
- const deUint16 a = isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : rnd.getInt(0, 0xffff);
+ const deUint16 r = isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : (deUint16)rnd.getInt(0, 0xffff);
+ const deUint16 g = isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : (deUint16)rnd.getInt(0, 0xffff);
+ const deUint16 b = isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : (deUint16)rnd.getInt(0, 0xffff);
+ const deUint16 a = isVoidExtentHDR ? deFloat32To16(rnd.getFloat(0.0f, 1.0f)) : (deUint16)rnd.getInt(0, 0xffff);
generateVoidExtentBlock(VoidExtentParams(isVoidExtentHDR, r, g, b, a)).pushBytesToVector(dst);
}
else
diff --git a/modules/gles3/functional/es3fApiCase.cpp b/modules/gles3/functional/es3fApiCase.cpp
index 892ad35..fdc5d1b 100644
--- a/modules/gles3/functional/es3fApiCase.cpp
+++ b/modules/gles3/functional/es3fApiCase.cpp
@@ -88,7 +88,12 @@
void ApiCase::checkBooleans (deUint8 value, deUint8 expected)
{
- if (value != expected)
+ checkBooleans((deInt32)value, expected);
+}
+
+void ApiCase::checkBooleans (deInt32 value, deUint8 expected)
+{
+ if (value != (deInt32)expected)
{
m_log << TestLog::Message << "// ERROR: expected " << (expected ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage;
if (m_testCtx.getTestResult() == QP_TEST_RESULT_PASS)
diff --git a/modules/gles3/functional/es3fApiCase.hpp b/modules/gles3/functional/es3fApiCase.hpp
index b644282..9038a27 100644
--- a/modules/gles3/functional/es3fApiCase.hpp
+++ b/modules/gles3/functional/es3fApiCase.hpp
@@ -50,6 +50,7 @@
void expectError (deUint32 error0, deUint32 error1);
void getSupportedExtensions (const deUint32 numSupportedValues, const deUint32 extension, std::vector<int>& values);
void checkBooleans (deUint8 value, deUint8 expected);
+ void checkBooleans (deInt32 value, deUint8 expected);
tcu::TestLog& m_log;
};
diff --git a/modules/gles3/functional/es3fClippingTests.cpp b/modules/gles3/functional/es3fClippingTests.cpp
index 5368229..f2b45fa 100644
--- a/modules/gles3/functional/es3fClippingTests.cpp
+++ b/modules/gles3/functional/es3fClippingTests.cpp
@@ -1995,8 +1995,8 @@
const tcu::IVec3 r1 = outside[ndx1];
const tcu::IVec3 r2 = outside[ndx2];
const tcu::Vec4 p0 = tcu::Vec4(r0.x() * w0, r0.y() * w0, r0.z() * w0, w0);
- const tcu::Vec4 p1 = tcu::Vec4(r1.x() * far * w1, r1.y() * far * w1, r1.z() * far * w1, w1);
- const tcu::Vec4 p2 = tcu::Vec4(r2.x() * far * w2, r2.y() * far * w2, r2.z() * far * w2, w2);
+ const tcu::Vec4 p1 = tcu::Vec4(float(r1.x()) * far * w1, float(r1.y()) * far * w1, float(r1.z()) * far * w1, w1);
+ const tcu::Vec4 p2 = tcu::Vec4(float(r2.x()) * far * w2, float(r2.y()) * far * w2, float(r2.z()) * far * w2, w2);
const std::string name = std::string("clip") +
(outside[ndx1].x() > 0 ? "_pos_x" : (outside[ndx1].x() < 0 ? "_neg_x" : "")) +
@@ -2027,9 +2027,9 @@
const tcu::IVec3 r0 = outside[ndx1];
const tcu::IVec3 r1 = outside[ndx2];
const tcu::IVec3 r2 = outside[ndx3];
- const tcu::Vec4 p0 = tcu::Vec4(r0.x() * far * w0, r0.y() * far * w0, r0.z() * far * w0, w0);
- const tcu::Vec4 p1 = tcu::Vec4(r1.x() * far * w1, r1.y() * far * w1, r1.z() * far * w1, w1);
- const tcu::Vec4 p2 = tcu::Vec4(r2.x() * far * w2, r2.y() * far * w2, r2.z() * far * w2, w2);
+ const tcu::Vec4 p0 = tcu::Vec4(float(r0.x()) * far * w0, float(r0.y()) * far * w0, float(r0.z()) * far * w0, w0);
+ const tcu::Vec4 p1 = tcu::Vec4(float(r1.x()) * far * w1, float(r1.y()) * far * w1, float(r1.z()) * far * w1, w1);
+ const tcu::Vec4 p2 = tcu::Vec4(float(r2.x()) * far * w2, float(r2.y()) * far * w2, float(r2.z()) * far * w2, w2);
// ignore cases where polygon is along xz or yz planes
if (pointsOnLine(r0.swizzle(0, 1), r1.swizzle(0, 1), r2.swizzle(0, 1)))
diff --git a/modules/gles3/functional/es3fColorClearTest.cpp b/modules/gles3/functional/es3fColorClearTest.cpp
index 9a75ecd..8b8a28b 100644
--- a/modules/gles3/functional/es3fColorClearTest.cpp
+++ b/modules/gles3/functional/es3fColorClearTest.cpp
@@ -147,7 +147,7 @@
int b = (int)(rnd.getUint32() & 0xFF);
int a = m_testAlpha ? (int)(rnd.getUint32() & 0xFF) : 0xFF;
RGBA clearCol(r, g, b, a);
- gl.clearColor(r/255.0f, g/255.0f, b/255.0f, a/255.0f);
+ gl.clearColor(float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, float(a)/255.0f);
// Mask.
deUint8 clearMask;
diff --git a/modules/gles3/functional/es3fDepthStencilClearTests.cpp b/modules/gles3/functional/es3fDepthStencilClearTests.cpp
index 112757b..0138bc8 100644
--- a/modules/gles3/functional/es3fDepthStencilClearTests.cpp
+++ b/modules/gles3/functional/es3fDepthStencilClearTests.cpp
@@ -327,7 +327,7 @@
if (m_testDepth)
{
int numSteps = DEPTH_STEPS;
- float step = 2.0f / numSteps;
+ float step = 2.0f / (float)numSteps;
gl.enable (GL_DEPTH_TEST);
gl.depthFunc(GL_LESS);
@@ -336,7 +336,7 @@
for (int ndx = 0; ndx < numSteps; ndx++)
{
- float d = -1.0f + step*ndx;
+ float d = -1.0f + step*(float)ndx;
float c = (float)ndx / (float)(numSteps-1);
float pos[] =
{
diff --git a/modules/gles3/functional/es3fDepthStencilTests.cpp b/modules/gles3/functional/es3fDepthStencilTests.cpp
index 861d2a0..09958d8 100644
--- a/modules/gles3/functional/es3fDepthStencilTests.cpp
+++ b/modules/gles3/functional/es3fDepthStencilTests.cpp
@@ -271,10 +271,10 @@
// Compute depth values
{
int numValues = DE_LENGTH_OF_ARRAY(depthValues);
- float depthStep = 2.0f/(numValues-1);
+ float depthStep = 2.0f/(float)(numValues-1);
for (int ndx = 0; ndx < numValues; ndx++)
- depthValues[ndx] = -1.0f + depthStep*ndx;
+ depthValues[ndx] = -1.0f + depthStep*(float)ndx;
}
for (int y0 = 0; y0 < numL0CellsY; y0++)
@@ -322,7 +322,7 @@
cmd.params.visibleFace = rr::FACETYPE_FRONT;
cmd.rect = rr::WindowRectangle(0, 0, target.width, target.height);
- cmd.color = Vec4(0.0f, 0.0f, colorStep*ndx, 0.0f);
+ cmd.color = Vec4(0.0f, 0.0f, colorStep*(float)ndx, 0.0f);
cmd.colorMask = tcu::BVec4(false, false, true, false);
cmd.params.depth = depthSteps[ndx]+epsilon;
cmd.params.depthTestEnabled = true;
@@ -347,7 +347,7 @@
cmd.params.visibleFace = rr::FACETYPE_FRONT;
cmd.rect = rr::WindowRectangle(0, 0, target.width, target.height);
- cmd.color = Vec4(0.0f, colorStep*(ndx+1), 0.0f, 0.0f);
+ cmd.color = Vec4(0.0f, colorStep*float(ndx+1), 0.0f, 0.0f);
cmd.colorMask = tcu::BVec4(false, true, false, false);
cmd.params.stencilTestEnabled = true;
diff --git a/modules/gles3/functional/es3fDrawTests.cpp b/modules/gles3/functional/es3fDrawTests.cpp
index efd8b48..54f0ece 100644
--- a/modules/gles3/functional/es3fDrawTests.cpp
+++ b/modules/gles3/functional/es3fDrawTests.cpp
@@ -688,8 +688,8 @@
deInt32 offsetLocation = ctx.getAttribLocation(programID, "a_offset");
deInt32 colorLocation = ctx.getAttribLocation(programID, "a_color");
- float cellW = 2.0f / m_gridSide;
- float cellH = 2.0f / m_gridSide;
+ float cellW = 2.0f / (float)m_gridSide;
+ float cellH = 2.0f / (float)m_gridSide;
const tcu::Vec4 vertexPositions[] =
{
tcu::Vec4(0, 0, 0, 1),
@@ -710,7 +710,7 @@
std::vector<tcu::Vec4> offsets;
for (int x = 0; x < m_gridSide; ++x)
for (int y = 0; y < m_gridSide; ++y)
- offsets.push_back(tcu::Vec4(x * cellW - 1.0f, y * cellW - 1.0f, 0, 0));
+ offsets.push_back(tcu::Vec4((float)x * cellW - 1.0f, (float)y * cellW - 1.0f, 0, 0));
std::vector<tcu::Vec4> colors;
for (int x = 0; x < m_gridSide; ++x)
diff --git a/modules/gles3/functional/es3fFboInvalidateTests.cpp b/modules/gles3/functional/es3fFboInvalidateTests.cpp
index 7fc9f26..5bfd62a 100644
--- a/modules/gles3/functional/es3fFboInvalidateTests.cpp
+++ b/modules/gles3/functional/es3fFboInvalidateTests.cpp
@@ -706,7 +706,7 @@
IVec2 quadSizePixels (m_numSamples == 0 ? getWidth() : de::min(128, getWidth()),
m_numSamples == 0 ? getHeight() : de::min(128, getHeight()));
Vec2 quadNDCLeftBottomXY (-1.0f, -1.0f);
- Vec2 quadNDCSize (2.0f*quadSizePixels.x()/getWidth(), 2.0f*quadSizePixels.y()/getHeight());
+ Vec2 quadNDCSize (2.0f*(float)quadSizePixels.x()/(float)getWidth(), 2.0f*(float)quadSizePixels.y()/(float)getHeight());
Vec2 quadNDCRightTopXY = quadNDCLeftBottomXY + quadNDCSize;
tcu::TextureFormat depthStencilFmt = m_depthStencilFmt != GL_NONE ? glu::mapGLInternalFormat(m_depthStencilFmt) : tcu::TextureFormat();
bool depth = depthStencilFmt.order == tcu::TextureFormat::D || depthStencilFmt.order == tcu::TextureFormat::DS;
@@ -1085,7 +1085,7 @@
IVec2 quadSizePixels (m_numSamples == 0 ? getWidth() : de::min(128, getWidth()),
m_numSamples == 0 ? getHeight() : de::min(128, getHeight()));
Vec2 quadNDCLeftBottomXY (-1.0f, -1.0f);
- Vec2 quadNDCSize (2.0f*quadSizePixels.x()/getWidth(), 2.0f*quadSizePixels.y()/getHeight());
+ Vec2 quadNDCSize (2.0f*(float)quadSizePixels.x()/(float)getWidth(), 2.0f*(float)quadSizePixels.y()/(float)getHeight());
Vec2 quadNDCRightTopXY = quadNDCLeftBottomXY + quadNDCSize;
tcu::TextureFormat depthStencilFmt = m_depthStencilFmt != GL_NONE ? glu::mapGLInternalFormat(m_depthStencilFmt) : tcu::TextureFormat();
bool depth = depthStencilFmt.order == tcu::TextureFormat::D || depthStencilFmt.order == tcu::TextureFormat::DS;
diff --git a/modules/gles3/functional/es3fFboMultisampleTests.cpp b/modules/gles3/functional/es3fFboMultisampleTests.cpp
index 0072c2e..c29cdb8 100644
--- a/modules/gles3/functional/es3fFboMultisampleTests.cpp
+++ b/modules/gles3/functional/es3fFboMultisampleTests.cpp
@@ -187,7 +187,7 @@
for (int ndx = 0; ndx < numSteps; ndx++)
{
- float d = -1.0f + step*ndx;
+ float d = -1.0f + step*(float)ndx;
float c = (float)ndx / (float)(numSteps-1);
flatShader.setColor(*getCurrentContext(), flatShaderID, Vec4(0.0f, 0.0f, c, 1.0f) * (colorFmtInfo.valueMax-colorFmtInfo.valueMin) + colorFmtInfo.valueMin);
diff --git a/modules/gles3/functional/es3fFloatStateQueryTests.cpp b/modules/gles3/functional/es3fFloatStateQueryTests.cpp
index 1c00af4..4c7f7a4 100644
--- a/modules/gles3/functional/es3fFloatStateQueryTests.cpp
+++ b/modules/gles3/functional/es3fFloatStateQueryTests.cpp
@@ -133,7 +133,7 @@
if (!state.verifyValidity(testCtx))
return;
- const GLboolean expectedGLState = reference ? GL_TRUE : GL_FALSE;
+ const GLboolean expectedGLState = reference != 0.0f ? GL_TRUE : GL_FALSE;
if (state != expectedGLState)
{
@@ -164,8 +164,8 @@
const GLboolean referenceAsGLBoolean[] =
{
- reference0 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
- reference1 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+ reference0 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+ reference1 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
};
if (boolVector2[0] != referenceAsGLBoolean[0] ||
@@ -193,10 +193,10 @@
const GLboolean referenceAsGLBoolean[] =
{
- reference0 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
- reference1 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
- reference2 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
- reference3 ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+ reference0 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+ reference1 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+ reference2 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
+ reference3 != 0.0f ? GLboolean(GL_TRUE) : GLboolean(GL_FALSE),
};
if (boolVector4[0] != referenceAsGLBoolean[0] ||
diff --git a/modules/gles3/functional/es3fFragDepthTests.cpp b/modules/gles3/functional/es3fFragDepthTests.cpp
index 5647765..d8d8dd8 100644
--- a/modules/gles3/functional/es3fFragDepthTests.cpp
+++ b/modules/gles3/functional/es3fFragDepthTests.cpp
@@ -235,7 +235,7 @@
// Render reference.
for (int y = 0; y < referenceFrame.getHeight(); y++)
{
- float yf = ((float)y + 0.5f) / referenceFrame.getHeight();
+ float yf = ((float)y + 0.5f) / (float)referenceFrame.getHeight();
int half = de::clamp((int)((float)referenceFrame.getWidth()*0.5f + 0.5f), 0, referenceFrame.getWidth());
// Fill left half - comparison to constant 0.5
@@ -252,7 +252,7 @@
for (int x = half; x < referenceFrame.getWidth(); x++)
{
float xf = ((float)x + 0.5f) / (float)referenceFrame.getWidth();
- float xh = ((float)x - half + 0.5f) / (float)(referenceFrame.getWidth()-half);
+ float xh = ((float)(x - half) + 0.5f) / (float)(referenceFrame.getWidth()-half);
float rd = 1.0f - (xh + yf) * 0.5f;
float d = m_evalFunc(Vec2(xf, yf));
bool dpass = compare(m_compareFunc, d, rd);
diff --git a/modules/gles3/functional/es3fFragmentOutputTests.cpp b/modules/gles3/functional/es3fFragmentOutputTests.cpp
index 1dc1415..53963cd 100644
--- a/modules/gles3/functional/es3fFragmentOutputTests.cpp
+++ b/modules/gles3/functional/es3fFragmentOutputTests.cpp
@@ -597,11 +597,11 @@
int quadY = quadNdx / (gridWidth-1);
int quadX = quadNdx - quadY*(gridWidth-1);
- indices[quadNdx*6+0] = quadX + quadY*gridWidth;
- indices[quadNdx*6+1] = quadX + (quadY+1)*gridWidth;
- indices[quadNdx*6+2] = quadX + quadY*gridWidth + 1;
+ indices[quadNdx*6+0] = deUint16(quadX + quadY*gridWidth);
+ indices[quadNdx*6+1] = deUint16(quadX + (quadY+1)*gridWidth);
+ indices[quadNdx*6+2] = deUint16(quadX + quadY*gridWidth + 1);
indices[quadNdx*6+3] = indices[quadNdx*6+1];
- indices[quadNdx*6+4] = quadX + (quadY+1)*gridWidth + 1;
+ indices[quadNdx*6+4] = deUint16(quadX + (quadY+1)*gridWidth + 1);
indices[quadNdx*6+5] = indices[quadNdx*6+2];
}
diff --git a/modules/gles3/functional/es3fInstancedRenderingTests.cpp b/modules/gles3/functional/es3fInstancedRenderingTests.cpp
index aec9c25..f55afd6 100644
--- a/modules/gles3/functional/es3fInstancedRenderingTests.cpp
+++ b/modules/gles3/functional/es3fInstancedRenderingTests.cpp
@@ -336,14 +336,14 @@
int ndx11 = (y + 1)*(QUAD_GRID_SIZE + 1) + x + 1;
// Lower-left triangle of a quad.
- m_gridIndices.push_back(ndx00);
- m_gridIndices.push_back(ndx10);
- m_gridIndices.push_back(ndx01);
+ m_gridIndices.push_back((deUint16)ndx00);
+ m_gridIndices.push_back((deUint16)ndx10);
+ m_gridIndices.push_back((deUint16)ndx01);
// Upper-right triangle of a quad.
- m_gridIndices.push_back(ndx11);
- m_gridIndices.push_back(ndx01);
- m_gridIndices.push_back(ndx10);
+ m_gridIndices.push_back((deUint16)ndx11);
+ m_gridIndices.push_back((deUint16)ndx01);
+ m_gridIndices.push_back((deUint16)ndx10);
}
}
else
@@ -495,7 +495,7 @@
int numRows = glu::getDataTypeMatrixNumRows(m_rgbAttrType);
int numCols = glu::getDataTypeMatrixNumColumns(m_rgbAttrType);
- glVertexAttribPointer(curLoc, numRows, GL_FLOAT, GL_FALSE, numCols*numRows*sizeof(float), attrPtr);
+ glVertexAttribPointer(curLoc, numRows, GL_FLOAT, GL_FALSE, numCols*numRows*(int)sizeof(float), attrPtr);
}
else
DE_ASSERT(DE_FALSE);
@@ -586,18 +586,18 @@
deInt32 intR = (deInt32)(r*FLOAT_INT_SCALE + FLOAT_INT_BIAS);
deInt32 intG = (deInt32)(g*FLOAT_INT_SCALE + FLOAT_INT_BIAS);
deInt32 intB = (deInt32)(b*FLOAT_INT_SCALE + FLOAT_INT_BIAS);
- r = (float)(intR - FLOAT_INT_BIAS) / FLOAT_INT_SCALE;
- g = (float)(intG - FLOAT_INT_BIAS) / FLOAT_INT_SCALE;
- b = (float)(intB - FLOAT_INT_BIAS) / FLOAT_INT_SCALE;
+ r = ((float)intR - FLOAT_INT_BIAS) / FLOAT_INT_SCALE;
+ g = ((float)intG - FLOAT_INT_BIAS) / FLOAT_INT_SCALE;
+ b = ((float)intB - FLOAT_INT_BIAS) / FLOAT_INT_SCALE;
}
else if(glu::isDataTypeUintOrUVec(m_rgbAttrType))
{
deUint32 uintR = (deInt32)(r*FLOAT_UINT_SCALE + FLOAT_UINT_BIAS);
deUint32 uintG = (deInt32)(g*FLOAT_UINT_SCALE + FLOAT_UINT_BIAS);
deUint32 uintB = (deInt32)(b*FLOAT_UINT_SCALE + FLOAT_UINT_BIAS);
- r = (float)(uintR - FLOAT_UINT_BIAS) / FLOAT_UINT_SCALE;
- g = (float)(uintG - FLOAT_UINT_BIAS) / FLOAT_UINT_SCALE;
- b = (float)(uintB - FLOAT_UINT_BIAS) / FLOAT_UINT_SCALE;
+ r = ((float)uintR - FLOAT_UINT_BIAS) / FLOAT_UINT_SCALE;
+ g = ((float)uintG - FLOAT_UINT_BIAS) / FLOAT_UINT_SCALE;
+ b = ((float)uintB - FLOAT_UINT_BIAS) / FLOAT_UINT_SCALE;
}
// Draw rectangle.
diff --git a/modules/gles3/functional/es3fMultisampleTests.cpp b/modules/gles3/functional/es3fMultisampleTests.cpp
index 64b4777..5d9edf7 100644
--- a/modules/gles3/functional/es3fMultisampleTests.cpp
+++ b/modules/gles3/functional/es3fMultisampleTests.cpp
@@ -668,7 +668,7 @@
for (int i = 0; i < numTriangles; i++)
{
float angle0 = 2.0f*DE_PI * (float)i / (float)numTriangles + 0.001f*(float)m_currentIteration;
- float angle1 = 2.0f*DE_PI * (float)(i + 0.5f) / (float)numTriangles + 0.001f*(float)m_currentIteration;
+ float angle1 = 2.0f*DE_PI * ((float)i + 0.5f) / (float)numTriangles + 0.001f*(float)m_currentIteration;
renderTriangle(Vec2(0.0f, 0.0f),
Vec2(deFloatCos(angle0)*0.95f, deFloatSin(angle0)*0.95f),
@@ -1138,7 +1138,7 @@
for (int i = 0; i < numTriangles; i++)
{
float angle0 = 2.0f*DE_PI * (float)i / (float)numTriangles;
- float angle1 = 2.0f*DE_PI * (float)(i + 0.5f) / (float)numTriangles;
+ float angle1 = 2.0f*DE_PI * ((float)i + 0.5f) / (float)numTriangles;
renderTriangle(Vec2(0.0f, 0.0f),
Vec2(deFloatCos(angle0)*0.95f, deFloatSin(angle0)*0.95f),
@@ -1544,7 +1544,7 @@
GLU_CHECK_CALL(glSampleCoverage((float)i / (float)(numTriangles-1), invertSampleCoverage ? GL_TRUE : GL_FALSE));
float angle0 = 2.0f*DE_PI * (float)i / (float)numTriangles;
- float angle1 = 2.0f*DE_PI * (float)(i + 0.5f) / (float)numTriangles;
+ float angle1 = 2.0f*DE_PI * ((float)i + 0.5f) / (float)numTriangles;
renderTriangle(Vec2(0.0f, 0.0f),
Vec2(deFloatCos(angle0)*0.95f, deFloatSin(angle0)*0.95f),
diff --git a/modules/gles3/functional/es3fNegativeTextureApiTests.cpp b/modules/gles3/functional/es3fNegativeTextureApiTests.cpp
index 1006028..93103a8 100644
--- a/modules/gles3/functional/es3fNegativeTextureApiTests.cpp
+++ b/modules/gles3/functional/es3fNegativeTextureApiTests.cpp
@@ -511,11 +511,11 @@
const size_t blockBytes = getBlockSize(tcuFormat);
const vector<deUint8> dummyData (blockBytes);
- glCompressedTexImage2D(GL_TEXTURE_2D, 0, format, blockPixels.x(), blockPixels.y(), 0, blockBytes, &dummyData[0]);
+ glCompressedTexImage2D(GL_TEXTURE_2D, 0, format, blockPixels.x(), blockPixels.y(), 0, (int)blockBytes, &dummyData[0]);
expectError(GL_INVALID_ENUM);
FOR_CUBE_FACES(faceGL,
{
- glCompressedTexImage2D(faceGL, 0, format, blockPixels.x(), blockPixels.y(), 0, blockBytes, &dummyData[0]);
+ glCompressedTexImage2D(faceGL, 0, format, blockPixels.x(), blockPixels.y(), 0, (int)blockBytes, &dummyData[0]);
expectError(GL_INVALID_ENUM);
});
}
@@ -2686,7 +2686,7 @@
const size_t blockBytes = getBlockSize(tcuFormat);
const vector<deUint8> dummyData (blockBytes);
- glCompressedTexImage3D(GL_TEXTURE_3D, 0, format, blockPixels.x(), blockPixels.y(), blockPixels.z(), 0, blockBytes, &dummyData[0]);
+ glCompressedTexImage3D(GL_TEXTURE_3D, 0, format, blockPixels.x(), blockPixels.y(), blockPixels.z(), 0, (int)blockBytes, &dummyData[0]);
expectError(requiredError);
}
}
diff --git a/modules/gles3/functional/es3fPrerequisiteTests.cpp b/modules/gles3/functional/es3fPrerequisiteTests.cpp
index 32e4dea..9ebc8f6 100644
--- a/modules/gles3/functional/es3fPrerequisiteTests.cpp
+++ b/modules/gles3/functional/es3fPrerequisiteTests.cpp
@@ -138,7 +138,7 @@
};
- glClearColor(r/255.0f, g/255.0f, b/255.0f, a/255.0f);
+ glClearColor(float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, float(a)/255.0f);
glClear(GL_COLOR_BUFFER_BIT);
GLU_CHECK_MSG("CLES2 ClearColor failed.");
@@ -225,7 +225,7 @@
int b = (int)(deRandom_getUint32(&rnd) & 0xFF);
tcu::clear(refImage.getAccess(), tcu::IVec4(r, g, b, 255));
- glClearColor(r/255.0f, g/255.0f, b/255.0f, 1.0f);
+ glClearColor(float(r)/255.0f, float(g)/255.0f, float(b)/255.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glu::readPixels(m_context.getRenderContext(), x, y, resImage.getAccess());
diff --git a/modules/gles3/functional/es3fPrimitiveRestartTests.cpp b/modules/gles3/functional/es3fPrimitiveRestartTests.cpp
index 70389bd..d926aec 100644
--- a/modules/gles3/functional/es3fPrimitiveRestartTests.cpp
+++ b/modules/gles3/functional/es3fPrimitiveRestartTests.cpp
@@ -413,7 +413,7 @@
for (int i = 0; i < numVertices; i++)
{
- float fx = -0.9f + 1.8f * ((i/3) + (i%3 == 2 ? 0.8f : 0.0f)) * 3 / numRows;
+ float fx = -0.9f + 1.8f * ((float)(i/3) + (i%3 == 2 ? 0.8f : 0.0f)) * 3 / numRows;
float fy = -0.9f + 1.8f * ((float)rowNdx + (i%3 == 0 ? 0.0f : 0.8f)) / numRows;
m_positions.push_back(fx);
diff --git a/modules/gles3/functional/es3fRasterizationTests.cpp b/modules/gles3/functional/es3fRasterizationTests.cpp
index aec11de..52286f9 100644
--- a/modules/gles3/functional/es3fRasterizationTests.cpp
+++ b/modules/gles3/functional/es3fRasterizationTests.cpp
@@ -1412,8 +1412,8 @@
for (int col = 0; col < numColumns; ++col)
for (int row = 0; row < numRows; ++row)
{
- const tcu::Vec2 center = tcu::Vec2((row + 0.5f) / numRows * 2.0f - 1.0f, (col + 0.5f) / numColumns * 2.0f - 1.0f);
- const float rotation = (iteration * numColumns * numRows + col * numRows + row) / (float)(m_iterationCount * numColumns * numRows) * DE_PI / 2.0f;
+ const tcu::Vec2 center = tcu::Vec2(((float)row + 0.5f) / (float)numRows * 2.0f - 1.0f, ((float)col + 0.5f) / (float)numColumns * 2.0f - 1.0f);
+ const float rotation = (float)(iteration * numColumns * numRows + col * numRows + row) / (float)(m_iterationCount * numColumns * numRows) * DE_PI / 2.0f;
const tcu::Vec2 sideH = quadSide * tcu::Vec2(deFloatCos(rotation), deFloatSin(rotation));
const tcu::Vec2 sideV = tcu::Vec2(sideH.y(), -sideH.x());
const tcu::Vec2 quad[4] =
@@ -1468,7 +1468,7 @@
{
const float quadSide = (m_caseType == FILLRULECASE_CLIPPED_PARTIAL) ? (1.0f) : (2.0f);
const tcu::Vec2 center = (m_caseType == FILLRULECASE_CLIPPED_PARTIAL) ? (tcu::Vec2(0.5f, 0.5f)) : (tcu::Vec2(0.0f, 0.0f));
- const float rotation = (iteration) / (float)(m_iterationCount - 1) * DE_PI / 2.0f;
+ const float rotation = (float)(iteration) / (float)(m_iterationCount - 1) * DE_PI / 2.0f;
const tcu::Vec2 sideH = quadSide * tcu::Vec2(deFloatCos(rotation), deFloatSin(rotation));
const tcu::Vec2 sideV = tcu::Vec2(sideH.y(), -sideH.x());
const tcu::Vec2 quad[4] =
diff --git a/modules/gles3/functional/es3fReadPixelsTests.cpp b/modules/gles3/functional/es3fReadPixelsTests.cpp
index d074264..759ba5d 100644
--- a/modules/gles3/functional/es3fReadPixelsTests.cpp
+++ b/modules/gles3/functional/es3fReadPixelsTests.cpp
@@ -176,10 +176,10 @@
// Render reference
- const int coordX1 = (int)((-0.5f * reference.getWidth() / 2.0f) + reference.getWidth() / 2.0f);
- const int coordY1 = (int)((-0.5f * reference.getHeight() / 2.0f) + reference.getHeight() / 2.0f);
- const int coordX2 = (int)(( 0.5f * reference.getWidth() / 2.0f) + reference.getWidth() / 2.0f);
- const int coordY2 = (int)(( 0.5f * reference.getHeight() / 2.0f) + reference.getHeight() / 2.0f);
+ const int coordX1 = (int)((-0.5f * (float)reference.getWidth() / 2.0f) + (float)reference.getWidth() / 2.0f);
+ const int coordY1 = (int)((-0.5f * (float)reference.getHeight() / 2.0f) + (float)reference.getHeight() / 2.0f);
+ const int coordX2 = (int)(( 0.5f * (float)reference.getWidth() / 2.0f) + (float)reference.getWidth() / 2.0f);
+ const int coordY2 = (int)(( 0.5f * (float)reference.getHeight() / 2.0f) + (float)reference.getHeight() / 2.0f);
for (int x = 0; x < reference.getWidth(); x++)
{
@@ -311,7 +311,7 @@
render(reference);
const int rowWidth = (m_rowLength == 0 ? m_width : m_rowLength) + m_skipPixels;
- const int rowPitch = m_alignment * deCeilFloatToInt32(pixelSize * rowWidth / (float)m_alignment);
+ const int rowPitch = m_alignment * deCeilFloatToInt32(float(pixelSize * rowWidth) / (float)m_alignment);
pixelData.resize(rowPitch * (m_height + m_skipRows), 0);
@@ -353,17 +353,17 @@
clearColor(reference, pixelData, pixelSize);
const int rowWidth = (m_rowLength == 0 ? m_width : m_rowLength);
- const int rowPitch = m_alignment * deCeilFloatToInt32(pixelSize * rowWidth / (float)m_alignment);
+ const int rowPitch = m_alignment * deCeilFloatToInt32((float)(pixelSize * rowWidth) / (float)m_alignment);
const tcu::ConstPixelBufferAccess resultAccess = tcu::ConstPixelBufferAccess(format, m_width, m_height, 1, rowPitch, 0, &(pixelData[pixelSize * m_skipPixels + m_skipRows * rowPitch]));
// \note Renderbuffers are never multisampled
if (!m_useRenderBuffer && m_context.getRenderTarget().getNumSamples() > 1)
{
const tcu::IVec4 formatBitDepths = tcu::getTextureFormatBitDepth(format);
- const deUint8 redThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits, formatBitDepths.x()))));
- const deUint8 greenThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits, formatBitDepths.y()))));
- const deUint8 blueThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits, formatBitDepths.z()))));
- const deUint8 alphaThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits, formatBitDepths.w()))));
+ const deUint8 redThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits, formatBitDepths.x()))));
+ const deUint8 greenThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits, formatBitDepths.y()))));
+ const deUint8 blueThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits, formatBitDepths.z()))));
+ const deUint8 alphaThreshold = (deUint8)deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits, formatBitDepths.w()))));
// bilinearCompare only accepts RGBA, UINT8
tcu::Texture2D referenceRGBA8 (tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNORM_INT8), m_width, m_height);
@@ -383,10 +383,10 @@
else
{
const tcu::IVec4 formatBitDepths = tcu::getTextureFormatBitDepth(format);
- const float redThreshold = 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits, formatBitDepths.x()));
- const float greenThreshold = 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits, formatBitDepths.y()));
- const float blueThreshold = 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits, formatBitDepths.z()));
- const float alphaThreshold = 2.0f / (1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits, formatBitDepths.w()));
+ const float redThreshold = 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().redBits, formatBitDepths.x()));
+ const float greenThreshold = 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().greenBits, formatBitDepths.y()));
+ const float blueThreshold = 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().blueBits, formatBitDepths.z()));
+ const float alphaThreshold = 2.0f / (float)(1 << deMin32(m_context.getRenderTarget().getPixelFormat().alphaBits, formatBitDepths.w()));
// Compare
if (tcu::floatThresholdCompare(m_testCtx.getLog(), "Result", "Result", reference.getLevel(0), resultAccess, tcu::Vec4(redThreshold, greenThreshold, blueThreshold, alphaThreshold), tcu::COMPARE_LOG_RESULT))
diff --git a/modules/gles3/functional/es3fShaderBuiltinVarTests.cpp b/modules/gles3/functional/es3fShaderBuiltinVarTests.cpp
index 44127d6..7874059 100644
--- a/modules/gles3/functional/es3fShaderBuiltinVarTests.cpp
+++ b/modules/gles3/functional/es3fShaderBuiltinVarTests.cpp
@@ -566,8 +566,8 @@
{
for (int xo = 0; xo < w; xo++)
{
- const float xf = float(xo+0.5f) / float(w);
- const float yf = float((h-yo-1)+0.5f) / float(h);
+ const float xf = (float(xo)+0.5f) / float(w);
+ const float yf = (float(h-yo-1)+0.5f) / float(h);
const tcu::Vec4 color (xf, yf, 0.0f, 1.0f);
const int dx = x0+xo;
const int dy = y0+yo;
@@ -831,8 +831,8 @@
const int quadY = quadNdx/maxQuadsX;
const int quadX = quadNdx%maxQuadsX;
- const float x0 = -1.0f + quadX*w;
- const float y0 = -1.0f + quadY*h;
+ const float x0 = -1.0f + float(quadX)*w;
+ const float y0 = -1.0f + float(quadY)*h;
if (triNdx%2 == 0)
{
diff --git a/modules/gles3/functional/es3fShaderDerivateTests.cpp b/modules/gles3/functional/es3fShaderDerivateTests.cpp
index 150444f..508cfc8 100644
--- a/modules/gles3/functional/es3fShaderDerivateTests.cpp
+++ b/modules/gles3/functional/es3fShaderDerivateTests.cpp
@@ -478,11 +478,11 @@
// * non-linearity may happen around zero or with very high function values due to subnorms not
// behaving well.
const tcu::Vec4 functionValueForward = (derivateFunc == DERIVATE_DFDX)
- ? (function.evaluateAt(x + 2.0f, y + 0.5f))
- : (function.evaluateAt(x + 0.5f, y + 2.0f));
+ ? (function.evaluateAt((float)x + 2.0f, (float)y + 0.5f))
+ : (function.evaluateAt((float)x + 0.5f, (float)y + 2.0f));
const tcu::Vec4 functionValueBackward = (derivateFunc == DERIVATE_DFDX)
- ? (function.evaluateAt(x - 1.0f, y + 0.5f))
- : (function.evaluateAt(x + 0.5f, y - 1.0f));
+ ? (function.evaluateAt((float)x - 1.0f, (float)y + 0.5f))
+ : (function.evaluateAt((float)x + 0.5f, (float)y - 1.0f));
bool anyComponentFailed = false;
diff --git a/modules/gles3/functional/es3fShaderLoopTests.cpp b/modules/gles3/functional/es3fShaderLoopTests.cpp
index dd5b24e..a1b2127 100644
--- a/modules/gles3/functional/es3fShaderLoopTests.cpp
+++ b/modules/gles3/functional/es3fShaderLoopTests.cpp
@@ -362,7 +362,7 @@
else
{
if (loopCountType == LOOPCOUNT_CONSTANT)
- incrementStr = string("ndx += ") + de::toString(1.0f / numLoopIters);
+ incrementStr = string("ndx += ") + de::toString(1.0f / (float)numLoopIters);
else if (loopCountType == LOOPCOUNT_UNIFORM)
incrementStr = string("ndx += ") + getFloatFractionUniformName(numLoopIters);
else if (loopCountType == LOOPCOUNT_DYNAMIC)
diff --git a/modules/gles3/functional/es3fShaderMatrixTests.cpp b/modules/gles3/functional/es3fShaderMatrixTests.cpp
index 1f0a5ee..2a945cf 100644
--- a/modules/gles3/functional/es3fShaderMatrixTests.cpp
+++ b/modules/gles3/functional/es3fShaderMatrixTests.cpp
@@ -1666,10 +1666,10 @@
for (int attribNdx = 0; attribNdx < 4; attribNdx++)
{
m_userAttribTransforms[attribNdx] = Mat4(0.0f);
- m_userAttribTransforms[attribNdx]( 0, 3) = 0.2f; // !< prevent matrix*vec from going into zero (assuming vec.w != 0)
- m_userAttribTransforms[attribNdx]( 1, 3) = 0.1f; // !<
- m_userAttribTransforms[attribNdx]( 2, 3) = 0.4f + 0.15f * attribNdx; // !<
- m_userAttribTransforms[attribNdx]( 3, 3) = 0.7f; // !<
+ m_userAttribTransforms[attribNdx]( 0, 3) = 0.2f; // !< prevent matrix*vec from going into zero (assuming vec.w != 0)
+ m_userAttribTransforms[attribNdx]( 1, 3) = 0.1f; // !<
+ m_userAttribTransforms[attribNdx]( 2, 3) = 0.4f + 0.15f * float(attribNdx); // !<
+ m_userAttribTransforms[attribNdx]( 3, 3) = 0.7f; // !<
m_userAttribTransforms[attribNdx]((0 + attribNdx) % 4, 0) = 1.0f;
m_userAttribTransforms[attribNdx]((1 + attribNdx) % 4, 1) = 1.0f;
m_userAttribTransforms[attribNdx]((2 + attribNdx) % 4, 2) = 1.0f;
diff --git a/modules/gles3/functional/es3fShaderOperatorTests.cpp b/modules/gles3/functional/es3fShaderOperatorTests.cpp
index 3f24038..f74dc7a 100644
--- a/modules/gles3/functional/es3fShaderOperatorTests.cpp
+++ b/modules/gles3/functional/es3fShaderOperatorTests.cpp
@@ -208,7 +208,7 @@
// Reference for expression "in0++, in1 = in0 + in2, in2 = in1"
inline Vec4 sequenceSideEffCase0 (const Vec4& in0, const Vec4& in1, const Vec4& in2) { DE_UNREF(in1); return in0 + 1.0f + in2; }
// Reference for expression "in1++, in0 = float(in1), in1 = uint(in0 + in2)"
-inline deUint32 sequenceSideEffCase1 (float in0, deUint32 in1, float in2) { DE_UNREF(in0); return (deUint32)(in1 + 1.0f + in2); }
+inline deUint32 sequenceSideEffCase1 (float in0, deUint32 in1, float in2) { DE_UNREF(in0); return (deUint32)(float(in1) + 1.0f + in2); }
// Reference for expression "in1 = in0, in2++, in2 = in2 + vec2(in1), ivec2(in2)"
inline IVec2 sequenceSideEffCase2 (bool in0, bool in1, const Vec2& in2) { DE_UNREF(in1); return (in2 + Vec2(1.0f) + Vec2((float)in0)).asInt(); }
// Reference for expression "in0 = in0 + vec4(in2), in1 = in1 + ivec4(in0), in1++"
@@ -898,31 +898,31 @@
Vector<T, Size> nop (const Vector<T, Size>& v) { return v; }
#define DECLARE_UNARY_GENTYPE_FUNCS(FUNC_NAME) \
- void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].z()); } \
+ void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2)).x(); } \
void eval_##FUNC_NAME##_vec2 (ShaderEvalContext& c) { c.color.yz() = FUNC_NAME(c.in[0].swizzle(3, 1)); } \
void eval_##FUNC_NAME##_vec3 (ShaderEvalContext& c) { c.color.xyz() = FUNC_NAME(c.in[0].swizzle(2, 0, 1)); } \
void eval_##FUNC_NAME##_vec4 (ShaderEvalContext& c) { c.color = FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0)); }
#define DECLARE_BINARY_GENTYPE_FUNCS(FUNC_NAME) \
- void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].z(), c.in[1].x()); } \
+ void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2), c.in[1].swizzle(0)).x(); } \
void eval_##FUNC_NAME##_vec2 (ShaderEvalContext& c) { c.color.yz() = FUNC_NAME(c.in[0].swizzle(3, 1), c.in[1].swizzle(1, 0)); } \
void eval_##FUNC_NAME##_vec3 (ShaderEvalContext& c) { c.color.xyz() = FUNC_NAME(c.in[0].swizzle(2, 0, 1), c.in[1].swizzle(1, 2, 0)); } \
void eval_##FUNC_NAME##_vec4 (ShaderEvalContext& c) { c.color = FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0), c.in[1].swizzle(3, 2, 1, 0)); }
#define DECLARE_TERNARY_GENTYPE_FUNCS(FUNC_NAME) \
- void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].z(), c.in[1].x(), c.in[2].y()); } \
+ void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2), c.in[1].swizzle(0), c.in[2].swizzle(1)).x(); } \
void eval_##FUNC_NAME##_vec2 (ShaderEvalContext& c) { c.color.yz() = FUNC_NAME(c.in[0].swizzle(3, 1), c.in[1].swizzle(1, 0), c.in[2].swizzle(2, 1)); } \
void eval_##FUNC_NAME##_vec3 (ShaderEvalContext& c) { c.color.xyz() = FUNC_NAME(c.in[0].swizzle(2, 0, 1), c.in[1].swizzle(1, 2, 0), c.in[2].swizzle(3, 1, 2)); } \
void eval_##FUNC_NAME##_vec4 (ShaderEvalContext& c) { c.color = FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0), c.in[1].swizzle(3, 2, 1, 0), c.in[2].swizzle(0, 3, 2, 1)); }
#define DECLARE_UNARY_SCALAR_GENTYPE_FUNCS(FUNC_NAME) \
- void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].z()); } \
+ void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2)); } \
void eval_##FUNC_NAME##_vec2 (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(3, 1)); } \
void eval_##FUNC_NAME##_vec3 (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2, 0, 1)); } \
void eval_##FUNC_NAME##_vec4 (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0)); }
#define DECLARE_BINARY_SCALAR_GENTYPE_FUNCS(FUNC_NAME) \
- void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].z(), c.in[1].x()); } \
+ void eval_##FUNC_NAME##_float (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2), c.in[1].swizzle(0)); } \
void eval_##FUNC_NAME##_vec2 (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(3, 1), c.in[1].swizzle(1, 0)); } \
void eval_##FUNC_NAME##_vec3 (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(2, 0, 1), c.in[1].swizzle(1, 2, 0)); } \
void eval_##FUNC_NAME##_vec4 (ShaderEvalContext& c) { c.color.x() = FUNC_NAME(c.in[0].swizzle(1, 2, 3, 0), c.in[1].swizzle(3, 2, 1, 0)); }
diff --git a/modules/gles3/functional/es3fShaderPackingFunctionTests.cpp b/modules/gles3/functional/es3fShaderPackingFunctionTests.cpp
index 2fd78a0..bc5141b 100644
--- a/modules/gles3/functional/es3fShaderPackingFunctionTests.cpp
+++ b/modules/gles3/functional/es3fShaderPackingFunctionTests.cpp
@@ -668,7 +668,7 @@
const int s = rnd.getBool() ? 1 : -1;
const int exp = rnd.getInt(minExp, maxExp);
const deUint32 mantissa = rnd.getUint32() & ((1<<mantBits)-1);
- const deUint16 value = tcu::Float16::construct(s, exp ? exp : 1 /* avoid denorm */, (1u<<10) | mantissa).bits();
+ const deUint16 value = tcu::Float16::construct(s, exp ? exp : 1 /* avoid denorm */, (deUint16)((1u<<10) | mantissa)).bits();
inVal |= value << (16*c);
}
diff --git a/modules/gles3/functional/es3fShaderPrecisionTests.cpp b/modules/gles3/functional/es3fShaderPrecisionTests.cpp
index e4ae760..a030b32 100644
--- a/modules/gles3/functional/es3fShaderPrecisionTests.cpp
+++ b/modules/gles3/functional/es3fShaderPrecisionTests.cpp
@@ -331,8 +331,8 @@
{
const deUint64 refBits = tcu::Float64(reference).bits();
const deUint64 resBits = tcu::Float64(result).bits();
- const deUint64 accurateRefBits = refBits >> maskBits;
- const deUint64 accurateResBits = resBits >> maskBits;
+ const deUint64 accurateRefBits = maskBits < 32 ? refBits >> maskBits : 0u;
+ const deUint64 accurateResBits = maskBits < 32 ? resBits >> maskBits : 0u;
const deUint64 ulpDiff = (deUint64)de::abs((deInt64)accurateRefBits - (deInt64)accurateResBits);
if (ulpDiff > (deUint64)roundingUlpError)
@@ -559,11 +559,6 @@
m_renderbuffer = 0;
}
-inline int extendTo32Bit (int value, int bits)
-{
- return (value & ((1<<(bits-1))-1)) | (((value & (1<<(bits-1))) << (32-bits)) >> (32-bits));
-}
-
ShaderIntPrecisionCase::IterateResult ShaderIntPrecisionCase::iterate (void)
{
// Constant data.
@@ -604,10 +599,10 @@
// Compute values and reference.
for (int testNdx = 0; testNdx < m_numTestsPerIter; testNdx++)
{
- int in0 = extendTo32Bit(((isMaxRangeA ? (int)m_rnd.getUint32() : m_rnd.getInt(m_rangeA.x(), m_rangeA.y())) & mask), m_bits);
- int in1 = extendTo32Bit(((isMaxRangeB ? (int)m_rnd.getUint32() : m_rnd.getInt(m_rangeB.x(), m_rangeB.y())) & mask), m_bits);
+ int in0 = deSignExtendTo32(((isMaxRangeA ? (int)m_rnd.getUint32() : m_rnd.getInt(m_rangeA.x(), m_rangeA.y())) & mask), m_bits);
+ int in1 = deSignExtendTo32(((isMaxRangeB ? (int)m_rnd.getUint32() : m_rnd.getInt(m_rangeB.x(), m_rangeB.y())) & mask), m_bits);
int refMasked = m_evalFunc(in0, in1) & mask;
- int refOut = extendTo32Bit(refMasked, m_bits);
+ int refOut = deSignExtendTo32(refMasked, m_bits);
log << TestLog::Message << "iter " << m_iterNdx << ", test " << testNdx << ": "
<< "in0 = " << in0 << ", in1 = " << in1 << ", ref out = " << refOut << " / " << tcu::toHex(refMasked)
diff --git a/modules/gles3/functional/es3fShaderTextureFunctionTests.cpp b/modules/gles3/functional/es3fShaderTextureFunctionTests.cpp
index 45444d5..b447370 100644
--- a/modules/gles3/functional/es3fShaderTextureFunctionTests.cpp
+++ b/modules/gles3/functional/es3fShaderTextureFunctionTests.cpp
@@ -647,7 +647,7 @@
m_texture2D = new glu::Texture2D(m_renderCtx, m_textureSpec.format, m_textureSpec.width, m_textureSpec.height);
for (int level = 0; level < m_textureSpec.numLevels; level++)
{
- float fA = level*levelStep;
+ float fA = float(level)*levelStep;
float fB = 1.0f-fA;
Vec4 colorA = cBias + cScale*Vec4(fA, fB, fA, fB);
Vec4 colorB = cBias + cScale*Vec4(fB, fA, fB, fA);
@@ -658,8 +658,8 @@
m_texture2D->upload();
// Compute LOD.
- float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*m_textureSpec.width / (float)viewportSize[0];
- float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*m_textureSpec.height / (float)viewportSize[1];
+ float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width / (float)viewportSize[0];
+ float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height / (float)viewportSize[1];
m_lookupParams.lod = computeLodFromDerivates(dudx, 0.0f, 0.0f, dvdy);
// Append to texture list.
@@ -679,7 +679,7 @@
m_textureCube = new glu::TextureCube(m_renderCtx, m_textureSpec.format, m_textureSpec.width);
for (int level = 0; level < m_textureSpec.numLevels; level++)
{
- float fA = level*levelStep;
+ float fA = float(level)*levelStep;
float fB = 1.0f-fA;
Vec2 f (fA, fB);
@@ -716,8 +716,8 @@
tcu::CubeFaceFloatCoords c00 = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
tcu::CubeFaceFloatCoords c10 = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.maxCoord[0]*proj, m_lookupSpec.minCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
tcu::CubeFaceFloatCoords c01 = tcu::getCubeFaceCoords(Vec3(m_lookupSpec.minCoord[0]*proj, m_lookupSpec.maxCoord[1]*proj, m_lookupSpec.minCoord[2]*proj));
- float dudx = (c10.s - c00.s)*m_textureSpec.width / (float)viewportSize[0];
- float dvdy = (c01.t - c00.t)*m_textureSpec.height / (float)viewportSize[1];
+ float dudx = (c10.s - c00.s)*(float)m_textureSpec.width / (float)viewportSize[0];
+ float dvdy = (c01.t - c00.t)*(float)m_textureSpec.height / (float)viewportSize[1];
m_lookupParams.lod = computeLodFromDerivates(dudx, 0.0f, 0.0f, dvdy);
@@ -741,7 +741,7 @@
for (int layer = 0; layer < levelAccess.getDepth(); layer++)
{
- float fA = layer*layerStep + level*levelStep;
+ float fA = (float)layer*layerStep + (float)level*levelStep;
float fB = 1.0f-fA;
Vec4 colorA = cBias + cScale*Vec4(fA, fB, fA, fB);
Vec4 colorB = cBias + cScale*Vec4(fB, fA, fB, fA);
@@ -752,8 +752,8 @@
m_texture2DArray->upload();
// Compute LOD.
- float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*m_textureSpec.width / (float)viewportSize[0];
- float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*m_textureSpec.height / (float)viewportSize[1];
+ float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width / (float)viewportSize[0];
+ float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height / (float)viewportSize[1];
m_lookupParams.lod = computeLodFromDerivates(dudx, 0.0f, 0.0f, dvdy);
// Append to texture list.
@@ -771,7 +771,7 @@
m_texture3D = new glu::Texture3D(m_renderCtx, m_textureSpec.format, m_textureSpec.width, m_textureSpec.height, m_textureSpec.depth);
for (int level = 0; level < m_textureSpec.numLevels; level++)
{
- float fA = level*levelStep;
+ float fA = (float)level*levelStep;
float fB = 1.0f-fA;
Vec4 colorA = cBias + cScale*Vec4(fA, fB, fA, fB);
Vec4 colorB = cBias + cScale*Vec4(fB, fA, fB, fA);
@@ -782,10 +782,10 @@
m_texture3D->upload();
// Compute LOD.
- float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*m_textureSpec.width / (float)viewportSize[0];
- float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*m_textureSpec.height / (float)viewportSize[1];
- float dwdx = (m_lookupSpec.maxCoord[2]-m_lookupSpec.minCoord[2])*0.5f*proj*m_textureSpec.depth / (float)viewportSize[0];
- float dwdy = (m_lookupSpec.maxCoord[2]-m_lookupSpec.minCoord[2])*0.5f*proj*m_textureSpec.depth / (float)viewportSize[1];
+ float dudx = (m_lookupSpec.maxCoord[0]-m_lookupSpec.minCoord[0])*proj*(float)m_textureSpec.width / (float)viewportSize[0];
+ float dvdy = (m_lookupSpec.maxCoord[1]-m_lookupSpec.minCoord[1])*proj*(float)m_textureSpec.height / (float)viewportSize[1];
+ float dwdx = (m_lookupSpec.maxCoord[2]-m_lookupSpec.minCoord[2])*0.5f*proj*(float)m_textureSpec.depth / (float)viewportSize[0];
+ float dwdy = (m_lookupSpec.maxCoord[2]-m_lookupSpec.minCoord[2])*0.5f*proj*(float)m_textureSpec.depth / (float)viewportSize[1];
m_lookupParams.lod = computeLodFromDerivates(dudx, 0.0f, dwdx, 0.0f, dvdy, dwdy);
// Append to texture list.
diff --git a/modules/gles3/functional/es3fTransformFeedbackTests.cpp b/modules/gles3/functional/es3fTransformFeedbackTests.cpp
index 6ddd9c8..f50d4a4 100644
--- a/modules/gles3/functional/es3fTransformFeedbackTests.cpp
+++ b/modules/gles3/functional/es3fTransformFeedbackTests.cpp
@@ -440,12 +440,12 @@
// Add position.
attributes.push_back(Attribute("a_position", glu::VarType(glu::TYPE_FLOAT_VEC4, glu::PRECISION_HIGHP), inputStride));
- inputStride += 4*sizeof(deUint32);
+ inputStride += 4*(int)sizeof(deUint32);
if (usePointSize)
{
attributes.push_back(Attribute("a_pointSize", glu::VarType(glu::TYPE_FLOAT, glu::PRECISION_HIGHP), inputStride));
- inputStride += 1*sizeof(deUint32);
+ inputStride += 1*(int)sizeof(deUint32);
}
// Compute attribute vector.
@@ -457,7 +457,7 @@
string name = getAttributeName(var->name.c_str(), vecIter.getPath());
attributes.push_back(Attribute(name, type, inputStride));
- inputStride += glu::getDataTypeScalarSize(type.getBasicType())*sizeof(deUint32);
+ inputStride += glu::getDataTypeScalarSize(type.getBasicType())*(int)sizeof(deUint32);
}
}
}
@@ -516,7 +516,7 @@
}
}
- accumulatedSize += output.type.getScalarSize()*sizeof(deUint32);
+ accumulatedSize += output.type.getScalarSize()*(int)sizeof(deUint32);
}
}
@@ -776,7 +776,7 @@
if (!isOk)
break;
- outOffset += numComponents*sizeof(deUint32);
+ outOffset += numComponents*(int)sizeof(deUint32);
}
return isOk;
@@ -959,13 +959,13 @@
if (m_bufferMode == GL_SEPARATE_ATTRIBS)
{
for (vector<Output>::const_iterator outIter = m_transformFeedbackOutputs.begin(); outIter != m_transformFeedbackOutputs.end(); outIter++)
- m_bufferStrides.push_back(outIter->type.getScalarSize()*sizeof(deUint32));
+ m_bufferStrides.push_back(outIter->type.getScalarSize()*(int)sizeof(deUint32));
}
else
{
int totalSize = 0;
for (vector<Output>::const_iterator outIter = m_transformFeedbackOutputs.begin(); outIter != m_transformFeedbackOutputs.end(); outIter++)
- totalSize += outIter->type.getScalarSize()*sizeof(deUint32);
+ totalSize += outIter->type.getScalarSize()*(int)sizeof(deUint32);
m_bufferStrides.push_back(totalSize);
}
diff --git a/modules/gles3/functional/es3fVertexArrayObjectTests.cpp b/modules/gles3/functional/es3fVertexArrayObjectTests.cpp
index 776239e..ae9183f 100644
--- a/modules/gles3/functional/es3fVertexArrayObjectTests.cpp
+++ b/modules/gles3/functional/es3fVertexArrayObjectTests.cpp
@@ -327,13 +327,13 @@
{
switch (buffer.type)
{
- case GL_FLOAT: stride = buffer.componentCount * sizeof(GLfloat); break;
- case GL_INT: stride = buffer.componentCount * sizeof(GLint); break;
- case GL_UNSIGNED_INT: stride = buffer.componentCount * sizeof(GLuint); break;
- case GL_SHORT: stride = buffer.componentCount * sizeof(GLshort); break;
- case GL_UNSIGNED_SHORT: stride = buffer.componentCount * sizeof(GLushort); break;
- case GL_BYTE: stride = buffer.componentCount * sizeof(GLbyte); break;
- case GL_UNSIGNED_BYTE: stride = buffer.componentCount * sizeof(GLubyte); break;
+ case GL_FLOAT: stride = buffer.componentCount * (int)sizeof(GLfloat); break;
+ case GL_INT: stride = buffer.componentCount * (int)sizeof(GLint); break;
+ case GL_UNSIGNED_INT: stride = buffer.componentCount * (int)sizeof(GLuint); break;
+ case GL_SHORT: stride = buffer.componentCount * (int)sizeof(GLshort); break;
+ case GL_UNSIGNED_SHORT: stride = buffer.componentCount * (int)sizeof(GLushort); break;
+ case GL_BYTE: stride = buffer.componentCount * (int)sizeof(GLbyte); break;
+ case GL_UNSIGNED_BYTE: stride = buffer.componentCount * (int)sizeof(GLubyte); break;
default:
stride = 0;
@@ -376,7 +376,7 @@
case GL_SHORT:
{
- GLshort v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+ GLshort v = (GLshort)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
deMemcpy(componentItr, &v, sizeof(v));
componentItr += sizeof(v);
break;
@@ -384,7 +384,7 @@
case GL_UNSIGNED_SHORT:
{
- GLushort v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+ GLushort v = (GLushort)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
deMemcpy(componentItr, &v, sizeof(v));
componentItr += sizeof(v);
break;
@@ -392,7 +392,7 @@
case GL_BYTE:
{
- GLbyte v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+ GLbyte v = (GLbyte)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
deMemcpy(componentItr, &v, sizeof(v));
componentItr += sizeof(v);
break;
@@ -400,7 +400,7 @@
case GL_UNSIGNED_BYTE:
{
- GLubyte v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+ GLubyte v = (GLubyte)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
deMemcpy(componentItr, &v, sizeof(v));
componentItr += sizeof(v);
break;
@@ -437,12 +437,12 @@
switch (state.attributes[0].type)
{
- case GL_SHORT: scale = (1.0f/((1u<<14)-1)); break;
- case GL_UNSIGNED_SHORT: scale = (1.0f/((1u<<15)-1)); break;
- case GL_INT: scale = (1.0f/((1u<<30)-1)); break;
- case GL_UNSIGNED_INT: scale = (1.0f/((1u<<31)-1)); break;
- case GL_BYTE: scale = (1.0f/((1u<<6)-1)); break;
- case GL_UNSIGNED_BYTE: scale = (1.0f/((1u<<7)-1)); break;
+ case GL_SHORT: scale = (1.0f/float((1u<<14)-1u)); break;
+ case GL_UNSIGNED_SHORT: scale = (1.0f/float((1u<<15)-1u)); break;
+ case GL_INT: scale = (1.0f/float((1u<<30)-1u)); break;
+ case GL_UNSIGNED_INT: scale = (1.0f/float((1u<<31)-1u)); break;
+ case GL_BYTE: scale = (1.0f/float((1u<<6)-1u)); break;
+ case GL_UNSIGNED_BYTE: scale = (1.0f/float((1u<<7)-1u)); break;
default:
DE_ASSERT(DE_FALSE);
@@ -455,12 +455,12 @@
switch (state.attributes[0].type)
{
- case GL_SHORT: scale = (0.5f/((1u<<14)-1)); break;
- case GL_UNSIGNED_SHORT: scale = (0.5f/((1u<<15)-1)); break;
- case GL_INT: scale = (0.5f/((1u<<30)-1)); break;
- case GL_UNSIGNED_INT: scale = (0.5f/((1u<<31)-1)); break;
- case GL_BYTE: scale = (0.5f/((1u<<6)-1)); break;
- case GL_UNSIGNED_BYTE: scale = (0.5f/((1u<<7)-1)); break;
+ case GL_SHORT: scale = (0.5f/float((1u<<14)-1u)); break;
+ case GL_UNSIGNED_SHORT: scale = (0.5f/float((1u<<15)-1u)); break;
+ case GL_INT: scale = (0.5f/float((1u<<30)-1u)); break;
+ case GL_UNSIGNED_INT: scale = (0.5f/float((1u<<31)-1u)); break;
+ case GL_BYTE: scale = (0.5f/float((1u<<6)-1u)); break;
+ case GL_UNSIGNED_BYTE: scale = (0.5f/float((1u<<7)-1u)); break;
default:
DE_ASSERT(DE_FALSE);
@@ -483,12 +483,12 @@
switch (state.attributes[0].type)
{
- case GL_SHORT: scale = (1.0f/((1u<<14)-1)); break;
- case GL_UNSIGNED_SHORT: scale = (1.0f/((1u<<15)-1)); break;
- case GL_INT: scale = (1.0f/((1u<<30)-1)); break;
- case GL_UNSIGNED_INT: scale = (1.0f/((1u<<31)-1)); break;
- case GL_BYTE: scale = (1.0f/((1u<<6)-1)); break;
- case GL_UNSIGNED_BYTE: scale = (1.0f/((1u<<7)-1)); break;
+ case GL_SHORT: scale = (1.0f/float((1u<<14)-1u)); break;
+ case GL_UNSIGNED_SHORT: scale = (1.0f/float((1u<<15)-1u)); break;
+ case GL_INT: scale = (1.0f/float((1u<<30)-1u)); break;
+ case GL_UNSIGNED_INT: scale = (1.0f/float((1u<<31)-1u)); break;
+ case GL_BYTE: scale = (1.0f/float((1u<<6)-1u)); break;
+ case GL_UNSIGNED_BYTE: scale = (1.0f/float((1u<<7)-1u)); break;
default:
DE_ASSERT(DE_FALSE);
@@ -512,18 +512,18 @@
switch (state.attributes[0].type)
{
- case GL_SHORT: scale = (1.0f/((1u<<14)-1)); break;
- case GL_UNSIGNED_SHORT: scale = (1.0f/((1u<<15)-1)); break;
- case GL_INT: scale = (1.0f/((1u<<30)-1)); break;
- case GL_UNSIGNED_INT: scale = (1.0f/((1u<<31)-1)); break;
- case GL_BYTE: scale = (1.0f/((1u<<6)-1)); break;
- case GL_UNSIGNED_BYTE: scale = (1.0f/((1u<<7)-1)); break;
+ case GL_SHORT: scale = (1.0f/float((1u<<14)-1u)); break;
+ case GL_UNSIGNED_SHORT: scale = (1.0f/float((1u<<15)-1u)); break;
+ case GL_INT: scale = (1.0f/float((1u<<30)-1u)); break;
+ case GL_UNSIGNED_INT: scale = (1.0f/float((1u<<31)-1u)); break;
+ case GL_BYTE: scale = (1.0f/float((1u<<6)-1u)); break;
+ case GL_UNSIGNED_BYTE: scale = (1.0f/float((1u<<7)-1u)); break;
default:
DE_ASSERT(DE_FALSE);
}
- scale *= 0.5;
+ scale *= 0.5f;
vertexShaderStream
<< "\tgl_Position = vec4(" << scale << " * " << "a_attrib0.xyz, 1.0);\n"
@@ -903,13 +903,13 @@
{
switch (buffer.type)
{
- case GL_FLOAT: stride = buffer.componentCount * sizeof(GLfloat); break;
- case GL_INT: stride = buffer.componentCount * sizeof(GLint); break;
- case GL_UNSIGNED_INT: stride = buffer.componentCount * sizeof(GLuint); break;
- case GL_SHORT: stride = buffer.componentCount * sizeof(GLshort); break;
- case GL_UNSIGNED_SHORT: stride = buffer.componentCount * sizeof(GLushort); break;
- case GL_BYTE: stride = buffer.componentCount * sizeof(GLbyte); break;
- case GL_UNSIGNED_BYTE: stride = buffer.componentCount * sizeof(GLubyte); break;
+ case GL_FLOAT: stride = buffer.componentCount * (int)sizeof(GLfloat); break;
+ case GL_INT: stride = buffer.componentCount * (int)sizeof(GLint); break;
+ case GL_UNSIGNED_INT: stride = buffer.componentCount * (int)sizeof(GLuint); break;
+ case GL_SHORT: stride = buffer.componentCount * (int)sizeof(GLshort); break;
+ case GL_UNSIGNED_SHORT: stride = buffer.componentCount * (int)sizeof(GLushort); break;
+ case GL_BYTE: stride = buffer.componentCount * (int)sizeof(GLbyte); break;
+ case GL_UNSIGNED_BYTE: stride = buffer.componentCount * (int)sizeof(GLubyte); break;
default:
stride = 0;
@@ -944,7 +944,7 @@
case GL_UNSIGNED_INT:
{
- GLuint v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+ GLuint v = (GLuint)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
deMemcpy(componentItr, &v, sizeof(v));
componentItr += sizeof(v);
break;
@@ -952,7 +952,7 @@
case GL_SHORT:
{
- GLshort v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+ GLshort v = (GLshort)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
deMemcpy(componentItr, &v, sizeof(v));
componentItr += sizeof(v);
break;
@@ -960,7 +960,7 @@
case GL_UNSIGNED_SHORT:
{
- GLushort v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+ GLushort v = (GLushort)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
deMemcpy(componentItr, &v, sizeof(v));
componentItr += sizeof(v);
break;
@@ -968,7 +968,7 @@
case GL_BYTE:
{
- GLbyte v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+ GLbyte v = (GLbyte)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
deMemcpy(componentItr, &v, sizeof(v));
componentItr += sizeof(v);
break;
@@ -976,7 +976,7 @@
case GL_UNSIGNED_BYTE:
{
- GLubyte v = m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
+ GLubyte v = (GLubyte)m_random.getInt(buffer.intRangeMin, buffer.intRangeMax);
deMemcpy(componentItr, &v, sizeof(v));
componentItr += sizeof(v);
break;
@@ -1013,12 +1013,12 @@
switch (state.attributes[0].type)
{
- case GL_SHORT: scale = (1.0f/((1u<<14)-1)); break;
- case GL_UNSIGNED_SHORT: scale = (1.0f/((1u<<15)-1)); break;
- case GL_INT: scale = (1.0f/((1u<<30)-1)); break;
- case GL_UNSIGNED_INT: scale = (1.0f/((1u<<31)-1)); break;
- case GL_BYTE: scale = (1.0f/((1u<<6)-1)); break;
- case GL_UNSIGNED_BYTE: scale = (1.0f/((1u<<7)-1)); break;
+ case GL_SHORT: scale = (1.0f/float((1u<<14)-1u)); break;
+ case GL_UNSIGNED_SHORT: scale = (1.0f/float((1u<<15)-1u)); break;
+ case GL_INT: scale = (1.0f/float((1u<<30)-1u)); break;
+ case GL_UNSIGNED_INT: scale = (1.0f/float((1u<<31)-1u)); break;
+ case GL_BYTE: scale = (1.0f/float((1u<<6)-1u)); break;
+ case GL_UNSIGNED_BYTE: scale = (1.0f/float((1u<<7)-1u)); break;
default:
DE_ASSERT(DE_FALSE);
@@ -1031,12 +1031,12 @@
switch (state.attributes[0].type)
{
- case GL_SHORT: scale = (0.5f/((1u<<14)-1)); break;
- case GL_UNSIGNED_SHORT: scale = (0.5f/((1u<<15)-1)); break;
- case GL_INT: scale = (0.5f/((1u<<30)-1)); break;
- case GL_UNSIGNED_INT: scale = (0.5f/((1u<<31)-1)); break;
- case GL_BYTE: scale = (0.5f/((1u<<6)-1)); break;
- case GL_UNSIGNED_BYTE: scale = (0.5f/((1u<<7)-1)); break;
+ case GL_SHORT: scale = (0.5f/float((1u<<14)-1u)); break;
+ case GL_UNSIGNED_SHORT: scale = (0.5f/float((1u<<15)-1u)); break;
+ case GL_INT: scale = (0.5f/float((1u<<30)-1u)); break;
+ case GL_UNSIGNED_INT: scale = (0.5f/float((1u<<31)-1u)); break;
+ case GL_BYTE: scale = (0.5f/float((1u<<6)-1u)); break;
+ case GL_UNSIGNED_BYTE: scale = (0.5f/float((1u<<7)-1u)); break;
default:
DE_ASSERT(DE_FALSE);
@@ -1059,12 +1059,12 @@
switch (state.attributes[0].type)
{
- case GL_SHORT: scale = (1.0f/((1u<<14)-1)); break;
- case GL_UNSIGNED_SHORT: scale = (1.0f/((1u<<15)-1)); break;
- case GL_INT: scale = (1.0f/((1u<<30)-1)); break;
- case GL_UNSIGNED_INT: scale = (1.0f/((1u<<31)-1)); break;
- case GL_BYTE: scale = (1.0f/((1u<<6)-1)); break;
- case GL_UNSIGNED_BYTE: scale = (1.0f/((1u<<7)-1)); break;
+ case GL_SHORT: scale = (1.0f/float((1u<<14)-1u)); break;
+ case GL_UNSIGNED_SHORT: scale = (1.0f/float((1u<<15)-1u)); break;
+ case GL_INT: scale = (1.0f/float((1u<<30)-1u)); break;
+ case GL_UNSIGNED_INT: scale = (1.0f/float((1u<<31)-1u)); break;
+ case GL_BYTE: scale = (1.0f/float((1u<<6)-1u)); break;
+ case GL_UNSIGNED_BYTE: scale = (1.0f/float((1u<<7)-1u)); break;
default:
@@ -1089,18 +1089,18 @@
switch (state.attributes[0].type)
{
- case GL_SHORT: scale = (1.0f/((1u<<14)-1)); break;
- case GL_UNSIGNED_SHORT: scale = (1.0f/((1u<<15)-1)); break;
- case GL_INT: scale = (1.0f/((1u<<30)-1)); break;
- case GL_UNSIGNED_INT: scale = (1.0f/((1u<<31)-1)); break;
- case GL_BYTE: scale = (1.0f/((1u<<6)-1)); break;
- case GL_UNSIGNED_BYTE: scale = (1.0f/((1u<<7)-1)); break;
+ case GL_SHORT: scale = (1.0f/float((1u<<14)-1u)); break;
+ case GL_UNSIGNED_SHORT: scale = (1.0f/float((1u<<15)-1u)); break;
+ case GL_INT: scale = (1.0f/float((1u<<30)-1u)); break;
+ case GL_UNSIGNED_INT: scale = (1.0f/float((1u<<31)-1u)); break;
+ case GL_BYTE: scale = (1.0f/float((1u<<6)-1u)); break;
+ case GL_UNSIGNED_BYTE: scale = (1.0f/float((1u<<7)-1u)); break;
default:
DE_ASSERT(DE_FALSE);
}
- scale *= 0.5;
+ scale *= 0.5f;
vertexShaderStream
<< "\tgl_Position = vec4(" << scale << " * " << "vec3(a_attrib0.xyz), 1.0);\n"
diff --git a/modules/gles3/functional/es3fVertexTextureTests.cpp b/modules/gles3/functional/es3fVertexTextureTests.cpp
index 7528abf..a2cd1c0 100644
--- a/modules/gles3/functional/es3fVertexTextureTests.cpp
+++ b/modules/gles3/functional/es3fVertexTextureTests.cpp
@@ -298,13 +298,13 @@
for (int i = 0; i < DE_LENGTH_OF_ARRAY(quadVertices); i++)
m_positions.push_back(safeCoords(quadVertices[i], renderSize, Vec2(0.0f)) * 2.0f - 1.0f);
- m_indices.push_back(firstNdx + 0);
- m_indices.push_back(firstNdx + 1);
- m_indices.push_back(firstNdx + 2);
+ m_indices.push_back(deUint16(firstNdx + 0));
+ m_indices.push_back(deUint16(firstNdx + 1));
+ m_indices.push_back(deUint16(firstNdx + 2));
- m_indices.push_back(firstNdx + 1);
- m_indices.push_back(firstNdx + 3);
- m_indices.push_back(firstNdx + 2);
+ m_indices.push_back(deUint16(firstNdx + 1));
+ m_indices.push_back(deUint16(firstNdx + 3));
+ m_indices.push_back(deUint16(firstNdx + 2));
}
m_texCoords.reserve(m_gridSize*m_gridSize*4);
@@ -444,7 +444,7 @@
DE_ASSERT(deInBounds32(ix + region.x, 0, dst.getWidth()));
DE_ASSERT(deInBounds32(iy + region.y, 0, dst.getHeight()));
- dst.setPixel(ix + region.x, iy + region.y, toRGBA(color));
+ dst.setPixel(ix + region.x, iy + region.y, tcu::RGBA(color));
}
}
}
diff --git a/modules/gles3/performance/es3pBufferDataUploadTests.cpp b/modules/gles3/performance/es3pBufferDataUploadTests.cpp
index d4dfa16..027453b 100644
--- a/modules/gles3/performance/es3pBufferDataUploadTests.cpp
+++ b/modules/gles3/performance/es3pBufferDataUploadTests.cpp
@@ -509,9 +509,9 @@
if (numBytes < 1024)
buf << numBytes << " byte(s)";
else if (numBytes < 1024 * 1024)
- buf << de::floatToString(numBytes/1024.0f, 1) << " KiB";
+ buf << de::floatToString((float)numBytes/1024.0f, 1) << " KiB";
else
- buf << de::floatToString(numBytes/1024.0f/1024.0f, 1) << " MiB";
+ buf << de::floatToString((float)numBytes/1024.0f/1024.0f, 1) << " MiB";
return buf.str();
}
@@ -582,7 +582,7 @@
bestTime = sectionTimes[sectionNdx];
// Detect if write takes 50% longer than it should, and warm up if that happened
- if (sectionNdx != numSections-1 && (float)sectionTimes[sectionNdx] > 1.5f * bestTime)
+ if (sectionNdx != numSections-1 && (float)sectionTimes[sectionNdx] > 1.5f * (float)bestTime)
{
deYield();
tcu::warmupCPU();
@@ -1373,7 +1373,7 @@
for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
{
- const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].writtenSize);
+ const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].writtenSize);
log << tcu::TestLog::Sample
<< samples[sampleNdx].writtenSize
<< samples[sampleNdx].bufferSize
@@ -1401,7 +1401,7 @@
for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
{
- const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].writtenSize);
+ const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].writtenSize);
log << tcu::TestLog::Sample
<< samples[sampleNdx].writtenSize
<< samples[sampleNdx].bufferSize
@@ -1432,7 +1432,7 @@
for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
{
- const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].writtenSize);
+ const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].writtenSize);
log << tcu::TestLog::Sample
<< samples[sampleNdx].writtenSize
<< samples[sampleNdx].bufferSize
@@ -1464,7 +1464,7 @@
for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
{
- const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].writtenSize);
+ const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].writtenSize);
log << tcu::TestLog::Sample
<< samples[sampleNdx].writtenSize
<< samples[sampleNdx].bufferSize
@@ -1497,7 +1497,7 @@
for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
{
- const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].writtenSize);
+ const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].writtenSize);
log << tcu::TestLog::Sample
<< samples[sampleNdx].writtenSize
<< samples[sampleNdx].bufferSize
@@ -1527,7 +1527,7 @@
for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
{
- const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].renderDataSize);
+ const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].renderDataSize);
log << tcu::TestLog::Sample
<< samples[sampleNdx].renderDataSize
<< samples[sampleNdx].numVertices
@@ -1556,7 +1556,7 @@
for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
{
- const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].renderDataSize);
+ const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].renderDataSize);
log << tcu::TestLog::Sample
<< samples[sampleNdx].renderDataSize
<< samples[sampleNdx].numVertices
@@ -1588,7 +1588,7 @@
for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
{
- const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].renderDataSize);
+ const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].renderDataSize);
log << tcu::TestLog::Sample
<< samples[sampleNdx].renderDataSize
<< samples[sampleNdx].uploadedDataSize
@@ -1623,7 +1623,7 @@
for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
{
- const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].renderDataSize);
+ const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].renderDataSize);
log << tcu::TestLog::Sample
<< samples[sampleNdx].renderDataSize
<< samples[sampleNdx].uploadedDataSize
@@ -1659,7 +1659,7 @@
for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
{
- const float fitResidual = samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * samples[sampleNdx].renderDataSize);
+ const float fitResidual = (float)samples[sampleNdx].duration.fitResponseDuration - (theilSenFitting.offset + theilSenFitting.coefficient * (float)samples[sampleNdx].renderDataSize);
log << tcu::TestLog::Sample
<< samples[sampleNdx].renderDataSize
<< samples[sampleNdx].uploadedDataSize
@@ -1681,7 +1681,7 @@
static UploadSampleAnalyzeResult analyzeSampleResults (tcu::TestLog& log, const std::vector<UploadSampleResult<SampleType> >& samples, bool logBucketPerformance)
{
// Assume data is linear with some outliers, fit a line
- const LineParametersWithConfidence theilSenFitting = fitLineToSamples(samples);
+ const LineParametersWithConfidence theilSenFitting = fitLineToSamples(samples);
const typename SampleTypeTraits<SampleType>::StatsType resultStats = calculateSampleStatistics(theilSenFitting, samples);
float approximatedTransferRate;
float approximatedTransferRateNoConstant;
@@ -1790,7 +1790,7 @@
static RenderSampleAnalyzeResult analyzeSampleResults (tcu::TestLog& log, const std::vector<RenderSampleResult<SampleType> >& samples)
{
// Assume data is linear with some outliers, fit a line
- const LineParametersWithConfidence theilSenFitting = fitLineToSamples(samples);
+ const LineParametersWithConfidence theilSenFitting = fitLineToSamples(samples);
const typename SampleTypeTraits<SampleType>::StatsType resultStats = calculateSampleStatistics(theilSenFitting, samples);
float approximatedProcessingRate;
float approximatedProcessingRateNoConstant;
@@ -3435,7 +3435,7 @@
// make sure our zeroBuffer is large enough
if (m_respecifySize)
{
- const int largerBufferSize = deAlign32((int)(m_bufferSizeMax * m_sizeDifferenceFactor), 4*4);
+ const int largerBufferSize = deAlign32((int)((float)m_bufferSizeMax * m_sizeDifferenceFactor), 4*4);
m_zeroData.resize(largerBufferSize, 0x00);
}
}
@@ -3452,7 +3452,7 @@
const int drawEnd = deAlign32(bufferSize * 3 / 4, 4*4);
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
- const int largerBufferSize = deAlign32((int)(bufferSize * m_sizeDifferenceFactor), 4*4);
+ const int largerBufferSize = deAlign32((int)((float)bufferSize * m_sizeDifferenceFactor), 4*4);
const int newBufferSize = (m_respecifySize) ? (largerBufferSize) : (bufferSize);
deUint64 startTime;
deUint64 endTime;
@@ -3892,10 +3892,10 @@
for (int cellZ = 0; cellZ < scene.gridLayers; ++cellZ)
{
const tcu::Vec4 color = (((cellX + cellY + cellZ) % 2) == 0) ? (green) : (yellow);
- const float cellLeft = (float(cellX ) / scene.gridWidth - 0.5f) * 2.0f;
- const float cellRight = (float(cellX+1) / scene.gridWidth - 0.5f) * 2.0f;
- const float cellTop = (float(cellY+1) / scene.gridHeight - 0.5f) * 2.0f;
- const float cellBottom = (float(cellY ) / scene.gridHeight - 0.5f) * 2.0f;
+ const float cellLeft = (float(cellX ) / (float)scene.gridWidth - 0.5f) * 2.0f;
+ const float cellRight = (float(cellX+1) / (float)scene.gridWidth - 0.5f) * 2.0f;
+ const float cellTop = (float(cellY+1) / (float)scene.gridHeight - 0.5f) * 2.0f;
+ const float cellBottom = (float(cellY ) / (float)scene.gridHeight - 0.5f) * 2.0f;
vertexData[(cellY * scene.gridWidth * scene.gridLayers + cellX * scene.gridLayers + cellZ) * 12 + 0] = color;
vertexData[(cellY * scene.gridWidth * scene.gridLayers + cellX * scene.gridLayers + cellZ) * 12 + 1] = tcu::Vec4(cellLeft, cellTop, 0.0f, 1.0f);
@@ -4635,7 +4635,7 @@
deYield();
// "Render" something and wait for it
- gl.clearColor(0.0f, 1.0f, m_sampleNdx / float(m_numSamples), 1.0f);
+ gl.clearColor(0.0f, 1.0f, float(m_sampleNdx) / float(m_numSamples), 1.0f);
gl.clear(GL_COLOR_BUFFER_BIT);
// wait for results
@@ -4763,13 +4763,13 @@
// log
{
const char* const targetFunctionName = (m_drawMethod == DRAWMETHOD_DRAW_ARRAYS) ? ("drawArrays") : ("drawElements");
- const int perVertexSize = (m_targetBuffer == TARGETBUFFER_INDEX) ? (sizeof(deUint32)) : (sizeof(tcu::Vec4[2]));
+ const int perVertexSize = (m_targetBuffer == TARGETBUFFER_INDEX) ? ((int)sizeof(deUint32)) : ((int)sizeof(tcu::Vec4[2]));
const int fullMinUploadSize = RenderCase<SampleType>::getMinWorkloadSize() * perVertexSize;
const int fullMaxUploadSize = RenderCase<SampleType>::getMaxWorkloadSize() * perVertexSize;
const int minUploadSize = (m_uploadRange == UPLOADRANGE_FULL) ? (fullMinUploadSize) : (deAlign32(fullMinUploadSize/2, 4));
const int maxUploadSize = (m_uploadRange == UPLOADRANGE_FULL) ? (fullMaxUploadSize) : (deAlign32(fullMaxUploadSize/2, 4));
- const int minUnrelatedUploadSize = RenderCase<SampleType>::getMinWorkloadSize() * sizeof(tcu::Vec4[2]);
- const int maxUnrelatedUploadSize = RenderCase<SampleType>::getMaxWorkloadSize() * sizeof(tcu::Vec4[2]);
+ const int minUnrelatedUploadSize = RenderCase<SampleType>::getMinWorkloadSize() * (int)sizeof(tcu::Vec4[2]);
+ const int maxUnrelatedUploadSize = RenderCase<SampleType>::getMaxWorkloadSize() * (int)sizeof(tcu::Vec4[2]);
m_testCtx.getLog()
<< tcu::TestLog::Message
@@ -4939,7 +4939,7 @@
// upload to 25% - 75% range
target = GL_ELEMENT_ARRAY_BUFFER;
- size = (glw::GLsizeiptr)deAlign32((glw::GLsizeiptr)((int)(indexData.size() * sizeof(deUint32))) / 2, 4);
+ size = (glw::GLsizeiptr)deAlign32((deInt32)(indexData.size() * sizeof(deUint32)) / 2, 4);
offset = (glw::GLintptr)deAlign32((int)size / 2, 4);
source = (const deUint8*)&indexData[0] + offset;
}
@@ -5275,7 +5275,7 @@
{
// upload to 25% - 75% range
target = GL_ELEMENT_ARRAY_BUFFER;
- size = (glw::GLsizeiptr)deAlign32((glw::GLsizeiptr)((int)(indexData.size() * sizeof(deUint32))) / 2, 4);
+ size = (glw::GLsizeiptr)deAlign32((deInt32)(indexData.size() * sizeof(deUint32)) / 2, 4);
offset = (glw::GLintptr)deAlign32((int)size / 2, 4);
source = (const deUint8*)&indexData[0] + offset;
}
@@ -6163,7 +6163,7 @@
lineFit = theilSenSiegelLinearRegression(dataPoints, 0.6f);
// Difference of more than 25% of the offset along the whole sample range
- if (de::abs(lineFit.coefficient) * numDataPoints > de::abs(lineFit.offset) * 0.25f)
+ if (de::abs(lineFit.coefficient) * (float)numDataPoints > de::abs(lineFit.offset) * 0.25f)
{
m_testCtx.getLog()
<< tcu::TestLog::Message
diff --git a/modules/gles3/performance/es3pShaderCompilationCases.cpp b/modules/gles3/performance/es3pShaderCompilationCases.cpp
index c646d8f..c3ad27d 100644
--- a/modules/gles3/performance/es3pShaderCompilationCases.cpp
+++ b/modules/gles3/performance/es3pShaderCompilationCases.cpp
@@ -2048,10 +2048,10 @@
// Log this measurement.
log << TestLog::Float("Measurement" + de::toString(ndx) + "CompilationTime",
"Measurement " + de::toString(ndx) + " compilation time",
- "ms", QP_KEY_TAG_TIME, timeWithoutDraw / 1000.0f)
+ "ms", QP_KEY_TAG_TIME, (float)timeWithoutDraw / 1000.0f)
<< TestLog::Float("Measurement" + de::toString(ndx) + "SpecializationTime",
"Measurement " + de::toString(ndx) + " specialization time",
- "ms", QP_KEY_TAG_TIME, specializationTime / 1000.0f);
+ "ms", QP_KEY_TAG_TIME, (float)specializationTime / 1000.0f);
}
// Log some statistics.
@@ -2585,7 +2585,7 @@
// Log this measurement.
log << TestLog::Float("Measurement" + de::toString(ndx) + "Time",
"Measurement " + de::toString(ndx) + " time",
- "ms", QP_KEY_TAG_TIME, measurements[ndx].totalTime()/1000.0f);
+ "ms", QP_KEY_TAG_TIME, (float)measurements[ndx].totalTime()/1000.0f);
}
// Log some statistics.
diff --git a/modules/gles3/stress/es3sSpecialFloatTests.cpp b/modules/gles3/stress/es3sSpecialFloatTests.cpp
index dc2fca9..8f7394d 100644
--- a/modules/gles3/stress/es3sSpecialFloatTests.cpp
+++ b/modules/gles3/stress/es3sSpecialFloatTests.cpp
@@ -636,13 +636,13 @@
{
const int baseNdx = (x * (DE_LENGTH_OF_ARRAY(s_specialFloats) - 1) + y) * 6;
- indices[baseNdx + 0] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
- indices[baseNdx + 1] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
- indices[baseNdx + 2] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
+ indices[baseNdx + 0] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+ indices[baseNdx + 1] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+ indices[baseNdx + 2] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
- indices[baseNdx + 3] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
- indices[baseNdx + 4] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
- indices[baseNdx + 5] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
+ indices[baseNdx + 3] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+ indices[baseNdx + 4] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+ indices[baseNdx + 5] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
}
m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a grid with the shader. Setting a_attr for each vertex to (special, special, 1, 1)." << tcu::TestLog::EndMessage;
@@ -858,13 +858,13 @@
{
const int baseNdx = (x * (DE_LENGTH_OF_ARRAY(s_specialFloats)) + y) * 6;
- indices[baseNdx + 0] = (x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0);
- indices[baseNdx + 1] = (x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1);
- indices[baseNdx + 2] = (x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0);
+ indices[baseNdx + 0] = (deUint16)((x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0));
+ indices[baseNdx + 1] = (deUint16)((x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1));
+ indices[baseNdx + 2] = (deUint16)((x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0));
- indices[baseNdx + 3] = (x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0);
- indices[baseNdx + 4] = (x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1);
- indices[baseNdx + 5] = (x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1);
+ indices[baseNdx + 3] = (deUint16)((x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+0));
+ indices[baseNdx + 4] = (deUint16)((x+1) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1));
+ indices[baseNdx + 5] = (deUint16)((x+0) * (DE_LENGTH_OF_ARRAY(s_specialFloats) + 1) + (y+1));
}
m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a grid with the shader. Setting u_special for vertex each tile to (special, special, 1, 1)." << tcu::TestLog::EndMessage;
@@ -1188,13 +1188,13 @@
{
const int baseNdx = (x * (gridSize - 1) + y) * 6;
- indices[baseNdx + 0] = (x+0) * gridSize + (y+0);
- indices[baseNdx + 1] = (x+1) * gridSize + (y+1);
- indices[baseNdx + 2] = (x+1) * gridSize + (y+0);
+ indices[baseNdx + 0] = (deUint16)((x+0) * gridSize + (y+0));
+ indices[baseNdx + 1] = (deUint16)((x+1) * gridSize + (y+1));
+ indices[baseNdx + 2] = (deUint16)((x+1) * gridSize + (y+0));
- indices[baseNdx + 3] = (x+0) * gridSize + (y+0);
- indices[baseNdx + 4] = (x+1) * gridSize + (y+1);
- indices[baseNdx + 5] = (x+0) * gridSize + (y+1);
+ indices[baseNdx + 3] = (deUint16)((x+0) * gridSize + (y+0));
+ indices[baseNdx + 4] = (deUint16)((x+1) * gridSize + (y+1));
+ indices[baseNdx + 5] = (deUint16)((x+0) * gridSize + (y+1));
}
m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a textured grid with the shader." << tcu::TestLog::EndMessage;
@@ -1503,13 +1503,13 @@
{
const int baseNdx = (x * (DE_LENGTH_OF_ARRAY(s_specialFloats) - 1) + y) * 6;
- indices[baseNdx + 0] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
- indices[baseNdx + 1] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
- indices[baseNdx + 2] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
+ indices[baseNdx + 0] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+ indices[baseNdx + 1] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+ indices[baseNdx + 2] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
- indices[baseNdx + 3] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0);
- indices[baseNdx + 4] = (x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
- indices[baseNdx + 5] = (x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1);
+ indices[baseNdx + 3] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+0));
+ indices[baseNdx + 4] = (deUint16)((x+1) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
+ indices[baseNdx + 5] = (deUint16)((x+0) * DE_LENGTH_OF_ARRAY(s_specialFloats) + (y+1));
}
m_testCtx.getLog() << tcu::TestLog::Message << "Drawing a textured grid with the shader. Sampling from the texture using special floating point values." << tcu::TestLog::EndMessage;
@@ -1698,13 +1698,13 @@
{
const int baseNdx = y * 6;
- indices[baseNdx + 0] = (y + 0) * 2;
- indices[baseNdx + 1] = (y + 1) * 2;
- indices[baseNdx + 2] = (y + 1) * 2 + 1;
+ indices[baseNdx + 0] = (deUint16)((y + 0) * 2);
+ indices[baseNdx + 1] = (deUint16)((y + 1) * 2);
+ indices[baseNdx + 2] = (deUint16)((y + 1) * 2 + 1);
- indices[baseNdx + 3] = (y + 0) * 2;
- indices[baseNdx + 4] = (y + 1) * 2 + 1;
- indices[baseNdx + 5] = (y + 0) * 2 + 1;
+ indices[baseNdx + 3] = (deUint16)((y + 0) * 2);
+ indices[baseNdx + 4] = (deUint16)((y + 1) * 2 + 1);
+ indices[baseNdx + 5] = (deUint16)((y + 0) * 2 + 1);
}
// Draw grids
@@ -1899,13 +1899,13 @@
{
const int baseNdx = (x * numBlendFuncs + y) * 6;
- indices[baseNdx + 0] = (x+0) * (numBlendFuncs + 1) + (y+0);
- indices[baseNdx + 1] = (x+1) * (numBlendFuncs + 1) + (y+1);
- indices[baseNdx + 2] = (x+1) * (numBlendFuncs + 1) + (y+0);
+ indices[baseNdx + 0] = (deUint16)((x+0) * (numBlendFuncs + 1) + (y+0));
+ indices[baseNdx + 1] = (deUint16)((x+1) * (numBlendFuncs + 1) + (y+1));
+ indices[baseNdx + 2] = (deUint16)((x+1) * (numBlendFuncs + 1) + (y+0));
- indices[baseNdx + 3] = (x+0) * (numBlendFuncs + 1) + (y+0);
- indices[baseNdx + 4] = (x+1) * (numBlendFuncs + 1) + (y+1);
- indices[baseNdx + 5] = (x+0) * (numBlendFuncs + 1) + (y+1);
+ indices[baseNdx + 3] = (deUint16)((x+0) * (numBlendFuncs + 1) + (y+0));
+ indices[baseNdx + 4] = (deUint16)((x+1) * (numBlendFuncs + 1) + (y+1));
+ indices[baseNdx + 5] = (deUint16)((x+0) * (numBlendFuncs + 1) + (y+1));
}
// Draw tiles
@@ -2038,9 +2038,9 @@
gl.uniform4fv(uColorLoc, 1, color.getPtr());
deUint16 indices[3];
- indices[0] = rnd.getInt(0, maxVertexIndex);
- indices[1] = rnd.getInt(0, maxVertexIndex);
- indices[2] = rnd.getInt(0, maxVertexIndex);
+ indices[0] = (deUint16)rnd.getInt(0, maxVertexIndex);
+ indices[1] = (deUint16)rnd.getInt(0, maxVertexIndex);
+ indices[2] = (deUint16)rnd.getInt(0, maxVertexIndex);
gl.drawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, indices);
}
diff --git a/modules/gles31/functional/es31fCopyImageTests.cpp b/modules/gles31/functional/es31fCopyImageTests.cpp
index 1d681aa..98c10af 100644
--- a/modules/gles31/functional/es31fCopyImageTests.cpp
+++ b/modules/gles31/functional/es31fCopyImageTests.cpp
@@ -1046,7 +1046,7 @@
for (int slice = 0; slice < levelSize.z(); slice++)
{
const RandomViewport viewport (renderContext.getRenderTarget(), levelSize.x(), levelSize.y(), rng.getUint32());
- const float r = (float(slice) + 0.5f) / levelSize.z();
+ const float r = (float(slice) + 0.5f) / (float)levelSize.z();
tcu::Surface renderedFrame (viewport.width, viewport.height);
tcu::Surface referenceFrame (viewport.width, viewport.height);
vector<float> texCoord;
diff --git a/modules/gles31/functional/es31fDrawTests.cpp b/modules/gles31/functional/es31fDrawTests.cpp
index 0664137..f8c4f5b 100644
--- a/modules/gles31/functional/es31fDrawTests.cpp
+++ b/modules/gles31/functional/es31fDrawTests.cpp
@@ -820,8 +820,8 @@
deInt32 offsetLocation = ctx.getAttribLocation(programID, "a_offset");
deInt32 colorLocation = ctx.getAttribLocation(programID, "a_color");
- float cellW = 2.0f / m_gridSide;
- float cellH = 2.0f / m_gridSide;
+ float cellW = 2.0f / (float)m_gridSide;
+ float cellH = 2.0f / (float)m_gridSide;
const tcu::Vec4 vertexPositions[] =
{
tcu::Vec4(0, 0, 0, 1),
@@ -842,7 +842,7 @@
std::vector<tcu::Vec4> offsets;
for (int x = 0; x < m_gridSide; ++x)
for (int y = 0; y < m_gridSide; ++y)
- offsets.push_back(tcu::Vec4(x * cellW - 1.0f, y * cellW - 1.0f, 0, 0));
+ offsets.push_back(tcu::Vec4((float)x * cellW - 1.0f, (float)y * cellW - 1.0f, 0, 0));
std::vector<tcu::Vec4> colors;
for (int x = 0; x < m_gridSide; ++x)
@@ -1034,7 +1034,7 @@
, m_computeCmd (computeCmd)
, m_computeData (computeData)
, m_computeIndices (computeIndices)
- , m_commandSize ((method==DRAWMETHOD_DRAWARRAYS) ? (sizeof(DrawArraysCommand)) : (sizeof(DrawElementsCommand)))
+ , m_commandSize ((method==DRAWMETHOD_DRAWARRAYS) ? ((int)sizeof(DrawArraysCommand)) : ((int)sizeof(DrawElementsCommand)))
, m_numDrawCmds (drawCallCount)
, m_gridSize (gridSize)
, m_cmdBufferID (0)
@@ -1410,8 +1410,8 @@
for (int y = 0; y < m_gridSize; ++y)
for (int x = 0; x < m_gridSize; ++x)
{
- const float posX = (x / (float)m_gridSize) * 2.0f - 1.0f;
- const float posY = (y / (float)m_gridSize) * 2.0f - 1.0f;
+ const float posX = ((float)x / (float)m_gridSize) * 2.0f - 1.0f;
+ const float posY = ((float)y / (float)m_gridSize) * 2.0f - 1.0f;
const float cellSize = 2.0f / (float)m_gridSize;
const tcu::Vec4& color = ((x + y)%2) ? (yellow) : (green);
@@ -1444,8 +1444,8 @@
for (int y = 0; y < m_gridSize+1; ++y)
for (int x = 0; x < m_gridSize+1; ++x)
{
- const float posX = (x / (float)m_gridSize) * 2.0f - 1.0f;
- const float posY = (y / (float)m_gridSize) * 2.0f - 1.0f;
+ const float posX = ((float)x / (float)m_gridSize) * 2.0f - 1.0f;
+ const float posY = ((float)y / (float)m_gridSize) * 2.0f - 1.0f;
buffer[(y * (m_gridSize+1) + x) * 4 + 0] = tcu::Vec4(posX, posY, 0.0f, 1.0f);
buffer[(y * (m_gridSize+1) + x) * 4 + 1] = green;
@@ -1502,8 +1502,8 @@
// Setup buffers
gl.bindBuffer(GL_ARRAY_BUFFER, m_dataBufferID);
- gl.vertexAttribPointer(positionLoc, 4, GL_FLOAT, GL_FALSE, 8 * sizeof(float), DE_NULL);
- gl.vertexAttribPointer(colorLoc, 4, GL_FLOAT, GL_FALSE, 8 * sizeof(float), ((const deUint8*)DE_NULL) + 4*sizeof(float));
+ gl.vertexAttribPointer(positionLoc, 4, GL_FLOAT, GL_FALSE, 8 * (int)sizeof(float), DE_NULL);
+ gl.vertexAttribPointer(colorLoc, 4, GL_FLOAT, GL_FALSE, 8 * (int)sizeof(float), ((const deUint8*)DE_NULL) + 4*sizeof(float));
gl.enableVertexAttribArray(positionLoc);
gl.enableVertexAttribArray(colorLoc);
diff --git a/modules/gles31/functional/es31fGeometryShaderTests.cpp b/modules/gles31/functional/es31fGeometryShaderTests.cpp
index e75eb28..ae92528 100644
--- a/modules/gles31/functional/es31fGeometryShaderTests.cpp
+++ b/modules/gles31/functional/es31fGeometryShaderTests.cpp
@@ -835,8 +835,8 @@
for (int ndx = 0; ndx < emitCount / 2; ++ndx)
{
- output.EmitVertex(vertex->position + tcu::Vec4(2 * ndx * colWidth, 0.0, 0.0, 0.0), vertex->pointSize, vertex->outputs, packets[packetNdx].primitiveIDIn);
- output.EmitVertex(vertex->position + tcu::Vec4(2 * ndx * colWidth, rowHeight, 0.0, 0.0), vertex->pointSize, vertex->outputs, packets[packetNdx].primitiveIDIn);
+ output.EmitVertex(vertex->position + tcu::Vec4(2 * (float)ndx * colWidth, 0.0, 0.0, 0.0), vertex->pointSize, vertex->outputs, packets[packetNdx].primitiveIDIn);
+ output.EmitVertex(vertex->position + tcu::Vec4(2 * (float)ndx * colWidth, rowHeight, 0.0, 0.0), vertex->pointSize, vertex->outputs, packets[packetNdx].primitiveIDIn);
}
output.EndPrimitive();
}
@@ -1283,7 +1283,7 @@
else if (m_test == READ_TEXTURE)
{
const int primitiveNdx = (m_instanced) ? (invocationID) : ((int)vertex->outputs[0].get<float>().x());
- const tcu::Vec2 texCoord = tcu::Vec2(1.0f / 8.0f + primitiveNdx / 4.0f, 0.5f);
+ const tcu::Vec2 texCoord = tcu::Vec2(1.0f / 8.0f + (float)primitiveNdx / 4.0f, 0.5f);
const tcu::Vec4 texColor = m_sampler.sampler.tex2D->sample(texCoord.x(), texCoord.y(), 0.0f);
DE_ASSERT(primitiveNdx >= 0);
@@ -2456,7 +2456,7 @@
for (int ndx = 0; ndx < m_primitiveCount; ++ndx)
{
- m_vertexPosData[ndx] = tcu::Vec4(-1.0f, ((float)ndx) / m_primitiveCount * 2.0f - 1.0f, 0.0f, 1.0f);
+ m_vertexPosData[ndx] = tcu::Vec4(-1.0f, ((float)ndx) / (float)m_primitiveCount * 2.0f - 1.0f, 0.0f, 1.0f);
m_vertexAttrData[ndx] = (ndx % 2 == 0) ? tcu::Vec4(1, 1, 1, 1) : tcu::Vec4(1, 0, 0, 1);
}
@@ -3346,7 +3346,7 @@
if (layerNdx == 0)
return verifyEmptyImage(layer);
else
- return verifyImageSingleColoredRow(layer, layerNdx / (float)m_numLayers, white);
+ return verifyImageSingleColoredRow(layer, (float)layerNdx / (float)m_numLayers, white);
case TEST_LAYER_ID:
{
@@ -3388,7 +3388,7 @@
{
DE_ASSERT(rowWidthRatio > 0.0f);
- const int barLength = (int)(rowWidthRatio*layer.getWidth());
+ const int barLength = (int)(rowWidthRatio * (float)layer.getWidth());
const int barLengthThreshold = 1;
tcu::Surface errorMask (layer.getWidth(), layer.getHeight());
bool allPixelsOk = true;
@@ -4589,12 +4589,12 @@
gl.bindBuffer(GL_ARRAY_BUFFER, *buffer);
gl.bufferData(GL_ARRAY_BUFFER, (int)sizeof(vertexData), vertexData, GL_STATIC_DRAW);
- gl.vertexAttribPointer(positionLocation, 4, GL_FLOAT, GL_FALSE, 2 * sizeof(tcu::Vec4), DE_NULL);
+ gl.vertexAttribPointer(positionLocation, 4, GL_FLOAT, GL_FALSE, 2 * (int)sizeof(tcu::Vec4), DE_NULL);
gl.enableVertexAttribArray(positionLocation);
if (oneLocation != -1)
{
- gl.vertexAttribPointer(oneLocation, 4, GL_FLOAT, GL_FALSE, 2 * sizeof(tcu::Vec4), (const tcu::Vec4*)DE_NULL + 1);
+ gl.vertexAttribPointer(oneLocation, 4, GL_FLOAT, GL_FALSE, 2 * (int)sizeof(tcu::Vec4), (const tcu::Vec4*)DE_NULL + 1);
gl.enableVertexAttribArray(oneLocation);
}
@@ -5360,7 +5360,7 @@
};
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
- const int feedbackSize = 8 * sizeof(float[4]);
+ const int feedbackSize = 8 * (int)sizeof(float[4]);
m_vao = new glu::VertexArray(m_context.getRenderContext());
gl.bindVertexArray(**m_vao);
diff --git a/modules/gles31/functional/es31fMultisampleTests.cpp b/modules/gles31/functional/es31fMultisampleTests.cpp
index 028eef2..4a77f95 100644
--- a/modules/gles31/functional/es31fMultisampleTests.cpp
+++ b/modules/gles31/functional/es31fMultisampleTests.cpp
@@ -101,7 +101,7 @@
for (int ndx = 0; ndx < numWords - 1; ++ndx)
mask[ndx] = 0xFFFFFFFF;
- mask[numWords - 1] = (deUint32)((1ULL << topWordBits) - (deUint32)1);
+ mask[numWords - 1] = deBitMask32(0, (int)topWordBits);
return mask;
}
@@ -490,7 +490,7 @@
for (int triNdx = 0; triNdx < numTriangles; triNdx++)
{
const float angle0 = 2.0f*DE_PI * (float)triNdx / (float)numTriangles;
- const float angle1 = 2.0f*DE_PI * (float)(triNdx + 0.5f) / (float)numTriangles;
+ const float angle1 = 2.0f*DE_PI * ((float)triNdx + 0.5f) / (float)numTriangles;
const Vec4 color = Vec4(0.4f + (float)triNdx/(float)numTriangles*0.6f,
0.5f + (float)triNdx/(float)numTriangles*0.3f,
0.6f - (float)triNdx/(float)numTriangles*0.5f,
@@ -499,7 +499,7 @@
const int wordCount = getEffectiveSampleMaskWordCount(m_numSamples - 1);
const GLbitfield finalWordBits = m_numSamples - 32 * ((m_numSamples-1) / 32);
- const GLbitfield finalWordMask = (GLbitfield)(1ULL << finalWordBits) - 1UL;
+ const GLbitfield finalWordMask = (GLbitfield)deBitMask32(0, (int)finalWordBits);
for (int wordNdx = 0; wordNdx < wordCount; ++wordNdx)
{
@@ -809,7 +809,7 @@
{
const int wordCount = getEffectiveSampleMaskWordCount(m_numSamples - 1);
const GLbitfield finalWordBits = m_numSamples - 32 * ((m_numSamples-1) / 32);
- const GLbitfield finalWordMask = (GLbitfield)(1ULL << finalWordBits) - 1UL;
+ const GLbitfield finalWordMask = (GLbitfield)deBitMask32(0, (int)finalWordBits);
for (int wordNdx = 0; wordNdx < wordCount; ++wordNdx)
{
@@ -936,7 +936,7 @@
const int wordCount = getEffectiveSampleMaskWordCount(m_numSamples - 1);
const GLbitfield finalWordBits = m_numSamples - 32 * ((m_numSamples-1) / 32);
- const GLbitfield finalWordMask = (GLbitfield)(1ULL << finalWordBits) - 1UL;
+ const GLbitfield finalWordMask = (GLbitfield)deBitMask32(0, (int)finalWordBits);
for (int wordNdx = 0; wordNdx < wordCount; ++wordNdx)
{
diff --git a/modules/gles31/functional/es31fPrimitiveBoundingBoxTests.cpp b/modules/gles31/functional/es31fPrimitiveBoundingBoxTests.cpp
index ea8109a..d25314e 100644
--- a/modules/gles31/functional/es31fPrimitiveBoundingBoxTests.cpp
+++ b/modules/gles31/functional/es31fPrimitiveBoundingBoxTests.cpp
@@ -108,10 +108,10 @@
tcu::Vec4 vertexBox;
tcu::IVec4 pixelBox;
- vertexBox.x() = (bbox.min.x() * 0.5f + 0.5f) * viewportSize.x();
- vertexBox.y() = (bbox.min.y() * 0.5f + 0.5f) * viewportSize.y();
- vertexBox.z() = (bbox.max.x() * 0.5f + 0.5f) * viewportSize.x();
- vertexBox.w() = (bbox.max.y() * 0.5f + 0.5f) * viewportSize.y();
+ vertexBox.x() = (bbox.min.x() * 0.5f + 0.5f) * (float)viewportSize.x();
+ vertexBox.y() = (bbox.min.y() * 0.5f + 0.5f) * (float)viewportSize.y();
+ vertexBox.z() = (bbox.max.x() * 0.5f + 0.5f) * (float)viewportSize.x();
+ vertexBox.w() = (bbox.max.y() * 0.5f + 0.5f) * (float)viewportSize.y();
pixelBox.x() = deFloorFloatToInt32(vertexBox.x() - size/2.0f);
pixelBox.y() = deFloorFloatToInt32(vertexBox.y() - size/2.0f);
@@ -775,10 +775,10 @@
tcu::Vec4 vertexBox;
tcu::IVec4 pixelBox;
- vertexBox.x() = (patternPos.x() * 0.5f + 0.5f) * viewportSize.x();
- vertexBox.y() = (patternPos.y() * 0.5f + 0.5f) * viewportSize.y();
- vertexBox.z() = ((patternPos.x() + patternSize.x()) * 0.5f + 0.5f) * viewportSize.x();
- vertexBox.w() = ((patternPos.y() + patternSize.y()) * 0.5f + 0.5f) * viewportSize.y();
+ vertexBox.x() = (patternPos.x() * 0.5f + 0.5f) * (float)viewportSize.x();
+ vertexBox.y() = (patternPos.y() * 0.5f + 0.5f) * (float)viewportSize.y();
+ vertexBox.z() = ((patternPos.x() + patternSize.x()) * 0.5f + 0.5f) * (float)viewportSize.x();
+ vertexBox.w() = ((patternPos.y() + patternSize.y()) * 0.5f + 0.5f) * (float)viewportSize.y();
if (roundDir == ROUND_INWARDS)
{
@@ -1230,17 +1230,17 @@
const int cellY = cellNdx / m_gridSize;
const tcu::Vec4& cellColor = ((cellX+cellY)%2 == 0) ? (green) : (yellow);
- data[(ndx * 6 + 0) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((cellX+0) / float(m_gridSize), (cellY+0) / float(m_gridSize), 0.0f, 1.0f);
+ data[(ndx * 6 + 0) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(cellX+0) / float(m_gridSize), float(cellY+0) / float(m_gridSize), 0.0f, 1.0f);
data[(ndx * 6 + 0) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = cellColor;
- data[(ndx * 6 + 1) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((cellX+1) / float(m_gridSize), (cellY+1) / float(m_gridSize), 0.0f, 1.0f);
+ data[(ndx * 6 + 1) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(cellX+1) / float(m_gridSize), float(cellY+1) / float(m_gridSize), 0.0f, 1.0f);
data[(ndx * 6 + 1) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = cellColor;
- data[(ndx * 6 + 2) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((cellX+0) / float(m_gridSize), (cellY+1) / float(m_gridSize), 0.0f, 1.0f);
+ data[(ndx * 6 + 2) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(cellX+0) / float(m_gridSize), float(cellY+1) / float(m_gridSize), 0.0f, 1.0f);
data[(ndx * 6 + 2) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = cellColor;
- data[(ndx * 6 + 3) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((cellX+0) / float(m_gridSize), (cellY+0) / float(m_gridSize), 0.0f, 1.0f);
+ data[(ndx * 6 + 3) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(cellX+0) / float(m_gridSize), float(cellY+0) / float(m_gridSize), 0.0f, 1.0f);
data[(ndx * 6 + 3) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = cellColor;
- data[(ndx * 6 + 4) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((cellX+1) / float(m_gridSize), (cellY+0) / float(m_gridSize), 0.0f, 1.0f);
+ data[(ndx * 6 + 4) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(cellX+1) / float(m_gridSize), float(cellY+0) / float(m_gridSize), 0.0f, 1.0f);
data[(ndx * 6 + 4) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = cellColor;
- data[(ndx * 6 + 5) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((cellX+1) / float(m_gridSize), (cellY+1) / float(m_gridSize), 0.0f, 1.0f);
+ data[(ndx * 6 + 5) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(cellX+1) / float(m_gridSize), float(cellY+1) / float(m_gridSize), 0.0f, 1.0f);
data[(ndx * 6 + 5) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = cellColor;
}
}
@@ -1702,8 +1702,8 @@
{
const IterationConfig& config = generateRandomConfig((0xDEDEDEu * (deUint32)iteration) ^ (0xABAB13 * attemptNdx), renderTargetSize);
- if (config.viewportSize.x() * (config.patternSize.x() * 0.5f) > 2.5f * m_patternSide * m_wideLineLineWidth &&
- config.viewportSize.y() * (config.patternSize.y() * 0.5f) > 2.5f * m_patternSide * m_wideLineLineWidth)
+ if ((float)config.viewportSize.x() * (config.patternSize.x() * 0.5f) > 2.5f * (float)m_patternSide * (float)m_wideLineLineWidth &&
+ (float)config.viewportSize.y() * (config.patternSize.y() * 0.5f) > 2.5f * (float)m_patternSide * (float)m_wideLineLineWidth)
{
return config;
}
@@ -1735,16 +1735,16 @@
if (direction)
{
- data[(ndx * 2 + 0) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(minorCoord / float(m_patternSide), majorCoord / float(m_patternSide), 0.0f, 1.0f);
+ data[(ndx * 2 + 0) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(minorCoord) / float(m_patternSide), float(majorCoord) / float(m_patternSide), 0.0f, 1.0f);
data[(ndx * 2 + 0) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = green;
- data[(ndx * 2 + 1) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(minorCoord / float(m_patternSide), (majorCoord + 1) / float(m_patternSide), 0.0f, 1.0f);
+ data[(ndx * 2 + 1) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(minorCoord) / float(m_patternSide), float(majorCoord + 1) / float(m_patternSide), 0.0f, 1.0f);
data[(ndx * 2 + 1) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = green;
}
else
{
- data[(ndx * 2 + 0) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(majorCoord / float(m_patternSide), minorCoord / float(m_patternSide), 0.0f, 1.0f);
+ data[(ndx * 2 + 0) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(majorCoord) / float(m_patternSide), float(minorCoord) / float(m_patternSide), 0.0f, 1.0f);
data[(ndx * 2 + 0) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = blue;
- data[(ndx * 2 + 1) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((majorCoord + 1) / float(m_patternSide), minorCoord / float(m_patternSide), 0.0f, 1.0f);
+ data[(ndx * 2 + 1) * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(majorCoord + 1) / float(m_patternSide), float(minorCoord) / float(m_patternSide), 0.0f, 1.0f);
data[(ndx * 2 + 1) * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = blue;
}
}
@@ -1773,7 +1773,7 @@
if (m_isWideLineCase)
gl.lineWidth((float)m_wideLineLineWidth);
- gl.uniform1f(gl.getUniformLocation(m_program->getProgram(), "u_lineWidth"), (m_isWideLineCase) ? (m_wideLineLineWidth) : (1.0f));
+ gl.uniform1f(gl.getUniformLocation(m_program->getProgram(), "u_lineWidth"), (m_isWideLineCase) ? ((float)m_wideLineLineWidth) : (1.0f));
m_testCtx.getLog() << tcu::TestLog::Message << "Rendering pattern." << tcu::TestLog::EndMessage;
@@ -1790,7 +1790,7 @@
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
const bool isMsaa = m_context.getRenderTarget().getNumSamples() > 1;
const ProjectedBBox projectedBBox = projectBoundingBox(config.bbox);
- const float lineWidth = (m_isWideLineCase) ? (m_wideLineLineWidth) : (1.0f);
+ const float lineWidth = (m_isWideLineCase) ? ((float)m_wideLineLineWidth) : (1.0f);
const tcu::IVec4 viewportBBoxArea = getViewportBoundingBoxArea(projectedBBox, config.viewportSize, lineWidth);
const tcu::IVec4 viewportPatternArea = getViewportPatternArea(config.patternPos, config.patternSize, config.viewportSize, ROUND_INWARDS);
const tcu::IVec2 expectedHorizontalLines = getNumberOfLinesRange(viewportBBoxArea.y(), viewportBBoxArea.w(), config.patternPos.y(), config.patternSize.y(), config.viewportSize.y(), DIRECTION_VERTICAL);
@@ -1926,18 +1926,18 @@
for (int lineNdx = patternStartNdx; lineNdx < patternEndNdx; ++lineNdx)
{
- const float linePos = (patternStart + (lineNdx / float(m_patternSide)) * patternSize) * 0.5f + 0.5f;
- const float lineWidth = (m_isWideLineCase) ? (m_wideLineLineWidth) : (1.0f);
+ const float linePos = (patternStart + (float(lineNdx) / float(m_patternSide)) * patternSize) * 0.5f + 0.5f;
+ const float lineWidth = (m_isWideLineCase) ? ((float)m_wideLineLineWidth) : (1.0f);
- if (linePos * viewportArea > queryAreaBegin + 1.0f &&
- linePos * viewportArea < queryAreaEnd - 1.0f)
+ if (linePos * (float)viewportArea > (float)queryAreaBegin + 1.0f &&
+ linePos * (float)viewportArea < (float)queryAreaEnd - 1.0f)
{
// line center is within the area
++numLinesMin;
++numLinesMax;
}
- else if (linePos * viewportArea > queryAreaBegin - lineWidth*0.5f - 1.0f &&
- linePos * viewportArea < queryAreaEnd + lineWidth*0.5f + 1.0f)
+ else if (linePos * (float)viewportArea > (float)queryAreaBegin - lineWidth*0.5f - 1.0f &&
+ linePos * (float)viewportArea < (float)queryAreaEnd + lineWidth*0.5f + 1.0f)
{
// line could leak into area
++numLinesMax;
@@ -1952,8 +1952,8 @@
const bool numLinesOk = checkAreaNumLines(access, tcu::IVec4(rowBegin, row, rowEnd - rowBegin, 1), messageLimitCounter, SCAN_ROW_COMPONENT_NDX, numLines);
const bool lineWidthOk = checkLineWidths(access, tcu::IVec2(rowBegin, row), tcu::IVec2(rowEnd, row), SCAN_ROW_COMPONENT_NDX, messageLimitCounter);
- return (numLinesOk ? (deUint8)SCANRESULT_NUM_LINES_OK_BIT : 0u) |
- (lineWidthOk ? (deUint8)SCANRESULT_LINE_WIDTH_OK_BIT : 0u);
+ return (deUint8)((numLinesOk ? (deUint8)SCANRESULT_NUM_LINES_OK_BIT : 0u) |
+ (lineWidthOk ? (deUint8)SCANRESULT_LINE_WIDTH_OK_BIT : 0u));
}
deUint8 LineRenderCase::scanColumn (const tcu::ConstPixelBufferAccess& access, int column, int columnBegin, int columnEnd, const tcu::IVec2& numLines, int& messageLimitCounter) const
@@ -1961,8 +1961,8 @@
const bool numLinesOk = checkAreaNumLines(access, tcu::IVec4(column, columnBegin, 1, columnEnd - columnBegin), messageLimitCounter, SCAN_COL_COMPONENT_NDX, numLines);
const bool lineWidthOk = checkLineWidths(access, tcu::IVec2(column, columnBegin), tcu::IVec2(column, columnEnd), SCAN_COL_COMPONENT_NDX, messageLimitCounter);
- return (numLinesOk ? (deUint8)SCANRESULT_NUM_LINES_OK_BIT : 0u) |
- (lineWidthOk ? (deUint8)SCANRESULT_LINE_WIDTH_OK_BIT : 0u);
+ return (deUint8)((numLinesOk ? (deUint8)SCANRESULT_NUM_LINES_OK_BIT : 0u) |
+ (lineWidthOk ? (deUint8)SCANRESULT_LINE_WIDTH_OK_BIT : 0u));
}
bool LineRenderCase::checkAreaNumLines (const tcu::ConstPixelBufferAccess& access, const tcu::IVec4& area, int& messageLimitCounter, int componentNdx, const tcu::IVec2& numLines) const
@@ -2567,12 +2567,12 @@
if (direction)
{
- m_attribData[ndx * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(minorCoord / float(m_numStripes), majorCoord / float(m_numStripes), 0.0f, 1.0f);
+ m_attribData[ndx * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(float(minorCoord) / float(m_numStripes), float(majorCoord) / float(m_numStripes), 0.0f, 1.0f);
m_attribData[ndx * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = green;
}
else
{
- m_attribData[ndx * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4((majorCoord + 0.5f) / float(m_numStripes), (minorCoord + 0.5f) / float(m_numStripes), 0.0f, 1.0f);
+ m_attribData[ndx * VA_NUM_ATTRIB_VECS + VA_POS_VEC_NDX] = tcu::Vec4(((float)majorCoord + 0.5f) / float(m_numStripes), ((float)minorCoord + 0.5f) / float(m_numStripes), 0.0f, 1.0f);
m_attribData[ndx * VA_NUM_ATTRIB_VECS + VA_COL_VEC_NDX] = blue;
}
}
@@ -2791,7 +2791,8 @@
else
{
// transform to viewport coords
- const tcu::IVec2 pixelCenter(deRoundFloatToInt32((refPoint.center.x() * 0.5f + 0.5f) * viewport.getWidth()), deRoundFloatToInt32((refPoint.center.y() * 0.5f + 0.5f) * viewport.getHeight()));
+ const tcu::IVec2 pixelCenter(deRoundFloatToInt32((refPoint.center.x() * 0.5f + 0.5f) * (float)viewport.getWidth()),
+ deRoundFloatToInt32((refPoint.center.y() * 0.5f + 0.5f) * (float)viewport.getHeight()));
// find rasterized point in the result
if (pixelCenter.x() < 1 || pixelCenter.y() < 1 || pixelCenter.x() >= viewport.getWidth()-1 || pixelCenter.y() >= viewport.getHeight()-1)
@@ -2850,10 +2851,10 @@
// point fully in the bounding box
anyError |= !verifyWidePoint(viewport, refPoint, bbox, POINT_FULL, logFloodCounter);
}
- else if (refPoint.center.x() >= bbox.min.x() + refPoint.size / 2.0f &&
- refPoint.center.y() >= bbox.min.y() - refPoint.size / 2.0f &&
- refPoint.center.x() <= bbox.max.x() + refPoint.size / 2.0f &&
- refPoint.center.y() <= bbox.max.y() - refPoint.size / 2.0f)
+ else if (refPoint.center.x() >= bbox.min.x() + (float)refPoint.size / 2.0f &&
+ refPoint.center.y() >= bbox.min.y() - (float)refPoint.size / 2.0f &&
+ refPoint.center.x() <= bbox.max.x() + (float)refPoint.size / 2.0f &&
+ refPoint.center.y() <= bbox.max.y() - (float)refPoint.size / 2.0f)
{
// point leaks into bounding box
anyError |= !verifyWidePoint(viewport, refPoint, bbox, POINT_PARTIAL, logFloodCounter);
@@ -2873,8 +2874,8 @@
de::max(viewportBBoxArea.y(), 0),
de::min(viewportBBoxArea.z(), viewport.getWidth()),
de::min(viewportBBoxArea.w(), viewport.getHeight()));
- const tcu::IVec2 pointPos = tcu::IVec2(deRoundFloatToInt32((refPoint.center.x()*0.5f + 0.5f) * viewport.getWidth()),
- deRoundFloatToInt32((refPoint.center.y()*0.5f + 0.5f) * viewport.getHeight()));
+ const tcu::IVec2 pointPos = tcu::IVec2(deRoundFloatToInt32((refPoint.center.x()*0.5f + 0.5f) * (float)viewport.getWidth()),
+ deRoundFloatToInt32((refPoint.center.y()*0.5f + 0.5f) * (float)viewport.getHeight()));
// find any fragment within the point that is inside the bbox, start search at the center
@@ -3604,8 +3605,8 @@
m_layers.resize(m_numLayers);
for (int layerNdx = 0; layerNdx < m_numLayers; ++layerNdx)
{
- m_layers[layerNdx].zOffset = ((float)layerNdx / m_numLayers) * 2.0f - 1.0f;
- m_layers[layerNdx].zScale = (2.0f / m_numLayers);
+ m_layers[layerNdx].zOffset = ((float)layerNdx / (float)m_numLayers) * 2.0f - 1.0f;
+ m_layers[layerNdx].zScale = (2.0f / (float)m_numLayers);
m_layers[layerNdx].color1 = (layerNdx == 0) ? (tcu::Vec4(0.0f, 1.0f, 0.0f, 1.0f)) : (tcu::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
m_layers[layerNdx].color2 = (layerNdx == 0) ? (tcu::Vec4(1.0f, 1.0f, 0.0f, 1.0f)) : (tcu::Vec4(1.0f, 0.0f, 1.0f, 1.0f));
}
@@ -3861,12 +3862,12 @@
const int cellY = cellNdx / m_gridSize;
const tcu::Vec4& cellColor = ((cellX+cellY)%2 == 0) ? (color1) : (color2);
- data[ndx * 6 * 2 + 0] = tcu::Vec4((cellX+0) / float(m_gridSize) * 2.0f - 1.0f, (cellY+0) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f); data[ndx * 6 * 2 + 1] = cellColor;
- data[ndx * 6 * 2 + 2] = tcu::Vec4((cellX+1) / float(m_gridSize) * 2.0f - 1.0f, (cellY+1) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f); data[ndx * 6 * 2 + 3] = cellColor;
- data[ndx * 6 * 2 + 4] = tcu::Vec4((cellX+0) / float(m_gridSize) * 2.0f - 1.0f, (cellY+1) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f); data[ndx * 6 * 2 + 5] = cellColor;
- data[ndx * 6 * 2 + 6] = tcu::Vec4((cellX+0) / float(m_gridSize) * 2.0f - 1.0f, (cellY+0) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f); data[ndx * 6 * 2 + 7] = cellColor;
- data[ndx * 6 * 2 + 8] = tcu::Vec4((cellX+1) / float(m_gridSize) * 2.0f - 1.0f, (cellY+0) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f); data[ndx * 6 * 2 + 9] = cellColor;
- data[ndx * 6 * 2 + 10] = tcu::Vec4((cellX+1) / float(m_gridSize) * 2.0f - 1.0f, (cellY+1) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f); data[ndx * 6 * 2 + 11] = cellColor;
+ data[ndx * 6 * 2 + 0] = tcu::Vec4(float(cellX+0) / float(m_gridSize) * 2.0f - 1.0f, float(cellY+0) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f); data[ndx * 6 * 2 + 1] = cellColor;
+ data[ndx * 6 * 2 + 2] = tcu::Vec4(float(cellX+1) / float(m_gridSize) * 2.0f - 1.0f, float(cellY+1) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f); data[ndx * 6 * 2 + 3] = cellColor;
+ data[ndx * 6 * 2 + 4] = tcu::Vec4(float(cellX+0) / float(m_gridSize) * 2.0f - 1.0f, float(cellY+1) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f); data[ndx * 6 * 2 + 5] = cellColor;
+ data[ndx * 6 * 2 + 6] = tcu::Vec4(float(cellX+0) / float(m_gridSize) * 2.0f - 1.0f, float(cellY+0) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f); data[ndx * 6 * 2 + 7] = cellColor;
+ data[ndx * 6 * 2 + 8] = tcu::Vec4(float(cellX+1) / float(m_gridSize) * 2.0f - 1.0f, float(cellY+0) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f); data[ndx * 6 * 2 + 9] = cellColor;
+ data[ndx * 6 * 2 + 10] = tcu::Vec4(float(cellX+1) / float(m_gridSize) * 2.0f - 1.0f, float(cellY+1) / float(m_gridSize) * 2.0f - 1.0f, 0.0f, 0.0f); data[ndx * 6 * 2 + 11] = cellColor;
// Fill Z with random values (fake Z)
for (int vtxNdx = 0; vtxNdx < 6; ++vtxNdx)
@@ -4580,15 +4581,15 @@
if (cellSide)
{
- data[ndx * 3 + 0] = tcu::Vec4((cellX+0) / float(gridSize), ((cellY+0) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
- data[ndx * 3 + 1] = tcu::Vec4((cellX+1) / float(gridSize), ((cellY+1) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
- data[ndx * 3 + 2] = tcu::Vec4((cellX+0) / float(gridSize), ((cellY+1) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
+ data[ndx * 3 + 0] = tcu::Vec4(float(cellX+0) / float(gridSize), (float(cellY+0) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
+ data[ndx * 3 + 1] = tcu::Vec4(float(cellX+1) / float(gridSize), (float(cellY+1) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
+ data[ndx * 3 + 2] = tcu::Vec4(float(cellX+0) / float(gridSize), (float(cellY+1) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
}
else
{
- data[ndx * 3 + 0] = tcu::Vec4((cellX+0) / float(gridSize), ((cellY+0) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
- data[ndx * 3 + 1] = tcu::Vec4((cellX+1) / float(gridSize), ((cellY+0) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
- data[ndx * 3 + 2] = tcu::Vec4((cellX+1) / float(gridSize), ((cellY+1) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
+ data[ndx * 3 + 0] = tcu::Vec4(float(cellX+0) / float(gridSize), (float(cellY+0) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
+ data[ndx * 3 + 1] = tcu::Vec4(float(cellX+1) / float(gridSize), (float(cellY+0) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
+ data[ndx * 3 + 2] = tcu::Vec4(float(cellX+1) / float(gridSize), (float(cellY+1) / float(gridSize)) * 2.0f - 1.0f, 0.0f, 1.0f);
}
}
@@ -4620,8 +4621,8 @@
bool ViewportCallOrderCase::verifyImage (const tcu::PixelBufferAccess& result)
{
- const tcu::IVec2 insideBorder (deCeilFloatToInt32(0.25f * result.getWidth()) + 1, deFloorFloatToInt32(0.5f * result.getWidth()) - 1);
- const tcu::IVec2 outsideBorder (deFloorFloatToInt32(0.25f * result.getWidth()) - 1, deCeilFloatToInt32(0.5f * result.getWidth()) + 1);
+ const tcu::IVec2 insideBorder (deCeilFloatToInt32(0.25f * (float)result.getWidth()) + 1, deFloorFloatToInt32(0.5f * (float)result.getWidth()) - 1);
+ const tcu::IVec2 outsideBorder (deFloorFloatToInt32(0.25f * (float)result.getWidth()) - 1, deCeilFloatToInt32(0.5f * (float)result.getWidth()) + 1);
tcu::Surface errorMask (result.getWidth(), result.getHeight());
bool anyError = false;
diff --git a/modules/gles31/functional/es31fSSBOLayoutCase.cpp b/modules/gles31/functional/es31fSSBOLayoutCase.cpp
index 4741fe4..b265614 100644
--- a/modules/gles31/functional/es31fSSBOLayoutCase.cpp
+++ b/modules/gles31/functional/es31fSSBOLayoutCase.cpp
@@ -329,7 +329,7 @@
int getDataTypeByteSize (glu::DataType type)
{
- return glu::getDataTypeScalarSize(type)*sizeof(deUint32);
+ return glu::getDataTypeScalarSize(type)*(int)sizeof(deUint32);
}
int getDataTypeByteAlignment (glu::DataType type)
@@ -339,12 +339,12 @@
case glu::TYPE_FLOAT:
case glu::TYPE_INT:
case glu::TYPE_UINT:
- case glu::TYPE_BOOL: return 1*sizeof(deUint32);
+ case glu::TYPE_BOOL: return 1*(int)sizeof(deUint32);
case glu::TYPE_FLOAT_VEC2:
case glu::TYPE_INT_VEC2:
case glu::TYPE_UINT_VEC2:
- case glu::TYPE_BOOL_VEC2: return 2*sizeof(deUint32);
+ case glu::TYPE_BOOL_VEC2: return 2*(int)sizeof(deUint32);
case glu::TYPE_FLOAT_VEC3:
case glu::TYPE_INT_VEC3:
@@ -354,7 +354,7 @@
case glu::TYPE_FLOAT_VEC4:
case glu::TYPE_INT_VEC4:
case glu::TYPE_UINT_VEC4:
- case glu::TYPE_BOOL_VEC4: return 4*sizeof(deUint32);
+ case glu::TYPE_BOOL_VEC4: return 4*(int)sizeof(deUint32);
default:
DE_ASSERT(false);
@@ -370,7 +370,7 @@
int computeStd140BaseAlignment (const VarType& type, deUint32 layoutFlags)
{
- const int vec4Alignment = sizeof(deUint32)*4;
+ const int vec4Alignment = (int)sizeof(deUint32)*4;
if (type.isBasicType())
{
@@ -597,7 +597,7 @@
const int topLevelArraySize = varType.getArraySize() == VarType::UNSIZED_ARRAY ? 0 : varType.getArraySize();
const string prefix = blockPrefix + bufVar.getName() + "[0]";
const bool isStd140 = (blockLayoutFlags & LAYOUT_STD140) != 0;
- const int vec4Align = sizeof(deUint32)*4;
+ const int vec4Align = (int)sizeof(deUint32)*4;
const int baseAlignment = isStd140 ? computeStd140BaseAlignment(varType, combinedFlags)
: computeStd430BaseAlignment(varType, combinedFlags);
int curOffset = deAlign32(baseOffset, baseAlignment);
diff --git a/modules/gles31/functional/es31fSampleShadingTests.cpp b/modules/gles31/functional/es31fSampleShadingTests.cpp
index a05b968..c38729d 100644
--- a/modules/gles31/functional/es31fSampleShadingTests.cpp
+++ b/modules/gles31/functional/es31fSampleShadingTests.cpp
@@ -312,7 +312,7 @@
// Minimum number of samples is max(ceil(<mss> * <samples>),1). Decrease mss with epsilon to prevent
// ceiling to a too large sample count.
const float epsilon = 0.25f / (float)m_numTargetSamples;
- const float ratio = (sampleCount / (float)m_numTargetSamples) - epsilon;
+ const float ratio = ((float)sampleCount / (float)m_numTargetSamples) - epsilon;
gl.enable(GL_SAMPLE_SHADING);
gl.minSampleShading(ratio);
@@ -321,12 +321,12 @@
m_testCtx.getLog()
<< tcu::TestLog::Message
<< "Setting MIN_SAMPLE_SHADING_VALUE = " << ratio << "\n"
- << "Requested sample count: shadingValue * numSamples = " << ratio << " * " << m_numTargetSamples << " = " << (ratio * m_numTargetSamples) << "\n"
- << "Minimum sample count: ceil(shadingValue * numSamples) = ceil(" << (ratio * m_numTargetSamples) << ") = " << sampleCount
+ << "Requested sample count: shadingValue * numSamples = " << ratio << " * " << m_numTargetSamples << " = " << (ratio * (float)m_numTargetSamples) << "\n"
+ << "Minimum sample count: ceil(shadingValue * numSamples) = ceil(" << (ratio * (float)m_numTargetSamples) << ") = " << sampleCount
<< tcu::TestLog::EndMessage;
// can't fail with reasonable values of numSamples
- DE_ASSERT(deFloatCeil(ratio * m_numTargetSamples) == float(sampleCount));
+ DE_ASSERT(deFloatCeil(ratio * (float)m_numTargetSamples) == float(sampleCount));
}
}
diff --git a/modules/gles31/functional/es31fSampleVariableTests.cpp b/modules/gles31/functional/es31fSampleVariableTests.cpp
index 3172a5e..14b2c31 100644
--- a/modules/gles31/functional/es31fSampleVariableTests.cpp
+++ b/modules/gles31/functional/es31fSampleVariableTests.cpp
@@ -154,7 +154,7 @@
, m_distanceThreshold (0.0f)
{
// approximate Bates distribution as normal
- const float variance = (1.0f / (12.0f * m_numSamples));
+ const float variance = (1.0f / (12.0f * (float)m_numSamples));
const float standardDeviation = deFloatSqrt(variance);
// 95% of means of sample positions are within 2 standard deviations if
@@ -168,7 +168,7 @@
DE_UNREF(position);
DE_ASSERT(m_isStatisticallySignificant);
- const tcu::Vec2 avgPosition (testColor.getGreen() / 255.0f, testColor.getBlue() / 255.0f);
+ const tcu::Vec2 avgPosition ((float)testColor.getGreen() / 255.0f, (float)testColor.getBlue() / 255.0f);
const tcu::Vec2 distanceFromCenter = tcu::abs(avgPosition - tcu::Vec2(0.5f, 0.5f));
return distanceFromCenter.x() < m_distanceThreshold && distanceFromCenter.y() < m_distanceThreshold;
@@ -557,7 +557,7 @@
{
// sample id should be sample index
const int threshold = 255 / 4 / m_numTargetSamples + 1;
- const float sampleIdColor = sampleNdx / (float)m_numTargetSamples;
+ const float sampleIdColor = (float)sampleNdx / (float)m_numTargetSamples;
m_testCtx.getLog() << tcu::TestLog::Message << "Verifying sample " << (sampleNdx+1) << "/" << (int)resultBuffers.size() << tcu::TestLog::EndMessage;
allOk &= verifyImageWithVerifier(resultBuffers[sampleNdx], m_testCtx.getLog(), ColorVerifier(tcu::Vec3(0.0f, sampleIdColor, 1.0f), tcu::IVec3(1, threshold, 1)), false);
@@ -737,7 +737,7 @@
for (int sampleNdx = 0; sampleNdx < (int)resultBuffers.size(); ++sampleNdx)
{
const tcu::RGBA color = resultBuffers[sampleNdx].getPixel(x, y);
- samplePositions[sampleNdx] = tcu::Vec2(color.getGreen() / 255.0f, color.getBlue() / 255.0f);
+ samplePositions[sampleNdx] = tcu::Vec2((float)color.getGreen() / 255.0f, (float)color.getBlue() / 255.0f);
}
// Just check there are no two samples with same positions
@@ -1534,7 +1534,7 @@
for (int sampleNdx = 0; sampleNdx < (int)resultBuffers.size(); ++sampleNdx)
{
const tcu::RGBA color = resultBuffers[sampleNdx].getPixel(x, y);
- maskBitIndices[sampleNdx] = (int)deFloatRound(color.getGreen() / 255.0f * m_numTargetSamples);
+ maskBitIndices[sampleNdx] = (int)deFloatRound((float)color.getGreen() / 255.0f * (float)m_numTargetSamples);
}
// just check there are no two invocations with the same bit index
@@ -1748,16 +1748,16 @@
deUint16 high;
{
- int redBits = (int)deFloatRound(lowColor.getRed() / 255.0f * 31);
- int greenBits = (int)deFloatRound(lowColor.getGreen() / 255.0f * 63);
- int blueBits = (int)deFloatRound(lowColor.getBlue() / 255.0f * 31);
+ int redBits = (int)deFloatRound((float)lowColor.getRed() / 255.0f * 31);
+ int greenBits = (int)deFloatRound((float)lowColor.getGreen() / 255.0f * 63);
+ int blueBits = (int)deFloatRound((float)lowColor.getBlue() / 255.0f * 31);
low = (deUint16)(redBits | (greenBits << 5) | (blueBits << 11));
}
{
- int redBits = (int)deFloatRound(highColor.getRed() / 255.0f * 31);
- int greenBits = (int)deFloatRound(highColor.getGreen() / 255.0f * 63);
- int blueBits = (int)deFloatRound(highColor.getBlue() / 255.0f * 31);
+ int redBits = (int)deFloatRound((float)highColor.getRed() / 255.0f * 31);
+ int greenBits = (int)deFloatRound((float)highColor.getGreen() / 255.0f * 63);
+ int blueBits = (int)deFloatRound((float)highColor.getBlue() / 255.0f * 31);
high = (deUint16)(redBits | (greenBits << 5) | (blueBits << 11));
}
diff --git a/modules/gles31/functional/es31fSeparateShaderTests.cpp b/modules/gles31/functional/es31fSeparateShaderTests.cpp
index 71c7be2..2f89604 100644
--- a/modules/gles31/functional/es31fSeparateShaderTests.cpp
+++ b/modules/gles31/functional/es31fSeparateShaderTests.cpp
@@ -671,9 +671,9 @@
ProgramParams genProgramParams (Random& rnd)
{
const deUint32 vtxSeed = rnd.getUint32();
- const GLfloat vtxScale = rnd.getInt(8, 16) / 16.0f;
+ const GLfloat vtxScale = (float)rnd.getInt(8, 16) / 16.0f;
const deUint32 frgSeed = rnd.getUint32();
- const GLfloat frgScale = rnd.getInt(0, 16) / 16.0f;
+ const GLfloat frgScale = (float)rnd.getInt(0, 16) / 16.0f;
return ProgramParams(vtxSeed, vtxScale, frgSeed, frgScale);
}
diff --git a/modules/gles31/functional/es31fShaderMultisampleInterpolationTests.cpp b/modules/gles31/functional/es31fShaderMultisampleInterpolationTests.cpp
index f9ef47b..aea088f 100644
--- a/modules/gles31/functional/es31fShaderMultisampleInterpolationTests.cpp
+++ b/modules/gles31/functional/es31fShaderMultisampleInterpolationTests.cpp
@@ -781,26 +781,26 @@
m_renderSceneDescription = "triangle fan of narrow triangles";
m_renderAttribs["a_position"].offset = 0;
- m_renderAttribs["a_position"].stride = sizeof(float[4]) * 3;
- m_renderAttribs["a_barycentricsA"].offset = sizeof(float[4]);
- m_renderAttribs["a_barycentricsA"].stride = sizeof(float[4]) * 3;
- m_renderAttribs["a_barycentricsB"].offset = sizeof(float[4]) * 2;
- m_renderAttribs["a_barycentricsB"].stride = sizeof(float[4]) * 3;
+ m_renderAttribs["a_position"].stride = (int)sizeof(float[4]) * 3;
+ m_renderAttribs["a_barycentricsA"].offset = (int)sizeof(float[4]);
+ m_renderAttribs["a_barycentricsA"].stride = (int)sizeof(float[4]) * 3;
+ m_renderAttribs["a_barycentricsB"].offset = (int)sizeof(float[4]) * 2;
+ m_renderAttribs["a_barycentricsB"].stride = (int)sizeof(float[4]) * 3;
for (int triangleNdx = 0; triangleNdx < numTriangles; ++triangleNdx)
{
- const float angle = ((float)triangleNdx) / numTriangles * 2.0f * DE_PI;
- const float nextAngle = ((float)triangleNdx + 1.0f) / numTriangles * 2.0f * DE_PI;
+ const float angle = ((float)triangleNdx) / (float)numTriangles * 2.0f * DE_PI;
+ const float nextAngle = ((float)triangleNdx + 1.0f) / (float)numTriangles * 2.0f * DE_PI;
data[(triangleNdx * 3 + 0) * 3 + 0] = tcu::Vec4(0.2f, -0.3f, 0.0f, 1.0f);
data[(triangleNdx * 3 + 0) * 3 + 1] = tcu::Vec4(1.0f, 0.0f, 0.0f, 0.0f);
data[(triangleNdx * 3 + 0) * 3 + 2] = tcu::Vec4(1.0f, 0.0f, 0.0f, 0.0f);
- data[(triangleNdx * 3 + 1) * 3 + 0] = tcu::Vec4(2.0f * cos(angle), 2.0f * sin(angle), 0.0f, 1.0f);
+ data[(triangleNdx * 3 + 1) * 3 + 0] = tcu::Vec4(2.0f * deFloatCos(angle), 2.0f * deFloatSin(angle), 0.0f, 1.0f);
data[(triangleNdx * 3 + 1) * 3 + 1] = tcu::Vec4(0.0f, 1.0f, 0.0f, 0.0f);
data[(triangleNdx * 3 + 1) * 3 + 2] = tcu::Vec4(0.0f, 1.0f, 0.0f, 0.0f);
- data[(triangleNdx * 3 + 2) * 3 + 0] = tcu::Vec4(2.0f * cos(nextAngle), 2.0f * sin(nextAngle), 0.0f, 1.0f);
+ data[(triangleNdx * 3 + 2) * 3 + 0] = tcu::Vec4(2.0f * deFloatCos(nextAngle), 2.0f * deFloatSin(nextAngle), 0.0f, 1.0f);
data[(triangleNdx * 3 + 2) * 3 + 1] = tcu::Vec4(0.0f, 0.0f, 1.0f, 0.0f);
data[(triangleNdx * 3 + 2) * 3 + 2] = tcu::Vec4(0.0f, 0.0f, 1.0f, 0.0f);
}
diff --git a/modules/gles31/functional/es31fShaderPackingFunctionTests.cpp b/modules/gles31/functional/es31fShaderPackingFunctionTests.cpp
index c8129e5..deaf761 100644
--- a/modules/gles31/functional/es31fShaderPackingFunctionTests.cpp
+++ b/modules/gles31/functional/es31fShaderPackingFunctionTests.cpp
@@ -672,7 +672,7 @@
const int s = rnd.getBool() ? 1 : -1;
const int exp = rnd.getInt(minExp, maxExp);
const deUint32 mantissa = rnd.getUint32() & ((1<<mantBits)-1);
- const deUint16 value = tcu::Float16::construct(s, exp ? exp : 1 /* avoid denorm */, (1u<<10) | mantissa).bits();
+ const deUint16 value = tcu::Float16::construct(s, exp ? exp : 1 /* avoid denorm */, (deUint16)((1u<<10) | mantissa)).bits();
inVal |= value << (16*c);
}
diff --git a/modules/gles31/functional/es31fStencilTexturingTests.cpp b/modules/gles31/functional/es31fStencilTexturingTests.cpp
index 80cc264..6e41437 100644
--- a/modules/gles31/functional/es31fStencilTexturingTests.cpp
+++ b/modules/gles31/functional/es31fStencilTexturingTests.cpp
@@ -111,12 +111,12 @@
positions[rectNdx*4 + 2] = Vec2(x0, y1);
positions[rectNdx*4 + 3] = Vec2(x1, y1);
- indices[rectNdx*6 + 0] = rectNdx*4 + 0;
- indices[rectNdx*6 + 1] = rectNdx*4 + 1;
- indices[rectNdx*6 + 2] = rectNdx*4 + 2;
- indices[rectNdx*6 + 3] = rectNdx*4 + 2;
- indices[rectNdx*6 + 4] = rectNdx*4 + 1;
- indices[rectNdx*6 + 5] = rectNdx*4 + 3;
+ indices[rectNdx*6 + 0] = (deUint16)(rectNdx*4 + 0);
+ indices[rectNdx*6 + 1] = (deUint16)(rectNdx*4 + 1);
+ indices[rectNdx*6 + 2] = (deUint16)(rectNdx*4 + 2);
+ indices[rectNdx*6 + 3] = (deUint16)(rectNdx*4 + 2);
+ indices[rectNdx*6 + 4] = (deUint16)(rectNdx*4 + 1);
+ indices[rectNdx*6 + 5] = (deUint16)(rectNdx*4 + 3);
}
}
diff --git a/modules/gles31/functional/es31fSynchronizationTests.cpp b/modules/gles31/functional/es31fSynchronizationTests.cpp
index 7c13068..d84b6cb 100644
--- a/modules/gles31/functional/es31fSynchronizationTests.cpp
+++ b/modules/gles31/functional/es31fSynchronizationTests.cpp
@@ -207,7 +207,7 @@
if (m_storage == STORAGE_BUFFER)
{
const int bufferElements = m_workWidth * m_workHeight * m_elementsPerInvocation;
- const int bufferSize = bufferElements * sizeof(deUint32);
+ const int bufferSize = bufferElements * (int)sizeof(deUint32);
std::vector<deUint32> zeroBuffer (bufferElements, 0);
m_testCtx.getLog() << tcu::TestLog::Message << "Allocating zero-filled buffer for storage, size " << bufferElements << " elements, " << bufferSize << " bytes." << tcu::TestLog::EndMessage;
@@ -220,7 +220,7 @@
else if (m_storage == STORAGE_IMAGE)
{
const int bufferElements = m_workWidth * m_workHeight * m_elementsPerInvocation;
- const int bufferSize = bufferElements * sizeof(deUint32);
+ const int bufferSize = bufferElements * (int)sizeof(deUint32);
m_testCtx.getLog() << tcu::TestLog::Message << "Allocating image for storage, size " << m_workWidth << "x" << m_workHeight * m_elementsPerInvocation << ", " << bufferSize << " bytes." << tcu::TestLog::EndMessage;
@@ -247,7 +247,7 @@
{
const int bufferElements = m_workWidth * m_workHeight;
- const int bufferSize = bufferElements * sizeof(deUint32);
+ const int bufferSize = bufferElements * (int)sizeof(deUint32);
std::vector<deInt32> negativeBuffer (bufferElements, -1);
m_testCtx.getLog() << tcu::TestLog::Message << "Allocating -1 filled buffer for results, size " << bufferElements << " elements, " << bufferSize << " bytes." << tcu::TestLog::EndMessage;
@@ -1628,7 +1628,7 @@
if (m_storage == STORAGE_BUFFER)
{
const int numElements = m_invocationGridSize * m_invocationGridSize * m_perInvocationSize;
- const int bufferSize = numElements * ((m_formatInteger) ? (sizeof(deInt32)) : (sizeof(glw::GLfloat)));
+ const int bufferSize = numElements * (int)((m_formatInteger) ? (sizeof(deInt32)) : (sizeof(glw::GLfloat)));
glw::GLuint retVal = 0;
m_testCtx.getLog() << tcu::TestLog::Message << "Creating buffer #" << friendlyName << ", size " << bufferSize << " bytes." << tcu::TestLog::EndMessage;
diff --git a/modules/gles31/functional/es31fTessellationGeometryInteractionTests.cpp b/modules/gles31/functional/es31fTessellationGeometryInteractionTests.cpp
index 4fbcaaf..5fcb276 100644
--- a/modules/gles31/functional/es31fTessellationGeometryInteractionTests.cpp
+++ b/modules/gles31/functional/es31fTessellationGeometryInteractionTests.cpp
@@ -1233,7 +1233,7 @@
// This minimal error could result in a difference in rounding => allow one additional pixel in deviation
const int rasterDeviation = 2;
- const tcu::IVec2 rasterPos ((int)deFloatRound((vertices[ndx].x() * 0.5f + 0.5f) * image.getWidth()), (int)deFloatRound((vertices[ndx].y() * 0.5f + 0.5f) * image.getHeight()));
+ const tcu::IVec2 rasterPos ((int)deFloatRound((vertices[ndx].x() * 0.5f + 0.5f) * (float)image.getWidth()), (int)deFloatRound((vertices[ndx].y() * 0.5f + 0.5f) * (float)image.getHeight()));
// Find produced rasterization results
bool found = false;
diff --git a/modules/gles31/functional/es31fTessellationTests.cpp b/modules/gles31/functional/es31fTessellationTests.cpp
index 7c08f7d..c9c5dbf 100644
--- a/modules/gles31/functional/es31fTessellationTests.cpp
+++ b/modules/gles31/functional/es31fTessellationTests.cpp
@@ -1062,7 +1062,7 @@
: Vec2(-1.0f);
- drawPoint(dst, (int)(dstPos.x()*dst.getWidth()), (int)(dstPos.y()*dst.getHeight()), color, size);
+ drawPoint(dst, (int)(dstPos.x() * (float)dst.getWidth()), (int)(dstPos.y() * (float)dst.getHeight()), color, size);
}
static void drawTessCoordVisualization (tcu::Surface& dst, TessPrimitiveType primitiveType, const vector<Vec3>& coords)
@@ -1431,8 +1431,8 @@
if (curFinalLevel != prevFinalLevel)
continue;
- const float curFraction = curFinalLevel - curClampedLevel;
- const float prevFraction = prevFinalLevel - prevClampedLevel;
+ const float curFraction = (float)curFinalLevel - curClampedLevel;
+ const float prevFraction = (float)prevFinalLevel - prevClampedLevel;
if (curData.additionalSegmentLength < prevData.additionalSegmentLength ||
(curClampedLevel == prevClampedLevel && curData.additionalSegmentLength != prevData.additionalSegmentLength))
@@ -1736,12 +1736,12 @@
for (int i = 0; i < gridHeight; i++)
for (int j = 0; j < gridWidth; j++)
{
- const int corners[4] =
+ const deUint16 corners[4] =
{
- (i+0)*(gridWidth+1) + j+0,
- (i+0)*(gridWidth+1) + j+1,
- (i+1)*(gridWidth+1) + j+0,
- (i+1)*(gridWidth+1) + j+1
+ (deUint16)((i+0)*(gridWidth+1) + j+0),
+ (deUint16)((i+0)*(gridWidth+1) + j+1),
+ (deUint16)((i+1)*(gridWidth+1) + j+0),
+ (deUint16)((i+1)*(gridWidth+1) + j+1)
};
const int secondTriangleVertexIndexOffset = m_caseType == CASETYPE_BASIC ? 0
@@ -1764,7 +1764,7 @@
// share a vertices, it's at the same index for everyone.
for (int m = 0; m < 2; m++)
for (int n = 0; n < 2; n++)
- gridIndices.push_back((i+(i+m)%2)*(gridWidth+1) + j+(j+n)%2);
+ gridIndices.push_back((deUint16)((i+(i+m)%2)*(gridWidth+1) + j+(j+n)%2));
if(m_caseType == CASETYPE_PRECISE && (i+j) % 2 == 0)
std::reverse(gridIndices.begin() + (gridIndices.size() - 4),
@@ -6006,7 +6006,7 @@
tcsDeclarations += outMaybePatch + output.declare();
if (!isPerPatchIO)
- tcsStatements += "\t\tv += float(gl_InvocationID)*" + de::floatToString(0.4f*output.numBasicSubobjectsInElementType(), 1) + ";\n";
+ tcsStatements += "\t\tv += float(gl_InvocationID)*" + de::floatToString(0.4f * (float)output.numBasicSubobjectsInElementType(), 1) + ";\n";
tcsStatements += "\n\t\t// Assign values to output " + output.name() + "\n";
if (isArray)
@@ -6015,7 +6015,7 @@
tcsStatements += output.glslTraverseBasicType(2, glslAssignBasicTypeObject);
if (!isPerPatchIO)
- tcsStatements += "\t\tv += float(" + de::toString(int(NUM_OUTPUT_VERTICES)) + "-gl_InvocationID-1)*" + de::floatToString(0.4f*output.numBasicSubobjectsInElementType(), 1) + ";\n";
+ tcsStatements += "\t\tv += float(" + de::toString(int(NUM_OUTPUT_VERTICES)) + "-gl_InvocationID-1)*" + de::floatToString(0.4f * (float)output.numBasicSubobjectsInElementType(), 1) + ";\n";
}
tcsStatements += "\t}\n";
diff --git a/modules/gles31/functional/es31fTextureBorderClampTests.cpp b/modules/gles31/functional/es31fTextureBorderClampTests.cpp
index 9df2ea5..5ceb433 100644
--- a/modules/gles31/functional/es31fTextureBorderClampTests.cpp
+++ b/modules/gles31/functional/es31fTextureBorderClampTests.cpp
@@ -428,10 +428,10 @@
tcu::floatToU8(sRGB[1]),
tcu::floatToU8(sRGB[2]),
tcu::floatToU8(sRGB[3]));
- const tcu::Vec4 linearized = tcu::sRGBToLinear(tcu::Vec4(sRGB8[0] / 255.0f,
- sRGB8[1] / 255.0f,
- sRGB8[2] / 255.0f,
- sRGB8[3] / 255.0f));
+ const tcu::Vec4 linearized = tcu::sRGBToLinear(tcu::Vec4((float)sRGB8[0] / 255.0f,
+ (float)sRGB8[1] / 255.0f,
+ (float)sRGB8[2] / 255.0f,
+ (float)sRGB8[3] / 255.0f));
return rr::GenericVec4(tcu::select(linearized, tcu::Vec4(0.0f), channelMask));
}
diff --git a/modules/gles31/functional/es31fTextureGatherTests.cpp b/modules/gles31/functional/es31fTextureGatherTests.cpp
index f5a5540..440c003 100644
--- a/modules/gles31/functional/es31fTextureGatherTests.cpp
+++ b/modules/gles31/functional/es31fTextureGatherTests.cpp
@@ -641,7 +641,7 @@
float operator() (const IVec2& pixCoord) const
{
- return (float)(pixCoord.x() + 0.5f) / (float)m_renderSize.x();
+ return ((float)pixCoord.x() + 0.5f) / (float)m_renderSize.x();
}
private:
diff --git a/modules/gles31/functional/es31fTextureMultisampleTests.cpp b/modules/gles31/functional/es31fTextureMultisampleTests.cpp
index 7f8a786..385eb8c 100644
--- a/modules/gles31/functional/es31fTextureMultisampleTests.cpp
+++ b/modules/gles31/functional/es31fTextureMultisampleTests.cpp
@@ -666,12 +666,12 @@
for (int y = 0; y < m_gridsize; ++y)
for (int x = 0; x < m_gridsize; ++x)
{
- gridData[(y * m_gridsize + x)*6 + 0] = tcu::Vec4(((float)(x+0) / m_gridsize) * 2.0f - 1.0f, ((float)(y+0) / m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
- gridData[(y * m_gridsize + x)*6 + 1] = tcu::Vec4(((float)(x+0) / m_gridsize) * 2.0f - 1.0f, ((float)(y+1) / m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
- gridData[(y * m_gridsize + x)*6 + 2] = tcu::Vec4(((float)(x+1) / m_gridsize) * 2.0f - 1.0f, ((float)(y+1) / m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
- gridData[(y * m_gridsize + x)*6 + 3] = tcu::Vec4(((float)(x+0) / m_gridsize) * 2.0f - 1.0f, ((float)(y+0) / m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
- gridData[(y * m_gridsize + x)*6 + 4] = tcu::Vec4(((float)(x+1) / m_gridsize) * 2.0f - 1.0f, ((float)(y+1) / m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
- gridData[(y * m_gridsize + x)*6 + 5] = tcu::Vec4(((float)(x+1) / m_gridsize) * 2.0f - 1.0f, ((float)(y+0) / m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
+ gridData[(y * m_gridsize + x)*6 + 0] = tcu::Vec4(((float)(x+0) / (float)m_gridsize) * 2.0f - 1.0f, ((float)(y+0) / (float)m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
+ gridData[(y * m_gridsize + x)*6 + 1] = tcu::Vec4(((float)(x+0) / (float)m_gridsize) * 2.0f - 1.0f, ((float)(y+1) / (float)m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
+ gridData[(y * m_gridsize + x)*6 + 2] = tcu::Vec4(((float)(x+1) / (float)m_gridsize) * 2.0f - 1.0f, ((float)(y+1) / (float)m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
+ gridData[(y * m_gridsize + x)*6 + 3] = tcu::Vec4(((float)(x+0) / (float)m_gridsize) * 2.0f - 1.0f, ((float)(y+0) / (float)m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
+ gridData[(y * m_gridsize + x)*6 + 4] = tcu::Vec4(((float)(x+1) / (float)m_gridsize) * 2.0f - 1.0f, ((float)(y+1) / (float)m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
+ gridData[(y * m_gridsize + x)*6 + 5] = tcu::Vec4(((float)(x+1) / (float)m_gridsize) * 2.0f - 1.0f, ((float)(y+0) / (float)m_gridsize) * 2.0f - 1.0f, 0.0f, 1.0f);
}
gl.bufferData (GL_ARRAY_BUFFER, (int)(gridData.size() * sizeof(tcu::Vec4)), gridData[0].getPtr(), GL_STATIC_DRAW);
@@ -911,7 +911,7 @@
for (int x = 0; x < m_gridsize; ++x)
{
if (m_flags & FLAGS_SAMPLE_COVERAGE)
- gl.sampleCoverage((y*m_gridsize + x) / float(m_gridsize*m_gridsize), GL_FALSE);
+ gl.sampleCoverage((float)(y*m_gridsize + x) / float(m_gridsize*m_gridsize), GL_FALSE);
gl.drawArrays (GL_TRIANGLES, (y*m_gridsize + x) * 6, 6);
GLU_EXPECT_NO_ERROR (gl.getError(), "drawArrays");
@@ -1661,8 +1661,8 @@
{
const bool colorAttachmentTexture = (m_caseType == CASE_DIFFERENT_N_SAMPLES_TEX) || (m_caseType == CASE_DIFFERENT_FIXED_TEX);
const bool colorAttachmentRbo = (m_caseType == CASE_DIFFERENT_N_SAMPLES_RBO) || (m_caseType == CASE_DIFFERENT_FIXED_RBO);
- const glw::GLenum fixedSampleLocations0 = (m_caseType == CASE_DIFFERENT_N_SAMPLES_RBO) ? (GL_TRUE) : (GL_FALSE);
- const glw::GLenum fixedSampleLocations1 = ((m_caseType == CASE_DIFFERENT_FIXED_TEX) || (m_caseType == CASE_DIFFERENT_FIXED_RBO)) ? (GL_TRUE) : (GL_FALSE);
+ const glw::GLboolean fixedSampleLocations0 = (m_caseType == CASE_DIFFERENT_N_SAMPLES_RBO) ? (GL_TRUE) : (GL_FALSE);
+ const glw::GLboolean fixedSampleLocations1 = ((m_caseType == CASE_DIFFERENT_FIXED_TEX) || (m_caseType == CASE_DIFFERENT_FIXED_RBO)) ? (GL_TRUE) : (GL_FALSE);
glu::CallLogWrapper gl (m_context.getRenderContext().getFunctions(), m_testCtx.getLog());
glw::GLuint fboId = 0;
glw::GLuint rboId = 0;
diff --git a/modules/gles31/functional/es31fUniformLocationTests.cpp b/modules/gles31/functional/es31fUniformLocationTests.cpp
index 9d7fc8b..8fe0ee1 100644
--- a/modules/gles31/functional/es31fUniformLocationTests.cpp
+++ b/modules/gles31/functional/es31fUniformLocationTests.cpp
@@ -204,7 +204,7 @@
else if (glu::isDataTypeUintOrUVec(adjustedType))
return float(hash%255);
else if (glu::isDataTypeFloatOrVec(adjustedType))
- return (hash%255)/255.0f;
+ return float(hash%255)/255.0f;
else if (glu::isDataTypeBoolOrBVec(adjustedType))
return float(hash%2);
else
diff --git a/modules/gles31/functional/es31fVertexAttributeBindingTests.cpp b/modules/gles31/functional/es31fVertexAttributeBindingTests.cpp
index 3136137..765d553 100644
--- a/modules/gles31/functional/es31fVertexAttributeBindingTests.cpp
+++ b/modules/gles31/functional/es31fVertexAttributeBindingTests.cpp
@@ -456,12 +456,12 @@
const tcu::Vec4& color = ((x + y) % 2 == 0) ? (colorA) : (colorB);
const tcu::Vec4 positions[6] =
{
- tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
- tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
- tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
- tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
- tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
- tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+ tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+ tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+ tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+ tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+ tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+ tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
};
// copy cell vertices to the buffer.
@@ -748,12 +748,12 @@
for (int y = 0; y < GRID_SIZE; ++y)
for (int x = 0; x < GRID_SIZE; ++x)
{
- primitiveData[(y * GRID_SIZE + x) * 6 + 0] = tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
- primitiveData[(y * GRID_SIZE + x) * 6 + 1] = tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
- primitiveData[(y * GRID_SIZE + x) * 6 + 2] = tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
- primitiveData[(y * GRID_SIZE + x) * 6 + 3] = tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
- primitiveData[(y * GRID_SIZE + x) * 6 + 4] = tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
- primitiveData[(y * GRID_SIZE + x) * 6 + 5] = tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+ primitiveData[(y * GRID_SIZE + x) * 6 + 0] = tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+ primitiveData[(y * GRID_SIZE + x) * 6 + 1] = tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+ primitiveData[(y * GRID_SIZE + x) * 6 + 2] = tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+ primitiveData[(y * GRID_SIZE + x) * 6 + 3] = tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+ primitiveData[(y * GRID_SIZE + x) * 6 + 4] = tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+ primitiveData[(y * GRID_SIZE + x) * 6 + 5] = tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
}
}
@@ -772,7 +772,7 @@
const tcu::Vec4& color = ((x + y) % 2 == 0) ? (green) : (yellow);
colorOffsetWritePtr[(y * GRID_SIZE + x) * 2 + 0] = color;
- colorOffsetWritePtr[(y * GRID_SIZE + x) * 2 + 1] = tcu::Vec4(x / float(GRID_SIZE) * 2.0f - 1.0f, y / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 0.0f);
+ colorOffsetWritePtr[(y * GRID_SIZE + x) * 2 + 1] = tcu::Vec4(float(x) / float(GRID_SIZE) * 2.0f - 1.0f, float(y) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 0.0f);
}
}
else
@@ -1031,7 +1031,7 @@
const tcu::Vec4& color = ((x + y) % 2 == 0) ? (green) : (yellow);
colorOffsetData[((y * GRID_SIZE + x) * numInstanceElementsPerCell + v) * 2 + 0] = color;
- colorOffsetData[((y * GRID_SIZE + x) * numInstanceElementsPerCell + v) * 2 + 1] = tcu::Vec4(x / float(GRID_SIZE) * 2.0f - 1.0f, y / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 0.0f);
+ colorOffsetData[((y * GRID_SIZE + x) * numInstanceElementsPerCell + v) * 2 + 1] = tcu::Vec4(float(x) / float(GRID_SIZE) * 2.0f - 1.0f, float(y) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 0.0f);
}
}
@@ -1246,17 +1246,17 @@
{
const tcu::Vec4& color = ((x + y) % 2 == 0) ? (green) : (yellow);
- vertexData[(y * GRID_SIZE + x) * 12 + 0] = tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+ vertexData[(y * GRID_SIZE + x) * 12 + 0] = tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
vertexData[(y * GRID_SIZE + x) * 12 + 1] = color;
- vertexData[(y * GRID_SIZE + x) * 12 + 2] = tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+ vertexData[(y * GRID_SIZE + x) * 12 + 2] = tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
vertexData[(y * GRID_SIZE + x) * 12 + 3] = color;
- vertexData[(y * GRID_SIZE + x) * 12 + 4] = tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+ vertexData[(y * GRID_SIZE + x) * 12 + 4] = tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
vertexData[(y * GRID_SIZE + x) * 12 + 5] = color;
- vertexData[(y * GRID_SIZE + x) * 12 + 6] = tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+ vertexData[(y * GRID_SIZE + x) * 12 + 6] = tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
vertexData[(y * GRID_SIZE + x) * 12 + 7] = color;
- vertexData[(y * GRID_SIZE + x) * 12 + 8] = tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+ vertexData[(y * GRID_SIZE + x) * 12 + 8] = tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
vertexData[(y * GRID_SIZE + x) * 12 + 9] = color;
- vertexData[(y * GRID_SIZE + x) * 12 + 10] = tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
+ vertexData[(y * GRID_SIZE + x) * 12 + 10] = tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f);
vertexData[(y * GRID_SIZE + x) * 12 + 11] = color;
}
diff --git a/modules/gles31/stress/es31sDrawTests.cpp b/modules/gles31/stress/es31sDrawTests.cpp
index 7af5c2a..0a0c427 100644
--- a/modules/gles31/stress/es31sDrawTests.cpp
+++ b/modules/gles31/stress/es31sDrawTests.cpp
@@ -197,7 +197,7 @@
std::vector<deUint16> indices (indexBufferSize);
for (int ndx = 0; ndx < (int)indices.size(); ++ndx)
- indices[ndx] = (m_op == INVALID_INDEX) ? (overBoundDrawCount + ndx) : (ndx);
+ indices[ndx] = (deUint16)((m_op == INVALID_INDEX) ? (overBoundDrawCount + ndx) : (ndx));
gl.glGenBuffers(1, &m_indexBufferID);
gl.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexBufferID);
diff --git a/modules/gles31/stress/es31sVertexAttributeBindingTests.cpp b/modules/gles31/stress/es31sVertexAttributeBindingTests.cpp
index 5622297..3a285a5 100644
--- a/modules/gles31/stress/es31sVertexAttributeBindingTests.cpp
+++ b/modules/gles31/stress/es31sVertexAttributeBindingTests.cpp
@@ -450,12 +450,12 @@
const tcu::Vec4& color = ((x + y) % 2 == 0) ? (colorA) : (colorB);
const tcu::Vec4 positions[6] =
{
- tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
- tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
- tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
- tcu::Vec4((x+0) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
- tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
- tcu::Vec4((x+1) / float(GRID_SIZE) * 2.0f - 1.0f, (y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+ tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+ tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+ tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+ tcu::Vec4(float(x+0) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+ tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+1) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
+ tcu::Vec4(float(x+1) / float(GRID_SIZE) * 2.0f - 1.0f, float(y+0) / float(GRID_SIZE) * 2.0f - 1.0f, 0.0f, 1.0f),
};
// copy cell vertices to the buffer.
diff --git a/modules/glshared/glsBufferTestUtil.cpp b/modules/glshared/glsBufferTestUtil.cpp
index b00ff84..34b60a6 100644
--- a/modules/glshared/glsBufferTestUtil.cpp
+++ b/modules/glshared/glsBufferTestUtil.cpp
@@ -480,10 +480,10 @@
for (int y = 0; y < gridSizeY; y++)
for (int x = 0; x < gridSizeX; x++)
{
- float sx0 = (x+0) / (float)gridSizeX;
- float sy0 = (y+0) / (float)gridSizeY;
- float sx1 = (x+1) / (float)gridSizeX;
- float sy1 = (y+1) / (float)gridSizeY;
+ float sx0 = (float)(x+0) / (float)gridSizeX;
+ float sy0 = (float)(y+0) / (float)gridSizeY;
+ float sx1 = (float)(x+1) / (float)gridSizeX;
+ float sy1 = (float)(y+1) / (float)gridSizeY;
float fx0 = 2.0f * sx0 - 1.0f;
float fy0 = 2.0f * sy0 - 1.0f;
float fx1 = 2.0f * sx1 - 1.0f;
@@ -549,8 +549,8 @@
for (int y = 0; y < VERIFY_QUAD_SIZE; y++)
for (int x = 0; x < VERIFY_QUAD_SIZE; x++)
{
- float fx = (float)(x+0.5f) / (float)VERIFY_QUAD_SIZE;
- float fy = (float)(y+0.5f) / (float)VERIFY_QUAD_SIZE;
+ float fx = ((float)x+0.5f) / (float)VERIFY_QUAD_SIZE;
+ float fy = ((float)y+0.5f) / (float)VERIFY_QUAD_SIZE;
bool tri = fx + fy <= 1.0f;
float tx = tri ? fx : (1.0f-fx);
diff --git a/modules/glshared/glsBuiltinPrecisionTests.cpp b/modules/glshared/glsBuiltinPrecisionTests.cpp
index 5f4af96..2d717d5 100644
--- a/modules/glshared/glsBuiltinPrecisionTests.cpp
+++ b/modules/glshared/glsBuiltinPrecisionTests.cpp
@@ -340,7 +340,7 @@
const float& value,
ostream& os)
{
- os << (value ? "true" : "false");
+ os << (value != 0.0f ? "true" : "false");
}
static void doPrintIVal (const FloatFormat&,
@@ -4014,7 +4014,7 @@
const int exp = rnd.getInt(0, getNumBits(prec)-2);
const int sign = rnd.getBool() ? -1 : 1;
- return sign * rnd.getInt(0, 1L << exp);
+ return sign * rnd.getInt(0, (deInt32)1 << exp);
}
void genFixeds (const FloatFormat&, vector<int>& dst) const
@@ -4134,26 +4134,26 @@
for (int sign = -1; sign <= 1; sign += 2)
{
// Smallest subnormal
- dst.push_back(sign * minQuantum);
+ dst.push_back((float)sign * minQuantum);
// Largest subnormal
- dst.push_back(sign * (minNormalized - minQuantum));
+ dst.push_back((float)sign * (minNormalized - minQuantum));
// Smallest normalized
- dst.push_back(sign * minNormalized);
+ dst.push_back((float)sign * minNormalized);
// Next smallest normalized
- dst.push_back(sign * (minNormalized + minQuantum));
+ dst.push_back((float)sign * (minNormalized + minQuantum));
- dst.push_back(sign * 0.5f);
- dst.push_back(sign * 1.0f);
- dst.push_back(sign * 2.0f);
+ dst.push_back((float)sign * 0.5f);
+ dst.push_back((float)sign * 1.0f);
+ dst.push_back((float)sign * 2.0f);
// Largest number
- dst.push_back(sign * (deFloatLdExp(1.0f, maxExp) +
- (deFloatLdExp(1.0f, maxExp) - maxQuantum)));
+ dst.push_back((float)sign * (deFloatLdExp(1.0f, maxExp) +
+ (deFloatLdExp(1.0f, maxExp) - maxQuantum)));
- dst.push_back(sign * TCU_INFINITY);
+ dst.push_back((float)sign * TCU_INFINITY);
}
}
diff --git a/modules/glshared/glsDrawTest.cpp b/modules/glshared/glsDrawTest.cpp
index 4a6ac52..3053279 100644
--- a/modules/glshared/glsDrawTest.cpp
+++ b/modules/glshared/glsDrawTest.cpp
@@ -397,10 +397,10 @@
static WrappedType<Type> create (Type value) { WrappedType<Type> v; v.m_value = value; return v; }
inline Type getValue (void) const { return m_value; }
- inline WrappedType<Type> operator+ (const WrappedType<Type>& other) const { return WrappedType<Type>::create(m_value + other.getValue()); }
- inline WrappedType<Type> operator* (const WrappedType<Type>& other) const { return WrappedType<Type>::create(m_value * other.getValue()); }
- inline WrappedType<Type> operator/ (const WrappedType<Type>& other) const { return WrappedType<Type>::create(m_value / other.getValue()); }
- inline WrappedType<Type> operator- (const WrappedType<Type>& other) const { return WrappedType<Type>::create(m_value - other.getValue()); }
+ inline WrappedType<Type> operator+ (const WrappedType<Type>& other) const { return WrappedType<Type>::create((Type)(m_value + other.getValue())); }
+ inline WrappedType<Type> operator* (const WrappedType<Type>& other) const { return WrappedType<Type>::create((Type)(m_value * other.getValue())); }
+ inline WrappedType<Type> operator/ (const WrappedType<Type>& other) const { return WrappedType<Type>::create((Type)(m_value / other.getValue())); }
+ inline WrappedType<Type> operator- (const WrappedType<Type>& other) const { return WrappedType<Type>::create((Type)(m_value - other.getValue())); }
inline WrappedType<Type>& operator+= (const WrappedType<Type>& other) { m_value += other.getValue(); return *this; }
inline WrappedType<Type>& operator*= (const WrappedType<Type>& other) { m_value *= other.getValue(); return *this; }
@@ -689,7 +689,7 @@
if (max < min)
return min;
- return GLValue::Short::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+ return GLValue::Short::create((min == max ? min : (deInt16)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
}
template<>
@@ -698,7 +698,7 @@
if (max < min)
return min;
- return GLValue::Ushort::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+ return GLValue::Ushort::create((min == max ? min : (deUint16)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
}
template<>
@@ -707,7 +707,7 @@
if (max < min)
return min;
- return GLValue::Byte::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+ return GLValue::Byte::create((min == max ? min : (deInt8)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
}
template<>
@@ -716,7 +716,7 @@
if (max < min)
return min;
- return GLValue::Ubyte::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+ return GLValue::Ubyte::create((min == max ? min : (deUint8)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
}
template<>
@@ -2463,21 +2463,21 @@
{
static const int size[] =
{
- sizeof(float), // INPUTTYPE_FLOAT = 0,
- sizeof(deInt32), // INPUTTYPE_FIXED,
- sizeof(double), // INPUTTYPE_DOUBLE
+ (int)sizeof(float), // INPUTTYPE_FLOAT = 0,
+ (int)sizeof(deInt32), // INPUTTYPE_FIXED,
+ (int)sizeof(double), // INPUTTYPE_DOUBLE
- sizeof(deInt8), // INPUTTYPE_BYTE,
- sizeof(deInt16), // INPUTTYPE_SHORT,
+ (int)sizeof(deInt8), // INPUTTYPE_BYTE,
+ (int)sizeof(deInt16), // INPUTTYPE_SHORT,
- sizeof(deUint8), // INPUTTYPE_UNSIGNED_BYTE,
- sizeof(deUint16), // INPUTTYPE_UNSIGNED_SHORT,
+ (int)sizeof(deUint8), // INPUTTYPE_UNSIGNED_BYTE,
+ (int)sizeof(deUint16), // INPUTTYPE_UNSIGNED_SHORT,
- sizeof(deInt32), // INPUTTYPE_INT,
- sizeof(deUint32), // INPUTTYPE_UNSIGNED_INT,
- sizeof(deFloat16), // INPUTTYPE_HALF,
- sizeof(deUint32) / 4, // INPUTTYPE_UNSIGNED_INT_2_10_10_10,
- sizeof(deUint32) / 4 // INPUTTYPE_INT_2_10_10_10,
+ (int)sizeof(deInt32), // INPUTTYPE_INT,
+ (int)sizeof(deUint32), // INPUTTYPE_UNSIGNED_INT,
+ (int)sizeof(deFloat16), // INPUTTYPE_HALF,
+ (int)sizeof(deUint32) / 4, // INPUTTYPE_UNSIGNED_INT_2_10_10_10,
+ (int)sizeof(deUint32) / 4 // INPUTTYPE_INT_2_10_10_10,
};
return de::getSizedArrayElement<DrawTestSpec::INPUTTYPE_LAST>(size, (int)type);
@@ -3211,9 +3211,9 @@
m_glArrayPack = new AttributePack(m_testCtx, m_renderCtx, *m_glesContext, tcu::UVec2(renderTargetWidth, renderTargetHeight), useVao, true);
m_rrArrayPack = new AttributePack(m_testCtx, m_renderCtx, *m_refContext, tcu::UVec2(renderTargetWidth, renderTargetHeight), useVao, false);
- m_maxDiffRed = deCeilFloatToInt32(256.0f * (6.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().redBits)));
- m_maxDiffGreen = deCeilFloatToInt32(256.0f * (6.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().greenBits)));
- m_maxDiffBlue = deCeilFloatToInt32(256.0f * (6.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().blueBits)));
+ m_maxDiffRed = deCeilFloatToInt32(256.0f * (6.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().redBits)));
+ m_maxDiffGreen = deCeilFloatToInt32(256.0f * (6.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().greenBits)));
+ m_maxDiffBlue = deCeilFloatToInt32(256.0f * (6.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().blueBits)));
}
void DrawTest::deinit (void)
@@ -3849,14 +3849,14 @@
if (attribSpec.normalize)
attrMaxValue += 1.0f;
else
- attrMaxValue += 1024.0;
+ attrMaxValue += 1024.0f;
}
else if (attribSpec.inputType == DrawTestSpec::INPUTTYPE_INT_2_10_10_10)
{
if (attribSpec.normalize)
attrMaxValue += 1.0f;
else
- attrMaxValue += 512.0;
+ attrMaxValue += 512.0f;
}
else
{
@@ -3891,12 +3891,12 @@
if (attribSpec.inputType == DrawTestSpec::INPUTTYPE_UNSIGNED_INT_2_10_10_10)
{
if (!attribSpec.normalize)
- colorScale *= 1.0 / 1024.0;
+ colorScale *= 1.0f / 1024.0f;
}
else if (attribSpec.inputType == DrawTestSpec::INPUTTYPE_INT_2_10_10_10)
{
if (!attribSpec.normalize)
- colorScale *= 1.0 / 512.0;
+ colorScale *= 1.0f / 512.0f;
}
else
{
diff --git a/modules/glshared/glsFragOpInteractionCase.cpp b/modules/glshared/glsFragOpInteractionCase.cpp
index e97e7b1..5b68420 100644
--- a/modules/glshared/glsFragOpInteractionCase.cpp
+++ b/modules/glshared/glsFragOpInteractionCase.cpp
@@ -186,8 +186,8 @@
const int maxOutOfBounds = 0;
const float minSize = 0.5f;
- const int minW = deCeilFloatToInt32(minSize*targetW);
- const int minH = deCeilFloatToInt32(minSize*targetH);
+ const int minW = deCeilFloatToInt32(minSize * (float)targetW);
+ const int minH = deCeilFloatToInt32(minSize * (float)targetH);
const int maxW = targetW + 2*maxOutOfBounds;
const int maxH = targetH + 2*maxOutOfBounds;
@@ -396,7 +396,7 @@
const deUint64 subUnitBorderLo = (1u << (numSubBits - 1u)) - 1u;
const deUint64 subUnitBorderHi = 1u << (numSubBits - 1u);
const deUint64 maxFixedValue = (1u << (numBits + numSubBits)) - 1u;
- const deUint64 fixedValue = deRoundFloatToInt64(v * maxFixedValue);
+ const deUint64 fixedValue = deRoundFloatToInt64(v * (float)maxFixedValue);
const deUint64 units = fixedValue >> numSubBits;
const deUint64 subUnits = fixedValue & ((1u << numSubBits) - 1u);
diff --git a/modules/glshared/glsInteractionTestUtil.cpp b/modules/glshared/glsInteractionTestUtil.cpp
index 2c8f126..a19b019 100644
--- a/modules/glshared/glsInteractionTestUtil.cpp
+++ b/modules/glshared/glsInteractionTestUtil.cpp
@@ -154,8 +154,8 @@
if (state.scissorTestEnabled)
{
- int minScissorW = deCeilFloatToInt32(minScissorSize*targetWidth);
- int minScissorH = deCeilFloatToInt32(minScissorSize*targetHeight);
+ int minScissorW = deCeilFloatToInt32(minScissorSize * (float)targetWidth);
+ int minScissorH = deCeilFloatToInt32(minScissorSize * (float)targetHeight);
int maxScissorW = targetWidth + 2*maxScissorOutOfBounds;
int maxScissorH = targetHeight + 2*maxScissorOutOfBounds;
@@ -227,8 +227,8 @@
const int maxOutOfBounds = 0;
const float minSize = 0.5f;
- int minW = deCeilFloatToInt32(minSize*targetWidth);
- int minH = deCeilFloatToInt32(minSize*targetHeight);
+ int minW = deCeilFloatToInt32(minSize * (float)targetWidth);
+ int minH = deCeilFloatToInt32(minSize * (float)targetHeight);
int maxW = targetWidth + 2*maxOutOfBounds;
int maxH = targetHeight + 2*maxOutOfBounds;
diff --git a/modules/glshared/glsLongStressCase.cpp b/modules/glshared/glsLongStressCase.cpp
index 7f751ce..71d8fdf 100644
--- a/modules/glshared/glsLongStressCase.cpp
+++ b/modules/glshared/glsLongStressCase.cpp
@@ -385,13 +385,13 @@
{
const int vtxNdx = (int)m_posBuf.size()/2;
- m_ndxBuf.push_back(vtxNdx+0);
- m_ndxBuf.push_back(vtxNdx+1);
- m_ndxBuf.push_back(vtxNdx+2);
+ m_ndxBuf.push_back(deUint16(vtxNdx+0));
+ m_ndxBuf.push_back(deUint16(vtxNdx+1));
+ m_ndxBuf.push_back(deUint16(vtxNdx+2));
- m_ndxBuf.push_back(vtxNdx+2);
- m_ndxBuf.push_back(vtxNdx+1);
- m_ndxBuf.push_back(vtxNdx+3);
+ m_ndxBuf.push_back(deUint16(vtxNdx+2));
+ m_ndxBuf.push_back(deUint16(vtxNdx+1));
+ m_ndxBuf.push_back(deUint16(vtxNdx+3));
m_posBuf.push_back(ax);
m_posBuf.push_back(ay);
@@ -1494,7 +1494,7 @@
<< TestLog::Message << "Frame number: " << m_currentIteration << TestLog::EndMessage
<< TestLog::Message << "Time since last log entry: " << timeDiff << "s" << TestLog::EndMessage
<< TestLog::Message << "Frames since last log entry: " << iterDiff << TestLog::EndMessage
- << TestLog::Message << "Average frame time since last log entry: " << de::floatToString((float)timeDiff / iterDiff, 2) << "s" << TestLog::EndMessage
+ << TestLog::Message << "Average frame time since last log entry: " << de::floatToString((float)timeDiff / (float)iterDiff, 2) << "s" << TestLog::EndMessage
<< TestLog::Message << "Approximate texture memory usage: "
<< de::floatToString((float)m_textures->computeApproxMemUsage() / Mi, 2) << " MiB / "
<< de::floatToString((float)m_maxTexMemoryUsageBytes / Mi, 2) << " MiB"
diff --git a/modules/glshared/glsMemoryStressCase.cpp b/modules/glshared/glsMemoryStressCase.cpp
index cff05bf..3195d28 100644
--- a/modules/glshared/glsMemoryStressCase.cpp
+++ b/modules/glshared/glsMemoryStressCase.cpp
@@ -920,7 +920,7 @@
}
else
{
- const float change = (min - max) / ((float)(max));
+ const float change = (float)(min - max) / (float)(max);
if (change > threshold)
{
log << TestLog::Message << "Allocated objects max: " << max << ", min: " << min << ", difference: " << change << "% threshold: " << threshold << "%" << TestLog::EndMessage;
diff --git a/modules/glshared/glsRandomShaderCase.cpp b/modules/glshared/glsRandomShaderCase.cpp
index 8f92bbd..a0a71f4 100644
--- a/modules/glshared/glsRandomShaderCase.cpp
+++ b/modules/glshared/glsRandomShaderCase.cpp
@@ -202,12 +202,12 @@
int quadY = quadNdx / (m_gridWidth);
int quadX = quadNdx - quadY*m_gridWidth;
- m_indices[quadNdx*6+0] = quadX + quadY*(m_gridWidth+1);
- m_indices[quadNdx*6+1] = quadX + (quadY+1)*(m_gridWidth+1);
- m_indices[quadNdx*6+2] = quadX + quadY*(m_gridWidth+1) + 1;
- m_indices[quadNdx*6+3] = m_indices[quadNdx*6+2];
- m_indices[quadNdx*6+4] = m_indices[quadNdx*6+1];
- m_indices[quadNdx*6+5] = quadX + (quadY+1)*(m_gridWidth+1) + 1;
+ m_indices[quadNdx*6+0] = (deUint16)(quadX + quadY*(m_gridWidth+1));
+ m_indices[quadNdx*6+1] = (deUint16)(quadX + (quadY+1)*(m_gridWidth+1));
+ m_indices[quadNdx*6+2] = (deUint16)(quadX + quadY*(m_gridWidth+1) + 1);
+ m_indices[quadNdx*6+3] = (deUint16)(m_indices[quadNdx*6+2]);
+ m_indices[quadNdx*6+4] = (deUint16)(m_indices[quadNdx*6+1]);
+ m_indices[quadNdx*6+5] = (deUint16)(quadX + (quadY+1)*(m_gridWidth+1) + 1);
}
// Create textures.
diff --git a/modules/glshared/glsRasterizationTestUtil.cpp b/modules/glshared/glsRasterizationTestUtil.cpp
index d50a8c8..b1b5163 100644
--- a/modules/glshared/glsRasterizationTestUtil.cpp
+++ b/modules/glshared/glsRasterizationTestUtil.cpp
@@ -103,7 +103,7 @@
bool pixelNearLineSegment (const tcu::IVec2& pixel, const tcu::Vec2& p0, const tcu::Vec2& p1)
{
- const tcu::Vec2 pixelCenterPosition = tcu::Vec2(pixel.x() + 0.5f, pixel.y() + 0.5f);
+ const tcu::Vec2 pixelCenterPosition = tcu::Vec2((float)pixel.x() + 0.5f, (float)pixel.y() + 0.5f);
// "Near" = Distance from the line to the pixel is less than 2 * pixel_max_radius. (pixel_max_radius = sqrt(2) / 2)
const float maxPixelDistance = 1.414f;
@@ -573,14 +573,14 @@
{
// allow anywhere in the pixel area in multisample
// allow only in the center subpixels (4 subpixels) in singlesample
- const float testSquareSize = (multisample) ? (1.0f) : (2.0f / (1UL << subpixelBits));
+ const float testSquareSize = (multisample) ? (1.0f) : (2.0f / (float)(1UL << subpixelBits));
const float testSquarePos = (multisample) ? (0.0f) : (0.5f - testSquareSize / 2);
const tcu::Vec2 corners[4] =
{
- tcu::Vec2((pixel.x() + testSquarePos + 0.0f) / viewportSize.x() * 2.0f - 1.0f, (pixel.y() + testSquarePos + 0.0f ) / viewportSize.y() * 2.0f - 1.0f),
- tcu::Vec2((pixel.x() + testSquarePos + 0.0f) / viewportSize.x() * 2.0f - 1.0f, (pixel.y() + testSquarePos + testSquareSize) / viewportSize.y() * 2.0f - 1.0f),
- tcu::Vec2((pixel.x() + testSquarePos + testSquareSize) / viewportSize.x() * 2.0f - 1.0f, (pixel.y() + testSquarePos + testSquareSize) / viewportSize.y() * 2.0f - 1.0f),
- tcu::Vec2((pixel.x() + testSquarePos + testSquareSize) / viewportSize.x() * 2.0f - 1.0f, (pixel.y() + testSquarePos + 0.0f ) / viewportSize.y() * 2.0f - 1.0f),
+ tcu::Vec2(((float)pixel.x() + testSquarePos + 0.0f) / (float)viewportSize.x() * 2.0f - 1.0f, ((float)pixel.y() + testSquarePos + 0.0f ) / (float)viewportSize.y() * 2.0f - 1.0f),
+ tcu::Vec2(((float)pixel.x() + testSquarePos + 0.0f) / (float)viewportSize.x() * 2.0f - 1.0f, ((float)pixel.y() + testSquarePos + testSquareSize) / (float)viewportSize.y() * 2.0f - 1.0f),
+ tcu::Vec2(((float)pixel.x() + testSquarePos + testSquareSize) / (float)viewportSize.x() * 2.0f - 1.0f, ((float)pixel.y() + testSquarePos + testSquareSize) / (float)viewportSize.y() * 2.0f - 1.0f),
+ tcu::Vec2(((float)pixel.x() + testSquarePos + testSquareSize) / (float)viewportSize.x() * 2.0f - 1.0f, ((float)pixel.y() + testSquarePos + 0.0f ) / (float)viewportSize.y() * 2.0f - 1.0f),
};
const InterpolationRange weights[4] =
{
@@ -622,18 +622,18 @@
// allow interpolation weights anywhere in the pixel
const tcu::Vec2 corners[4] =
{
- tcu::Vec2(pixel.x() + 0.0f, pixel.y() + 0.0f),
- tcu::Vec2(pixel.x() + 0.0f, pixel.y() + 1.0f),
- tcu::Vec2(pixel.x() + 1.0f, pixel.y() + 1.0f),
- tcu::Vec2(pixel.x() + 1.0f, pixel.y() + 0.0f),
+ tcu::Vec2((float)pixel.x() + 0.0f, (float)pixel.y() + 0.0f),
+ tcu::Vec2((float)pixel.x() + 0.0f, (float)pixel.y() + 1.0f),
+ tcu::Vec2((float)pixel.x() + 1.0f, (float)pixel.y() + 1.0f),
+ tcu::Vec2((float)pixel.x() + 1.0f, (float)pixel.y() + 0.0f),
};
const float wa = scene.lines[lineNdx].positions[0].w();
const float wb = scene.lines[lineNdx].positions[1].w();
- const tcu::Vec2 pa = tcu::Vec2((scene.lines[lineNdx].positions[0].x() / wa + 1.0f) * 0.5f * viewportSize.x(),
- (scene.lines[lineNdx].positions[0].y() / wa + 1.0f) * 0.5f * viewportSize.y());
- const tcu::Vec2 pb = tcu::Vec2((scene.lines[lineNdx].positions[1].x() / wb + 1.0f) * 0.5f * viewportSize.x(),
- (scene.lines[lineNdx].positions[1].y() / wb + 1.0f) * 0.5f * viewportSize.y());
+ const tcu::Vec2 pa = tcu::Vec2((scene.lines[lineNdx].positions[0].x() / wa + 1.0f) * 0.5f * (float)viewportSize.x(),
+ (scene.lines[lineNdx].positions[0].y() / wa + 1.0f) * 0.5f * (float)viewportSize.y());
+ const tcu::Vec2 pb = tcu::Vec2((scene.lines[lineNdx].positions[1].x() / wb + 1.0f) * 0.5f * (float)viewportSize.x(),
+ (scene.lines[lineNdx].positions[1].y() / wb + 1.0f) * 0.5f * (float)viewportSize.y());
// calculate interpolation as a line
const LineInterpolationRange weights[4] =
@@ -1458,10 +1458,10 @@
DE_ASSERT(deInBounds32(fragPos.x(), 0, maskMap.getWidth()));
DE_ASSERT(deInBounds32(fragPos.y(), 0, maskMap.getHeight()));
- const int previousMask = maskMap.getPixelInt(fragPos.x(), fragPos.y()).x();
- const int newMask = (previousMask) | (1UL << bitNdx);
+ const deUint32 previousMask = maskMap.getPixelUint(fragPos.x(), fragPos.y()).x();
+ const deUint32 newMask = (previousMask) | ((deUint32)1u << bitNdx);
- maskMap.setPixel(tcu::IVec4(newMask, 0, 0, 0), fragPos.x(), fragPos.y());
+ maskMap.setPixel(tcu::UVec4(newMask, 0, 0, 0), fragPos.x(), fragPos.y());
}
}
}
@@ -1562,12 +1562,12 @@
const tcu::Vec4 valueMin = de::clamp(range.min.x(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[0] + de::clamp(range.min.y(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[1];
const tcu::Vec4 valueMax = de::clamp(range.max.x(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[0] + de::clamp(range.max.y(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[1];
- const tcu::Vec3 colorMinF (de::clamp(valueMin.x() * formatLimit.x(), 0.0f, (float)formatLimit.x()),
- de::clamp(valueMin.y() * formatLimit.y(), 0.0f, (float)formatLimit.y()),
- de::clamp(valueMin.z() * formatLimit.z(), 0.0f, (float)formatLimit.z()));
- const tcu::Vec3 colorMaxF (de::clamp(valueMax.x() * formatLimit.x(), 0.0f, (float)formatLimit.x()),
- de::clamp(valueMax.y() * formatLimit.y(), 0.0f, (float)formatLimit.y()),
- de::clamp(valueMax.z() * formatLimit.z(), 0.0f, (float)formatLimit.z()));
+ const tcu::Vec3 colorMinF (de::clamp(valueMin.x() * (float)formatLimit.x(), 0.0f, (float)formatLimit.x()),
+ de::clamp(valueMin.y() * (float)formatLimit.y(), 0.0f, (float)formatLimit.y()),
+ de::clamp(valueMin.z() * (float)formatLimit.z(), 0.0f, (float)formatLimit.z()));
+ const tcu::Vec3 colorMaxF (de::clamp(valueMax.x() * (float)formatLimit.x(), 0.0f, (float)formatLimit.x()),
+ de::clamp(valueMax.y() * (float)formatLimit.y(), 0.0f, (float)formatLimit.y()),
+ de::clamp(valueMax.z() * (float)formatLimit.z(), 0.0f, (float)formatLimit.z()));
const tcu::IVec3 colorMin ((int)deFloatFloor(colorMinF.x()),
(int)deFloatFloor(colorMinF.y()),
(int)deFloatFloor(colorMinF.z()));
@@ -1916,18 +1916,18 @@
const tcu::Vec4 valueMin = de::clamp(range.min.x(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[0] + de::clamp(range.min.y(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[1];
const tcu::Vec4 valueMax = de::clamp(range.max.x(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[0] + de::clamp(range.max.y(), 0.0f, 1.0f) * scene.lines[lineNdx].colors[1];
- const tcu::Vec3 colorMinF (de::clamp(valueMin.x() * formatLimit.x(), 0.0f, (float)formatLimit.x()),
- de::clamp(valueMin.y() * formatLimit.y(), 0.0f, (float)formatLimit.y()),
- de::clamp(valueMin.z() * formatLimit.z(), 0.0f, (float)formatLimit.z()));
- const tcu::Vec3 colorMaxF (de::clamp(valueMax.x() * formatLimit.x(), 0.0f, (float)formatLimit.x()),
- de::clamp(valueMax.y() * formatLimit.y(), 0.0f, (float)formatLimit.y()),
- de::clamp(valueMax.z() * formatLimit.z(), 0.0f, (float)formatLimit.z()));
+ const tcu::Vec3 colorMinF (de::clamp(valueMin.x() * (float)formatLimit.x(), 0.0f, (float)formatLimit.x()),
+ de::clamp(valueMin.y() * (float)formatLimit.y(), 0.0f, (float)formatLimit.y()),
+ de::clamp(valueMin.z() * (float)formatLimit.z(), 0.0f, (float)formatLimit.z()));
+ const tcu::Vec3 colorMaxF (de::clamp(valueMax.x() * (float)formatLimit.x(), 0.0f, (float)formatLimit.x()),
+ de::clamp(valueMax.y() * (float)formatLimit.y(), 0.0f, (float)formatLimit.y()),
+ de::clamp(valueMax.z() * (float)formatLimit.z(), 0.0f, (float)formatLimit.z()));
const tcu::IVec3 colorMin ((int)deFloatFloor(colorMinF.x()),
- (int)deFloatFloor(colorMinF.y()),
- (int)deFloatFloor(colorMinF.z()));
+ (int)deFloatFloor(colorMinF.y()),
+ (int)deFloatFloor(colorMinF.z()));
const tcu::IVec3 colorMax ((int)deFloatCeil (colorMaxF.x()),
- (int)deFloatCeil (colorMaxF.y()),
- (int)deFloatCeil (colorMaxF.z()));
+ (int)deFloatCeil (colorMaxF.y()),
+ (int)deFloatCeil (colorMaxF.z()));
// Verify validity
if (pixelNativeColor.x() < colorMin.x() ||
@@ -2086,9 +2086,9 @@
const I64Vec2 pixelCenterPosition = I64Vec2(pixel.x(), pixel.y()) * I64Vec2(numSubPixels, numSubPixels) + I64Vec2(numSubPixels / 2, numSubPixels / 2);
const I64Vec2 triangleSubPixelSpaceRound[3] =
{
- I64Vec2(deRoundFloatToInt32(triangleScreenSpace[0].x()*numSubPixels), deRoundFloatToInt32(triangleScreenSpace[0].y()*numSubPixels)),
- I64Vec2(deRoundFloatToInt32(triangleScreenSpace[1].x()*numSubPixels), deRoundFloatToInt32(triangleScreenSpace[1].y()*numSubPixels)),
- I64Vec2(deRoundFloatToInt32(triangleScreenSpace[2].x()*numSubPixels), deRoundFloatToInt32(triangleScreenSpace[2].y()*numSubPixels)),
+ I64Vec2(deRoundFloatToInt32(triangleScreenSpace[0].x() * (float)numSubPixels), deRoundFloatToInt32(triangleScreenSpace[0].y() * (float)numSubPixels)),
+ I64Vec2(deRoundFloatToInt32(triangleScreenSpace[1].x() * (float)numSubPixels), deRoundFloatToInt32(triangleScreenSpace[1].y() * (float)numSubPixels)),
+ I64Vec2(deRoundFloatToInt32(triangleScreenSpace[2].x() * (float)numSubPixels), deRoundFloatToInt32(triangleScreenSpace[2].y() * (float)numSubPixels)),
};
// Check (using cross product) if pixel center is
@@ -2138,15 +2138,15 @@
// both rounding directions
const I64Vec2 triangleSubPixelSpaceFloor[3] =
{
- I64Vec2(deFloorFloatToInt32(triangleScreenSpace[0].x()*numSubPixels), deFloorFloatToInt32(triangleScreenSpace[0].y()*numSubPixels)),
- I64Vec2(deFloorFloatToInt32(triangleScreenSpace[1].x()*numSubPixels), deFloorFloatToInt32(triangleScreenSpace[1].y()*numSubPixels)),
- I64Vec2(deFloorFloatToInt32(triangleScreenSpace[2].x()*numSubPixels), deFloorFloatToInt32(triangleScreenSpace[2].y()*numSubPixels)),
+ I64Vec2(deFloorFloatToInt32(triangleScreenSpace[0].x() * (float)numSubPixels), deFloorFloatToInt32(triangleScreenSpace[0].y() * (float)numSubPixels)),
+ I64Vec2(deFloorFloatToInt32(triangleScreenSpace[1].x() * (float)numSubPixels), deFloorFloatToInt32(triangleScreenSpace[1].y() * (float)numSubPixels)),
+ I64Vec2(deFloorFloatToInt32(triangleScreenSpace[2].x() * (float)numSubPixels), deFloorFloatToInt32(triangleScreenSpace[2].y() * (float)numSubPixels)),
};
const I64Vec2 triangleSubPixelSpaceCeil[3] =
{
- I64Vec2(deCeilFloatToInt32(triangleScreenSpace[0].x()*numSubPixels), deCeilFloatToInt32(triangleScreenSpace[0].y()*numSubPixels)),
- I64Vec2(deCeilFloatToInt32(triangleScreenSpace[1].x()*numSubPixels), deCeilFloatToInt32(triangleScreenSpace[1].y()*numSubPixels)),
- I64Vec2(deCeilFloatToInt32(triangleScreenSpace[2].x()*numSubPixels), deCeilFloatToInt32(triangleScreenSpace[2].y()*numSubPixels)),
+ I64Vec2(deCeilFloatToInt32(triangleScreenSpace[0].x() * (float)numSubPixels), deCeilFloatToInt32(triangleScreenSpace[0].y() * (float)numSubPixels)),
+ I64Vec2(deCeilFloatToInt32(triangleScreenSpace[1].x() * (float)numSubPixels), deCeilFloatToInt32(triangleScreenSpace[1].y() * (float)numSubPixels)),
+ I64Vec2(deCeilFloatToInt32(triangleScreenSpace[2].x() * (float)numSubPixels), deCeilFloatToInt32(triangleScreenSpace[2].y() * (float)numSubPixels)),
};
const I64Vec2* const corners = (multisample) ? (pixelCorners) : (pixelCenterCorners);
diff --git a/modules/glshared/glsScissorTests.cpp b/modules/glshared/glsScissorTests.cpp
index 6462182..11d51ad 100644
--- a/modules/glshared/glsScissorTests.cpp
+++ b/modules/glshared/glsScissorTests.cpp
@@ -202,10 +202,10 @@
const glu::ShaderProgram shader (m_renderCtx, genShaders(glu::getContextTypeGLSLVersion(m_renderCtx.getType())));
const RandomViewport viewport (m_renderCtx.getRenderTarget(), 256, 256, deStringHash(getName()));
- const IVec4 relScissorArea (int(m_scissorArea.x()*viewport.width),
- int(m_scissorArea.y()*viewport.height),
- int(m_scissorArea.z()*viewport.width),
- int(m_scissorArea.w()*viewport.height));
+ const IVec4 relScissorArea (int(m_scissorArea.x() * (float)viewport.width),
+ int(m_scissorArea.y() * (float)viewport.height),
+ int(m_scissorArea.z() * (float)viewport.width),
+ int(m_scissorArea.w() * (float)viewport.height));
const IVec4 absScissorArea (relScissorArea.x() + viewport.x,
relScissorArea.y() + viewport.y,
relScissorArea.z(),
@@ -380,7 +380,7 @@
}
for (int ndx = 0; ndx < indexCount; ndx++)
- indices[primNdx*indexCount + ndx] = baseIndices[ndx] + primNdx*vertexCount;
+ indices[primNdx*indexCount + ndx] = (deUint16)(baseIndices[ndx] + primNdx*vertexCount);
}
gl.uniform4fv(gl.getUniformLocation(program, "u_color"), 1, white.m_data);
diff --git a/modules/glshared/glsShaderExecUtil.cpp b/modules/glshared/glsShaderExecUtil.cpp
index 9597f63..6891eec 100644
--- a/modules/glshared/glsShaderExecUtil.cpp
+++ b/modules/glshared/glsShaderExecUtil.cpp
@@ -470,7 +470,7 @@
vector<glu::VertexArrayBinding> vertexArrays;
de::UniquePtr<glu::TransformFeedback> transformFeedback (useTFObject ? new glu::TransformFeedback(m_renderCtx) : DE_NULL);
glu::Buffer outputBuffer (m_renderCtx);
- const int outputBufferStride = computeTotalScalarSize(m_outputs.begin(), m_outputs.end())*sizeof(deUint32);
+ const int outputBufferStride = computeTotalScalarSize(m_outputs.begin(), m_outputs.end())*(int)sizeof(deUint32);
// Setup inputs.
for (int inputNdx = 0; inputNdx < (int)m_inputs.size(); inputNdx++)
@@ -490,7 +490,7 @@
{
int numRows = glu::getDataTypeMatrixNumRows(basicType);
int numCols = glu::getDataTypeMatrixNumColumns(basicType);
- int stride = numRows * numCols * sizeof(float);
+ int stride = numRows * numCols * (int)sizeof(float);
for (int colNdx = 0; colNdx < numCols; ++colNdx)
vertexArrays.push_back(glu::va::Float(symbol.name, colNdx, numRows, numValues, stride, ((const float*)ptr) + colNdx * numRows));
@@ -531,9 +531,9 @@
const int scalarSize = symbol.varType.getScalarSize();
for (int ndx = 0; ndx < numValues; ndx++)
- deMemcpy((deUint32*)dstPtr + scalarSize*ndx, (const deUint8*)srcPtr + curOffset + ndx*outputBufferStride, scalarSize*sizeof(deUint32));
+ deMemcpy((deUint32*)dstPtr + scalarSize*ndx, (const deUint8*)srcPtr + curOffset + ndx*outputBufferStride, scalarSize*(int)sizeof(deUint32));
- curOffset += scalarSize*sizeof(deUint32);
+ curOffset += scalarSize*(int)sizeof(deUint32);
}
gl.unmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);
@@ -735,7 +735,7 @@
{
int numRows = glu::getDataTypeMatrixNumRows(basicType);
int numCols = glu::getDataTypeMatrixNumColumns(basicType);
- int stride = numRows * numCols * sizeof(float);
+ int stride = numRows * numCols * (int)sizeof(float);
for (int colNdx = 0; colNdx < numCols; ++colNdx)
vertexArrays.push_back(glu::va::Float(attribName, colNdx, numRows, numValues, stride, ((const float*)ptr) + colNdx * numRows));
@@ -950,7 +950,7 @@
if (glu::isDataTypeScalarOrVector(basicType))
{
const deUint32 alignment = getVecStd430ByteAlignment(basicType);
- const deUint32 size = (deUint32)glu::getDataTypeScalarSize(basicType)*sizeof(deUint32);
+ const deUint32 size = (deUint32)glu::getDataTypeScalarSize(basicType)*(int)sizeof(deUint32);
curOffset = (deUint32)deAlign32((int)curOffset, (int)alignment);
maxAlignment = de::max(maxAlignment, alignment);
@@ -1005,7 +1005,7 @@
{
for (int vecNdx = 0; vecNdx < numVecs; vecNdx++)
{
- const int srcOffset = sizeof(deUint32)*(elemNdx*scalarSize + vecNdx*numComps);
+ const int srcOffset = (int)sizeof(deUint32)*(elemNdx*scalarSize + vecNdx*numComps);
const int dstOffset = layout.offset + layout.stride*elemNdx + (isMatrix ? layout.matrixStride*vecNdx : 0);
const deUint8* srcPtr = (const deUint8*)srcBasePtr + srcOffset;
deUint8* dstPtr = (deUint8*)dstBasePtr + dstOffset;
@@ -1033,7 +1033,7 @@
for (int vecNdx = 0; vecNdx < numVecs; vecNdx++)
{
const int srcOffset = layout.offset + layout.stride*elemNdx + (isMatrix ? layout.matrixStride*vecNdx : 0);
- const int dstOffset = sizeof(deUint32)*(elemNdx*scalarSize + vecNdx*numComps);
+ const int dstOffset = (int)sizeof(deUint32)*(elemNdx*scalarSize + vecNdx*numComps);
const deUint8* srcPtr = (const deUint8*)srcBasePtr + srcOffset;
deUint8* dstPtr = (deUint8*)dstBasePtr + dstOffset;
diff --git a/modules/glshared/glsShaderLibraryCase.cpp b/modules/glshared/glsShaderLibraryCase.cpp
index 089d7a6..1d9bb27 100644
--- a/modules/glshared/glsShaderLibraryCase.cpp
+++ b/modules/glshared/glsShaderLibraryCase.cpp
@@ -947,7 +947,7 @@
DE_ASSERT(scalarSize == numCols*numRows);
for (int i = 0; i < numCols; i++)
- vertexArrays.push_back(va::Float(attribLoc + i, numRows, numVerticesPerDraw, scalarSize*sizeof(float), &scalars[i * numRows]));
+ vertexArrays.push_back(va::Float(attribLoc + i, numRows, numVerticesPerDraw, scalarSize*(int)sizeof(float), &scalars[i * numRows]));
}
else
{
@@ -1017,10 +1017,10 @@
// Read back results.
Surface surface (width, height);
const float w = s_positions[3];
- const int minY = deCeilFloatToInt32 (((-quadSize / w) * 0.5f + 0.5f) * height + 1.0f);
- const int maxY = deFloorFloatToInt32(((+quadSize / w) * 0.5f + 0.5f) * height - 0.5f);
- const int minX = deCeilFloatToInt32 (((-quadSize / w) * 0.5f + 0.5f) * width + 1.0f);
- const int maxX = deFloorFloatToInt32(((+quadSize / w) * 0.5f + 0.5f) * width - 0.5f);
+ const int minY = deCeilFloatToInt32 (((-quadSize / w) * 0.5f + 0.5f) * (float)height + 1.0f);
+ const int maxY = deFloorFloatToInt32(((+quadSize / w) * 0.5f + 0.5f) * (float)height - 0.5f);
+ const int minX = deCeilFloatToInt32 (((-quadSize / w) * 0.5f + 0.5f) * (float)width + 1.0f);
+ const int maxX = deFloorFloatToInt32(((+quadSize / w) * 0.5f + 0.5f) * (float)width - 0.5f);
GLU_EXPECT_NO_ERROR(postDrawError, "draw");
diff --git a/modules/glshared/glsShaderRenderCase.cpp b/modules/glshared/glsShaderRenderCase.cpp
index e7dddf9..2bdb94b 100644
--- a/modules/glshared/glsShaderRenderCase.cpp
+++ b/modules/glshared/glsShaderRenderCase.cpp
@@ -64,22 +64,6 @@
static const int MAX_RENDER_HEIGHT = 112;
static const tcu::Vec4 DEFAULT_CLEAR_COLOR = tcu::Vec4(0.125f, 0.25f, 0.5f, 1.0f);
-inline RGBA toRGBA (const Vec4& a)
-{
- return RGBA(deClamp32(deRoundFloatToInt32(a.x() * 255.0f), 0, 255),
- deClamp32(deRoundFloatToInt32(a.y() * 255.0f), 0, 255),
- deClamp32(deRoundFloatToInt32(a.z() * 255.0f), 0, 255),
- deClamp32(deRoundFloatToInt32(a.w() * 255.0f), 0, 255));
-}
-
-inline tcu::Vec4 toVec (const RGBA& c)
-{
- return tcu::Vec4(c.getRed() / 255.0f,
- c.getGreen() / 255.0f,
- c.getBlue() / 255.0f,
- c.getAlpha() / 255.0f);
-}
-
// TextureBinding
TextureBinding::TextureBinding (const glu::Texture2D* tex2D, const tcu::Sampler& sampler)
@@ -214,8 +198,8 @@
for (int y = 0; y < gridSize+1; y++)
for (int x = 0; x < gridSize+1; x++)
{
- float sx = x / (float)gridSize;
- float sy = y / (float)gridSize;
+ float sx = (float)x / (float)gridSize;
+ float sy = (float)y / (float)gridSize;
float fx = 2.0f * sx - 1.0f;
float fy = 2.0f * sy - 1.0f;
int vtxNdx = ((y * (gridSize+1)) + x);
@@ -242,13 +226,13 @@
int v11 = ((y+1) * stride) + x + 1;
int baseNdx = ((y * gridSize) + x) * 6;
- m_indices[baseNdx + 0] = v10;
- m_indices[baseNdx + 1] = v00;
- m_indices[baseNdx + 2] = v01;
+ m_indices[baseNdx + 0] = (deUint16)v10;
+ m_indices[baseNdx + 1] = (deUint16)v00;
+ m_indices[baseNdx + 2] = (deUint16)v01;
- m_indices[baseNdx + 3] = v10;
- m_indices[baseNdx + 4] = v01;
- m_indices[baseNdx + 5] = v11;
+ m_indices[baseNdx + 3] = (deUint16)v10;
+ m_indices[baseNdx + 4] = (deUint16)v01;
+ m_indices[baseNdx + 5] = (deUint16)v11;
}
}
@@ -663,8 +647,8 @@
for (int y = 0; y < gridSize+1; y++)
for (int x = 0; x < gridSize+1; x++)
{
- float sx = x / (float)gridSize;
- float sy = y / (float)gridSize;
+ float sx = (float)x / (float)gridSize;
+ float sy = (float)y / (float)gridSize;
int vtxNdx = ((y * (gridSize+1)) + x);
evalCtx.reset(sx, sy);
@@ -682,10 +666,10 @@
for (int y = 0; y < gridSize; y++)
for (int x = 0; x < gridSize; x++)
{
- float x0 = x / (float)gridSize;
- float x1 = (x + 1) / (float)gridSize;
- float y0 = y / (float)gridSize;
- float y1 = (y + 1) / (float)gridSize;
+ float x0 = (float)x / (float)gridSize;
+ float x1 = (float)(x + 1) / (float)gridSize;
+ float y0 = (float)y / (float)gridSize;
+ float y1 = (float)(y + 1) / (float)gridSize;
float sx0 = x0 * (float)width;
float sx1 = x1 * (float)width;
@@ -730,7 +714,7 @@
const Vec4& t2 = tri ? c10 : c01;
Vec4 color = t0 + (t1-t0)*tx + (t2-t0)*ty;
- result.setPixel(ix, iy, toRGBA(color));
+ result.setPixel(ix, iy, tcu::RGBA(color));
}
}
}
@@ -758,7 +742,7 @@
if (!hasAlpha)
color.w() = 1.0f;
- result.setPixel(x, y, toRGBA(color));
+ result.setPixel(x, y, tcu::RGBA(color));
}
}
diff --git a/modules/glshared/glsStateChangePerfTestCases.cpp b/modules/glshared/glsStateChangePerfTestCases.cpp
index aacb05e..51ab6aa 100644
--- a/modules/glshared/glsStateChangePerfTestCases.cpp
+++ b/modules/glshared/glsStateChangePerfTestCases.cpp
@@ -71,7 +71,7 @@
for (int i = 0; i < (int)values.size(); i++)
sum += values[i];
- result.mean = ((double)sum) / values.size();
+ result.mean = ((double)sum) / (double)values.size();
for (int i = 0; i < (int)values.size(); i++)
{
@@ -79,7 +79,7 @@
result.variance += (val - result.mean) * (val - result.mean);
}
- result.variance /= values.size();
+ result.variance /= (double)values.size();
{
const int n = (int)(values.size()/2);
@@ -107,9 +107,9 @@
for (int triangleNdx = 0; triangleNdx < triangleCount; triangleNdx++)
{
- indices.push_back((GLushort)triangleNdx*3);
- indices.push_back((GLushort)triangleNdx*3+1);
- indices.push_back((GLushort)triangleNdx*3+2);
+ indices.push_back((GLushort)(triangleNdx*3));
+ indices.push_back((GLushort)(triangleNdx*3+1));
+ indices.push_back((GLushort)(triangleNdx*3+2));
}
}
@@ -173,7 +173,7 @@
sum += (value - avg) * (value - avg);
}
- return sum / values.size();
+ return sum / (double)values.size();
}
deUint64 findMin (const vector<deUint64>& values)
@@ -681,7 +681,7 @@
for (int valueNdx = 0; valueNdx < (int)values.size(); valueNdx++)
sum += values[valueNdx];
- return ((double)sum) / values.size();
+ return ((double)sum) / (double)values.size();
}
void StateChangeCallPerformanceCase::logAndSetTestResult (void)
diff --git a/modules/glshared/glsStateQueryUtil.cpp b/modules/glshared/glsStateQueryUtil.cpp
index 25cf96d..ef3000f 100644
--- a/modules/glshared/glsStateQueryUtil.cpp
+++ b/modules/glshared/glsStateQueryUtil.cpp
@@ -1728,7 +1728,7 @@
static float normalizeI32Float (deInt32 c)
{
- return de::max(c / float((1ul << 31) - 1u), -1.0f);
+ return de::max((float)c / float((1ul << 31) - 1u), -1.0f);
}
void verifyNormalizedI32Vec4 (tcu::ResultCollector& result, QueriedState& state, const tcu::IVec4& expected)
diff --git a/modules/glshared/glsTextureBufferCase.cpp b/modules/glshared/glsTextureBufferCase.cpp
index 21787a2..cb4b35a 100644
--- a/modules/glshared/glsTextureBufferCase.cpp
+++ b/modules/glshared/glsTextureBufferCase.cpp
@@ -82,16 +82,9 @@
deUint8 extend2BitsToByte (deUint8 bits)
{
- deUint8 x = 0;
-
DE_ASSERT((bits & (~0x03u)) == 0);
- x |= bits << 6;
- x |= bits << 4;
- x |= bits << 2;
- x |= bits;
-
- return x;
+ return (deUint8)(bits | (bits << 2) | (bits << 4) | (bits << 6));
}
void genRandomCoords (de::Random rng, vector<deUint8>& coords, size_t offset, size_t size)
@@ -445,7 +438,7 @@
glu::TextureBuffer& texture)
{
const size_t minSize = 4*16;
- const size_t size = de::max<size_t>(minSize, size_t((texture.getSize() != 0 ? texture.getSize() : texture.getBufferSize()) * (0.7 + 0.3 * rng.getFloat())));
+ const size_t size = de::max<size_t>(minSize, size_t((float)(texture.getSize() != 0 ? texture.getSize() : texture.getBufferSize()) * (0.7f + 0.3f * rng.getFloat())));
const size_t minOffset = texture.getOffset();
const size_t offset = minOffset + (rng.getUint32() % (texture.getBufferSize() - (size + minOffset)));
vector<deUint8> data;
@@ -468,7 +461,7 @@
glu::TextureBuffer& texture)
{
const size_t minSize = 4*16;
- const size_t size = de::max<size_t>(minSize, size_t((texture.getSize() != 0 ? texture.getSize() : texture.getBufferSize()) * (0.7 + 0.3 * rng.getFloat())));
+ const size_t size = de::max<size_t>(minSize, size_t((float)(texture.getSize() != 0 ? texture.getSize() : texture.getBufferSize()) * (0.7f + 0.3f * rng.getFloat())));
const size_t minOffset = texture.getOffset();
const size_t offset = minOffset + (rng.getUint32() % (texture.getBufferSize() - (size + minOffset)));
vector<deUint8> data;
@@ -502,7 +495,7 @@
glu::TextureBuffer& texture)
{
const size_t minSize = 4*16;
- const size_t size = de::max<size_t>(minSize, size_t((texture.getSize() != 0 ? texture.getSize() : texture.getBufferSize()) * (0.7 + 0.3 * rng.getFloat())));
+ const size_t size = de::max<size_t>(minSize, size_t((float)(texture.getSize() != 0 ? texture.getSize() : texture.getBufferSize()) * (0.7f + 0.3f * rng.getFloat())));
const size_t minOffset = texture.getOffset();
const size_t offset = minOffset + (rng.getUint32() % (texture.getBufferSize() - (size + minOffset)));
vector<deUint8> data;
diff --git a/modules/glshared/glsTextureTestUtil.cpp b/modules/glshared/glsTextureTestUtil.cpp
index 5966e22..8811651 100644
--- a/modules/glshared/glsTextureTestUtil.cpp
+++ b/modules/glshared/glsTextureTestUtil.cpp
@@ -3247,10 +3247,10 @@
for (int x = 0; x < dst.getWidth(); x++)
{
const tcu::Vec4 result = dst.getPixel(x, y);
- const int minX = deFloorFloatToInt32(float(x-0.5f) / dstW * srcW);
- const int minY = deFloorFloatToInt32(float(y-0.5f) / dstH * srcH);
- const int maxX = deCeilFloatToInt32(float(x+1.5f) / dstW * srcW);
- const int maxY = deCeilFloatToInt32(float(y+1.5f) / dstH * srcH);
+ const int minX = deFloorFloatToInt32(((float)x-0.5f) / dstW * srcW);
+ const int minY = deFloorFloatToInt32(((float)y-0.5f) / dstH * srcH);
+ const int maxX = deCeilFloatToInt32(((float)x+1.5f) / dstW * srcW);
+ const int maxY = deCeilFloatToInt32(((float)y+1.5f) / dstH * srcH);
tcu::Vec4 minVal, maxVal;
bool isOk;
diff --git a/modules/glshared/glsTextureTestUtil.hpp b/modules/glshared/glsTextureTestUtil.hpp
index 6225efb..a94f1ab 100644
--- a/modules/glshared/glsTextureTestUtil.hpp
+++ b/modules/glshared/glsTextureTestUtil.hpp
@@ -240,14 +240,6 @@
RandomViewport (const tcu::RenderTarget& renderTarget, int preferredWidth, int preferredHeight, deUint32 seed);
};
-inline tcu::RGBA toRGBA (const tcu::Vec4& v)
-{
- return tcu::RGBA(tcu::floatToU8(v.x()),
- tcu::floatToU8(v.y()),
- tcu::floatToU8(v.z()),
- tcu::floatToU8(v.w()));
-}
-
inline tcu::RGBA toRGBAMasked (const tcu::Vec4& v, deUint8 mask)
{
return tcu::RGBA((mask&tcu::RGBA::RED_MASK) ? tcu::floatToU8(v.x()) : 0,
@@ -256,20 +248,18 @@
(mask&tcu::RGBA::ALPHA_MASK) ? tcu::floatToU8(v.w()) : 0xFF); //!< \note Alpha defaults to full saturation when reading masked format
}
+// \todo[jarkko 2015-05-19] remove this
inline tcu::Vec4 toVec4 (const tcu::RGBA& c)
{
- return tcu::Vec4(c.getRed() / 255.0f,
- c.getGreen() / 255.0f,
- c.getBlue() / 255.0f,
- c.getAlpha() / 255.0f);
+ return c.toVec();
}
inline deUint8 getColorMask (const tcu::PixelFormat& format)
{
- return (format.redBits ? tcu::RGBA::RED_MASK : 0) |
- (format.greenBits ? tcu::RGBA::GREEN_MASK : 0) |
- (format.blueBits ? tcu::RGBA::BLUE_MASK : 0) |
- (format.alphaBits ? tcu::RGBA::ALPHA_MASK : 0);
+ return (deUint8)((format.redBits ? tcu::RGBA::RED_MASK : 0) |
+ (format.greenBits ? tcu::RGBA::GREEN_MASK : 0) |
+ (format.blueBits ? tcu::RGBA::BLUE_MASK : 0) |
+ (format.alphaBits ? tcu::RGBA::ALPHA_MASK : 0));
}
inline tcu::IVec4 getBitsVec (const tcu::PixelFormat& format)
diff --git a/modules/glshared/glsUniformBlockCase.cpp b/modules/glshared/glsUniformBlockCase.cpp
index d2d4760..fd272bf 100644
--- a/modules/glshared/glsUniformBlockCase.cpp
+++ b/modules/glshared/glsUniformBlockCase.cpp
@@ -361,7 +361,7 @@
int getDataTypeByteSize (glu::DataType type)
{
- return glu::getDataTypeScalarSize(type)*sizeof(deUint32);
+ return glu::getDataTypeScalarSize(type)*(int)sizeof(deUint32);
}
int getDataTypeByteAlignment (glu::DataType type)
@@ -371,12 +371,12 @@
case glu::TYPE_FLOAT:
case glu::TYPE_INT:
case glu::TYPE_UINT:
- case glu::TYPE_BOOL: return 1*sizeof(deUint32);
+ case glu::TYPE_BOOL: return 1*(int)sizeof(deUint32);
case glu::TYPE_FLOAT_VEC2:
case glu::TYPE_INT_VEC2:
case glu::TYPE_UINT_VEC2:
- case glu::TYPE_BOOL_VEC2: return 2*sizeof(deUint32);
+ case glu::TYPE_BOOL_VEC2: return 2*(int)sizeof(deUint32);
case glu::TYPE_FLOAT_VEC3:
case glu::TYPE_INT_VEC3:
@@ -386,7 +386,7 @@
case glu::TYPE_FLOAT_VEC4:
case glu::TYPE_INT_VEC4:
case glu::TYPE_UINT_VEC4:
- case glu::TYPE_BOOL_VEC4: return 4*sizeof(deUint32);
+ case glu::TYPE_BOOL_VEC4: return 4*(int)sizeof(deUint32);
default:
DE_ASSERT(false);
@@ -398,8 +398,8 @@
{
DE_ASSERT(!glu::isDataTypeMatrix(type));
- int baseStride = getDataTypeByteSize(type);
- int vec4Alignment = sizeof(deUint32)*4;
+ const int baseStride = getDataTypeByteSize(type);
+ const int vec4Alignment = (int)sizeof(deUint32)*4;
DE_ASSERT(baseStride <= vec4Alignment);
return de::max(baseStride, vec4Alignment); // Really? See rule 4.
@@ -413,7 +413,7 @@
int computeStd140BaseAlignment (const VarType& type)
{
- const int vec4Alignment = sizeof(deUint32)*4;
+ const int vec4Alignment = (int)sizeof(deUint32)*4;
if (type.isBasicType())
{
diff --git a/modules/glshared/glsVertexArrayTests.cpp b/modules/glshared/glsVertexArrayTests.cpp
index e5ec808..ca07647 100644
--- a/modules/glshared/glsVertexArrayTests.cpp
+++ b/modules/glshared/glsVertexArrayTests.cpp
@@ -172,21 +172,21 @@
{
static const int size[] =
{
- sizeof(float), // INPUTTYPE_FLOAT = 0,
- sizeof(deInt32), // INPUTTYPE_FIXED,
- sizeof(double), // INPUTTYPE_DOUBLE
+ (int)sizeof(float), // INPUTTYPE_FLOAT = 0,
+ (int)sizeof(deInt32), // INPUTTYPE_FIXED,
+ (int)sizeof(double), // INPUTTYPE_DOUBLE
- sizeof(deInt8), // INPUTTYPE_BYTE,
- sizeof(deInt16), // INPUTTYPE_SHORT,
+ (int)sizeof(deInt8), // INPUTTYPE_BYTE,
+ (int)sizeof(deInt16), // INPUTTYPE_SHORT,
- sizeof(deUint8), // INPUTTYPE_UNSIGNED_BYTE,
- sizeof(deUint16), // INPUTTYPE_UNSIGNED_SHORT,
+ (int)sizeof(deUint8), // INPUTTYPE_UNSIGNED_BYTE,
+ (int)sizeof(deUint16), // INPUTTYPE_UNSIGNED_SHORT,
- sizeof(deInt32), // INPUTTYPE_INT,
- sizeof(deUint32), // INPUTTYPE_UNSIGNED_INT,
- sizeof(deFloat16), // INPUTTYPE_HALF,
- sizeof(deUint32) / 4, // INPUTTYPE_UNSIGNED_INT_2_10_10_10,
- sizeof(deUint32) / 4 // INPUTTYPE_INT_2_10_10_10,
+ (int)sizeof(deInt32), // INPUTTYPE_INT,
+ (int)sizeof(deUint32), // INPUTTYPE_UNSIGNED_INT,
+ (int)sizeof(deFloat16), // INPUTTYPE_HALF,
+ (int)sizeof(deUint32) / 4, // INPUTTYPE_UNSIGNED_INT_2_10_10_10,
+ (int)sizeof(deUint32) / 4 // INPUTTYPE_INT_2_10_10_10,
};
return de::getSizedArrayElement<Array::INPUTTYPE_LAST>(size, (int)type);
@@ -234,7 +234,7 @@
if (max < min)
return min;
- return GLValue::Short::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+ return GLValue::Short::create((min == max ? min : (deInt16)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
}
template<>
@@ -243,7 +243,7 @@
if (max < min)
return min;
- return GLValue::Ushort::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+ return GLValue::Ushort::create((min == max ? min : (deUint16)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
}
template<>
@@ -252,7 +252,7 @@
if (max < min)
return min;
- return GLValue::Byte::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+ return GLValue::Byte::create((min == max ? min : (deInt8)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
}
template<>
@@ -261,7 +261,7 @@
if (max < min)
return min;
- return GLValue::Ubyte::create((min == max ? min : min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>()))));
+ return GLValue::Ubyte::create((min == max ? min : (deUint8)(min + (deRandom_getUint32(&rnd) % (max.to<int>() - min.to<int>())))));
}
template<>
@@ -1758,9 +1758,9 @@
, m_glArrayPack (DE_NULL)
, m_rrArrayPack (DE_NULL)
, m_isOk (false)
- , m_maxDiffRed (deCeilFloatToInt32(256.0f * (2.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().redBits))))
- , m_maxDiffGreen (deCeilFloatToInt32(256.0f * (2.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().greenBits))))
- , m_maxDiffBlue (deCeilFloatToInt32(256.0f * (2.0f / (1 << m_renderCtx.getRenderTarget().getPixelFormat().blueBits))))
+ , m_maxDiffRed (deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().redBits))))
+ , m_maxDiffGreen (deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().greenBits))))
+ , m_maxDiffBlue (deCeilFloatToInt32(256.0f * (2.0f / (float)(1 << m_renderCtx.getRenderTarget().getPixelFormat().blueBits))))
{
}
@@ -1843,9 +1843,9 @@
// Check reference pixel against screen pixel
{
tcu::RGBA screenCmpPixel = screen.getPixel(x+dx, y+dy);
- deUint8 r = deAbs32(refPixel.getRed() - screenCmpPixel.getRed());
- deUint8 g = deAbs32(refPixel.getGreen() - screenCmpPixel.getGreen());
- deUint8 b = deAbs32(refPixel.getBlue() - screenCmpPixel.getBlue());
+ deUint8 r = (deUint8)deAbs32(refPixel.getRed() - screenCmpPixel.getRed());
+ deUint8 g = (deUint8)deAbs32(refPixel.getGreen() - screenCmpPixel.getGreen());
+ deUint8 b = (deUint8)deAbs32(refPixel.getBlue() - screenCmpPixel.getBlue());
if (r <= m_maxDiffRed && g <= m_maxDiffGreen && b <= m_maxDiffBlue)
isOkPixel = true;
@@ -1854,9 +1854,9 @@
// Check screen pixels against reference pixel
{
tcu::RGBA refCmpPixel = ref.getPixel(x+dx, y+dy);
- deUint8 r = deAbs32(refCmpPixel.getRed() - screenPixel.getRed());
- deUint8 g = deAbs32(refCmpPixel.getGreen() - screenPixel.getGreen());
- deUint8 b = deAbs32(refCmpPixel.getBlue() - screenPixel.getBlue());
+ deUint8 r = (deUint8)deAbs32(refCmpPixel.getRed() - screenPixel.getRed());
+ deUint8 g = (deUint8)deAbs32(refCmpPixel.getGreen() - screenPixel.getGreen());
+ deUint8 b = (deUint8)deAbs32(refCmpPixel.getBlue() - screenPixel.getBlue());
if (r <= m_maxDiffRed && g <= m_maxDiffGreen && b <= m_maxDiffBlue)
isOkPixel = true;
diff --git a/modules/glshared/glsVertexArrayTests.hpp b/modules/glshared/glsVertexArrayTests.hpp
index 155bb6d..25a04a3 100644
--- a/modules/glshared/glsVertexArrayTests.hpp
+++ b/modules/glshared/glsVertexArrayTests.hpp
@@ -244,10 +244,10 @@
static WrappedType<Type> create (Type value) { WrappedType<Type> v; v.m_value = value; return v; }
inline Type getValue (void) const { return m_value; }
- inline WrappedType<Type> operator+ (const WrappedType<Type>& other) const { return WrappedType<Type>::create(m_value + other.getValue()); }
- inline WrappedType<Type> operator* (const WrappedType<Type>& other) const { return WrappedType<Type>::create(m_value * other.getValue()); }
- inline WrappedType<Type> operator/ (const WrappedType<Type>& other) const { return WrappedType<Type>::create(m_value / other.getValue()); }
- inline WrappedType<Type> operator- (const WrappedType<Type>& other) const { return WrappedType<Type>::create(m_value - other.getValue()); }
+ inline WrappedType<Type> operator+ (const WrappedType<Type>& other) const { return WrappedType<Type>::create((Type)(m_value + other.getValue())); }
+ inline WrappedType<Type> operator* (const WrappedType<Type>& other) const { return WrappedType<Type>::create((Type)(m_value * other.getValue())); }
+ inline WrappedType<Type> operator/ (const WrappedType<Type>& other) const { return WrappedType<Type>::create((Type)(m_value / other.getValue())); }
+ inline WrappedType<Type> operator- (const WrappedType<Type>& other) const { return WrappedType<Type>::create((Type)(m_value - other.getValue())); }
inline WrappedType<Type>& operator+= (const WrappedType<Type>& other) { m_value += other.getValue(); return *this; }
inline WrappedType<Type>& operator*= (const WrappedType<Type>& other) { m_value *= other.getValue(); return *this; }
diff --git a/modules/internal/ditFrameworkTests.cpp b/modules/internal/ditFrameworkTests.cpp
index fdf23dc..2b55b15 100644
--- a/modules/internal/ditFrameworkTests.cpp
+++ b/modules/internal/ditFrameworkTests.cpp
@@ -791,8 +791,8 @@
(subCase.vtx[1].z() == subCase.vtx[2].z());
const float refDepth = subCase.vtx[0].z()*(zf - zn)/2.0f + (zn + zf)/2.0f;
- rr::resolveMultisampleColorBuffer(resolvedColor.getAccess(), rr::MultisampleConstPixelBufferAccess::fromMultisampleAccess(interpolated.getAccess()));
- rr::resolveMultisampleColorBuffer(resolvedDepthStencil.getAccess(), rr::MultisampleConstPixelBufferAccess::fromMultisampleAccess(depthStencil.getAccess()));
+ rr::resolveMultisampleBuffer(resolvedColor.getAccess(), rr::MultisampleConstPixelBufferAccess::fromMultisampleAccess(interpolated.getAccess()));
+ rr::resolveMultisampleBuffer(resolvedDepthStencil.getAccess(), rr::MultisampleConstPixelBufferAccess::fromMultisampleAccess(depthStencil.getAccess()));
clear(errorAccess, Vec4(0.0f, 1.0f, 0.0f, 1.0f));
for (int y = 0; y < height; y++)
diff --git a/modules/internal/ditImageCompareTests.cpp b/modules/internal/ditImageCompareTests.cpp
index 899b488..28c480c 100644
--- a/modules/internal/ditImageCompareTests.cpp
+++ b/modules/internal/ditImageCompareTests.cpp
@@ -83,6 +83,10 @@
compareTime = deGetMicroseconds()-startTime;
}
+ m_testCtx.getLog() << TestLog::Image("RefImage", "Reference Image", refImg)
+ << TestLog::Image("CmpImage", "Compare Image", cmpImg)
+ << TestLog::Image("ErrorMask", "Error Mask", errorMask);
+
m_testCtx.getLog() << TestLog::Float("Result", "Result metric", "", QP_KEY_TAG_NONE, result)
<< TestLog::Float("MinBound", "Minimum bound", "", QP_KEY_TAG_NONE, m_minBound)
<< TestLog::Float("MaxBound", "Maximum bound", "", QP_KEY_TAG_NONE, m_maxBound)
@@ -164,7 +168,7 @@
addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube", "cube_ref.png", "cube_cmp.png", 0.0029f, 0.0031f));
addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_2", "cube_2_ref.png", "cube_2_cmp.png", 0.0134f, 0.0140f));
addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_sphere", "cube_sphere_ref.png", "cube_sphere_cmp.png", 0.0730f, 0.0801f));
- addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_nmap", "cube_nmap_ref.png", "cube_nmap_cmp.png", 0.0024f, 0.0025f));
+ addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_nmap", "cube_nmap_ref.png", "cube_nmap_cmp.png", 0.0022f, 0.0025f));
addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_nmap_2", "cube_nmap_2_ref.png", "cube_nmap_2_cmp.png", 0.0172f, 0.0189f));
addChild(new FuzzyComparisonMetricCase(m_testCtx, "earth_diffuse", "earth_diffuse_ref.png", "earth_diffuse_cmp.png", 0.0f, 0.00002f));
addChild(new FuzzyComparisonMetricCase(m_testCtx, "eath_texture", "earth_texture_ref.png", "earth_texture_cmp.png", 0.0002f, 0.0003f));
@@ -172,7 +176,7 @@
addChild(new FuzzyComparisonMetricCase(m_testCtx, "earth_light", "earth_light_ref.png", "earth_light_cmp.png", 1.7050f, 1.7070f));
addChild(new FuzzyComparisonMetricCase(m_testCtx, "lessThan0", "lessThan0-reference.png", "lessThan0-result.png", 0.0003f, 0.0004f));
addChild(new FuzzyComparisonMetricCase(m_testCtx, "cube_sphere_2", "cube_sphere_2_ref.png", "cube_sphere_2_cmp.png", 0.0207f, 0.0230f));
- addChild(new FuzzyComparisonMetricCase(m_testCtx, "earth_to_empty", "earth_spot_ref.png", "empty_256x256.png", 77074.0f, 77076.0f));
+ addChild(new FuzzyComparisonMetricCase(m_testCtx, "earth_to_empty", "earth_spot_ref.png", "empty_256x256.png", 54951.0f, 54955.0f));
}
};
diff --git a/scripts/opengl/gen_null_render_context.py b/scripts/opengl/gen_null_render_context.py
index 36a2d5e..3693433 100644
--- a/scripts/opengl/gen_null_render_context.py
+++ b/scripts/opengl/gen_null_render_context.py
@@ -43,11 +43,13 @@
"glGenSamplers",
"glGenTransformFeedbacks",
"glGenProgramPipelines",
+ "glGetInternalformativ",
"glMapBufferRange",
"glCheckFramebufferStatus",
"glReadPixels",
"glBindBuffer",
- "glDeleteBuffers"
+ "glDeleteBuffers",
+ "glGetAttribLocation",
])
NULL_PLATFORM_DIR = os.path.normpath(os.path.join(SCRIPTS_DIR, "..", "..", "framework", "platform", "null"))
diff --git a/targets/null/null.cmake b/targets/null/null.cmake
index d86ef46..d12f177 100644
--- a/targets/null/null.cmake
+++ b/targets/null/null.cmake
@@ -12,4 +12,6 @@
null/tcuNullPlatform.hpp
null/tcuNullRenderContext.cpp
null/tcuNullRenderContext.hpp
+ null/tcuNullContextFactory.cpp
+ null/tcuNullContextFactory.hpp
)