Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support GL_ARB_texture_multisample extension. #3430

Merged
merged 3 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Test/GL_ARB_texture_multisample.vert
ncesario-lunarg marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#version 140
#extension GL_ARB_texture_multisample : enable

out float result;

uniform sampler2DMS data;
uniform sampler2DMSArray data1;
void main()
{
result = texelFetch(data, ivec2(0), 3).r;
ivec2 temp = textureSize(data);
result = texelFetch(data1, ivec3(0), 3).r;
ivec3 temp1 = textureSize(data1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice if these were indented. Not sure if we want that enforced @arcady-lunarg?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have organized the format @ncesario-lunarg

}
101 changes: 101 additions & 0 deletions Test/baseResults/GL_ARB_texture_multisample.vert.out
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not the desired output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your reminder, I have update the test file and expected result file.

Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
GL_ARB_texture_multisample.vert
Shader version: 140
Requested GL_ARB_texture_multisample
0:? Sequence
0:8 Function Definition: main( ( global void)
0:8 Function Parameters:
0:10 Sequence
0:10 move second child to first child ( temp float)
0:10 'result' ( smooth out float)
0:10 direct index ( temp float)
0:10 textureFetch ( global 4-component vector of float)
0:10 'data' ( uniform sampler2DMS)
0:10 Constant:
0:10 0 (const int)
0:10 0 (const int)
0:10 Constant:
0:10 3 (const int)
0:10 Constant:
0:10 0 (const int)
0:11 Sequence
0:11 move second child to first child ( temp 2-component vector of int)
0:11 'temp' ( temp 2-component vector of int)
0:11 textureSize ( global 2-component vector of int)
0:11 'data' ( uniform sampler2DMS)
0:12 move second child to first child ( temp float)
0:12 'result' ( smooth out float)
0:12 direct index ( temp float)
0:12 textureFetch ( global 4-component vector of float)
0:12 'data1' ( uniform sampler2DMSArray)
0:12 Constant:
0:12 0 (const int)
0:12 0 (const int)
0:12 0 (const int)
0:12 Constant:
0:12 3 (const int)
0:12 Constant:
0:12 0 (const int)
0:13 Sequence
0:13 move second child to first child ( temp 3-component vector of int)
0:13 'temp1' ( temp 3-component vector of int)
0:13 textureSize ( global 3-component vector of int)
0:13 'data1' ( uniform sampler2DMSArray)
0:? Linker Objects
0:? 'result' ( smooth out float)
0:? 'data' ( uniform sampler2DMS)
0:? 'data1' ( uniform sampler2DMSArray)
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)


Linked vertex stage:


Shader version: 140
Requested GL_ARB_texture_multisample
0:? Sequence
0:8 Function Definition: main( ( global void)
0:8 Function Parameters:
0:10 Sequence
0:10 move second child to first child ( temp float)
0:10 'result' ( smooth out float)
0:10 direct index ( temp float)
0:10 textureFetch ( global 4-component vector of float)
0:10 'data' ( uniform sampler2DMS)
0:10 Constant:
0:10 0 (const int)
0:10 0 (const int)
0:10 Constant:
0:10 3 (const int)
0:10 Constant:
0:10 0 (const int)
0:11 Sequence
0:11 move second child to first child ( temp 2-component vector of int)
0:11 'temp' ( temp 2-component vector of int)
0:11 textureSize ( global 2-component vector of int)
0:11 'data' ( uniform sampler2DMS)
0:12 move second child to first child ( temp float)
0:12 'result' ( smooth out float)
0:12 direct index ( temp float)
0:12 textureFetch ( global 4-component vector of float)
0:12 'data1' ( uniform sampler2DMSArray)
0:12 Constant:
0:12 0 (const int)
0:12 0 (const int)
0:12 0 (const int)
0:12 Constant:
0:12 3 (const int)
0:12 Constant:
0:12 0 (const int)
0:13 Sequence
0:13 move second child to first child ( temp 3-component vector of int)
0:13 'temp1' ( temp 3-component vector of int)
0:13 textureSize ( global 3-component vector of int)
0:13 'data1' ( uniform sampler2DMSArray)
0:? Linker Objects
0:? 'result' ( smooth out float)
0:? 'data' ( uniform sampler2DMS)
0:? 'data1' ( uniform sampler2DMSArray)
0:? 'gl_VertexID' ( gl_VertexId int VertexId)
0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId)

2 changes: 1 addition & 1 deletion glslang/MachineIndependent/Initialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6278,7 +6278,7 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
{
if ((ms || image) && shadow)
continue;
if (ms && profile != EEsProfile && version < 150)
if (ms && profile != EEsProfile && version < 140)
continue;
if (ms && image && profile == EEsProfile)
continue;
Expand Down
6 changes: 5 additions & 1 deletion glslang/MachineIndependent/ParseHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,11 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
requireInt16Arithmetic(loc, "built-in function", "(u)int16 types can only be in uniform block or buffer storage");
if (builtIn && fnCandidate->getType().contains8BitInt())
requireInt8Arithmetic(loc, "built-in function", "(u)int8 types can only be in uniform block or buffer storage");

if (builtIn && (fnCandidate->getBuiltInOp() == EOpTextureFetch || fnCandidate->getBuiltInOp() == EOpTextureQuerySize)) {
TString typeName = (*fnCandidate)[0].type->getSampler().getString();
if ((typeName == "sampler2DMS" || typeName == "sampler2DMSArray") && version <= 140)
arcady-lunarg marked this conversation as resolved.
Show resolved Hide resolved
requireExtensions(loc, 1, &E_GL_ARB_texture_multisample, fnCandidate->getName().c_str());
}
if (arguments != nullptr) {
// Make sure qualifications work for these arguments.
TIntermAggregate* aggregate = arguments->getAsAggregate();
Expand Down
1 change: 1 addition & 0 deletions gtests/AST.FromFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ INSTANTIATE_TEST_SUITE_P(
"GL_ARB_draw_instanced.vert",
"GL_ARB_fragment_coord_conventions.vert",
"GL_ARB_bindless_texture.frag",
"GL_ARB_texture_multisample.vert",
"BestMatchFunction.vert",
"EndStreamPrimitive.geom",
"floatBitsToInt.vert",
Expand Down