Skip to content

Commit

Permalink
Fix pointer error from real bool type
Browse files Browse the repository at this point in the history
Having replaced deBool with real bool it is no longer guaranteed to be
the size of an int. This means that we need to be careful when copying
from a shader buffer where bools are 4 bytes.

In this example, from findLSBZero, 'bool comparison' was a single byte,
placed before 'int32_t res', meaning that the first 3 bytes of 'res'
were overwritten by 'comparison'.

Components: OpenGLES
Affects: dEQP-GLES31.functional.shaders.builtin_functions.uniform.*

Change-Id: I6c9c0512f97598ac4a3bca5164e1e6400ec7c321
  • Loading branch information
gnl21 authored and lordalcol committed May 31, 2024
1 parent 15b5cd8 commit c231733
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,8 @@ void UniformIntegerFunctionCase::deinit(void)
void UniformIntegerFunctionCase::init(void)
{
std::ostringstream oss;
oss << "result = " << getFunctionName()
<< "(value);\n"
"comparison = ("
<< getFunctionName() << "(value) == " << computeExpectedResult(m_input) << ");\n";
oss << "result = " << getFunctionName() << "(value);\n"
<< "comparison = (" << getFunctionName() << "(value) == " << computeExpectedResult(m_input) << ");\n";
m_spec.source = oss.str();

DE_ASSERT(!m_executor);
Expand All @@ -117,7 +115,7 @@ void UniformIntegerFunctionCase::init(void)
tcu::TestNode::IterateResult UniformIntegerFunctionCase::iterate(void)
{
int32_t result;
bool comparison;
int32_t comparison; // A bool in the shader, but we must use a 32-bit type to copy out into.
vector<void *> outputPointers(2);

outputPointers[0] = &result;
Expand Down

0 comments on commit c231733

Please sign in to comment.