dEQP-GLES2.functional.texture.size.cube.15x15_rgba4444
dEQP-GLES2.functional.texture.size.cube.15x15_rgba8888
dEQP-GLES2.functional.texture.size.cube.16x16_l8_mipmap
-dEQP-GLES2.functional.texture.size.cube.256x256_rgba4444
dEQP-GLES2.functional.texture.size.cube.256x256_rgba4444_mipmap
-dEQP-GLES2.functional.texture.size.cube.512x512_rgba4444
dEQP-GLES2.functional.texture.size.cube.512x512_rgba4444_mipmap
dEQP-GLES2.functional.texture.specification.teximage2d_align.cube_l8_63_1
dEQP-GLES2.functional.texture.specification.teximage2d_align.cube_l8_63_2
--- /dev/null
+# Bug 21526557
+dEQP-GLES2.functional.texture.size.cube.256x256_rgba4444
+dEQP-GLES2.functional.texture.size.cube.512x512_rgba4444
--- /dev/null
+# Feature Request 21737242
+dEQP-GLES31.functional.tessellation.user_defined_io.negative.per_vertex_incorrect_control_explicit_output_array_size_1
+dEQP-GLES31.functional.tessellation.user_defined_io.negative.per_vertex_incorrect_control_explicit_output_array_size_2
+dEQP-GLES31.functional.tessellation.user_defined_io.negative.per_vertex_incorrect_control_explicit_output_array_size_3
+dEQP-GLES31.functional.tessellation.user_defined_io.negative.per_vertex_incorrect_eval_explicit_input_array_size
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()
}
""
end
+
+case per_vertex_incorrect_control_explicit_output_array_size_1
+ version 310 es
+ desc "Incorrectly sized tessellation control output array"
+ expect compile_or_link_fail
+ require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
+ vertex ""
+ #version 310 es
+ ${VERTEX_DECLARATIONS}
+ void main()
+ {
+ ${VERTEX_OUTPUT}
+ }
+ ""
+ tessellation_control ""
+ #version 310 es
+ ${TESSELLATION_CONTROL_DECLARATIONS}
+ out highp float varyingArray[3]; // size is not equal to gl_MaxPatchVertices
+ void main()
+ {
+ varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID];
+ ${TESSELLATION_CONTROL_OUTPUT}
+ }
+ ""
+ tessellation_evaluation ""
+ #version 310 es
+ ${TESSELLATION_EVALUATION_DECLARATIONS}
+ in highp float varyingArray[gl_MaxPatchVertices]; // size is correct
+ out mediump float te_out;
+ void main()
+ {
+ te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2];
+ ${TESSELLATION_EVALUATION_OUTPUT}
+ }
+ ""
+ fragment ""
+ #version 310 es
+ precision mediump float;
+ ${FRAGMENT_DECLARATIONS}
+ in mediump float te_out;
+ void main()
+ {
+ ${FRAG_COLOR} = vec4(te_out);
+ }
+ ""
+end
+
+case per_vertex_incorrect_control_explicit_output_array_size_2
+ version 310 es
+ desc "Incorrectly sized tessellation control output array"
+ expect compile_or_link_fail
+ require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
+ vertex ""
+ #version 310 es
+ ${VERTEX_DECLARATIONS}
+ void main()
+ {
+ ${VERTEX_OUTPUT}
+ }
+ ""
+ tessellation_control ""
+ #version 310 es
+ ${TESSELLATION_CONTROL_DECLARATIONS}
+ out highp float varyingArray[gl_MaxPatchVertices]; // size does not match layout declaration
+ void main()
+ {
+ varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID];
+ ${TESSELLATION_CONTROL_OUTPUT}
+ }
+ ""
+ tessellation_evaluation ""
+ #version 310 es
+ ${TESSELLATION_EVALUATION_DECLARATIONS}
+ in highp float varyingArray[gl_MaxPatchVertices]; // size is correct
+ out mediump float te_out;
+ void main()
+ {
+ te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2];
+ ${TESSELLATION_EVALUATION_OUTPUT}
+ }
+ ""
+ fragment ""
+ #version 310 es
+ precision mediump float;
+ ${FRAGMENT_DECLARATIONS}
+ in mediump float te_out;
+ void main()
+ {
+ ${FRAG_COLOR} = vec4(te_out);
+ }
+ ""
+end
+
+case per_vertex_incorrect_control_explicit_output_array_size_3
+ version 310 es
+ desc "Incorrectly sized tessellation control output array"
+ expect compile_or_link_fail
+ require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
+ vertex ""
+ #version 310 es
+ ${VERTEX_DECLARATIONS}
+ void main()
+ {
+ ${VERTEX_OUTPUT}
+ }
+ ""
+ tessellation_control ""
+ #version 310 es
+ ${TESSELLATION_CONTROL_DECLARATIONS}
+ out highp float varyingArray[${GL_MAX_PATCH_VERTICES}]; // size does not match layout declaration
+ void main()
+ {
+ varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID];
+ ${TESSELLATION_CONTROL_OUTPUT}
+ }
+ ""
+ tessellation_evaluation ""
+ #version 310 es
+ ${TESSELLATION_EVALUATION_DECLARATIONS}
+ in highp float varyingArray[gl_MaxPatchVertices]; // size is correct
+ out mediump float te_out;
+ void main()
+ {
+ te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2];
+ ${TESSELLATION_EVALUATION_OUTPUT}
+ }
+ ""
+ fragment ""
+ #version 310 es
+ precision mediump float;
+ ${FRAGMENT_DECLARATIONS}
+ in mediump float te_out;
+ void main()
+ {
+ ${FRAG_COLOR} = vec4(te_out);
+ }
+ ""
+end
+
+case per_vertex_incorrect_eval_explicit_input_array_size
+ version 310 es
+ desc "Incorrectly sized tessellation control output array"
+ expect compile_or_link_fail
+ require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
+ vertex ""
+ #version 310 es
+ ${VERTEX_DECLARATIONS}
+ void main()
+ {
+ ${VERTEX_OUTPUT}
+ }
+ ""
+ tessellation_control ""
+ #version 310 es
+ ${TESSELLATION_CONTROL_DECLARATIONS}
+ out highp float varyingArray[];
+ void main()
+ {
+ varyingArray[gl_InvocationID] = gl_in[0].gl_Position[gl_InvocationID];
+ ${TESSELLATION_CONTROL_OUTPUT}
+ }
+ ""
+ tessellation_evaluation ""
+ #version 310 es
+ ${TESSELLATION_EVALUATION_DECLARATIONS}
+ in highp float varyingArray[3]; // size is not equal to gl_MaxPatchVertices
+ out mediump float te_out;
+ void main()
+ {
+ te_out = varyingArray[0] * gl_TessCoord.x + varyingArray[1] * gl_TessCoord.y + varyingArray[2];
+ ${TESSELLATION_EVALUATION_OUTPUT}
+ }
+ ""
+ fragment ""
+ #version 310 es
+ precision mediump float;
+ ${FRAGMENT_DECLARATIONS}
+ in mediump float te_out;
+ void main()
+ {
+ ${FRAG_COLOR} = vec4(te_out);
+ }
+ ""
+end
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)
}
}
-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)
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.
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)
}
}
-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)
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.
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
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)
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);
}
}
}
}
}
-void ExecutionRequestHandler::processMessage (MessageType type, const deUint8* data, int dataSize)
+void ExecutionRequestHandler::processMessage (MessageType type, const deUint8* data, size_t dataSize)
{
switch (type)
{
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)
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)
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
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);
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)
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);
private:
const deUint8* m_data;
- int m_size;
- int m_pos;
+ size_t m_size;
+ size_t m_pos;
};
class MessageWriter
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));
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);
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);
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);
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);
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);
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);
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);
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;
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) {}
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) {}
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) {};
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;
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) {}
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) {}
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;
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;
*//*--------------------------------------------------------------------*/
#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>
+
+#if (DE_OS == DE_OS_UNIX) || (DE_OS == DE_OS_ANDROID) || (DE_OS == DE_OS_WIN32)
+# include <signal.h>
+#endif
+
+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);
{ "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
{
{
}
- 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;
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>();
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;
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);
}
}
-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())
{
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))
{
}
}
-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))
{
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);
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);
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);
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());
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 (...)
throw;
}
}
- else
+ else if (cmdLine.runMode == RUNMODE_CONNECT)
{
de::SocketAddress address;
+
address.setFamily(DE_SOCKETFAMILY_INET4);
address.setProtocol(DE_SOCKETPROTOCOL_TCP);
- address.setHost(cmdLine.host.c_str());
+ 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_ASSERT(false);
+ return DE_NULL;
+ }
}
-static void runExecutor (const CommandLine& cmdLine)
+#if (DE_OS == DE_OS_UNIX) || (DE_OS == DE_OS_ANDROID)
+
+static xe::BatchExecutor* s_executor = DE_NULL;
+
+void signalHandler (int, siginfo_t*, void*)
+{
+ if (s_executor)
+ s_executor->cancel();
+}
+
+void setupSignalHandler (xe::BatchExecutor* executor)
+{
+ s_executor = executor;
+ struct sigaction sa;
+
+ sa.sa_sigaction = signalHandler;
+ sa.sa_flags = SA_SIGINFO | SA_RESTART;
+ sigfillset(&sa.sa_mask);
+
+ sigaction(SIGINT, &sa, DE_NULL);
+}
+
+void resetSignalHandler (void)
+{
+ struct sigaction sa;
+
+ sa.sa_handler = SIG_DFL;
+ sa.sa_flags = SA_RESTART;
+ sigfillset(&sa.sa_mask);
+
+ sigaction(SIGINT, &sa, DE_NULL);
+ s_executor = DE_NULL;
+}
+
+#elif (DE_OS == DE_OS_WIN32)
+
+static xe::BatchExecutor* s_executor = DE_NULL;
+
+void signalHandler (int)
+{
+ if (s_executor)
+ s_executor->cancel();
+}
+
+void setupSignalHandler (xe::BatchExecutor* executor)
+{
+ s_executor = executor;
+ signal(SIGINT, signalHandler);
+}
+
+void resetSignalHandler (void)
+{
+ signal(SIGINT, SIG_DFL);
+ s_executor = DE_NULL;
+}
+
+#else
+
+void setupSignalHandler (xe::BatchExecutor*)
+{
+}
+
+void resetSignalHandler (void)
+{
+}
+
+#endif
+
+void runExecutor (const CommandLine& cmdLine)
{
xe::TestRoot root;
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());
std::auto_ptr<xe::CommLink> commLink(createCommLink(cmdLine));
xe::BatchExecutor executor(cmdLine.targetCfg, commLink.get(), &root, testSet, &batchResult, &infoLog);
- executor.run();
- commLink.reset();
+ try
+ {
+ setupSignalHandler(&executor);
+ executor.run();
+ resetSignalHandler();
+ }
+ catch (...)
+ {
+ resetSignalHandler();
+
+ if (!cmdLine.outFile.empty())
+ {
+ xe::writeBatchResultToFile(batchResult, cmdLine.outFile.c_str());
+ printf("Test log written to %s\n", cmdLine.outFile.c_str());
+ }
+
+ if (!cmdLine.infoFile.empty())
+ {
+ writeInfoLog(infoLog, cmdLine.infoFile.c_str());
+ printf("Info log written to %s\n", cmdLine.infoFile.c_str());
+ }
+
+ if (cmdLine.summary)
+ printBatchResultSummary(&root, testSet, batchResult);
+
+ throw;
+ }
if (!cmdLine.outFile.empty())
{
if (cmdLine.summary)
printBatchResultSummary(&root, testSet, batchResult);
+
+ {
+ string err;
+
+ if (commLink->getState(err) == xe::COMMLINKSTATE_ERROR)
+ throw xe::Error(err);
+ }
}
+} // anonymous
+
int main (int argc, const char* const* argv)
{
CommandLine cmdLine;
m_commLink->setCallbacks(DE_NULL, DE_NULL, DE_NULL, DE_NULL);
}
+void BatchExecutor::cancel (void)
+{
+ m_state = STATE_FINISHED;
+ m_dispatcher.cancel();
+}
+
void BatchExecutor::onStateChanged (CommLinkState state, const char* message)
{
switch (state)
}
}
-void BatchExecutor::onTestLogData (const deUint8* bytes, int numBytes)
+void BatchExecutor::onTestLogData (const deUint8* bytes, size_t numBytes)
{
try
{
}
}
-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);
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);
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);
writer.enqueue();
}
-void BatchExecutor::dispatchStateChanged (CallReader data)
+void BatchExecutor::dispatchStateChanged (CallReader& data)
{
BatchExecutor* executor = DE_NULL;
CommLinkState state = COMMLINKSTATE_LAST;
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;
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;
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
{
{
}
-void InfoLog::append (const deUint8* bytes, int numBytes)
+void InfoLog::append (const deUint8* bytes, size_t numBytes)
{
DE_ASSERT(numBytes > 0);
- int oldSize = (int)m_data.size();
+ const size_t oldSize = m_data.size();
m_data.resize(oldSize+numBytes);
deMemcpy(&m_data[oldSize], bytes, numBytes);
}
public:
InfoLog (void);
- int getSize (void) const { return (int)m_data.size(); }
+ size_t getSize (void) const { return m_data.size(); }
const deUint8* getBytes (void) const { return !m_data.empty() ? &m_data[0] : DE_NULL; }
- void append (const deUint8* bytes, int numBytes);
+ void append (const deUint8* bytes, size_t numBytes);
private:
InfoLog (const InfoLog& other);
// CallQueue
CallQueue::CallQueue (void)
- : m_callSem (0)
+ : m_canceled (false)
+ , m_callSem (0)
, m_callQueue (64)
{
}
delete *i;
}
+void CallQueue::cancel (void)
+{
+ m_canceled = true;
+ m_callSem.increment();
+}
+
void CallQueue::callNext (void)
{
Call* call = DE_NULL;
// Wait for a call.
m_callSem.decrement();
+ if (m_canceled)
+ return;
+
// Acquire call from buffer.
{
de::ScopedLock lock(m_lock);
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&)
{
}
-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());
return ptr;
}
+bool CallReader::isDataConsumed (void) const
+{
+ return m_curPos == m_call->getDataSize();
+}
+
CallReader& operator>> (CallReader& reader, std::string& value)
{
value.clear();
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);
}
class Call
{
public:
- typedef void (*Function) (CallReader data);
+ typedef void (*Function) (CallReader& data);
Call (void);
~Call (void);
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]; }
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
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:
Call* getEmptyCall (void);
void enqueue (Call* call);
void freeCall (Call* call);
+ void cancel (void);
private:
CallQueue (const CallQueue& other);
CallQueue& operator= (const CallQueue& other);
+ bool m_canceled;
de::Semaphore m_callSem;
de::Mutex m_lock;
{
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);
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)
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; }
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
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;
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;
while (!m_buffer.isCanceled())
{
- int numToSend = 0;
- int numSent = 0;
+ size_t numToSend = 0;
+ size_t numSent = 0;
deSocketResult result = DE_SOCKETRESULT_LAST;
try
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
{
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)
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);
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
}
}
-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)
{
{
closeConnection();
m_state.setState(COMMLINKSTATE_ERROR, e.what());
+ throw;
}
}
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;
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;
};
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);
void reset (void);
- void parse (const deUint8* bytes, int numBytes);
+ void parse (const deUint8* bytes, size_t numBytes);
private:
TestLogParser (const TestLogParser& other);
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 == '/')
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);
}
#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
*
// \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);
}
// 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");
}
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))
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)
{
{
{ "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[] =
{
<< 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")
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
{
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
};
//! 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;
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)
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);
}
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);
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);
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));
// \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);
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
{
{
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)");
}
}
}
-void unquantizeWeights (deUint32* dst, const ISEDecodedResult* weightGrid, const ASTCBlockMode& blockMode)
+void unquantizeWeights (deUint32 dst[64], const ISEDecodedResult* weightGrid, const ASTCBlockMode& blockMode)
{
const int numWeights = computeNumWeights(blockMode);
const ISEParams& iseParams = blockMode.weightISEParams;
for (int weightNdx = 0; weightNdx < numWeights; weightNdx++)
dst[weightNdx] += dst[weightNdx] > 32 ? 1 : 0;
+
+ // Initialize nonexistent weights to poison values
+ for (int weightNdx = numWeights; weightNdx < 64; weightNdx++)
+ dst[weightNdx] = ~0u;
+
}
void interpolateWeights (TexelWeightPair* dst, const deUint32* unquantizedWeights, int blockWidth, int blockHeight, const ASTCBlockMode& blockMode)
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;
-
- seed1 *= seed1; seed5 *= seed5; seed9 *= seed9;
- seed2 *= seed2; seed6 *= seed6; seed10 *= seed10;
- seed3 *= seed3; seed7 *= seed7; seed11 *= seed11;
- seed4 *= seed4; seed8 *= seed8; seed12 *= seed12;
+ 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 = (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;
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));
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;
}
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);
}
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); }
// 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);
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();
case NO: return no;
case YES: return yes;
case MAYBE: return no | yes;
- default: DE_ASSERT(!"Impossible case");
+ default: DE_FATAL("Impossible case");
}
return Interval();
{
// Hexadecimal value formatter.
-template <int NumDigits>
+template <size_t NumDigits>
class Hex
{
public:
deUint64 value;
};
-template <int NumDigits>
+template <size_t NumDigits>
std::ostream& operator<< (std::ostream& stream, tcu::Format::Hex<NumDigits> hex)
{
return hex.toStream(stream);
#define TCU_BIT_DESC(BIT) tcu::Format::BitDesc(BIT, #BIT)
-template <int BitfieldSize>
+template <size_t BitfieldSize>
class Bitfield
{
public:
const BitDesc* m_end;
};
-template <int BitfieldSize>
+template <size_t BitfieldSize>
inline std::ostream& operator<< (std::ostream& stream, Bitfield<BitfieldSize> decoder)
{
return decoder.toStream(stream);
// Enum formatter.
// \todo [2012-10-30 pyry] Use template for GetName.
-template <typename T, int NumBytes = sizeof(T)>
+template <typename T, size_t NumBytes = sizeof(T)>
class Enum
{
public:
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
if (name)
return std::string(name);
else
- return Hex<NumBytes*2>(m_value).toString();
+ return Hex<NumBytes*2>((deUint64)m_value).toString();
}
private:
const T m_value;
};
-template <typename T, int NumBytes>
+template <typename T, size_t NumBytes>
inline std::ostream& operator<< (std::ostream& stream, const Enum<T, NumBytes>& fmt) { return fmt.toStream(stream); }
// Array formatters.
template <typename T> inline deUint64 toUint64 (T value) { return (deUint64)value & makeMask64<sizeof(T)*8>(); }
/** Format value as hexadecimal number. */
-template <int NumDigits, typename T>
+template <size_t NumDigits, typename T>
inline Format::Hex<NumDigits> toHex (T value)
{
return Format::Hex<NumDigits>(toUint64(value));
namespace tcu
{
+enum
+{
+ MIN_ERR_THRESHOLD = 4 // Magic to make small differences go away
+};
+
using std::vector;
template<int Channel>
}
#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);
-
- float scale = 1.0f/(255-minErrThreshold);
- float sqSum = (float)(r*r + g*g + b*b + a*a) * (scale*scale);
+ 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);
- return deFloatSqrt(sqSum);
+ return deUint32(r*r + g*g + b*b + a*a);
}
template<int NumChannels>
}
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] =
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)
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)
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;
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));
{
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
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);
// the gap here too to keep the float enumeration continuous.
//
// Denormals occupy one exponent pattern. Removing one from
- // exponent should to the trick.
- return (deInt32)(f.bits() - (1u << 23u));
+ // exponent should to the trick. Add one since the removed range
+ // contained one representable value, 0.
+ return (deInt32)(f.bits() - (1u << 23u) + 1u);
}
}
}
{
deUint16 val;
resource->read((deUint8*)&val, sizeof(val));
- return ((val >> 8) & 0xFF) | ((val << 8) & 0xFF00);
+ return (deUint16)(((val >> 8) & 0xFF) | ((val << 8) & 0xFF00));
}
/*--------------------------------------------------------------------*//*!
#include "tcuRGBA.hpp"
#include "tcuVector.hpp"
+#include "tcuTextureUtil.hpp"
namespace tcu
{
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);
}
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)
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;
case QP_TEST_RESULT_RESOURCE_ERROR: return 110;
case QP_TEST_RESULT_INTERNAL_ERROR: return 120;
case QP_TEST_RESULT_CRASH: return 150;
- default: DE_ASSERT(!"Impossible case");
+ default: DE_FATAL("Impossible case");
}
return 0;
}
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
SeedBuilder& operator<< (SeedBuilder& builder, deUint8 value)
{
- const deInt8 val = value ^ 140u;
+ const deUint8 val = value ^ 140u;
builder.feed(sizeof(val), &val);
return builder;
#include "tcuTestHierarchyUtil.hpp"
#include "tcuStringTemplate.hpp"
+#include "tcuCommandLine.hpp"
+
#include "qpXmlWriter.h"
#include <fstream>
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* const node = iter.getNode();
- const TestNodeType nodeType = node->getNodeType();
- const bool isEnter = iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE;
+ 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");
+ }
- DE_ASSERT(iter.getState() == TestHierarchyIterator::STATE_ENTER_NODE ||
- iter.getState() == TestHierarchyIterator::STATE_LEAVE_NODE);
+ iter.next();
- if (nodeType == NODETYPE_PACKAGE)
+ 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);
+ {
+ if (isEnter)
{
- if (isEnter)
- {
- const string filename = makePackageFilename(filenamePattern, node->getName(), "xml");
- qpXmlAttribute attribs[2];
- int numAttribs = 0;
-
- DE_ASSERT(!curFile && !writer);
-
- 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;
- }
+ 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 (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();
+ }
+}
+
+/*--------------------------------------------------------------------*//*!
+ * \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();
- const char* pkgName = iter.getNode()->getName();
+ 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);
{
// \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
, 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
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;
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;
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());
{
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;
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;
{
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;
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;
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;
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
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++)
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++)
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);
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;
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++)
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++)
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++)
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++)
}
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,
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);
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)
#endif
}
+inline deUint8 readUint32Low8 (const deUint8* src)
+{
+#if (DE_ENDIANNESS == DE_LITTLE_ENDIAN)
+ const deUint32 uint32ByteOffsetBits0To8 = 0; //!< least significant byte in the lowest address
+#else
+ const deUint32 uint32ByteOffsetBits0To8 = 3; //!< least significant byte in the highest address
+#endif
+
+ return src[uint32ByteOffsetBits0To8];
+}
+
+inline void writeUint32Low8 (deUint8* dst, deUint8 val)
+{
+#if (DE_ENDIANNESS == DE_LITTLE_ENDIAN)
+ const deUint32 uint32ByteOffsetBits0To8 = 0; //!< least significant byte in the lowest address
+#else
+ const deUint32 uint32ByteOffsetBits0To8 = 3; //!< least significant byte in the highest address
+#endif
+
+ dst[uint32ByteOffsetBits0To8] = val;
+}
+
+inline deUint32 readUint32High24 (const deUint8* src)
+{
+#if (DE_ENDIANNESS == DE_LITTLE_ENDIAN)
+ const deUint32 uint32ByteOffset8To32 = 1;
+#else
+ const deUint32 uint32ByteOffset8To32 = 0;
+#endif
+
+ return readUint24(src + uint32ByteOffset8To32);
+}
+
+inline void writeUint32High24 (deUint8* dst, deUint32 val)
+{
+#if (DE_ENDIANNESS == DE_LITTLE_ENDIAN)
+ const deUint32 uint32ByteOffset8To32 = 1;
+#else
+ const deUint32 uint32ByteOffset8To32 = 0;
+#endif
+
+ writeUint24(dst + uint32ByteOffset8To32, val);
+}
+
// \todo [2011-09-21 pyry] Move to tcutil?
template <typename T>
inline T convertSatRte (float f)
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)
{
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;
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)
{
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;
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)
{
- if (m_format.order == TextureFormat::RGBA)
+ if (m_format.order == TextureFormat::RGBA || m_format.order == TextureFormat::sRGBA)
return readRGBA8888Float(pixelPtr);
- else if (m_format.order == TextureFormat::RGB)
+ else if (m_format.order == TextureFormat::RGB || m_format.order == TextureFormat::sRGB)
return readRGB888Float(pixelPtr);
}
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);
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.
if (m_format.type == TextureFormat::UNORM_INT8)
{
- if (m_format.order == TextureFormat::RGBA) return readRGBA8888Int(pixelPtr);
- else if (m_format.order == TextureFormat::RGB) return readRGB888Int(pixelPtr);
+ if (m_format.order == TextureFormat::RGBA || m_format.order == TextureFormat::sRGBA)
+ return readRGBA8888Int(pixelPtr);
+ else if (m_format.order == TextureFormat::RGB || m_format.order == TextureFormat::sRGB)
+ return readRGB888Int(pixelPtr);
}
#define U16(OFFS, COUNT) ((*((const deUint16*)pixelPtr) >> (OFFS)) & ((1<<(COUNT))-1))
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.
}
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();
-
-#define UB32(OFFS, COUNT) ((*((const deUint32*)pixelPtr) >> (OFFS)) & ((1<<(COUNT))-1))
-#define NB32(OFFS, COUNT) channelToNormFloat(UB32(OFFS, COUNT), (COUNT))
+ const deUint8* const pixelPtr = (const deUint8*)getPixelPtr(x, y, z);
DE_ASSERT(m_format.order == TextureFormat::DS || m_format.order == TextureFormat::D);
{
case TextureFormat::D:
case TextureFormat::DS: // \note Fall-through.
- return NB32(8, 24);
+ return (float)readUint32High24(pixelPtr) / 16777215.0f;
+
default:
DE_ASSERT(false);
return 0.0f;
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);
}
-
-#undef UB32
-#undef NB32
}
int ConstPixelBufferAccess::getPixStencil (int x, int y, int z) const
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)
{
case TextureFormat::UNSIGNED_INT_24_8:
switch (m_format.order)
{
- case TextureFormat::S: return (int)(*((const deUint32*)pixelPtr) >> 8);
- case TextureFormat::DS: return (int)(*((const deUint32*)pixelPtr) & 0xff);
+ case TextureFormat::S:
+ case TextureFormat::DS:
+ return (int)readUint32Low8(pixelPtr);
default:
DE_ASSERT(false);
case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
DE_ASSERT(m_format.order == TextureFormat::DS);
- return *((const deUint32*)(pixelPtr+4)) & 0xff;
+ return (int)readUint32Low8(pixelPtr + 4);
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);
}
}
}
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)
{
- if (m_format.order == TextureFormat::RGBA)
+ if (m_format.order == TextureFormat::RGBA || m_format.order == TextureFormat::sRGBA)
{
writeRGBA8888Float(pixelPtr, color);
return;
}
- else if (m_format.order == TextureFormat::RGB)
+ else if (m_format.order == TextureFormat::RGB || m_format.order == TextureFormat::sRGB)
{
writeRGB888Float(pixelPtr, color);
return;
*((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.
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)
{
- if (m_format.order == TextureFormat::RGBA) { writeRGBA8888Int(pixelPtr, color); return; }
- else if (m_format.order == TextureFormat::RGB) { writeRGB888Int(pixelPtr, color); return; }
+ if (m_format.order == TextureFormat::RGBA || m_format.order == TextureFormat::sRGBA)
+ {
+ writeRGBA8888Int(pixelPtr, color);
+ return;
+ }
+ else if (m_format.order == TextureFormat::RGB || m_format.order == TextureFormat::sRGB)
+ {
+ writeRGB888Int(pixelPtr, color);
+ return;
+ }
}
#define PU(VAL, OFFS, BITS) (uintToChannel((deUint32)(VAL), (BITS)) << (OFFS))
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.
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();
-
-#define PN(VAL, OFFS, BITS) (normFloatToChannel((VAL), (BITS)) << (OFFS))
+ deUint8* const pixelPtr = (deUint8*)getPixelPtr(x, y, z);
switch (m_format.type)
{
case TextureFormat::UNSIGNED_INT_24_8:
switch (m_format.order)
{
- case TextureFormat::D: *((deUint32*)pixelPtr) = PN(depth, 8, 24); break;
- case TextureFormat::DS: *((deUint32*)pixelPtr) = (*((deUint32*)pixelPtr) & 0x000000ff) | PN(depth, 8, 24); break;
+ case TextureFormat::D:
+ case TextureFormat::DS:
+ writeUint32High24(pixelPtr, convertSatRteUint24(depth * 16777215.0f));
+ break;
+
default:
DE_ASSERT(false);
}
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;
}
-
-#undef PN
}
void PixelBufferAccess::setPixStencil (int stencil, int x, int y, int z) const
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();
-
-#define PU(VAL, OFFS, BITS) (uintToChannel((deUint32)(VAL), (BITS)) << (OFFS))
+ deUint8* const pixelPtr = (deUint8*)getPixelPtr(x, y, z);
switch (m_format.type)
{
case TextureFormat::UNSIGNED_INT_24_8:
switch (m_format.order)
{
- case TextureFormat::S: *((deUint32*)pixelPtr) = PU(stencil, 8, 24); break;
- case TextureFormat::DS: *((deUint32*)pixelPtr) = (*((deUint32*)pixelPtr) & 0xffffff00) | PU(stencil, 0, 8); break;
+ case TextureFormat::S:
+ case TextureFormat::DS:
+ writeUint32Low8(pixelPtr, convertSat<deUint8>((deUint32)stencil));
+ break;
+
default:
DE_ASSERT(false);
}
case TextureFormat::FLOAT_UNSIGNED_INT_24_8_REV:
DE_ASSERT(m_format.order == TextureFormat::DS);
- *((deUint32*)(pixelPtr+4)) = PU((deUint32)stencil, 0, 8);
+ writeUint32Low8(pixelPtr + 4, convertSat<deUint8>((deUint32)stencil));
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;
}
-
-#undef PU
}
static inline int imod (int a, int b)
static bool isFixedPointDepthTextureFormat (const tcu::TextureFormat& format)
{
- const tcu::TextureChannelClass channelClass = tcu::getTextureChannelClass(format.type);
+ DE_ASSERT(format.order == TextureFormat::D);
- if (format.order == TextureFormat::D)
- {
- // depth internal formats cannot be non-normalized integers
- return channelClass != tcu::TEXTURECHANNELCLASS_FLOATING_POINT;
- }
- else if (format.order == TextureFormat::DS)
+ const tcu::TextureChannelClass channelClass = tcu::getTextureChannelClass(format.type);
+ if (channelClass == tcu::TEXTURECHANNELCLASS_FLOATING_POINT)
+ return false;
+ else if (channelClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT)
+ return true;
+ else
{
- // 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;
- }
- }
+ DE_ASSERT(false);
+ return false;
}
-
- return false;
}
// Texel lookup with color conversion.
~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]; }
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;
// For combined formats, treat D and S as separate channels
if (hasDepth)
- fillWithComponentGradients(getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_DEPTH), colorA, colorB);
+ fillWithGrid(getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_DEPTH), cellSize, colorA, colorB);
if (hasStencil)
- fillWithComponentGradients(getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_STENCIL), colorA.swizzle(3,2,1,0), colorB.swizzle(3,2,1,0));
+ fillWithGrid(getEffectiveDepthStencilAccess(access, tcu::Sampler::MODE_STENCIL), cellSize, colorA.swizzle(3,2,1,0), colorB.swizzle(3,2,1,0));
}
else
{
{
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);
}
}
m_thread.pushMessage(m_stream.str());
}
-Thread::Thread (int seed)
+Thread::Thread (deUint32 seed)
: m_random (seed)
, m_status (THREADSTATUS_NOT_STARTED)
{
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)
THREADSTATUS_FAILED,
THREADSTATUS_NOT_SUPPORTED
};
- Thread (int seed);
+ Thread (deUint32 seed);
~Thread (void);
virtual void init (void) {} //!< Called first before any Operation
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]); }
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;
#include "tcuDefs.hpp"
#include "tcuVector.hpp"
+#include "deMeta.hpp"
#include "deMath.h"
#include "deInt32.h"
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); }
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); }
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);
}
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);
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)
#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)
/* Assertion macro family. */
void deAssertFail(const char* reason, const char* file, int line);
+/* Assertion failure callback. Requires DE_ASSERT_FAILURE_CALLBACK to be defined or otherwise has no effect. */
+typedef void (*deAssertFailureCallbackFunc) (const char* reason, const char* file, int line);
+void deSetAssertFailureCallback (deAssertFailureCallbackFunc callback);
+
DE_INLINE deBool deGetFalse (void) { return DE_FALSE; }
DE_INLINE deBool deGetTrue (void) { return DE_TRUE; }
# define DE_ASSERT(X) /*@ -noeffect*/ ((void)0) /*!< Assertion macro. */
#endif
-/* Assertion failure callback. Requires DE_ASSERT_FAILURE_CALLBACK to be defined or otherwise has no effect. */
-typedef void (*deAssertFailureCallbackFunc) (const char* reason, const char* file, int line);
-void deSetAssertFailureCallback (deAssertFailureCallbackFunc callback);
-
/* Verify macro. Behaves like assert in debug build, but executes statement in release build. */
#if defined(DE_DEBUG)
# define DE_VERIFY(X) do { if ((!deGetFalse() && (X)) ? DE_FALSE : DE_TRUE) deAssertFail(#X, __FILE__, __LINE__); } while(deGetFalse())
# define DE_VERIFY(X) X
#endif
+/* Fatal macro. */
+#if defined(DE_DEBUG) && !defined(DE_COVERAGE_BUILD)
+# define DE_FATAL(MSG) do { deAssertFail("" /* force to string literal */ MSG, __FILE__, __LINE__); } while(deGetFalse())
+#else
+# define DE_FATAL(MSG) /*@ -noeffect*/ ((void)0) /*!< Fatal macro. */
+#endif
+
/** Test assert macro for use in testers (same as DE_ASSERT, but always enabled). */
#define DE_TEST_ASSERT(X) do { if ((!deGetFalse() && (X)) ? DE_FALSE : DE_TRUE) deAssertFail(#X, __FILE__, __LINE__); } while(deGetFalse())
-/** Compile-time assertion macro. */
#if (DE_COMPILER == DE_COMPILER_GCC)
/* GCC 4.8 and newer warns about unused typedefs. */
# define DE_UNUSED_TYPEDEF_ATTR __attribute__((unused))
#else
# define DE_UNUSED_TYPEDEF_ATTR
#endif
+
+/** Compile-time assertion macro. */
#define DE_STATIC_ASSERT(X) typedef char DE_UNIQUE_NAME[(X) ? 1 : -1] DE_UNUSED_TYPEDEF_ATTR
#define DE_HEADER_STATIC_ASSERT(HEADERTOKEN, X) typedef char DE_HEADER_UNIQUE_NAME(HEADERTOKEN)[(X) ? 1 : -1] DE_UNUSED_TYPEDEF_ATTR
#elif (DE_CPU == DE_CPU_ARM) && (DE_COMPILER == DE_COMPILER_MSC)
# define DE_BREAKPOINT() do { printf("Software breakpoint encountered in %s, line %d\n", __FILE__, __LINE__); DebugBreak(); } while (deGetFalse())
#else
-# define DE_BREAKPOINT() DE_ASSERT(!"Software breakpoint encountered!")
+# define DE_BREAKPOINT() DE_FATAL("Software breakpoint encountered!")
#endif
/** Swap two values. */
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)
{
}
/* 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;
}
}
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;
}
* \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);
}
/*--------------------------------------------------------------------*//*!
DE_INLINE int deLog2Floor32 (deInt32 a)
{
DE_ASSERT(a > 0);
- return 31 - deClz32(a);
+ return 31 - deClz32((deUint32)a);
}
/*--------------------------------------------------------------------*//*!
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. */
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);
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 */
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); }
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)
}
}
+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 */
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");
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);
/* 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. */
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);
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
* \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;
* \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)
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;
}
* \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);
}
/*--------------------------------------------------------------------*//*!
{
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);
#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);
* \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);
}
* \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);
}
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;
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;
}
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);
{
}
- 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;
{
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);
}
};
};
+template <typename A, typename B>
+struct TypesSame
+{
+ enum
+ {
+ Value = false
+ };
+};
+
+template <typename A>
+struct TypesSame<A, A>
+{
+ enum
+ {
+ Value = true
+ };
+};
+
} // meta
} // de
* 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:
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) {}
{
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);
}
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 (;;)
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
{
if (m_numEntered == 0)
break;
- if (mode == WAIT_MODE_YIELD)
- deYield();
+ wait(waitMode);
}
}
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
{
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())
{
}
}
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);
}
};
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();
}
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
* 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
};
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);
{
}
- 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
{
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);
}
case DE_IMAGEFORMAT_XRGB8888: return *(deARGB*)addr;
case DE_IMAGEFORMAT_ARGB8888: return *(deARGB*)addr;
default:
- DE_ASSERT(!"deImage_getPixel(): invalid format");
+ DE_FATAL("deImage_getPixel(): invalid format");
return deARGB_black();
}
}
case DE_IMAGEFORMAT_XRGB8888: *(deARGB*)addr = argb; break;
case DE_IMAGEFORMAT_ARGB8888: *(deARGB*)addr = argb; break;
default:
- DE_ASSERT(!"deImage_getPixel(): invalid format");
+ DE_FATAL("deImage_getPixel(): invalid format");
}
}
{
for (x = 0; x < dstWidth; x++)
{
- float xFloat = (float)(x + 0.5f) / (float)dstWidth * (float)srcImage->width - 0.5f;
- float yFloat = (float)(y + 0.5f) / (float)dstHeight * (float)srcImage->height - 0.5f;
+ float xFloat = ((float)x + 0.5f) / (float)dstWidth * (float)srcImage->width - 0.5f;
+ float yFloat = ((float)y + 0.5f) / (float)dstHeight * (float)srcImage->height - 0.5f;
int xFixed = deFloorFloatToInt32(xFloat * 256.0f);
int yFixed = deFloorFloatToInt32(yFloat * 256.0f);
int xFactor = (xFixed & 0xFF);
* \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;
}
/*--------------------------------------------------------------------*//*!
* \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)
#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);
}
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;
#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;
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;
}
}
* \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);
* \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);
* \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)
*//*--------------------------------------------------------------------*/
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);
*//*--------------------------------------------------------------------*/
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);
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);
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)
/* 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;
/* 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;
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; \
\
{ \
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)); \
\
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]; \
\
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); \
\
void TYPENAME##_intersectInplace (TYPENAME* a, const TYPENAME* b) \
{ \
- DE_ASSERT(!"Not implemented."); \
+ DE_FATAL("Not implemented."); \
} \
\
deBool TYPENAME##_sum (TYPENAME* to, const TYPENAME* a, const TYPENAME* b) \
\
void TYPENAME##_differenceInplace (TYPENAME* a, const TYPENAME* b) \
{ \
- DE_ASSERT(!"Not implemented."); \
+ DE_FATAL("Not implemented."); \
} \
\
struct TYPENAME##SetwiseImplementDummy_s { int dummy; }
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; \
\
{ \
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)); \
\
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]; \
\
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); \
void TYPENAME##_intersectInplace (TYPENAME* a, const TYPENAME* b) \
{ \
DE_UNREF(a && b); \
- DE_ASSERT(!"Not implemented."); \
+ DE_FATAL("Not implemented."); \
} \
\
deBool TYPENAME##_difference (TYPENAME* to, const TYPENAME* a, const TYPENAME* b) \
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)
builder->blockListTail = block;
- builder->length += len;
+ builder->length += (int)len;
return DE_TRUE;
}
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)
{
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);
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;
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;
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;
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(;;)
{
{
deThreadInStream* threadStream = (deThreadInStream*)arg;
- deUint8* buffer = malloc(sizeof(deUint8) * threadStream->bufferSize);
+ deUint8* buffer = malloc(sizeof(deUint8) * (size_t)threadStream->bufferSize);
for(;;)
{
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)
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);
deSemaphore_increment(buffer->fill);
- buffer->producerSum += val;
+ buffer->producerHash ^= val;
}
}
deSemaphore_increment(buffer->empty);
- buffer->consumerSum += val;
+ buffer->consumerHash ^= val;
if (val == 0)
break;
deSemaphore_destroy(testBuffer.empty);
deSemaphore_destroy(testBuffer.fill);
- DE_TEST_ASSERT(testBuffer.producerSum == testBuffer.consumerSum);
+ DE_TEST_ASSERT(testBuffer.producerHash == testBuffer.consumerHash);
}
}
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;
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;
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;
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;
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;
{
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);
deBool deFile_seek (deFile* file, deFilePosition base, deInt64 offset)
{
- return lseek(file->fd, offset, mapSeekPosition(base)) >= 0;
+ return lseek(file->fd, (off_t)offset, mapSeekPosition(base)) >= 0;
}
deInt64 deFile_getPosition (const deFile* file)
return -1;
size = lseek(file->fd, 0, SEEK_CUR);
- lseek(file->fd, curPos, SEEK_SET);
+ lseek(file->fd, (off_t)curPos, SEEK_SET);
return size;
}
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;
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;
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. */
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] == '/')
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));
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)");
/* Check status. */
{
char errBuf[256];
- int result = 0;
+ ssize_t result = 0;
close(statusPipe[1]);
while ((result = read(statusPipe[0], errBuf, 1)) == -1)
if (result > 0)
{
+ int procStatus = 0;
+
/* Read full error msg. */
int errPos = 1;
while (errPos < DE_LENGTH_OF_ARRAY(errBuf))
closePipe(pipeErr);
/* Run waitpid to clean up zombie. */
- waitpid(pid, &result, 0);
+ waitpid(pid, &procStatus, 0);
deProcess_setError(process, errBuf);
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]);
#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
/* Common socket functions. */
+static deUint16 deHostOrderShortToNetworkOrder (deUint16 v)
+{
+ /*
+ * On some platforms htons is defined as a macro which expands to something
+ * that evaluates to some other type than uint16_t (i.e. does not conform
+ * to POSIX-1-2001 or Winsock). Do a redundant uint16 conversion to work
+ * around conversion warnings on these platforms.
+ */
+ return (deUint16)htons(v);
+}
+
static int deSocketFamilyToBsdFamily (deSocketFamily family)
{
switch (family)
}
}
-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);
/* \note Always uses first address. */
- if (bsdAddrBufSize < (int)result->ai_addrlen)
+ if (bsdAddrBufSize < (size_t)result->ai_addrlen)
{
- DE_ASSERT(!"Too small bsdAddr buffer");
+ DE_FATAL("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);
+ ((struct sockaddr_in*)bsdAddr)->sin_port = deHostOrderShortToNetworkOrder((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);
+ ((struct sockaddr_in6*)bsdAddr)->sin6_port = deHostOrderShortToNetworkOrder((deUint16)address->port);
}
else
return DE_FALSE;
{
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");
+ DE_FATAL("Too small bsdAddr buffer");
return DE_FALSE;
}
- addr4->sin_port = htons((deUint16)address->port);
+ addr4->sin_port = deHostOrderShortToNetworkOrder((deUint16)address->port);
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;
}
{
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");
+ DE_FATAL("Too small bsdAddr buffer");
return DE_FALSE;
}
- addr6->sin6_port = htons((deUint16)address->port);
+ addr6->sin6_port = deHostOrderShortToNetworkOrder((deUint16)address->port);
addr6->sin6_family = AF_INET6;
- *bsdAddrLen = sizeof(struct sockaddr_in6);
+ *bsdAddrLen = (NativeSocklen)sizeof(struct sockaddr_in6);
return DE_TRUE;
}
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. */
}
/* Bind to address. */
- if (bind(sock->handle, bsdAddr, bsdAddrLen) != 0)
+ if (bind(sock->handle, bsdAddr, (NativeSocklen)bsdAddrLen) != 0)
{
deSocket_close(sock);
return DE_FALSE;
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;
{
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. */
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;
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)
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)
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. */
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);
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;
}
}
case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
case EGL_GL_TEXTURE_3D_KHR: return GL_TEXTURE_3D;
case EGL_GL_RENDERBUFFER_KHR: return GL_RENDERBUFFER;
- default: DE_ASSERT(!"Impossible"); return GL_NONE;
+ default: DE_FATAL("Impossible"); return GL_NONE;
}
}
case 1: return EGL_OPENGL_ES_BIT;
case 2: return EGL_OPENGL_ES2_BIT;
case 3: return EGL_OPENGL_ES3_BIT_KHR;
- default: DE_ASSERT(!"Unknown OpenGL ES version");
+ default: DE_FATAL("Unknown OpenGL ES version");
}
default:
- DE_ASSERT(!"Unknown GL API");
+ DE_FATAL("Unknown GL API");
}
return 0;
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;
#define EGL_SYNC_CL_EVENT 0x30FE
#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
+#define EGL_BUFFER_AGE_KHR 0x313D
+#define EGL_BUFFER_AGE_EXT 0x313D
#define EGL_NATIVE_BUFFER_ANDROID 0x3140
#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
EGLBoolean querySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) const;
EGLBoolean releaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer) const;
EGLBoolean releaseThread (void) const;
+EGLBoolean setDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) const;
EGLBoolean signalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) const;
EGLBoolean surfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) const;
EGLBoolean swapBuffers (EGLDisplay dpy, EGLSurface surface) const;
+EGLBoolean swapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) const;
EGLBoolean swapInterval (EGLDisplay dpy, EGLint interval) const;
EGLBoolean terminate (EGLDisplay dpy) const;
EGLBoolean unlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface) const;
return m_egl.releaseThread();
}
+EGLBoolean FuncPtrLibrary::setDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) const
+{
+ return m_egl.setDamageRegionKHR(dpy, surface, rects, n_rects);
+}
+
EGLBoolean FuncPtrLibrary::signalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) const
{
return m_egl.signalSyncKHR(dpy, sync, mode);
return m_egl.swapBuffers(dpy, surface);
}
+EGLBoolean FuncPtrLibrary::swapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) const
+{
+ return m_egl.swapBuffersWithDamageKHR(dpy, surface, rects, n_rects);
+}
+
EGLBoolean FuncPtrLibrary::swapInterval (EGLDisplay dpy, EGLint interval) const
{
return m_egl.swapInterval(dpy, interval);
typedef EGLW_APICALL EGLBoolean (EGLW_APIENTRY* eglQuerySurfaceFunc) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
typedef EGLW_APICALL EGLBoolean (EGLW_APIENTRY* eglReleaseTexImageFunc) (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
typedef EGLW_APICALL EGLBoolean (EGLW_APIENTRY* eglReleaseThreadFunc) (void);
+typedef EGLW_APICALL EGLBoolean (EGLW_APIENTRY* eglSetDamageRegionKHRFunc) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
typedef EGLW_APICALL EGLBoolean (EGLW_APIENTRY* eglSignalSyncKHRFunc) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
typedef EGLW_APICALL EGLBoolean (EGLW_APIENTRY* eglSurfaceAttribFunc) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
typedef EGLW_APICALL EGLBoolean (EGLW_APIENTRY* eglSwapBuffersFunc) (EGLDisplay dpy, EGLSurface surface);
+typedef EGLW_APICALL EGLBoolean (EGLW_APIENTRY* eglSwapBuffersWithDamageKHRFunc) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
typedef EGLW_APICALL EGLBoolean (EGLW_APIENTRY* eglSwapIntervalFunc) (EGLDisplay dpy, EGLint interval);
typedef EGLW_APICALL EGLBoolean (EGLW_APIENTRY* eglTerminateFunc) (EGLDisplay dpy);
typedef EGLW_APICALL EGLBoolean (EGLW_APIENTRY* eglUnlockSurfaceKHRFunc) (EGLDisplay dpy, EGLSurface surface);
eglQuerySurfaceFunc querySurface;
eglReleaseTexImageFunc releaseTexImage;
eglReleaseThreadFunc releaseThread;
+eglSetDamageRegionKHRFunc setDamageRegionKHR;
eglSignalSyncKHRFunc signalSyncKHR;
eglSurfaceAttribFunc surfaceAttrib;
eglSwapBuffersFunc swapBuffers;
+eglSwapBuffersWithDamageKHRFunc swapBuffersWithDamageKHR;
eglSwapIntervalFunc swapInterval;
eglTerminateFunc terminate;
eglUnlockSurfaceKHRFunc unlockSurfaceKHR;
dst->getPlatformDisplayEXT = (eglGetPlatformDisplayEXTFunc) loader->get("eglGetPlatformDisplayEXT");
dst->getSyncAttribKHR = (eglGetSyncAttribKHRFunc) loader->get("eglGetSyncAttribKHR");
dst->lockSurfaceKHR = (eglLockSurfaceKHRFunc) loader->get("eglLockSurfaceKHR");
+dst->setDamageRegionKHR = (eglSetDamageRegionKHRFunc) loader->get("eglSetDamageRegionKHR");
dst->signalSyncKHR = (eglSignalSyncKHRFunc) loader->get("eglSignalSyncKHR");
+dst->swapBuffersWithDamageKHR = (eglSwapBuffersWithDamageKHRFunc) loader->get("eglSwapBuffersWithDamageKHR");
dst->unlockSurfaceKHR = (eglUnlockSurfaceKHRFunc) loader->get("eglUnlockSurfaceKHR");
dst->waitSyncKHR = (eglWaitSyncKHRFunc) loader->get("eglWaitSyncKHR");
virtual EGLBoolean querySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) const = 0;
virtual EGLBoolean releaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer) const = 0;
virtual EGLBoolean releaseThread (void) const = 0;
+virtual EGLBoolean setDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) const = 0;
virtual EGLBoolean signalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) const = 0;
virtual EGLBoolean surfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) const = 0;
virtual EGLBoolean swapBuffers (EGLDisplay dpy, EGLSurface surface) const = 0;
+virtual EGLBoolean swapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) const = 0;
virtual EGLBoolean swapInterval (EGLDisplay dpy, EGLint interval) const = 0;
virtual EGLBoolean terminate (EGLDisplay dpy) const = 0;
virtual EGLBoolean unlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface) const = 0;
else if (isDataTypeMatrix(dataType))
return getDataTypeMatrixNumColumns(dataType);
- DE_ASSERT(!"Illegal datatype.");
+ DE_FATAL("Illegal datatype.");
return 0;
}
else if (isDataTypeMatrix(dataType))
return getDataTypeMatrixNumRows(dataType);
- DE_ASSERT(!"Illegal datatype.");
+ DE_FATAL("Illegal datatype.");
return 0;
}
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;
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)
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)
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)
{
}
}
- DE_ASSERT(!"invalid delete");
+ DE_FATAL("invalid delete");
}
void GLContext::useProgram (deUint32 program)
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);
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);
}
}
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);
}
}
-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);
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));
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];
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];
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.
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];
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>(),
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];
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);
if (m_uniforms[ndx].name == std::string(name))
return m_uniforms[ndx];
- DE_ASSERT(!"Invalid uniform name, uniform not found.");
+ DE_FATAL("Invalid uniform name, uniform not found.");
return m_uniforms[0];
}
profileMask = GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
break;
default:
- DE_ASSERT(!"Impossible context profile");
+ DE_FATAL("Impossible context profile");
}
const int attribs[] =
case RenderConfig::SURFACETYPE_DONT_CARE:
return GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
default:
- DE_ASSERT(!"Impossible case");
+ DE_FATAL("Impossible case");
}
return 0;
}
switch (surfaceType)
{
case RenderConfig::SURFACETYPE_DONT_CARE:
- DE_ASSERT(!"Impossible case");
+ DE_FATAL("Impossible case");
case RenderConfig::SURFACETYPE_WINDOW:
return new GlxWindow(visual, config);
else if (m_state == STATE_PENDING_DESTROY)
m_state = STATE_READY_FOR_DESTROY;
else
- DE_ASSERT(!"Invalid window state");
+ DE_FATAL("Invalid window state");
}
void Window::markForDestroy (void)
else if (m_state == STATE_IN_USE)
m_state = STATE_PENDING_DESTROY;
else
- DE_ASSERT(!"Invalid window state");
+ DE_FATAL("Invalid window state");
}
bool Window::isPendingDestroy (void) const
else
{
print("ERROR: Window was not available for deletion, leaked tcu::Android::Window!\n");
- DE_ASSERT(!"Window leaked");
+ DE_FATAL("Window leaked");
}
}
}
virtual glu::ContextType getType (void) const { return m_type; }
virtual const glw::Functions& getFunctions (void) const { return m_functions; }
virtual const RenderTarget& getRenderTarget (void) const { return m_emptyTarget; }
- virtual deUint32 getDefaultFramebuffer (void) const { DE_ASSERT(!"No framebuffer"); return 0; }
+ virtual deUint32 getDefaultFramebuffer (void) const { DE_FATAL("No framebuffer"); return 0; }
virtual void postIterate (void);
protected:
--- /dev/null
+/*-------------------------------------------------------------------------
+ * 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
--- /dev/null
+#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
*//*--------------------------------------------------------------------*/
#include "tcuNullPlatform.hpp"
+#include "tcuNullContextFactory.hpp"
#include "tcuNullRenderContext.hpp"
#include "egluNativeDisplay.hpp"
#include "eglwLibrary.hpp"
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:
string shadingLanguageVersion;
string extensions;
vector<string> extensionList;
+ vector<deUint32> compressedTextureList;
GLenum lastError;
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");
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)
{
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)
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;
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:
}
}
+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();
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"
}
-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);
}
-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);
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);
}
typedef struct Buffer_s
{
- int capacity;
- int size;
+ size_t capacity;
+ size_t size;
deUint8* data;
} Buffer;
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;
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;
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!");
}
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,
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;
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));
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
{
}
}
- writeDataBytes = packedStride*height;
+ writeDataBytes = (size_t)(packedStride*height);
break;
}
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] =
{
};
int numWritten = 0;
- int srcNdx = 0;
+ size_t srcNdx = 0;
deBool writeIndent = DE_TRUE;
const char* indentStr = getIndentStr(writer->xmlElementDepth);
/* 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;
* \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
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;
}
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?
if (m_child)
return DE_NULL;
- m_child = Expression::createRandom(state, m_inValueRange);
+ m_child = Expression::createRandom(state, m_inValueRange.asAccess());
return m_child;
}
}
default:
- DE_ASSERT(!"Unsupported");
+ DE_FATAL("Unsupported");
break;
}
}
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;
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++)
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;
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));
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;
// \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);
}
}
}
// - 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
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);
}
ValueRange newVarRange(computeRandomType(state, maxScalars));
computeRandomValueRange(state, newVarRange.asAccess());
- m_variable = allocateNewVariable(state, newVarRange);
+ m_variable = allocateNewVariable(state, newVarRange.asAccess());
}
else
{
// 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());
}
}
}
ValueRange infRange(m_variable->getType());
setInfiniteRange(infRange);
- state.getVariableManager().setValue(m_variable, infRange);
+ state.getVariableManager().setValue(m_variable, infRange.asAccess());
}
}
{
if (m_child == DE_NULL)
{
- m_child = Expression::createRandom(state, m_valueRange);
+ m_child = Expression::createRandom(state, m_valueRange.asAccess());
return m_child;
}
else
// Create child.
state.pushPrecedence(swizzlePrecedence);
- m_child = Expression::createRandom(state, inValueRange);
+ m_child = Expression::createRandom(state, inValueRange.asAccess());
state.popPrecedence();
return m_child;
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;
}
}
}
- m_coordExpr = Expression::createRandom(state, coordRange);
+ m_coordExpr = Expression::createRandom(state, coordRange.asAccess());
}
else
{
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);
texOutputRange.getMax().component(ndx) = 1.0f;
}
- if (!valueRange.isSupersetOf(texOutputRange))
+ if (!valueRange.isSupersetOf(texOutputRange.asAccess()))
return 0.0f;
return state.getShaderParameters().texLookupBaseWeight;
// 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()));
}
}
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));
}
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());
}
}
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);
}
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;
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)
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));
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.
}
}
+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;
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);
if (++m_numEmitted > m_maxVertices)
{
- DE_ASSERT(!"Undefined results, too many vertices emitted.");
+ DE_FATAL("Undefined results, too many vertices emitted.");
return;
}
//! 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));
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;
}
// 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);
}
}
}
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);
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;
}
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;
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);
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
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];
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)
} // 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)
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());
+
+ int getNumSamples (void) const;
- MultisamplePixelBufferAccess colorBuffers[MAX_COLOR_BUFFERS];
- const int numColorBuffers;
- const MultisamplePixelBufferAccess depthBuffer;
- const MultisamplePixelBufferAccess stencilBuffer;
+ 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
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)
deUint32 aligned;
deMemcpy(&aligned, ptr, sizeof(deUint32));
- dst[Order::T0] = (float(extendSign<10>((aligned >> 0) & ((1 << 10) - 1)) * 2.0f + 1.0f) / float(range10));
- if (size >= 2) dst[Order::T1] = (float(extendSign<10>((aligned >> 10) & ((1 << 10) - 1)) * 2.0f + 1.0f) / float(range10));
- if (size >= 3) dst[Order::T2] = (float(extendSign<10>((aligned >> 20) & ((1 << 10) - 1)) * 2.0f + 1.0f) / float(range10));
- if (size >= 4) dst[Order::T3] = (float(extendSign< 2>((aligned >> 30) & ((1 << 2) - 1)) * 2.0f + 1.0f) / float(range2));
+ dst[Order::T0] = (float(extendSign<10>((aligned >> 0) & ((1 << 10) - 1))) * 2.0f + 1.0f) / float(range10);
+ if (size >= 2) dst[Order::T1] = (float(extendSign<10>((aligned >> 10) & ((1 << 10) - 1))) * 2.0f + 1.0f) / float(range10);
+ if (size >= 3) dst[Order::T2] = (float(extendSign<10>((aligned >> 20) & ((1 << 10) - 1))) * 2.0f + 1.0f) / float(range10);
+ if (size >= 4) dst[Order::T3] = (float(extendSign< 2>((aligned >> 30) & ((1 << 2) - 1))) * 2.0f + 1.0f) / float(range2);
}
// ordered readers
case VERTEXATTRIBTYPE_PURE_INT8:
case VERTEXATTRIBTYPE_PURE_INT16:
case VERTEXATTRIBTYPE_PURE_INT32:
- DE_ASSERT(!"Invalid read");
+ DE_FATAL("Invalid read");
default:
DE_ASSERT(false);
case VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV_BGRA:
case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP_BGRA:
case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE_BGRA:
- DE_ASSERT(!"Invalid read");
+ DE_FATAL("Invalid read");
default:
DE_ASSERT(false);
case VERTEXATTRIBTYPE_NONPURE_UNORM_2_10_10_10_REV_BGRA:
case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_CLAMP_BGRA:
case VERTEXATTRIBTYPE_NONPURE_SNORM_2_10_10_10_REV_SCALE_BGRA:
- DE_ASSERT(!"Invalid read");
+ DE_FATAL("Invalid read");
default:
DE_ASSERT(false);
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;
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;
{
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);
}
}
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)
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;
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;
-
- 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);
+ 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((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++)
{
{
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);
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]);
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]);
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;
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));
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];
}
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()));
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];
}
case EGL_NATIVE_BUFFER_ANDROID:
return createAndroidNativeImageSource(format);
default:
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
return MovePtr<ImageSource>();
}
}
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;
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;
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;
initializeColorRbo(gl, rbo, *ref);
break;
default:
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
}
gl.bindFramebuffer(GL_FRAMEBUFFER, 0);
}
// 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++)
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++)
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());
}
}
}
else
{
- float change = (min - max) / ((float)(max));
+ float change = (float)(min - max) / ((float)(max));
if (change > threshold)
{
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());
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);
}
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);
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);
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)
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;
};
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;
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);
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" : "")) +
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)))
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;
// 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
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);
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);
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[] =
{
// 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++)
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;
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;
break;
case GL_TEXTURE_CUBE_MAP:
- DE_ASSERT(!"TODO");
+ DE_FATAL("TODO");
break;
case GL_RENDERBUFFER:
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)
{
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;
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;
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),
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),
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),
};
- 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.");
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());
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] =
{
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] =
// 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++)
{
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);
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);
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))
{
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;
else if (dataType == TYPE_FLOAT_VEC3) return evalArrayCoordsVec3;
else if (dataType == TYPE_FLOAT_VEC4) return evalArrayCoordsVec4;
- DE_ASSERT(!"Invalid data type.");
+ DE_FATAL("Invalid data type.");
return NULL;
}
else if (dataType == TYPE_FLOAT_VEC3) return evalArrayUniformVec3;
else if (dataType == TYPE_FLOAT_VEC4) return evalArrayUniformVec4;
- DE_ASSERT(!"Invalid data type.");
+ DE_FATAL("Invalid data type.");
return NULL;
}
else if (dataType == TYPE_FLOAT_VEC3) return evalSubscriptVec3;
else if (dataType == TYPE_FLOAT_VEC4) return evalSubscriptVec4;
- DE_ASSERT(!"Invalid data type.");
+ DE_FATAL("Invalid data type.");
return NULL;
}
else if (dataType == TYPE_FLOAT_MAT3) return evalSubscriptMat3;
else if (dataType == TYPE_FLOAT_MAT4) return evalSubscriptMat4;
- DE_ASSERT(!"Invalid data type.");
+ DE_FATAL("Invalid data type.");
return NULL;
}
case 3: return evalLoop3Iters;
}
- DE_ASSERT(!"Invalid loop iteration count.");
+ DE_FATAL("Invalid loop iteration count.");
return NULL;
}
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)
// 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++"
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)); }
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);
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.
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);
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);
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);
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));
}
}
}
{
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));
}
}
}
{
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));
}
}
}
{
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);
}
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);
{
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);
}
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);
}
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());
static string getShaderInfoLog (const glw::Functions& gl, deUint32 shader)
{
string result;
- int infoLogLen;
+ int infoLogLen = 0;
vector<char> infoLogBuf;
gl.getShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLen);
static string getProgramInfoLog (const glw::Functions& gl, deUint32 program)
{
string result;
- int infoLogLen;
+ int infoLogLen = 0;
vector<char> infoLogBuf;
gl.getProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLen);
bool ShaderCompilerCase::compileShader (deUint32 shader) const
{
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
- GLint status;
+ GLint status = 0;
gl.compileShader(shader);
gl.getShaderiv(shader, GL_COMPILE_STATUS, &status);
return status != 0;
bool ShaderCompilerCase::linkAndUseProgram (deUint32 program) const
{
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
- GLint linkStatus;
+ GLint linkStatus = 0;
gl.linkProgram(program);
gl.getProgramiv(program, GL_LINK_STATUS, &linkStatus);
// 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.
// 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.
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();
{
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;
{
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;
{
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;
{
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
{
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
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);
}
IterateResult iterate (void)
{
- GLint value;
+ GLint value = 0;
GLU_CHECK_CALL(glGetIntegerv(m_param, &value));
m_testCtx.getLog() << TestLog::Message << glu::getParamQueryStr(m_param) << " = " << value << TestLog::EndMessage;
{
// 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
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)
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;
};
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" : "")) +
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)))
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;
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);
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[] =
{
// 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++)
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;
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;
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),
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)
tcu::Surface error (image.getWidth(), image.getHeight());
bool isOk = true;
- for (int y = 1; y < image.getHeight()-1; y++)
- for (int x = 1; x < image.getWidth()-1; x++)
+ for (int y = 0; y < image.getHeight(); y++)
+ for (int x = 0; x < image.getWidth(); x++)
{
- const tcu::RGBA pixel = image.getPixel(x, y);
- bool pixelOk = true;
+ if (x == 0 || y == 0 || y + 1 == image.getHeight() || x + 1 == image.getWidth())
+ {
+ // Background color might bleed in at the borders with msaa
+ error.setPixel(x, y, tcu::RGBA(0, 255, 0, 255));
+ }
+ else
+ {
+ const tcu::RGBA pixel = image.getPixel(x, y);
+ bool pixelOk = true;
- // Any pixel with !(G ~= 255) is faulty (not a linear combinations of green and yellow)
- if (de::abs(pixel.getGreen() - 255) > colorThreshold)
- pixelOk = false;
+ // Any pixel with !(G ~= 255) is faulty (not a linear combinations of green and yellow)
+ if (de::abs(pixel.getGreen() - 255) > colorThreshold)
+ pixelOk = false;
- // Any pixel with !(B ~= 0) is faulty (not a linear combinations of green and yellow)
- if (de::abs(pixel.getBlue() - 0) > colorThreshold)
- pixelOk = false;
+ // Any pixel with !(B ~= 0) is faulty (not a linear combinations of green and yellow)
+ if (de::abs(pixel.getBlue() - 0) > colorThreshold)
+ pixelOk = false;
- error.setPixel(x, y, (pixelOk) ? (tcu::RGBA(0, 255, 0, 255)) : (tcu::RGBA(255, 0, 0, 255)));
- isOk = isOk && pixelOk;
+ error.setPixel(x, y, (pixelOk) ? (tcu::RGBA(0, 255, 0, 255)) : (tcu::RGBA(255, 0, 0, 255)));
+ isOk = isOk && pixelOk;
+ }
}
if (!isOk)
texCfg = &builder.makeConfig<Texture2DArray>();
break;
default:
- DE_ASSERT(!"Impossible case");
+ DE_FATAL("Impossible case");
}
texCfg->internalFormat = getDefaultFormat(target, GL_TEXTURE);
texCfg->width = 64;
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;
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;
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);
return 0;
default:
- DE_ASSERT(!"Unknown format");
+ DE_FATAL("Unknown format");
return 0;
}
}
return glu::TYPE_INT_VEC4;
default:
- DE_ASSERT(!"Unknown format");
+ DE_FATAL("Unknown format");
return glu::TYPE_LAST;
}
}
return tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::SIGNED_INT32);
default:
- DE_ASSERT(!"Unknown format");
+ DE_FATAL("Unknown format");
return tcu::TextureFormat();
}
}
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)
{
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] ||
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] ||
// 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
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);
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];
}
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
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);
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.
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),
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),
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),
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);
});
}
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);
}
}
};
- 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.");
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());
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);
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] =
{
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] =
// 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++)
{
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);
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);
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))
{
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;
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)
{
// * 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;
else if (dataType == TYPE_FLOAT_VEC3) return evalArrayCoordsVec3;
else if (dataType == TYPE_FLOAT_VEC4) return evalArrayCoordsVec4;
- DE_ASSERT(!"Invalid data type.");
+ DE_FATAL("Invalid data type.");
return NULL;
}
else if (dataType == TYPE_FLOAT_VEC3) return evalArrayUniformVec3;
else if (dataType == TYPE_FLOAT_VEC4) return evalArrayUniformVec4;
- DE_ASSERT(!"Invalid data type.");
+ DE_FATAL("Invalid data type.");
return NULL;
}
else if (dataType == TYPE_FLOAT_VEC3) return evalSubscriptVec3;
else if (dataType == TYPE_FLOAT_VEC4) return evalSubscriptVec4;
- DE_ASSERT(!"Invalid data type.");
+ DE_FATAL("Invalid data type.");
return NULL;
}
case TYPE_FLOAT_MAT4: return evalSubscriptMat4;
default:
- DE_ASSERT(!"Invalid data type.");
+ DE_FATAL("Invalid data type.");
return DE_NULL;
}
}
case 3: return evalLoop3Iters;
}
- DE_ASSERT(!"Invalid loop iteration count.");
+ DE_FATAL("Invalid loop iteration count.");
return NULL;
}
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)
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;
// 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++"
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)); }
<< BuiltinFuncInfo("tanh", "tanh", GT, Value(GT, -1.5f, 5.5f), notUsed, notUsed, 0.5f, 0.5f, PRECMASK_LOWP, FLOAT_GENTYPE_FUNCS(tanh) )
<< BuiltinFuncInfo("asinh", "asinh", GT, Value(GT, -1.0f, 1.0f), notUsed, notUsed, 1.0f, 0.0f, PRECMASK_MEDIUMP_HIGHP, FLOAT_GENTYPE_FUNCS(asinh) )
<< BuiltinFuncInfo("acosh", "acosh", GT, Value(GT, 1.0f, 2.2f), notUsed, notUsed, 1.0f, 0.0f, PRECMASK_MEDIUMP_HIGHP, FLOAT_GENTYPE_FUNCS(acosh) )
- << BuiltinFuncInfo("atanh", "atanh", GT, Value(GT, -1.0f, 1.0f), notUsed, notUsed, 1.0f, 0.0f, PRECMASK_MEDIUMP_HIGHP, FLOAT_GENTYPE_FUNCS(atanh) )
+ << BuiltinFuncInfo("atanh", "atanh", GT, Value(GT, -0.99f, 0.99f), notUsed, notUsed, 1.0f, 0.0f, PRECMASK_MEDIUMP_HIGHP, FLOAT_GENTYPE_FUNCS(atanh) )
);
// 8.2 Exponential Functions.
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);
}
{
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 < 64 ? refBits >> (deUint64)maskBits : 0u;
+ const deUint64 accurateResBits = maskBits < 64 ? resBits >> (deUint64)maskBits : 0u;
const deUint64 ulpDiff = (deUint64)de::abs((deInt64)accurateRefBits - (deInt64)accurateResBits);
if (ulpDiff > (deUint64)roundingUlpError)
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.
// 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)
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);
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.
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);
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);
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);
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.
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);
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.
void createTexture (void)
{
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(m_format, m_dataType));
de::Random rnd (deStringHash(getName()));
glGenTextures(1, &tex);
void createTexture (void)
{
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(m_format, m_dataType));
de::Random rnd (deStringHash(getName()));
glGenTextures(1, &tex);
void createTexture (void)
{
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
de::Random rnd (deStringHash(getName()));
glu::TransferFormat transferFmt = glu::getTransferFormat(m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
void createTexture (void)
{
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
de::Random rnd (deStringHash(getName()));
glu::TransferFormat transferFmt = glu::getTransferFormat(m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_3D, tex);
void createTexture (void)
{
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(m_format, m_dataType));
de::Random rnd (deStringHash(getName()));
glGenTextures(1, &tex);
void createTexture (void)
{
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(m_format, m_dataType));
de::Random rnd (deStringHash(getName()));
glGenTextures(1, &tex);
tcu::TextureFormat fmt = glu::mapGLInternalFormat(m_internalFormat);
glu::TransferFormat transferFmt = glu::getTransferFormat(fmt);
deUint32 tex = 0;
- tcu::TextureLevel levelData (fmt);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
de::Random rnd (deStringHash(getName()));
glGenTextures(1, &tex);
tcu::TextureFormat fmt = glu::mapGLInternalFormat(m_internalFormat);
glu::TransferFormat transferFmt = glu::getTransferFormat(fmt);
deUint32 tex = 0;
- tcu::TextureLevel levelData (fmt);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
de::Random rnd (deStringHash(getName()));
glGenTextures(1, &tex);
void createTexture (void)
{
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
de::Random rnd (deStringHash(getName()));
glu::TransferFormat transferFmt = glu::getTransferFormat(m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
glGenTextures (1, &tex);
glBindTexture (GL_TEXTURE_2D_ARRAY, tex);
void createTexture (void)
{
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
de::Random rnd (deStringHash(getName()));
glu::TransferFormat transferFmt = glu::getTransferFormat(m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
glGenTextures (1, &tex);
glBindTexture (GL_TEXTURE_3D, tex);
{
glu::TransferFormat fmt = glu::getTransferFormat(m_texFormat);
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(fmt.format, fmt.dataType));
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
{
glu::TransferFormat fmt = glu::getTransferFormat(m_texFormat);
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(fmt.format, fmt.dataType));
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
glu::TransferFormat fmt = glu::getTransferFormat(m_texFormat);
de::Random rnd (deStringHash(getName()));
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(fmt.format, fmt.dataType));
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glu::TransferFormat fmt = glu::getTransferFormat(m_texFormat);
de::Random rnd (deStringHash(getName()));
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(fmt.format, fmt.dataType));
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
// 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.
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);
}
}
}
}
}
- accumulatedSize += output.type.getScalarSize()*sizeof(deUint32);
+ accumulatedSize += output.type.getScalarSize()*(int)sizeof(deUint32);
}
}
if (!isOk)
break;
- outOffset += numComponents*sizeof(deUint32);
+ outOffset += numComponents*(int)sizeof(deUint32);
}
return isOk;
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);
}
{
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;
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;
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;
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;
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;
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);
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);
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);
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"
{
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;
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;
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;
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;
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;
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;
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);
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);
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:
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"
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);
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));
}
}
}
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();
}
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();
DE_ASSERT(position >= 0.0f);
DE_ASSERT(position <= 1.0f);
- const float floatNdx = ((int)values.size() - 1) * position;
+ const float floatNdx = (float)(values.size() - 1) * position;
const int lowerNdx = (int)deFloatFloor(floatNdx);
const int higherNdx = lowerNdx + 1;
const float interpolationFactor = floatNdx - (float)lowerNdx;
for (int ndx = 0; ndx < (int)samples.size(); ++ndx)
{
- const float timeInSeconds = values[ndx] / 1000.0f / 1000.0f;
- processingRates[ndx] = samples[ndx].*predictor / timeInSeconds;
+ const float timeInSeconds = (float)values[ndx] / 1000.0f / 1000.0f;
+ processingRates[ndx] = (float)(samples[ndx].*predictor) / timeInSeconds;
}
std::sort(processingRates.begin(), processingRates.end());
for (int ndx = 0; ndx < (int)samples.size(); ++ndx)
{
- const float prediction = samples[ndx].*predictor * fit.coefficient + fit.offset;
+ const float prediction = (float)(samples[ndx].*predictor) * fit.coefficient + fit.offset;
const float actual = (float)values[ndx];
timeDiffs[ndx] = actual - prediction;
}
for (int ndx = 0; ndx < (int)samples.size(); ++ndx)
{
- const float prediction = samples[ndx].*predictor * fit.coefficient + fit.offset;
+ const float prediction = (float)(samples[ndx].*predictor) * fit.coefficient + fit.offset;
const float actual = (float)values[ndx];
// Ignore cases where we predict negative times, or if
for (int sampleNdx = 0; sampleNdx < (int)samples.size(); ++sampleNdx)
{
- const float bucketNdxFloat = (samples[sampleNdx].allocatedSize - minBufferSize) / (float)(maxBufferSize - minBufferSize) * numBuckets;
+ const float bucketNdxFloat = (float)(samples[sampleNdx].allocatedSize - minBufferSize) / (float)(maxBufferSize - minBufferSize) * (float)numBuckets;
const int bucketNdx = de::clamp((int)deFloatFloor(bucketNdxFloat), 0, numBuckets-1);
buckets[bucketNdx].push_back(samples[sampleNdx]);
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
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
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
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
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
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
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
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
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
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
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;
// Print a nice result summary
- const int bucketRangeMin = minBufferSize + (int)(( bucketNdx / (float)numBuckets) * (maxBufferSize - minBufferSize));
- const int bucketRangeMax = minBufferSize + (int)(((bucketNdx+1) / (float)numBuckets) * (maxBufferSize - minBufferSize));
+ const int bucketRangeMin = minBufferSize + (int)(((float) bucketNdx / (float)numBuckets) * (float)(maxBufferSize - minBufferSize));
+ const int bucketRangeMax = minBufferSize + (int)(((float)(bucketNdx+1) / (float)numBuckets) * (float)(maxBufferSize - minBufferSize));
const typename SampleTypeTraits<SampleType>::StatsType stats = calculateSampleStatistics(theilSenFitting, buckets[bucketNdx]);
const tcu::ScopedLogSection section (log, "BufferSizeRange", std::string("Transfer performance with buffer size in range [").append(getHumanReadableByteSize(bucketRangeMin).append(", ").append(getHumanReadableByteSize(bucketRangeMax).append("]"))));
const tcu::ScopedLogSection section(log, "Results", "Results");
const int medianBufferSize = (samples.front().bufferSize + samples.back().bufferSize) / 2;
- const float approximatedTransferTime = (theilSenFitting.offset + theilSenFitting.coefficient * medianBufferSize) / 1000.0f / 1000.0f;
- const float approximatedTransferTimeNoConstant = (theilSenFitting.coefficient * medianBufferSize) / 1000.0f / 1000.0f;
+ const float approximatedTransferTime = (theilSenFitting.offset + theilSenFitting.coefficient * (float)medianBufferSize) / 1000.0f / 1000.0f;
+ const float approximatedTransferTimeNoConstant = (theilSenFitting.coefficient * (float)medianBufferSize) / 1000.0f / 1000.0f;
const float sampleLinearity = calculateSampleFitLinearity(samples);
const float sampleTemporalStability = calculateSampleTemporalStability(samples);
- approximatedTransferRateNoConstant = medianBufferSize / approximatedTransferTimeNoConstant;
- approximatedTransferRate = medianBufferSize / approximatedTransferTime;
+ approximatedTransferRateNoConstant = (float)medianBufferSize / approximatedTransferTimeNoConstant;
+ approximatedTransferRate = (float)medianBufferSize / approximatedTransferTime;
log << tcu::TestLog::Float("ResultLinearity", "Sample linearity", "%", QP_KEY_TAG_QUALITY, sampleLinearity * 100.0f)
<< tcu::TestLog::Float("SampleTemporalStability", "Sample temporal stability", "%", QP_KEY_TAG_QUALITY, sampleTemporalStability * 100.0f)
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;
const tcu::ScopedLogSection section(log, "Results", "Results");
const int medianDataSize = (samples.front().renderDataSize + samples.back().renderDataSize) / 2;
- const float approximatedRenderTime = (theilSenFitting.offset + theilSenFitting.coefficient * medianDataSize) / 1000.0f / 1000.0f;
- const float approximatedRenderTimeNoConstant = (theilSenFitting.coefficient * medianDataSize) / 1000.0f / 1000.0f;
+ const float approximatedRenderTime = (theilSenFitting.offset + theilSenFitting.coefficient * (float)medianDataSize) / 1000.0f / 1000.0f;
+ const float approximatedRenderTimeNoConstant = (theilSenFitting.coefficient * (float)medianDataSize) / 1000.0f / 1000.0f;
const float sampleLinearity = calculateSampleFitLinearity(samples);
const float sampleTemporalStability = calculateSampleTemporalStability(samples);
- approximatedProcessingRateNoConstant = medianDataSize / approximatedRenderTimeNoConstant;
- approximatedProcessingRate = medianDataSize / approximatedRenderTime;
+ approximatedProcessingRateNoConstant = (float)medianDataSize / approximatedRenderTimeNoConstant;
+ approximatedProcessingRate = (float)medianDataSize / approximatedRenderTime;
log << tcu::TestLog::Float("ResultLinearity", "Sample linearity", "%", QP_KEY_TAG_QUALITY, sampleLinearity * 100.0f)
<< tcu::TestLog::Float("SampleTemporalStability", "Sample temporal stability", "%", QP_KEY_TAG_QUALITY, sampleTemporalStability * 100.0f)
// choose buffer sizes
for (int sampleNdx = 0; sampleNdx < m_numSamples; ++sampleNdx)
{
- const int rawBufferSize = (int)deFloatFloor(bufferSizeMin + (bufferSizeMax - bufferSizeMin) * ((float)(sampleNdx + 1) / m_numSamples));
+ const int rawBufferSize = (int)deFloatFloor((float)bufferSizeMin + (float)(bufferSizeMax - bufferSizeMin) * ((float)(sampleNdx + 1) / (float)m_numSamples));
const int bufferSize = deAlign32(rawBufferSize, 16);
- const int allocatedBufferSize = deAlign32((m_allocateLargerBuffer) ? ((int)(bufferSize * 1.5f)) : (bufferSize), 16);
+ const int allocatedBufferSize = deAlign32((m_allocateLargerBuffer) ? ((int)((float)bufferSize * 1.5f)) : (bufferSize), 16);
m_results[sampleNdx].bufferSize = bufferSize;
m_results[sampleNdx].allocatedSize = allocatedBufferSize;
// 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);
}
}
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;
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);
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
// 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
// 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;
}
{
// 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;
}
const int upperIndex = (int)(std::upper_bound(allSamples.begin(), allSamples.end(), testSample, comparer) - allSamples.begin());
const int lowerRank = lowerIndex + 1; // convert zero-indexed to rank
const int upperRank = upperIndex; // convert zero-indexed to rank, upperIndex is last equal + 1
- const float rankMidpoint = (lowerRank + upperRank) / 2.0f;
+ const float rankMidpoint = (float)(lowerRank + upperRank) / 2.0f;
sum += rankMidpoint;
}
{
const float R1 = sumOfRanks(orderedObservationsA, allSamples, comparer);
- const float U1 = n1*n2 + n1*(n1 + 1)/2 - R1;
- const float U2 = (n1 * n2) - U1;
+ const float U1 = (float)(n1*n2 + n1*(n1 + 1)/2) - R1;
+ const float U2 = (float)(n1 * n2) - U1;
const float U = de::min(U1, U2);
// \note: sample sizes might not be large enough to expect normal distribution but we do it anyway
- const float mU = n1*n2 / 2.0f;
- const float sigmaU = deFloatSqrt((n1*n2*(n1+n2+1)) / 12.0f);
+ const float mU = (float)(n1 * n2) / 2.0f;
+ const float sigmaU = deFloatSqrt((float)(n1*n2*(n1+n2+1)) / 12.0f);
const float z = (U - mU) / sigmaU;
DistributionCompareResult result;
// thresholds
if (diff <= (float)absoluteThreshold)
return false;
- if (diff <= a*relativeThreshold ||
- diff <= b*relativeThreshold)
+ if (diff <= float(a)*relativeThreshold ||
+ diff <= float(b)*relativeThreshold)
return false;
// cmp
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
static string getShaderInfoLog (const glw::Functions& gl, deUint32 shader)
{
string result;
- int infoLogLen;
+ int infoLogLen = 0;
vector<char> infoLogBuf;
gl.getShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLen);
static string getProgramInfoLog (const glw::Functions& gl, deUint32 program)
{
string result;
- int infoLogLen;
+ int infoLogLen = 0;
vector<char> infoLogBuf;
gl.getProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLen);
bool ShaderCompilerCase::compileShader (deUint32 shader) const
{
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
- GLint status;
+ GLint status = 0;
gl.compileShader(shader);
gl.getShaderiv(shader, GL_COMPILE_STATUS, &status);
return status != 0;
bool ShaderCompilerCase::linkAndUseProgram (deUint32 program) const
{
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
- GLint linkStatus;
+ GLint linkStatus = 0;
gl.linkProgram(program);
gl.getProgramiv(program, GL_LINK_STATUS, &linkStatus);
// 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.
// 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.
{
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;
{
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;
{
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;
{
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;
{
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
{
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
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);
}
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;
{
DE_UNREF(source);
DE_UNREF(type);
- DE_ASSERT(!"GetErrorCase cannot handle anything other than error codes");
+ DE_FATAL("GetErrorCase cannot handle anything other than error codes");
}
void GetErrorCase::expectError (glw::GLenum error0, glw::GLenum error1)
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
const char* const msg = "This is a debug label";
GLuint object = 0;
+ int outlen = -1;
char buffer[64];
- int outlen = 0;
switch(m_identifier)
{
break;
default:
- DE_ASSERT(!"Invalid identifier");
+ DE_FATAL("Invalid identifier");
}
gl.objectLabel(m_identifier, object, -1, msg);
case GL_FRAMEBUFFER: gl.deleteFramebuffers(1, &object); break;
default:
- DE_ASSERT(!"Invalid identifier");
+ DE_FATAL("Invalid identifier");
}
return STOP;
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
const char* const msg = "This is a debug label";
+ int outlen = -1;
char buffer[64];
- int outlen = 0;
glw::GLsync sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
GLU_EXPECT_NO_ERROR(gl.getError(), "fenceSync");
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: ");
+ int outlen = -1;
GLuint shader;
glw::GLsync sync;
char buffer[64];
- int outlen;
sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: ");
const char* const msg = "This is a debug label";
+ int outlen = -1;
GLuint shader;
glw::GLsync sync;
char buffer[64];
- int outlen;
sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: ");
const char* const msg = "This is a debug label";
const char* const clipMsg = "This is a de";
+ int outlen = -1;
GLuint shader;
glw::GLsync sync;
char buffer[64];
- int outlen;
sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: ");
const char* const msg = "This is a debug label";
+ int outlen = -1;
GLuint shader;
glw::GLsync sync;
char buffer[64];
- int outlen;
sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: ");
int maxLabelLen = -1;
+ int outlen = -1;
GLuint shader;
glw::GLsync sync;
- int outlen;
gl.getIntegerv(GL_MAX_LABEL_LENGTH, &maxLabelLen);
GLS_COLLECT_GL_ERROR(result, gl.getError(), "GL_MAX_LABEL_LENGTH");
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
tcu::ResultCollector result (m_testCtx.getLog(), " // ERROR: ");
const char* const msg = "This is a debug label";
+ int outlen = -1;
GLuint shader;
glw::GLsync sync;
- int outlen;
sync = gl.fenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
GLS_COLLECT_GL_ERROR(result, gl.getError(), "fenceSync");
case CASETYPE_GETERROR: return new GetErrorCase(ctx, name, desc, function);
default:
- DE_ASSERT(!"Invalid type");
+ DE_FATAL("Invalid type");
}
return DE_NULL;
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),
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)
, 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)
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);
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;
// 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);
return 0;
default:
- DE_ASSERT(!"Unknown format");
+ DE_FATAL("Unknown format");
return 0;
}
}
return glu::TYPE_INT_VEC4;
default:
- DE_ASSERT(!"Unknown format");
+ DE_FATAL("Unknown format");
return glu::TYPE_LAST;
}
}
return tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::SIGNED_INT32);
default:
- DE_ASSERT(!"Unknown format");
+ DE_FATAL("Unknown format");
return tcu::TextureFormat();
}
}
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();
}
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);
const int colorComponentThreshold = 20;
bool testResult = true;
- for (int x = 1; x + 1 < m_viewportSize.x(); ++x)
- for (int y = 1; y + 1 < m_viewportSize.y(); ++y)
+ for (int x = 0; x < m_viewportSize.x(); ++x)
+ for (int y = 0; y < m_viewportSize.y(); ++y)
{
- bool found = false;
- const tcu::RGBA refcolor = m_refResult->getPixel(x, y);
-
- // Got to find similar pixel near this pixel (3x3 kernel)
- for (int dx = -1; dx <= 1; ++dx)
- for (int dy = -1; dy <= 1; ++dy)
+ if (x == 0 || y == 0 || x + 1 == m_viewportSize.x() || y + 1 == m_viewportSize.y())
{
- const tcu::RGBA testColor = m_glResult->getPixel(x + dx, y + dy);
- const tcu::IVec4 colDiff = tcu::abs(testColor.toIVec() - refcolor.toIVec());
+ // Mark edge pixels as correct since their neighbourhood is undefined
+ errorMask.setPixel(x, y, green);
+ }
+ else
+ {
+ const tcu::RGBA refcolor = m_refResult->getPixel(x, y);
+ bool found = false;
- const int maxColDiff = de::max(de::max(colDiff.x(), colDiff.y()), colDiff.z()); // check RGB channels
+ // Got to find similar pixel near this pixel (3x3 kernel)
+ for (int dx = -1; dx <= 1; ++dx)
+ for (int dy = -1; dy <= 1; ++dy)
+ {
+ const tcu::RGBA testColor = m_glResult->getPixel(x + dx, y + dy);
+ const tcu::IVec4 colDiff = tcu::abs(testColor.toIVec() - refcolor.toIVec());
- if (maxColDiff <= colorComponentThreshold)
- found = true;
- }
+ const int maxColDiff = de::max(de::max(colDiff.x(), colDiff.y()), colDiff.z()); // check RGB channels
+
+ if (maxColDiff <= colorComponentThreshold)
+ found = true;
+ }
- if (!found)
- testResult = false;
+ if (!found)
+ testResult = false;
- errorMask.setPixel(x, y, (found) ? (green) : (red));
+ errorMask.setPixel(x, y, (found) ? (green) : (red));
+ }
}
if (testResult)
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);
}
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:
{
{
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;
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);
}
};
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);
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;
}
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,
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)
{
{
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)
{
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)
{
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);
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)
{
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;
}
}
{
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;
}
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;
}
}
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;
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);
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;
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
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
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;
}
}
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)
// 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);
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
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));
}
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)
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);
}
}
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;
int getDataTypeByteSize (glu::DataType type)
{
- return glu::getDataTypeScalarSize(type)*sizeof(deUint32);
+ return glu::getDataTypeScalarSize(type)*(int)sizeof(deUint32);
}
int getDataTypeByteAlignment (glu::DataType type)
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:
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);
int computeStd140BaseAlignment (const VarType& type, deUint32 layoutFlags)
{
- const int vec4Alignment = sizeof(deUint32)*4;
+ const int vec4Alignment = (int)sizeof(deUint32)*4;
if (type.isBasicType())
{
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);
// 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);
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));
}
}
, 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
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;
{
// 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);
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
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
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));
}
return getDataTypeVector(scalarType, size);
}
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
return TYPE_INVALID;
}
case VARYINGINTERPOLATION_CENTROID: return glu::INTERPOLATION_CENTROID;
case VARYINGINTERPOLATION_DEFAULT: return glu::INTERPOLATION_LAST; //!< Last means no qualifier, i.e. default
default:
- DE_ASSERT(!"Invalid interpolation");
+ DE_FATAL("Invalid interpolation");
return glu::INTERPOLATION_LAST;
}
}
case glu::INTERPOLATION_CENTROID: return VARYINGINTERPOLATION_CENTROID;
case glu::INTERPOLATION_LAST: return VARYINGINTERPOLATION_DEFAULT; //!< Last means no qualifier, i.e. default
default:
- DE_ASSERT(!"Invalid interpolation");
+ DE_FATAL("Invalid interpolation");
return VARYINGINTERPOLATION_LAST;
}
}
}
default:
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
}
if (isDataTypeScalarOrVector(basicType))
oss << exp;
break;
default:
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
}
}
else if (isDataTypeMatrix(basicType))
}
}
else
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
}
// Representation for the varyings between vertex and fragment shaders
break;
default:
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
}
}
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);
}
msg << "randomly either by name or by location.\n";
break;
default:
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
}
msg << "In the vertex shader the varyings are qualified ";
case glu::SHADERTYPE_FRAGMENT:
return createShaderProgram(DE_NULL, &src, true);
default:
- DE_ASSERT(!"Impossible case");
+ DE_FATAL("Impossible case");
}
}
return MovePtr<ProgramWrapper>(); // Shut up compiler warnings.
desc << "Varyings have same name, ";
break;
default:
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
}
describeInterpolation("vertex", vtxInterp, name, desc);
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);
}
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);
}
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);
}
}
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;
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;
{
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;
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;
// 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;
: 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)
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))
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
// 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),
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)
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";
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));
}
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:
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);
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");
{
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;
void createTexture (void)
{
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
de::Random rnd (deStringHash(getName()));
glu::TransferFormat transferFmt = glu::getTransferFormat(m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, tex);
void createTexture (void)
{
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
de::Random rnd (deStringHash(getName()));
glu::TransferFormat transferFmt = glu::getTransferFormat(m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(transferFmt.format, transferFmt.dataType));
glGenTextures (1, &tex);
glBindTexture (GL_TEXTURE_CUBE_MAP_ARRAY, tex);
{
glu::TransferFormat fmt = glu::getTransferFormat(m_texFormat);
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(fmt.format, fmt.dataType));
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, tex);
glu::TransferFormat fmt = glu::getTransferFormat(m_texFormat);
de::Random rnd (deStringHash(getName()));
deUint32 tex = 0;
- tcu::TextureLevel levelData (m_texFormat);
+ tcu::TextureLevel levelData (glu::mapGLTransferFormat(fmt.format, fmt.dataType));
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, tex);
else if (type >= TYPE_SAMPLER_1D_SHADOW && type <= TYPE_SAMPLER_2D_ARRAY_SHADOW)
return TYPE_FLOAT;
else
- DE_ASSERT(!"Unknown sampler type");
+ DE_FATAL("Unknown sampler type");
return TYPE_INVALID;
}
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
- DE_ASSERT(!"Unkown primitive type");
+ DE_FATAL("Unkown primitive type");
return glu::TYPE_INVALID;
}
return GL_RGBA8UI;
default:
- DE_ASSERT(!"Unsupported (sampler) type");
+ DE_FATAL("Unsupported (sampler) type");
return 0;
}
}
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.
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);
}
}
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
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);
}
}
{
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;
}
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);
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.
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;
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);
template <>
const char* dataTypeNameOf<Void> (void)
{
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
return DE_NULL;
}
template <>
VarType getVarTypeOf<Void> (Precision)
{
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
return VarType();
}
const float& value,
ostream& os)
{
- os << (value ? "true" : "false");
+ os << (value != 0.0f ? "true" : "false");
}
static void doPrintIVal (const FloatFormat&,
case glu::PRECISION_LOWP:
return ctx.format.ulp(ret, 2.0);
default:
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
}
return 0;
}
case glu::PRECISION_LOWP:
return ctx.format.ulp(ret, 2.0);
default:
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
}
return 0;
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
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);
}
}
case 1:
return new InOutFuncCase<Sig>(context, name, func);
default:
- DE_ASSERT(!"Impossible");
+ DE_FATAL("Impossible");
}
return DE_NULL;
}
DE_ASSERT(position <= 1.0f);
const int maxNdx = (int)values.size() - 1;
- const float floatNdx = maxNdx * position;
+ const float floatNdx = (float)maxNdx * position;
const int lowerNdx = (int)deFloatFloor(floatNdx);
const int higherNdx = lowerNdx + (lowerNdx == maxNdx ? 0 : 1); // Use only last element if position is 1.0
const float interpolationFactor = floatNdx - (float)lowerNdx;
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; }
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<>
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<>
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<>
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<>
if (isCoordinate)
switch (numComponents)
{
- case 1: coord += tcu::Vec2((float)attribValue.x(), (float)attribValue.x()); break;
- case 2: coord += tcu::Vec2((float)attribValue.x(), (float)attribValue.y()); break;
- case 3: coord += tcu::Vec2((float)attribValue.x() + attribValue.z(), (float)attribValue.y()); break;
- case 4: coord += tcu::Vec2((float)attribValue.x() + attribValue.z(), (float)attribValue.y() + attribValue.w()); break;
+ case 1: coord += tcu::Vec2((float)attribValue.x(), (float)attribValue.x()); break;
+ case 2: coord += tcu::Vec2((float)attribValue.x(), (float)attribValue.y()); break;
+ case 3: coord += tcu::Vec2((float)attribValue.x() + (float)attribValue.z(), (float)attribValue.y()); break;
+ case 4: coord += tcu::Vec2((float)attribValue.x() + (float)attribValue.z(), (float)attribValue.y() + (float)attribValue.w()); break;
default:
DE_ASSERT(false);
break;
case 2:
- color.x() = color.x() * attribValue.x();
- color.y() = color.y() * attribValue.y();
+ color.x() = color.x() * (float)attribValue.x();
+ color.y() = color.y() * (float)attribValue.y();
break;
case 3:
- color.x() = color.x() * attribValue.x();
- color.y() = color.y() * attribValue.y();
- color.z() = color.z() * attribValue.z();
+ color.x() = color.x() * (float)attribValue.x();
+ color.y() = color.y() * (float)attribValue.y();
+ color.z() = color.z() * (float)attribValue.z();
break;
case 4:
- color.x() = color.x() * attribValue.x() * attribValue.w();
- color.y() = color.y() * attribValue.y() * attribValue.w();
- color.z() = color.z() * attribValue.z() * attribValue.w();
+ color.x() = color.x() * (float)attribValue.x() * (float)attribValue.w();
+ color.y() = color.y() * (float)attribValue.y() * (float)attribValue.w();
+ color.z() = color.z() * (float)attribValue.z() * (float)attribValue.w();
break;
default:
if (min < 0 || (size_t)min > std::numeric_limits<T>::max() ||
max < 0 || (size_t)max > std::numeric_limits<T>::max() ||
min > max)
- DE_ASSERT(!"Invalid range");
+ DE_FATAL("Invalid range");
for (int elementNdx = 0; elementNdx < elementCount; ++elementNdx)
{
{
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);
else if (contextSupports(m_renderCtx.getType(), glu::ApiType::es(3,1)) || glu::isContextTypeGLCore(m_renderCtx.getType()))
useVao = true;
else
- DE_ASSERT(!"Unknown context type");
+ DE_FATAL("Unknown context type");
m_refBuffers = new sglr::ReferenceContextBuffers(m_renderCtx.getRenderTarget().getPixelFormat(), 0, 0, renderTargetWidth, renderTargetHeight, renderTargetSamples);
m_refContext = new sglr::ReferenceContext(limits, m_refBuffers->getColorbuffer(), m_refBuffers->getDepthbuffer(), m_refBuffers->getStencilbuffer());
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)
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
{
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
{
image = &builder.makeConfig<Texture2D>();
break;
default:
- DE_ASSERT(!"Impossible case");
+ DE_FATAL("Impossible case");
}
image->internalFormat = format;
image->width = width;
case GL_TEXTURE:
return "tex";
default:
- DE_ASSERT(!"Impossible case");
+ DE_FATAL("Impossible case");
}
return ""; // Shut up compiler
}
if (dynamic_cast<const Texture2DArray*>(&img) != DE_NULL)
return GL_TEXTURE_2D_ARRAY;
- DE_ASSERT(!"Impossible image type");
+ DE_FATAL("Impossible image type");
return GL_NONE;
}
gl.bindTexture(glTarget(*tex), 0);
}
else
- DE_ASSERT(!"Impossible image type");
+ DE_FATAL("Impossible image type");
return ret;
}
else if (dynamic_cast<const Texture*>(&cfg) != DE_NULL)
gl.deleteTextures(1, &img);
else
- DE_ASSERT(!"Impossible image type");
+ DE_FATAL("Impossible image type");
}
static void attachAttachment (const Attachment& att, GLenum attPoint,
gl.framebufferTextureLayer(lAtt->target, attPoint,
lAtt->imageName, lAtt->level, lAtt->layer);
else
- DE_ASSERT(!"Impossible attachment type");
+ DE_FATAL("Impossible attachment type");
}
GLenum attachmentType (const Attachment& att)
else if (dynamic_cast<const TextureAttachment*>(&att) != DE_NULL)
return GL_TEXTURE;
- DE_ASSERT(!"Impossible attachment type");
+ DE_FATAL("Impossible attachment type");
return GL_NONE;
}
dynamic_cast<const TextureLayerAttachment*>(&tAtt))
return lAtt->layer;
- DE_ASSERT(!"Impossible attachment type");
+ DE_FATAL("Impossible attachment type");
return 0;
}
case GL_RENDERBUFFER:
return de::lookupDefault(rbos, imgName, DE_NULL);
default:
- DE_ASSERT(!"Bad image type");
+ DE_FATAL("Bad image type");
}
return DE_NULL; // shut up compiler warning
}
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;
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);
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;
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;
{
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);
<< 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"
}
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;
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.
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;
WeightEquation weightEquation)
{
// allow interpolation weights anywhere in the central subpixels
- const float testSquareSize = (2.0f / (1UL << subpixelBits));
+ const float testSquareSize = (2.0f / (float)(1UL << subpixelBits));
const float testSquarePos = (0.5f - testSquareSize / 2);
const tcu::Vec2 corners[4] =
{
- tcu::Vec2(pixel.x() + testSquarePos + 0.0f, pixel.y() + testSquarePos + 0.0f),
- tcu::Vec2(pixel.x() + testSquarePos + 0.0f, pixel.y() + testSquarePos + testSquareSize),
- tcu::Vec2(pixel.x() + testSquarePos + testSquareSize, pixel.y() + testSquarePos + testSquareSize),
- tcu::Vec2(pixel.x() + testSquarePos + testSquareSize, pixel.y() + testSquarePos + 0.0f),
+ tcu::Vec2((float)pixel.x() + testSquarePos + 0.0f, (float)pixel.y() + testSquarePos + 0.0f),
+ tcu::Vec2((float)pixel.x() + testSquarePos + 0.0f, (float)pixel.y() + testSquarePos + testSquareSize),
+ tcu::Vec2((float)pixel.x() + testSquarePos + testSquareSize, (float)pixel.y() + testSquarePos + testSquareSize),
+ tcu::Vec2((float)pixel.x() + testSquarePos + testSquareSize, (float)pixel.y() + testSquarePos + 0.0f),
};
// calculate interpolation as a line
{
// 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] =
{
// 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] =
const tcu::Vec3 valueRangeMax = tcu::Vec3(colorStackMax.xyz());
const tcu::IVec3 formatLimit ((1 << args.redBits) - 1, (1 << args.greenBits) - 1, (1 << args.blueBits) - 1);
- const tcu::Vec3 colorMinF (de::clamp(valueRangeMin.x() * formatLimit.x(), 0.0f, (float)formatLimit.x()),
- de::clamp(valueRangeMin.y() * formatLimit.y(), 0.0f, (float)formatLimit.y()),
- de::clamp(valueRangeMin.z() * formatLimit.z(), 0.0f, (float)formatLimit.z()));
- const tcu::Vec3 colorMaxF (de::clamp(valueRangeMax.x() * formatLimit.x(), 0.0f, (float)formatLimit.x()),
- de::clamp(valueRangeMax.y() * formatLimit.y(), 0.0f, (float)formatLimit.y()),
- de::clamp(valueRangeMax.z() * formatLimit.z(), 0.0f, (float)formatLimit.z()));
+ const tcu::Vec3 colorMinF (de::clamp(valueRangeMin.x() * (float)formatLimit.x(), 0.0f, (float)formatLimit.x()),
+ de::clamp(valueRangeMin.y() * (float)formatLimit.y(), 0.0f, (float)formatLimit.y()),
+ de::clamp(valueRangeMin.z() * (float)formatLimit.z(), 0.0f, (float)formatLimit.z()));
+ const tcu::Vec3 colorMaxF (de::clamp(valueRangeMax.x() * (float)formatLimit.x(), 0.0f, (float)formatLimit.x()),
+ de::clamp(valueRangeMax.y() * (float)formatLimit.y(), 0.0f, (float)formatLimit.y()),
+ de::clamp(valueRangeMax.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()));
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());
}
}
}
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()));
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() ||
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
// 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);
break;
default:
- DE_ASSERT(!"Unsupported version");
+ DE_FATAL("Unsupported version");
}
return glu::makeVtxFragSources(tcu::StringTemplate(vtxSource).specialize(params), tcu::StringTemplate(frgSource).specialize(params));
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(),
}
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);
case CLEAR_COLOR_FLOAT:
retval.colorFmt = GL_RGBA16F;
retval.texFmt = tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::HALF_FLOAT);
- DE_ASSERT(!"Floating point clear not implemented");// \todo [2014-1-23 otto] pixel read format & type, nothing guaranteed, need extension...
+ DE_FATAL("Floating point clear not implemented");// \todo [2014-1-23 otto] pixel read format & type, nothing guaranteed, need extension...
break;
case CLEAR_COLOR_INT:
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++)
{
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));
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);
{
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));
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);
{
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;
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;
return version != glu::GLSL_VERSION_100_ES;
}
+static int queryGLInt (const glu::RenderContext& renderCtx, deUint32 pname)
+{
+ const glw::Functions& gl = renderCtx.getFunctions();
+ glw::GLint value = 0;
+
+ gl.getIntegerv(pname, &value);
+ GLU_EXPECT_NO_ERROR(gl.getError(), ("query " + de::toString(glu::getGettableStateStr(pname))).c_str());
+
+ return value;
+}
+
ShaderCase::ValueBlock::ValueBlock (void)
: arrayLength(0)
{
case TYPE_SAMPLER_2D:
case TYPE_SAMPLER_CUBE:
- DE_ASSERT(!"implement!");
+ DE_FATAL("implement!");
break;
default:
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
{
// 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");
return withExt;
}
-static map<string, string> generateVertexSpecialization (glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
+static map<string, string> generateVertexSpecialization (const glu::RenderContext& renderCtx, glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
{
const bool usesInout = usesShaderInoutQualifiers(targetVersion);
const char* vtxIn = usesInout ? "in" : "attribute";
ostringstream setup;
map<string, string> params;
+ DE_UNREF(renderCtx);
+
decl << vtxIn << " highp vec4 dEQP_Position;\n";
for (int ndx = 0; ndx < (int)valueBlock.values.size(); ndx++)
return params;
}
-static map<string, string> generateFragmentSpecialization (glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
+static map<string, string> generateFragmentSpecialization (const glu::RenderContext& renderCtx, glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
{
const bool usesInout = usesShaderInoutQualifiers(targetVersion);
const bool customColorOut = usesInout;
ostringstream output;
map<string, string> params;
+ DE_UNREF(renderCtx);
+
genCompareFunctions(decl, valueBlock, false);
genCompareOp(output, fragColor, valueBlock, "", DE_NULL);
return params;
}
-static map<string, string> generateGeometrySpecialization (glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
+static map<string, string> generateGeometrySpecialization (const glu::RenderContext& renderCtx, glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
{
ostringstream decl;
map<string, string> params;
+ DE_UNREF(renderCtx);
DE_UNREF(targetVersion);
decl << "layout (triangles) in;\n";
return params;
}
-static map<string, string> generateTessControlSpecialization (glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
+static map<string, string> generateTessControlSpecialization (const glu::RenderContext& renderCtx, glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
{
ostringstream decl;
ostringstream output;
params.insert(pair<string, string>("TESSELLATION_CONTROL_DECLARATIONS", decl.str()));
params.insert(pair<string, string>("TESSELLATION_CONTROL_OUTPUT", output.str()));
+ params.insert(pair<string, string>("GL_MAX_PATCH_VERTICES", de::toString(queryGLInt(renderCtx, GL_MAX_PATCH_VERTICES))));
return params;
}
-static map<string, string> generateTessEvalSpecialization (glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
+static map<string, string> generateTessEvalSpecialization (const glu::RenderContext& renderCtx, glu::GLSLVersion targetVersion, const ShaderCase::ValueBlock& valueBlock)
{
ostringstream decl;
ostringstream output;
params.insert(pair<string, string>("TESSELLATION_EVALUATION_DECLARATIONS", decl.str()));
params.insert(pair<string, string>("TESSELLATION_EVALUATION_OUTPUT", output.str()));
+ params.insert(pair<string, string>("GL_MAX_PATCH_VERTICES", de::toString(queryGLInt(renderCtx, GL_MAX_PATCH_VERTICES))));
return params;
}
-static void specializeShaders (glu::ProgramSources& dst, glu::ShaderType shaderType, const std::vector<std::string>& sources, const ShaderCase::ValueBlock& valueBlock, glu::GLSLVersion targetVersion, const std::vector<ShaderCase::CaseRequirement>& requirements, std::map<std::string, std::string> (*specializationGenerator)(glu::GLSLVersion, const ShaderCase::ValueBlock&))
+static void specializeShaders (const glu::RenderContext& renderCtx,
+ glu::ProgramSources& dst,
+ glu::ShaderType shaderType,
+ const std::vector<std::string>& sources,
+ const ShaderCase::ValueBlock& valueBlock,
+ glu::GLSLVersion targetVersion,
+ const std::vector<ShaderCase::CaseRequirement>& requirements,
+ std::map<std::string, std::string> (*specializationGenerator)(const glu::RenderContext&, glu::GLSLVersion, const ShaderCase::ValueBlock&))
{
if (!sources.empty())
{
- const std::map<std::string, std::string> specializationParams = specializationGenerator(targetVersion, valueBlock);
+ const std::map<std::string, std::string> specializationParams = specializationGenerator(renderCtx, targetVersion, valueBlock);
for (int ndx = 0; ndx < (int)sources.size(); ++ndx)
{
void ShaderCase::specializeVertexShaders (glu::ProgramSources& dst, const std::vector<std::string>& sources, const ValueBlock& valueBlock, const std::vector<ShaderCase::CaseRequirement>& requirements) const
{
- specializeShaders(dst, glu::SHADERTYPE_VERTEX, sources, valueBlock, m_targetVersion, requirements, generateVertexSpecialization);
+ specializeShaders(m_renderCtx, dst, glu::SHADERTYPE_VERTEX, sources, valueBlock, m_targetVersion, requirements, generateVertexSpecialization);
}
void ShaderCase::specializeFragmentShaders (glu::ProgramSources& dst, const std::vector<std::string>& sources, const ValueBlock& valueBlock, const std::vector<ShaderCase::CaseRequirement>& requirements) const
{
- specializeShaders(dst, glu::SHADERTYPE_FRAGMENT, sources, valueBlock, m_targetVersion, requirements, generateFragmentSpecialization);
+ specializeShaders(m_renderCtx, dst, glu::SHADERTYPE_FRAGMENT, sources, valueBlock, m_targetVersion, requirements, generateFragmentSpecialization);
}
void ShaderCase::specializeGeometryShaders (glu::ProgramSources& dst, const std::vector<std::string>& sources, const ValueBlock& valueBlock, const std::vector<ShaderCase::CaseRequirement>& requirements) const
{
- specializeShaders(dst, glu::SHADERTYPE_GEOMETRY, sources, valueBlock, m_targetVersion, requirements, generateGeometrySpecialization);
+ specializeShaders(m_renderCtx, dst, glu::SHADERTYPE_GEOMETRY, sources, valueBlock, m_targetVersion, requirements, generateGeometrySpecialization);
}
void ShaderCase::specializeTessControlShaders (glu::ProgramSources& dst, const std::vector<std::string>& sources, const ValueBlock& valueBlock, const std::vector<ShaderCase::CaseRequirement>& requirements) const
{
- specializeShaders(dst, glu::SHADERTYPE_TESSELLATION_CONTROL, sources, valueBlock, m_targetVersion, requirements, generateTessControlSpecialization);
+ specializeShaders(m_renderCtx, dst, glu::SHADERTYPE_TESSELLATION_CONTROL, sources, valueBlock, m_targetVersion, requirements, generateTessControlSpecialization);
}
void ShaderCase::specializeTessEvalShaders (glu::ProgramSources& dst, const std::vector<std::string>& sources, const ValueBlock& valueBlock, const std::vector<ShaderCase::CaseRequirement>& requirements) const
{
- specializeShaders(dst, glu::SHADERTYPE_TESSELLATION_EVALUATION, sources, valueBlock, m_targetVersion, requirements, generateTessEvalSpecialization);
+ specializeShaders(m_renderCtx, dst, glu::SHADERTYPE_TESSELLATION_EVALUATION, sources, valueBlock, m_targetVersion, requirements, generateTessEvalSpecialization);
}
void ShaderCase::dumpValues (const ValueBlock& valueBlock, int arrayNdx)
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)
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);
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;
}
}
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);
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;
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));
}
}
}
if (!hasAlpha)
color.w() = 1.0f;
- result.setPixel(x, y, toRGBA(color));
+ result.setPixel(x, y, tcu::RGBA(color));
}
}
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++)
{
result.variance += (val - result.mean) * (val - result.mean);
}
- result.variance /= values.size();
+ result.variance /= (double)values.size();
{
const int n = (int)(values.size()/2);
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));
}
}
sum += (value - avg) * (value - avg);
}
- return sum / values.size();
+ return sum / (double)values.size();
}
deUint64 findMin (const vector<deUint64>& values)
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)
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)
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)
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;
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;
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;
{
if (isMultisampleTarget(target) && isSamplerStateTester(tester))
{
- DE_ASSERT(!"Multisample textures have no sampler state");
+ DE_FATAL("Multisample textures have no sampler state");
return DE_NULL;
}
if (target == GL_TEXTURE_BUFFER)
{
- DE_ASSERT(!"Buffer textures have no texture state");
+ DE_FATAL("Buffer textures have no texture state");
return DE_NULL;
}
if (target != GL_TEXTURE_3D && mapTesterToPname(tester) == GL_TEXTURE_WRAP_R)
{
- DE_ASSERT(!"Only 3D textures have wrap r filter");
+ DE_FATAL("Only 3D textures have wrap r filter");
return DE_NULL;
}
params["FRAG_COLOR"] = "dEQP_FragColor";
}
else
- DE_ASSERT(!"Unsupported version");
+ DE_FATAL("Unsupported version");
params["PRECISION"] = glu::getPrecisionName(m_texCoordPrecision);
}
}
else
- DE_ASSERT(!"Unsupported version");
+ DE_FATAL("Unsupported version");
params["SAMPLER_TYPE"] = sampler;
params["LOOKUP"] = lookup;
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;
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,
(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)
int getDataTypeByteSize (glu::DataType type)
{
- return glu::getDataTypeScalarSize(type)*sizeof(deUint32);
+ return glu::getDataTypeScalarSize(type)*(int)sizeof(deUint32);
}
int getDataTypeByteAlignment (glu::DataType type)
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:
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);
{
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.
int computeStd140BaseAlignment (const VarType& type)
{
- const int vec4Alignment = sizeof(deUint32)*4;
+ const int vec4Alignment = (int)sizeof(deUint32)*4;
if (type.isBasicType())
{
{
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);
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<>
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<>
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<>
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<>
if (isCoordinate)
switch (numComponents)
{
- case 1: coord = tcu::Vec2((float)attribValue.x(), (float)attribValue.x()); break;
- case 2: coord = tcu::Vec2((float)attribValue.x(), (float)attribValue.y()); break;
- case 3: coord = tcu::Vec2((float)attribValue.x() + attribValue.z(), (float)attribValue.y()); break;
- case 4: coord = tcu::Vec2((float)attribValue.x() + attribValue.z(), (float)attribValue.y() + attribValue.w()); break;
+ case 1: coord = tcu::Vec2((float)attribValue.x(), (float)attribValue.x()); break;
+ case 2: coord = tcu::Vec2((float)attribValue.x(), (float)attribValue.y()); break;
+ case 3: coord = tcu::Vec2((float)attribValue.x() + (float)attribValue.z(), (float)attribValue.y()); break;
+ case 4: coord = tcu::Vec2((float)attribValue.x() + (float)attribValue.z(), (float)attribValue.y() + (float)attribValue.w()); break;
default:
DE_ASSERT(false);
break;
case 2:
- color.x() = color.x() * attribValue.x();
- color.y() = color.y() * attribValue.y();
+ color.x() = color.x() * (float)attribValue.x();
+ color.y() = color.y() * (float)attribValue.y();
break;
case 3:
- color.x() = color.x() * attribValue.x();
- color.y() = color.y() * attribValue.y();
- color.z() = color.z() * attribValue.z();
+ color.x() = color.x() * (float)attribValue.x();
+ color.y() = color.y() * (float)attribValue.y();
+ color.z() = color.z() * (float)attribValue.z();
break;
case 4:
- color.x() = color.x() * attribValue.x() * attribValue.w();
- color.y() = color.y() * attribValue.y() * attribValue.w();
- color.z() = color.z() * attribValue.z() * attribValue.w();
+ color.x() = color.x() * (float)attribValue.x() * (float)attribValue.w();
+ color.y() = color.y() * (float)attribValue.y() * (float)attribValue.w();
+ color.z() = color.z() * (float)attribValue.z() * (float)attribValue.w();
break;
default:
, 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))))
{
}
m_isOk = true;
- for (int y = 1; y < ref.getHeight()-1; y++)
+ for (int y = 0; y < ref.getHeight(); y++)
{
- for (int x = 1; x < ref.getWidth()-1; x++)
+ for (int x = 0; x < ref.getWidth(); x++)
{
tcu::RGBA refPixel = ref.getPixel(x, y);
tcu::RGBA screenPixel = screen.getPixel(x, y);
bool isOkPixel = false;
+ if (y == 0 || y + 1 == ref.getHeight() || x == 0 || x + 1 == ref.getWidth())
+ {
+ // Don't check borders since the pixel neighborhood is undefined
+ error.setPixel(x, y, tcu::RGBA(screenPixel.getRed(), (screenPixel.getGreen() + 255) / 2, screenPixel.getBlue(), 255));
+ continue;
+ }
+
// Don't do comparisons for this pixel if it belongs to a one-pixel-thin part (i.e. it doesn't have similar-color neighbors in both x and y directions) in both result and reference.
// This fixes some false negatives.
bool refThin = (!tcu::compareThreshold(refPixel, ref.getPixel(x-1, y ), threshold) && !tcu::compareThreshold(refPixel, ref.getPixel(x+1, y ), threshold)) ||
// 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;
// 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;
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; }
(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++)
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)
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));
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));
}
};
ptrns.append(line)
return ptrns
-def applyPatterns (caseList, patterns, op):
+def applyPatterns (caseList, patterns, filename, op):
matched = set()
errors = []
curList = copy(caseList)
print "ERROR: %s: %s" % (reason, pattern)
if len(errors) > 0:
- die("Found %s invalid patterns" % len(errors))
+ die("Found %s invalid patterns while processing file %s" % (len(errors), filename))
return [c for c in caseList if op(c in matched)]
-def applyInclude (caseList, patterns):
- return applyPatterns(caseList, patterns, lambda b: b)
+def applyInclude (caseList, patterns, filename):
+ return applyPatterns(caseList, patterns, filename, lambda b: b)
-def applyExclude (caseList, patterns):
- return applyPatterns(caseList, patterns, lambda b: not b)
+def applyExclude (caseList, patterns, filename):
+ return applyPatterns(caseList, patterns, filename, lambda b: not b)
def readPatternLists (mustpass):
lists = {}
for filter in filters:
ptrnList = patternLists[filter.filename]
if filter.type == Filter.TYPE_INCLUDE:
- res = applyInclude(res, ptrnList)
+ res = applyInclude(res, ptrnList, filter.filename)
else:
assert filter.type == Filter.TYPE_EXCLUDE
- res = applyExclude(res, ptrnList)
+ res = applyExclude(res, ptrnList, filter.filename)
return res
def appendToHierarchy (root, casePath):
filters = MASTER_EGL_COMMON_FILTERS),
])
-MASTER_GLES2_COMMON_FILTERS = [include("gles2-master.txt"), exclude("gles2-failures.txt")]
+MASTER_GLES2_COMMON_FILTERS = [
+ include("gles2-master.txt"),
+ exclude("gles2-test-issues.txt"),
+ exclude("gles2-failures.txt")
+ ]
MASTER_GLES2_PKG = Package(module = GLES2_MODULE, configurations = [
# Master
Configuration(name = "master",
exclude("gles31-hw-issues.txt"),
exclude("gles31-test-issues.txt"),
exclude("gles31-spec-issues.txt"),
+ exclude("gles31-new-tests.txt"),
]
MASTER_GLES31_PKG = Package(module = GLES31_MODULE, configurations = [
# Master
"EGL_EXT_platform_base",
"EGL_EXT_platform_x11",
"EGL_ANDROID_image_native_buffer",
- "EGL_EXT_yuv_surface"
+ "EGL_EXT_yuv_surface",
+ "EGL_EXT_buffer_age",
+ "EGL_KHR_partial_update",
+ "EGL_KHR_swap_buffers_with_damage"
]
PROTECTS = [
"KHRONOS_SUPPORT_INT64"
"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"))
null/tcuNullPlatform.hpp
null/tcuNullRenderContext.cpp
null/tcuNullRenderContext.hpp
+ null/tcuNullContextFactory.cpp
+ null/tcuNullContextFactory.hpp
)