I'm trying to get SDL to use "direct3d11" as the render driver, since "direct3d" does not support SDL_BLENDOPERATION_MAXIMUM.
According to this post on a related question, I should be able to see "direct3d11" as a renderer driver by looping through SDL's render drivers and printing them out.
However, the only drivers that I get are "direct3d", "opengl", "opengles2", and "software".
I tried doing what was suggested here but setting SDL_HINT_RENDER_DRIVER obviously has no effect since it doesn't even see "direct3d11" as an option (though oddly it doesn't give an error).
Unfortunately, that thread seems to have run dry, and general googling has been unhelpful.
So... why don't I see "direct3d11" as an option?
Is this expected behavior?
Am I missing a step in SDL?
Is there some sort of Windows config I have to change?
Is there a special library I need to include for it to work?
Is there a magic compiler setting or define or something I need to set?
Does this test code work on other people's machines?
Any info or help would be appreciated.
Some technical details:
OS: Windows 10 (x64)
GPU: GeForce RTX 2060 (dxdiag lists Feature Levels as "12_1,12_0,11_1,11_0,10_1,10_0,9_3,9_2,9_1")
I'm using Visual Studio 2017 (15.9.11)
Using SDL version 2.0.10
SDL defaults to "direct3d" as the render driver when creating an SDL_Renderer (not shown in test code)
Test code:
#include <SDL.h>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
// init
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
std::cout << "SDL could not be initialized: " << SDL_GetError() << std::endl;
}
// print SDL version
SDL_version linked;
SDL_GetVersion(&linked);
printf("SDL version %d.%d.%d\n", linked.major, linked.minor, linked.patch);
// print size_t (see if 32 or 64 bit)
cout << sizeof(size_t) << endl;
// try to set hint
cout << SDL_SetHintWithPriority(SDL_HINT_RENDER_DRIVER, "direct3d11", SDL_HINT_OVERRIDE) << endl;
// print render drivers
cout << endl;
for (int i = 0; i < SDL_GetNumRenderDrivers(); i++){
SDL_RendererInfo rendererInfo = {};
SDL_GetRenderDriverInfo(i, &rendererInfo);
cout << rendererInfo.name << endl;
}
cout << endl;
return 0;
}
Result (64 bit compilation):
SDL version 2.0.10
8
1
direct3d
opengl
opengles2
software
Result (32 bit compilation):
SDL version 2.0.10
4
1
direct3d
opengl
opengles2
software
If you need more info, please let me know. I'm willing to test things if it would help.